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 pathlib import Path
from process.main import SingleRun, setup_loggers
# setup the loggers so that the output is not spammed with model errors/warnings
setup_loggers()
data_dir = Path("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 pathlib import Path
from process.main import SingleRun, setup_loggers
# setup the loggers so that the output is not spammed with model errors/warnings
setup_loggers()
data_dir = Path("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.2.3.dev37+g5ea7543e8 Git Tag : v3.2.2-37-g5ea7543e Git Branch : main Date : 16/01/2026 UTC Time : 10:49 User : runner Computer : runnervmmtnos Directory : /home/runner/work/PROCESS/PROCESS/examples 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/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/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/physics.py:7739: RuntimeWarning: divide by zero encountered in scalar divide * (nd_plasma_pedestal_electron / n_greenwald) ** -0.174
/home/runner/work/PROCESS/PROCESS/process/costs.py:3028: RuntimeWarning: invalid value encountered in sqrt annoam = cost_variables.ucoam[cost_variables.lsa - 1] * np.sqrt( /home/runner/work/PROCESS/PROCESS/process/costs.py:3099: RuntimeWarning: invalid value encountered in sqrt annwst = cost_variables.ucwst[cost_variables.lsa - 1] * np.sqrt(
1 | Convergence Parameter: 7.240E-01
/home/runner/work/PROCESS/PROCESS/process/current_drive.py:1991: 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.018E-10
7 | Convergence Parameter: 1.041E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/physics.py:6700) 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/tf_coil.py:246) dr_tf_plasma_case to 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/physics.py:6700) 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/tf_coil.py:246) dr_tf_plasma_case to 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.347E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/physics.py:6700) 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/tf_coil.py:246) dr_tf_plasma_case to 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.282E-09
4 | Convergence Parameter: 3.111E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/physics.py:6632) Predicted plasma driven current is more than upper limit on non-inductive fraction (/home/runner/work/PROCESS/PROCESS/process/physics.py:6700) 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/tf_coil.py:246) dr_tf_plasma_case to 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.345E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/physics.py:6632) Predicted plasma driven current is more than upper limit on non-inductive fraction (/home/runner/work/PROCESS/PROCESS/process/physics.py:6700) 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/tf_coil.py:246) dr_tf_plasma_case to 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.874E-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.287E-05
22 | Convergence Parameter: 2.712E-04
23 | Convergence Parameter: 1.255E-05
24 | Convergence Parameter: 1.460E-05
25 | Convergence Parameter: 7.681E-05
26 | Convergence Parameter: 3.306E-05
27 | Convergence Parameter: 6.645E-04
28 | Convergence Parameter: 5.398E-04
29 | Convergence Parameter: 3.084E-05
30 | Convergence Parameter: 5.480E-05
31 | Convergence Parameter: 5.029E-05
32 | Convergence Parameter: 1.025E-04
33 | Convergence Parameter: 5.211E-05
34 | Convergence Parameter: 2.432E-05
35 | Convergence Parameter: 1.882E-06
36 | Convergence Parameter: 4.021E-06
37 | Convergence Parameter: 2.492E-06
38 | Convergence Parameter: 1.269E-05
39 | Convergence Parameter: 4.243E-06
40 | Convergence Parameter: 2.067E-05
41 | Convergence Parameter: 1.292E-05
42 | Convergence Parameter: 2.307E-06
43 | Convergence Parameter: 5.082E-08
44 | Convergence Parameter: 5.793E-09
************************************* PROCESS found a feasible solution **************************************
******************************************** Errors and Warnings ********************************************* (/home/runner/work/PROCESS/PROCESS/process/physics.py:6632) Predicted plasma driven current is more than upper limit on non-inductive fraction (/home/runner/work/PROCESS/PROCESS/process/physics.py:6700) 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/tf_coil.py:246) dr_tf_plasma_case to 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.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.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),
]
)