From 02734161155f72a3601b6fef71ec2ad1f7c149b0 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 17 Dec 2025 14:06:48 +0000 Subject: [PATCH 1/8] fix: initialize m_tf_wp_steel_conduit in tfcoil_variables and update outtf call in ResistiveTFCoil --- process/data_structure/tfcoil_variables.py | 1 + process/resistive_tf_coil.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index d1d56ed36f..1549ca97b3 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -1497,6 +1497,7 @@ def init_tfcoil_variables(): whtconal = 0.0 m_tf_coil_wp_turn_insulation = 0.0 m_tf_coil_superconductor = 0.0 + m_tf_wp_steel_conduit = 0.0 m_tf_coil_wp_insulation = 0.0 m_tf_coils_total = 0.0 dx_tf_wp_primary_toroidal = 0.0 diff --git a/process/resistive_tf_coil.py b/process/resistive_tf_coil.py index cf51f19949..5b6b1866ac 100644 --- a/process/resistive_tf_coil.py +++ b/process/resistive_tf_coil.py @@ -261,7 +261,7 @@ def run(self, output: bool): tfcoil_variables.sig_tf_case = 0.0e0 tfcoil_variables.sig_tf_wp = 0.0e0 if output: - self.outtf(0) + self.outtf() def res_tf_internal_geom(self): """ From 62a70a9e44ffcbbf5fc2a19250eca86351fe9bae Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 17 Dec 2025 15:17:22 +0000 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=94=84=20-=20rename=20`tcoolin`=20to?= =?UTF-8?q?=20`temp=5Fcp=5Fcoolant=5Finlet`=20for=20consistency=20across?= =?UTF-8?q?=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_1_MFILE.DAT | 2 +- examples/data/large_tokamak_2_MFILE.DAT | 2 +- examples/data/large_tokamak_3_MFILE.DAT | 2 +- examples/data/large_tokamak_4_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- .../heat_transport_variables.py | 2 +- process/data_structure/tfcoil_variables.py | 6 ++-- process/init.py | 12 ++++---- process/input.py | 2 +- process/io/obsolete_vars.py | 1 + process/power.py | 19 +++++++----- process/tf_coil.py | 29 +++++++++++++------ .../input_files/st_regression.IN.DAT | 2 +- tests/unit/test_power.py | 10 ++++--- tests/unit/test_tfcoil.py | 10 ++++--- 16 files changed, 62 insertions(+), 43 deletions(-) diff --git a/examples/data/large_tokamak_1_MFILE.DAT b/examples/data/large_tokamak_1_MFILE.DAT index 800c14027d..a9059c29c7 100644 --- a/examples/data/large_tokamak_1_MFILE.DAT +++ b/examples/data/large_tokamak_1_MFILE.DAT @@ -7531,7 +7531,7 @@ Resistive_losses_in_current_leads_(MW)___________________________________ (qcl/1 45%_allowance_for_heat_loads_in_transfer_lines,_storage_tanks_etc_(MW)___ (qmisc/1.0d6)__________________ 2.72832586344118472e-02 OP Sum_=_Total_heat_removal_at_cryogenic_temperatures_(temp_tf_cryo_&_tcoolin)_(MW)_ (helpow_+_helpow_cryal/1.0d6)__ 8.79127222664381619e-02 OP Temperature_of_cryogenic_superconducting_components_(K)__________________ (temp_tf_cryo)_________________ 4.50000000000000000e+00 -Temperature_of_cryogenic_aluminium_components_(K)________________________ (tcoolin)______________________ 3.13149999999999977e+02 +Temperature_of_cryogenic_aluminium_components_(K)________________________ (temp_cp_coolant_inlet)______________________ 3.13149999999999977e+02 Electric_power_for_cryogenic_plant_(MW)__________________________________ (p_cryo_plant_electric_mw)_____ 4.33777902259955042e+01 OP # Plant Heat Transport Balance # Neutronic_nuclear_heat_deposited_in_FW_[MW]______________________________ (p_fw_nuclear_heat_total_mw)___ 1.64705228778508570e+02 diff --git a/examples/data/large_tokamak_2_MFILE.DAT b/examples/data/large_tokamak_2_MFILE.DAT index 070ffcd7d2..ac334c29a7 100644 --- a/examples/data/large_tokamak_2_MFILE.DAT +++ b/examples/data/large_tokamak_2_MFILE.DAT @@ -7531,7 +7531,7 @@ Resistive_losses_in_current_leads_(MW)___________________________________ (qcl/1 45%_allowance_for_heat_loads_in_transfer_lines,_storage_tanks_etc_(MW)___ (qmisc/1.0d6)__________________ 2.80915192906149337e-02 OP Sum_=_Total_heat_removal_at_cryogenic_temperatures_(temp_tf_cryo_&_tcoolin)_(MW)_ (helpow_+_helpow_cryal/1.0d6)__ 9.05171177142036903e-02 OP Temperature_of_cryogenic_superconducting_components_(K)__________________ (temp_tf_cryo)_________________ 4.50000000000000000e+00 -Temperature_of_cryogenic_aluminium_components_(K)________________________ (tcoolin)______________________ 3.13149999999999977e+02 +Temperature_of_cryogenic_aluminium_components_(K)________________________ (temp_cp_coolant_inlet)______________________ 3.13149999999999977e+02 Electric_power_for_cryogenic_plant_(MW)__________________________________ (p_cryo_plant_electric_mw)_____ 4.46628479114613484e+01 OP # Plant Heat Transport Balance # Neutronic_nuclear_heat_deposited_in_FW_[MW]______________________________ (p_fw_nuclear_heat_total_mw)___ 1.69539637888681625e+02 diff --git a/examples/data/large_tokamak_3_MFILE.DAT b/examples/data/large_tokamak_3_MFILE.DAT index 7a1893da1c..52c140f02f 100644 --- a/examples/data/large_tokamak_3_MFILE.DAT +++ b/examples/data/large_tokamak_3_MFILE.DAT @@ -7531,7 +7531,7 @@ Resistive_losses_in_current_leads_(MW)___________________________________ (qcl/1 45%_allowance_for_heat_loads_in_transfer_lines,_storage_tanks_etc_(MW)___ (qmisc/1.0d6)__________________ 2.89423603823851655e-02 OP Sum_=_Total_heat_removal_at_cryogenic_temperatures_(temp_tf_cryo_&_tcoolin)_(MW)_ (helpow_+_helpow_cryal/1.0d6)__ 9.32587167876855194e-02 OP Temperature_of_cryogenic_superconducting_components_(K)__________________ (temp_tf_cryo)_________________ 4.50000000000000000e+00 -Temperature_of_cryogenic_aluminium_components_(K)________________________ (tcoolin)______________________ 3.13149999999999977e+02 +Temperature_of_cryogenic_aluminium_components_(K)________________________ (temp_cp_coolant_inlet)______________________ 3.13149999999999977e+02 Electric_power_for_cryogenic_plant_(MW)__________________________________ (p_cryo_plant_electric_mw)_____ 4.60156044457528566e+01 OP # Plant Heat Transport Balance # Neutronic_nuclear_heat_deposited_in_FW_[MW]______________________________ (p_fw_nuclear_heat_total_mw)___ 1.76218051876661121e+02 diff --git a/examples/data/large_tokamak_4_MFILE.DAT b/examples/data/large_tokamak_4_MFILE.DAT index 893fbbc606..9ebc1f2c32 100644 --- a/examples/data/large_tokamak_4_MFILE.DAT +++ b/examples/data/large_tokamak_4_MFILE.DAT @@ -7531,7 +7531,7 @@ Resistive_losses_in_current_leads_(MW)___________________________________ (qcl/1 45%_allowance_for_heat_loads_in_transfer_lines,_storage_tanks_etc_(MW)___ (qmisc/1.0d6)__________________ 2.96747670762382149e-02 OP Sum_=_Total_heat_removal_at_cryogenic_temperatures_(temp_tf_cryo_&_tcoolin)_(MW)_ (helpow_+_helpow_cryal/1.0d6)__ 9.56186939123231522e-02 OP Temperature_of_cryogenic_superconducting_components_(K)__________________ (temp_tf_cryo)_________________ 4.50000000000000000e+00 -Temperature_of_cryogenic_aluminium_components_(K)________________________ (tcoolin)______________________ 3.13149999999999977e+02 +Temperature_of_cryogenic_aluminium_components_(K)________________________ (temp_cp_coolant_inlet)______________________ 3.13149999999999977e+02 Electric_power_for_cryogenic_plant_(MW)__________________________________ (p_cryo_plant_electric_mw)_____ 4.71800615346873045e+01 OP # Plant Heat Transport Balance # Neutronic_nuclear_heat_deposited_in_FW_[MW]______________________________ (p_fw_nuclear_heat_total_mw)___ 1.87203899318251160e+02 diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 5dda240920..da9fff8f32 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -7416,7 +7416,7 @@ Resistive_losses_in_current_leads_(MW)___________________________________ (qcl/1 45%_allowance_for_heat_loads_in_transfer_lines,_storage_tanks_etc_(MW)___ (qmisc/1.0d6)__________________ 2.76301692454299294e-02 OP Sum_=_Total_heat_removal_at_cryogenic_temperatures_(temp_tf_cryo_&_tcoolin)_(MW)_ (helpow_+_helpow_cryal/1.0d6)__ 8.90305453463853258e-02 OP Temperature_of_cryogenic_superconducting_components_(K)__________________ (temp_tf_cryo)_________________ 4.50000000000000000e+00 -Temperature_of_cryogenic_aluminium_components_(K)________________________ (tcoolin)______________________ 3.13149999999999977e+02 +Temperature_of_cryogenic_aluminium_components_(K)________________________ (temp_cp_coolant_inlet)______________________ 3.13149999999999977e+02 Electric_power_for_cryogenic_plant_(MW)__________________________________ (p_cryo_plant_electric_mw)_____ 4.39293451525369605e+01 OP # Plant Heat Transport Balance # Neutronic_nuclear_heat_deposited_in_FW_[MW]______________________________ (p_fw_nuclear_heat_total_mw)___ 1.74794853452737073e+02 diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 1521096d4a..2cb8660cbd 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -7416,7 +7416,7 @@ Resistive_losses_in_current_leads_(MW)___________________________________ (qcl/1 45%_allowance_for_heat_loads_in_transfer_lines,_storage_tanks_etc_(MW)___ (qmisc/1.0d6)__________________ 2.69532623647092545e-02 OP Sum_=_Total_heat_removal_at_cryogenic_temperatures_(temp_tf_cryo_&_tcoolin)_(MW)_ (helpow_+_helpow_cryal/1.0d6)__ 8.68494009529520300e-02 OP Temperature_of_cryogenic_superconducting_components_(K)__________________ (temp_tf_cryo)_________________ 4.50000000000000000e+00 -Temperature_of_cryogenic_aluminium_components_(K)________________________ (tcoolin)______________________ 3.13149999999999977e+02 +Temperature_of_cryogenic_aluminium_components_(K)________________________ (temp_cp_coolant_inlet)______________________ 3.13149999999999977e+02 Electric_power_for_cryogenic_plant_(MW)__________________________________ (p_cryo_plant_electric_mw)_____ 4.28531274958454702e+01 OP # Plant Heat Transport Balance # Neutronic_nuclear_heat_deposited_in_FW_[MW]______________________________ (p_fw_nuclear_heat_total_mw)___ 1.67952135824856697e+02 diff --git a/process/data_structure/heat_transport_variables.py b/process/data_structure/heat_transport_variables.py index b8820eadef..e7c6cc44c7 100644 --- a/process/data_structure/heat_transport_variables.py +++ b/process/data_structure/heat_transport_variables.py @@ -83,7 +83,7 @@ helpow_cryal: float = None -"""Heat removal at cryogenic temperature tcoolin (W)""" +"""Heat removal at cryogenic temperature temp_cp_coolant_inlet (W)""" p_coolant_pump_elec_total_mw: float = None diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index 1549ca97b3..cbf072b7af 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -1017,7 +1017,7 @@ """average radius of coolant channel (m) (`iteration variable 69`)""" -tcoolin: float = None +temp_cp_coolant_inlet: float = None """centrepost coolant inlet temperature (K)""" @@ -1287,7 +1287,7 @@ def init_tfcoil_variables(): global p_tf_leg_resistive global temp_cp_max global rcool - global tcoolin + global temp_cp_coolant_inlet global dtiocool global temp_cp_average global tcpav2 @@ -1522,7 +1522,7 @@ def init_tfcoil_variables(): p_tf_leg_resistive = 0.0 temp_cp_max = 473.15 # 200 C rcool = 0.005 - tcoolin = 313.15 # 40 C + temp_cp_coolant_inlet = 313.15 # 40 C dtiocool = 0.0 temp_cp_average = 373.15 # 100 C tcpav2 = 0.0 diff --git a/process/init.py b/process/init.py index 15b7598cc0..32968cfdf1 100644 --- a/process/init.py +++ b/process/init.py @@ -645,10 +645,10 @@ def check_process(inputs): # noqa: ARG001 # Water cooled copper magnets initalisation / checks if data_structure.tfcoil_variables.i_tf_sup == 0: # Check if the initial centrepost coolant loop adapted to the magnet technology - # Ice cannot flow so tcoolin > 273.15 K - if data_structure.tfcoil_variables.tcoolin < 273.15: + # Ice cannot flow so temp_cp_coolant_inlet > 273.15 K + if data_structure.tfcoil_variables.temp_cp_coolant_inlet < 273.15: raise ProcessValidationError( - "Coolant temperature (tcoolin) cannot be < 0 C (273.15 K) for water cooled copper magents" + "Coolant temperature (temp_cp_coolant_inlet) cannot be < 0 C (273.15 K) for water cooled copper magents" ) # Temperature of the TF legs cannot be cooled down @@ -680,9 +680,9 @@ def check_process(inputs): # noqa: ARG001 elif data_structure.tfcoil_variables.i_tf_sup == 2: # Call a lvl 3 error if the inlet coolant temperature is too large # Motivation : ill-defined aluminium resistivity fit for T > 40-50 K - if data_structure.tfcoil_variables.tcoolin > 40.0: + if data_structure.tfcoil_variables.temp_cp_coolant_inlet > 40.0: raise ProcessValidationError( - "Coolant temperature (tcoolin) should be < 40 K for the cryo-al resistivity to be defined" + "Coolant temperature (temp_cp_coolant_inlet) should be < 40 K for the cryo-al resistivity to be defined" ) # Check if the leg average temperature is low enough for the resisitivity fit @@ -701,7 +701,7 @@ def check_process(inputs): # noqa: ARG001 # Otherwise intitialise the average conductor temperature at data_structure.tfcoil_variables.temp_cp_average = ( - data_structure.tfcoil_variables.tcoolin + data_structure.tfcoil_variables.temp_cp_coolant_inlet ) # Check if the boostrap current selection is addapted to ST diff --git a/process/input.py b/process/input.py index 022b7715ef..41f81e9514 100644 --- a/process/input.py +++ b/process/input.py @@ -1678,7 +1678,7 @@ def __post_init__(self): data_structure.constraint_variables, float, range=(0.001, 2.0) ), "tcomrepl": InputVariable(data_structure.cost_variables, float, range=(0.01, 2.0)), - "tcoolin": InputVariable( + "temp_cp_coolant_inlet": InputVariable( data_structure.tfcoil_variables, float, range=(4.0, 373.15) ), "tcritsc": InputVariable( diff --git a/process/io/obsolete_vars.py b/process/io/obsolete_vars.py index 9bf809f51c..0211bb99d1 100644 --- a/process/io/obsolete_vars.py +++ b/process/io/obsolete_vars.py @@ -475,6 +475,7 @@ "tdivrepl": "t_div_replace_yrs", "tlife": "life_plant", "iavail": "i_plant_availability", + "tcoolin": "temp_cp_coolant_inlet", } OBS_VARS_HELP = { diff --git a/process/power.py b/process/power.py index 936d1de535..d701ab4158 100644 --- a/process/power.py +++ b/process/power.py @@ -780,7 +780,7 @@ def calculate_cryo_loads(self) -> None: # Rem : Nuclear heating on the outer legs assumed to be negligible # Rem : To be updated with 2 cooling loops for TART designs if tfcoil_variables.i_tf_sup == 2: - # Heat removal power at cryogenic temperature tfcoil_variables.tcoolin (W) + # Heat removal power at cryogenic temperature tfcoil_variables.temp_cp_coolant_inlet (W) heat_transport_variables.helpow_cryal = ( tfcoil_variables.p_cp_resistive + tfcoil_variables.p_tf_leg_resistive @@ -788,11 +788,14 @@ def calculate_cryo_loads(self) -> None: + fwbs_variables.pnuc_cp_tf * 1.0e6 ) - # Calculate electric power requirement for cryogenic plant at tfcoil_variables.tcoolin (MW) + # Calculate electric power requirement for cryogenic plant at tfcoil_variables.temp_cp_coolant_inlet (MW) p_tf_cryoal_cryo = ( 1.0e-6 - * (constants.TEMP_ROOM - tfcoil_variables.tcoolin) - / (tfcoil_variables.eff_tf_cryo * tfcoil_variables.tcoolin) + * (constants.TEMP_ROOM - tfcoil_variables.temp_cp_coolant_inlet) + / ( + tfcoil_variables.eff_tf_cryo + * tfcoil_variables.temp_cp_coolant_inlet + ) * heat_transport_variables.helpow_cryal ) @@ -807,7 +810,7 @@ def calculate_cryo_loads(self) -> None: * ((293 / tfcoil_variables.temp_tf_cryo) - 1) / ((293 / 4.5) - 1) + heat_transport_variables.helpow_cryal - * ((293 / tfcoil_variables.tcoolin) - 1) + * ((293 / tfcoil_variables.temp_cp_coolant_inlet) - 1) / ((293 / 4.5) - 1) ) / 1.0e3 @@ -1576,7 +1579,7 @@ def output_cryogenics(self) -> None: po.ovarre( self.outfile, - "Sum = Total heat removal at cryogenic temperatures (temp_tf_cryo & tcoolin) (MW)", + "Sum = Total heat removal at cryogenic temperatures (temp_tf_cryo & temp_cp_coolant_inlet) (MW)", "(helpow + helpow_cryal/1.0d6)", (heat_transport_variables.helpow + heat_transport_variables.helpow_cryal) * 1.0e-6, @@ -1591,8 +1594,8 @@ def output_cryogenics(self) -> None: po.ovarre( self.outfile, "Temperature of cryogenic aluminium components (K)", - "(tcoolin)", - tfcoil_variables.tcoolin, + "(temp_cp_coolant_inlet)", + tfcoil_variables.temp_cp_coolant_inlet, ) po.ovarre( self.outfile, diff --git a/process/tf_coil.py b/process/tf_coil.py index 84abe4ace7..6abebe4ec6 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -2250,7 +2250,7 @@ def cntrpst(self): # -------------- elif tfcoil_variables.i_tf_sup == 2: # Inlet coolant density [kg/m3] - coolant_density = self.he_density(tfcoil_variables.tcoolin) + coolant_density = self.he_density(tfcoil_variables.temp_cp_coolant_inlet) # Mass flow rate [kg/s] cool_mass_flow = acool * coolant_density * tfcoil_variables.vcool @@ -2258,7 +2258,7 @@ def cntrpst(self): # Infinitesimal power deposition used in the integral dptot = ptot / n_tcool_it - tcool_calc = copy.copy(tfcoil_variables.tcoolin) # K + tcool_calc = copy.copy(tfcoil_variables.temp_cp_coolant_inlet) # K for _i in range(n_tcool_it): # Thermal capacity Cp coolant_cp = self.he_cp(tcool_calc) @@ -2273,11 +2273,15 @@ def cntrpst(self): vcool_max = cool_mass_flow / (acool * coolant_density) # Getting the global in-outlet temperature increase - tfcoil_variables.dtiocool = tcool_calc - tfcoil_variables.tcoolin + tfcoil_variables.dtiocool = ( + tcool_calc - tfcoil_variables.temp_cp_coolant_inlet + ) # -------------- # Average coolant temperature - tcool_av = tfcoil_variables.tcoolin + 0.5e0 * tfcoil_variables.dtiocool + tcool_av = ( + tfcoil_variables.temp_cp_coolant_inlet + 0.5e0 * tfcoil_variables.dtiocool + ) # ********************************************** # Film temperature rise @@ -2359,7 +2363,7 @@ def cntrpst(self): # Average conductor temperature tfcoil_variables.tcpav2 = ( - tfcoil_variables.tcoolin + tfcoil_variables.temp_cp_coolant_inlet + dtcncpav + dtfilmav + 0.5e0 * tfcoil_variables.dtiocool @@ -2367,9 +2371,16 @@ def cntrpst(self): # Peak wall temperature tfcoil_variables.temp_cp_peak = ( - tfcoil_variables.tcoolin + tfcoil_variables.dtiocool + dtfilmav + dtconcpmx + tfcoil_variables.temp_cp_coolant_inlet + + tfcoil_variables.dtiocool + + dtfilmav + + dtconcpmx + ) + tcoolmx = ( + tfcoil_variables.temp_cp_coolant_inlet + + tfcoil_variables.dtiocool + + dtfilmav ) - tcoolmx = tfcoil_variables.tcoolin + tfcoil_variables.dtiocool + dtfilmav # ------------------------- # Thermal hydraulics: friction factor from Z. Olujic, Chemical @@ -2494,8 +2505,8 @@ def cntrpst(self): po.ovarre( self.outfile, "Input coolant temperature (K)", - "(tfcoil_variables.tcoolin)", - tfcoil_variables.tcoolin, + "(tfcoil_variables.temp_cp_coolant_inlet)", + tfcoil_variables.temp_cp_coolant_inlet, ) po.ovarre( self.outfile, diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index d44be1cbb6..3687e3dafc 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -1519,7 +1519,7 @@ tftmp = 20.0 * DESCRIPTION: Average Radius of Coolant Channel for CP (m) * JUSTIFICATION: Assumed -* tcoolin = 20.0 +* temp_cp_coolant_inlet = 20.0 * DESCRIPTION: Centrepost Coolant Inlet Temperature (K) * JUSTIFICATION: Choosen to be optimal after a scan ranging from 15 to 30 K (G. Voss and S. Kahn) diff --git a/tests/unit/test_power.py b/tests/unit/test_power.py index 506c6105e4..099d8f6ead 100644 --- a/tests/unit/test_power.py +++ b/tests/unit/test_power.py @@ -2230,7 +2230,7 @@ class Power2Param(NamedTuple): temp_tf_cryo: Any = None - tcoolin: Any = None + temp_cp_coolant_inlet: Any = None eff_tf_cryo: Any = None @@ -2361,7 +2361,7 @@ class Power2Param(NamedTuple): i_tf_sup=1, tfcmw=0, temp_tf_cryo=4.5, - tcoolin=313.14999999999998, + temp_cp_coolant_inlet=313.14999999999998, eff_tf_cryo=0.13, p_fw_blkt_coolant_pump_mw=202.02739897087824, p_shld_coolant_pump_elec_mw=0.0078214713655548, @@ -2463,7 +2463,7 @@ class Power2Param(NamedTuple): i_tf_sup=1, tfcmw=0, temp_tf_cryo=4.5, - tcoolin=313.14999999999998, + temp_cp_coolant_inlet=313.14999999999998, eff_tf_cryo=0.13, p_fw_blkt_coolant_pump_mw=201.96778859673452, p_shld_coolant_pump_elec_mw=0.0080667886808651647, @@ -2841,7 +2841,9 @@ def test_power2(power2param, monkeypatch, power): monkeypatch.setattr(tfcoil_variables, "temp_tf_cryo", power2param.temp_tf_cryo) - monkeypatch.setattr(tfcoil_variables, "tcoolin", power2param.tcoolin) + monkeypatch.setattr( + tfcoil_variables, "temp_cp_coolant_inlet", power2param.temp_cp_coolant_inlet + ) monkeypatch.setattr(tfcoil_variables, "eff_tf_cryo", power2param.eff_tf_cryo) diff --git a/tests/unit/test_tfcoil.py b/tests/unit/test_tfcoil.py index 007b6060df..132d461aed 100644 --- a/tests/unit/test_tfcoil.py +++ b/tests/unit/test_tfcoil.py @@ -159,8 +159,8 @@ class CntrpstTestAsset(NamedTuple): :i_tf_sup: value for tfcoil_variables.i_tf_sup to be mocked with (0=Copper, 2=Cryogenic aluminium) :type i_tf_sup: integer - :tcoolin: value for tfcoil_variables.tcoolin to be mocked with (centrepost coolant inlet temperature) - :type tcoolin: float + :temp_cp_coolant_inlet: value for tfcoil_variables.temp_cp_coolant_inlet to be mocked with (centrepost coolant inlet temperature) + :type temp_cp_coolant_inlet: float :expected_dtiocool: expected value of tfcoil_variables.dtiocool after tfcoil.cntrpst routine has run :type expected_dtiocool: float @@ -173,7 +173,7 @@ class CntrpstTestAsset(NamedTuple): """ i_tf_sup: int - tcoolin: float + temp_cp_coolant_inlet: float expected_dtiocool: float expected_tcpav2: float expected_temp_cp_peak: float @@ -220,7 +220,9 @@ def test_cntrpst(cntrpst_asset, monkeypatch, reinitialise_error_module, tfcoil): monkeypatch.setattr(tfcoil_variables, "vol_cond_cp", 2) monkeypatch.setattr(tfcoil_variables, "p_cp_resistive", 1) monkeypatch.setattr(tfcoil_variables, "i_tf_sup", cntrpst_asset.i_tf_sup) - monkeypatch.setattr(tfcoil_variables, "tcoolin", cntrpst_asset.tcoolin) + monkeypatch.setattr( + tfcoil_variables, "temp_cp_coolant_inlet", cntrpst_asset.temp_cp_coolant_inlet + ) monkeypatch.setattr(fwbs_variables, "pnuc_cp_tf", 1) monkeypatch.setattr(build_variables, "z_tf_inside_half", 1) monkeypatch.setattr(build_variables, "dr_tf_outboard", 0.5) From 98e1ade9183e5372183d5ad61d02b77cffaf2e39 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 17 Dec 2025 15:31:17 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=94=84=20-=20rename=20`vcool`=20to=20?= =?UTF-8?q?`vel=5Fcp=5Fcoolant=5Fmidplane`=20for=20clarity=20and=20consist?= =?UTF-8?q?ency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/numerics.py | 2 +- process/data_structure/tfcoil_variables.py | 6 ++-- process/input.py | 2 +- process/io/obsolete_vars.py | 1 + process/io/plot_proc.py | 2 +- process/iteration_variables.py | 4 ++- process/tf_coil.py | 28 +++++++++++++------ .../input_files/st_regression.IN.DAT | 2 +- tests/unit/test_tfcoil.py | 2 +- 9 files changed, 32 insertions(+), 17 deletions(-) diff --git a/process/data_structure/numerics.py b/process/data_structure/numerics.py index 4bf548f81c..8eff9d8889 100644 --- a/process/data_structure/numerics.py +++ b/process/data_structure/numerics.py @@ -266,7 +266,7 @@ * (67) ft_cycle_min (f-value for equation 42) * (68) fptemp (f-value for equation 44) * (69) rcool -* (70) vcool +* (70) vel_cp_coolant_midplane * (71) fq95_min (f-value for equation 45) * (72) fipir (f-value for equation 46) * (73) dr_fw_plasma_gap_inboard diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index cbf072b7af..8028f54a75 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -1046,7 +1046,7 @@ """peak centrepost temperature (K)""" -vcool: float = None +vel_cp_coolant_midplane: float = None """inlet centrepost coolant flow speed at midplane (m/s) (`iteration variable 70`)""" @@ -1293,7 +1293,7 @@ def init_tfcoil_variables(): global tcpav2 global temp_tf_legs_outboard global temp_cp_peak - global vcool + global vel_cp_coolant_midplane global vol_cond_cp global whtcp global whttflgs @@ -1528,7 +1528,7 @@ def init_tfcoil_variables(): tcpav2 = 0.0 temp_tf_legs_outboard = -1.0 temp_cp_peak = 0.0 - vcool = 20.0 + vel_cp_coolant_midplane = 20.0 vol_cond_cp = 0.0 whtcp = 0.0 whttflgs = 0.0 diff --git a/process/input.py b/process/input.py index 41f81e9514..32e064a4fb 100644 --- a/process/input.py +++ b/process/input.py @@ -1928,7 +1928,7 @@ def __post_init__(self): "vachtmw": InputVariable( data_structure.heat_transport_variables, float, range=(0.0, 100.0) ), - "vcool": InputVariable( + "vel_cp_coolant_midplane": InputVariable( data_structure.tfcoil_variables, float, range=(0.001, 100.0) ), "v_tf_coil_dump_quench_max_kv": InputVariable( diff --git a/process/io/obsolete_vars.py b/process/io/obsolete_vars.py index 0211bb99d1..4555deac05 100644 --- a/process/io/obsolete_vars.py +++ b/process/io/obsolete_vars.py @@ -476,6 +476,7 @@ "tlife": "life_plant", "iavail": "i_plant_availability", "tcoolin": "temp_cp_coolant_inlet", + "vcool": "vel_cp_coolant_midplane", } OBS_VARS_HELP = { diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 9b951603a2..95361cc451 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -7851,7 +7851,7 @@ def plot_magnetics_info(axis, mfile_data, scan): (sig_cond, "TF conductor max TRESCA stress", "MPa"), (sig_case, "TF bucking max TRESCA stress", "MPa"), (fcoolcp, "CP cooling fraction", "%"), - ("vcool", "Maximum coolant flow speed", "ms$^{-1}$"), + ("vel_cp_coolant_midplane", "Maximum coolant flow speed", "ms$^{-1}$"), (p_cp_resistive, "CP Resisitive heating", "MW"), ( p_tf_leg_resistive, diff --git a/process/iteration_variables.py b/process/iteration_variables.py index 3214f3ffec..1396993883 100644 --- a/process/iteration_variables.py +++ b/process/iteration_variables.py @@ -172,7 +172,9 @@ class IterationVariable: ), 68: IterationVariable("fptemp", data_structure.constraint_variables, 0.001, 1.0), 69: IterationVariable("rcool", data_structure.tfcoil_variables, 0.001, 0.010), - 70: IterationVariable("vcool", data_structure.tfcoil_variables, 1.0, 1.0e2), + 70: IterationVariable( + "vel_cp_coolant_midplane", data_structure.tfcoil_variables, 1.0, 1.0e2 + ), 71: IterationVariable("fq95_min", data_structure.constraint_variables, 0.001, 1.0), 72: IterationVariable("fipir", data_structure.constraint_variables, 0.001, 1.0), 73: IterationVariable( diff --git a/process/tf_coil.py b/process/tf_coil.py index 6abebe4ec6..9084cc0cbc 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -2237,13 +2237,15 @@ def cntrpst(self): coolant_th_cond = constants.KH2O # Mass flow rate [kg/s] - cool_mass_flow = acool * coolant_density * tfcoil_variables.vcool + cool_mass_flow = ( + acool * coolant_density * tfcoil_variables.vel_cp_coolant_midplane + ) # Water temperature rise tfcoil_variables.dtiocool = ptot / (cool_mass_flow * coolant_cp) # Constant coolant velocity - vcool_max = tfcoil_variables.vcool + vcool_max = tfcoil_variables.vel_cp_coolant_midplane # -------------- # Helium coolant @@ -2253,7 +2255,9 @@ def cntrpst(self): coolant_density = self.he_density(tfcoil_variables.temp_cp_coolant_inlet) # Mass flow rate [kg/s] - cool_mass_flow = acool * coolant_density * tfcoil_variables.vcool + cool_mass_flow = ( + acool * coolant_density * tfcoil_variables.vel_cp_coolant_midplane + ) # Infinitesimal power deposition used in the integral dptot = ptot / n_tcool_it @@ -2294,7 +2298,12 @@ def cntrpst(self): coolant_visco = self.he_visco(tcool_av) # Reynolds number - reyn = coolant_density * tfcoil_variables.vcool * dcool / coolant_visco + reyn = ( + coolant_density + * tfcoil_variables.vel_cp_coolant_midplane + * dcool + / coolant_visco + ) # Helium thermal conductivity [W/(m.K)] if tfcoil_variables.i_tf_sup == 2: @@ -2410,10 +2419,13 @@ def cntrpst(self): * (lcool / dcool) * coolant_density * 0.5e0 - * tfcoil_variables.vcool**2 + * tfcoil_variables.vel_cp_coolant_midplane**2 ) tfcoil_variables.p_cp_coolant_pump_elec = ( - dpres * acool * tfcoil_variables.vcool / tfcoil_variables.etapump + dpres + * acool + * tfcoil_variables.vel_cp_coolant_midplane + / tfcoil_variables.etapump ) # Critical pressure in saturation pressure calculations (Pa) @@ -2455,8 +2467,8 @@ def cntrpst(self): po.ovarre( self.outfile, "Inlet coolant flow speed (m/s)", - "(vcool)", - tfcoil_variables.vcool, + "(vel_cp_coolant_midplane)", + tfcoil_variables.vel_cp_coolant_midplane, ) po.ovarre( self.outfile, diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index 3687e3dafc..b35f362748 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -1425,7 +1425,7 @@ tftmp = 20.0 * JUSTIFICATION: Not set, using default *ixc = 70 -*vcool = 10.0 +*vel_cp_coolant_midplane = 10.0 *boundl(70) = 9.0 *boundu(70) = 10.0 * DESCRIPTION: Max Centrepost Coolant Flow Speed (m/s) diff --git a/tests/unit/test_tfcoil.py b/tests/unit/test_tfcoil.py index 132d461aed..b6c81991e6 100644 --- a/tests/unit/test_tfcoil.py +++ b/tests/unit/test_tfcoil.py @@ -216,7 +216,7 @@ def test_cntrpst(cntrpst_asset, monkeypatch, reinitialise_error_module, tfcoil): monkeypatch.setattr(tfcoil_variables, "a_cp_cool", 1) monkeypatch.setattr(tfcoil_variables, "n_tf_coils", 16) monkeypatch.setattr(tfcoil_variables, "rcool", 0.005) - monkeypatch.setattr(tfcoil_variables, "vcool", 20.0) + monkeypatch.setattr(tfcoil_variables, "vel_cp_coolant_midplane", 20.0) monkeypatch.setattr(tfcoil_variables, "vol_cond_cp", 2) monkeypatch.setattr(tfcoil_variables, "p_cp_resistive", 1) monkeypatch.setattr(tfcoil_variables, "i_tf_sup", cntrpst_asset.i_tf_sup) From d6dbb783c38e97c4acfaf54bfce8ff8ea1bc720d Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 17 Dec 2025 15:53:24 +0000 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=94=84=20-=20rename=20`rcool`=20to=20?= =?UTF-8?q?`radius=5Fcp=5Fcoolant=5Fchannel`=20for=20clarity=20and=20consi?= =?UTF-8?q?stency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/numerics.py | 2 +- process/data_structure/tfcoil_variables.py | 6 ++-- process/init.py | 2 +- process/input.py | 4 ++- process/io/obsolete_vars.py | 1 + process/io/plot_proc.py | 22 ++++++++++++++ process/iteration_variables.py | 4 ++- process/tf_coil.py | 29 +++++++++++++------ .../input_files/st_regression.IN.DAT | 2 +- tests/unit/test_tfcoil.py | 2 +- 10 files changed, 56 insertions(+), 18 deletions(-) diff --git a/process/data_structure/numerics.py b/process/data_structure/numerics.py index 8eff9d8889..8d8d040b73 100644 --- a/process/data_structure/numerics.py +++ b/process/data_structure/numerics.py @@ -265,7 +265,7 @@ * (66) ft_current_ramp_up (f-value for equation 41) * (67) ft_cycle_min (f-value for equation 42) * (68) fptemp (f-value for equation 44) -* (69) rcool +* (69) radius_cp_coolant_channel * (70) vel_cp_coolant_midplane * (71) fq95_min (f-value for equation 45) * (72) fipir (f-value for equation 46) diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index 8028f54a75..1d302c6d07 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -1013,7 +1013,7 @@ """maximum peak centrepost temperature (K) (`constraint equation 44`)""" -rcool: float = None +radius_cp_coolant_channel: float = None """average radius of coolant channel (m) (`iteration variable 69`)""" @@ -1286,7 +1286,7 @@ def init_tfcoil_variables(): global p_cp_resistive global p_tf_leg_resistive global temp_cp_max - global rcool + global radius_cp_coolant_channel global temp_cp_coolant_inlet global dtiocool global temp_cp_average @@ -1521,7 +1521,7 @@ def init_tfcoil_variables(): p_cp_resistive = 0.0 p_tf_leg_resistive = 0.0 temp_cp_max = 473.15 # 200 C - rcool = 0.005 + radius_cp_coolant_channel = 0.005 temp_cp_coolant_inlet = 313.15 # 40 C dtiocool = 0.0 temp_cp_average = 373.15 # 100 C diff --git a/process/init.py b/process/init.py index 32968cfdf1..e5b69dc6d5 100644 --- a/process/init.py +++ b/process/init.py @@ -1042,7 +1042,7 @@ def check_process(inputs): # noqa: ARG001 data_structure.tfcoil_variables.dx_tf_turn_insulation + data_structure.tfcoil_variables.dx_tf_wp_insulation ) - + 4.0 * data_structure.tfcoil_variables.rcool + + 4.0 * data_structure.tfcoil_variables.radius_cp_coolant_channel ) if data_structure.numerics.boundl[139] < dr_tf_wp_min: diff --git a/process/input.py b/process/input.py index 32e064a4fb..5ff0c9c7e3 100644 --- a/process/input.py +++ b/process/input.py @@ -1439,7 +1439,9 @@ def __post_init__(self): data_structure.buildings_variables, float, range=(0.9, 3.0) ), "rbwt": InputVariable(data_structure.buildings_variables, float, range=(0.0, 10.0)), - "rcool": InputVariable(data_structure.tfcoil_variables, float, range=(1e-06, 1.0)), + "radius_cp_coolant_channel": InputVariable( + data_structure.tfcoil_variables, float, range=(1e-06, 1.0) + ), "reactor_clrnc": InputVariable( data_structure.buildings_variables, float, range=(0.0, 10.0) ), diff --git a/process/io/obsolete_vars.py b/process/io/obsolete_vars.py index 4555deac05..32b9e2c010 100644 --- a/process/io/obsolete_vars.py +++ b/process/io/obsolete_vars.py @@ -477,6 +477,7 @@ "iavail": "i_plant_availability", "tcoolin": "temp_cp_coolant_inlet", "vcool": "vel_cp_coolant_midplane", + "rcool": "radius_cp_coolant_channel", } OBS_VARS_HELP = { diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 95361cc451..6972553813 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -6621,6 +6621,28 @@ def plot_resistive_tf_wp(axis, mfile_data, scan: int, fig) -> None: }, ) + # Add info about the Winding Pack + textstr_cooling = ( + f"$\\mathbf{{Cooling \\ info:}}$\n \n" + f"Coolant inlet temperature: {mfile_data.data['temp_cp_coolant_inlet'].get_scan(scan):.2f} K\n" + f"Coolant velocity: {mfile_data.data['vel_cp_coolant_midplane'].get_scan(scan):.2f}K\n" + ) + axis.text( + 0.55, + 0.35, + textstr_cooling, + fontsize=9, + verticalalignment="top", + horizontalalignment="left", + transform=fig.transFigure, + bbox={ + "boxstyle": "round", + "facecolor": "wheat", + "alpha": 1.0, + "linewidth": 2, + }, + ) + axis.minorticks_on() axis.set_xlim(0.0, r_tf_inboard_out * 1.1) axis.set_ylim((y14[-1] * 1.65), (-y14[-1] * 1.65)) diff --git a/process/iteration_variables.py b/process/iteration_variables.py index 1396993883..fb5c15ecc7 100644 --- a/process/iteration_variables.py +++ b/process/iteration_variables.py @@ -171,7 +171,9 @@ class IterationVariable: "ft_cycle_min", data_structure.constraint_variables, 0.001, 1.0 ), 68: IterationVariable("fptemp", data_structure.constraint_variables, 0.001, 1.0), - 69: IterationVariable("rcool", data_structure.tfcoil_variables, 0.001, 0.010), + 69: IterationVariable( + "radius_cp_coolant_channel", data_structure.tfcoil_variables, 0.001, 0.010 + ), 70: IterationVariable( "vel_cp_coolant_midplane", data_structure.tfcoil_variables, 1.0, 1.0e2 ), diff --git a/process/tf_coil.py b/process/tf_coil.py index 9084cc0cbc..1cc9d201b1 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -2207,9 +2207,11 @@ def cntrpst(self): acool = ( tfcoil_variables.a_cp_cool * tfcoil_variables.n_tf_coils ) # Cooling cross-sectional area - dcool = 2.0e0 * tfcoil_variables.rcool # Diameter + dcool = 2.0e0 * tfcoil_variables.radius_cp_coolant_channel # Diameter lcool = 2.0e0 * (bv.z_tf_inside_half + bv.dr_tf_outboard) # Length - tfcoil_variables.ncool = acool / (np.pi * tfcoil_variables.rcool**2) # Number + tfcoil_variables.ncool = acool / ( + np.pi * tfcoil_variables.radius_cp_coolant_channel**2 + ) # Number # Average conductor cross-sectional area to cool (with cooling area) acpav = ( @@ -2318,7 +2320,12 @@ def cntrpst(self): nuselt = 0.023e0 * reyn**0.8e0 * prndtl**0.4e0 h = nuselt * coolant_th_cond / dcool dtfilmav = ptot / ( - h * 2.0e0 * np.pi * tfcoil_variables.rcool * tfcoil_variables.ncool * lcool + h + * 2.0e0 + * np.pi + * tfcoil_variables.radius_cp_coolant_channel + * tfcoil_variables.ncool + * lcool ) # Average film temperature (in contact with te conductor) @@ -2341,12 +2348,16 @@ def cntrpst(self): # Average temperature rise : To be changed with Garry Voss' better documented formula ? dtcncpav = ( (ptot / tfcoil_variables.vol_cond_cp) - / (2.0e0 * conductor_th_cond * (ro**2 - tfcoil_variables.rcool**2)) + / ( + 2.0e0 + * conductor_th_cond + * (ro**2 - tfcoil_variables.radius_cp_coolant_channel**2) + ) * ( - ro**2 * tfcoil_variables.rcool**2 - - 0.25e0 * tfcoil_variables.rcool**4 + ro**2 * tfcoil_variables.radius_cp_coolant_channel**2 + - 0.25e0 * tfcoil_variables.radius_cp_coolant_channel**4 - 0.75e0 * ro**4 - + ro**4 * np.log(ro / tfcoil_variables.rcool) + + ro**4 * np.log(ro / tfcoil_variables.radius_cp_coolant_channel) ) ) @@ -2355,8 +2366,8 @@ def cntrpst(self): (ptot / tfcoil_variables.vol_cond_cp) / (2.0e0 * conductor_th_cond) * ( - (tfcoil_variables.rcool**2 - ro**2) / 2.0e0 - + ro**2 * np.log(ro / tfcoil_variables.rcool) + (tfcoil_variables.radius_cp_coolant_channel**2 - ro**2) / 2.0e0 + + ro**2 * np.log(ro / tfcoil_variables.radius_cp_coolant_channel) ) ) diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index b35f362748..b50abeeaa4 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -1515,7 +1515,7 @@ tftmp = 20.0 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -* rcool = 3.0E-3 +* radius_cp_coolant_channel = 3.0E-3 * DESCRIPTION: Average Radius of Coolant Channel for CP (m) * JUSTIFICATION: Assumed diff --git a/tests/unit/test_tfcoil.py b/tests/unit/test_tfcoil.py index b6c81991e6..13fad4f49f 100644 --- a/tests/unit/test_tfcoil.py +++ b/tests/unit/test_tfcoil.py @@ -215,7 +215,7 @@ def test_cntrpst(cntrpst_asset, monkeypatch, reinitialise_error_module, tfcoil): """ monkeypatch.setattr(tfcoil_variables, "a_cp_cool", 1) monkeypatch.setattr(tfcoil_variables, "n_tf_coils", 16) - monkeypatch.setattr(tfcoil_variables, "rcool", 0.005) + monkeypatch.setattr(tfcoil_variables, "radius_cp_coolant_channel", 0.005) monkeypatch.setattr(tfcoil_variables, "vel_cp_coolant_midplane", 20.0) monkeypatch.setattr(tfcoil_variables, "vol_cond_cp", 2) monkeypatch.setattr(tfcoil_variables, "p_cp_resistive", 1) From 8428b215527eec59ce50a5eef9fa2f58e06f8d05 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Wed, 17 Dec 2025 15:55:05 +0000 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=94=84=20-=20rename=20`ncool`=20to=20?= =?UTF-8?q?`n=5Fcp=5Fcoolant=5Fchannels=5Ftotal`=20for=20clarity=20and=20c?= =?UTF-8?q?onsistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/tfcoil_variables.py | 6 +++--- process/tf_coil.py | 10 +++++----- tests/unit/test_tfcoil.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index 1d302c6d07..a39b08b22c 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -991,7 +991,7 @@ """Centrepost cooling area toroidal cross-section (constant over the whole CP)""" -ncool: float = None +n_cp_coolant_channels_total: float = None """number of centrepost coolant tubes""" @@ -1281,7 +1281,7 @@ def init_tfcoil_variables(): global fcoolcp global f_a_tf_cool_outboard global a_cp_cool - global ncool + global n_cp_coolant_channels_total global p_cp_coolant_pump_elec global p_cp_resistive global p_tf_leg_resistive @@ -1516,7 +1516,7 @@ def init_tfcoil_variables(): fcoolcp = 0.3 f_a_tf_cool_outboard = 0.2 a_cp_cool = 0.0 - ncool = 0.0 + n_cp_coolant_channels_total = 0.0 p_cp_coolant_pump_elec = 0.0 p_cp_resistive = 0.0 p_tf_leg_resistive = 0.0 diff --git a/process/tf_coil.py b/process/tf_coil.py index 1cc9d201b1..399ad29817 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -2209,7 +2209,7 @@ def cntrpst(self): ) # Cooling cross-sectional area dcool = 2.0e0 * tfcoil_variables.radius_cp_coolant_channel # Diameter lcool = 2.0e0 * (bv.z_tf_inside_half + bv.dr_tf_outboard) # Length - tfcoil_variables.ncool = acool / ( + tfcoil_variables.n_cp_coolant_channels_total = acool / ( np.pi * tfcoil_variables.radius_cp_coolant_channel**2 ) # Number @@ -2220,7 +2220,7 @@ def cntrpst(self): / (bv.z_tf_inside_half + bv.dr_tf_outboard) + acool ) - ro = (acpav / (np.pi * tfcoil_variables.ncool)) ** 0.5 + ro = (acpav / (np.pi * tfcoil_variables.n_cp_coolant_channels_total)) ** 0.5 # Inner legs total heating power (to be removed by coolant) ptot = tfcoil_variables.p_cp_resistive + fwbs_variables.pnuc_cp_tf * 1.0e6 @@ -2324,7 +2324,7 @@ def cntrpst(self): * 2.0e0 * np.pi * tfcoil_variables.radius_cp_coolant_channel - * tfcoil_variables.ncool + * tfcoil_variables.n_cp_coolant_channels_total * lcool ) @@ -2496,8 +2496,8 @@ def cntrpst(self): po.ovarre( self.outfile, "Number of coolant tubes", - "(ncool)", - tfcoil_variables.ncool, + "(n_cp_coolant_channels_total)", + tfcoil_variables.n_cp_coolant_channels_total, ) po.ovarre(self.outfile, "Reynolds number", "(reyn)", reyn) po.ovarre(self.outfile, "Prandtl number", "(prndtl)", prndtl) diff --git a/tests/unit/test_tfcoil.py b/tests/unit/test_tfcoil.py index 13fad4f49f..6ceee1c6a8 100644 --- a/tests/unit/test_tfcoil.py +++ b/tests/unit/test_tfcoil.py @@ -230,7 +230,7 @@ def test_cntrpst(cntrpst_asset, monkeypatch, reinitialise_error_module, tfcoil): tfcoil.cntrpst() # appears to be the same for all cases? - assert pytest.approx(tfcoil_variables.ncool) == 203718.3271576 + assert pytest.approx(tfcoil_variables.n_cp_coolant_channels_total) == 203718.3271576 assert ( pytest.approx(tfcoil_variables.dtiocool, abs=1e-8) From cc1315e8f6664da1f5b88a3802664db470f6d761 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 18 Dec 2025 10:14:41 +0000 Subject: [PATCH 6/8] fix: adjust TF coil power box text position and update average coolant temperature in iteration variables --- process/io/plot_proc.py | 14 +++++++++++--- process/iteration_variables.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 6972553813..119445228b 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -2171,7 +2171,7 @@ def plot_main_power_flow( # TF coil power box axis.text( 0.325, - 0.05, + 0.075, f"TF coils:\n{mfile_data.data['p_tf_electric_supplies_mw'].get_scan(scan):.3f} MWe", fontsize=9, verticalalignment="bottom", @@ -2235,7 +2235,7 @@ def plot_main_power_flow( # Recirculated power to TF axis.annotate( "", - xy=(0.35, 0.075), + xy=(0.35, 0.1), xytext=(0.35, 0.1625), xycoords=fig.transFigure, arrowprops={ @@ -6625,7 +6625,15 @@ def plot_resistive_tf_wp(axis, mfile_data, scan: int, fig) -> None: textstr_cooling = ( f"$\\mathbf{{Cooling \\ info:}}$\n \n" f"Coolant inlet temperature: {mfile_data.data['temp_cp_coolant_inlet'].get_scan(scan):.2f} K\n" - f"Coolant velocity: {mfile_data.data['vel_cp_coolant_midplane'].get_scan(scan):.2f}K\n" + f"Coolant temperature rise: {mfile_data.data['dtiocool'].get_scan(scan):.2f} K\n" + f"Coolant velocity: {mfile_data.data['vel_cp_coolant_midplane'].get_scan(scan):.2f} $\\mathrm{{ms^{{-1}}}}$\n\n" + f"Average CP temperature: {mfile_data.data['temp_cp_average'].get_scan(scan):.2f} K\n" + f"CP resistivity: {mfile_data.data['rho_cp'].get_scan(scan):.2e} $\\Omega \\mathrm{{m}}$\n" + f"Leg resistivity: {mfile_data.data['rho_tf_leg'].get_scan(scan):.2e} $\\Omega \\mathrm{{m}}$\n" + f"Leg resistance: {mfile_data.data['res_tf_leg'].get_scan(scan):.2e} $\\Omega$\n" + f"CP resistive losses: {mfile_data.data['p_cp_resistive'].get_scan(scan):,.2f} $\\mathrm{{W}}$\n" + f"Leg resistive losses: {mfile_data.data['p_tf_leg_resistive'].get_scan(scan):,.2f} $\\mathrm{{W}}$\n" + f"Joints resistive losses: {mfile_data.data['p_tf_joints_resistive'].get_scan(scan):,.2f} $\\mathrm{{W}}$\n" ) axis.text( 0.55, diff --git a/process/iteration_variables.py b/process/iteration_variables.py index fb5c15ecc7..0733f31b1c 100644 --- a/process/iteration_variables.py +++ b/process/iteration_variables.py @@ -77,7 +77,7 @@ class IterationVariable: "e_beam_kev", data_structure.current_drive_variables, 1.0, 1.0e6 ), 20: IterationVariable( - "temp_cp_average", data_structure.tfcoil_variables, 40.00, 3.0e2 + "temp_cp_average", data_structure.tfcoil_variables, 40.00, 573.0 ), 21: IterationVariable( "ft_burn_min", data_structure.constraint_variables, 0.001, 1.0 From e11ef092a118df0efe5fadb56c88a8a43f593d05 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 18 Dec 2025 10:31:12 +0000 Subject: [PATCH 7/8] docs: add naming convention for temperature changes with `dtemp_` prefix --- documentation/development/standards.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/documentation/development/standards.md b/documentation/development/standards.md index 3767925f44..203046e27a 100644 --- a/documentation/development/standards.md +++ b/documentation/development/standards.md @@ -362,6 +362,12 @@ This should be used for units of $\text{kg} \cdot \text{m}^{-2}\text{s}^{-1}$ --------------------- +##### Temperature Changes + +- Relative rises or falls in temperatures should start with the `dtemp_` prefix + +--------------------- + ##### Times - Times should start with the `t_` prefix From db279347853f56b71739ef35e58ac7d4fe2a6939 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 18 Dec 2025 10:32:50 +0000 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=94=84=20-=20rename=20`dtiocool`=20to?= =?UTF-8?q?=20`dtemp=5Fcp=5Fcoolant`=20for=20clarity=20and=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/tfcoil_variables.py | 6 +++--- process/io/plot_proc.py | 2 +- process/tf_coil.py | 17 +++++++++-------- tests/unit/test_tfcoil.py | 6 +++--- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index a39b08b22c..b78ba4c29d 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -1021,7 +1021,7 @@ """centrepost coolant inlet temperature (K)""" -dtiocool: float = None +dtemp_cp_coolant: float = None """inlet / outlet TF coil coolant temperature rise (K)""" @@ -1288,7 +1288,7 @@ def init_tfcoil_variables(): global temp_cp_max global radius_cp_coolant_channel global temp_cp_coolant_inlet - global dtiocool + global dtemp_cp_coolant global temp_cp_average global tcpav2 global temp_tf_legs_outboard @@ -1523,7 +1523,7 @@ def init_tfcoil_variables(): temp_cp_max = 473.15 # 200 C radius_cp_coolant_channel = 0.005 temp_cp_coolant_inlet = 313.15 # 40 C - dtiocool = 0.0 + dtemp_cp_coolant = 0.0 temp_cp_average = 373.15 # 100 C tcpav2 = 0.0 temp_tf_legs_outboard = -1.0 diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 119445228b..b7fe8f5cf1 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -6625,7 +6625,7 @@ def plot_resistive_tf_wp(axis, mfile_data, scan: int, fig) -> None: textstr_cooling = ( f"$\\mathbf{{Cooling \\ info:}}$\n \n" f"Coolant inlet temperature: {mfile_data.data['temp_cp_coolant_inlet'].get_scan(scan):.2f} K\n" - f"Coolant temperature rise: {mfile_data.data['dtiocool'].get_scan(scan):.2f} K\n" + f"Coolant temperature rise: {mfile_data.data['dtemp_cp_coolant'].get_scan(scan):.2f} K\n" f"Coolant velocity: {mfile_data.data['vel_cp_coolant_midplane'].get_scan(scan):.2f} $\\mathrm{{ms^{{-1}}}}$\n\n" f"Average CP temperature: {mfile_data.data['temp_cp_average'].get_scan(scan):.2f} K\n" f"CP resistivity: {mfile_data.data['rho_cp'].get_scan(scan):.2e} $\\Omega \\mathrm{{m}}$\n" diff --git a/process/tf_coil.py b/process/tf_coil.py index 399ad29817..755bff67e2 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -2244,7 +2244,7 @@ def cntrpst(self): ) # Water temperature rise - tfcoil_variables.dtiocool = ptot / (cool_mass_flow * coolant_cp) + tfcoil_variables.dtemp_cp_coolant = ptot / (cool_mass_flow * coolant_cp) # Constant coolant velocity vcool_max = tfcoil_variables.vel_cp_coolant_midplane @@ -2279,14 +2279,15 @@ def cntrpst(self): vcool_max = cool_mass_flow / (acool * coolant_density) # Getting the global in-outlet temperature increase - tfcoil_variables.dtiocool = ( + tfcoil_variables.dtemp_cp_coolant = ( tcool_calc - tfcoil_variables.temp_cp_coolant_inlet ) # -------------- # Average coolant temperature tcool_av = ( - tfcoil_variables.temp_cp_coolant_inlet + 0.5e0 * tfcoil_variables.dtiocool + tfcoil_variables.temp_cp_coolant_inlet + + 0.5e0 * tfcoil_variables.dtemp_cp_coolant ) # ********************************************** @@ -2386,19 +2387,19 @@ def cntrpst(self): tfcoil_variables.temp_cp_coolant_inlet + dtcncpav + dtfilmav - + 0.5e0 * tfcoil_variables.dtiocool + + 0.5e0 * tfcoil_variables.dtemp_cp_coolant ) # Peak wall temperature tfcoil_variables.temp_cp_peak = ( tfcoil_variables.temp_cp_coolant_inlet - + tfcoil_variables.dtiocool + + tfcoil_variables.dtemp_cp_coolant + dtfilmav + dtconcpmx ) tcoolmx = ( tfcoil_variables.temp_cp_coolant_inlet - + tfcoil_variables.dtiocool + + tfcoil_variables.dtemp_cp_coolant + dtfilmav ) # ------------------------- @@ -2534,8 +2535,8 @@ def cntrpst(self): po.ovarre( self.outfile, "Input-output coolant temperature rise (K)", - "(dtiocool)", - tfcoil_variables.dtiocool, + "(dtemp_cp_coolant)", + tfcoil_variables.dtemp_cp_coolant, ) po.ovarre(self.outfile, "Film temperature rise (K)", "(dtfilmav)", dtfilmav) po.ovarre( diff --git a/tests/unit/test_tfcoil.py b/tests/unit/test_tfcoil.py index 6ceee1c6a8..ea3eaae526 100644 --- a/tests/unit/test_tfcoil.py +++ b/tests/unit/test_tfcoil.py @@ -162,7 +162,7 @@ class CntrpstTestAsset(NamedTuple): :temp_cp_coolant_inlet: value for tfcoil_variables.temp_cp_coolant_inlet to be mocked with (centrepost coolant inlet temperature) :type temp_cp_coolant_inlet: float - :expected_dtiocool: expected value of tfcoil_variables.dtiocool after tfcoil.cntrpst routine has run + :expected_dtiocool: expected value of tfcoil_variables.dtemp_cp_coolant after tfcoil.cntrpst routine has run :type expected_dtiocool: float :expected_tcpav2: expected value of tfcoil_variables.tcpav2 after tfcoil.cntrpst routine has run :type expected_tcpav2: float @@ -196,7 +196,7 @@ def test_cntrpst(cntrpst_asset, monkeypatch, reinitialise_error_module, tfcoil): """Integration test for cntrpst Testing tfcoil module variables being set: - - dtiocool + - dtemp_cp_coolant - tcpav2 - temp_cp_peak - p_cp_coolant_pump_elec @@ -233,7 +233,7 @@ def test_cntrpst(cntrpst_asset, monkeypatch, reinitialise_error_module, tfcoil): assert pytest.approx(tfcoil_variables.n_cp_coolant_channels_total) == 203718.3271576 assert ( - pytest.approx(tfcoil_variables.dtiocool, abs=1e-8) + pytest.approx(tfcoil_variables.dtemp_cp_coolant, abs=1e-8) == cntrpst_asset.expected_dtiocool ) assert pytest.approx(tfcoil_variables.tcpav2) == cntrpst_asset.expected_tcpav2