Skip to content

Commit

Permalink
Rename switch variable iculbl to i_beta_component for clarity in beta…
Browse files Browse the repository at this point in the history
… limit scaling
  • Loading branch information
chris-ashe committed Nov 8, 2024
1 parent 3cbbb23 commit 77a09f2
Show file tree
Hide file tree
Showing 25 changed files with 49 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ constraint equation 24 should be turned on with iteration variable 36

By default, $\beta$ is defined with respect to the total equilibrium B-field [^2].

| `iculbl` | Description |
| `i_beta_component` | Description |
| :-: | - |
| 0 (default) | Apply the $\beta$ limit to the total plasma beta (including the contribution from fast ions) |
| 1 | Apply the $\beta$ limit to only the thermal component of beta |
| 2 | Apply the $\beta$ limit to only the thermal plus neutral beam contributions to beta |
| 3 | Apply the $\beta$ limit to the total beta (including the contribution from fast ions), calculated using only the toroidal field |

### Setting the Beta $g$ Coefficient
## Setting the Beta $g$ Coefficient

Switch `iprofile` determines how the beta $g$ coefficient `dnbeta` should
be calculated.
Expand All @@ -37,13 +37,17 @@ be calculated.

Further details on the calculation of `alphaj` and `rli` is given in [Plasma Current](./plasma_current.md).

### Limiting $\epsilon\beta_p$
## Limiting $\epsilon\beta_p$

To apply a limit to the value of $\epsilon\beta_p$, where $\epsilon = a/R$ is
the inverse aspect ratio and $\beta_p$ is the poloidal $\beta$, constraint equation no. 6 should be
turned on with iteration variable no. 8 (`fbeta`). The limiting value of $\epsilon\beta_p$
is be set using input parameter `epbetmax`.

## Key Constraints



[^1]: N.A. Uckan and ITER Physics Group, 'ITER Physics Design Guidelines: 1989',

[^2]: D.J. Ward, 'PROCESS Fast Alpha Pressure', Work File Note F/PL/PJK/PROCESS/CODE/050
Expand Down
2 changes: 1 addition & 1 deletion examples/data/csv_output_large_tokamak_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion examples/data/large_tokamak_1_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion examples/data/large_tokamak_2_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion examples/data/large_tokamak_3_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion examples/data/large_tokamak_4_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion examples/data/large_tokamak_IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion examples/data/scan_example_file_IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
14 changes: 7 additions & 7 deletions process/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ def calculate_beta_limit(
This subroutine calculates the beta limit using the algorithm documented in AEA FUS 172.
The limit applies to beta defined with respect to the total B-field.
Switch iculbl determines which components of beta to include.
Switch i_beta_component determines which components of beta to include.
Notes:
- If iculbl = 0, then the limit is applied to the total beta.
- If iculbl = 1, then the limit is applied to the thermal beta only.
- If iculbl = 2, then the limit is applied to the thermal + neutral beam beta components.
- If iculbl = 3, then the limit is applied to the toroidal beta.
- If i_beta_component = 0, then the limit is applied to the total beta.
- If i_beta_component = 1, then the limit is applied to the thermal beta only.
- If i_beta_component = 2, then the limit is applied to the thermal + neutral beam beta components.
- If i_beta_component = 3, then the limit is applied to the toroidal beta.
- The default value for the g coefficient is dnbeta = 3.5.
Expand Down Expand Up @@ -3574,15 +3574,15 @@ def outplas(self):
"OP ",
)

if physics_variables.iculbl == 0:
if physics_variables.i_beta_component == 0:
po.ovarrf(
self.outfile,
"Limit on total beta",
"(betalim)",
physics_variables.betalim,
"OP ",
)
elif physics_variables.iculbl == 1:
elif physics_variables.i_beta_component == 1:
po.ovarrf(
self.outfile,
"Limit on thermal beta",
Expand Down
12 changes: 6 additions & 6 deletions source/fortran/constraint_equations.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ subroutine constraint_eqn_024(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
!! #=#=# fbetatry, betalim
!! and hence also optional here.
!! Logic change during pre-factoring: err, symbol, units will be assigned only if present.
!! iculbl : input integer : switch for beta limit scaling (constraint equation 24):<UL>
!! i_beta_component : input integer : switch for beta limit scaling (constraint equation 24):<UL>
!! <LI> = 0 apply limit to total beta;
!! <LI> = 1 apply limit to thermal beta;
!! <LI> = 2 apply limit to thermal + neutral beam beta
Expand All @@ -1274,7 +1274,7 @@ subroutine constraint_eqn_024(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
!! beta_beam : input real : neutral beam beta component
!! bt : input real : toroidal field
!! btot : input real : total field
use physics_variables, only: iculbl, betalim, beta, beta_beam, beta_fast_alpha, bt, btot
use physics_variables, only: i_beta_component, betalim, beta, beta_beam, beta_fast_alpha, bt, btot
use stellarator_variables, only: istell
use constraint_variables, only: fbetatry
implicit none
Expand All @@ -1285,28 +1285,28 @@ subroutine constraint_eqn_024(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units)
character(len=10), intent(out) :: tmp_units

! Include all beta components: relevant for both tokamaks and stellarators
if ((iculbl == 0).or.(istell /= 0)) then
if ((i_beta_component == 0).or.(istell /= 0)) then
tmp_cc = 1.0D0 - fbetatry * betalim/beta
tmp_con = betalim
tmp_err = betalim - beta / fbetatry
tmp_symbol = '<'
tmp_units = ''
! Here, the beta limit applies to only the thermal component, not the fast alpha or neutral beam parts
else if (iculbl == 1) then
else if (i_beta_component == 1) then
tmp_cc = 1.0D0 - fbetatry * betalim/(beta-beta_fast_alpha-beta_beam)
tmp_con = betalim
tmp_err = betalim - (beta-beta_fast_alpha-beta_beam) / fbetatry
tmp_symbol = '<'
tmp_units = ''
! Beta limit applies to thermal + neutral beam: components of the total beta, i.e. excludes alphas
else if (iculbl == 2) then
else if (i_beta_component == 2) then
tmp_cc = 1.0D0 - fbetatry * betalim/(beta-beta_fast_alpha)
tmp_con = betalim * (1.0D0 - tmp_cc)
tmp_err = (beta-beta_fast_alpha) * tmp_cc
tmp_symbol = '<'
tmp_units = ''
! Beta limit applies to toroidal beta
else if (iculbl == 3) then
else if (i_beta_component == 3) then
tmp_cc = 1.0D0 - fbetatry * betalim/(beta*(btot/bt)**2)
tmp_con = betalim
tmp_err = betalim - (beta*(btot/bt)**2) / fbetatry
Expand Down
6 changes: 3 additions & 3 deletions source/fortran/input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ subroutine parse_input_file(in_file,out_file,show_changes)
ncls, nfixmx, cptdin, ipfloc, i_sup_pf_shape, rref, i_pf_current, &
ccl0_ma, ccls_ma, ld_ratio_cst
use physics_variables, only: ipedestal, taumax, i_single_null, fvsbrnni, &
rhopedt, cvol, f_deuterium, ffwal, iculbl, itartpf, ilhthresh, &
rhopedt, cvol, f_deuterium, ffwal, i_beta_component, itartpf, ilhthresh, &
fpdivlim, epbetmax, isc, kappa95, aspect, cwrmax, nesep, c_beta, csawth, dene, &
ftar, plasma_res_factor, ssync, rnbeam, beta, neped, hfact, dnbeta, &
fgwsep, rhopedn, tratio, q0, ishape, fne0, ignite, f_tritium, &
Expand Down Expand Up @@ -623,8 +623,8 @@ subroutine parse_input_file(in_file,out_file,show_changes)
case ('i_bootstrap_current')
call parse_int_variable('i_bootstrap_current', i_bootstrap_current, 1, 5, &
'Switch for bootstrap scaling')
case ('iculbl')
call parse_int_variable('iculbl', iculbl, 0, 3, &
case ('i_beta_component')
call parse_int_variable('i_beta_component', i_beta_component, 0, 3, &
'Switch for beta limit scaling')
case ('i_plasma_current')
call parse_int_variable('i_plasma_current', i_plasma_current, 1, 9, &
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 @@ -254,7 +254,7 @@ module physics_variables
!! - =4 for Sauter et al scaling
!! - =5 for Sakai et al scaling

integer :: iculbl
integer :: i_beta_component
!! switch for beta limit scaling (`constraint equation 24`)
!!
!! - =0 apply limit to total beta
Expand Down Expand Up @@ -973,7 +973,7 @@ subroutine init_physics_variables
hfact = 1.0D0
taumax = 10.0D0
i_bootstrap_current = 3
iculbl = 0
i_beta_component = 0
i_plasma_current = 4
i_diamagnetic_current = 0
idensl = 7
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/large_tokamak_1_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/large_tokamak_2_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/large_tokamak_3_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/large_tokamak_4_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/large_tokamak_IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/large_tokamak_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/scan_2D_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -17851,7 +17851,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
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 @@ -2428,7 +2428,7 @@
0.0
],
"icode": 0.0,
"iculbl": 0.0,
"i_beta_component": 0.0,
"i_plasma_current": 4.0,
"idensl": 7.0,
"i_diamagnetic_current": 0.0,
Expand Down Expand Up @@ -9808,7 +9808,7 @@
"icase": "power plant type",
"icc": "",
"icode": "",
"iculbl": "switch for beta limit scaling (`constraint equation 24`)\n<ul>\n<li>=0 apply limit to total beta</li>\n<li>=1 apply limit to thermal beta</li>\n<li>=2 apply limit to thermal + neutral beam beta</li>\n<li>=3 apply limit to toroidal beta</li>\n</ul>",
"i_beta_component": "switch for beta limit scaling (`constraint equation 24`)\n<ul>\n<li>=0 apply limit to total beta</li>\n<li>=1 apply limit to thermal beta</li>\n<li>=2 apply limit to thermal + neutral beam beta</li>\n<li>=3 apply limit to toroidal beta</li>\n</ul>",
"i_plasma_current": "switch for plasma current scaling to use\n<ul>\n<li>=1 Peng analytic fit</li>\n<li>=2 Peng double null divertor scaling (ST)</li>\n<li>=3 simple ITER scaling (k = 2.2, d = 0.6)</li>\n<li>=4 later ITER scaling, a la Uckan</li>\n<li>=5 Todd empirical scaling I</li>\n<li>=6 Todd empirical scaling II</li>\n<li>=7 Connor-Hastie model</li>\n<li>=8 Sauter scaling allowing negative triangularity</li>\n<li>=9 FIESTA ST fit</li>\n</ul>",
"idensl": "switch for density limit to enforce (`constraint equation 5`)\n<ul>\n<li>=1 old ASDEX</li>\n<li>=2 Borrass model for ITER (I)</li>\n<li>=3 Borrass model for ITER (II)</li>\n<li>=4 JET edge radiation</li>\n<li>=5 JET simplified</li>\n<li>=6 Hugill-Murakami Mq limit</li>\n<li>=7 Greenwald limit</li>\n</ul>",
"i_diamagnetic_current": "switch for diamagnetic current scaling\n<ul>\n<li>=0 Do not calculate</li>\n<li>=1 Use original TART scaling</li>\n<li>=2 Use SCENE scaling</li>\n</ul>",
Expand Down Expand Up @@ -13322,7 +13322,7 @@
"lb": 1,
"ub": 4
},
"iculbl": {
"i_beta_component": {
"lb": 0,
"ub": 3
},
Expand Down Expand Up @@ -19114,7 +19114,7 @@
"hfact",
"taumax",
"i_bootstrap_current",
"iculbl",
"i_beta_component",
"i_plasma_current",
"i_diamagnetic_current",
"idensl",
Expand Down Expand Up @@ -20441,7 +20441,7 @@
"iblnkith": "int_variable",
"i_bootstrap_current": "int_variable",
"icc": "int_array",
"iculbl": "int_variable",
"i_beta_component": "int_variable",
"i_plasma_current": "int_variable",
"idensl": "int_variable",
"i_diamagnetic_current": "int_variable",
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/input_files/large_tokamak.IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/input_files/large_tokamak_nof.IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
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 @@ -325,7 +325,7 @@ boundu(36) = 1.0

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

iculbl = 3
i_beta_component = 3
* DESCRIPTION: Switch for Beta Limit Scaling (icc=24) (3: Apply Limit to Toroidal)
* JUSTIFICATION: Total beta is used to agree with literature limit
* REFERENCE: Ono & Kaita (2015), Physics of Plasmas, 22, 040501
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/large_tokamak_IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/large_tokamak_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ gamma = 0.3
i_bootstrap_current = 4

* Switch for beta limit scaling
iculbl = 1
i_beta_component = 1

* Switch for plasma current scaling
i_plasma_current = 4
Expand Down

0 comments on commit 77a09f2

Please sign in to comment.