Skip to content
Merged
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
2 changes: 0 additions & 2 deletions process/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from process.data_structure.impurity_radiation_module import (
init_impurity_radiation_module,
)
from process.data_structure.neoclassics_variables import init_neoclassics_variables
from process.data_structure.physics_variables import (
init_physics_module,
init_physics_variables,
Expand Down Expand Up @@ -250,7 +249,6 @@ def init_all_module_vars():
init_tfcoil_variables()
constants.init_constants()
init_rebco_variables()
init_neoclassics_variables()


def check_process(inputs, data): # noqa: ARG001
Expand Down
2 changes: 2 additions & 0 deletions process/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from process.data_structure.fwbs_variables import FWBSData
from process.data_structure.heat_transport_variables import HeatTransportData
from process.data_structure.ife_variables import IFEData
from process.data_structure.neoclassics_variables import NeoclassicsData
from process.data_structure.pf_power_variables import PFPowerData
from process.data_structure.pfcoil_variables import PFCoilData
from process.data_structure.power_variables import PowerData
Expand Down Expand Up @@ -61,6 +62,7 @@ class DataStructure:
stellarator: StellaratorData = initialise_later
stellarator_config: StellaratorConfigData = initialise_later
pf_power: PFPowerData = initialise_later
neoclassics: NeoclassicsData = initialise_later

def __post_init__(self):
for f in fields(self):
Expand Down
167 changes: 62 additions & 105 deletions process/data_structure/neoclassics_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,128 +4,85 @@
Beidler (2013), https://doi.org/10.1088/0029-5515/51/7/076001
"""

from dataclasses import dataclass, field

import numpy as np

NO_ROOTS = 30
"""Number of Gauss laguerre roots"""

densities: list[float] = None
"""Densities of the species that are considered [/m3]"""

temperatures: list[float] = None
"""Temperature of the species that are considered [J]"""
@dataclass
class NeoclassicsData:
densities: list[float] = field(default_factory=lambda: np.zeros(4))
"""Densities of the species that are considered [/m3]"""

dr_densities: list[float] = None
"""Radial derivative of the density of the species [/m3]"""
temperatures: list[float] = field(default_factory=lambda: np.zeros(4))
"""Temperature of the species that are considered [J]"""

dr_temperatures: list[float] = None
"""Radial derivative of the temperature of the species [J]"""
dr_densities: list[float] = field(default_factory=lambda: np.zeros(4))
"""Radial derivative of the density of the species [/m3]"""

roots: list[float] = None
"""Gauss Laguerre Roots"""
dr_temperatures: list[float] = field(default_factory=lambda: np.zeros(4))
"""Radial derivative of the temperature of the species [J]"""

weights: list[float] = None
"""Gauss Laguerre Weights"""
roots: list[float] = field(default_factory=lambda: np.zeros(NO_ROOTS))
"""Gauss Laguerre Roots"""

nu: list[float] = None
"""90-degree deflection frequency on GL roots"""
weights: list[float] = field(default_factory=lambda: np.zeros(NO_ROOTS))
"""Gauss Laguerre Weights"""

nu_star: list[float] = None
"""Dimensionless deflection frequency"""
nu: list[float] = field(default_factory=lambda: np.zeros((4, NO_ROOTS)))
"""90-degree deflection frequency on GL roots"""

nu_star_averaged: list[float] = None
"""Maxwellian averaged dimensionless 90-degree deflection frequency for electrons (index 1) and ions (index 2)"""
nu_star: list[float] = field(default_factory=lambda: np.zeros((4, NO_ROOTS)))
"""Dimensionless deflection frequency"""

vd: list[float] = None
"""Drift velocity on GL roots"""
nu_star_averaged: list[float] = field(default_factory=lambda: np.zeros(4))
"""Maxwellian averaged dimensionless 90-degree deflection frequency for electrons (index 1) and ions (index 2)"""

kt: list[float] = None
"""Thermal energy on GL roots"""
vd: list[float] = field(default_factory=lambda: np.zeros((4, NO_ROOTS)))
"""Drift velocity on GL roots"""

er: float = None
"""Radial electrical field [V/m]"""
kt: list[float] = field(default_factory=lambda: np.zeros((4, NO_ROOTS)))
"""Thermal energy on GL roots"""

iota: float = None
"""Iota (1/safety factor)"""
er: float = 0.0
"""Radial electrical field [V/m]"""

d11_mono: list[float] = None
"""Radial monoenergetic transport coefficient on GL roots (species dependent)"""
iota: float = 1.0
"""Iota (1/safety factor)"""

d11_mono: list[float] = field(default_factory=lambda: np.zeros((4, NO_ROOTS)))
"""Radial monoenergetic transport coefficient on GL roots (species dependent)"""

d11_plateau: list[float] = field(default_factory=lambda: np.zeros((4, NO_ROOTS)))
"""Toroidal monoenergetic transport coefficient as given by the stellarator
input json file as function of nu_star, normalised by the banana value.
"""

d111: list[float] = field(default_factory=lambda: np.zeros(4))
"""Radial integrated transport coefficient (n=1) (species dependent)"""

d112: list[float] = field(default_factory=lambda: np.zeros(4))
"""Radial integrated transport coefficient (n=2) (species dependent)"""

d113: list[float] = field(default_factory=lambda: np.zeros(4))
"""Radial integrated transport coefficient (n=3) (species dependent)"""

q_flux: list[float] = field(default_factory=lambda: np.zeros(4))
"""energy transport flux (J/m2)"""

gamma_flux: list[float] = field(default_factory=lambda: np.zeros(4))
"""energy flux from particle transport"""

d31_mono: list[float] = field(default_factory=lambda: np.zeros(NO_ROOTS))
"""Toroidal monoenergetic transport coefficient"""

eps_eff: float = 1e-5
"""Epsilon effective (used in neoclassics_calc_D11_mono)"""

r_eff: float = 0.0

d11_plateau: list[float] = None
"""Toroidal monoenergetic transport coefficient as given by the stellarator
input json file as function of nu_star, normalised by the banana value.
"""

d111: list[float] = None
"""Radial integrated transport coefficient (n=1) (species dependent)"""

d112: list[float] = None
"""Radial integrated transport coefficient (n=2) (species dependent)"""

d113: list[float] = None
"""Radial integrated transport coefficient (n=3) (species dependent)"""

q_flux: list[float] = None
"""energy transport flux (J/m2)"""

gamma_flux: list[float] = None
"""energy flux from particle transport"""

d31_mono: list[float] = None
"""Toroidal monoenergetic transport coefficient"""

eps_eff: float = None
"""Epsilon effective (used in neoclassics_calc_D11_mono)"""

r_eff: float = None


def init_neoclassics_variables():
global \
densities, \
temperatures, \
dr_densities, \
dr_temperatures, \
roots, \
weights, \
nu, \
nu_star, \
nu_star_averaged, \
vd, \
kt, \
er, \
iota, \
d11_mono, \
d11_plateau, \
d111, \
d112, \
d113, \
q_flux, \
gamma_flux, \
d31_mono, \
eps_eff, \
r_eff

densities = np.zeros(4)
temperatures = np.zeros(4)
dr_densities = np.zeros(4)
dr_temperatures = np.zeros(4)
roots = np.zeros(NO_ROOTS)
weights = np.zeros(NO_ROOTS)
nu = np.zeros((4, NO_ROOTS))
nu_star = np.zeros((4, NO_ROOTS))
nu_star_averaged = np.zeros(4)
vd = np.zeros((4, NO_ROOTS))
kt = np.zeros((4, NO_ROOTS))
iota = 1.0
d11_mono = np.zeros((4, NO_ROOTS))
d11_plateau = np.zeros((4, NO_ROOTS))
d111 = np.zeros(4)
d112 = np.zeros(4)
d113 = np.zeros(4)
q_flux = np.zeros(4)
gamma_flux = np.zeros(4)
d31_mono = np.zeros(NO_ROOTS)
eps_eff = 1e-5
r_eff = 0.0
er = 0.0
CREATE_DICTS_FROM_DATACLASS = NeoclassicsData
Loading
Loading