Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Density Profile | `NeProfile(Profile)`
# Density Profile | `ElectronDensityProfile(Profile)`

The density profile class is organised around a central runner function that is called each time the plasma is parameterised by the parent [`PlasmaProfile()`](./plasma_profiles.md) class. It is called by [`pedestal_parameterisation()`](plasma_profiles.md#pedestal_parameterisation) and [`parabolic parameterisation()`](./plasma_profiles.md#parabolic_parameterisation). The sequence of the runner function can be seen below along with explanation of the following calculations.

Expand All @@ -19,7 +19,7 @@ $$
n_{\text{i0}} = \left(\frac{n_\text{i}}{n_\text{e}}\right)n_{\text{e0}}
$$

#### Electron core density of a pedestalised profile | `ncore()`
#### Electron core density of a pedestalised profile | `calculate_pedestal_profile_on_axis_density()`

This function calculates the core electron density for a pedestalsied profile (`i_plasma_pedestal == 1`). It takes in values of

Expand Down
49 changes: 45 additions & 4 deletions documentation/source/physics-models/profiles/plasma_profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

In `PROCESS` the density, temperature and current profiles of the plasma for electrons and ions can take two forms depending on the switch value for `i_plasma_pedestal`. Either without a [pedestal](http://fusionwiki.ciemat.es/wiki/Pedestal), `i_plasma_pedestal == 0` or with a pedestal `i_plasma_pedestal == 1`. `i_plasma_pedestal == 0` is better suited for modelling L-mode plasmas, while `i_plasma_pedestal == 1` is better suited for modelling [H-mode](https://en.wikipedia.org/wiki/High-confinement_mode) plasmas.

The files responsible for calculating and storing the profiles are `plasma_profiles.py` and `profiles.py`. A central plasma profile object is created from the [`PlasmaProfile`](plasma_profiles.md#plasma-profile-class-plasmaprofile) class that contains attributes for the plasma density and temperature. The density and temperature profiles are in themselves objects of the [`Profile`](./plasma_profiles_abstract_class.md) abstract base class. [`Profile`](./plasma_profiles_abstract_class.md), [`NeProfile`](plasma_density_profile.md) and [`TeProfile`](./plasma_temperature_profile.md) are all defined in `profiles.py`. [`PlasmaProfile`](plasma_profiles.md#plasma-profile-class-plasmaprofile) is exclusively in `plasma_profiles.py`
The files responsible for calculating and storing the profiles are `plasma_profiles.py` and `profiles.py`. A central plasma profile object is created from the [`PlasmaProfile`](plasma_profiles.md#plasma-profile-class-plasmaprofile) class that contains attributes for the plasma density and temperature. The density and temperature profiles are in themselves objects of the [`Profile`](./plasma_profiles_abstract_class.md) abstract base class. [`Profile`](./plasma_profiles_abstract_class.md), [`ElectronDensityProfile`](plasma_density_profile.md) and [`ElectronTemperatureProfile`](./plasma_temperature_profile.md) are all defined in `profiles.py`. [`PlasmaProfile`](plasma_profiles.md#plasma-profile-class-plasmaprofile) is exclusively in `plasma_profiles.py`

<figure markdown>
![UML of profiles](./uml_classes_PlasmaProfile.png){height="1000px"}
Expand Down Expand Up @@ -238,7 +238,7 @@ The graph below is for a standard pedestal profile. You can vary its attributes

## Plasma Profile Class | `PlasmaProfile`
### Initialization | `__init__()`
The parent plasma profile class is `PlasmaProfile`. Initialization sets the profile class size and `neprofile` and `teprofile` to [`NeProfile`](plasma_density_profile.md) & [`TeProfile`](plasma_temperature_profile.md) objects from `profiles.py`
The parent plasma profile class is `PlasmaProfile`. Initialization sets the profile class size and `neprofile` and `teprofile` to [`ElectronDensityProfile`](plasma_density_profile.md) & [`ElectronTemperatureProfile`](plasma_temperature_profile.md) objects from `profiles.py`

???+ Note

Expand Down Expand Up @@ -266,7 +266,7 @@ Depending on the value of `i_plasma_pedestal` different functions will be ran, t

If pedestal profile values are set they are reset to have values that agree with the original form of the parabolic profiles. Such that $\rho_{\text{ped}} = 1$ and that pedestal and separatrix densities and temperatures are zero. This will then warn the user in the terminal.

The density and temperature profile runner function [`TeProfile/NeProfile.run()`](plasma_density_profile.md#runner-function-run) is then called to re-calculate the profile and core values.
The density and temperature profile runner function [`ElectronTemperatureProfile/ElectronDensityProfile.run()`](plasma_density_profile.md#runner-function-run) is then called to re-calculate the profile and core values.

Ratio of density-weighted to volume-averaged temperature factor is calculated:

Expand Down Expand Up @@ -593,7 +593,7 @@ $$

##### `pedestal_parameterisation()`

The density and temperature profile runner function [`TeProfile/NeProfile.run()`](plasma_density_profile.md#runner-function-run) is firstly called to re-calculate the profile and core values.
The density and temperature profile runner function [`ElectronTemperatureProfile/ElectronDensityProfile.run()`](plasma_density_profile.md#runner-function-run) is firstly called to re-calculate the profile and core values.

Perform integrations to calculate ratio of density-weighted to volume-averaged temperature, etc. Density-weighted temperature = $\frac{\int{nT \ dV}}{\int{n \ dV}}$, which is approximately equal to the ratio $\frac{\int{\rho \ n(\rho) T(\rho) \ d\rho}}{\int{\rho \ n(\rho) \ d\rho}}$

Expand Down Expand Up @@ -636,6 +636,47 @@ The same function is run from the `i_plasma_pedestal == 0 ` profile case, found

-----



## Calculate profile volume average | `calculate_vol_avg_of_profile()`

General method to calculate the volume averaged value of any normalised radial profile.

### Derivation

The integral $I$ of any quantity $G(\rho)$ over the volume of the plasma where $\rho$ is the normalised minor radius is:

$$
I=\int_{}^{} G(\rho) \ dV
$$

The volume element is the surface area of the toroidal surface times the thickness $dV=2\pi R_0 2\pi\kappa r dr $

$$
I=\int_{0}^{1} G(\rho) 2\pi R_0 2\pi\kappa r \ dr
$$

Substituting the normalised minor radius coordinate $\rho=r/a$, and bringing the constants out in front,

$$
I=4 \pi^2 R_0 \kappa a^2 \int_{0}^{1} G(\rho) \rho \ d\rho
$$

However, if we calculate the volume $V$, the exact same integral is used where $G=1$,

$$
V=4 \pi^2 R_0 \kappa a^2 \int_{0}^{1} \rho \ d\rho = \frac{1}{2} 4 \pi^2 R_0 \kappa a^2
$$

Therefore the general volume integral of $G(\rho)$, where $V$ is the volume, is

$$
I=2 V \int_{0}^{1} G(\rho) \rho \ d\rho
$$

If $G$ is a density then $2 \int_{0}^{1} G(\rho) \rho \ d\rho$ is the volume averaged density.


## Key Constraints

--------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Temperature Profile | `TeProfile(Profile)`
# Temperature Profile | `ElectronTemperatureProfile(Profile)`

The temperature profile class is organised around a central runner function that is called each time the plasma is parameterised by the parent [`PlasmaProfile()`](plasma_profiles.md#plasma-profile-class-plasmaprofile) class. It is called by [`pedestal_parameterisation()`](plasma_profiles.md#pedestal_parameterisation) and [`parabolic parameterisation()`](plasma_profiles.md#parabolic_parameterisation). The sequence of the runner function can be seen below along with explanation of the following calculations.

Expand All @@ -14,7 +14,7 @@ The temperature profile class is organised around a central runner function that

The core electron temperature is calculated using the [`tcore`](plasma_temperature_profile.md#electron-core-density-of-a-pedestalised-profile--tcore) method.

#### Electron core density of a pedestalised profile | `tcore()`
#### Electron core density of a pedestalised profile | `calculate_pedestal_profile_on_axis_temperature()`

This function calculates the core electron density for a pedestalsied profile in $\text{keV}$. The inclusion of a new $\beta_T$ exponent term allows a more accurate description of temperature profiles with a triangular shape or a strong gradient near the pedestal (characteristic of regimes with an [internal transport barrier](https://wiki.fusion.ciemat.es/wiki/Internal_Transport_Barrier)).

Expand Down
9 changes: 6 additions & 3 deletions process/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@
from process.models.physics.plasma_fields import PlasmaFields
from process.models.physics.plasma_geometry import PlasmaGeom
from process.models.physics.plasma_profiles import PlasmaProfile
from process.models.physics.profiles import NeProfile, TeProfile
from process.models.physics.profiles import (
ElectronDensityProfile,
ElectronTemperatureProfile,
)
from process.models.physics.scrape_off_layer import ScrapeOffLayer
from process.models.power import Power
from process.models.pulse import Pulse
Expand Down Expand Up @@ -671,8 +674,8 @@ def __init__(self, data: DataStructure):
self.pulse = Pulse()
self.shield = Shield()
self.ife = IFE(availability=self.availability, costs=self.costs)
self.ne_profile = NeProfile()
self.te_profile = TeProfile()
self.ne_profile = ElectronDensityProfile()
self.te_profile = ElectronTemperatureProfile()
self.plasma_profile = PlasmaProfile(self.ne_profile, self.te_profile)
self.fw = FirstWall()
self.blanket_library = BlanketLibrary(fw=self.fw)
Expand Down
7 changes: 4 additions & 3 deletions process/models/physics/plasma_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ def __init__(self, ne_profile, te_profile):
Args:
profile_size (int): The size of the plasma profile.
outfile (str): The output file path.
neprofile (NeProfile): An instance of the NeProfile class.
teprofile (TeProfile): An instance of the TeProfile class.
neprofile (ElectronDensityProfile): An instance of the ElectronDensityProfile
class.
teprofile (ElectronTemperatureProfile): An instance of the ElectronTemperatureProfile class.
"""
# Default profile_size = 201, but it's possible to experiment with this value.
# See `n_plasma_profile_elements`
Expand Down Expand Up @@ -195,7 +196,7 @@ def pedestal_parameterisation(self):
`temp_plasma_electron_density_weighted_kev` and
`temp_plasma_ion_density_weighted_kev`.
"""
# Run TeProfile and NeProfile class methods:
# Run ElectronTemperatureProfile and ElectronDensityProfile class methods:
# Re-calculate core and profile values

self.teprofile.run()
Expand Down
Loading
Loading