Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions documentation/development/standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,18 @@ This should be used for units of $\text{kg} \cdot \text{m}^{-2}\text{s}^{-1}$

---------------------

##### Electric charges

- Electric charges should start with the `charge_` prefix

--------------------

###### Charge numbers

- Electric charge numbers should start with the `n_charge_` prefix.

------------------

##### Current densities

- Current densities should start with the `j_` prefix
Expand Down
6 changes: 3 additions & 3 deletions process/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1654,12 +1654,12 @@ def constraint_equation_64():
"""Upper limit on Zeff
author: P B Lloyd, CCFE, Culham Science Centre

fzeff_max: f-value for maximum zeff
fzeff_max: f-value for maximum n_charge_plasma_effective_vol_avg
zeff_max: maximum value for Zeff
zeff: plasma effective charge
n_charge_plasma_effective_vol_avg: plasma effective charge
"""
cc = (
data_structure.physics_variables.zeff
data_structure.physics_variables.n_charge_plasma_effective_vol_avg
/ data_structure.constraint_variables.zeff_max
- 1.0 * data_structure.constraint_variables.fzeff_max
)
Expand Down
38 changes: 26 additions & 12 deletions process/current_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def iternb(self):
physics_variables.nd_plasma_electrons_vol_avg,
dend,
dent,
physics_variables.zeffai,
physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg,
physics_variables.dlamie,
)

Expand All @@ -102,7 +102,7 @@ def iternb(self):
current_drive_variables.e_beam_kev,
physics_variables.rmajor,
physics_variables.temp_plasma_electron_density_weighted_kev,
physics_variables.zeff,
physics_variables.n_charge_plasma_effective_vol_avg,
)

return effnbss, f_p_beam_injected_ions, fshine
Expand Down Expand Up @@ -179,7 +179,7 @@ def culnbi(self):
physics_variables.nd_plasma_electrons_vol_avg,
dend,
dent,
physics_variables.zeffai,
physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg,
physics_variables.dlamie,
)

Expand All @@ -198,7 +198,7 @@ def culnbi(self):
physics_variables.rmajor,
physics_variables.rminor,
physics_variables.temp_plasma_electron_density_weighted_kev,
physics_variables.zeff,
physics_variables.n_charge_plasma_effective_vol_avg,
)

return effnbss, f_p_beam_injected_ions, fshine
Expand Down Expand Up @@ -491,7 +491,17 @@ def sigbeam(self, eb, te, ne, rnhe, rnc, rno, rnfe):

return max(1e-20 * (np.exp(s1) / eb * (1.0 + sz)), 1e-23)

def cfnbi(self, afast, efast, te, ne, _nd, _nt, zeffai, xlmbda):
def cfnbi(
self,
afast,
efast,
te,
ne,
_nd,
_nt,
n_charge_plasma_effective_mass_weighted_vol_avg,
xlmbda,
):
"""Routine to calculate the fraction of the fast particle energy
coupled to the ions
author: P J Knight, CCFE, Culham Science Centre
Expand All @@ -501,7 +511,7 @@ def cfnbi(self, afast, efast, te, ne, _nd, _nt, zeffai, xlmbda):
ne : input real : volume averaged electron density (m**-3)
nd : input real : deuterium beam density (m**-3)
nt : input real : tritium beam density (m**-3)
zeffai : input real : mass weighted plasma effective charge
n_charge_plasma_effective_mass_weighted_vol_avg : input real : mass weighted plasma effective charge
xlmbda : input real : ion-electron coulomb logarithm
f_p_beam_injected_ions : output real : fraction of fast particle energy coupled to ions
This routine calculates the fast particle energy coupled to
Expand All @@ -522,7 +532,7 @@ def cfnbi(self, afast, efast, te, ne, _nd, _nt, zeffai, xlmbda):
# ecritfix = 16.0e0 * te * afast * (sum / (ne * xlmbda)) ** (2.0e0 / 3.0e0)

xlmbdai = self.xlmbdabi(afast, atmdt, efast, te, ne)
sumln = zeffai * xlmbdai / xlmbda
sumln = n_charge_plasma_effective_mass_weighted_vol_avg * xlmbdai / xlmbda
xlnrat = (
3.0e0 * np.sqrt(np.pi) / 4.0e0 * me / constants.PROTON_MASS * sumln
) ** (2.0e0 / 3.0e0)
Expand Down Expand Up @@ -605,7 +615,7 @@ def culecd(self):
epsloc = rrr * physics_variables.rminor / physics_variables.rmajor

# Effective charge (use average value)
zlocal = physics_variables.zeff
zlocal = physics_variables.n_charge_plasma_effective_vol_avg

# Coulomb logarithm for ion-electron collisions
# (From J. A. Wesson, 'Tokamaks', Clarendon Press, Oxford, p.293)
Expand Down Expand Up @@ -1066,7 +1076,11 @@ def cullhy(self):

x = 24.0e0 / (nplacc * np.sqrt(tlocal))

term01 = 6.1e0 / (nplacc * nplacc * (physics_variables.zeff + 5.0e0))
term01 = 6.1e0 / (
nplacc
* nplacc
* (physics_variables.n_charge_plasma_effective_vol_avg + 5.0e0)
)
term02 = 1.0e0 + (tlocal / 25.0e0) ** 1.16e0
term03 = epslh**0.77e0 * np.sqrt(12.25e0 + x * x)
term04 = 3.5e0 * epslh**0.77e0 + x
Expand Down Expand Up @@ -1351,7 +1365,7 @@ def cudriv(self) -> None:
* current_drive_variables.feffcd,
2: lambda: self.ion_cyclotron.ion_cyclotron_ipdg89(
temp_plasma_electron_density_weighted_kev=physics_variables.temp_plasma_electron_density_weighted_kev,
zeff=physics_variables.zeff,
zeff=physics_variables.n_charge_plasma_effective_vol_avg,
rmajor=physics_variables.rmajor,
dene20=dene20,
)
Expand All @@ -1368,7 +1382,7 @@ def cudriv(self) -> None:
beta=physics_variables.beta_total_vol_avg,
rmajor=physics_variables.rmajor,
dene20=dene20,
zeff=physics_variables.zeff,
zeff=physics_variables.n_charge_plasma_effective_vol_avg,
)
* current_drive_variables.feffcd,
5: lambda: (
Expand All @@ -1393,7 +1407,7 @@ def cudriv(self) -> None:
* current_drive_variables.feffcd,
13: lambda: self.electron_cyclotron.electron_cyclotron_freethy(
te=physics_variables.temp_plasma_electron_vol_avg_kev,
zeff=physics_variables.zeff,
zeff=physics_variables.n_charge_plasma_effective_vol_avg,
rmajor=physics_variables.rmajor,
nd_plasma_electrons_vol_avg=physics_variables.nd_plasma_electrons_vol_avg,
b_plasma_toroidal_on_axis=physics_variables.b_plasma_toroidal_on_axis,
Expand Down
2 changes: 1 addition & 1 deletion process/data_structure/constraint_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@


fzeff_max: float = None
"""f-value for maximum zeff (`constraint equation 64`, `iteration variable 112`)"""
"""f-value for maximum n_charge_plasma_effective_vol_avg (`constraint equation 64`, `iteration variable 112`)"""


eta_cd_norm_hcd_primary_max: float = None
Expand Down
5 changes: 5 additions & 0 deletions process/data_structure/impurity_radiation_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

f_nd_impurity_electrons: list[float] = None

n_charge_impurity_profile: list[float] = None
"""charge profile of impurities"""

imp_label: list[str] = None

impurity_arr_label: list[str] = None
Expand All @@ -53,6 +56,7 @@ def init_impurity_radiation_module():
global radius_plasma_core_norm
global f_p_plasma_core_rad_reduction
global f_nd_impurity_electrons
global n_charge_impurity_profile
global imp_label
global impurity_arr_label
global impurity_arr_z
Expand Down Expand Up @@ -101,6 +105,7 @@ def init_impurity_radiation_module():
impurity_arr_z = np.zeros(N_IMPURITIES)
m_impurity_amu_array = np.zeros(N_IMPURITIES)
f_nd_impurity_electron_array = np.zeros(N_IMPURITIES)
n_charge_impurity_profile = np.zeros((N_IMPURITIES, 200))
impurity_arr_len_tab = np.full(N_IMPURITIES, 0)
temp_impurity_keV_array = np.zeros((N_IMPURITIES, 200))
pden_impurity_lz_nd_temp_array = np.zeros((N_IMPURITIES, 200))
Expand Down
21 changes: 13 additions & 8 deletions process/data_structure/physics_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,12 +1307,15 @@
"""plasma poloidal cross-sectional area [m^2]"""


zeff: float = None
"""plasma effective charge"""
n_charge_plasma_effective_vol_avg: float = None
"""Volume averaged plasma effective charge"""

n_charge_plasma_effective_profile: list[float] = None
"""Profile of plasma effective charge"""

zeffai: float = None
"""mass weighted plasma effective charge"""

n_charge_plasma_effective_mass_weighted_vol_avg: float = None
"""Plasma mass-weighted volume averaged plasma effective charge"""


def init_physics_module():
Expand Down Expand Up @@ -1628,8 +1631,9 @@ def init_physics_variables():
global pflux_fw_neutron_mw
global wtgpd
global a_plasma_poloidal
global zeff
global zeffai
global n_charge_plasma_effective_vol_avg
global n_charge_plasma_effective_profile
global n_charge_plasma_effective_mass_weighted_vol_avg

m_beam_amu = 0.0
m_fuel_amu = 0.0
Expand Down Expand Up @@ -1886,5 +1890,6 @@ def init_physics_variables():
pflux_fw_neutron_mw = 0.0
wtgpd = 0.0
a_plasma_poloidal = 0.0
zeff = 0.0
zeffai = 0.0
n_charge_plasma_effective_vol_avg = 0.0
n_charge_plasma_effective_profile = []
n_charge_plasma_effective_mass_weighted_vol_avg = 0.0
6 changes: 3 additions & 3 deletions process/fusion_reactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ def beam_fusion(
temp_plasma_electron_density_weighted_kev: float,
temp_plasma_ion_density_weighted_kev: float,
vol_plasma: float,
zeffai: float,
n_charge_plasma_effective_mass_weighted_vol_avg: float,
) -> tuple:
"""
Routine to calculate beam slowing down properties.
Expand All @@ -941,7 +941,7 @@ def beam_fusion(
temp_plasma_electron_density_weighted_kev (float): Density-weighted electron temperature (keV).
temp_plasma_ion_density_weighted_kev (float): Density-weighted ion temperature (keV).
vol_plasma (float): Plasma volume (m^3).
zeffai (float): Mass weighted plasma effective charge.
n_charge_plasma_effective_mass_weighted_vol_avg (float): Mass weighted plasma effective charge.

Returns:
tuple: A tuple containing the following elements:
Expand Down Expand Up @@ -987,7 +987,7 @@ def beam_fusion(
14.8
* constants.M_DEUTERON_AMU
* temp_plasma_electron_density_weighted_kev
* zeffai ** (2 / 3)
* n_charge_plasma_effective_mass_weighted_vol_avg ** (2 / 3)
* (ion_electron_coulomb_log + 4.0)
/ ion_electron_coulomb_log
)
Expand Down
2 changes: 1 addition & 1 deletion process/io/mfile_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"nd_plasma_separatrix_electron",
"temp_plasma_pedestal_kev",
"nd_plasma_pedestal_electron",
"zeff",
"n_charge_plasma_effective_vol_avg",
"nd_plasma_impurities_vol_avg",
"t_energy_confinement",
"hfact",
Expand Down
Loading
Loading