Running and visualising a PROCESS scan¶
Perform a parameter scan for a given input file and plot the results.
Scan details¶
The input file is a scan-enabled version of the large tokamak IN.DAT, as found in the tests directory. The scan-relevant values are:
nsweep = 17 * b_tf_inboard_max, maximum peak toroidal field (T) (constraint equation 25)
isweep = 6
sweep = 10.5, 10.4, 10.3, 10.2, 10.1, 10.0
nsweep: integer denoting the variable to scan (seescan_modulefor options). Here17corresponds tob_tf_inboard_maxbeing scannedisweep: the number of scan points to runsweep: array of values for the scanned variable to take; one for each run. Should be of lengthisweep
In [1]:
Copied!
from process.core.repository import get_process_root
from process.main import SingleRun
data_dir = get_process_root() / "../examples/data/"
input_name = data_dir / "scan_example_file_IN.DAT"
# Perform a SingleRun on a scan-enabled input file
single_run = SingleRun(str(input_name), solver="vmcon_bounded")
single_run.run()
from process.core.repository import get_process_root
from process.main import SingleRun
data_dir = get_process_root() / "../examples/data/"
input_name = data_dir / "scan_example_file_IN.DAT"
# Perform a SingleRun on a scan-enabled input file
single_run = SingleRun(str(input_name), solver="vmcon_bounded")
single_run.run()
The IN.DAT file does not contain any obsolete variables. ************************************************************************************************************** ************************************************** PROCESS *************************************************** ************************************** Power Reactor Optimisation Code *************************************** ************************************************************************************************************** Version : 3.3.1.dev34+g6d036d5d5 Git Tag : v3.3.0-34-g6d036d5d Git Branch : main Date : 26/02/2026 UTC Time : 16:30 User : runner Computer : runnervmnay03 Directory : /home/runner/work/PROCESS/PROCESS Input : /home/runner/work/PROCESS/PROCESS/examples/data/scan_example_file_IN.DAT Run title : Generic large tokamak Run type : Reactor concept design: Pulsed tokamak model, (c) UK Atomic Energy Authority ************************************************************************************************************** Equality constraints : 3 Inequality constraints : 23 Total constraints : 26 Iteration variables : 20 Max iterations : 200 Figure of merit : +1 -- minimise major radius Convergence parameter : 1e-07 ************************************************************************************************************** Starting scan point 1 of 6 : Max_toroidal_field_(T) , b_tf_inboard_max = 10.5
/home/runner/work/PROCESS/PROCESS/process/core/init.py:92: UserWarning: Lower limit of volume averaged electron temperature (temp_plasma_electron_vol_avg_kev) has been raised to ensure temp_plasma_electron_vol_avg_kev > temp_plasma_pedestal_kev check_process(inputs) /home/runner/work/PROCESS/PROCESS/process/core/init.py:92: UserWarning: temp_cs_superconductor_margin_min and tmargmin should not both be specified in IN.DAT temp_cs_superconductor_margin_min has been ignored check_process(inputs)
/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:7176: RuntimeWarning: divide by zero encountered in scalar divide * (nd_plasma_pedestal_electron / n_greenwald) ** -0.174
1 | Convergence Parameter: 7.240E-01
/home/runner/work/PROCESS/PROCESS/process/models/physics/current_drive.py:2154: RuntimeWarning: invalid value encountered in scalar divide * (c_hcd_driven / p_hcd_injected)
2 | Convergence Parameter: 4.446E-01
3 | Convergence Parameter: 9.801E-02
4 | Convergence Parameter: 3.803E-02
5 | Convergence Parameter: 4.481E-06
6 | Convergence Parameter: 1.019E-10
7 | Convergence Parameter: 1.039E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:6017) Diamagnetic fraction is more than 1%, but not calculated. Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1 (/home/runner/work/PROCESS/PROCESS/process/models/tfcoil/base.py:236) dr_tf_plasma_case too small to accommodate the WP, forced to minimum value Starting scan point 2 of 6 : Max_toroidal_field_(T) , b_tf_inboard_max = 10.4
1 | Convergence Parameter: 3.097E-03
2 | Convergence Parameter: 2.129E-07
3 | Convergence Parameter: 1.378E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:6017) Diamagnetic fraction is more than 1%, but not calculated. Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1 (/home/runner/work/PROCESS/PROCESS/process/models/tfcoil/base.py:236) dr_tf_plasma_case too small to accommodate the WP, forced to minimum value Starting scan point 3 of 6 : Max_toroidal_field_(T) , b_tf_inboard_max = 10.3
1 | Convergence Parameter: 3.720E-03
2 | Convergence Parameter: 2.244E-07
3 | Convergence Parameter: 1.362E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:6017) Diamagnetic fraction is more than 1%, but not calculated. Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1 (/home/runner/work/PROCESS/PROCESS/process/models/tfcoil/base.py:236) dr_tf_plasma_case too small to accommodate the WP, forced to minimum value Starting scan point 4 of 6 : Max_toroidal_field_(T) , b_tf_inboard_max = 10.2
1 | Convergence Parameter: 4.585E-03
2 | Convergence Parameter: 8.164E-04
3 | Convergence Parameter: 2.361E-09
4 | Convergence Parameter: 3.295E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:5949) Predicted plasma driven current is more than upper limit on non-inductive fraction (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:6017) Diamagnetic fraction is more than 1%, but not calculated. Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1 (/home/runner/work/PROCESS/PROCESS/process/models/tfcoil/base.py:236) dr_tf_plasma_case too small to accommodate the WP, forced to minimum value Starting scan point 5 of 6 : Max_toroidal_field_(T) , b_tf_inboard_max = 10.1
1 | Convergence Parameter: 7.083E-03
2 | Convergence Parameter: 3.395E-07
3 | Convergence Parameter: 1.464E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:5949) Predicted plasma driven current is more than upper limit on non-inductive fraction (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:6017) Diamagnetic fraction is more than 1%, but not calculated. Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1 (/home/runner/work/PROCESS/PROCESS/process/models/tfcoil/base.py:236) dr_tf_plasma_case too small to accommodate the WP, forced to minimum value Starting scan point 6 of 6 : Max_toroidal_field_(T) , b_tf_inboard_max = 10.0
1 | Convergence Parameter: 1.442E-02
2 | Convergence Parameter: 3.487E-04
3 | Convergence Parameter: 1.267E-03
4 | Convergence Parameter: 7.872E-05
5 | Convergence Parameter: 7.490E-05
6 | Convergence Parameter: 3.730E-04
7 | Convergence Parameter: 2.247E-03
8 | Convergence Parameter: 5.139E-03
9 | Convergence Parameter: 7.165E-04
10 | Convergence Parameter: 2.729E-03
11 | Convergence Parameter: 6.954E-04
12 | Convergence Parameter: 3.884E-05
13 | Convergence Parameter: 2.254E-06
14 | Convergence Parameter: 3.472E-06
15 | Convergence Parameter: 1.731E-05
16 | Convergence Parameter: 9.239E-05
17 | Convergence Parameter: 9.353E-03
18 | Convergence Parameter: 1.049E-03
19 | Convergence Parameter: 3.038E-03
20 | Convergence Parameter: 1.226E-05
21 | Convergence Parameter: 6.284E-05
22 | Convergence Parameter: 2.711E-04
23 | Convergence Parameter: 1.255E-05
24 | Convergence Parameter: 1.466E-05
25 | Convergence Parameter: 7.709E-05
26 | Convergence Parameter: 3.307E-05
27 | Convergence Parameter: 6.646E-04
28 | Convergence Parameter: 5.405E-04
29 | Convergence Parameter: 3.087E-05
30 | Convergence Parameter: 5.228E-05
31 | Convergence Parameter: 5.197E-05
32 | Convergence Parameter: 1.001E-04
33 | Convergence Parameter: 6.572E-05
34 | Convergence Parameter: 1.746E-05
35 | Convergence Parameter: 1.497E-06
36 | Convergence Parameter: 3.481E-06
37 | Convergence Parameter: 1.347E-06
38 | Convergence Parameter: 4.646E-06
39 | Convergence Parameter: 1.226E-05
40 | Convergence Parameter: 2.690E-05
41 | Convergence Parameter: 3.346E-06
42 | Convergence Parameter: 7.925E-08
43 | Convergence Parameter: 1.060E-07
44 | Convergence Parameter: 5.337E-07
45 | Convergence Parameter: 2.743E-06
46 | Convergence Parameter: 3.064E-04
47 | Convergence Parameter: 4.108E-04
48 | Convergence Parameter: 1.517E-05
49 | Convergence Parameter: 5.225E-07
50 | Convergence Parameter: 5.076E-07
51 | Convergence Parameter: 5.745E-06
52 | Convergence Parameter: 2.463E-05
53 | Convergence Parameter: 9.555E-07
54 | Convergence Parameter: 3.556E-08
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:5949) Predicted plasma driven current is more than upper limit on non-inductive fraction (/home/runner/work/PROCESS/PROCESS/process/models/physics/physics.py:6017) Diamagnetic fraction is more than 1%, but not calculated. Consider using i_diamagnetic_current=2 and i_pfirsch_schluter_current=1 (/home/runner/work/PROCESS/PROCESS/process/models/tfcoil/base.py:236) dr_tf_plasma_case too small to accommodate the WP, forced to minimum value ****************************************** Scan Convergence Summary ****************************************** Scan 01: b_tf_inboard_max = 10.5 CONVERGED Scan 02: b_tf_inboard_max = 10.4 CONVERGED Scan 03: b_tf_inboard_max = 10.3 CONVERGED Scan 04: b_tf_inboard_max = 10.2 CONVERGED Scan 05: b_tf_inboard_max = 10.1 CONVERGED Scan 06: b_tf_inboard_max = 10.0 CONVERGED Convergence Percentage: 100.00% ******************************************* End of PROCESS Output ********************************************
Plot scan results¶
Use plot_scans.py to plot the resulting MFILE.DAT.
In [2]:
Copied!
%matplotlib inline
from process.core.io import plot_scans
# Define working directory relative to project dir and input file name
mfile_name = data_dir / "scan_example_file_MFILE.DAT"
output_dir = data_dir
plot_scans.main(
args=[
"-f",
str(mfile_name),
"-yv",
"b_plasma_toroidal_on_axis rmajor p_plant_electric_net_mw p_fusion_total_mw capcost",
"--outputdir",
str(output_dir),
]
)
%matplotlib inline
from process.core.io import plot_scans
# Define working directory relative to project dir and input file name
mfile_name = data_dir / "scan_example_file_MFILE.DAT"
output_dir = data_dir
plot_scans.main(
args=[
"-f",
str(mfile_name),
"-yv",
"b_plasma_toroidal_on_axis rmajor p_plant_electric_net_mw p_fusion_total_mw capcost",
"--outputdir",
str(output_dir),
]
)