Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
842a248
🔄 - Rename deuterium fuel fraction variable to f_plasma_fuel_deuteriu…
chris-ashe Sep 30, 2025
972c624
🔄 - Refactor tritium variable naming to f_plasma_fuel_tritium for con…
chris-ashe Sep 30, 2025
9e6a2f6
🔄 - Update variable naming for helium-3 fuel fraction to f_plasma_fue…
chris-ashe Sep 30, 2025
626b2d5
🔄 - Rename total plasma beta variable to beta_total_vol_avg for consi…
chris-ashe Sep 30, 2025
5bf2a34
🔄 - Rename toroidal beta variable to beta_toroidal_vol_avg for consis…
chris-ashe Sep 30, 2025
5a0a2c1
🔄 - Refactor variable naming for poloidal beta to beta_poloidal_vol_a…
chris-ashe Sep 30, 2025
c7fd39c
🔄 - Refactor thermal beta variable naming to beta_thermal_vol_avg for…
chris-ashe Sep 30, 2025
da63f1a
:bug: :memo: small naming fixes
chris-ashe Oct 16, 2025
3a4085f
🔄 Rename volume averaged plasma pressure variable to thermal plasma p…
chris-ashe Oct 10, 2025
c1930f9
🔄 Rename plasma pressure variable to thermal plasma pressure in multi…
chris-ashe Oct 10, 2025
f2d21e2
🔄 Update beta variable references to use total and thermal plasma pre…
chris-ashe Oct 17, 2025
9f41512
:memo: Update plasma beta documentation: enhance definitions and clar…
chris-ashe Oct 10, 2025
ba2efea
🔄 Rename `nd_alphas` to `nd_plasma_alphas_vol_avg`
chris-ashe Oct 17, 2025
7f7edf5
🔄 Rename `nd_protons` to `nd_plasma_protons_vol_avg` across multiple …
chris-ashe Oct 17, 2025
d4cc3a6
:art: Add output for ratio of electron density weighted temperature t…
chris-ashe Oct 17, 2025
6aa2f1a
:memo: Clarify documentation on density weighted temperature and upda…
chris-ashe Oct 17, 2025
d5907d3
🔄 Rename `pcoef` to `f_temp_plasma_electron_density_vol_avg` for clar…
chris-ashe Oct 17, 2025
7c8f330
🔄 Updated variable names from `nd_fuel_ions` to `nd_plasma_fuel_ions_…
chris-ashe Oct 17, 2025
32eda1e
🔄 Updated variable names from `nd_ions_total` to `nd_plasma_ions_tota…
chris-ashe Oct 17, 2025
bf9ca5a
🔄 Updated variable names from `nd_electron_line` to `nd_plasma_electr…
chris-ashe Oct 17, 2025
0f7959d
🔄 Rename `nd_impurities` to `nd_plasma_impurities_vol_avg` across mul…
chris-ashe Oct 17, 2025
216a597
🔄 Rename `beta_max` to `beta_vol_avg_max` across multiple files for c…
chris-ashe Oct 17, 2025
41faba4
🔄 Rename `beta_min` to `beta_vol_avg_min` across multiple files for c…
chris-ashe Oct 17, 2025
afbd442
🔄 Rename `beta_thermal_poloidal` to `beta_thermal_poloidal_vol_avg` a…
chris-ashe Oct 17, 2025
56853c6
🔄 Rename `beta_thermal_toroidal` to `beta_thermal_toroidal_vol_avg` a…
chris-ashe Oct 17, 2025
f5a6ea9
🔄 Rename `dlimit` to `nd_plasma_electron_max_array` across multiple f…
chris-ashe Oct 17, 2025
92d4f7d
🔄 Rename `dnelimt` to `nd_plasma_electrons_max` across multiple files…
chris-ashe Oct 17, 2025
ae2aff9
:memo: Update volume averaged thermal beta definitions for clarity an…
chris-ashe Oct 17, 2025
63ea1c7
update integration test data
chris-ashe Oct 21, 2025
40ffce9
Update obsolete vars
chris-ashe Oct 21, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ plus correction terms outlined in Culham Report AEA FUS 172.
| $\mathtt{alphat}$, $\alpha_T$ | temperature profile factor |
| $\mathtt{aspect}$, $A$ | aspect ratio |
| $\mathtt{nd_plasma_electrons_vol_avg}$, $n_{\text{e}}$ | volume averaged electron density $(\text{m}^{-3})$ |
| $\mathtt{nd_electron_line}$, $n_{\text{e,0}}$ | line averaged electron density $(\text{m}^{-3})$ |
| $\mathtt{nd_plasma_electron_line}$, $n_{\text{e,0}}$ | line averaged electron density $(\text{m}^{-3})$ |
| $\mathtt{e_beam_kev}$ | neutral beam energy $(\text{keV})$ |
| $\mathtt{f_radius_beam_tangency_rmajor}$ | R_tangent / R_major for neutral beam injection |
| $\mathtt{fshine}$ | shine-through fraction of beam |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ Please see the [H&CD section](../../eng-models/heating_and_current_drive/heating
3. **Set the plasma tritium and ion densities**

$$
\mathtt{deuterium\_density = nd_fuel_ions * f\_deuterium\_plasma} \\
\mathtt{tritium\_density = nd_fuel_ions * f\_tritium\_plasma}
\mathtt{deuterium\_density = nd_plasma_fuel_ions_vol_avg * f\_deuterium\_plasma} \\
\mathtt{tritium\_density = nd_plasma_fuel_ions_vol_avg * f\_tritium\_plasma}
$$

4. **Calculate the beam alpha powers, density and deposited energy**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ profiles
## Setting of plasma fuel composition

The fractional composition of the 'fuel' ions ($\text{D}$, $\text{T}$ and $^3\text{He}$) is
controlled using the three variables `f_deuterium`, `f_tritium` and `f_helium3`, respectively.
controlled using the three variables `f_plasma_fuel_deuterium`, `f_plasma_fuel_tritium` and `f_plasma_fuel_helium3`, respectively.
More information about setting seeded impurities and simulating first wall sputtering can be found in the [composition and impurities section](../plasma_composition.md).

It is also possible to optimise on the deuterium-tritium fuel mixture ratio. For this, `f_tritium` **must** be set as an iteration variable with `ixc = 173`. More info can be found [here](#fuel-ions-mixture-self-consistency).
It is also possible to optimise on the deuterium-tritium fuel mixture ratio. For this, `f_plasma_fuel_tritium` **must** be set as an iteration variable with `ixc = 173`. More info can be found [here](#fuel-ions-mixture-self-consistency).

!!! note "Reactions not calculated"

Expand Down Expand Up @@ -238,7 +238,7 @@ The value of `big_q_plasma_min` can be set to the minimum desired $Q_{\text{plas

This constraint can be activated by stating `icc = 92` in the input file.

This constraint should be activated if the user wishes to allow the ratio of the fuel ions to be iterated upon. For this, `f_tritium` has to be set as an iteration variable with `ixc = 173`. This constraint ensure that the summation of the fuel fractions always sums to 1.0 and will modify the other compositions depending on the value of `f_tritium`.
This constraint should be activated if the user wishes to allow the ratio of the fuel ions to be iterated upon. For this, `f_plasma_fuel_tritium` has to be set as an iteration variable with `ixc = 173`. This constraint ensure that the summation of the fuel fractions always sums to 1.0 and will modify the other compositions depending on the value of `f_plasma_fuel_tritium`.

[^1]: H.-S. Bosch and G. M. Hale, “Improved formulas for fusion cross-sections and thermal reactivities,” Nuclear Fusion, vol. 32, no. 4, pp. 611–631, Apr. 1992, doi: https://doi.org/10.1088/0029-5515/32/4/i07.
[^2]: I. P. E. G. on E. Drive and I. P. B. Editors, “Chapter 5: Physics of energetic ions,” Nuclear Fusion, vol. 39, no. 12, pp. 2471–2495, Dec. 1999, doi: https://doi.org/10.1088/0029-5515/39/12/305.
48 changes: 45 additions & 3 deletions documentation/physics-models/plasma_beta/plasma_beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@
The efficiency of confinement of plasma pressure by the magnetic field is represented by the ratio:

$$
\beta = \frac{2\mu_0p}{B^2}
\beta(\rho) = \frac{2\mu_0p(\rho)}{\left(B(\rho)\right)^2}
$$

Where $\beta$ is a function of normalised minor radius across the plasma ($\rho$), due to the change in pressure and magnetic field strength.

The standard $\beta$ term used for comparison and to represent the plasma as a whole in many calculations is the volume averaged value given by:

$$
\langle \beta \rangle = \frac{2\mu_0 \langle p \rangle}{\langle B \rangle^2}
$$

Where $\langle p \rangle$ is the volume averaged plasma pressure and $\langle B \rangle$ is the average field.

There are several different measures of this type, arising from different choices of definition and from the need to quantify different equilibrium properties.

In its expanded form of magnetic field components:
Expand Down Expand Up @@ -92,6 +102,32 @@ $$

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

## Definitions

### Volume averaged thermal toroidal beta

We define $B_{\text{T,on-axis}}$ as the toroidal field at the plasma major radius, $R_0$

$$
\overbrace{\langle \beta_t \rangle_{\text{V}}}^{\texttt{beta_toroidal_thermal_vol_avg}} = \frac{2\mu_0 \overbrace{\langle p_{\text{thermal}} \rangle}^{\texttt{pres_plasma_thermal_vol_avg}}}{\underbrace{B_{\text{T,on-axis}}^2}_{\texttt{b_plasma_toroidal_on_axis}}}
$$

### Volume averaged thermal poloidal beta



$$
\overbrace{\langle \beta_p \rangle_{\text{V}}}^{\texttt{beta_poloidal_thermal_vol_avg}} = \frac{2\mu_0 \overbrace{\langle p_{\text{thermal}} \rangle}^{\texttt{pres_plasma_thermal_vol_avg}}}{\underbrace{\langle B_{\text{P,average}} \rangle^2}_{\texttt{b_plasma_poloidal_average}}}
$$

### Volume averaged thermal beta

$$
\overbrace{\langle \beta \rangle_{\text{V}}}^{\texttt{beta_thermal_vol_avg}} = \frac{2\mu_0 \overbrace{\langle p_{\text{thermal}} \rangle}^{\texttt{pres_plasma_thermal_vol_avg}}}{\sqrt{\langle B_{\text{P,average}} \rangle^2+B_{\text{T,on-axis}}^2}}
$$

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

## Troyon Beta Limit

The Troyon plasma beta limit is given by[^0][^1]:
Expand Down Expand Up @@ -350,7 +386,13 @@ This constraint can be activated by stating `icc = 1` in the input file.
Ensures the relationship between $\beta$, density, temperature and total magnetic field is withheld by checking the fixed input or iteration variable $\mathtt{beta}$ is consistent in value with the rest of the physics parameters

$$
\mathtt{beta} \equiv \frac{2\mu_0 \langle n_{\text{e}}T_{\text{e}}+n_{\text{i}}T_{\text{i}}\rangle}{B^2} + \beta_{\alpha} + \beta_{\text{beam}}
\texttt{beta_total_vol_avg} \equiv \frac{2\mu_0 \langle n_{\text{e}}T_{\text{e}}+n_{\text{i}}T_{\text{i}}\rangle}{B^2} + \beta_{\alpha} + \beta_{\text{beam}}
$$

Here the calculation of the volume averaged pressure of the ions and electrons has to use the density weighted temperature for each. This is because $\langle nT \rangle_{\text{V}} \neq \langle n \rangle_{\text{V}} \langle T \rangle_{\text{V}}$, where $\text{V}$ denotes the volume averaged value. The true value is, $\langle nT \rangle_{\text{V}} = \langle n \rangle_{\text{V}} \langle T \rangle_{\text{n}}$, where $\text{n}$ is the density weighted averaged. For example:

$$
\langle n_{\text{e}}T_{\text{e}} \rangle_{\text{V}} = \overbrace{\langle n_{\text{e}} \rangle_{\text{V}}}^{\texttt{nd_plasma_electrons_vol_avg}} \times \overbrace{\langle T_{\text{e}} \rangle_{\text{n}}}^{\texttt{temp_plasma_electron_density_weighted_kev}}
$$

**It is highly recommended to always have this constraint on as it is a global consistency checker**
Expand Down Expand Up @@ -403,7 +445,7 @@ The value of `beta_poloidal_max` can be set to the desired maximum poloidal beta

This constraint can be activated by stating `icc = 84` in the input file.

The value of `beta_min` can be set to the desired minimum total beta. The scaling value `fbeta_min` can be varied also.
The value of `beta_vol_avg_min` can be set to the desired minimum total beta. The scaling value `fbeta_min` can be varied also.

[^0]: F. Troyon et.al, “Beta limit in tokamaks. Experimental and computational status,” Plasma Physics and Controlled Fusion, vol. 30, no. 11, pp. 1597–1609, Oct. 1988, doi: https://doi.org/10.1088/0741-3335/30/11/019.

Expand Down
16 changes: 8 additions & 8 deletions documentation/physics-models/plasma_composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using input array `f_nd_impurity_electrons(1,...,14)`. The available species alo
As stated above, the number density fractions for hydrogen (all isotopes) and
helium should not be set, as they are calculated by the code. This is to ensure
plasma quasi-neutrality taking into account the fuel ratios
`f_deuterium`, `f_tritium` and `f_helium3`, and the alpha particle fraction `f_nd_alpha_electron` which may
`f_plasma_fuel_deuterium`, `f_plasma_fuel_tritium` and `f_plasma_fuel_helium3`, and the alpha particle fraction `f_nd_alpha_electron` which may
be input by the user or selected as an iteration variable.

!!! note "Location of impurities"
Expand All @@ -59,7 +59,7 @@ All of the plasma composites are normally given as a fraction of the volume aver

1. **Alpha Ash Portion Calculation**

- Calculate the number density of alpha particles (`nd_alphas`) using the electron density (`nd_plasma_electrons_vol_avg`) and the alpha particle to electron ratio (`f_nd_alpha_electron`).
- Calculate the number density of alpha particles (`nd_plasma_alphas_vol_avg`) using the electron density (`nd_plasma_electrons_vol_avg`) and the alpha particle to electron ratio (`f_nd_alpha_electron`).
- `f_nd_alpha_electron` can be set as an iteration variable (`ixc = 109`) or set directly.

$$
Expand All @@ -68,19 +68,19 @@ All of the plasma composites are normally given as a fraction of the volume aver


2. **Protons Calculation**
- The calculation of proton density (`nd_protons`) depends on whether the alpha rate density has been calculated. This should only happen in the first function call as the rates are calculated later on in the code.
- The calculation of proton density (`nd_plasma_protons_vol_avg`) depends on whether the alpha rate density has been calculated. This should only happen in the first function call as the rates are calculated later on in the code.

- If the alpha rate density is not yet calculated, use a rough estimate.

$$
\texttt{nd_protons} | n_{\text{p}} = \\
\texttt{nd_plasma_protons_vol_avg} | n_{\text{p}} = \\
\text{max}\left[\texttt{f_nd_protium_electrons} \times n_{\text{e}}, n_{\alpha}\times \left(f_{\text{3He}} + 0.001\right)\right]
$$

- Otherwise, use the calculated proton rate density.

$$
\texttt{nd_protons} | n_{\text{p}} = \\
\texttt{nd_plasma_protons_vol_avg} | n_{\text{p}} = \\
\text{max}\left[\texttt{f_nd_protium_electrons} \times n_{\text{e}}, n_{\alpha}\times \frac{r_{\text{p}}}{r_{\alpha,\text{total}}}\right]
$$

Expand Down Expand Up @@ -116,7 +116,7 @@ All of the plasma composites are normally given as a fraction of the volume aver
\mathtt{nd\_fuel\_ions} | n_{\text{i}} = \frac{\mathtt{znfuel}}{1+f_{\text{3He}}}
$$

- Calculate the fuel ion density (`nd_fuel_ions`).
- Calculate the fuel ion density (`nd_plasma_fuel_ions_vol_avg`).

7. **Set Hydrogen and Helium Impurity Fractions**

Expand All @@ -132,15 +132,15 @@ All of the plasma composites are normally given as a fraction of the volume aver

8. **Total Impurity Density Calculation**

- Calculate the total impurity density (`nd_impurities`).
- Calculate the total impurity density (`nd_plasma_impurities_vol_avg`).

$$
\mathtt{nd\_impurities} | n_{\text{impurities}} = \sum_j n_{\text{e}} f_j
$$

9. **Total Ion Density Calculation**

- Calculate the total ion density (`nd_ions_total`).
- Calculate the total ion density (`nd_plasma_ions_total_vol_avg`).

$$
\mathtt{nd\_ions\_total} | n_{\text{i,total}} = n_{\text{i}} + n_{\alpha}+n_{\text{protons}}+ n_{\text{beam}}+n_{\text{impurities}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The density profile class is organised around a central runner function that is
### Calculate core values | `set_physics_variables()`

The core electron density is calculated using the [`ncore`](plasma_density_profile.md#electron-core-density-of-a-pedestalised-profile--ncore) method.
The core ion density is then set from $n_{\text{i}}$ (`nd_ions_total`) which is the total ion density such as:
The core ion density is then set from $n_{\text{i}}$ (`nd_plasma_ions_total_vol_avg`) which is the total ion density such as:

$$
n_{\text{i0}} = \left(\frac{n_\text{i}}{n_\text{e}}\right)n_{\text{e0}}
Expand Down
12 changes: 6 additions & 6 deletions documentation/physics-models/profiles/plasma_profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,23 +282,23 @@ The line averaged density is then calculated for the profile paramaters
Line averaged electron density is calculated by integrating the profile across the normalised width of the profile and then dividing by the width of the integration bounds

$$
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_electron_line}} = \frac{\int^1_0 n_0(1-\rho^2)^{\alpha_n} \ d\rho}{\rho}
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_plasma_electron_line}} = \frac{\int^1_0 n_0(1-\rho^2)^{\alpha_n} \ d\rho}{\rho}
$$

This can be more easily represented in radial coordinates and returning $\rho = \frac{r}{a}$

$$
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_electron_line}} = \frac{\int^a_0 n_0(1-r^2/a^2)^{\alpha_n} \ dr}{a}
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_plasma_electron_line}} = \frac{\int^a_0 n_0(1-r^2/a^2)^{\alpha_n} \ dr}{a}
$$

$$
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_electron_line}} = \frac{\left[\frac{an_0}{2}\frac{\Gamma(1/2)\Gamma(\alpha_n+1)}{\Gamma(\alpha_n+3/2)}\right]}{a}
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_plasma_electron_line}} = \frac{\left[\frac{an_0}{2}\frac{\Gamma(1/2)\Gamma(\alpha_n+1)}{\Gamma(\alpha_n+3/2)}\right]}{a}
$$

$\Gamma$ is the [gamma function](https://en.wikipedia.org/wiki/Gamma_function) and is calculated in the code with [scipy.special.gamma()](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.gamma.html)

$$
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_electron_line}} = \frac{n_0}{2}\frac{\Gamma(1/2)\Gamma(\alpha_n+1)}{\Gamma(\alpha_n+3/2)}
\overbrace{\bar{n_{\text{e}}}}^{\texttt{nd_plasma_electron_line}} = \frac{n_0}{2}\frac{\Gamma(1/2)\Gamma(\alpha_n+1)}{\Gamma(\alpha_n+3/2)}
$$

This is in agreement with the derivation from the ITER Physics Design 1989 [^2]
Expand Down Expand Up @@ -385,7 +385,7 @@ $$\begin{aligned}

$$\begin{aligned}
\texttt{nd_plasma_electron_on_axis} = n_{\text{e}} \times (\alpha_n+1) \\
\texttt{nd_plasma_ions_on_axis} = \texttt{nd_ions_total} \times (\alpha_n+1)
\texttt{nd_plasma_ions_on_axis} = \texttt{nd_plasma_ions_total_vol_avg} \times (\alpha_n+1)
\end{aligned}$$

-----
Expand Down Expand Up @@ -605,7 +605,7 @@ $$
Calculate the line averaged electron density by integrating the normalised profile using the class [`integrate_profile_y()`](./plasma_profiles_abstract_class.md#calculate-the-profile-integral-value-integrate_profile_y) function

$$
\texttt{nd_electron_line} = \int_0^1{n(\rho) \ d\rho}
\texttt{nd_plasma_electron_line} = \int_0^1{n(\rho) \ d\rho}
$$

A divertor variable `prn1` is set to be equal to the separatrix density over the mean density:
Expand Down
Loading
Loading