-
Notifications
You must be signed in to change notification settings - Fork 18
Add option for density pedestal setting #4181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
dca63c1
ca0f090
46694e1
9e28869
bc0b295
f7b9d75
7ff453c
5c1d9f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -148,4 +148,32 @@ $$\begin{aligned} | |||||
|
|
||||||
| 5. Profile is then integrated with `integrate_profile_y()` using Simpsons integration from the profile abstract base class | ||||||
|
|
||||||
| ----------------------- | ||||||
|
|
||||||
| ### Setting pedestal and separatrix values | `set_pedestal_and_separatrix_values()` | ||||||
|
|
||||||
| The switch `i_nd_plasma_pedestal_separatrix` controls how the values of the density pedestal and separatrix are set. | ||||||
|
|
||||||
| #### User input | ||||||
|
|
||||||
| If `i_nd_plasma_pedestal_separatrix == 0` then the values of `nd_plasma_pedestal_electron` and `nd_plasma_separatrix_electron` are taken directly from the input file | ||||||
|
|
||||||
| #### Fraction of Greenwald Limit | ||||||
|
|
||||||
| If `i_nd_plasma_pedestal_separatrix == 1`, the values of $n_{\text{ped}}$ and $n_{\text{sep}}$ are set as fractions of the [Greenwald](https://wiki.fusion.ciemat.es/wiki/Greenwald_limit) limit such as: | ||||||
|
|
||||||
| $$ | ||||||
| n_{\text{ped}} = \overbrace{f_{\text{GW,ped}}}^{\texttt{f_nd_plasma_pedestal_greenwald}} \times \frac{I_p [\text{A}]}{\pi a^2 [\text{m}^2]} \times 10^{14} | ||||||
| $$ | ||||||
|
|
||||||
| $$ | ||||||
| n_{\text{sep}} = \overbrace{f_{\text{GW,sep}}}^{\texttt{f_nd_plasma_separatrix_greenwald}} \times \frac{I_p [\text{A}]}{\pi a^2 [\text{m}^2]} \times 10^{14} | ||||||
| $$ | ||||||
|
|
||||||
|
|
||||||
| $\texttt{f_nd_plasma_pedestal_greenwald}$ and $\texttt{f_nd_plasma_separatrix_greenwald}$ can be set as iteration variables respectively by using `ixc = 45` | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This seems to be the convention on this page for PROCESS variables name outside of equations |
||||||
| and `ixc = 152` respectively | ||||||
|
|
||||||
| ------ | ||||||
|
|
||||||
| [^1]: Jean, J. (2011). *HELIOS: A Zero-Dimensional Tool for Next Step and Reactor Studies*. Fusion Science and Technology, 59(2), 308–349. <https://doi.org/10.13182/FST11-A11650> | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -171,10 +171,10 @@ def __post_init__(self): | |||||
| ), | ||||||
| "ffwal": InputVariable(data_structure.physics_variables, float, range=(0.0, 10.0)), | ||||||
| "f_nd_plasma_pedestal_greenwald": InputVariable( | ||||||
| data_structure.physics_variables, float, range=(-1.0, 5.0) | ||||||
| data_structure.physics_variables, float, range=(0.1, 1.5) | ||||||
| ), | ||||||
| "f_nd_plasma_separatrix_greenwald": InputVariable( | ||||||
| data_structure.physics_variables, float, range=(-1.0, 5.0) | ||||||
| data_structure.physics_variables, float, range=(0.01, 0.9) | ||||||
| ), | ||||||
| "f_plasma_fuel_helium3": InputVariable( | ||||||
| data_structure.physics_variables, float, range=(-1.0, 5.0) | ||||||
|
|
@@ -1083,6 +1083,9 @@ def __post_init__(self): | |||||
| "nd_plasma_separatrix_electron": InputVariable( | ||||||
| data_structure.physics_variables, float, range=(0.0, 1e21) | ||||||
| ), | ||||||
| "i_nd_plasma_pedestal_electron": InputVariable( | ||||||
|
||||||
| "i_nd_plasma_pedestal_electron": InputVariable( | |
| "i_nd_plasma_pedestal_separatrix": InputVariable( |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,6 +127,14 @@ def parabolic_paramterisation(self): | |
| / sp.special.gamma(physics_variables.alphan + 1.5) | ||
| ) | ||
|
|
||
| physics_variables.temp_plasma_electron_line_avg_kev = ( | ||
| physics_variables.temp_plasma_electron_vol_avg_kev | ||
| * (1.0 + physics_variables.alphat) | ||
| * (sp.special.gamma(0.5) / 2.0) | ||
| * sp.special.gamma(physics_variables.alphat + 1.0) | ||
| / sp.special.gamma(physics_variables.alphat + 1.5) | ||
| ) | ||
|
Comment on lines
+130
to
+136
|
||
|
|
||
| # Density-weighted temperatures | ||
|
|
||
| physics_variables.temp_plasma_electron_density_weighted_kev = ( | ||
|
|
@@ -203,11 +211,15 @@ def pedestal_parameterisation(self): | |
| / physics_variables.temp_plasma_electron_vol_avg_kev | ||
| ) | ||
|
|
||
| # Line-averaged electron density | ||
| # Line-averaged electron density and temperature | ||
| # = integral(n(rho).drho) | ||
|
|
||
| physics_variables.nd_plasma_electron_line = self.neprofile.profile_integ | ||
|
|
||
| physics_variables.temp_plasma_electron_line_avg_kev = ( | ||
| self.teprofile.profile_integ | ||
| ) | ||
|
|
||
| # Scrape-off density / volume averaged density | ||
| # (Input value is used if i_plasma_pedestal = 0) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import scipy as sp | ||
|
|
||
| from process.data_structure import physics_variables | ||
| from process.models.physics.density_limit import PlasmaDensityLimit | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
@@ -83,6 +84,13 @@ def integrate_profile_y(self): | |
| ) | ||
|
|
||
|
|
||
| class DensityProfilePedestalType(IntEnum): | ||
| """Enum for i_nd_plasma_pedestal_separatrix types""" | ||
|
|
||
| USER_INPUT = 0 | ||
| GREENWALD_FRACTION = 1 | ||
|
|
||
|
|
||
| class NeProfile(Profile): | ||
| """Electron density profile class. Contains a function to calculate the electron density profile and | ||
| store the data. | ||
|
|
@@ -220,6 +228,33 @@ def ncore( | |
| ncore = 1.0e-6 | ||
| return ncore | ||
|
|
||
| def set_pedestal_and_separatrix_values(self): | ||
| """Sets the pedestal and separatrix density values based on the user input or greenwald fraction method.""" | ||
|
|
||
| if ( | ||
| DensityProfilePedestalType(physics_variables.i_nd_plasma_pedestal_separatrix) | ||
| == DensityProfilePedestalType.USER_INPUT | ||
| ): | ||
| pass | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this |
||
| elif ( | ||
| DensityProfilePedestalType(physics_variables.i_nd_plasma_pedestal_separatrix) | ||
| == DensityProfilePedestalType.GREENWALD_FRACTION | ||
| ): | ||
| physics_variables.nd_plasma_pedestal_electron = ( | ||
| physics_variables.f_nd_plasma_pedestal_greenwald | ||
| * PlasmaDensityLimit.calculate_greenwald_density_limit( | ||
| c_plasma=physics_variables.plasma_current, | ||
| rminor=physics_variables.rminor, | ||
| ) | ||
| ) | ||
| physics_variables.nd_plasma_separatrix_electron = ( | ||
| physics_variables.f_nd_plasma_separatrix_greenwald | ||
| * PlasmaDensityLimit.calculate_greenwald_density_limit( | ||
| c_plasma=physics_variables.plasma_current, | ||
| rminor=physics_variables.rminor, | ||
| ) | ||
| ) | ||
|
|
||
|
Comment on lines
+231
to
+257
|
||
| def set_physics_variables(self): | ||
| """Calculates and sets physics variables required for the profile.""" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation says
f_nd_plasma_pedestal_greenwaldcan be set as an iteration variable withixc = 45, but the actual iteration variable index for this parameter is 145 (seeprocess/core/solver/iteration_variables.py). Update the docs to useixc = 145to avoid misleading users.