diff --git a/process/core/caller.py b/process/core/caller.py index df8716424..9b6c0f4f6 100644 --- a/process/core/caller.py +++ b/process/core/caller.py @@ -15,6 +15,7 @@ from process.core.solver import constraints from process.core.solver.iteration_variables import set_scaled_iteration_variable from process.core.solver.objectives import objective_function +from process.data_structure.blanket_variables import BlktModelTypes from process.models.tfcoil.base import TFConductorModel from process.models.tfcoil.superconducting import SuperconductingTFTurnType @@ -344,11 +345,11 @@ def _call_models_once(self, xc: np.ndarray, data: DataStructure): 4 | KIT HCLL model 5 | DCLL model """ - if self.data.fwbs.i_blanket_type == 1: + if self.data.fwbs.i_blanket_type == BlktModelTypes.CCFE_HCPB: # CCFE HCPB model self.models.ccfe_hcpb.run() - elif self.data.fwbs.i_blanket_type == 5: + elif self.data.fwbs.i_blanket_type == BlktModelTypes.DCLL: # DCLL model self.models.dcll.run() diff --git a/process/core/init.py b/process/core/init.py index d5ed1f892..c65dce19e 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -16,6 +16,7 @@ from process.core.log import logging_model_handler from process.core.solver import iteration_variables from process.core.solver.constraints import ConstraintManager +from process.data_structure.blanket_variables import BlktModelTypes from process.data_structure.impurity_radiation_module import ( init_impurity_radiation_module, ) @@ -1116,7 +1117,9 @@ def check_process(inputs, data): # noqa: ARG001 # Ensure that blanket material fractions allow non-zero space for steel # CCFE HCPB Model - if data.stellarator.istell == 0 and (data.fwbs.i_blanket_type == 1): + if data.stellarator.istell == 0 and ( + data.fwbs.i_blanket_type == BlktModelTypes.CCFE_HCPB + ): fsum = data.fwbs.breeder_multiplier + data.fwbs.vfcblkt + data.fwbs.vfpblkt if fsum >= 1.0: raise ProcessValidationError( diff --git a/process/core/output.py b/process/core/output.py index 83435cca6..caded8abe 100644 --- a/process/core/output.py +++ b/process/core/output.py @@ -1,5 +1,6 @@ from process import data_structure from process.core.log import logging_model_handler +from process.data_structure.blanket_variables import BlktModelTypes from process.models.tfcoil.base import TFConductorModel from process.models.tfcoil.superconducting import ( SuperconductingTFTurnType, @@ -122,11 +123,11 @@ def write(models, data, _outfile): # First wall geometry models.fw.output() - if data.fwbs.i_blanket_type == 1: + if data.fwbs.i_blanket_type == BlktModelTypes.CCFE_HCPB: # CCFE HCPB model models.ccfe_hcpb.output() - elif data.fwbs.i_blanket_type == 5: + elif data.fwbs.i_blanket_type == BlktModelTypes.DCLL: # DCLL model models.dcll.output() diff --git a/process/data_structure/blanket_variables.py b/process/data_structure/blanket_variables.py index 51d37e4b3..4f663a592 100644 --- a/process/data_structure/blanket_variables.py +++ b/process/data_structure/blanket_variables.py @@ -26,6 +26,14 @@ """ from dataclasses import dataclass +from enum import IntEnum + + +class BlktModelTypes(IntEnum): + """Enum for blanket model types. `i_blanket_type`""" + + CCFE_HCPB = 1 + DCLL = 5 @dataclass diff --git a/process/models/blankets/blanket_library.py b/process/models/blankets/blanket_library.py index 98c5c4109..58c628c23 100644 --- a/process/models/blankets/blanket_library.py +++ b/process/models/blankets/blanket_library.py @@ -13,6 +13,7 @@ from process.data_structure import ( physics_variables, ) +from process.data_structure.blanket_variables import BlktModelTypes from process.models.build import FwBlktVVShape from process.models.engineering.ivc_functions import ( calculate_pipe_bend_radius, @@ -888,7 +889,8 @@ def set_blanket_module_geometry(self): Error If the poloidal segment length is less than three times the minimum liquid breeder pipe width. """ - if self.data.fwbs.i_blanket_type == 5: + i_blanket_type = BlktModelTypes(self.data.fwbs.i_blanket_type) + if i_blanket_type == BlktModelTypes.DCLL: # Unless DCLL then we will use BZ self.data.blanket.len_blkt_inboard_coolant_channel_radial = ( self.data.build.blbuith diff --git a/process/models/power.py b/process/models/power.py index a81f0c06f..716441950 100644 --- a/process/models/power.py +++ b/process/models/power.py @@ -16,6 +16,7 @@ physics_variables, tfcoil_variables, ) +from process.data_structure.blanket_variables import BlktModelTypes from process.data_structure.pfcoil_variables import NGC2 @@ -1932,9 +1933,10 @@ def plant_thermal_efficiency(self, eta_turbine: float) -> float: i_thermal_electric_conversion = ElectricConversionModelTypes( self.data.fwbs.i_thermal_electric_conversion ) + i_blanket_type = BlktModelTypes(self.data.fwbs.i_blanket_type) if i_thermal_electric_conversion == ElectricConversionModelTypes.CCFE_HCPB_VALUE: # CCFE HCPB Model - if self.data.fwbs.i_blanket_type == 1: + if i_blanket_type == BlktModelTypes.CCFE_HCPB: # HCPB, efficiency taken from M. Kovari 2016 # "PROCESS": A systems code for fusion power plants - # Part 2: Engineering @@ -1950,7 +1952,7 @@ def plant_thermal_efficiency(self, eta_turbine: float) -> float: == ElectricConversionModelTypes.CCFE_HCPB_VALUE_WITH_DIVERTOR ): # CCFE HCPB Model - if self.data.fwbs.i_blanket_type == 1: + if self.data.fwbs.i_blanket_type == BlktModelTypes.CCFE_HCPB: # HCPB, efficiency taken from M. Kovari 2016 # "PROCESS": A systems code for fusion power plants - # Part 2: Engineering @@ -1971,7 +1973,7 @@ def plant_thermal_efficiency(self, eta_turbine: float) -> float: == ElectricConversionModelTypes.STEAM_RANKINE_CYCLE ): # CCFE HCPB Model - if self.data.fwbs.i_blanket_type == 1: + if self.data.fwbs.i_blanket_type == BlktModelTypes.CCFE_HCPB: # If coolant is helium, the steam cycle is assumed to be superheated # and a different correlation is used. The turbine inlet temperature # is assumed to be 20 degrees below the primary coolant outlet