|
RadCluster
Graph-based cluster dynamics for irradiated materials
|
Functions | |
| build_sim (solver_mode, physics_option=None) | |
| run_mode (label, solver_mode, solver_cfg) | |
| _load_run_from_dir (d, solver_mode, label) | |
| find_reference_run (ref_dir=None) | |
| find_window_run (load_dir=None) | |
| _relerr (ref, new) | |
| make_comparison_plots (res_dict, wall_dict, out_path) | |
| make_distribution_plots (res_dict, out_path) | |
| write_report (res_dict, wall_dict, report_path) | |
| main () | |
Variables | |
| CODES_DIR = Path(__file__).resolve().parent.parent | |
| MODULE_ROOT = CODES_DIR.parent | |
| REPO_ROOT = MODULE_ROOT.parent | |
| I = int(1e4) | |
| V = int(1e4) | |
| int | i_mobile = 1 |
| int | v_mobile = 1 |
| i_discrete = I | |
| v_discrete = V | |
| int | I_bin = 0 |
| int | V_bin = 0 |
| int | C_FLOOR = 1e-25 |
| str | HE_KINETICS = 'quasi_steady_state' |
| dict | PARAM_OVERRIDES |
| dict | BASE_SOLVER_CFG |
| dict | WINDOW_METHOD |
| dict | MODE4_CFG = {**BASE_SOLVER_CFG, 'solver_method': WINDOW_METHOD} |
| dict | MODE0_CFG |
| str | PHYSICS_OPTION = 'full_CD_fission' |
| dict | COLORS = {'mode0': '#1f77b4', 'mode4': '#2ca02c'} |
| dict | LABELS |
| dict | LS = {'mode0': '-', 'mode4': '--'} |
compare_window_modes.py
=======================
Run and compare the two solver modes for the I=V=10000 full_CD system:
Mode 0 — full_system : reference (20 006 ODEs, no window)
Mode 4 — active_window : two independent sliding windows + OpenMP-parallel
RHS (auto-serial when threads=1)
Physical parameters are taken verbatim from the notebook cell:
T=573 K, G=1e-6 dpa/s, I=V=10000, i_mobile=v_mobile=1,
i_discrete=I, v_discrete=V, I_bin=V_bin=0 (full per-size),
he_kinetics=quasi_steady_state, fission cascade.
Window design (derived from I=V=1000 reference run):
SIA front saturates at n≈62 at t=1e4 s, VAC front reaches m≈1000 at t=1e4 s.
Initial width must accommodate both axes → window_width = 500.
(expand thresholds / pads tuned to match these observations)
Usage:
cd EuroferMicrostructure/radcluster_code/codes
python compare_window_modes.py [--ref-dir <path>] [--skip-mode0]
|
protected |
Load a saved run from directory *d*. Returns (results_dict, dir_name) or (None, None) if the directory doesn't contain valid results.
Definition at line 221 of file compare_window_modes.py.
|
protected |
Element-wise relative error |new - ref| / (|ref| + 1e-30).
Definition at line 323 of file compare_window_modes.py.
| compare_window_modes.build_sim | ( | solver_mode, | |
physics_option = None |
|||
| ) |
Construct an RadClusterSimulation with the reference parameters.
Definition at line 133 of file compare_window_modes.py.
| compare_window_modes.find_reference_run | ( | ref_dir = None | ) |
Return the results dict for mode-0. If ref_dir is given, load from there. Otherwise scan the output directory for the most recent full_system run with N_eq == 20006 (I=V=10000, QSS He) matching PHYSICS_OPTION (or bin_moment fallback since they are mathematically identical with I_bin=0). Legacy `cpp_full` directory names are also matched.
Definition at line 248 of file compare_window_modes.py.
| compare_window_modes.find_window_run | ( | load_dir = None | ) |
Return the results dict for active_window. If load_dir is given, load from there; otherwise find the most recent matching output directory for PHYSICS_OPTION. Legacy `sliding_OpenMP` directory names are also matched.
Definition at line 288 of file compare_window_modes.py.
| compare_window_modes.main | ( | ) |
Definition at line 654 of file compare_window_modes.py.
| compare_window_modes.make_comparison_plots | ( | res_dict, | |
| wall_dict, | |||
| out_path | |||
| ) |
res_dict : {'mode0': results, 'mode4': results} (any key may be absent)
wall_dict: {'mode0': float, 'mode4': float}
out_path : Path to save the figure
Definition at line 328 of file compare_window_modes.py.
| compare_window_modes.make_distribution_plots | ( | res_dict, | |
| out_path | |||
| ) |
Definition at line 505 of file compare_window_modes.py.
| compare_window_modes.run_mode | ( | label, | |
| solver_mode, | |||
| solver_cfg | |||
| ) |
Definition at line 181 of file compare_window_modes.py.
| compare_window_modes.write_report | ( | res_dict, | |
| wall_dict, | |||
| report_path | |||
| ) |
Definition at line 549 of file compare_window_modes.py.
| dict compare_window_modes.BASE_SOLVER_CFG |
Definition at line 96 of file compare_window_modes.py.
| int compare_window_modes.C_FLOOR = 1e-25 |
Definition at line 74 of file compare_window_modes.py.
| compare_window_modes.CODES_DIR = Path(__file__).resolve().parent.parent |
Definition at line 34 of file compare_window_modes.py.
| dict compare_window_modes.COLORS = {'mode0': '#1f77b4', 'mode4': '#2ca02c'} |
Definition at line 318 of file compare_window_modes.py.
| str compare_window_modes.HE_KINETICS = 'quasi_steady_state' |
Definition at line 75 of file compare_window_modes.py.
| compare_window_modes.I = int(1e4) |
Definition at line 66 of file compare_window_modes.py.
| int compare_window_modes.I_bin = 0 |
Definition at line 72 of file compare_window_modes.py.
| compare_window_modes.i_discrete = I |
Definition at line 70 of file compare_window_modes.py.
| int compare_window_modes.i_mobile = 1 |
Definition at line 68 of file compare_window_modes.py.
| dict compare_window_modes.LABELS |
Definition at line 319 of file compare_window_modes.py.
| dict compare_window_modes.LS = {'mode0': '-', 'mode4': '--'} |
Definition at line 321 of file compare_window_modes.py.
| dict compare_window_modes.MODE0_CFG |
Definition at line 121 of file compare_window_modes.py.
| dict compare_window_modes.MODE4_CFG = {**BASE_SOLVER_CFG, 'solver_method': WINDOW_METHOD} |
Definition at line 120 of file compare_window_modes.py.
| compare_window_modes.MODULE_ROOT = CODES_DIR.parent |
Definition at line 35 of file compare_window_modes.py.
| dict compare_window_modes.PARAM_OVERRIDES |
Definition at line 77 of file compare_window_modes.py.
| str compare_window_modes.PHYSICS_OPTION = 'full_CD_fission' |
Definition at line 130 of file compare_window_modes.py.
| compare_window_modes.REPO_ROOT = MODULE_ROOT.parent |
Definition at line 36 of file compare_window_modes.py.
| compare_window_modes.V = int(1e4) |
Definition at line 67 of file compare_window_modes.py.
| int compare_window_modes.V_bin = 0 |
Definition at line 73 of file compare_window_modes.py.
| compare_window_modes.v_discrete = V |
Definition at line 71 of file compare_window_modes.py.
| int compare_window_modes.v_mobile = 1 |
Definition at line 69 of file compare_window_modes.py.
| dict compare_window_modes.WINDOW_METHOD |
Definition at line 108 of file compare_window_modes.py.