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
2 changes: 1 addition & 1 deletion process/core/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ def __post_init__(self):
choices=list(range(N_CONFINEMENT_SCALINGS)),
),
"quench_model": InputVariable("tfcoil", str, choices=["exponential", "linear"]),
"i_fw_coolant_type": InputVariable("fwbs", str, choices=["helium", "water"]),
"i_fw_coolant_type": InputVariable("fwbs", int, choices=[1, 2]),
"i_vacuum_pumping": InputVariable("vacuum", str, choices=["old", "simple"]),
"dcond": InputVariable("tfcoil", float, array=True),
"c_pf_coil_turn_peak_input": InputVariable("pf_coil", float, array=True),
Expand Down
3 changes: 2 additions & 1 deletion process/core/io/plot/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from process.data_structure.numerics import FiguresOfMerit, PROCESSRunMode
from process.data_structure.pfcoil_variables import NFIXMX
from process.models.build import Build
from process.models.engineering.pumping import CoolantType
from process.models.geometry.blanket import (
blanket_geometry_double_null,
blanket_geometry_single_null,
Expand Down Expand Up @@ -5452,7 +5453,7 @@ def plot_first_wall_poloidal_cross_section(axis: plt.Axes, mfile: MFile, scan: i
)

textstr_fw = "\n".join((
rf"Coolant type: {i_fw_coolant_type}",
rf"Coolant type: {CoolantType(i_fw_coolant_type).name}",
rf"$T_{{FW,peak}}$: {temp_fw_peak:,.3f} K",
rf"$P_{{FW}}$: {pres_fw_coolant / 1e3:,.3f} kPa",
rf"$P_{{FW}}$: {pres_fw_coolant / 1e5:,.3f} bar",
Expand Down
6 changes: 3 additions & 3 deletions process/data_structure/fwbs_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ class FWBSData:
- =2 pressurized water
"""

i_fw_coolant_type: str = "helium"
i_fw_coolant_type: int = 1
"""switch for first wall coolant (can be different from blanket coolant):
- 'helium'
- 'water'
- =1 helium
- =2 water
"""

dr_fw_wall: float = 0.003
Expand Down
61 changes: 23 additions & 38 deletions process/models/blankets/blanket_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
eshellvol,
)
from process.models.engineering.pumping import (
CoolantType,
calculate_reynolds_number,
darcy_friction_haaland,
)
Expand Down Expand Up @@ -694,16 +695,8 @@ def primary_coolant_properties(self, output: bool):
"""
# Make sure that, if the inputs for the FW and blanket inputs are different,
# the i_fw_blkt_shared_coolant variable is appropriately set for separate coolants
if (
self.data.fwbs.i_fw_coolant_type == "Helium"
and self.data.fwbs.i_blkt_coolant_type == 2
):
self.data.fwbs.i_fw_blkt_shared_coolant = (
FWBlktCoolantLoopTypes.SEPARATE_LOOPS
)
if (
self.data.fwbs.i_fw_coolant_type == "Water"
and self.data.fwbs.i_blkt_coolant_type == 1
if CoolantType(self.data.fwbs.i_fw_coolant_type) != CoolantType(
self.data.fwbs.i_blkt_coolant_type
):
self.data.fwbs.i_fw_blkt_shared_coolant = (
FWBlktCoolantLoopTypes.SEPARATE_LOOPS
Expand All @@ -720,7 +713,7 @@ def primary_coolant_properties(self, output: bool):
) * 0.5
# FW/BB
fw_bb_fluid_properties = FluidProperties.of(
self.data.fwbs.i_fw_coolant_type,
CoolantType(self.data.fwbs.i_fw_coolant_type).full_name,
temperature=mid_temp,
pressure=self.data.fwbs.pres_fw_coolant,
)
Expand All @@ -741,7 +734,7 @@ def primary_coolant_properties(self, output: bool):
self.data.fwbs.temp_fw_coolant_in + self.data.fwbs.temp_fw_coolant_out
) * 0.5
fw_fluid_properties = FluidProperties.of(
self.data.fwbs.i_fw_coolant_type,
CoolantType(self.data.fwbs.i_fw_coolant_type).full_name,
temperature=mid_temp_fw,
pressure=self.data.fwbs.pres_fw_coolant,
)
Expand All @@ -756,7 +749,7 @@ def primary_coolant_properties(self, output: bool):
+ self.data.fwbs.temp_blkt_coolant_out
) * 0.5
bb_fluid_properties = FluidProperties.of(
"Helium" if self.data.fwbs.i_blkt_coolant_type == 1 else "Water",
CoolantType(self.data.fwbs.i_blkt_coolant_type).full_name,
temperature=mid_temp_bl,
pressure=self.data.fwbs.pres_blkt_coolant,
)
Expand Down Expand Up @@ -802,7 +795,7 @@ def primary_coolant_properties(self, output: bool):
self.outfile,
"Coolant type",
"(i_fw_coolant_type)",
f'"{self.data.fwbs.i_fw_coolant_type}"',
self.data.fwbs.i_fw_coolant_type,
)
po.ovarrf(
self.outfile,
Expand Down Expand Up @@ -855,11 +848,11 @@ def primary_coolant_properties(self, output: bool):
):
po.osubhd(self.outfile, "Breeding Blanket :")

if self.data.fwbs.i_blkt_coolant_type == 1:
if self.data.fwbs.i_blkt_coolant_type == CoolantType.HELIUM:
po.ocmmnt(
self.outfile, "Coolant type (i_blkt_coolant_type=1), Helium"
)
if self.data.fwbs.i_blkt_coolant_type == 2:
if self.data.fwbs.i_blkt_coolant_type == CoolantType.WATER:
po.ocmmnt(
self.outfile, "Coolant type (i_blkt_coolant_type=2), Water"
)
Expand Down Expand Up @@ -2140,16 +2133,8 @@ def thermo_hydraulic_model(self, output: bool):

# Make sure that, if the inputs for the FW and blanket inputs are different,
# the i_fw_blkt_shared_coolant variable is appropriately set for separate coolants
if (
self.data.fwbs.i_fw_coolant_type == "Helium"
and self.data.fwbs.i_blkt_coolant_type == 2
):
self.data.fwbs.i_fw_blkt_shared_coolant = (
FWBlktCoolantLoopTypes.SEPARATE_LOOPS
)
if (
self.data.fwbs.i_fw_coolant_type == "Water"
and self.data.fwbs.i_blkt_coolant_type == 1
if CoolantType(self.data.fwbs.i_fw_coolant_type) != CoolantType(
self.data.fwbs.i_blkt_coolant_type
):
self.data.fwbs.i_fw_blkt_shared_coolant = (
FWBlktCoolantLoopTypes.SEPARATE_LOOPS
Expand Down Expand Up @@ -2484,9 +2469,7 @@ def thermo_hydraulic_model(self, output: bool):
pres_coolant_pump_inlet=self.data.fwbs.pres_blkt_coolant,
dpres_coolant=deltap_blkt,
mflow_coolant_total=self.data.blanket.mflow_blkt_coolant_total,
primary_coolant_switch=(
"Helium" if self.data.fwbs.i_blkt_coolant_type == 1 else "Water"
),
primary_coolant_switch=(self.data.fwbs.i_blkt_coolant_type),
den_coolant=self.data.fwbs.den_blkt_coolant,
label="Blanket",
)
Expand Down Expand Up @@ -2524,9 +2507,7 @@ def thermo_hydraulic_model(self, output: bool):
pres_coolant_pump_inlet=self.data.fwbs.blpressure_liq,
dpres_coolant=deltap_bl_liq,
mflow_coolant_total=self.data.blanket.mfblkt_liq,
primary_coolant_switch=(
"Helium" if self.data.fwbs.i_blkt_coolant_type == 1 else "Water"
),
primary_coolant_switch=(self.data.fwbs.i_blkt_coolant_type),
den_coolant=self.data.fwbs.den_liq,
label="Liquid Metal Breeder/Coolant",
)
Expand Down Expand Up @@ -3312,7 +3293,7 @@ def coolant_pumping_power(
pres_coolant_pump_inlet: float,
dpres_coolant: float,
mflow_coolant_total: float,
primary_coolant_switch: str,
primary_coolant_switch: int,
den_coolant: float,
label: str,
) -> float:
Expand All @@ -3334,8 +3315,8 @@ def coolant_pumping_power(
Coolant pressure drop (Pa).
mflow_coolant_total : float
Total coolant mass flow rate in (kg/s).
primary_coolant_switch : str
Name of FW/blanket coolant (e.g., "Helium" or "Water") if icoolpump=1.
primary_coolant_switch : int
Type of FW/blanket coolant (e.g., 1=Helium, 2=Water) if icoolpump=1.
den_coolant : float
Density of coolant or liquid breeder (kg/m³).
label : str
Expand All @@ -3356,15 +3337,19 @@ def coolant_pumping_power(
pres_coolant_pump_outlet = pres_coolant_pump_inlet + dpres_coolant

# Adiabatic index for helium or water
gamma = (5 / 3) if self.data.fwbs.i_blkt_coolant_type == 1 else (4 / 3)
gamma = (
(5 / 3)
if self.data.fwbs.i_blkt_coolant_type == CoolantType.HELIUM
else (4 / 3)
)
Comment on lines 3339 to +3344

# If calculating for primary coolant
if i_liquid_breeder == 1:
# The pumping power is be calculated in the most general way,
# using enthalpies before and after the pump.

pump_outlet_fluid_properties = FluidProperties.of(
fluid_name=primary_coolant_switch,
fluid_name=CoolantType(primary_coolant_switch).name,
temperature=temp_coolant_pump_outlet,
pressure=pres_coolant_pump_outlet,
)
Expand All @@ -3374,7 +3359,7 @@ def coolant_pumping_power(

# Get specific enthalpy at the outlet (J/kg) before pump using pressure and entropy s1
pump_inlet_fluid_properties = FluidProperties.of(
fluid_name=primary_coolant_switch,
fluid_name=CoolantType(primary_coolant_switch).name,
pressure=pres_coolant_pump_inlet,
entropy=s1,
)
Expand Down
5 changes: 3 additions & 2 deletions process/models/blankets/hcpb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
calculate_pipe_bend_radius,
pumping_powers_as_fractions,
)
from process.models.engineering.pumping import CoolantType
from process.models.power import PumpingPowerModelTypes
from process.models.tfcoil.base import TFConductorModel

Expand All @@ -36,7 +37,7 @@ def output(self):

def run(self, output: bool = False):
# Coolant type
self.data.fwbs.i_blkt_coolant_type = 1
self.data.fwbs.i_blkt_coolant_type = CoolantType.HELIUM
# Note that the first wall coolant is now input separately.

# Calculate blanket, shield, vacuum vessel and cryostat volumes
Expand Down Expand Up @@ -775,7 +776,7 @@ def powerflow_calc(self, output: bool):

# If we have chosen pressurised water as the blanket coolant, set the
# coolant outlet temperature as 20 deg C below the boiling point
if self.data.fwbs.i_blkt_coolant_type == 2:
if self.data.fwbs.i_blkt_coolant_type == CoolantType.WATER:
outlet_saturated_fluid_properties = FluidProperties.of(
"Water",
pressure=self.data.fwbs.pres_blkt_coolant * 1.0e6,
Expand Down
40 changes: 38 additions & 2 deletions process/models/engineering/pumping.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,45 @@
"""Engineering models for pumping system analysis."""

import logging
from enum import IntEnum
from types import DynamicClassAttribute

import numpy as np


class CoolantType(IntEnum):
"""Enum for coolant types."""

HELIUM = (1, "Helium")
WATER = (2, "Water")

def __new__(cls, value: int, full_name: str):
"""Create a new CoolantType enum member with value and full_name.

Parameters
----------
value : int
The numeric value of the enum member.
full_name : str
The full name description of the coolant type.
This should match the CoolProp name for the coolant type.

Returns
-------
CoolantType
A new enum member with the specified value and full_name.
"""
obj = int.__new__(cls, value)
obj._value_ = value
obj._full_name_ = full_name
return obj

@DynamicClassAttribute
def full_name(self):
"""Return the full name of the coolant type."""
return self._full_name_


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -33,7 +69,7 @@ def darcy_friction_haaland(

References
----------
- https://en.wikipedia.org/wiki/Darcy_friction_factor_formulae#Haaland_equation
[1] https://en.wikipedia.org/wiki/Darcy_friction_factor_formulae#Haaland_equation
"""
# Bracketed term in Haaland equation
bracket = (roughness_channel / radius_channel / 3.7) ** 1.11 + 6.9 / reynolds
Expand Down Expand Up @@ -82,7 +118,7 @@ def gnielinski_heat_transfer_coefficient(

References
----------
- https://en.wikipedia.org/wiki/Nusselt_number#Gnielinski_correlation
[1] https://en.wikipedia.org/wiki/Nusselt_number#Gnielinski_correlation

"""
# Calculate pipe diameter (m)
Expand Down
11 changes: 7 additions & 4 deletions process/models/fw.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
eshellarea,
)
from process.models.engineering.materials import eurofer97_thermal_conductivity
from process.models.engineering.pumping import gnielinski_heat_transfer_coefficient
from process.models.engineering.pumping import (
CoolantType,
gnielinski_heat_transfer_coefficient,
)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -393,14 +396,14 @@ def fw_temp(

# Calculate inlet coolant fluid properties (fixed pressure)
inlet_coolant_properties = FluidProperties.of(
self.data.fwbs.i_fw_coolant_type,
CoolantType(self.data.fwbs.i_fw_coolant_type).full_name,
temperature=self.data.fwbs.temp_fw_coolant_in,
pressure=self.data.fwbs.pres_fw_coolant,
)

# Calculate outlet coolant fluid properties (fixed pressure)
outlet_coolant_properties = FluidProperties.of(
self.data.fwbs.i_fw_coolant_type,
CoolantType(self.data.fwbs.i_fw_coolant_type).full_name,
temperature=self.data.fwbs.temp_fw_coolant_out,
pressure=self.data.fwbs.pres_fw_coolant,
)
Expand Down Expand Up @@ -754,7 +757,7 @@ def output_fw_pumping(self):
self.outfile,
"First wall coolant type",
"(i_fw_coolant_type)",
f"'{self.data.fwbs.i_fw_coolant_type}'",
self.data.fwbs.i_fw_coolant_type,
)
po.ovarrf(
self.outfile,
Expand Down
5 changes: 3 additions & 2 deletions process/models/stellarator/stellarator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
global_variables,
numerics,
)
from process.models.engineering.pumping import CoolantType
from process.models.physics.physics import Physics, rether
from process.models.power import PumpingPowerModelTypes
from process.models.stellarator.build import st_build
Expand Down Expand Up @@ -786,7 +787,7 @@ def st_fwbs(self, output: bool):
# If we have chosen pressurised water as the coolant, set the
# coolant outlet temperature as 20 deg C below the boiling point

if self.data.fwbs.i_blkt_coolant_type == 2:
if self.data.fwbs.i_blkt_coolant_type == CoolantType.WATER:
if self.data.fwbs.irefprop:
self.data.fwbs.temp_blkt_coolant_out = (
FluidProperties.of(
Expand Down Expand Up @@ -1248,7 +1249,7 @@ def st_fwbs(self, output: bool):
# structures is used (see comment above)

if (self.data.fwbs.blktmodel > 0) or (
self.data.fwbs.i_blkt_coolant_type == 2
self.data.fwbs.i_blkt_coolant_type == CoolantType.WATER
): # pressurised water coolant
self.data.fwbs.m_fw_blkt_div_coolant_total = coolvol * 806.719e0
else: # gaseous helium coolant
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/data/large_tokamak_MFILE.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -35469,7 +35469,7 @@ Peak_radiation_wall_load_(MW/m^2)________________________________________ (pflux
Fast_alpha_particle_power_incident_on_the_first-wall_(MW)________________ (p_fw_alpha_mw)________________ 1.63474424550099187e+01 OP
Nominal_mean_neutron_load_on_vessel_first-wall_(MW/m^2)__________________ (pflux_fw_neutron_mw)__________ 1.01712659903962166e+00 OP
# First wall pumping #
First_wall_coolant_type__________________________________________________ (i_fw_coolant_type)____________ 'helium'
First_wall_coolant_type__________________________________________________ (i_fw_coolant_type)____________ 1
Outlet_temperature_of_first_wall_coolant_[K]_____________________________ (temp_fw_coolant_out)__________ 8.23000000000000000e+02 OP
Inlet_temperature_of_first_wall_coolant_[K]______________________________ (temp_fw_coolant_in)___________ 5.73000000000000000e+02 OP
Pressure_of_first_wall_coolant_[Pa]______________________________________ (pres_fw_coolant)______________ 1.55000000000000000e+07 OP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ i_blkt_inboard = 0 * switch for inboard blanket;
inuclear = 0 * switch for nuclear heating in the coils;
i_p_coolant_pumping = 3 * Switch for pumping power for primary coolant (mechanical power only and peak first wall
i_thermal_electric_conversion = 2 * Switch for power conversion cycle;
i_fw_coolant_type = helium * switch for first wall coolant (can be different from blanket coolant);
i_fw_coolant_type = 1 * switch for first wall coolant (can be different from blanket coolant);
etaiso = 0.9 * isentropic efficiency of FW and blanket coolant pumps
eta_coolant_pump_electric = 0.87 * electrical efficiency of primary coolant pumps
i_fw_blkt_shared_coolant = 0 * Switch for whether the FW and BB are on the same pump system
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/input_files/st_regression.IN.DAT
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,7 @@ etaiso = 0.9
* DESCRIPTION: First wall coolant pressure [Pa] (`i_thermal_electric_conversion>1`) (default = 15.5D6)
* JUSTIFICATION: Not yet set.

i_fw_coolant_type = helium
i_fw_coolant_type = 1
* DESCRIPTION: switch for first wall coolant (can be different from blanket coolant) (default = helium):
* 'helium'
* 'water'
Comment on lines +2169 to 2172
Expand Down
Loading
Loading