Skip to content
Open
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
5 changes: 3 additions & 2 deletions process/core/caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing BlktModelTypes from process.models.blankets.blanket_library couples the core caller to the full blanket library import graph. Consider relocating the enum to a lightweight module (or importing locally) so selecting a blanket model doesn't require importing blanket_library.py at module import time.

Copilot uses AI. Check for mistakes.
from process.models.tfcoil.base import TFConductorModel
from process.models.tfcoil.superconducting import SuperconductingTFTurnType

Expand Down Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion process/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing BlktModelTypes from process.models.blankets.blanket_library pulls in the full blanket library (including CoolProp interface) during core initialization. Consider moving the enum to a lightweight module (e.g., process.data_structure.fwbs_variables) to reduce import-time coupling and potential side effects.

Copilot uses AI. Check for mistakes.
from process.models.stellarator.initialization import st_init
from process.models.superconductors import (
SuperconductorMaterial,
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions process/core/output.py
Original file line number Diff line number Diff line change
@@ -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
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing BlktModelTypes from process.models.blankets.blanket_library introduces an eager dependency on the full blanket library (and its heavy imports) even for cases that return early (stellarator/IFE). Consider importing the enum from a lightweight module (or doing a local import inside write) to avoid unnecessary import-time side effects.

Copilot uses AI. Check for mistakes.
from process.models.tfcoil.base import TFConductorModel
from process.models.tfcoil.superconducting import (
SuperconductingTFTurnType,
Expand Down Expand Up @@ -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()

Expand Down
10 changes: 9 additions & 1 deletion process/models/blankets/blanket_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@
# FCI Flow Channel Insert


class BlktModelTypes(IntEnum):
"""Enum for blanket model types. `i_blanket_type`"""

CCFE_HCPB = 1
DCLL = 5
Comment on lines +43 to +47
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining BlktModelTypes inside blanket_library.py makes any import of the enum also import the full blanket library (numpy + CoolProp interface, etc.). To avoid unnecessary heavyweight imports in core modules, consider relocating this enum to a lightweight module (e.g., process.data_structure.fwbs_variables where i_blanket_type is defined) and importing it here instead.

Copilot uses AI. Check for mistakes.


class FWBlktCoolantLoopTypes(IntEnum):
"""Enumeration for first wall and blanket coolant loop types. `i_fw_blkt_shared_coolant`."""

Expand Down Expand Up @@ -884,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 == 5:
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
Expand Down
8 changes: 5 additions & 3 deletions process/models/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
tfcoil_variables,
times_variables,
)
from process.models.blankets.blanket_library import BlktModelTypes

Comment on lines +29 to 30
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing BlktModelTypes from process.models.blankets.blanket_library pulls in blanket_library's heavy dependencies (e.g., CoolProp via process.core.coolprop_interface) just to access an enum. Consider moving BlktModelTypes into a lightweight module (e.g., process.data_structure.fwbs_variables or a small process.models.blankets.types module) and importing from there to reduce coupling and import-time side effects.

Suggested change
from process.models.blankets.blanket_library import BlktModelTypes
def _get_blkt_model_types():
from process.models.blankets.blanket_library import BlktModelTypes
return BlktModelTypes
class _BlktModelTypesProxy:
def __getattr__(self, name):
return getattr(_get_blkt_model_types(), name)
BlktModelTypes = _BlktModelTypesProxy()

Copilot uses AI. Check for mistakes.

class PumpingPowerModelTypes(IntEnum):
Expand Down Expand Up @@ -1900,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 == 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
# https://www.sciencedirect.com/science/article/pii/S0920379616300072
Expand All @@ -1917,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 == 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
# https://www.sciencedirect.com/science/article/pii/S0920379616300072
Expand All @@ -1937,7 +1939,7 @@ def plant_thermal_efficiency(self, eta_turbine):
== ElectricConversionModelTypes.STEAM_RANKINE_CYCLE
):
# CCFE HCPB Model
if fwbs_variables.i_blanket_type == 1:
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
Expand Down
Loading