d0fus 2.7.2__tar.gz → 2.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_figures.py +21 -20
  2. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_parameterization.py +1 -1
  3. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_physical_functions.py +105 -35
  4. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_EXE/D0FUS_popcon.py +2 -1
  5. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_EXE/D0FUS_run.py +13 -3
  6. {d0fus-2.7.2 → d0fus-2.8.1}/PKG-INFO +2 -2
  7. {d0fus-2.7.2 → d0fus-2.8.1}/README.md +1 -1
  8. {d0fus-2.7.2 → d0fus-2.8.1}/d0fus.egg-info/PKG-INFO +2 -2
  9. {d0fus-2.7.2 → d0fus-2.8.1}/pyproject.toml +1 -1
  10. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS.py +0 -0
  11. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_cost_data.py +0 -0
  12. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_cost_functions.py +0 -0
  13. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_import.py +0 -0
  14. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_machine_presets.py +0 -0
  15. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_BIB/D0FUS_radial_build_functions.py +0 -0
  16. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_EXE/D0FUS_genetic.py +0 -0
  17. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_EXE/D0FUS_scan.py +0 -0
  18. {d0fus-2.7.2 → d0fus-2.8.1}/D0FUS_EXE/D0FUS_uncertainty.py +0 -0
  19. {d0fus-2.7.2 → d0fus-2.8.1}/LICENSE +0 -0
  20. {d0fus-2.7.2 → d0fus-2.8.1}/d0fus.egg-info/SOURCES.txt +0 -0
  21. {d0fus-2.7.2 → d0fus-2.8.1}/d0fus.egg-info/dependency_links.txt +0 -0
  22. {d0fus-2.7.2 → d0fus-2.8.1}/d0fus.egg-info/entry_points.txt +0 -0
  23. {d0fus-2.7.2 → d0fus-2.8.1}/d0fus.egg-info/requires.txt +0 -0
  24. {d0fus-2.7.2 → d0fus-2.8.1}/d0fus.egg-info/top_level.txt +0 -0
  25. {d0fus-2.7.2 → d0fus-2.8.1}/setup.cfg +0 -0
@@ -1063,28 +1063,29 @@ def plot_Lz_cooling(
1063
1063
 
1064
1064
  # Helium ash fraction against C_alpha, tabulated from full D0FUS runs.
1065
1065
  # Each entry is (C_alpha, f_He [%]) obtained by rerunning the corresponding
1066
- # benchmark deck with C_Alpha substituted and nothing else changed. The scan
1067
- # is reproduced by verif_Calpha/scan_calpha.py. Evaluating the standalone
1068
- # reservoir formula instead would answer a different question: at a fixed
1069
- # hand-picked reference point, without impurity dilution, without pedestal
1070
- # and with a cylindrical volume weight, it returns 4.6 % for C_alpha = 5,
1071
- # whereas the converged ITER deck returns 2.7 % at that value.
1072
- _HE_SCAN_ITER = [(3, 1.601), (4, 2.163), (5, 2.742), (6, 3.341), (7, 3.965),
1073
- (7.5, 4.287), (8, 4.618), (9, 5.308)]
1066
+ # benchmark deck with C_Alpha substituted and nothing else changed (script
1067
+ # scan_calpha.py in the analysis notes; 8 s per point). Tabulated with the
1068
+ # v2.8 ash balance, i.e. the alpha source of the reservoir equation is the
1069
+ # density-weighted reactivity integral of f_nbar (P_fus / E_fus exactly).
1070
+ # Before v2.8 the source dropped the n_hat^2 weight and the table read
1071
+ # 4.29 % at C_alpha = 7.5; the same 4.29 % is now obtained at C_alpha = 5.7,
1072
+ # which is the new ITER deck calibration (Shimada 2007 projection).
1073
+ _HE_SCAN_ITER = [(3, 2.132), (4, 2.896), (5, 3.697), (5.7, 4.285),
1074
+ (6, 4.546), (6.5, 4.992), (6.6, 5.084)]
1074
1075
  # EU-DEMO 2017 deck, kept for the record but no longer plotted: the range to
1075
1076
  # expect for a DEMO-class device is not known with anything like the
1076
1077
  # confidence of the ITER projection, so showing it would invite more
1077
- # commentary than it is worth. Its deck value is C_alpha = 10, returning
1078
- # 8.8 %, against a European baseline that assumes c_He = 10 %.
1079
- _HE_SCAN_DEMO = [(3, 2.472), (4, 3.318), (5, 4.177), (6, 5.052), (7, 5.944),
1080
- (7.5, 6.398), (8, 6.858), (9, 7.795), (10, 8.763),
1081
- (11, 9.767), (12, 10.818), (14, 13.124)]
1082
- _HE_ITER_LAST_FEASIBLE = 9 # beyond this the 500 MW ITER point does not close
1078
+ # commentary than it is worth. With the v2.8 balance its deck value
1079
+ # C_alpha = 6.8 returns 8.8 %, against a European baseline that assumes
1080
+ # 10 % (the pre-v2.8 deck used C_alpha = 10 for the same 8.8 %).
1081
+ _HE_SCAN_DEMO = [(3, 3.670), (4, 4.947), (5, 6.263), (6, 7.627), (7, 9.053),
1082
+ (8, 10.564), (9, 12.200), (10, 14.038)]
1083
+ _HE_ITER_LAST_FEASIBLE = 6.6 # beyond this the 500 MW ITER point does not close
1083
1084
 
1084
1085
 
1085
1086
  def plot_He_fraction(
1086
1087
  iter_scan: list | None = None,
1087
- C_Alpha_ITER: float = 7.5,
1088
+ C_Alpha_ITER: float = 5.7,
1088
1089
  save_dir: str | None = None,
1089
1090
  ) -> None:
1090
1091
  """
@@ -1103,16 +1104,16 @@ def plot_He_fraction(
1103
1104
  consistent with the design point of Chapter 2 by construction. This
1104
1105
  matters, because the standalone formula and the converged run do not
1105
1106
  agree: the former returns 4.6 % helium at C_alpha = 5 for ITER-like
1106
- parameters, the latter 2.7 %, the difference coming from the profiles,
1107
- the impurity dilution and the flux-surface volume weight.
1107
+ parameters, the latter 3.7 %, the difference coming from the impurity
1108
+ dilution, the pedestal profiles and the flux-surface volume weight.
1108
1109
 
1109
1110
  C_alpha is not a quantity one reads off a reference design. In PROCESS,
1110
1111
  for instance, the helium fraction is the input and tau_He*/tau_E an
1111
1112
  output, the only input on the ratio being a lower bound whose default is
1112
1113
  5.0 (constraint 62). It is therefore calibrated deck by deck so that the
1113
- predicted ash fraction lands on the projected one: 7.5 for ITER here.
1114
+ predicted ash fraction lands on the projected one: 5.7 for ITER here.
1114
1115
 
1115
- Past C_alpha ~ 9 the deck no longer closes: the dilution is such that
1116
+ Past C_alpha ~ 6.6 the deck no longer closes: the dilution is such that
1116
1117
  500 MW cannot be held under the density limit and the solver returns no
1117
1118
  design point. The curve stops there, which is a result in itself.
1118
1119
 
@@ -1153,7 +1154,7 @@ def plot_He_fraction(
1153
1154
  ax.set_xlabel(r"Removal efficiency $C_\alpha = \tau_\alpha^{*} / \tau_E$",
1154
1155
  fontsize=15)
1155
1156
  ax.set_ylabel(r"Helium ash fraction $f_\alpha$ [%]", fontsize=15)
1156
- ax.set_xlim(3, 9.6)
1157
+ ax.set_xlim(3, 7.2)
1157
1158
  ax.set_ylim(0, 6.6)
1158
1159
  ax.grid(True, alpha=0.28, lw=0.6)
1159
1160
  ax.tick_params(labelsize=13)
@@ -215,7 +215,7 @@ class GlobalConfig:
215
215
  # D-T+He plasma with Z_eff ~ 1 + 2 f_He (~1.1).
216
216
  # float -> manual override (legacy behaviour, e.g. Zeff = 2.0).
217
217
  r_synch : float = 0.5 # Synchrotron radiation wall reflectivity [-]
218
- C_Alpha : float = 7.5 # Helium ash confinement ratio τ_He*/τ_E [-], calibrated deck by deck (default 7.5 = ITER calibration; PROCESS provides only a lower bound, 5)
218
+ C_Alpha : float = 5.7 # Helium ash confinement ratio τ_He*/τ_E [-], calibrated deck by deck (default 5.7 = ITER calibration with the v2.8 ash balance, 4.3 % He; PROCESS provides only a lower bound, 5)
219
219
  # Impurity line radiation (0D bulk-plasma estimate).
220
220
  # Comma-separated species ('W', 'Ar', 'Ne', 'C', 'N', 'Kr') with matching
221
221
  # concentrations n_imp/n_e. Empty string = disabled (pure D-T).
@@ -166,7 +166,12 @@ if __name__ == "__main__":
166
166
  rho_ped=0.95, n_ped_frac=0.99, T_ped_frac=0.55,
167
167
  # Composition and radiation (deck section 4)
168
168
  Zeff=1.65, imp={'W': 2e-5, 'Ne': 7e-3}, r_synch=0.6,
169
- rho_rad_core=0.75, C_Alpha=5.0,
169
+ # C_Alpha: value at which the v2.8 ash balance (density-weighted
170
+ # reactivity, Miller volume weight) returns the frozen f_alpha of
171
+ # the 2026-06 deck. That deck was converged with the pre-v2.8
172
+ # balance at C_Alpha = 5.0; the two are related by the profile
173
+ # factor <sigma.v n_hat^2> / <sigma.v> and the volume weight.
174
+ rho_rad_core=0.75, C_Alpha=3.8119,
170
175
  # Current-drive deposition (deck section 11)
171
176
  A_beam=2, E_beam_keV=1000.0, rho_NBI=0.30, rho_EC=0.40,
172
177
  angle_NBI_deg=20.0,
@@ -184,7 +189,7 @@ if __name__ == "__main__":
184
189
  eta_LH=0.310283, eta_EC=0.0463759, eta_NBI=0.292349, I_CD=1.62962,
185
190
  Q=9.98184, P_sep=87.8792, P_LH_th=73.522,
186
191
  B_pol=0.715156, lambda_q_mm=1.12391, Gamma_n=0.58196,
187
- tau_alpha=15.7193,
192
+ tau_alpha=11.9840, # = C_Alpha * tauE with the v2.8 chain C_Alpha
188
193
  )
189
194
 
190
195
  #%% Geometry formulas
@@ -1201,7 +1206,8 @@ if __name__ == "__main__":
1201
1206
  import D0FUS_BIB.D0FUS_figures as figs
1202
1207
  figs.plot_nT_profiles()
1203
1208
 
1204
- def f_nbar_line(nbar_vol, nu_n, rho_ped=1.0, n_ped_frac=0.0, N=2000):
1209
+ def f_nbar_line(nbar_vol, nu_n, rho_ped=1.0, n_ped_frac=0.0, N=2000,
1210
+ Vprime_data=None):
1205
1211
  """
1206
1212
  Convert volume-averaged electron density to line-averaged density.
1207
1213
 
@@ -1247,6 +1253,14 @@ def f_nbar_line(nbar_vol, nu_n, rho_ped=1.0, n_ped_frac=0.0, N=2000):
1247
1253
  rho_ped : float Normalised pedestal radius (default 1.0).
1248
1254
  n_ped_frac : float n_ped / n̄.
1249
1255
  N : int Integration points (default 2000).
1256
+ Vprime_data: tuple or None Flux-surface Jacobian used to normalise the
1257
+ profile to nbar_vol. MUST be the same Vprime_data as the run that
1258
+ produced nbar_vol. None (default) falls back to the cylindrical
1259
+ volume element 2 rho drho, which is correct in Academic geometry
1260
+ only. Passing None while nbar_vol is a refined-Miller volume
1261
+ average rebuilds a profile of the wrong amplitude and peaking: on
1262
+ the SF Plant V2 point this returned 1.968e20 instead of 2.102e20,
1263
+ a 6.8 % error propagating to f_GW, the L-H threshold and Ip.
1250
1264
 
1251
1265
  Returns
1252
1266
  -------
@@ -1268,10 +1282,12 @@ def f_nbar_line(nbar_vol, nu_n, rho_ped=1.0, n_ped_frac=0.0, N=2000):
1268
1282
  """
1269
1283
  rho_arr = np.linspace(0.0, 1.0, N)
1270
1284
  return float(np.trapezoid(f_nprof(nbar_vol, nu_n, rho_arr,
1271
- rho_ped, n_ped_frac), rho_arr))
1285
+ rho_ped, n_ped_frac,
1286
+ Vprime_data), rho_arr))
1272
1287
 
1273
1288
 
1274
- def f_nbar_vol_from_line(nbar_line, nu_n, rho_ped=1.0, n_ped_frac=0.0, N=2000):
1289
+ def f_nbar_vol_from_line(nbar_line, nu_n, rho_ped=1.0, n_ped_frac=0.0, N=2000,
1290
+ Vprime_data=None):
1275
1291
  """
1276
1292
  Convert line-averaged electron density to volume-averaged density.
1277
1293
 
@@ -1283,12 +1299,13 @@ def f_nbar_vol_from_line(nbar_line, nu_n, rho_ped=1.0, n_ped_frac=0.0, N=2000):
1283
1299
  nu_n : float Density peaking exponent.
1284
1300
  rho_ped, n_ped_frac : float Pedestal parameters.
1285
1301
  N : int Integration points.
1302
+ Vprime_data: tuple or None Flux-surface Jacobian, see f_nbar_line().
1286
1303
 
1287
1304
  Returns
1288
1305
  -------
1289
1306
  nbar_vol : float Volume-averaged density [same unit as nbar_line].
1290
1307
  """
1291
- ratio = f_nbar_line(1.0, nu_n, rho_ped, n_ped_frac, N)
1308
+ ratio = f_nbar_line(1.0, nu_n, rho_ped, n_ped_frac, N, Vprime_data)
1292
1309
  return nbar_line / ratio
1293
1310
 
1294
1311
  if __name__ == "__main__":
@@ -8003,9 +8020,17 @@ if __name__ == "__main__":
8003
8020
  # ── Helium ash accumulation model ─────────────────────────────────────────────
8004
8021
 
8005
8022
  def _sigmav_vol(T_bar, nu_T, rho_ped=1.0, T_ped_frac=0.0, N=200,
8006
- Vprime_data=None, tau_i_e=1.0):
8023
+ Vprime_data=None, tau_i_e=1.0,
8024
+ nu_n=None, n_ped_frac=0.0):
8007
8025
  """
8008
- Volume-averaged DT reactivity ⟨σv⟩_vol = ∫₀¹ ⟨σv⟩[T(ρ)] · w(ρ) dρ.
8026
+ Density-weighted, volume-averaged DT reactivity
8027
+
8028
+ I_fus = ∫₀¹ ⟨σv⟩[T_i(ρ)] · n̂²(ρ) · w(ρ) dρ
8029
+
8030
+ where n̂(ρ) = n(ρ)/n̄ is the normalised density profile and w(ρ) the
8031
+ volume weight. This is the same normalised reactivity integral as in
8032
+ `f_nbar`, so that the alpha source seen by the helium-ash balance is
8033
+ the one that produces P_fus.
8009
8034
 
8010
8035
  Shared helper for f_He_fraction and f_tau_alpha, avoiding redundant
8011
8036
  profile and reactivity evaluations when both are called on the same
@@ -8021,10 +8046,20 @@ def _sigmav_vol(T_bar, nu_T, rho_ped=1.0, T_ped_frac=0.0, N=200,
8021
8046
  Vprime_data : tuple or None
8022
8047
  (rho_grid, Vprime, V_total) from precompute_Vprime().
8023
8048
  None → cylindrical weight 2ρ (Academic mode).
8049
+ tau_i_e : float T_i / T_e ratio; the reactivity is evaluated on
8050
+ T_i = tau_i_e · T_e.
8051
+ nu_n : float or None
8052
+ Density peaking exponent. None → the density weight n̂² is
8053
+ dropped (legacy behaviour, kept for reference only: it
8054
+ under-counts the alpha source by the factor
8055
+ ⟨σv n̂²⟩ / ⟨σv⟩, 1.2 for a flat ITER-like density and 1.6 for a
8056
+ peaked DEMO-like one).
8057
+ n_ped_frac : float n_ped / n̄ (used only when nu_n is not None).
8024
8058
 
8025
8059
  Returns
8026
8060
  -------
8027
- float Volume-averaged reactivity [m³ s⁻¹].
8061
+ float Normalised reactivity integral I_fus [m³ s⁻¹]. With nu_n = None
8062
+ it reduces to the plain volume average ⟨σv⟩_vol.
8028
8063
  """
8029
8064
  if Vprime_data is not None:
8030
8065
  # refined mode: Miller weight V'(ρ)/V
@@ -8032,18 +8067,27 @@ def _sigmav_vol(T_bar, nu_T, rho_ped=1.0, T_ped_frac=0.0, N=200,
8032
8067
  T = f_Tprof(T_bar, nu_T, rho_grid, rho_ped, T_ped_frac,
8033
8068
  Vprime_data)
8034
8069
  sv = f_sigmav(tau_i_e * T) # reactivity on T_i = tau_i_e * T_e
8035
- return float(np.trapezoid(sv * Vprime, rho_grid)) / V_total
8070
+ if nu_n is not None:
8071
+ n_hat = f_nprof(1.0, nu_n, rho_grid, rho_ped, n_ped_frac,
8072
+ Vprime_data)
8073
+ sv = sv * n_hat**2
8074
+ integrand = np.nan_to_num(sv * Vprime, nan=0.0, posinf=0.0)
8075
+ return float(np.trapezoid(integrand, rho_grid)) / V_total
8036
8076
  else:
8037
8077
  # Academic mode: cylindrical weight 2ρ dρ
8038
8078
  rho = np.linspace(0.0, 1.0, N)
8039
8079
  T = f_Tprof(T_bar, nu_T, rho, rho_ped, T_ped_frac)
8040
8080
  sv = f_sigmav(tau_i_e * T) # reactivity on T_i = tau_i_e * T_e
8041
- return float(np.trapezoid(sv * 2.0 * rho, rho))
8081
+ if nu_n is not None:
8082
+ n_hat = f_nprof(1.0, nu_n, rho, rho_ped, n_ped_frac)
8083
+ sv = sv * n_hat**2
8084
+ integrand = np.nan_to_num(sv * 2.0 * rho, nan=0.0, posinf=0.0)
8085
+ return float(np.trapezoid(integrand, rho))
8042
8086
 
8043
8087
 
8044
8088
  def f_He_fraction(n_bar, T_bar, tauE, C_Alpha, nu_T,
8045
8089
  rho_ped=1.0, T_ped_frac=0.0, Vprime_data=None, tau_i_e=1.0,
8046
- f_imp=0.0):
8090
+ f_imp=0.0, nu_n=None, n_ped_frac=0.0):
8047
8091
  """
8048
8092
  Estimate the equilibrium helium ash fraction f_α = n_α / n_e.
8049
8093
 
@@ -8072,7 +8116,7 @@ def f_He_fraction(n_bar, T_bar, tauE, C_Alpha, nu_T,
8072
8116
  C_Alpha : float
8073
8117
  Helium ash confinement ratio τ_α*/τ_E (dimensionless), lumping
8074
8118
  transport and wall recycling. Calibrated deck by deck; the ITER
8075
- deck calibration C_α = 7.5 returns f_α = 4.3 %.
8119
+ deck calibration C_α = 5.7 returns f_α = 4.3 % (see Notes).
8076
8120
  nu_T : float
8077
8121
  Temperature profile peaking exponent (core power-law)
8078
8122
  rho_ped : float, optional
@@ -8082,6 +8126,13 @@ def f_He_fraction(n_bar, T_bar, tauE, C_Alpha, nu_T,
8082
8126
  Vprime_data : tuple or None
8083
8127
  (rho_grid, Vprime, V_total) from precompute_Vprime().
8084
8128
  None → cylindrical weight (Academic mode).
8129
+ nu_n : float or None
8130
+ Density peaking exponent. Must match the value passed to f_nbar
8131
+ so that the alpha source of the ash balance is the one producing
8132
+ P_fus. None keeps the legacy volume average ⟨σv⟩_vol without the
8133
+ n̂² weight (not recommended, see Notes).
8134
+ n_ped_frac : float
8135
+ n_ped / n̄ (used only when nu_n is not None).
8085
8136
 
8086
8137
  Returns
8087
8138
  -------
@@ -8098,27 +8149,44 @@ def f_He_fraction(n_bar, T_bar, tauE, C_Alpha, nu_T,
8098
8149
  Notes
8099
8150
  -----
8100
8151
  Steady-state reservoir balance (Sarazin et al. 2020, Appendix B),
8101
- generalised here to impurity dilution. With
8102
- C = n_bar <sigma.v>_vol * C_alpha * tau_E
8152
+ generalised here to impurity dilution and to peaked profiles. With
8153
+ C = n_bar * I_fus * C_alpha * tau_E,
8154
+ I_fus = int sigma.v[T(rho)] n_hat(rho)^2 w(rho) drho
8103
8155
  the balance (C/4)(1 - f_imp - 2 f_alpha)^2 = f_alpha has the
8104
8156
  physical root
8105
8157
  f_alpha = s * (C_s + 1 - sqrt(2 C_s + 1)) / (2 C_s),
8106
8158
  with s = 1 - f_imp and C_s = C * s,
8107
8159
  reducing to (C + 1 - sqrt(2C + 1))/(2C) for f_imp = 0.
8108
- The correction lowers f_alpha by about 13 % at ITER-like impurity
8109
- content (f_imp ~ 0.07); the closed form is verified against a
8110
- direct root solve in test_verifications.py.
8111
- <sigma.v>_vol is the volume-averaged D-T reactivity using the
8112
- volume weight consistent with the geometry mode (cylindrical
8113
- 2 rho drho in Academic mode, Miller V'(rho)/V in Refined mode).
8160
+ The impurity correction lowers f_alpha by about 13 % at ITER-like
8161
+ impurity content (f_imp ~ 0.07).
8162
+ I_fus is the normalised reactivity integral of f_nbar, evaluated
8163
+ with the volume weight of the geometry mode (cylindrical 2 rho drho
8164
+ in Academic mode, Miller V'(rho)/V in Refined mode). Writing the
8165
+ source as n_bar^2 I_fus V / 4 makes the alpha production of the ash
8166
+ balance identical to P_fus / E_fus, which is the only consistent
8167
+ choice once P_fus is an input.
8168
+
8169
+ History. Up to v2.7.2 the source was written n_bar^2 <sigma.v>_vol,
8170
+ i.e. without the n_hat^2 weight. Because sigma.v and n_hat^2 are both
8171
+ peaked, this under-counted the alpha source by the factor
8172
+ <sigma.v n_hat^2> / <sigma.v> (1.23 for the flat ITER density,
8173
+ 1.59 for the SF Plant V2 point), so that a deck C_alpha = 7 behaved
8174
+ as an effective tau*_He/tau_E of 4.4. The v2.8 correction restores
8175
+ C_alpha as the true tau*_He/tau_E; the ITER deck calibration moved
8176
+ from C_alpha = 7.5 to 5.7 to keep f_alpha = 4.3 % (Shimada 2007).
8177
+ Cross-checked against METIS on the SF Plant V2 point (Sept 2026):
8178
+ at equal tau*_He/tau_E the two codes give the same f_He and P_fus.
8114
8179
 
8115
8180
  References
8116
8181
  ----------
8117
8182
  Y. Sarazin et al., Nucl. Fusion 60 (2020) 016010, Appendix B.
8118
8183
  """
8119
- # Volume-averaged reactivity via shared helper (uses T_i = tau_i_e * T_e)
8184
+ # Density-weighted reactivity integral I_fus (same as in f_nbar),
8185
+ # evaluated on T_i = tau_i_e * T_e. nu_n = None falls back to the
8186
+ # legacy <sigma.v>_vol (see Notes).
8120
8187
  sigmav_vol = _sigmav_vol(T_bar, nu_T, rho_ped, T_ped_frac,
8121
- Vprime_data=Vprime_data, tau_i_e=tau_i_e)
8188
+ Vprime_data=Vprime_data, tau_i_e=tau_i_e,
8189
+ nu_n=nu_n, n_ped_frac=n_ped_frac)
8122
8190
  C = n_bar * 1e20 * sigmav_vol * C_Alpha * tauE
8123
8191
  # Impurity-diluted closed form: solves (C/4)(1 - f_imp - 2 f)^2 = f;
8124
8192
  # reduces to the historical expression for f_imp = 0.
@@ -8142,7 +8210,7 @@ def f_tau_alpha(n_bar, T_bar, tauE, C_Alpha, nu_T,
8142
8210
  balance solved in `f_He_fraction`. Conversely, substituting f_α
8143
8211
  back into the particle balance yields the same identity:
8144
8212
 
8145
- τ*_α = 4 f_α / [ n_e (1 − 2f_α)² ⟨σv⟩_vol ] = C_α · τ_E
8213
+ τ*_α = 4 f_α / [ n_e (1 − 2f_α)² I_fus ] = C_α · τ_E
8146
8214
 
8147
8215
  so the two routes are algebraically equivalent.
8148
8216
 
@@ -9183,12 +9251,13 @@ if __name__ == "__main__":
9183
9251
  # ITER-1989 guideline formula at the PUBLISHED 95 % shaping and 15 MA
9184
9252
  # reproduces the ITER design value q95 = 3.0.
9185
9253
  # Helium ash: f_alpha solves the Sarazin steady-state balance with
9186
- # the deck removal efficiency C_alpha = 5 (tau*_alpha = C_alpha
9187
- # tau_E) at the chain tau_E. The value must close on the f_alpha
9188
- # forward reference injected in chain 2, which is the convergence
9189
- # criterion of the production solver. The production solver evaluates
9190
- # the ash balance with the cylindrical volume weight even in refined
9191
- # geometry (see D0FUS_run.py); the chain mirrors that call exactly.
9254
+ # the removal efficiency C_alpha (tau*_alpha = C_alpha tau_E) at the
9255
+ # chain tau_E. The value must close on the f_alpha forward reference
9256
+ # injected in chain 2, which is the convergence criterion of the
9257
+ # production solver. Since v2.8 the production solver evaluates the
9258
+ # ash balance with the density-weighted reactivity integral of
9259
+ # f_nbar and the Miller volume weight (see D0FUS_run.py); the chain
9260
+ # mirrors that call exactly, hence the ITER['C_Alpha'] value.
9192
9261
  _q95 = f_q95(ITER['B0'], ITER['Ip'], ITER['R0'], ITER['a'],
9193
9262
  ITER['kappa'], ITER['delta'], ITER['kappa95'],
9194
9263
  ITER['delta95'], Option_q95='Sauter')
@@ -9199,7 +9268,9 @@ if __name__ == "__main__":
9199
9268
  _fa = f_He_fraction(ITER['nbar'], ITER['Tbar'], ITER['tauE'],
9200
9269
  ITER['C_Alpha'], ITER['nu_T'],
9201
9270
  rho_ped=ITER['rho_ped'],
9202
- T_ped_frac=ITER['T_ped_frac'], tau_i_e=1.0)
9271
+ T_ped_frac=ITER['T_ped_frac'], tau_i_e=1.0,
9272
+ nu_n=ITER['nu_n'], n_ped_frac=ITER['n_ped_frac'],
9273
+ Vprime_data=ITER_Vpd)
9203
9274
  _ta = f_tau_alpha(ITER['nbar'], ITER['Tbar'], ITER['tauE'],
9204
9275
  ITER['C_Alpha'], ITER['nu_T'],
9205
9276
  rho_ped=ITER['rho_ped'],
@@ -9213,7 +9284,7 @@ if __name__ == "__main__":
9213
9284
  ("Gamma_n, Miller wall [MW/m2]", _Gam, FROZEN['Gamma_n'], 2e-3,
9214
9285
  "deck frozen"),
9215
9286
  ("Gamma_n [MW/m2]", _Gam, 0.57, 0.05, "Shimada 2007"),
9216
- ("f_He closure (C_alpha = 5) [-]", _fa, FROZEN['f_alpha'], 1e-3,
9287
+ ("f_He closure (chain C_alpha) [-]", _fa, FROZEN['f_alpha'], 1e-3,
9217
9288
  "solver fixed point"),
9218
9289
  ("f_He, IPB exhaust assumption [%]", _fa * 100, "4.4", None,
9219
9290
  "IPB 1999"),
@@ -9261,9 +9332,8 @@ if __name__ == "__main__":
9261
9332
 
9262
9333
  import D0FUS_BIB.D0FUS_figures as figs
9263
9334
  # plot_He_fraction takes separate ITER/DEMO removal efficiencies
9264
- # (C_Alpha_ITER=5.0, C_Alpha_DEMO=7.0 by default); defaults match the
9265
- # chain above (C_alpha = 5).
9266
- figs.plot_He_fraction(C_Alpha_ITER=ITER['C_Alpha'])
9335
+ # (C_Alpha_ITER = 5.7 by default, the v2.8 ITER deck calibration).
9336
+ figs.plot_He_fraction(C_Alpha_ITER=5.7)
9267
9337
 
9268
9338
  #%%
9269
9339
 
@@ -223,7 +223,8 @@ def compute_popcon(config, grid_spec, verbose=1):
223
223
 
224
224
  for jn, nbl in enumerate(nbar_line_grid):
225
225
  nbar_vol = f_nbar_vol_from_line(nbl, nu_n, rho_ped=rho_ped,
226
- n_ped_frac=n_ped_frac)
226
+ n_ped_frac=n_ped_frac,
227
+ Vprime_data=Vprime_data)
227
228
  P_fus = P_REF * (nbar_vol / n_ref_vol)**2
228
229
  P_alpha = f_P_alpha(P_fus)
229
230
 
@@ -894,7 +894,11 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
894
894
  rho_ped=rho_ped, n_ped_frac=n_ped_frac,
895
895
  T_ped_frac=T_ped_frac,
896
896
  Vprime_data=Vprime_data, tau_i_e=tau_i_e)
897
- nbar_line_loc = f_nbar_line(nbar_loc, nu_n, rho_ped, n_ped_frac)
897
+ # Vprime_data is required: nbar_loc is a volume average on the refined
898
+ # Miller Jacobian, so the profile rebuilt inside f_nbar_line must use
899
+ # the same volume element (see the f_nbar_line docstring).
900
+ nbar_line_loc = f_nbar_line(nbar_loc, nu_n, rho_ped, n_ped_frac,
901
+ Vprime_data=Vprime_data)
898
902
 
899
903
  # Radiative power losses [MW]
900
904
  # Fuel bremsstrahlung: uses Z_eff,fuel (D+T+He only) to avoid
@@ -1145,11 +1149,17 @@ def run(config: GlobalConfig = None, verbose: int = 0) -> tuple:
1145
1149
  f"I_Ohm={I_Ohm_loc:.2f}, P_Ohm={P_Ohm_loc:.3f}, "
1146
1150
  f"Q={Q_loc:.2f}")
1147
1151
 
1148
- # Helium ash fraction from confinement time
1152
+ # Helium ash fraction from confinement time. The density profile
1153
+ # (nu_n, n_ped_frac) and the volume weight (Vprime_data) are the
1154
+ # ones used by f_nbar above, so that the alpha source of the ash
1155
+ # balance is exactly P_fus / E_fus (v2.8 correction: the former
1156
+ # call dropped the n_hat^2 weight and the Miller weight, which
1157
+ # under-counted the source by 1.2 to 1.6).
1149
1158
  new_fa_loc = f_He_fraction(
1150
1159
  nbar_loc, Tbar, tau_E_loc, C_Alpha, nu_T,
1151
1160
  rho_ped=rho_ped, T_ped_frac=T_ped_frac, tau_i_e=tau_i_e,
1152
- f_imp=f_imp_dilution)
1161
+ f_imp=f_imp_dilution, nu_n=nu_n, n_ped_frac=n_ped_frac,
1162
+ Vprime_data=Vprime_data)
1153
1163
 
1154
1164
  if _dbg:
1155
1165
  print(f" new_f_alpha={new_fa_loc:.6f} (input={f_alpha:.6f})")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d0fus
3
- Version: 2.7.2
3
+ Version: 2.8.1
4
4
  Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
5
5
  Author-email: Timothé Auclair <timothe.auclair@gmail.com>
6
6
  Maintainer-email: Timothé Auclair <timothe.auclair@gmail.com>
@@ -278,7 +278,7 @@ Full derivations, validity domains and references: thesis, Chapter 1 and Appendi
278
278
 
279
279
  ## Version and citation
280
280
 
281
- The tag **v2.7.0** is the reference version of the thesis: the manuscript documents this exact state of the code, and the benchmarks of its Chapter 2 (module level, coil-by-coil against six machines, EU-DEMO 2017 and ITER device level) were produced with it. To cite D0FUS, use `CITATION.cff` (GitHub's *Cite this repository* button) or cite the thesis:
281
+ To cite D0FUS, use `CITATION.cff` (GitHub's *Cite this repository* button) or cite the thesis:
282
282
 
283
283
  > T. Auclair, *Apport des supraconducteurs à haute température critique au dimensionnement de machines de fusion nucléaire par confinement magnétique*, PhD thesis, Aix-Marseille Université / CEA-IRFM, 2026.
284
284
 
@@ -234,7 +234,7 @@ Full derivations, validity domains and references: thesis, Chapter 1 and Appendi
234
234
 
235
235
  ## Version and citation
236
236
 
237
- The tag **v2.7.0** is the reference version of the thesis: the manuscript documents this exact state of the code, and the benchmarks of its Chapter 2 (module level, coil-by-coil against six machines, EU-DEMO 2017 and ITER device level) were produced with it. To cite D0FUS, use `CITATION.cff` (GitHub's *Cite this repository* button) or cite the thesis:
237
+ To cite D0FUS, use `CITATION.cff` (GitHub's *Cite this repository* button) or cite the thesis:
238
238
 
239
239
  > T. Auclair, *Apport des supraconducteurs à haute température critique au dimensionnement de machines de fusion nucléaire par confinement magnétique*, PhD thesis, Aix-Marseille Université / CEA-IRFM, 2026.
240
240
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: d0fus
3
- Version: 2.7.2
3
+ Version: 2.8.1
4
4
  Summary: Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool
5
5
  Author-email: Timothé Auclair <timothe.auclair@gmail.com>
6
6
  Maintainer-email: Timothé Auclair <timothe.auclair@gmail.com>
@@ -278,7 +278,7 @@ Full derivations, validity domains and references: thesis, Chapter 1 and Appendi
278
278
 
279
279
  ## Version and citation
280
280
 
281
- The tag **v2.7.0** is the reference version of the thesis: the manuscript documents this exact state of the code, and the benchmarks of its Chapter 2 (module level, coil-by-coil against six machines, EU-DEMO 2017 and ITER device level) were produced with it. To cite D0FUS, use `CITATION.cff` (GitHub's *Cite this repository* button) or cite the thesis:
281
+ To cite D0FUS, use `CITATION.cff` (GitHub's *Cite this repository* button) or cite the thesis:
282
282
 
283
283
  > T. Auclair, *Apport des supraconducteurs à haute température critique au dimensionnement de machines de fusion nucléaire par confinement magnétique*, PhD thesis, Aix-Marseille Université / CEA-IRFM, 2026.
284
284
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "d0fus"
7
- version = "2.7.2"
7
+ version = "2.8.1"
8
8
  description = "Design 0-dimensional for Fusion Systems - Tokamak power plant design and optimization tool"
9
9
  readme = "README.md"
10
10
  license = {text = "CeCILL-C"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes