From 229400ef7e93add8986d5d95f3030bee7af032c9 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 8 Nov 2024 13:50:23 +0000 Subject: [PATCH] Rename 'dnbeam' to 'beam_density' for clarity and consistency across physics calculations --- process/physics.py | 20 ++++++++++---------- source/fortran/constraint_equations.f90 | 10 +++++----- source/fortran/physics_variables.f90 | 4 ++-- tests/integration/ref_dicts.json | 6 +++--- tests/unit/test_physics.py | 8 ++++---- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/process/physics.py b/process/physics.py index 9afa7f19f..1a824df49 100644 --- a/process/physics.py +++ b/process/physics.py @@ -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 @@ -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 ) @@ -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[ @@ -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 ) @@ -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: @@ -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: @@ -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( diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 8860d4a13..87c3b97b4 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -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 @@ -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 diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 3d2c29887..51d41b003 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -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 @@ -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 diff --git a/tests/integration/ref_dicts.json b/tests/integration/ref_dicts.json index 948132a67..f13fb135d 100644 --- a/tests/integration/ref_dicts.json +++ b/tests/integration/ref_dicts.json @@ -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, @@ -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)", @@ -19074,7 +19074,7 @@ "dlamie", "dlimit", "dnalp", - "dnbeam", + "beam_density", "beam_density_out", "dnbeta", "dnelimt", diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 81e693547..078fb7851 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -894,7 +894,7 @@ class PlasmaCompositionParam(NamedTuple): alphan: Any = None - dnbeam: Any = None + beam_density: Any = None f_helium3: Any = None @@ -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, @@ -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, @@ -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