Skip to content
Merged
44 changes: 39 additions & 5 deletions process/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import datetime
import getpass
import logging
import socket
import subprocess # noqa: S404
from pathlib import Path
Expand All @@ -22,9 +23,16 @@
from process.data_structure.impurity_radiation_variables import N_IMPURITIES
from process.data_structure.numerics import FiguresOfMerit, PROCESSRunMode
from process.data_structure.pfcoil_variables import PFConductorModel
from process.data_structure.physics_variables import DivertorNumberModels
from process.data_structure.physics_variables import (
ConfinementMode,
ConfinementTimeModel,
DivertorNumberModels,
)
from process.models.pfcoil import PFLocationTypes
from process.models.physics.profiles import DensityProfilePedestalType
from process.models.physics.profiles import (
DensityProfilePedestalType,
PlasmaProfileShapeType,
)
from process.models.stellarator.initialization import st_init
from process.models.superconductors import (
SuperconductorMaterial,
Expand All @@ -34,6 +42,7 @@
from process.models.tfcoil.base import TFCoilShapeModel, TFConductorModel
from process.models.tfcoil.superconducting import SuperconductingTFWPShapeType

logger = logging.getLogger(__name__)
if TYPE_CHECKING:
from process.core.model import DataStructure

Expand Down Expand Up @@ -1018,19 +1027,44 @@ def check_process(inputs, data): # noqa: ARG001
data.tfcoil.temp_tf_superconductor_margin_min = data.tfcoil.tmargmin
data.tfcoil.temp_cs_superconductor_margin_min = data.tfcoil.tmargmin

if data.physics.tauee_in > 1e-10 and data.physics.i_confinement_time != 48:
if (
data.physics.tauee_in > 1e-10
and data.physics.i_confinement_time != ConfinementTimeModel.NSTX_GYRO_BOHM
):
# Report error if confinement time is in the input
# but the scaling to use it is not selected.
warn("tauee_in is for use with i_confinement_time=48 only", stacklevel=2)

if data.physics.aspect > 1.7 and data.physics.i_confinement_time == 46:
if (
data.physics.aspect > 1.7
and data.physics.i_confinement_time == ConfinementTimeModel.MENARD_NSTX
):
# NSTX scaling is for A<1.7
warn("NSTX scaling is for A<1.7", stacklevel=2)

if data.physics.i_plasma_current == 2 and data.physics.i_confinement_time == 42:
if (
data.physics.i_plasma_current == 2
and data.physics.i_confinement_time == ConfinementTimeModel.LANG_HIGH_DENSITY
):
raise ProcessValidationError(
"Lang 2012 confinement scaling cannot be used for i_plasma_current=2 due to wrong q"
)
if (
data.stellarator.istell == 0
and ConfinementTimeModel(data.physics.i_confinement_time).mode
== ConfinementMode.STELLARATOR
):
raise ProcessValidationError(
"Stellarator confinement time scaling cannot be used for a tokamak"
)
if (
data.physics.i_plasma_pedestal == PlasmaProfileShapeType.PEDESTAL_PROFILE
and ConfinementTimeModel(data.physics.i_confinement_time).mode
not in [ConfinementMode.H_MODE, ConfinementMode.I_MODE]
):
logger.warning(
"Non H-mode or I-mode confinement time scaling should not be used with a pedestal profile"
)

# Cannot use temperature margin constraint with REBCO TF coils
if (
Expand Down
Loading
Loading