52 print(f
"\n{'='*70}\n EUROFER-97 RAG check — equations={equations!r}\n{'='*70}")
54 rag, layout = build_eurofer_rag(
55 inp, rr, equations=equations, cascade=
"fission")
59 print(
"rag.validate() ......................... OK")
62 assert len(rag.edges) > 0,
"RAG has no edges"
64 k = rag.kernel(e.kernel)
66 arr = np.asarray(k, dtype=float)
67 assert np.all(np.isfinite(arr)), f
"edge {e.label!r}: non-finite kernel"
69 if e.edge_class.value
in (
"coalescence",
"annihilation"):
70 assert arr.ndim == 2, \
71 f
"edge {e.label!r}: {e.edge_class} needs a 2-D kernel"
74 assert arr.ndim
in (0, 1), \
75 f
"edge {e.label!r}: expected scalar/1-D kernel, got {arr.ndim}-D"
76 print(f
"every edge has a registered kernel ..... OK ({len(rag.edges)} edges)")
80 sia_mono = rag.monomer_population(Polarity.SIA)
81 vac_mono = rag.monomer_population(Polarity.VACANCY)
82 assert sia_mono.name ==
"bulk-111" and sia_mono.polarity
is Polarity.SIA
83 assert vac_mono.name ==
"bulk" and vac_mono.polarity
is Polarity.VACANCY
84 print(
"SIA + vacancy monomer populations set .. OK")
87 assert rag.gas_species == [
"He"], f
"gas list = {rag.gas_species}"
88 print(
"gas list = ['He'] ...................... OK")
91 assert layout.has(
"SIA")
and layout.has(
"SIA100")
and layout.has(
"VAC")
92 assert layout.has(
"He")
and layout.has(
"conservation")
93 assert layout.block(
"conservation").length == 5
94 sia_len = layout.block(
"SIA").length
95 sia100_len = layout.block(
"SIA100").length
96 vac_len = layout.block(
"VAC").length
97 he_len = layout.block(
"He").length
98 expected = sia_len + sia100_len + vac_len + he_len + 5
99 assert layout.N_eq == expected, \
100 f
"N_eq {layout.N_eq} != {expected}"
101 assert layout.N_eq > 0
102 if equations ==
"discrete":
105 assert sia_len == 1000
and sia100_len == 1000
and vac_len == 1000, \
106 f
"discrete ladders should be 1000, got {sia_len}/{sia100_len}/{vac_len}"
107 assert he_len == 2, f
"fission He block should be 2 (Q_tot + c_h), got {he_len}"
108 print(f
"StateLayout N_eq sensible .............. OK (N_eq = {layout.N_eq})")
111 print(
"\n--- rag.summary() ---")
113 print(
"\n--- state_layout.describe() ---")
114 print(layout.describe())