RadCluster
Graph-based cluster dynamics for irradiated materials
Loading...
Searching...
No Matches
gate_im5vm2.py
Go to the documentation of this file.
1"""
2Stage-2 gate / Stage-4 baseline driver.
3
4Reproduces the RadCluster_1_0 reference run
5 20260504_201741_full_system_full_CD_fission_I1000V1000_im5vm2
6under RadCluster_2_1, and prints the macroscopic observables so the
7post-Stage-2 numbers can be compared against the v1.0 baseline.
8
9v1.0 baseline (for reference):
10 C_SIA_tot = 1.3205355691e20 C_VAC_tot = 1.9494579688e20
11 C_He_tot = 8.9886e11 mean_n_i = 7.6703 mean_n_v = 3.2384
12 swelling = 2.3004e-9 delta_FP = 9.9995e-5 delta_He = nan
13"""
14import sys
15from pathlib import Path
16
17ROOT = Path(sys.argv[1] if len(sys.argv) > 1
18 else r"d:/GitHub/RadCluster/radcluster_code")
19sys.path.insert(0, str(ROOT))
20print(f"ROOT = {ROOT}")
21
22from py_utils.simulation import RadClusterSimulation
23
25 I=1000, V=1000, solver_mode="full_system",
26 physics_option="full_CD_fission",
27 C_floor=1e-25, he_kinetics="quasi_steady_state",
28 i_mobile=5, v_mobile=2,
29)
30
31# The v1.0 baseline run was recorded at T=673 K; the workbook has since
32# been edited to 573 K. Pin T to the baseline value for a faithful compare.
33sim.input_data.reactions["T"] = 673.0
34sim.input_data._calculate_derived()
35sim.rebuild_rates()
36print(f"T pinned to {sim.input_data.derived['T']} K")
37
38cfg = sim._default_solver_config()
39cfg["t_span"] = (1e-6, 0.01)
40cfg["n_points"] = 200
41cfg["log_time"] = True
42cfg["rtol"] = 1e-6
43cfg["atol"] = 1e-20
44cfg["solver_method"]["linsol"] = "gmres"
45
46results = sim.run_adaptive(
47 solver_config=cfg, save_output=False,
48 max_doublings=0, points_per_segment=200,
49)
50
51print("RESULTS_BEGIN")
52if results is None:
53 print("RUN FAILED")
54else:
55 def last(key):
56 v = results.get(key)
57 if v is None:
58 return None
59 try:
60 return float(v[-1])
61 except (TypeError, IndexError):
62 try:
63 return float(v)
64 except (TypeError, ValueError):
65 return v
66 for k in ["C_SIA_tot", "C_VAC_tot", "C_He_tot", "mean_n_i",
67 "mean_n_v", "swelling", "delta_FP", "delta_He"]:
68 print(f"{k} = {last(k)!r}")
69print("RESULTS_END")