From 5c80704b1d3a0bcaa5e18d182325645e1c5388cf Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 29 Apr 2026 11:02:22 +0100 Subject: [PATCH 1/3] Add BlktModelTypes enum for blanket model types Co-authored-by: Copilot --- process/models/blankets/blanket_library.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/process/models/blankets/blanket_library.py b/process/models/blankets/blanket_library.py index c22162026..fee8eb323 100644 --- a/process/models/blankets/blanket_library.py +++ b/process/models/blankets/blanket_library.py @@ -22,6 +22,7 @@ ) from process.models.build import FwBlktVVShape from process.models.power import PumpingPowerModelTypes +from enum import IntEnum logger = logging.getLogger(__name__) @@ -40,6 +41,14 @@ # FCI Flow Channel Insert +class BlktModelTypes(IntEnum): + """Enum for blanket model types. `i_blanket_type`""" + + CCFE_HCPB = 1 + DCLL = 5 + + + class FWBlktCoolantLoopTypes(IntEnum): """Enumeration for first wall and blanket coolant loop types. `i_fw_blkt_shared_coolant`.""" From 33d1a37f3c4ef960a4ecb5703bfc9b69adbfa939 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 29 Apr 2026 11:08:39 +0100 Subject: [PATCH 2/3] Refactor blanket type checks to use BlktModelTypes enum for improved readability and maintainability Co-authored-by: Copilot --- process/core/caller.py | 5 +++-- process/core/init.py | 3 ++- process/core/output.py | 5 +++-- process/models/blankets/blanket_library.py | 5 ++--- process/models/power.py | 7 ++++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/process/core/caller.py b/process/core/caller.py index 953add544..051ccf3b7 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.models.blankets.blanket_library import BlktModelTypes from process.models.tfcoil.base import TFConductorModel from process.models.tfcoil.superconducting import SuperconductingTFTurnType @@ -341,11 +342,11 @@ def _call_models_once(self, xc: np.ndarray): 4 | KIT HCLL model 5 | DCLL model """ - if data_structure.fwbs_variables.i_blanket_type == 1: + if data_structure.fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB: # CCFE HCPB model self.models.ccfe_hcpb.run() - elif data_structure.fwbs_variables.i_blanket_type == 5: + elif data_structure.fwbs_variables.i_blanket_type == BlktModelTypes.DCLL: # DCLL model self.models.dcll.run() diff --git a/process/core/init.py b/process/core/init.py index 0fa2e9ecb..81928c0fe 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -58,6 +58,7 @@ ) from process.data_structure.tfcoil_variables import init_tfcoil_variables from process.data_structure.times_variables import init_times_variables +from process.models.blankets.blanket_library import BlktModelTypes from process.models.stellarator.initialization import st_init from process.models.superconductors import ( SuperconductorMaterial, @@ -1178,7 +1179,7 @@ def check_process(inputs, data): # noqa: ARG001 # CCFE HCPB Model if data_structure.stellarator_variables.istell == 0 and ( - data_structure.fwbs_variables.i_blanket_type == 1 + data_structure.fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB ): fsum = ( data_structure.fwbs_variables.breeder_multiplier diff --git a/process/core/output.py b/process/core/output.py index 07982308d..b2041e08e 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.models.blankets.blanket_library import BlktModelTypes from process.models.tfcoil.base import TFConductorModel from process.models.tfcoil.superconducting import ( SuperconductingTFTurnType, @@ -122,11 +123,11 @@ def write(models, _outfile): # First wall geometry models.fw.output() - if data_structure.fwbs_variables.i_blanket_type == 1: + if data_structure.fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB: # CCFE HCPB model models.ccfe_hcpb.output() - elif data_structure.fwbs_variables.i_blanket_type == 5: + elif data_structure.fwbs_variables.i_blanket_type == BlktModelTypes.DCLL: # DCLL model models.dcll.output() diff --git a/process/models/blankets/blanket_library.py b/process/models/blankets/blanket_library.py index fee8eb323..0aafbf130 100644 --- a/process/models/blankets/blanket_library.py +++ b/process/models/blankets/blanket_library.py @@ -43,12 +43,11 @@ class BlktModelTypes(IntEnum): """Enum for blanket model types. `i_blanket_type`""" - + CCFE_HCPB = 1 DCLL = 5 - class FWBlktCoolantLoopTypes(IntEnum): """Enumeration for first wall and blanket coolant loop types. `i_fw_blkt_shared_coolant`.""" @@ -893,7 +892,7 @@ def set_blanket_module_geometry(self): Error If the poloidal segment length is less than three times the minimum liquid breeder pipe width. """ - if fwbs_variables.i_blanket_type == 5: + if fwbs_variables.i_blanket_type == BlktModelTypes.DCLL: # Unless DCLL then we will use BZ blanket_library.len_blkt_inboard_coolant_channel_radial = ( build_variables.blbuith diff --git a/process/models/power.py b/process/models/power.py index 1ec6ae044..748a5ffa0 100644 --- a/process/models/power.py +++ b/process/models/power.py @@ -26,6 +26,7 @@ tfcoil_variables, times_variables, ) +from process.models.blankets.blanket_library import BlktModelTypes class PumpingPowerModelTypes(IntEnum): @@ -1902,7 +1903,7 @@ def plant_thermal_efficiency(self, eta_turbine): ) if i_thermal_electric_conversion == ElectricConversionModelTypes.CCFE_HCPB_VALUE: # CCFE HCPB Model - if fwbs_variables.i_blanket_type == 1: + if fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB: # HCPB, efficiency taken from M. Kovari 2016 # "PROCESS": A systems code for fusion power plants - Part 2: Engineering # https://www.sciencedirect.com/science/article/pii/S0920379616300072 @@ -1917,7 +1918,7 @@ def plant_thermal_efficiency(self, eta_turbine): == ElectricConversionModelTypes.CCFE_HCPB_VALUE_WITH_DIVERTOR ): # CCFE HCPB Model - if fwbs_variables.i_blanket_type == 1: + if fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB: # HCPB, efficiency taken from M. Kovari 2016 # "PROCESS": A systems code for fusion power plants - Part 2: Engineering # https://www.sciencedirect.com/science/article/pii/S0920379616300072 @@ -1937,7 +1938,7 @@ def plant_thermal_efficiency(self, eta_turbine): == ElectricConversionModelTypes.STEAM_RANKINE_CYCLE ): # CCFE HCPB Model - if fwbs_variables.i_blanket_type == 1: + if fwbs_variables.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 From 2b04ee265735010e54c3b8928c4ac0c688f96992 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 29 Apr 2026 15:15:34 +0100 Subject: [PATCH 3/3] Refactor blanket type checks to use BlktModelTypes enum for consistency in power calculations Co-authored-by: Copilot --- process/models/blankets/blanket_library.py | 4 ++-- process/models/power.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/process/models/blankets/blanket_library.py b/process/models/blankets/blanket_library.py index 0aafbf130..3d403cd88 100644 --- a/process/models/blankets/blanket_library.py +++ b/process/models/blankets/blanket_library.py @@ -22,7 +22,6 @@ ) from process.models.build import FwBlktVVShape from process.models.power import PumpingPowerModelTypes -from enum import IntEnum logger = logging.getLogger(__name__) @@ -892,7 +891,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 fwbs_variables.i_blanket_type == BlktModelTypes.DCLL: + i_blanket_type = BlktModelTypes(fwbs_variables.i_blanket_type) + if i_blanket_type == BlktModelTypes.DCLL: # Unless DCLL then we will use BZ blanket_library.len_blkt_inboard_coolant_channel_radial = ( build_variables.blbuith diff --git a/process/models/power.py b/process/models/power.py index 748a5ffa0..b51665778 100644 --- a/process/models/power.py +++ b/process/models/power.py @@ -1901,9 +1901,10 @@ def plant_thermal_efficiency(self, eta_turbine): i_thermal_electric_conversion = ElectricConversionModelTypes( fwbs_variables.i_thermal_electric_conversion ) + i_blanket_type = BlktModelTypes(fwbs_variables.i_blanket_type) if i_thermal_electric_conversion == ElectricConversionModelTypes.CCFE_HCPB_VALUE: # CCFE HCPB Model - if fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB: + 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 # https://www.sciencedirect.com/science/article/pii/S0920379616300072 @@ -1918,7 +1919,7 @@ def plant_thermal_efficiency(self, eta_turbine): == ElectricConversionModelTypes.CCFE_HCPB_VALUE_WITH_DIVERTOR ): # CCFE HCPB Model - if fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB: + 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 # https://www.sciencedirect.com/science/article/pii/S0920379616300072 @@ -1938,7 +1939,7 @@ def plant_thermal_efficiency(self, eta_turbine): == ElectricConversionModelTypes.STEAM_RANKINE_CYCLE ): # CCFE HCPB Model - if fwbs_variables.i_blanket_type == BlktModelTypes.CCFE_HCPB: + if 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