Skip to content

Commit

Permalink
🔄 Rename beta_limit_upper to beta_max for consistency across codebase…
Browse files Browse the repository at this point in the history
… and documentation
  • Loading branch information
chris-ashe committed Dec 19, 2024
1 parent a3bc522 commit aee23af
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 37 deletions.
16 changes: 8 additions & 8 deletions process/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2355,8 +2355,8 @@ def physics(self):
(physics_variables.c_beta / Fp) * (12.5e0 - 3.5e0 * Fp)
)

# calculate_beta_limit() returns the beta_limit_upper for beta
physics_variables.beta_limit_upper = calculate_beta_limit(
# calculate_beta_limit() returns the beta_max for beta
physics_variables.beta_max = calculate_beta_limit(
physics_variables.bt,
physics_variables.beta_norm_limit_upper,
physics_variables.plasma_current,
Expand Down Expand Up @@ -3594,24 +3594,24 @@ def outplas(self):
po.ovarrf(
self.outfile,
"Limit on total beta",
"(beta_limit_upper)",
physics_variables.beta_limit_upper,
"(beta_max)",
physics_variables.beta_max,
"OP ",
)
elif physics_variables.i_beta_component == 1:
po.ovarrf(
self.outfile,
"Limit on thermal beta",
"(beta_limit_upper)",
physics_variables.beta_limit_upper,
"(beta_max)",
physics_variables.beta_max,
"OP ",
)
else:
po.ovarrf(
self.outfile,
"Limit on thermal + NB beta",
"(beta_limit_upper)",
physics_variables.beta_limit_upper,
"(beta_max)",
physics_variables.beta_max,
"OP ",
)

Expand Down
2 changes: 1 addition & 1 deletion process/stellarator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4473,7 +4473,7 @@ def stphys(self, output):
)

# Calculate physics_variables.beta limit. Does nothing atm so commented out
# call stblim(physics_variables.beta_limit_upper)
# call stblim(physics_variables.beta_max)

# Calculate the neoclassical sanity check with PROCESS parameters
(
Expand Down
28 changes: 14 additions & 14 deletions source/fortran/constraint_equations.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ subroutine constraint_eqn_024(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
!! residual error in physical units; output string; units string
!! Equation for beta upper limit
!! #=# physics
!! #=#=# fbeta_max, beta_limit_upper
!! #=#=# fbeta_max, beta_max
!! and hence also optional here.
!! Logic change during pre-factoring: err, symbol, units will be assigned only if present.
!! i_beta_component : input integer : switch for beta limit scaling (constraint equation 24):<UL>
Expand All @@ -1268,13 +1268,13 @@ subroutine constraint_eqn_024(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
!! <LI> = 0 use tokamak model;
!! <LI> = 1 use stellarator model</UL>
!! fbeta_max : input real : f-value for beta limit
!! beta_limit_upper : input real : allowable beta
!! beta_max : input real : allowable beta
!! beta : input real : total plasma beta (calculated if ipedestal =3)
!! beta_fast_alpha : input real : fast alpha beta component
!! beta_beam : input real : neutral beam beta component
!! bt : input real : toroidal field
!! btot : input real : total field
use physics_variables, only: i_beta_component, beta_limit_upper, beta, beta_beam, beta_fast_alpha, bt, btot
use physics_variables, only: i_beta_component, beta_max, beta, beta_beam, beta_fast_alpha, bt, btot
use stellarator_variables, only: istell
use constraint_variables, only: fbeta_max
implicit none
Expand All @@ -1286,30 +1286,30 @@ subroutine constraint_eqn_024(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)

! Include all beta components: relevant for both tokamaks and stellarators
if ((i_beta_component == 0).or.(istell /= 0)) then
tmp_cc = 1.0D0 - fbeta_max * beta_limit_upper/beta
tmp_con = beta_limit_upper
tmp_err = beta_limit_upper - beta / fbeta_max
tmp_cc = 1.0D0 - fbeta_max * beta_max/beta
tmp_con = beta_max
tmp_err = beta_max - beta / fbeta_max
tmp_symbol = '<'
tmp_units = ''
! Here, the beta limit applies to only the thermal component, not the fast alpha or neutral beam parts
else if (i_beta_component == 1) then
tmp_cc = 1.0D0 - fbeta_max * beta_limit_upper/(beta-beta_fast_alpha-beta_beam)
tmp_con = beta_limit_upper
tmp_err = beta_limit_upper - (beta-beta_fast_alpha-beta_beam) / fbeta_max
tmp_cc = 1.0D0 - fbeta_max * beta_max/(beta-beta_fast_alpha-beta_beam)
tmp_con = beta_max
tmp_err = beta_max - (beta-beta_fast_alpha-beta_beam) / fbeta_max
tmp_symbol = '<'
tmp_units = ''
! Beta limit applies to thermal + neutral beam: components of the total beta, i.e. excludes alphas
else if (i_beta_component == 2) then
tmp_cc = 1.0D0 - fbeta_max * beta_limit_upper/(beta-beta_fast_alpha)
tmp_con = beta_limit_upper * (1.0D0 - tmp_cc)
tmp_cc = 1.0D0 - fbeta_max * beta_max/(beta-beta_fast_alpha)
tmp_con = beta_max * (1.0D0 - tmp_cc)
tmp_err = (beta-beta_fast_alpha) * tmp_cc
tmp_symbol = '<'
tmp_units = ''
! Beta limit applies to toroidal beta
else if (i_beta_component == 3) then
tmp_cc = 1.0D0 - fbeta_max * beta_limit_upper/(beta*(btot/bt)**2)
tmp_con = beta_limit_upper
tmp_err = beta_limit_upper - (beta*(btot/bt)**2) / fbeta_max
tmp_cc = 1.0D0 - fbeta_max * beta_max/(beta*(btot/bt)**2)
tmp_con = beta_max
tmp_err = beta_max - (beta*(btot/bt)**2) / fbeta_max
tmp_symbol = '<'
tmp_units = ''
end if
Expand Down
6 changes: 3 additions & 3 deletions source/fortran/input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ subroutine parse_input_file(in_file,out_file,show_changes)
itart, ralpne, iprofile, triang95, rad_fraction_sol, betbm0, protium, &
teped, f_helium3, iwalld, gamma, f_alpha_plasma, fgwped, tbeta, i_bootstrap_current, &
iradloss, te, alphan, rmajor, kappa, iinvqd, fkzohm, beamfus0, &
tauratio, idensl, bt, iscrp, ipnlaws, beta_limit_upper, beta_limit_lower, &
tauratio, idensl, bt, iscrp, ipnlaws, beta_max, beta_limit_lower, &
i_diamagnetic_current, i_pfirsch_schluter_current, m_s_limit, burnup_in
use pf_power_variables, only: iscenr, maxpoloidalpower
use pulse_variables, only: lpulse, dtstor, itcycl, istore, bctmp
Expand Down Expand Up @@ -530,8 +530,8 @@ subroutine parse_input_file(in_file,out_file,show_changes)
case ('beta')
call parse_real_variable('beta', beta, 0.0D0, 1.0D0, &
'Plasma beta')
case ('beta_limit_upper')
call parse_real_variable('beta_limit_upper', beta_limit_upper, 0.0D0, 1.0D0, &
case ('beta_max')
call parse_real_variable('beta_max', beta_max, 0.0D0, 1.0D0, &
'Plasma beta upper limit')
case ('beta_limit_lower')
call parse_real_variable('beta_limit_lower', beta_limit_lower, 0.0D0, 1.0D0, &
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 @@ -56,7 +56,7 @@ module physics_variables
real(dp) :: beta_fast_alpha
!! fast alpha beta component

real(dp) :: beta_limit_upper
real(dp) :: beta_max
!! Max allowable beta

real(dp) :: beta_limit_lower
Expand Down Expand Up @@ -947,7 +947,7 @@ subroutine init_physics_variables
beamfus0 = 1.0D0
beta = 0.042D0
beta_fast_alpha = 0.0D0
beta_limit_upper = 0.0D0
beta_max = 0.0D0
beta_limit_lower = 0.0D0
beta_beam = 0.0D0
beta_poloidal = 0.0D0
Expand Down
4 changes: 2 additions & 2 deletions source/fortran/scan.f90
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ subroutine scan_1d_store_output(iscan, ifail, noutvars_, ipnscns_, outvar)
use fwbs_variables, only: tpeak
use physics_variables, only: q, aspect, pradmw, dene, fusion_power, btot, tesep, &
pdivt, ralpne, ten, beta_poloidal, hfac, teped, alpha_power_beams, qlim, rmajor, wallmw, &
beta, beta_limit_upper, bt, plasma_current
beta, beta_max, bt, plasma_current
use global_variables, only: verbose, maxcal, runtitle, run_tests
use constants, only: nout
implicit none
Expand Down Expand Up @@ -229,7 +229,7 @@ subroutine scan_1d_store_output(iscan, ifail, noutvars_, ipnscns_, outvar)
outvar(15,iscan) = q
outvar(16,iscan) = qlim
outvar(17,iscan) = beta
outvar(18,iscan) = beta_limit_upper
outvar(18,iscan) = beta_max
outvar(19,iscan) = beta_poloidal / aspect
outvar(20,iscan) = ten/10.0D0
outvar(21,iscan) = dene/1.0D20
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/ref_dicts.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"beta_mcdonald": 0.0,
"beta_fast_alpha": 0.0,
"betai": 1.0,
"beta_limit_upper": 0.0,
"beta_max": 0.0,
"beta_limit_lower": 0.0,
"beta_beam": 0.0,
"betao": 1.0,
Expand Down Expand Up @@ -8871,7 +8871,7 @@
"beta_mcdonald": "",
"beta_fast_alpha": "fast alpha beta component",
"betai": "poloidal plane angle between divertor plate and leg, inboard (rad)",
"beta_limit_upper": "allowable beta",
"beta_max": "allowable beta",
"beta_limit_lower": "allowable lower beta",
"beta_beam": "neutral beam beta component",
"betao": "poloidal plane angle between divertor plate and leg, outboard (rad)",
Expand Down Expand Up @@ -11681,7 +11681,7 @@
"lb": 0.0,
"ub": 1.5707
},
"beta_limit_upper": {
"beta_max": {
"lb": 0.0,
"ub": 1.0
},
Expand Down Expand Up @@ -19076,7 +19076,7 @@
"beamfus0",
"beta",
"beta_fast_alpha",
"beta_limit_upper",
"beta_max",
"beta_limit_lower",
"beta_beam",
"beta_poloidal",
Expand Down Expand Up @@ -20036,7 +20036,7 @@
"beamwd": "real_variable",
"beta": "real_variable",
"betai": "real_variable",
"beta_limit_upper": "real_variable",
"beta_max": "real_variable",
"beta_limit_lower": "real_variable",
"betao": "real_variable",
"betbm0": "real_variable",
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/input_files/st_regression.IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ icc = 24
* JUSTIFICATION: Limit for plasma stability
* VARIABLES: beta calculated in-situ

*beta_limit_upper
*beta_max
* DESCRIPTION: Plasma beta upper limit
* JUSTIFICATION: Turned off, not in use. icc=24. Allow to be calculated in-situ

Expand Down
2 changes: 1 addition & 1 deletion tests/regression/input_files/stellarator.IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fptfnuc = 1 *f-value neutron heating

*----------------Physics Variables-----------------*

beta_limit_upper = 0.06 * upper beta limit
beta_max = 0.06 * upper beta limit
beta_limit_lower = 0.01 * lower beta limit
bigqmin = 1 * Minimal BigQ

Expand Down

0 comments on commit aee23af

Please sign in to comment.