From 49ee97e48e57084aae30f64a6ca80e84fc7edd35 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Mon, 29 Jun 2026 16:21:22 +0100 Subject: [PATCH] Move confinement time enums to data structure --- process/core/io/plot/summary.py | 6 +- process/data_structure/physics_variables.py | 106 ++++++++++++++++++- process/models/physics/confinement_time.py | 111 +------------------- 3 files changed, 112 insertions(+), 111 deletions(-) diff --git a/process/core/io/plot/summary.py b/process/core/io/plot/summary.py index ff74559759..241adb8c5f 100644 --- a/process/core/io/plot/summary.py +++ b/process/core/io/plot/summary.py @@ -23,6 +23,7 @@ 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 NFIXMX +from process.data_structure.physics_variables import ConfinementTimeModel from process.models.build import Build from process.models.engineering.materials import poisson_steel from process.models.geometry.blanket import ( @@ -50,10 +51,7 @@ ) from process.models.pfcoil import CSCoil from process.models.physics.bootstrap_current import BootstrapCurrentFractionModel -from process.models.physics.confinement_time import ( - ConfinementTimeModel, - PlasmaConfinementTime, -) +from process.models.physics.confinement_time import PlasmaConfinementTime from process.models.physics.current_drive import ( CurrentDriveModel, ElectronBernstein, diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 8bcb2cd059..9084ee39b5 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -20,7 +20,111 @@ class DivertorNumberModels(IntEnum): SINGLE_NULL = 1 -N_CONFINEMENT_SCALINGS = 51 +class ConfinementTimeModel(IntEnum): + """Confinement time (τ_E) model types""" + + USER_INPUT = (0, "User input electron confinement ") + NEO_ALCATOR = (1, "Neo-Alcator (Ohmic)") + MIRNOV = (2, "Mirnov (H)") + MEREZHKIN_MUHKOVATOV = (3, "Merezkhin-Muhkovatov (Ohmic)(L)") + SHIMOMURA = (4, "Shimomura (H)") + KAYE_GOLDSTON = (5, "Kaye-Goldston (L)") + ITER_89P = (6, "ITER 89-P (L)") + ITER_89_0 = (7, "ITER 89-O (L)") + REBUT_LALLIA = (8, "Rebut-Lallia (L)") + GOLDSTON = (9, "Goldston (L)") + T_10 = (10, "T10 (L)") + JAERI = (11, "JAERI / Odajima-Shimomura (L)") + KAYE_BIG = (12, "Kaye-Big Complex (L)") + ITER_H90_P = (13, "ITER H90-P (H)") + MINIMUM_OF_ITER_89P_AND_ITER_89_0 = (14, "ITER 89-P & 89-O min (L)") + RIEDEL_L = (15, "Riedel (L)") + CHRISTIANSEN = (16, "Christiansen (L)") + LACKNER_GOTTARDI = (17, "Lackner-Gottardi (L)") + NEO_KAYE = (18, "Neo-Kaye (L)") + RIEDEL_H = (19, "Riedel (H)") + ITER_H90_P_AMENDED = (20, "ITER H90-P amended (H)") + SUDO_ET_AL = (21, "LHD (Stell)") + GYRO_REDUCED_BOHM = (22, "Gyro-reduced Bohm (Stell)") + LACKNER_GOTTARDI_STELLARATOR = (23, "Lackner-Gottardi (Stell)") + ITER_93H = (24, "ITER-93H ELM-free (H)") + TITAN_REMOVED = (25, "TITAN RFP OBSOLETE ") + ITER_H97P = (26, "ITER H-97P ELM-free (H)") + ITER_H97P_ELMY = (27, "ITER H-97P ELMy (H)") + ITER_96P = (28, "ITER-96P (ITER-97L) (L)") + VALOVIC_ELMY = (29, "Valovic modified ELMy (H)") + KAYE = (30, "Kaye 98 modified (L)") + ITER_PB98P_Y = (31, "ITERH-PB98P(y) (H)") + IPB98_Y = (32, "IPB98(y) (H)") + ITER_IPB98Y1 = (33, "IPB98(y,1) (H)") + ITER_IPB98Y2 = (34, "IPB98(y,2) (H)") + ITER_IPB98Y3 = (35, "IPB98(y,3) (H)") + ITER_IPB98Y4 = (36, "IPB98(y,4) (H)") + ISS95_STELLARATOR = (37, "ISS95 (Stell)") + ISS04_STELLARATOR = (38, "ISS04 (Stell)") + DS03 = (39, "DS03 beta-independent (H)") + MURARI = (40, 'Murari "Non-power law" (H)') + PETTY08 = (41, "Petty 2008 (ST)(H)") + LANG_HIGH_DENSITY = (42, "Lang high density (H)") + HUBBARD_NOMINAL = (43, "Hubbard 2017 - nominal (I)") + HUBBARD_LOWER = (44, "Hubbard 2017 - lower (I)") + HUBBARD_UPPER = (45, "Hubbard 2017 - upper (I)") + MENARD_NSTX = (46, "Menard NSTX (ST)(H)") + MENARD_NSTX_PETTY08_HYBRID = (47, "Menard NSTX-Petty08 hybrid (ST)(H)") + NSTX_GYRO_BOHM = (48, "Buxton NSTX gyro-Bohm (ST)(H)") + ITPA20 = (49, "ITPA20 (H)") + ITPA20_IL = (50, "ITPA20-IL (H)") + + def __new__(cls, value: int, full_name: str): + """Create a new instance of ConfinementTimeModel. + + Parameters + ---------- + value : int + The enum value + full_name : str + The full name of the confinement time model + + Returns + ------- + ConfinementTimeModel + A new enum instance with the given value and full name + """ + obj = int.__new__(cls, value) + obj._value_ = value + obj.full_name = full_name + return obj + + +class ConfinementRadiationLossModel(IntEnum): + """Confinement radiation loss model types""" + + FULL_RADIATION = (0, "All radiation included in loss power term") + CORE_ONLY = (1, "Only core radiation included in loss power term") + NO_RADIATION = (2, "No radiation included in loss power term") + + def __new__(cls, value: int, description: str): + """Create a new instance of ConfinementRadiationLossModel. + + Parameters + ---------- + value : int + The enum value + description : str + The description of the radiation loss model + + Returns + ------- + ConfinementRadiationLossModel + A new enum instance with the given value and description + """ + obj = int.__new__(cls, value) + obj._value_ = value + obj.description = description + return obj + + +N_CONFINEMENT_SCALINGS = len(ConfinementTimeModel) """number of energy confinement time scaling laws""" diff --git a/process/models/physics/confinement_time.py b/process/models/physics/confinement_time.py index 3068cb39ee..27a9b63415 100644 --- a/process/models/physics/confinement_time.py +++ b/process/models/physics/confinement_time.py @@ -1,7 +1,6 @@ """Confinement time model calculations and definitions.""" import logging -from enum import IntEnum import numpy as np from scipy.optimize import root_scalar @@ -10,116 +9,16 @@ from process.core import process_output as po from process.core.exceptions import ProcessValueError from process.core.model import Model -from process.data_structure.physics_variables import N_CONFINEMENT_SCALINGS +from process.data_structure.physics_variables import ( + N_CONFINEMENT_SCALINGS, + ConfinementRadiationLossModel, + ConfinementTimeModel, +) from process.models.physics.plasma_geometry import PlasmaGeom logger = logging.getLogger(__name__) -class ConfinementTimeModel(IntEnum): - """Confinement time (τ_E) model types""" - - USER_INPUT = (0, "User input electron confinement ") - NEO_ALCATOR = (1, "Neo-Alcator (Ohmic)") - MIRNOV = (2, "Mirnov (H)") - MEREZHKIN_MUHKOVATOV = (3, "Merezkhin-Muhkovatov (Ohmic)(L)") - SHIMOMURA = (4, "Shimomura (H)") - KAYE_GOLDSTON = (5, "Kaye-Goldston (L)") - ITER_89P = (6, "ITER 89-P (L)") - ITER_89_0 = (7, "ITER 89-O (L)") - REBUT_LALLIA = (8, "Rebut-Lallia (L)") - GOLDSTON = (9, "Goldston (L)") - T_10 = (10, "T10 (L)") - JAERI = (11, "JAERI / Odajima-Shimomura (L)") - KAYE_BIG = (12, "Kaye-Big Complex (L)") - ITER_H90_P = (13, "ITER H90-P (H)") - MINIMUM_OF_ITER_89P_AND_ITER_89_0 = (14, "ITER 89-P & 89-O min (L)") - RIEDEL_L = (15, "Riedel (L)") - CHRISTIANSEN = (16, "Christiansen (L)") - LACKNER_GOTTARDI = (17, "Lackner-Gottardi (L)") - NEO_KAYE = (18, "Neo-Kaye (L)") - RIEDEL_H = (19, "Riedel (H)") - ITER_H90_P_AMENDED = (20, "ITER H90-P amended (H)") - SUDO_ET_AL = (21, "LHD (Stell)") - GYRO_REDUCED_BOHM = (22, "Gyro-reduced Bohm (Stell)") - LACKNER_GOTTARDI_STELLARATOR = (23, "Lackner-Gottardi (Stell)") - ITER_93H = (24, "ITER-93H ELM-free (H)") - TITAN_REMOVED = (25, "TITAN RFP OBSOLETE ") - ITER_H97P = (26, "ITER H-97P ELM-free (H)") - ITER_H97P_ELMY = (27, "ITER H-97P ELMy (H)") - ITER_96P = (28, "ITER-96P (ITER-97L) (L)") - VALOVIC_ELMY = (29, "Valovic modified ELMy (H)") - KAYE = (30, "Kaye 98 modified (L)") - ITER_PB98P_Y = (31, "ITERH-PB98P(y) (H)") - IPB98_Y = (32, "IPB98(y) (H)") - ITER_IPB98Y1 = (33, "IPB98(y,1) (H)") - ITER_IPB98Y2 = (34, "IPB98(y,2) (H)") - ITER_IPB98Y3 = (35, "IPB98(y,3) (H)") - ITER_IPB98Y4 = (36, "IPB98(y,4) (H)") - ISS95_STELLARATOR = (37, "ISS95 (Stell)") - ISS04_STELLARATOR = (38, "ISS04 (Stell)") - DS03 = (39, "DS03 beta-independent (H)") - MURARI = (40, 'Murari "Non-power law" (H)') - PETTY08 = (41, "Petty 2008 (ST)(H)") - LANG_HIGH_DENSITY = (42, "Lang high density (H)") - HUBBARD_NOMINAL = (43, "Hubbard 2017 - nominal (I)") - HUBBARD_LOWER = (44, "Hubbard 2017 - lower (I)") - HUBBARD_UPPER = (45, "Hubbard 2017 - upper (I)") - MENARD_NSTX = (46, "Menard NSTX (ST)(H)") - MENARD_NSTX_PETTY08_HYBRID = (47, "Menard NSTX-Petty08 hybrid (ST)(H)") - NSTX_GYRO_BOHM = (48, "Buxton NSTX gyro-Bohm (ST)(H)") - ITPA20 = (49, "ITPA20 (H)") - ITPA20_IL = (50, "ITPA20-IL (H)") - - def __new__(cls, value: int, full_name: str): - """Create a new instance of ConfinementTimeModel. - - Parameters - ---------- - value : int - The enum value - full_name : str - The full name of the confinement time model - - Returns - ------- - ConfinementTimeModel - A new enum instance with the given value and full name - """ - obj = int.__new__(cls, value) - obj._value_ = value - obj.full_name = full_name - return obj - - -class ConfinementRadiationLossModel(IntEnum): - """Confinement radiation loss model types""" - - FULL_RADIATION = (0, "All radiation included in loss power term") - CORE_ONLY = (1, "Only core radiation included in loss power term") - NO_RADIATION = (2, "No radiation included in loss power term") - - def __new__(cls, value: int, description: str): - """Create a new instance of ConfinementRadiationLossModel. - - Parameters - ---------- - value : int - The enum value - description : str - The description of the radiation loss model - - Returns - ------- - ConfinementRadiationLossModel - A new enum instance with the given value and description - """ - obj = int.__new__(cls, value) - obj._value_ = value - obj.description = description - return obj - - class PlasmaConfinementTime(Model): """Class to calculate plasma confinement time using various empirical scaling laws"""