Skip to content

Commit

Permalink
Rename 'dnbeam' to 'beam_density' for clarity and consistency across …
Browse files Browse the repository at this point in the history
…physics calculations
  • Loading branch information
chris-ashe committed Nov 8, 2024
1 parent 80e5a83 commit 229400e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
20 changes: 10 additions & 10 deletions process/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2498,9 +2498,9 @@ def plasma_composition():
# Beam hot ion component
# If ignited, prevent beam fusion effects
if physics_variables.ignite == 0:
physics_variables.dnbeam = physics_variables.dene * physics_variables.rnbeam
physics_variables.beam_density = physics_variables.dene * physics_variables.rnbeam
else:
physics_variables.dnbeam = 0.0
physics_variables.beam_density = 0.0

# Sum of Zi.ni for all impurity ions (those with charge > helium)
znimp = 0.0
Expand All @@ -2519,7 +2519,7 @@ def plasma_composition():
physics_variables.dene
- 2.0 * physics_variables.dnalp
- physics_variables.dnprot
- physics_variables.dnbeam
- physics_variables.beam_density
- znimp
)

Expand All @@ -2536,7 +2536,7 @@ def plasma_composition():
physics_variables.dnprot
+ (physics_variables.f_deuterium + physics_variables.f_tritium)
* physics_variables.deni
+ physics_variables.dnbeam
+ physics_variables.beam_density
) / physics_variables.dene

impurity_radiation_module.impurity_arr_frac[
Expand All @@ -2562,7 +2562,7 @@ def plasma_composition():
physics_variables.deni
+ physics_variables.dnalp
+ physics_variables.dnprot
+ physics_variables.dnbeam
+ physics_variables.beam_density
+ physics_variables.dnz
)

Expand Down Expand Up @@ -2646,7 +2646,7 @@ def plasma_composition():
physics_variables.afuel * physics_variables.deni
+ 4.0 * physics_variables.dnalp
+ physics_variables.dnprot
+ physics_variables.abeam * physics_variables.dnbeam
+ physics_variables.abeam * physics_variables.beam_density
)
for imp in range(impurity_radiation_module.nimp):
if impurity_radiation_module.impurity_arr_z[imp] > 2:
Expand All @@ -2666,9 +2666,9 @@ def plasma_composition():
+ physics_variables.dnalp
+ physics_variables.dnprot
+ (1.0 - current_drive_variables.f_tritium_beam)
* physics_variables.dnbeam
* physics_variables.beam_density
/ 2.0
+ current_drive_variables.f_tritium_beam * physics_variables.dnbeam / 3.0
+ current_drive_variables.f_tritium_beam * physics_variables.beam_density / 3.0
) / physics_variables.dene
for imp in range(impurity_radiation_module.nimp):
if impurity_radiation_module.impurity_arr_z[imp] > 2:
Expand Down Expand Up @@ -3692,8 +3692,8 @@ def outplas(self):
po.ovarre(
self.outfile,
"Hot beam density (/m3)",
"(dnbeam)",
physics_variables.dnbeam,
"(beam_density)",
physics_variables.beam_density,
"OP ",
)
po.ovarre(
Expand Down
10 changes: 5 additions & 5 deletions source/fortran/constraint_equations.f90
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,8 @@ subroutine constraint_eqn_007(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
!! during plasma start-up, and is excluded from all steady-state
!! power balance calculations.
!! beam_density_out : input real : hot beam ion density from calculation (/m3)
!! dnbeam : input real : hot beam ion density, variable (/m3)
use physics_variables, only: ignite, beam_density_out, dnbeam
!! beam_density : input real : hot beam ion density, variable (/m3)
use physics_variables, only: ignite, beam_density_out, beam_density
implicit none
real(dp), intent(out) :: tmp_cc
real(dp), intent(out) :: tmp_con
Expand All @@ -723,9 +723,9 @@ subroutine constraint_eqn_007(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)

! Do not assume plasma ignition:
if (ignite == 0) then
tmp_cc = 1.0D0 - beam_density_out/dnbeam
tmp_con = dnbeam * (1.0D0 - tmp_cc)
tmp_err = dnbeam * tmp_cc
tmp_cc = 1.0D0 - beam_density_out/beam_density
tmp_con = beam_density * (1.0D0 - tmp_cc)
tmp_err = beam_density * tmp_cc
tmp_symbol = '='
tmp_units = '/m3'
else
Expand Down
4 changes: 2 additions & 2 deletions source/fortran/physics_variables.f90
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module physics_variables
real(dp) :: dnalp
!! thermal alpha density (/m3)

real(dp) :: dnbeam
real(dp) :: beam_density
!! hot beam ion density, variable (/m3)

real(dp) :: beam_density_out
Expand Down Expand Up @@ -936,7 +936,7 @@ subroutine init_physics_variables
dlamie = 0.0D0
dlimit = 0.0D0
dnalp = 0.0D0
dnbeam = 0.0D0
beam_density = 0.0D0
beam_density_out = 0.0D0
dnbeta = 3.5D0
dnelimt = 0.0D0
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/ref_dicts.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@
],
"dlscal": 0.0,
"dnalp": 0.0,
"dnbeam": 0.0,
"beam_density": 0.0,
"beam_density_out": 0.0,
"dnbeta": 3.5,
"dndrho_max": null,
Expand Down Expand Up @@ -9302,7 +9302,7 @@
"dlimit": "density limit (/m3) as calculated using various models",
"dlscal": "vacuum system duct length scaling",
"dnalp": "thermal alpha density (/m3)",
"dnbeam": "hot beam ion density, variable (/m3)",
"beam_density": "hot beam ion density, variable (/m3)",
"beam_density_out": "hot beam ion density from calculation (/m3)",
"dnbeta": "Troyon-like coefficient for beta scaling calculated\n as 4*rli if `iprofile=1` (see also gtscale option)",
"dndrho_max": "Maximum density gradient wrt to normalized r (rho) (/m3)",
Expand Down Expand Up @@ -19074,7 +19074,7 @@
"dlamie",
"dlimit",
"dnalp",
"dnbeam",
"beam_density",
"beam_density_out",
"dnbeta",
"dnelimt",
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ class PlasmaCompositionParam(NamedTuple):

alphan: Any = None

dnbeam: Any = None
beam_density: Any = None

f_helium3: Any = None

Expand Down Expand Up @@ -1026,7 +1026,7 @@ class PlasmaCompositionParam(NamedTuple):
proton_rate_density=0,
f_deuterium=0.5,
alphan=1,
dnbeam=0,
beam_density=0,
f_helium3=0,
dnalp=0,
dene=7.5e19,
Expand Down Expand Up @@ -1148,7 +1148,7 @@ class PlasmaCompositionParam(NamedTuple):
proton_rate_density=540072280299564.38,
f_deuterium=0.5,
alphan=1,
dnbeam=0,
beam_density=0,
f_helium3=0,
dnalp=7.5e18,
dene=7.5e19,
Expand Down Expand Up @@ -1306,7 +1306,7 @@ def test_plasma_composition(plasmacompositionparam, monkeypatch, physics):

monkeypatch.setattr(physics_variables, "alphan", plasmacompositionparam.alphan)

monkeypatch.setattr(physics_variables, "dnbeam", plasmacompositionparam.dnbeam)
monkeypatch.setattr(physics_variables, "beam_density", plasmacompositionparam.beam_density)

monkeypatch.setattr(
physics_variables, "f_helium3", plasmacompositionparam.f_helium3
Expand Down

0 comments on commit 229400e

Please sign in to comment.