From e8a2adc55da3a88c9da3f9f4290660620bb57d22 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 12 Mar 2025 14:52:51 +0000 Subject: [PATCH 01/34] Convert init_blanket_library to Python --- process/blanket_library.py | 53 ++++++++++++++++++++++++++ process/init.py | 3 +- source/fortran/blanket_library.f90 | 60 ------------------------------ 3 files changed, 55 insertions(+), 61 deletions(-) diff --git a/process/blanket_library.py b/process/blanket_library.py index 8349c81633..9846c1c5f6 100644 --- a/process/blanket_library.py +++ b/process/blanket_library.py @@ -2917,3 +2917,56 @@ def dshellvol(rmajor, rminor, zminor, drin, drout, dz): vout = v2 - v1 return vin, vout, vin + vout + + +def init_blanket_library(): + blanket_library.hblnkt = 0.0 + blanket_library.hshld = 0.0 + blanket_library.dz_pf_cryostat = 0.0 + blanket_library.hvv = 0.0 + blanket_library.volshldi = 0.0 + blanket_library.volshldo = 0.0 + blanket_library.vol_vv_inboard = 0.0 + blanket_library.vol_vv_outboard = 0.0 + blanket_library.bldepti = 0.0 + blanket_library.bldepto = 0.0 + blanket_library.blwidti = 0.0 + blanket_library.blwidto = 0.0 + blanket_library.bllengi = 0.0 + blanket_library.bllengo = 0.0 + blanket_library.len_blkt_inboard_channel_total = 0.0 + blanket_library.bzfllengi_liq = 0.0 + blanket_library.bzfllengo_liq = 0.0 + blanket_library.len_blkt_outboard_channel_total = 0.0 + blanket_library.p_fw_inboard_nuclear_heat_mw = 0.0 + blanket_library.p_fw_outboard_nuclear_heat_mw = 0.0 + blanket_library.temp_fw_inboard_peak = 0.0 + blanket_library.temp_fw_outboard_peak = 0.0 + blanket_library.mflow_fw_inboard_coolant_total = 0.0 + blanket_library.mflow_fw_outboard_coolant_total = 0.0 + blanket_library.mflow_fw_coolant_total = 0.0 + blanket_library.n_fw_inboard_channels = 0.0 + blanket_library.n_fw_outboard_channels = 0.0 + blanket_library.mflow_fw_inboard_coolant_channel = 0.0 + blanket_library.mflow_fw_outboard_coolant_channel = 0.0 + blanket_library.p_blkt_nuclear_heat_inboard_mw = 0.0 + blanket_library.p_blkt_nuclear_heat_outboard_mw = 0.0 + blanket_library.mflow_blkt_inboard_coolant = 0.0 + blanket_library.mflow_blkt_outboard_coolant = 0.0 + blanket_library.mfblkti_liq = 0.0 + blanket_library.mfblkto_liq = 0.0 + blanket_library.mfblkt_liq = 0.0 + blanket_library.mflow_blkt_coolant_total = 0.0 + blanket_library.mftotal = 0.0 + blanket_library.n_blkt_inboard_channels = 0.0 + blanket_library.n_blkt_outboard_channels = 0.0 + blanket_library.mfblktpi = 0.0 + blanket_library.mfblktpo = 0.0 + blanket_library.vel_blkt_inboard_coolant = 0.0 + blanket_library.vel_blkt_outboard_coolant = 0.0 + blanket_library.htpmw_fwi = 0.0 + blanket_library.htpmw_fwo = 0.0 + blanket_library.htpmw_blkti = 0.0 + blanket_library.htpmw_blkto = 0.0 + blanket_library.vfblkti = 0.0 + blanket_library.vfblkto = 0.0 diff --git a/process/init.py b/process/init.py index c444238b44..10a27d69dd 100644 --- a/process/init.py +++ b/process/init.py @@ -8,6 +8,7 @@ import process import process.fortran as fortran import process.process_output as process_output +from process.blanket_library import init_blanket_library from process.exceptions import ProcessValidationError from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -242,7 +243,7 @@ def init_all_module_vars(): fortran.define_iteration_variables.init_define_iteration_variables() fortran.water_usage_variables.init_watuse_variables() fortran.cs_fatigue_variables.init_cs_fatigue_variables() - fortran.blanket_library.init_blanket_library() + init_blanket_library() fortran.dcll_module.init_dcll_module() fortran.init_module.init_fortran_modules() diff --git a/source/fortran/blanket_library.f90 b/source/fortran/blanket_library.f90 index 7b1cd4bb33..18f113e872 100644 --- a/source/fortran/blanket_library.f90 +++ b/source/fortran/blanket_library.f90 @@ -120,64 +120,4 @@ module blanket_library integer :: icomponent !! Switch used to specify selected component: blanket=0, shield=1, vacuum vessel=2 -contains - - subroutine init_blanket_library - !! Initialise module variables - - implicit none - - hblnkt = 0.0D0 - hshld = 0.0D0 - dz_pf_cryostat = 0.0D0 - hvv = 0.0D0 - volshldi = 0.0D0 - volshldo = 0.0D0 - vol_vv_inboard = 0.0D0 - vol_vv_outboard = 0.0D0 - bldepti = 0.0D0 - bldepto = 0.0D0 - blwidti = 0.0D0 - blwidto = 0.0D0 - bllengi = 0.0D0 - bllengo = 0.0D0 - len_blkt_inboard_channel_total = 0.0D0 - bzfllengi_liq = 0.0D0 - bzfllengo_liq = 0.0D0 - len_blkt_outboard_channel_total = 0.0D0 - p_fw_inboard_nuclear_heat_mw = 0.0D0 - p_fw_outboard_nuclear_heat_mw = 0.0D0 - temp_fw_inboard_peak = 0.0D0 - temp_fw_outboard_peak = 0.0D0 - mflow_fw_inboard_coolant_total = 0.0D0 - mflow_fw_outboard_coolant_total = 0.0D0 - mflow_fw_coolant_total = 0.0D0 - n_fw_inboard_channels = 0.0D0 - n_fw_outboard_channels = 0.0D0 - mflow_fw_inboard_coolant_channel = 0.0D0 - mflow_fw_outboard_coolant_channel = 0.0D0 - p_blkt_nuclear_heat_inboard_mw = 0.0D0 - p_blkt_nuclear_heat_outboard_mw = 0.0D0 - mflow_blkt_inboard_coolant = 0.0D0 - mflow_blkt_outboard_coolant = 0.0D0 - mfblkti_liq = 0.0D0 - mfblkto_liq = 0.0D0 - mfblkt_liq = 0.0D0 - mflow_blkt_coolant_total = 0.0D0 - mftotal = 0.0D0 - n_blkt_inboard_channels = 0.0D0 - n_blkt_outboard_channels = 0.0D0 - mfblktpi = 0.0D0 - mfblktpo = 0.0D0 - vel_blkt_inboard_coolant = 0.0D0 - vel_blkt_outboard_coolant = 0.0D0 - htpmw_fwi = 0.0D0 - htpmw_fwo = 0.0D0 - htpmw_blkti = 0.0D0 - htpmw_blkto = 0.0D0 - vfblkti = 0.0D0 - vfblkto = 0.0D0 - - end subroutine init_blanket_library - end module blanket_library From dc334946e3d7d6b66ad96495a2940840da49355e Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 12 Mar 2025 14:57:42 +0000 Subject: [PATCH 02/34] Convert init_build_variables to Python --- process/build.py | 92 ++++++++++++++++++++++++++++ process/init.py | 3 +- source/fortran/build_variables.f90 | 97 ------------------------------ 3 files changed, 94 insertions(+), 98 deletions(-) diff --git a/process/build.py b/process/build.py index 85f6471ce7..898e57a67c 100644 --- a/process/build.py +++ b/process/build.py @@ -2423,3 +2423,95 @@ def calculate_radial_build(self, output: bool) -> None: "(beamwd)", current_drive_variables.beamwd, ) + + +def init_build_variables(): + build_variables.aplasmin = 0.25 + build_variables.available_radial_space = 0.0 + build_variables.blarea = 0.0 + build_variables.blareaib = 0.0 + build_variables.blareaob = 0.0 + build_variables.blbmith = 0.17 + build_variables.blbmoth = 0.27 + build_variables.blbpith = 0.30 + build_variables.blbpoth = 0.35 + build_variables.blbuith = 0.365 + build_variables.blbuoth = 0.465 + build_variables.dr_blkt_inboard = 0.115 + build_variables.dr_blkt_outboard = 0.235 + build_variables.dz_blkt_upper = 0.0 + build_variables.dr_bore = 1.42 + build_variables.f_z_cryostat = 4.268 + build_variables.dr_cryostat = 0.07 + build_variables.dr_vv_inboard = 0.07 + build_variables.dr_vv_outboard = 0.07 + build_variables.dz_vv_upper = 0.07 + build_variables.dz_vv_lower = 0.07 + build_variables.dr_vv_shells = 0.12 + build_variables.f_avspace = 1.0 + build_variables.fcspc = 0.6 + build_variables.fseppc = 3.5e8 + build_variables.a_fw_total = 0.0 + build_variables.a_fw_inboard = 0.0 + build_variables.a_fw_outboard = 0.0 + build_variables.dr_fw_inboard = 0.0 + build_variables.dr_fw_outboard = 0.0 + build_variables.dr_shld_vv_gap_inboard = 0.155 + build_variables.dr_cs_tf_gap = 0.08 + build_variables.gapomin = 0.234 + build_variables.dr_shld_vv_gap_outboard = 0.0 + build_variables.hmax = 0.0 + build_variables.hpfdif = 0.0 + build_variables.hpfu = 0.0 + build_variables.hr1 = 0.0 + build_variables.iohcl = 1 + build_variables.i_cs_precomp = 1 + build_variables.i_tf_inside_cs = 0 + build_variables.dr_cs = 0.811 + build_variables.dr_cs_precomp = 0.0 + build_variables.rbld = 0.0 + build_variables.required_radial_space = 0.0 + build_variables.rinboard = 0.651 + build_variables.rsldi = 0.0 + build_variables.rsldo = 0.0 + build_variables.r_vv_inboard_out = 0.0 + build_variables.r_sh_inboard_out = 0.0 + build_variables.r_tf_inboard_in = 0.0 + build_variables.r_tf_inboard_mid = 0.0 + build_variables.r_tf_inboard_out = 0.0 + build_variables.r_tf_outboard_mid = 0.0 + build_variables.i_r_cp_top = 0 + build_variables.r_cp_top = 0.0 + build_variables.f_r_cp = 1.4 + build_variables.dr_tf_inner_bore = 0.0 + build_variables.dh_tf_inner_bore = 0.0 + build_variables.dr_fw_plasma_gap_inboard = 0.14 + build_variables.dr_fw_plasma_gap_outboard = 0.15 + build_variables.sharea = 0.0 + build_variables.shareaib = 0.0 + build_variables.shareaob = 0.0 + build_variables.dr_shld_inboard = 0.69 + build_variables.dz_shld_lower = 0.7 + build_variables.dr_shld_outboard = 1.05 + build_variables.dz_shld_upper = 0.6 + build_variables.sigallpc = 3.0e8 + build_variables.dr_tf_inboard = 0.0 + build_variables.tfoffset = 0.0 + build_variables.tfootfi = 1.19 + build_variables.dr_tf_outboard = 0.0 + build_variables.dr_tf_shld_gap = 0.05 + build_variables.dr_shld_thermal_inboard = 0.05 + build_variables.dr_shld_thermal_outboard = 0.05 + build_variables.dz_shld_thermal = 0.05 + build_variables.dz_shld_vv_gap = 0.163 + build_variables.dz_xpoint_divertor = 0.0 + build_variables.dz_fw_plasma_gap = 0.60 + build_variables.dr_shld_blkt_gap = 0.05 + build_variables.plleni = 1.0 + build_variables.plleno = 1.0 + build_variables.plsepi = 1.0 + build_variables.plsepo = 1.5 + build_variables.rspo = 0.0 + build_variables.r_sh_inboard_in = 0.0 + build_variables.z_plasma_xpoint_upper = 0.0 + build_variables.z_plasma_xpoint_lower = 0.0 diff --git a/process/init.py b/process/init.py index 10a27d69dd..e770d6aa45 100644 --- a/process/init.py +++ b/process/init.py @@ -9,6 +9,7 @@ import process.fortran as fortran import process.process_output as process_output from process.blanket_library import init_blanket_library +from process.build import init_build_variables from process.exceptions import ProcessValidationError from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -235,7 +236,7 @@ def init_all_module_vars(): fortran.structure_variables.init_structure_variables() fortran.vacuum_variables.init_vacuum_variables() fortran.pf_power_variables.init_pf_power_variables() - fortran.build_variables.init_build_variables() + init_build_variables() fortran.constraint_variables.init_constraint_variables() fortran.pulse_variables.init_pulse_variables() fortran.rebco_variables.init_rebco_variables() diff --git a/source/fortran/build_variables.f90 b/source/fortran/build_variables.f90 index 3c8bc900ba..d5e490fbd4 100644 --- a/source/fortran/build_variables.f90 +++ b/source/fortran/build_variables.f90 @@ -302,101 +302,4 @@ module build_variables real(dp) :: z_plasma_xpoint_lower !! Vertical height of the lower plasma x-point (m) - - contains - - subroutine init_build_variables - !! Initialise module variables - implicit none - - aplasmin = 0.25D0 - available_radial_space = 0.0D0 - blarea = 0.0D0 - blareaib = 0.0D0 - blareaob = 0.0D0 - blbmith = 0.17D0 - blbmoth = 0.27D0 - blbpith = 0.30D0 - blbpoth = 0.35D0 - blbuith = 0.365D0 - blbuoth = 0.465D0 - dr_blkt_inboard = 0.115D0 - dr_blkt_outboard = 0.235D0 - dz_blkt_upper = 0.0D0 - dr_bore = 1.42D0 - f_z_cryostat = 4.268D0 - dr_cryostat = 0.07D0 - dr_vv_inboard = 0.07D0 - dr_vv_outboard = 0.07D0 - dz_vv_upper = 0.07D0 - dz_vv_lower = 0.07D0 - dr_vv_shells = 0.12D0 - f_avspace = 1.0D0 - fcspc = 0.6D0 - fseppc = 3.5D8 - a_fw_total = 0.0D0 - a_fw_inboard = 0.0D0 - a_fw_outboard = 0.0D0 - dr_fw_inboard = 0.0D0 - dr_fw_outboard = 0.0D0 - dr_shld_vv_gap_inboard = 0.155D0 - dr_cs_tf_gap = 0.08D0 - gapomin = 0.234D0 - dr_shld_vv_gap_outboard = 0.0D0 - hmax = 0.0D0 - hpfdif = 0.0D0 - hpfu = 0.0D0 - hr1 = 0.0D0 - iohcl = 1 - i_cs_precomp = 1 - i_tf_inside_cs = 0 - dr_cs = 0.811D0 - dr_cs_precomp = 0.0D0 - rbld = 0.0D0 - required_radial_space = 0.0D0 - rinboard = 0.651D0 - rsldi = 0.0D0 - rsldo = 0.0D0 - r_vv_inboard_out = 0.0D0 - r_sh_inboard_out = 0.0D0 - r_tf_inboard_in = 0.0D0 - r_tf_inboard_mid = 0.0D0 - r_tf_inboard_out = 0.0D0 - r_tf_outboard_mid = 0.0D0 - i_r_cp_top = 0 - r_cp_top = 0.0D0 - f_r_cp = 1.4D0 - dr_tf_inner_bore = 0.0D0 - dh_tf_inner_bore = 0.0D0 - dr_fw_plasma_gap_inboard = 0.14D0 - dr_fw_plasma_gap_outboard = 0.15D0 - sharea = 0.0D0 - shareaib = 0.0D0 - shareaob = 0.0D0 - dr_shld_inboard = 0.69D0 - dz_shld_lower = 0.7D0 - dr_shld_outboard = 1.05D0 - dz_shld_upper = 0.6D0 - sigallpc = 3.0D8 - dr_tf_inboard = 0.0D0 - tfoffset = 0.0D0 - tfootfi = 1.19D0 - dr_tf_outboard = 0.0D0 - dr_tf_shld_gap = 0.05D0 - dr_shld_thermal_inboard = 0.05D0 - dr_shld_thermal_outboard = 0.05D0 - dz_shld_thermal = 0.05D0 - dz_shld_vv_gap = 0.163D0 - dz_xpoint_divertor= 0.0D0 - dz_fw_plasma_gap = 0.60D0 - dr_shld_blkt_gap = 0.05D0 - plleni = 1.0D0 - plleno = 1.0D0 - plsepi = 1.0D0 - plsepo = 1.5D0 - rspo = 0.0D0 - r_sh_inboard_in = 0.0D0 - z_plasma_xpoint_upper = 0.0D0 - z_plasma_xpoint_lower = 0.0D0 - end subroutine init_build_variables end module build_variables From f8fb07005a49981d7d205d9cd2d791cb64acab9f Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 12 Mar 2025 15:01:42 +0000 Subject: [PATCH 03/34] Convert init_buildings_variables to Python --- process/buildings.py | 156 +++++++++++++++++++++++ process/init.py | 3 +- source/fortran/buildings_variables.f90 | 165 ------------------------- 3 files changed, 158 insertions(+), 166 deletions(-) diff --git a/process/buildings.py b/process/buildings.py index 3dafebe309..bab47fc980 100644 --- a/process/buildings.py +++ b/process/buildings.py @@ -1493,3 +1493,159 @@ def bldgs_sizes(self, output, tf_radial_dim, tf_vertical_dim): "(staff_buildings_vol)", staff_buildings_vol, ) + + +def init_buildings_variables(): + buildings_variables.admv = 1.0e5 + buildings_variables.admvol = 0.0 + buildings_variables.aux_build_l = 60.0 + buildings_variables.aux_build_w = 30.0 + buildings_variables.aux_build_h = 5.0 + buildings_variables.auxcool_l = 20.0 + buildings_variables.auxcool_w = 20.0 + buildings_variables.auxcool_h = 5.0 + buildings_variables.bioshld_thk = 2.50 + buildings_variables.chemlab_l = 50.0 + buildings_variables.chemlab_w = 30.0 + buildings_variables.chemlab_h = 6.0 + buildings_variables.dz_tf_cryostat = 2.5 + buildings_variables.clh2 = 15.0 + buildings_variables.control_buildings_l = 80.0 + buildings_variables.control_buildings_w = 60.0 + buildings_variables.control_buildings_h = 6.0 + buildings_variables.conv = 6.0e4 + buildings_variables.convol = 0.0 + buildings_variables.crane_arm_h = 10.0 + buildings_variables.crane_clrnc_h = 4.0 + buildings_variables.crane_clrnc_v = 3.0 + buildings_variables.cryomag_l = 120.0 + buildings_variables.cryomag_w = 90.0 + buildings_variables.cryomag_h = 5.0 + buildings_variables.cryostore_l = 160.0 + buildings_variables.cryostore_w = 30.0 + buildings_variables.cryostore_h = 20.0 + buildings_variables.cryostat_clrnc = 2.5 + buildings_variables.cryvol = 0.0 + buildings_variables.efloor = 0.0 + buildings_variables.elecdist_l = 380.0 + buildings_variables.elecdist_w = 350.0 + buildings_variables.elecdist_h = 5.0 + buildings_variables.elecload_l = 100.0 + buildings_variables.elecload_w = 90.0 + buildings_variables.elecload_h = 3.0 + buildings_variables.elecstore_l = 100.0 + buildings_variables.elecstore_w = 60.0 + buildings_variables.elecstore_h = 12.0 + buildings_variables.elevol = 0.0 + buildings_variables.esbldgm3 = 1.0e3 + buildings_variables.fc_building_l = 60.0 + buildings_variables.fc_building_w = 60.0 + buildings_variables.fndt = 2.0 + buildings_variables.gas_buildings_l = 25.0 + buildings_variables.gas_buildings_w = 15.0 + buildings_variables.gas_buildings_h = 5.0 + buildings_variables.ground_clrnc = 5.0 + buildings_variables.hcd_building_l = 70.0 + buildings_variables.hcd_building_w = 40.0 + buildings_variables.hcd_building_h = 25.0 + buildings_variables.hw_storage_l = 20.0 + buildings_variables.hw_storage_w = 10.0 + buildings_variables.hw_storage_h = 5.0 + buildings_variables.heat_sink_l = 160.0 + buildings_variables.heat_sink_w = 80.0 + buildings_variables.heat_sink_h = 12.0 + buildings_variables.hccl = 5.0 + buildings_variables.hcwt = 1.5 + buildings_variables.hot_sepdist = 2.0 + buildings_variables.hotcell_h = 12.0 + buildings_variables.i_bldgs_size = 0 + buildings_variables.i_bldgs_v = 0 + buildings_variables.ilw_smelter_l = 50.0 + buildings_variables.ilw_smelter_w = 30.0 + buildings_variables.ilw_smelter_h = 30.0 + buildings_variables.ilw_storage_l = 120.0 + buildings_variables.ilw_storage_w = 100.0 + buildings_variables.ilw_storage_h = 8.0 + buildings_variables.llw_storage_l = 45.0 + buildings_variables.llw_storage_w = 20.0 + buildings_variables.llw_storage_h = 5.0 + buildings_variables.magnet_pulse_l = 105.0 + buildings_variables.magnet_pulse_w = 40.0 + buildings_variables.magnet_pulse_h = 5.0 + buildings_variables.magnet_trains_l = 120.0 + buildings_variables.magnet_trains_w = 90.0 + buildings_variables.magnet_trains_h = 5.0 + buildings_variables.maint_cont_l = 125.0 + buildings_variables.maint_cont_w = 100.0 + buildings_variables.maint_cont_h = 6.0 + buildings_variables.mbvfac = 2.8 + buildings_variables.nbi_sys_l = 225.0 + buildings_variables.nbi_sys_w = 185.0 + buildings_variables.pfbldgm3 = 2.0e4 + buildings_variables.pibv = 2.0e4 + buildings_variables.qnty_sfty_fac = 2.0 + buildings_variables.rbvfac = 1.6 + buildings_variables.rbrt = 1.0 + buildings_variables.rbvol = 0.0 + buildings_variables.rbwt = 2.0 + buildings_variables.reactor_clrnc = 4.0 + buildings_variables.reactor_fndtn_thk = 2.0 + buildings_variables.reactor_hall_l = 0.0 + buildings_variables.reactor_hall_w = 0.0 + buildings_variables.reactor_hall_h = 0.0 + buildings_variables.reactor_roof_thk = 1.0 + buildings_variables.reactor_wall_thk = 2.0 + buildings_variables.rmbvol = 0.0 + buildings_variables.robotics_l = 50.0 + buildings_variables.robotics_w = 30.0 + buildings_variables.robotics_h = 30.0 + buildings_variables.row = 4.0 + buildings_variables.rxcl = 4.0 + buildings_variables.sec_buildings_l = 30.0 + buildings_variables.sec_buildings_w = 25.0 + buildings_variables.sec_buildings_h = 6.0 + buildings_variables.shmf = 0.5 + buildings_variables.shov = 1.0e5 + buildings_variables.shovol = 0.0 + buildings_variables.staff_buildings_h = 5.0 + buildings_variables.staff_buildings_area = 4.8e5 + buildings_variables.stcl = 3.0 + buildings_variables.tfcbv = 2.0e4 + buildings_variables.transp_clrnc = 1.0 + buildings_variables.trcl = 1.0 + buildings_variables.triv = 4.0e4 + buildings_variables.turbine_hall_l = 109.0 + buildings_variables.turbine_hall_w = 62.0 + buildings_variables.turbine_hall_h = 15.0 + buildings_variables.tw_storage_l = 90.0 + buildings_variables.tw_storage_w = 30.0 + buildings_variables.tw_storage_h = 5.0 + buildings_variables.volnucb = 0.0 + buildings_variables.volrci = 0.0 + buildings_variables.warm_shop_l = 100.0 + buildings_variables.warm_shop_w = 50.0 + buildings_variables.warm_shop_h = 10.0 + buildings_variables.water_buildings_l = 110.0 + buildings_variables.water_buildings_w = 10.0 + buildings_variables.water_buildings_h = 5.0 + buildings_variables.workshop_l = 150.0 + buildings_variables.workshop_w = 125.0 + buildings_variables.workshop_h = 10.0 + buildings_variables.wgt = 5.0e5 + buildings_variables.wgt2 = 1.0e5 + buildings_variables.wrbi = 0.0 + buildings_variables.wsvfac = 1.9 + buildings_variables.wsvol = 0.0 + buildings_variables.a_reactor_bldg = 8.32e3 + buildings_variables.a_ee_ps_bldg = 2.133e4 + buildings_variables.a_aux_services_bldg = 1.0e3 + buildings_variables.a_hot_cell_bldg = 8.43e3 + buildings_variables.a_reactor_service_bldg = 2.44e3 + buildings_variables.a_service_water_bldg = 1.567e3 + buildings_variables.a_fuel_handling_bldg = 1.67e3 + buildings_variables.a_control_room_bldg = 2.88e3 + buildings_variables.a_ac_ps_bldg = 6.423e3 + buildings_variables.a_admin_bldg = 2.5674e4 + buildings_variables.a_site_service_bldg = 8.3e3 + buildings_variables.a_cryo_inert_gas_bldg = 1.838e4 + buildings_variables.a_security_bldg = 4.552e3 diff --git a/process/init.py b/process/init.py index e770d6aa45..a3fe91aa26 100644 --- a/process/init.py +++ b/process/init.py @@ -10,6 +10,7 @@ import process.process_output as process_output from process.blanket_library import init_blanket_library from process.build import init_build_variables +from process.buildings import init_buildings_variables from process.exceptions import ProcessValidationError from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -210,7 +211,7 @@ def init_all_module_vars(): than a 'run-once' executable. """ fortran.numerics.init_numerics() - fortran.buildings_variables.init_buildings_variables() + init_buildings_variables() fortran.cost_variables.init_cost_variables() fortran.divertor_variables.init_divertor_variables() fortran.error_handling.init_error_handling() diff --git a/source/fortran/buildings_variables.f90 b/source/fortran/buildings_variables.f90 index 07340fea96..9405bc5f3f 100644 --- a/source/fortran/buildings_variables.f90 +++ b/source/fortran/buildings_variables.f90 @@ -308,169 +308,4 @@ module buildings_variables real(dp) :: a_security_bldg !! Floor area of security building in m^2 - - - contains - - subroutine init_buildings_variables - !! Initialise buildings variables - implicit none - - admv = 1.0D5 - admvol = 0.0D0 - aux_build_l = 60.0D0 - aux_build_w = 30.0D0 - aux_build_h = 5.0D0 - auxcool_l = 20.0D0 - auxcool_w = 20.0D0 - auxcool_h = 5.0D0 - bioshld_thk = 2.50D0 - chemlab_l = 50.0D0 - chemlab_w = 30.0D0 - chemlab_h = 6.0D0 - dz_tf_cryostat = 2.5D0 - clh2 = 15.0D0 - control_buildings_l = 80.0D0 - control_buildings_w = 60.0D0 - control_buildings_h = 6.0D0 - conv = 6.0D4 - convol = 0.0D0 - crane_arm_h = 10.0D0 - crane_clrnc_h = 4.0D0 - crane_clrnc_v = 3.0D0 - cryomag_l = 120.0D0 - cryomag_w = 90.0D0 - cryomag_h = 5.0D0 - cryostore_l = 160.0D0 - cryostore_w = 30.0D0 - cryostore_h = 20.0D0 - cryostat_clrnc = 2.5D0 - cryvol = 0.0D0 - efloor = 0.0D0 - elecdist_l = 380.0D0 - elecdist_w = 350.0D0 - elecdist_h = 5.0D0 - elecload_l = 100.0D0 - elecload_w = 90.0D0 - elecload_h = 3.0D0 - elecstore_l = 100.0D0 - elecstore_w = 60.0D0 - elecstore_h = 12.0D0 - elevol = 0.0D0 - esbldgm3 = 1.0D3 - fc_building_l = 60.0D0 - fc_building_w = 60.0D0 - fndt = 2.0D0 - gas_buildings_l = 25.0D0 - gas_buildings_w = 15.0D0 - gas_buildings_h = 5.0D0 - ground_clrnc = 5.0D0 - hcd_building_l = 70.0D0 - hcd_building_w = 40.0D0 - hcd_building_h = 25.0D0 - hw_storage_l = 20.0D0 - hw_storage_w = 10.0D0 - hw_storage_h = 5.0D0 - heat_sink_l = 160.0D0 - heat_sink_w = 80.0D0 - heat_sink_h = 12.0D0 - hccl = 5.0D0 - hcwt = 1.5D0 - hot_sepdist = 2.0D0 - hotcell_h = 12.0D0 - i_bldgs_size = 0 - i_bldgs_v = 0 - ilw_smelter_l = 50.0D0 - ilw_smelter_w = 30.0D0 - ilw_smelter_h = 30.0D0 - ilw_storage_l = 120.0D0 - ilw_storage_w = 100.0D0 - ilw_storage_h = 8.0D0 - llw_storage_l = 45.0D0 - llw_storage_w = 20.0D0 - llw_storage_h = 5.0D0 - magnet_pulse_l = 105.0D0 - magnet_pulse_w = 40.0D0 - magnet_pulse_h = 5.0D0 - magnet_trains_l = 120.0D0 - magnet_trains_w = 90.0D0 - magnet_trains_h = 5.0D0 - maint_cont_l = 125.0D0 - maint_cont_w = 100.0D0 - maint_cont_h = 6.0D0 - mbvfac = 2.8D0 - nbi_sys_l = 225.0D0 - nbi_sys_w = 185.0D0 - pfbldgm3 = 2.0D4 - pibv = 2.0D4 - qnty_sfty_fac = 2.0D0 - rbvfac = 1.6D0 - rbrt = 1.0D0 - rbvol = 0.0D0 - rbwt = 2.0D0 - reactor_clrnc = 4.0D0 - reactor_fndtn_thk = 2.0D0 - reactor_hall_l = 0.0D0 - reactor_hall_w = 0.0D0 - reactor_hall_h = 0.0D0 - reactor_roof_thk = 1.0D0 - reactor_wall_thk = 2.0D0 - rmbvol = 0.0D0 - robotics_l = 50.0D0 - robotics_w = 30.0D0 - robotics_h = 30.0D0 - row = 4.0D0 - rxcl = 4.0D0 - sec_buildings_l = 30.0D0 - sec_buildings_w = 25.0D0 - sec_buildings_h = 6.0D0 - shmf = 0.5D0 - shov = 1.0D5 - shovol = 0.0D0 - staff_buildings_h = 5.0D0 - staff_buildings_area = 4.8D5 - stcl = 3.0D0 - tfcbv = 2.0D4 - transp_clrnc = 1.0D0 - trcl = 1.0D0 - triv = 4.0D4 - turbine_hall_l = 109.0D0 - turbine_hall_w = 62.0D0 - turbine_hall_h = 15.0D0 - tw_storage_l = 90.0D0 - tw_storage_w = 30.0D0 - tw_storage_h = 5.0D0 - volnucb = 0.0D0 - volrci = 0.0D0 - warm_shop_l = 100.0D0 - warm_shop_w = 50.0D0 - warm_shop_h = 10.0D0 - water_buildings_l = 110.0D0 - water_buildings_w = 10.0D0 - water_buildings_h = 5.0D0 - workshop_l = 150.0D0 - workshop_w = 125.0D0 - workshop_h = 10.0D0 - wgt = 5.0D5 - wgt2 = 1.0D5 - wrbi = 0.0D0 - wsvfac = 1.9D0 - wsvol = 0.0D0 - - a_reactor_bldg = 8.32D3 - a_ee_ps_bldg = 2.133D4 - a_aux_services_bldg = 1.0D3 - a_hot_cell_bldg = 8.43D3 - a_reactor_service_bldg = 2.44D3 - a_service_water_bldg = 1.567D3 - a_fuel_handling_bldg = 1.67D3 - a_control_room_bldg = 2.88D3 - a_ac_ps_bldg = 6.423D3 - a_admin_bldg = 2.5674D4 - a_site_service_bldg = 8.3D3 - a_cryo_inert_gas_bldg = 1.838D4 - a_security_bldg = 4.552D3 - - end subroutine init_buildings_variables - end module buildings_variables From b03a824bdb273c156cbca0c11623005108d2e16e Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 12 Mar 2025 15:35:11 +0000 Subject: [PATCH 04/34] Convert init_cost_variables to Python --- process/costs.py | 164 ++++++++++++++++++++++++++++++ process/init.py | 3 +- source/fortran/cost_variables.f90 | 163 ----------------------------- 3 files changed, 166 insertions(+), 164 deletions(-) diff --git a/process/costs.py b/process/costs.py index 732f1cefcf..27f1df25a6 100644 --- a/process/costs.py +++ b/process/costs.py @@ -2952,3 +2952,167 @@ def convert_fpy_to_calendar() -> None: ) else: cost_variables.cplife_cal = cost_variables.cplife + + +def init_cost_variables(): + cost_variables.abktflnc = 5.0 + cost_variables.adivflnc = 7.0 + cost_variables.blkcst = 0.0 + cost_variables.c221 = 0.0 + cost_variables.c222 = 0.0 + cost_variables.capcost = 0.0 + cost_variables.cconfix = 80.0 + cost_variables.cconshpf = 70.0 + cost_variables.cconshtf = 75.0 + cost_variables.cdcost = 0.0 + cost_variables.cdirt = 0.0 + cost_variables.cdrlife = 0.0 + cost_variables.cdrlife_cal = 0.0 + cost_variables.cfactr = 0.75 + cost_variables.cpfact = 0.0 + cost_variables.cfind = [0.244, 0.244, 0.244, 0.29] + cost_variables.cland = 19.2 + cost_variables.coe = 0.0 + cost_variables.coecap = 0.0 + cost_variables.coefuelt = 0.0 + cost_variables.coeoam = 0.0 + cost_variables.concost = 0.0 + cost_variables.costexp = 0.8 + cost_variables.costexp_pebbles = 0.6 + cost_variables.cost_factor_buildings = 1.0 + cost_variables.cost_factor_land = 1.0 + cost_variables.cost_factor_tf_coils = 1.0 + cost_variables.cost_factor_fwbs = 1.0 + cost_variables.cost_factor_rh = 1.0 + cost_variables.cost_factor_vv = 1.0 + cost_variables.cost_factor_bop = 1.0 + cost_variables.cost_factor_misc = 1.0 + cost_variables.maintenance_fwbs = 0.2 + cost_variables.maintenance_gen = 0.05 + cost_variables.amortization = 13.6 + cost_variables.cost_model = 1 + cost_variables.cowner = 0.15 + cost_variables.cplife = 0.0 + cost_variables.cplife_cal = 0.0 + cost_variables.cpstcst = 0.0 + cost_variables.cpstflnc = 10.0 + cost_variables.crctcore = 0.0 + cost_variables.csi = 16.0 + cost_variables.cturbb = 38.0 + cost_variables.decomf = 0.1 + cost_variables.dintrt = 0.0 + cost_variables.divcst = 0.0 + cost_variables.divlife = 0.0 + cost_variables.divlife_cal = 0.0 + cost_variables.dtlife = 0.0 + cost_variables.fcap0 = 1.165 + cost_variables.fcap0cp = 1.08 + cost_variables.fcdfuel = 0.1 + cost_variables.fcontng = 0.195 + cost_variables.fcr0 = 0.0966 + cost_variables.fkind = 1.0 + cost_variables.fwallcst = 0.0 + cost_variables.iavail = 2 + cost_variables.ibkt_life = 0 + cost_variables.life_dpa = 50 + cost_variables.bktcycles = 1.0e3 + cost_variables.avail_min = 0.75 + cost_variables.tok_build_cost_per_vol = 1283.0 + cost_variables.light_build_cost_per_vol = 270.0 + cost_variables.favail = 1.0 + cost_variables.num_rh_systems = 4 + cost_variables.conf_mag = 0.99 + cost_variables.div_prob_fail = 0.0002 + cost_variables.div_umain_time = 0.25 + cost_variables.div_nref = 7000.0 + cost_variables.div_nu = 14000.0 + cost_variables.fwbs_nref = 20000.0 + cost_variables.fwbs_nu = 40000.0 + cost_variables.fwbs_prob_fail = 0.0002 + cost_variables.fwbs_umain_time = 0.25 + cost_variables.redun_vacp = 25.0 + cost_variables.redun_vac = 0 + cost_variables.t_operation = 0.0 + cost_variables.tbktrepl = 0.5 + cost_variables.tcomrepl = 0.5 + cost_variables.tdivrepl = 0.25 + cost_variables.uubop = 0.02 + cost_variables.uucd = 0.02 + cost_variables.uudiv = 0.04 + cost_variables.uufuel = 0.02 + cost_variables.uufw = 0.04 + cost_variables.uumag = 0.02 + cost_variables.uuves = 0.04 + cost_variables.ifueltyp = 0 + cost_variables.ipnet = 0 + cost_variables.ireactor = 1 + cost_variables.lsa = 4 + cost_variables.moneyint = 0.0 + cost_variables.output_costs = 1 + cost_variables.discount_rate = 0.0435 + cost_variables.startupratio = 1.0 + cost_variables.startuppwr = 0.0 + cost_variables.tlife = 30.0 + cost_variables.ucblbe = 260.0 + cost_variables.ucblbreed = 875.0 + cost_variables.ucblli = 875.0 + cost_variables.ucblli2o = 600.0 + cost_variables.ucbllipb = 10.3 + cost_variables.ucblss = 90.0 + cost_variables.ucblvd = 200.0 + cost_variables.ucbus = 0.123 + cost_variables.uccase = 50.0 + cost_variables.uccpcl1 = 250.0 + cost_variables.uccpclb = 150.0 + cost_variables.uccry = 9.3e4 + cost_variables.uccryo = 32.0 + cost_variables.uccu = 75.0 + cost_variables.ucdiv = 2.8e5 + cost_variables.ucech = 3.0 + cost_variables.ucf1 = 2.23e7 + cost_variables.ucfnc = 35.0 + cost_variables.ucfuel = 3.45 + cost_variables.uche3 = 1.0e6 + cost_variables.uchrs = 87.9e6 + cost_variables.uchts = [15.3, 19.1] + cost_variables.uciac = 1.5e8 + cost_variables.ucich = 3.0 + cost_variables.uclh = 3.3 + cost_variables.ucme = 1.25e8 + cost_variables.ucmisc = 2.5e7 + cost_variables.ucnbi = 3.3 + cost_variables.ucoam = [68.8, 68.8, 68.8, 74.4] + cost_variables.ucpens = 32.0 + cost_variables.ucpfb = 210.0 + cost_variables.ucpfbk = 1.66e4 + cost_variables.ucpfbs = 4.9e3 + cost_variables.ucpfcb = 7.5e4 + cost_variables.ucpfdr1 = 150.0 + cost_variables.ucpfic = 1.0e4 + cost_variables.ucpfps = 3.5e4 + cost_variables.ucrb = 400.0 + cost_variables.ucsc = [ + 600.0, + 600.0, + 300.0, + 600.0, + 600.0, + 600.0, + 300.0, + 1200.0, + 1200.0, + ] + cost_variables.sc_mat_cost_0 = [4.8, 2.0, 1.0, 4.8, 4.8, 47.4, 1.0, 47.4, 47.4] + cost_variables.supercond_cost_model = 0 + cost_variables.ucshld = 32.0 + cost_variables.uctfbr = 1.22 + cost_variables.uctfbus = 100.0 + cost_variables.uctfps = 24.0 + cost_variables.uctfsw = 1.0 + cost_variables.ucturb = [230.0e6, 245.0e6] + cost_variables.ucwindpf = 465.0 + cost_variables.ucwindtf = 480.0 + cost_variables.ucwst = [0.0, 3.94, 5.91, 7.88] + cost_variables.u_unplanned_cp = 0.0 + cost_variables.i_cp_lifetime = 0 + cost_variables.cplife_input = 2.0 diff --git a/process/init.py b/process/init.py index a3fe91aa26..a9d5f64c40 100644 --- a/process/init.py +++ b/process/init.py @@ -11,6 +11,7 @@ from process.blanket_library import init_blanket_library from process.build import init_build_variables from process.buildings import init_buildings_variables +from process.costs import init_cost_variables from process.exceptions import ProcessValidationError from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -212,7 +213,7 @@ def init_all_module_vars(): """ fortran.numerics.init_numerics() init_buildings_variables() - fortran.cost_variables.init_cost_variables() + init_cost_variables() fortran.divertor_variables.init_divertor_variables() fortran.error_handling.init_error_handling() fortran.fwbs_variables.init_fwbs_variables() diff --git a/source/fortran/cost_variables.f90 b/source/fortran/cost_variables.f90 index 653991eaee..12109e5181 100644 --- a/source/fortran/cost_variables.f90 +++ b/source/fortran/cost_variables.f90 @@ -617,167 +617,4 @@ module cost_variables real(dp), dimension(4) :: ucwst !! cost of waste disposal (M$/y/1200MW) - - contains - - subroutine init_cost_variables - !! Initialise cost variables - implicit none - - abktflnc = 5.0D0 - adivflnc = 7.0D0 - blkcst = 0.0D0 - c221 = 0.0D0 - c222 = 0.0D0 - capcost = 0.0D0 - cconfix = 80.0D0 - cconshpf = 70.0D0 - cconshtf = 75.0D0 - cdcost = 0.0D0 - cdirt = 0.0D0 - cdrlife = 0.0D0 - cdrlife_cal = 0.0D0 - cfactr = 0.75D0 - cpfact = 0.0D0 - cfind = (/0.244D0, 0.244D0, 0.244D0, 0.29D0/) - cland = 19.2D0 - coe = 0.0D0 - coecap = 0.0D0 - coefuelt = 0.0D0 - coeoam = 0.0D0 - concost = 0.0D0 - costexp = 0.8D0 - costexp_pebbles = 0.6D0 - cost_factor_buildings = 1.0D0 - cost_factor_land = 1.0D0 - cost_factor_tf_coils = 1.0D0 - cost_factor_fwbs = 1.0D0 - cost_factor_rh = 1.0D0 - cost_factor_vv = 1.0D0 - cost_factor_bop = 1.0D0 - cost_factor_misc = 1.0D0 - maintenance_fwbs = 0.2D0 - maintenance_gen = 0.05D0 - amortization = 13.6D0 - cost_model = 1 - cowner = 0.15D0 - cplife = 0.0D0 - cplife_cal = 0.0D0 - cpstcst = 0.0D0 - cpstflnc = 10.0D0 - crctcore = 0.0D0 - csi = 16.0D0 - cturbb = 38.0D0 - decomf = 0.1D0 - dintrt = 0.0D0 - divcst = 0.0D0 - divlife = 0.0D0 - divlife_cal = 0.0D0 - dtlife = 0.0D0 - fcap0 = 1.165D0 - fcap0cp = 1.08D0 - fcdfuel = 0.1D0 - fcontng = 0.195D0 - fcr0 = 0.0966D0 - fkind = 1.0D0 - fwallcst = 0.0D0 - iavail= 2 - ibkt_life = 0 - life_dpa = 50 - bktcycles = 1.0D3 - avail_min = 0.75D0 - tok_build_cost_per_vol = 1283.0D0 - light_build_cost_per_vol = 270.0D0 - favail = 1.0D0 - num_rh_systems = 4 - conf_mag = 0.99D0 - div_prob_fail = 0.0002D0 - div_umain_time = 0.25D0 - div_nref = 7000.0D0 - div_nu = 14000.0D0 - fwbs_nref = 20000.0D0 - fwbs_nu = 40000.0D0 - fwbs_prob_fail = 0.0002D0 - fwbs_umain_time = 0.25D0 - redun_vacp = 25.0D0 - redun_vac = 0 - t_operation = 0.0D0 - tbktrepl = 0.5D0 - tcomrepl = 0.5D0 - tdivrepl = 0.25D0 - uubop = 0.02D0 - uucd = 0.02D0 - uudiv = 0.04D0 - uufuel = 0.02D0 - uufw = 0.04D0 - uumag = 0.02D0 - uuves = 0.04D0 - ifueltyp = 0 - ipnet = 0 - ireactor = 1 - lsa = 4 - moneyint = 0.0D0 - output_costs = 1 - discount_rate = 0.0435D0 - startupratio = 1.0 - startuppwr = 0.0 - tlife = 30.0D0 - ucblbe = 260.0D0 - ucblbreed = 875.0D0 - ucblli = 875.0D0 - ucblli2o = 600.0D0 - ucbllipb = 10.3D0 - ucblss = 90.0D0 - ucblvd = 200.0D0 - ucbus = 0.123D0 - uccase = 50.0D0 - uccpcl1 = 250.0D0 - uccpclb = 150.0D0 - uccry = 9.3D4 - uccryo = 32.0D0 - uccu = 75.0D0 - ucdiv = 2.8D5 - ucech = 3.0D0 - ucf1 = 2.23D7 - ucfnc = 35.0D0 - ucfuel = 3.45D0 - uche3 = 1.0D6 - uchrs = 87.9D6 - uchts = (/15.3D0, 19.1D0/) - uciac = 1.5D8 - ucich = 3.0D0 - uclh = 3.3D0 - ucme = 1.25D8 - ucmisc = 2.5D7 - ucnbi = 3.3D0 - ucoam = (/68.8D0, 68.8D0, 68.8D0, 74.4D0/) - ucpens = 32.0D0 - ucpfb = 210.0D0 - ucpfbk = 1.66D4 - ucpfbs = 4.9D3 - ucpfcb = 7.5D4 - ucpfdr1 = 150.0D0 - ucpfic = 1.0D4 - ucpfps = 3.5D4 - ucrb = 400.0D0 - ucsc = & - (/600.0D0, 600.0D0, 300.0D0, 600.0D0, 600.0D0, 600.0D0, 300.0D0, 1200.0D0, & - 1200.0D0/) - sc_mat_cost_0 = & - (/4.8D0, 2.0D0, 1.0D0, 4.8D0, 4.8D0, 47.4D0, 1.0D0, 47.4D0, 47.4D0/) - supercond_cost_model = 0 - ucshld = 32.0D0 - uctfbr = 1.22D0 - uctfbus = 100.0D0 - uctfps = 24.0D0 - uctfsw = 1.0D0 - ucturb = (/230.0D6, 245.0D6/) - ucwindpf = 465.0D0 - ucwindtf = 480.0D0 - ucwst = (/0.0D0, 3.94D0, 5.91D0, 7.88D0/) - u_unplanned_cp = 0.0 - i_cp_lifetime = 0 - cplife_input = 2.0D0 - - end subroutine init_cost_variables end module cost_variables From c4ef3aced73b5e7b685f78455b6f60a988764353 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 12 Mar 2025 15:48:45 +0000 Subject: [PATCH 05/34] Convert init_cs_fatigue_variables to Python --- process/cs_fatigue.py | 43 +++++++++++++++++++------ process/init.py | 3 +- source/fortran/CS_fatigue_variables.f90 | 25 -------------- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/process/cs_fatigue.py b/process/cs_fatigue.py index 4ee00939c7..377f6e881f 100644 --- a/process/cs_fatigue.py +++ b/process/cs_fatigue.py @@ -1,8 +1,7 @@ import numpy as np from numba import njit -from process.fortran import constants -from process.fortran import cs_fatigue_variables as csfv +from process.fortran import constants, cs_fatigue_variables class CsFatigue: @@ -22,7 +21,9 @@ def ncycle( # X. Sarasola et al, IEEE Transactions on Applied Superconductivity, # vol. 30, no. 4, pp. 1-5, June 2020, Art no. 4200705 - n = -csfv.paris_power_law * (csfv.walker_coefficient - 1.0e0) + n = -cs_fatigue_variables.paris_power_law * ( + cs_fatigue_variables.walker_coefficient - 1.0e0 + ) # Set units to MPa max_hoop_stress_MPa = max_hoop_stress / 1.0e6 @@ -43,7 +44,7 @@ def ncycle( # Calculated constant for a given stress ratio using Walker equation # https://en.wikipedia.org/wiki/Crack_growth_equation#Walker_equation - cr = csfv.paris_coefficient / (1.0e0 - r) ** n + cr = cs_fatigue_variables.paris_coefficient / (1.0e0 - r) ** n # select given increase in crack area delta = 1.0e-4 @@ -56,9 +57,13 @@ def ncycle( # Default CS steel undergoes fast fracture when SIF > 200 MPa, under a saftey factor 1.5 we use 133MPa pi_2_arr = np.array([np.pi / 2.0e0, 0]) while ( - (a <= t_structural_vertical / csfv.sf_vertical_crack) - and (c <= t_structural_radial / csfv.sf_radial_crack) - and (k_max <= csfv.fracture_toughness / csfv.sf_fast_fracture) + (a <= t_structural_vertical / cs_fatigue_variables.sf_vertical_crack) + and (c <= t_structural_radial / cs_fatigue_variables.sf_radial_crack) + and ( + k_max + <= cs_fatigue_variables.fracture_toughness + / cs_fatigue_variables.sf_fast_fracture + ) ): # find SIF max from SIF_a and SIF_c k_a, k_c = self.surface_stress_intensity_factor( @@ -72,11 +77,11 @@ def ncycle( k_max = max(k_a, k_c) # run euler_method and find number of cycles needed to give crack increase - delta_n = delta / (cr * (k_max**csfv.paris_power_law)) + delta_n = delta / (cr * (k_max**cs_fatigue_variables.paris_power_law)) # update a and c, N (+= doesnt work for fortran (?) reasons) - a = a + delta * (k_a / k_max) ** csfv.paris_power_law - c = c + delta * (k_c / k_max) ** csfv.paris_power_law + a = a + delta * (k_a / k_max) ** cs_fatigue_variables.paris_power_law + c = c + delta * (k_c / k_max) ** cs_fatigue_variables.paris_power_law n_pulse = n_pulse + delta_n # two pulses - ramp to Vsmax and ramp down per cycle @@ -225,3 +230,21 @@ def surface_stress_intensity_factor(hoop_stress, t, w, a, c, phi): ) * np.sqrt(np.pi * a / q) ) + + +def init_cs_fatigue_variables(): + cs_fatigue_variables.residual_sig_hoop = 2.4e8 + cs_fatigue_variables.t_crack_radial = 6.0e-3 + cs_fatigue_variables.t_crack_vertical = 0.89e-3 + cs_fatigue_variables.n_cycle = 0.0 + cs_fatigue_variables.n_cycle_min = 2.0e4 + cs_fatigue_variables.t_structural_vertical = 0.022 + cs_fatigue_variables.t_structural_radial = 0.07 + cs_fatigue_variables.bkt_life_csf = 0 + cs_fatigue_variables.sf_vertical_crack = 2.0 + cs_fatigue_variables.sf_radial_crack = 2.0 + cs_fatigue_variables.sf_fast_fracture = 1.5 + cs_fatigue_variables.paris_coefficient = 65.0e-14 + cs_fatigue_variables.paris_power_law = 3.5 + cs_fatigue_variables.walker_coefficient = 0.436 + cs_fatigue_variables.fracture_toughness = 2.0e2 diff --git a/process/init.py b/process/init.py index a9d5f64c40..f1e6e228e8 100644 --- a/process/init.py +++ b/process/init.py @@ -12,6 +12,7 @@ from process.build import init_build_variables from process.buildings import init_buildings_variables from process.costs import init_cost_variables +from process.cs_fatigue import init_cs_fatigue_variables from process.exceptions import ProcessValidationError from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -245,7 +246,7 @@ def init_all_module_vars(): fortran.reinke_variables.init_reinke_variables() fortran.define_iteration_variables.init_define_iteration_variables() fortran.water_usage_variables.init_watuse_variables() - fortran.cs_fatigue_variables.init_cs_fatigue_variables() + init_cs_fatigue_variables() init_blanket_library() fortran.dcll_module.init_dcll_module() diff --git a/source/fortran/CS_fatigue_variables.f90 b/source/fortran/CS_fatigue_variables.f90 index d1b66d05d3..05350ffbae 100644 --- a/source/fortran/CS_fatigue_variables.f90 +++ b/source/fortran/CS_fatigue_variables.f90 @@ -52,29 +52,4 @@ module CS_fatigue_variables real(dp) :: fracture_toughness !! fracture toughness (MPa m^1/2) - - contains - - subroutine init_CS_fatigue_variables - !! Initialise module variables - implicit none - - residual_sig_hoop = 2.4D8 - t_crack_radial = 6.0D-3 - t_crack_vertical = 0.89D-3 - n_cycle = 0.0D0 - n_cycle_min = 2.0D4 - t_structural_vertical = 0.022D0 - t_structural_radial = 0.07D0 - bkt_life_csf = 0 - sf_vertical_crack = 2.0D0 - sf_radial_crack = 2.0D0 - sf_fast_fracture = 1.5D0 - paris_coefficient = 65.0D-14 - paris_power_law = 3.5D0 - walker_coefficient = 0.436D0 - fracture_toughness = 2.0e2 - - end subroutine init_CS_fatigue_variables - end module CS_fatigue_variables From 98783ef8a8e0bd0219f341a0a7d5ad487e89abcc Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 14:19:24 +0000 Subject: [PATCH 06/34] Convert init_dcll_module to Python --- process/dcll.py | 36 +++++++++++++++++++++++++++++++ process/init.py | 3 ++- source/fortran/dcll.f90 | 48 ----------------------------------------- 3 files changed, 38 insertions(+), 49 deletions(-) diff --git a/process/dcll.py b/process/dcll.py index 5e78b87e5f..e02fc67ebe 100644 --- a/process/dcll.py +++ b/process/dcll.py @@ -936,3 +936,39 @@ def write_output(self): fwbs_variables.vol_vv, "OP ", ) + + +def init_dcll_module(): + dcll_module.r_fci = 0.0 + dcll_module.r_backwall = 0.0 + dcll_module.bz_r_ib = 0.0 + dcll_module.bz_r_ob = 0.0 + dcll_module.f_vol_stff_plates = 0.0 + dcll_module.f_vol_stl_bz_struct = 0.0 + dcll_module.f_vol_stl_back_wall = 0.0 + dcll_module.f_vol_stl_fw = 0.0 + dcll_module.f_vol_mfbss_stl = 0.0 + dcll_module.f_vol_mfbss_he = 0.0 + dcll_module.f_vol_mfbss_pbli = 0.0 + dcll_module.vol_fci = 0.0 + dcll_module.vol_bz_struct = 0.0 + dcll_module.vol_bz_liq = 0.0 + dcll_module.vol_bz_liq_ib = 0.0 + dcll_module.vol_bz_liq_ob = 0.0 + dcll_module.vol_bw = 0.0 + dcll_module.vol_bss = 0.0 + dcll_module.wht_cer = 0.0 + dcll_module.wht_stl_struct = 0.0 + dcll_module.wht_cool_struct = 0.0 + dcll_module.wht_bw_stl = 0.0 + dcll_module.wht_bw_cool = 0.0 + dcll_module.wht_mfbss_stl = 0.0 + dcll_module.wht_mfbss_cool = 0.0 + dcll_module.wht_mfbss_pbli = 0.0 + dcll_module.fwmass_stl = 0.0 + dcll_module.fwmass_cool = 0.0 + dcll_module.mass_cool_blanket = 0.0 + dcll_module.mass_liq_blanket = 0.0 + dcll_module.mass_stl_blanket = 0.0 + dcll_module.mass_segm_ib = 0.0 + dcll_module.mass_segm_ob = 0.0 diff --git a/process/init.py b/process/init.py index f1e6e228e8..b704fb3dd9 100644 --- a/process/init.py +++ b/process/init.py @@ -13,6 +13,7 @@ from process.buildings import init_buildings_variables from process.costs import init_cost_variables from process.cs_fatigue import init_cs_fatigue_variables +from process.dcll import init_dcll_module from process.exceptions import ProcessValidationError from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -248,7 +249,7 @@ def init_all_module_vars(): fortran.water_usage_variables.init_watuse_variables() init_cs_fatigue_variables() init_blanket_library() - fortran.dcll_module.init_dcll_module() + init_dcll_module() fortran.init_module.init_fortran_modules() diff --git a/source/fortran/dcll.f90 b/source/fortran/dcll.f90 index 3ae15a928e..2fdcf4a531 100644 --- a/source/fortran/dcll.f90 +++ b/source/fortran/dcll.f90 @@ -116,52 +116,4 @@ module dcll_module !! Total mass for an inboard/outboard reactor segment [kg] real(dp) :: mass_segm_ib, mass_segm_ob -contains - - !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - subroutine init_dcll_module - - !! Initialise module variables !!! - - implicit none - - r_fci = 0.0 - r_backwall = 0.0 - bz_r_ib = 0.0 - bz_r_ob = 0.0 - f_vol_stff_plates = 0.0 - f_vol_stl_bz_struct = 0.0 - f_vol_stl_back_wall = 0.0 - f_vol_stl_fw = 0.0 - f_vol_mfbss_stl = 0.0 - f_vol_mfbss_he = 0.0 - f_vol_mfbss_pbli = 0.0 - vol_fci = 0.0 - vol_bz_struct = 0.0 - vol_bz_liq = 0.0 - vol_bz_liq_ib = 0.0 - vol_bz_liq_ob = 0.0 - vol_bw = 0.0 - vol_bss = 0.0 - wht_cer = 0.0 - wht_stl_struct = 0.0 - wht_cool_struct = 0.0 - wht_bw_stl = 0.0 - wht_bw_cool = 0.0 - wht_mfbss_stl = 0.0 - wht_mfbss_cool = 0.0 - wht_mfbss_pbli = 0.0 - fwmass_stl = 0.0 - fwmass_cool = 0.0 - mass_cool_blanket = 0.0 - mass_liq_blanket = 0.0 - mass_stl_blanket = 0.0 - mass_segm_ib = 0.0 - mass_segm_ob = 0.0 - - end subroutine init_dcll_module - - !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - end module dcll_module From c6cc44e72b1f935b2cb475f142e3c1083c32827a Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 14:23:29 +0000 Subject: [PATCH 07/34] Convert init_divertor_variables to Python --- process/divertor.py | 24 +++++++++++++++++++++ process/init.py | 3 ++- source/fortran/divertor_variables.f90 | 31 +++------------------------ 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/process/divertor.py b/process/divertor.py index be68baf728..22da0ef0ba 100644 --- a/process/divertor.py +++ b/process/divertor.py @@ -312,3 +312,27 @@ def divwade( ) po.ovarre(self.outfile, "Divertor heat load (MW/m2)", "(hldiv)", dv.hldiv) return dv.hldiv + + +def init_divertor_variables(): + dv.anginc = 0.262 + dv.beta_div = 1.0 + dv.betai = 1.0 + dv.betao = 1.0 + dv.divclfr = 0.3 + dv.divdens = 1.0e4 + dv.dz_divertor = 0.2 + dv.divmas = 0.0 + dv.divplt = 0.035 + dv.divsur = 0.0 + dv.fdiva = 1.11 + dv.flux_exp = 2.0 + dv.hldiv = 0.0 + dv.i_hldiv = 2 + dv.hldivlim = 5.0 + dv.prn1 = 0.285 + dv.rconl = 0.0 + dv.rsrd = 0.0 + dv.tconl = 0.0 + dv.tdiv = 2.0 + dv.xpertin = 2.0 diff --git a/process/init.py b/process/init.py index b704fb3dd9..718a63ebb0 100644 --- a/process/init.py +++ b/process/init.py @@ -14,6 +14,7 @@ from process.costs import init_cost_variables from process.cs_fatigue import init_cs_fatigue_variables from process.dcll import init_dcll_module +from process.divertor import init_divertor_variables from process.exceptions import ProcessValidationError from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -216,7 +217,7 @@ def init_all_module_vars(): fortran.numerics.init_numerics() init_buildings_variables() init_cost_variables() - fortran.divertor_variables.init_divertor_variables() + init_divertor_variables() fortran.error_handling.init_error_handling() fortran.fwbs_variables.init_fwbs_variables() fortran.global_variables.init_global_variables() diff --git a/source/fortran/divertor_variables.f90 b/source/fortran/divertor_variables.f90 index 654b5fd1c5..9a35dc875e 100644 --- a/source/fortran/divertor_variables.f90 +++ b/source/fortran/divertor_variables.f90 @@ -82,32 +82,7 @@ module divertor_variables real(dp) :: xpertin !! perpendicular heat transport coefficient (m2/s) - contains - - subroutine init_divertor_variables - !! Initialise divertor_variables - implicit none - - anginc = 0.262D0 - beta_div = 1.0D0 - betai = 1.0D0 - betao = 1.0D0 - divclfr = 0.3D0 - divdens = 1.0D4 - dz_divertor = 0.2D0 - divmas = 0.0D0 - divplt = 0.035D0 - divsur = 0.0D0 - fdiva = 1.11D0 - flux_exp = 2.0D0 - hldiv = 0.0D0 - i_hldiv = 2 - hldivlim = 5.0D0 - prn1 = 0.285D0 - rconl = 0.0D0 - rsrd = 0.0D0 - tconl = 0.0D0 - tdiv = 2.0D0 - xpertin = 2.0D0 - end subroutine init_divertor_variables + real(dp) :: zeffdiv + !! Zeff in the divertor region (if `divdum/=0`) + end module divertor_variables From 59e2f4af64713f8e1ad89903eb4b9dec4f0c4670 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 14:40:51 +0000 Subject: [PATCH 08/34] Remove HCPB file units --- process/hcpb.py | 3 --- source/fortran/hcpb.f90 | 5 ----- tests/unit/test_ccfe_hcpb.py | 30 ------------------------------ 3 files changed, 38 deletions(-) diff --git a/process/hcpb.py b/process/hcpb.py index 271b12245c..08e596b74c 100644 --- a/process/hcpb.py +++ b/process/hcpb.py @@ -39,9 +39,6 @@ def __init__(self, blanket_library) -> None: self.blanket_library = blanket_library def run(self, output: bool): - ccfe_hcpb_module.ip = int(output) - ccfe_hcpb_module.ofile = self.outfile - # MDK (27/11/2015) build_variables.dr_fw_inboard = ( 2 * fwbs_variables.radius_fw_channel + 2 * fwbs_variables.dr_fw_wall diff --git a/source/fortran/hcpb.f90 b/source/fortran/hcpb.f90 index 59cd64257a..7e00c60872 100644 --- a/source/fortran/hcpb.f90 +++ b/source/fortran/hcpb.f90 @@ -16,9 +16,6 @@ module ccfe_hcpb_module implicit none - ! Variables for output to file - integer :: ip, ofile - ! Smeared densities of build sections real(dp) :: armour_density !! FW armour density [kg/m3] @@ -62,8 +59,6 @@ subroutine init_ccfe_hcpb_module !! Initialise module variables implicit none - ip = 0 - ofile = 0 armour_density = 0.0D0 fw_density = 0.0D0 blanket_density = 0.0D0 diff --git a/tests/unit/test_ccfe_hcpb.py b/tests/unit/test_ccfe_hcpb.py index 1728ff0f68..7d6f6cf80d 100644 --- a/tests/unit/test_ccfe_hcpb.py +++ b/tests/unit/test_ccfe_hcpb.py @@ -82,10 +82,6 @@ class NuclearHeatingMagnetsParam(NamedTuple): verbose: Any = None - ip: Any = None - - ofile: Any = None - armour_density: Any = None fw_density: Any = None @@ -155,8 +151,6 @@ class NuclearHeatingMagnetsParam(NamedTuple): whttf=19649856.627845347, whttflgs=0, verbose=0, - ip=0, - ofile=11, armour_density=0, fw_density=0, blanket_density=0, @@ -204,8 +198,6 @@ class NuclearHeatingMagnetsParam(NamedTuple): whttf=19662548.210142396, whttflgs=0, verbose=0, - ip=0, - ofile=11, armour_density=13202.434141839649, fw_density=5349.557730199961, blanket_density=2504.4899999999998, @@ -335,10 +327,6 @@ def test_nuclear_heating_magnets(nuclearheatingmagnetsparam, monkeypatch, ccfe_h monkeypatch.setattr(global_variables, "verbose", nuclearheatingmagnetsparam.verbose) - monkeypatch.setattr(ccfe_hcpb_module, "ip", nuclearheatingmagnetsparam.ip) - - monkeypatch.setattr(ccfe_hcpb_module, "ofile", nuclearheatingmagnetsparam.ofile) - monkeypatch.setattr( ccfe_hcpb_module, "armour_density", nuclearheatingmagnetsparam.armour_density ) @@ -726,8 +714,6 @@ class NuclearHeatingDivertorParam(NamedTuple): fusion_power: Any = None - ip: Any = None - expected_p_div_nuclear_heat_total_mw: Any = None @@ -740,7 +726,6 @@ class NuclearHeatingDivertorParam(NamedTuple): p_fw_hcd_nuclear_heat_mw=0, idivrt=1, fusion_power=1986.0623241661431, - ip=0, expected_p_div_nuclear_heat_total_mw=182.71773382328519, ), NuclearHeatingDivertorParam( @@ -749,7 +734,6 @@ class NuclearHeatingDivertorParam(NamedTuple): p_fw_hcd_nuclear_heat_mw=0, idivrt=1, fusion_power=1985.4423932312809, - ip=0, expected_p_div_nuclear_heat_total_mw=182.66070017727785, ), ), @@ -791,8 +775,6 @@ def test_nuclear_heating_divertor(nuclearheatingdivertorparam, monkeypatch, ccfe physics_variables, "fusion_power", nuclearheatingdivertorparam.fusion_power ) - monkeypatch.setattr(ccfe_hcpb_module, "ip", nuclearheatingdivertorparam.ip) - ccfe_hcpb.nuclear_heating_divertor() assert fwbs_variables.p_div_nuclear_heat_total_mw == pytest.approx( @@ -877,10 +859,6 @@ class PowerflowCalcParam(NamedTuple): htpmw_fw_blkt: Any = None - ip: Any = None - - ofile: Any = None - expected_p_div_rad_total_mw: Any = None expected_p_fw_rad_total_mw: Any = None @@ -938,8 +916,6 @@ class PowerflowCalcParam(NamedTuple): t_in_bb=573.13, t_out_bb=773.13, htpmw_fw_blkt=0, - ip=0, - ofile=11, expected_p_div_rad_total_mw=33.056596978820579, expected_p_fw_rad_total_mw=254.39207240222791, expected_psurffwi=97.271629070225231, @@ -987,8 +963,6 @@ class PowerflowCalcParam(NamedTuple): t_in_bb=573.13, t_out_bb=773.13, htpmw_fw_blkt=202.00455086503842, - ip=0, - ofile=11, expected_p_div_rad_total_mw=33.056596978820579, expected_p_fw_rad_total_mw=254.39207240222791, expected_psurffwi=97.271629070225259, @@ -1150,10 +1124,6 @@ def test_powerflow_calc(powerflowcalcparam, monkeypatch, ccfe_hcpb): primary_pumping_variables, "htpmw_fw_blkt", powerflowcalcparam.htpmw_fw_blkt ) - monkeypatch.setattr(ccfe_hcpb_module, "ip", powerflowcalcparam.ip) - - monkeypatch.setattr(ccfe_hcpb_module, "ofile", powerflowcalcparam.ofile) - ccfe_hcpb.powerflow_calc(False) assert fwbs_variables.p_div_rad_total_mw == pytest.approx( From c5725e2bcbef5535d0824ade2b3f8ba7c22df00c Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 14:42:55 +0000 Subject: [PATCH 09/34] Convert init_ccfe_hcpb_module to Python --- process/hcpb.py | 16 ++++++++++++++++ process/init.py | 3 ++- source/fortran/hcpb.f90 | 22 ---------------------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/process/hcpb.py b/process/hcpb.py index 08e596b74c..6c24187791 100644 --- a/process/hcpb.py +++ b/process/hcpb.py @@ -1471,3 +1471,19 @@ def write_output(self): "(divmas)", divertor_variables.divmas, ) + + +def init_ccfe_hcpb_module(): + ccfe_hcpb_module.armour_density = 0.0 + ccfe_hcpb_module.fw_density = 0.0 + ccfe_hcpb_module.blanket_density = 0.0 + ccfe_hcpb_module.shield_density = 0.0 + ccfe_hcpb_module.vv_density = 0.0 + ccfe_hcpb_module.x_blanket = 0.0 + ccfe_hcpb_module.x_shield = 0.0 + ccfe_hcpb_module.tfc_nuc_heating = 0.0 + ccfe_hcpb_module.fw_armour_u_nuc_heating = 0.0 + ccfe_hcpb_module.shld_u_nuc_heating = 0.0 + ccfe_hcpb_module.exp_blanket = 0.0 + ccfe_hcpb_module.exp_shield1 = 0.0 + ccfe_hcpb_module.exp_shield2 = 0.0 diff --git a/process/init.py b/process/init.py index 718a63ebb0..1fe1df2fc8 100644 --- a/process/init.py +++ b/process/init.py @@ -16,6 +16,7 @@ from process.dcll import init_dcll_module from process.divertor import init_divertor_variables from process.exceptions import ProcessValidationError +from process.hcpb import init_ccfe_hcpb_module from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -221,7 +222,7 @@ def init_all_module_vars(): fortran.error_handling.init_error_handling() fortran.fwbs_variables.init_fwbs_variables() fortran.global_variables.init_global_variables() - fortran.ccfe_hcpb_module.init_ccfe_hcpb_module() + init_ccfe_hcpb_module() fortran.heat_transport_variables.init_heat_transport_variables() fortran.ife_variables.init_ife_variables() fortran.impurity_radiation_module.init_impurity_radiation_module() diff --git a/source/fortran/hcpb.f90 b/source/fortran/hcpb.f90 index 7e00c60872..5c40939267 100644 --- a/source/fortran/hcpb.f90 +++ b/source/fortran/hcpb.f90 @@ -52,26 +52,4 @@ module ccfe_hcpb_module real(dp) :: exp_blanket, exp_shield1, exp_shield2 !! Exponential factors in nuclear heating calcs - -contains - - subroutine init_ccfe_hcpb_module - !! Initialise module variables - implicit none - - armour_density = 0.0D0 - fw_density = 0.0D0 - blanket_density = 0.0D0 - shield_density = 0.0D0 - vv_density = 0.0D0 - x_blanket = 0.0D0 - x_shield = 0.0D0 - tfc_nuc_heating = 0.0D0 - fw_armour_u_nuc_heating = 0.0D0 - shld_u_nuc_heating = 0.0D0 - exp_blanket = 0.0D0 - exp_shield1 = 0.0D0 - exp_shield2 = 0.0D0 - end subroutine init_ccfe_hcpb_module - end module ccfe_hcpb_module From 88e65d43ce67d262b7e24639c695d8c40b40cfa4 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 14:57:10 +0000 Subject: [PATCH 10/34] Convert init_impurity_radiation_module to Python --- process/impurity_radiation.py | 48 +++++++++++++++++++-- process/init.py | 3 +- source/fortran/impurity_radiation.f90 | 62 +++------------------------ tests/unit/test_impurity_radiation.py | 3 +- tests/unit/test_physics.py | 4 +- 5 files changed, 54 insertions(+), 66 deletions(-) diff --git a/process/impurity_radiation.py b/process/impurity_radiation.py index 9cc75ad31d..b6dd34859f 100644 --- a/process/impurity_radiation.py +++ b/process/impurity_radiation.py @@ -441,10 +441,6 @@ def pimpden(imp_element_index, neprofile, teprofile): pimpden[less_than_imp_temp_mask] = impurity_radiation_module.impurity_arr_lz_wm3[ imp_element_index, 0 ] - # if not impurity_radiation_module.toolow: # Only print warning once during a run - # impurity_radiation_module.toolow = True - # error_handling.fdiags[0] = teprofile - # error_handling.report_error(35) greater_than_imp_temp_mask = ( teprofile @@ -567,3 +563,47 @@ def calculate_imprad(self): self.map_imprad_profile() self.calculate_radiation_loss_profiles() self.integrate_radiation_loss_profiles() + + +def init_impurity_radiation_module(): + impurity_radiation_module.radius_plasma_core_norm = 0.6 + impurity_radiation_module.coreradiationfraction = 1.0 + impurity_radiation_module.fimp = [ + 1.0, + 0.1, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ] + impurity_radiation_module.imp_label = [ + "H_", + "He", + "Be", + "C_", + "N_", + "O_", + "Ne", + "Si", + "Ar", + "Fe", + "Ni", + "Kr", + "Xe", + "W_", + ] + impurity_radiation_module.impurity_arr_label[:] = " " + impurity_radiation_module.impurity_arr_z[:] = 0 + impurity_radiation_module.impurity_arr_amass[:] = 0.0 + impurity_radiation_module.impurity_arr_len_tab[:] = 0.0 + impurity_radiation_module.impurity_arr_temp_kev[:] = 0.0 + impurity_radiation_module.impurity_arr_lz_wm3[:] = 0.0 + impurity_radiation_module.impurity_arr_zav[:] = 0.0 diff --git a/process/init.py b/process/init.py index 1fe1df2fc8..9b33bafcb6 100644 --- a/process/init.py +++ b/process/init.py @@ -17,6 +17,7 @@ from process.divertor import init_divertor_variables from process.exceptions import ProcessValidationError from process.hcpb import init_ccfe_hcpb_module +from process.impurity_radiation import init_impurity_radiation_module from process.input import parse_input_file from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -225,7 +226,7 @@ def init_all_module_vars(): init_ccfe_hcpb_module() fortran.heat_transport_variables.init_heat_transport_variables() fortran.ife_variables.init_ife_variables() - fortran.impurity_radiation_module.init_impurity_radiation_module() + init_impurity_radiation_module() fortran.pfcoil_module.init_pfcoil_module() fortran.physics_module.init_physics_module() fortran.physics_variables.init_physics_variables() diff --git a/source/fortran/impurity_radiation.f90 b/source/fortran/impurity_radiation.f90 index 3b1309b9ed..dc541d8e45 100644 --- a/source/fortran/impurity_radiation.f90 +++ b/source/fortran/impurity_radiation.f90 @@ -21,30 +21,24 @@ module impurity_radiation_module #endif implicit none - private - public :: init_impurity_radiation_module, impurity_arr_amass, impurity_arr_frac, & - impurity_arr_Label,impurity_arr_len_tab, impurity_arr_Lz_Wm3, & - impurity_arr_Temp_keV, impurity_arr_Z, impurity_arr_Zav - - !! (It is recommended to turn on !! constraint eqn.17 with iteration variable 28: fradpwr.) - integer, public, parameter :: n_impurities = 14 + integer, parameter :: n_impurities = 14 !! n_impurities /14/ FIX : number of ion species in impurity radiation model - real(dp), public :: radius_plasma_core_norm + real(dp) :: radius_plasma_core_norm !! radius_plasma_core_norm /0.6/ : normalised radius defining the 'core' region - real(dp), public :: coreradiationfraction + real(dp) :: coreradiationfraction !! coreradiationfraction /1.0/ : fraction of radiation from 'core' region that is subtracted from the loss power !! fimp(n_impurities) /1.0,0.1,0.02,0.0,0.0,0.0,0.0,0.0,0.0016,0.0,0.0,0.0,0.0,0.0/ : !! impurity number density fractions relative to electron density !! - real(dp), public, dimension(n_impurities) :: fimp + real(dp), dimension(n_impurities) :: fimp - character*2, public, dimension(n_impurities) :: imp_label + character*2, dimension(n_impurities) :: imp_label !! imp_label(n_impurities) : impurity ion species names:
    !!
  • ( 1) Hydrogen (fraction calculated by code) !!
  • ( 2) Helium @@ -98,50 +92,4 @@ module impurity_radiation_module real(dp), dimension(n_impurities, all_array_hotfix_len) :: impurity_arr_Lz_Wm3 real(dp), dimension(n_impurities, all_array_hotfix_len) :: impurity_arr_Zav - -! type(imp_dat), dimension(n_impurities), save, public :: impurity_arr - - logical, public :: toolow - !! Used for reporting error in function pimpden - -contains - - ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - subroutine init_impurity_radiation_module - !! Initialise module variables - implicit none - - radius_plasma_core_norm = 0.6D0 - coreradiationfraction = 1.0D0 - fimp = (/ 1.0D0, 0.1D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.00D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0 /) - imp_label = (/ & - 'H_', & - 'He', & - 'Be', & - 'C_', & - 'N_', & - 'O_', & - 'Ne', & - 'Si', & - 'Ar', & - 'Fe', & - 'Ni', & - 'Kr', & - 'Xe', & - 'W_'/) - toolow = .false. - impurity_arr_Label = " " - impurity_arr_Z = 0 - impurity_arr_amass = 0.0D0 - impurity_arr_len_tab = 0.0D0 - impurity_arr_Temp_keV = 0.0D0 - impurity_arr_Lz_Wm3 = 0.0D0 - impurity_arr_Zav = 0.0D0 - ! Re-initialise entire array - end subroutine init_impurity_radiation_module - - ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - end module impurity_radiation_module diff --git a/tests/unit/test_impurity_radiation.py b/tests/unit/test_impurity_radiation.py index 833ef652dd..a092954ecd 100644 --- a/tests/unit/test_impurity_radiation.py +++ b/tests/unit/test_impurity_radiation.py @@ -6,12 +6,11 @@ import pytest import process.impurity_radiation as impurity_radiation -from process.fortran import impurity_radiation_module @pytest.fixture(autouse=True) def initialise_impurity_radiation(): - impurity_radiation_module.init_impurity_radiation_module() + impurity_radiation.init_impurity_radiation_module() impurity_radiation.initialise_imprad() diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 22f6f2afcd..c18f3f94df 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -13,7 +13,7 @@ physics_module, physics_variables, ) -from process.impurity_radiation import initialise_imprad +from process.impurity_radiation import init_impurity_radiation_module, initialise_imprad from process.physics import ( Physics, calculate_beta_limit, @@ -1498,7 +1498,7 @@ def test_plasma_composition(plasmacompositionparam, monkeypatch, physics): :param monkeypatch: pytest fixture used to mock module/class variables :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - impurity_radiation_module.init_impurity_radiation_module() + init_impurity_radiation_module() initialise_imprad() monkeypatch.setattr( From fcb5d8a1ddd63647dc3950ea3e2b8bf764c8e26f Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 15:13:30 +0000 Subject: [PATCH 11/34] Convert init_pfcoil_module to Python --- process/init.py | 3 ++- process/pfcoil.py | 24 +++++++++++++++++++++++- source/fortran/pfcoil.f90 | 29 ----------------------------- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/process/init.py b/process/init.py index 9b33bafcb6..51c5d32a09 100644 --- a/process/init.py +++ b/process/init.py @@ -19,6 +19,7 @@ from process.hcpb import init_ccfe_hcpb_module from process.impurity_radiation import init_impurity_radiation_module from process.input import parse_input_file +from process.pfcoil import init_pfcoil_module from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -227,7 +228,7 @@ def init_all_module_vars(): fortran.heat_transport_variables.init_heat_transport_variables() fortran.ife_variables.init_ife_variables() init_impurity_radiation_module() - fortran.pfcoil_module.init_pfcoil_module() + init_pfcoil_module() fortran.physics_module.init_physics_module() fortran.physics_variables.init_physics_variables() fortran.scan_module.init_scan_module() diff --git a/process/pfcoil.py b/process/pfcoil.py index 8e650e978f..aff20fb69b 100644 --- a/process/pfcoil.py +++ b/process/pfcoil.py @@ -36,7 +36,7 @@ def __init__(self, cs_fatigue) -> None: """Initialise Fortran module variables.""" self.outfile = ft.constants.nout # output file unit self.mfile = ft.constants.mfile # mfile file unit - pf.init_pfcoil_module() + init_pfcoil_module() self.cs_fatigue = cs_fatigue def run(self): @@ -3486,3 +3486,25 @@ def mtrx( gmat = np.asfortranarray(gmat) return nrws, gmat, bvec + + +def init_pfcoil_module(): + pf.first_call = True + pf.cslimit = False + pf.nef = 0.0 + pf.nfxf = 0.0 + pf.ricpf = 0.0 + pf.ssq0 = 0.0 + pf.sig_axial = 0.0 + pf.sig_hoop = 0.0 + pf.axial_force = 0 + pf.rfxf[:] = 0.0 + pf.zfxf[:] = 0.0 + pf.cfxf[:] = 0.0 + pf.xind[:] = 0.0 + pf.rcls[:] = 0.0 + pf.zcls[:] = 0.0 + pf.ccls[:] = 0.0 + pf.ccl0[:] = 0.0 + pf.bpf2[:] = 0.0 + pf.vsdum[:] = 0.0 diff --git a/source/fortran/pfcoil.f90 b/source/fortran/pfcoil.f90 index 1fda860f45..43a6fa1e36 100644 --- a/source/fortran/pfcoil.f90 +++ b/source/fortran/pfcoil.f90 @@ -44,33 +44,4 @@ module pfcoil_module type(volume_fractions), private :: conductorpf type(supercon_strand), private ::croco_strand - - contains - - ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - subroutine init_pfcoil_module - !! Initialise module variables - implicit none - - first_call = .true. - CSlimit = .false. - nef = 0 - nfxf = 0 - ricpf = 0.0D0 - ssq0 = 0.0D0 - sig_axial = 0.0D0 - sig_hoop = 0D0 - axial_force = 0D0 - rfxf = 0.0D0 - zfxf = 0.0D0 - cfxf = 0.0D0 - xind = 0.0D0 - rcls = 0.0D0 - zcls = 0.0D0 - ccls = 0.0D0 - ccl0 = 0.0D0 - bpf2 = 0.0D0 - vsdum = 0.0D0 - end subroutine init_pfcoil_module end module pfcoil_module From d4e46864105ddcbd056273331706fd76c7c28e77 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 15:38:59 +0000 Subject: [PATCH 12/34] Convert init_physics_variables to Python --- process/init.py | 3 +- process/physics.py | 233 ++++++++++++++++++++++++++ source/fortran/physics_variables.f90 | 239 --------------------------- 3 files changed, 235 insertions(+), 240 deletions(-) diff --git a/process/init.py b/process/init.py index 51c5d32a09..1a302d3a8a 100644 --- a/process/init.py +++ b/process/init.py @@ -20,6 +20,7 @@ from process.impurity_radiation import init_impurity_radiation_module from process.input import parse_input_file from process.pfcoil import init_pfcoil_module +from process.physics import init_physics_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -230,7 +231,7 @@ def init_all_module_vars(): init_impurity_radiation_module() init_pfcoil_module() fortran.physics_module.init_physics_module() - fortran.physics_variables.init_physics_variables() + init_physics_variables() fortran.scan_module.init_scan_module() fortran.sctfcoil_module.init_sctfcoil_module() fortran.stellarator_module.init_stellarator_module() diff --git a/process/physics.py b/process/physics.py index a02dea779b..d49bc418c9 100644 --- a/process/physics.py +++ b/process/physics.py @@ -7970,3 +7970,236 @@ def reinke_tsep(bt, flh, qstar, rmajor, eps, fgw, kappa, lhat): * (eps**0.15 * (1.0 + kappa**2.0) ** 0.34) * (lhat**0.29 * kappa_0 ** (-0.29) * 0.285) ) + + +def init_physics_variables(): + physics_variables.m_beam_amu = 0.0 + physics_variables.m_fuel_amu = 0.0 + physics_variables.m_ions_total_amu = 0.0 + physics_variables.m_plasma_fuel_ions = 0.0 + physics_variables.m_plasma_ions_total = 0.0 + physics_variables.m_plasma_alpha = 0.0 + physics_variables.m_plasma_electron = 0.0 + physics_variables.m_plasma = 0.0 + physics_variables.alphaj = 1.0 + physics_variables.alphan = 0.25 + physics_variables.alphap = 0.0 + physics_variables.alpha_rate_density_total = 0.0 + physics_variables.alpha_rate_density_plasma = 0.0 + physics_variables.alphat = 0.5 + physics_variables.aspect = 2.907 + physics_variables.beamfus0 = 1.0 + physics_variables.beta = 0.042 + physics_variables.beta_fast_alpha = 0.0 + physics_variables.beta_max = 0.0 + physics_variables.beta_min = 0.0 + physics_variables.beta_beam = 0.0 + physics_variables.beta_poloidal = 0.0 + physics_variables.beta_poloidal_eps = 0.0 + physics_variables.beta_toroidal = 0.0 + physics_variables.beta_thermal = 0.0 + physics_variables.beta_thermal_poloidal = 0.0 + physics_variables.beta_thermal_toroidal = 0.0 + physics_variables.beta_norm_total = 0.0 + physics_variables.beta_norm_thermal = 0.0 + physics_variables.beta_norm_poloidal = 0.0 + physics_variables.e_plasma_beta_thermal = 0.0 + physics_variables.beta_norm_toroidal = 0.0 + physics_variables.betbm0 = 1.5 + physics_variables.bp = 0.0 + physics_variables.bt = 5.68 + physics_variables.btot = 0.0 + physics_variables.burnup = 0.0 + physics_variables.burnup_in = 0.0 + physics_variables.bvert = 0.0 + physics_variables.c_beta = 0.5 + physics_variables.csawth = 1.0 + physics_variables.f_vol_plasma = 1.0 + physics_variables.f_r_conducting_wall = 1.35 + physics_variables.dene = 9.8e19 + physics_variables.nd_fuel_ions = 0.0 + physics_variables.dlamee = 0.0 + physics_variables.dlamie = 0.0 + physics_variables.dlimit[:] = 0.0 + physics_variables.nd_alphas = 0.0 + physics_variables.nd_beam_ions = 0.0 + physics_variables.beam_density_out = 0.0 + physics_variables.beta_norm_max = 3.5 + physics_variables.dnelimt = 0.0 + physics_variables.nd_ions_total = 0.0 + physics_variables.dnla = 0.0 + physics_variables.nd_protons = 0.0 + physics_variables.ntau = 0.0 + physics_variables.nTtau = 0.0 + physics_variables.nd_impurities = 0.0 + physics_variables.beta_poloidal_eps_max = 1.38 + physics_variables.eps = 0.34399724802 + physics_variables.aux_current_fraction = 0.0 + physics_variables.inductive_current_fraction = 0.0 + physics_variables.f_alpha_electron = 0.0 + physics_variables.f_alpha_plasma = 0.95 + physics_variables.f_alpha_ion = 0.0 + physics_variables.f_deuterium = 0.5 + physics_variables.ftar = 1.0 + physics_variables.ffwal = 0.92 + physics_variables.fgwped = 0.85 + physics_variables.fgwsep = 0.50 + physics_variables.f_helium3 = 0.0 + physics_variables.figmer = 0.0 + physics_variables.fkzohm = 1.0 + physics_variables.fplhsep = 1.0 + physics_variables.fpdivlim = 1.0 + physics_variables.fne0 = 1.0 + physics_variables.f_tritium = 0.5 + physics_variables.fusion_rate_density_total = 0.0 + physics_variables.fusion_rate_density_plasma = 0.0 + physics_variables.fvsbrnni = 1.0 + physics_variables.ejima_coeff = 0.4 + physics_variables.f_beta_alpha_beam_thermal = 0.0 + physics_variables.hfac[:] = 0.0 + physics_variables.hfact = 1.0 + physics_variables.taumax = 10.0 + physics_variables.i_bootstrap_current = 3 + physics_variables.i_beta_component = 0 + physics_variables.i_plasma_current = 4 + physics_variables.i_diamagnetic_current = 0 + physics_variables.i_density_limit = 8 + physics_variables.idivrt = 2 + physics_variables.i_beta_fast_alpha = 1 + physics_variables.ignite = 0 + physics_variables.ipedestal = 1 + physics_variables.i_pfirsch_schluter_current = 0 + physics_variables.neped = 4.0e19 + physics_variables.nesep = 3.0e19 + physics_variables.alpha_crit = 0.0 + physics_variables.nesep_crit = 0.0 + physics_variables.plasma_res_factor = 1.0 + physics_variables.rhopedn = 1.0 + physics_variables.rhopedt = 1.0 + physics_variables.tbeta = 2.0 + physics_variables.teped = 1.0 + physics_variables.tesep = 0.1 + physics_variables.iprofile = 1 + physics_variables.i_rad_loss = 1 + physics_variables.i_confinement_time = 34 + physics_variables.i_plasma_wall_gap = 1 + physics_variables.i_plasma_geometry = 0 + physics_variables.i_plasma_shape = 0 + physics_variables.itart = 0 + physics_variables.itartpf = 0 + physics_variables.iwalld = 1 + physics_variables.plasma_square = 0.0 + physics_variables.kappa = 1.792 + physics_variables.kappa95 = 1.6 + physics_variables.kappa_ipb = 0.0 + physics_variables.ne0 = 0.0 + physics_variables.ni0 = 0.0 + physics_variables.m_s_limit = 0.3 + physics_variables.p0 = 0.0 + physics_variables.j_plasma_0 = 0.0 + physics_variables.f_dd_branching_trit = 0.0 + physics_variables.alpha_power_density_plasma = 0.0 + physics_variables.alpha_power_density_total = 0.0 + physics_variables.alpha_power_electron_density = 0.0 + physics_variables.p_fw_alpha_mw = 0.0 + physics_variables.alpha_power_ions_density = 0.0 + physics_variables.alpha_power_total = 0.0 + physics_variables.alpha_power_plasma = 0.0 + physics_variables.alpha_power_beams = 0.0 + physics_variables.non_alpha_charged_power = 0.0 + physics_variables.charged_power_density = 0.0 + physics_variables.pcoef = 0.0 + physics_variables.p_plasma_inner_rad_mw = 0.0 + physics_variables.pden_plasma_core_rad_mw = 0.0 + physics_variables.dd_power = 0.0 + physics_variables.dhe3_power = 0.0 + physics_variables.pdivt = 0.0 + physics_variables.pdivl = 0.0 + physics_variables.pdivu = 0.0 + physics_variables.pdivmax = 0.0 + physics_variables.dt_power_total = 0.0 + physics_variables.dt_power_plasma = 0.0 + physics_variables.p_plasma_outer_rad_mw = 0.0 + physics_variables.pden_plasma_outer_rad_mw = 0.0 + physics_variables.charged_particle_power = 0.0 + physics_variables.vs_plasma_internal = 0.0 + physics_variables.pflux_fw_rad_mw = 0.0 + physics_variables.piepv = 0.0 + physics_variables.plasma_current = 0.0 + physics_variables.neutron_power_plasma = 0.0 + physics_variables.neutron_power_total = 0.0 + physics_variables.neutron_power_density_total = 0.0 + physics_variables.neutron_power_density_plasma = 0.0 + physics_variables.p_plasma_ohmic_mw = 0.0 + physics_variables.pden_plasma_ohmic_mw = 0.0 + physics_variables.p_plasma_loss_mw = 0.0 + physics_variables.fusion_power = 0.0 + physics_variables.len_plasma_poloidal = 0.0 + physics_variables.p_plasma_rad_mw = 0.0 + physics_variables.pden_plasma_rad_mw = 0.0 + physics_variables.pradsolmw = 0.0 + physics_variables.proton_rate_density = 0.0 + physics_variables.psolradmw = 0.0 + physics_variables.pden_plasma_sync_mw = 0.0 + physics_variables.p_plasma_sync_mw = 0.0 + physics_variables.i_l_h_threshold = 19 + physics_variables.p_l_h_threshold_mw = 0.0 + physics_variables.l_h_threshold_powers[:] = 0.0 + physics_variables.p_electron_transport_loss_mw = 0.0 + physics_variables.pden_electron_transport_loss_mw = 0.0 + physics_variables.p_ion_transport_loss_mw = 0.0 + physics_variables.pscalingmw = 0.0 + physics_variables.pden_ion_transport_loss_mw = 0.0 + physics_variables.q0 = 1.0 + physics_variables.q95 = 0.0 + physics_variables.qfuel = 0.0 + physics_variables.tauratio = 1.0 + physics_variables.q95_min = 0.0 + physics_variables.qstar = 0.0 + physics_variables.rad_fraction_sol = 0.8 + physics_variables.rad_fraction_total = 0.0 + physics_variables.f_nd_alpha_electron = 0.1 + physics_variables.f_nd_protium_electrons = 0.0 + physics_variables.ind_plasma_internal_norm = 0.9 + physics_variables.ind_plasma = 0.0 + physics_variables.rmajor = 8.14 + physics_variables.rminor = 0.0 + physics_variables.f_nd_beam_electron = 0.005 + physics_variables.rncne = 0.0 + physics_variables.rndfuel = 0.0 + physics_variables.rnfene = 0.0 + physics_variables.rnone = 0.0 + physics_variables.f_res_plasma_neo = 0.0 + physics_variables.res_plasma = 0.0 + physics_variables.t_plasma_res_diffusion = 0.0 + physics_variables.a_plasma_surface = 0.0 + physics_variables.a_plasma_surface_outboard = 0.0 + physics_variables.i_single_null = 1 + physics_variables.f_sync_reflect = 0.6 + physics_variables.t_electron_energy_confinement = 0.0 + physics_variables.tauee_in = 0.0 + physics_variables.t_energy_confinement = 0.0 + physics_variables.t_ion_energy_confinement = 0.0 + physics_variables.t_alpha_confinement = 0.0 + physics_variables.f_alpha_energy_confinement = 0.0 + physics_variables.te = 12.9 + physics_variables.te0 = 0.0 + physics_variables.ten = 0.0 + physics_variables.ti = 12.9 + physics_variables.ti0 = 0.0 + physics_variables.tin = 0.0 + physics_variables.tratio = 1.0 + physics_variables.triang = 0.36 + physics_variables.triang95 = 0.24 + physics_variables.vol_plasma = 0.0 + physics_variables.vs_plasma_burn_required = 0.0 + physics_variables.v_plasma_loop_burn = 0.0 + physics_variables.vshift = 0.0 + physics_variables.vs_plasma_ind_ramp = 0.0 + physics_variables.vs_plasma_res_ramp = 0.0 + physics_variables.vs_plasma_total_required = 0.0 + physics_variables.pflux_fw_neutron_mw = 0.0 + physics_variables.wtgpd = 0.0 + physics_variables.a_plasma_poloidal = 0.0 + physics_variables.zeff = 0.0 + physics_variables.zeffai = 0.0 diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 1b9b3f43fe..9c1f1c739f 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -908,243 +908,4 @@ module physics_variables real(dp) :: zeffai !! mass weighted plasma effective charge - - contains - - subroutine init_physics_variables - !! Initialise module variables - implicit none - - m_beam_amu = 0.0D0 - m_fuel_amu = 0.0D0 - m_ions_total_amu = 0.0D0 - m_plasma_fuel_ions = 0.0D0 - m_plasma_ions_total = 0.0D0 - m_plasma_alpha = 0.0D0 - m_plasma_electron = 0.0D0 - m_plasma = 0.0D0 - alphaj = 1.0D0 - alphan = 0.25D0 - alphap = 0.0D0 - alpha_rate_density_total = 0.0D0 - alpha_rate_density_plasma = 0.0D0 - alphat = 0.5D0 - aspect = 2.907D0 - beamfus0 = 1.0D0 - beta = 0.042D0 - beta_fast_alpha = 0.0D0 - beta_max = 0.0D0 - beta_min = 0.0D0 - beta_beam = 0.0D0 - beta_poloidal = 0.0D0 - beta_poloidal_eps = 0.0D0 - beta_toroidal = 0.0D0 - beta_thermal = 0.0D0 - beta_thermal_poloidal = 0.0D0 - beta_thermal_toroidal = 0.0D0 - beta_norm_total = 0.0D0 - beta_norm_thermal = 0.0D0 - beta_norm_poloidal = 0.0D0 - e_plasma_beta_thermal = 0.0D0 - beta_norm_toroidal = 0.0D0 - betbm0 = 1.5D0 - bp = 0.0D0 - bt = 5.68D0 - btot = 0.0D0 - burnup = 0.0D0 - burnup_in = 0.0D0 - bvert = 0.0D0 - c_beta = 0.5D0 - csawth = 1.0D0 - f_vol_plasma = 1.0D0 - f_r_conducting_wall = 1.35D0 - dene = 9.8D19 - nd_fuel_ions = 0.0D0 - dlamee = 0.0D0 - dlamie = 0.0D0 - dlimit = 0.0D0 - nd_alphas = 0.0D0 - nd_beam_ions = 0.0D0 - beam_density_out = 0.0D0 - beta_norm_max = 3.5D0 - dnelimt = 0.0D0 - nd_ions_total = 0.0D0 - dnla = 0.0D0 - nd_protons = 0.0D0 - ntau = 0.0D0 - nTtau = 0.0D0 - nd_impurities = 0.0D0 - beta_poloidal_eps_max = 1.38D0 - eps = 0.34399724802D0 - aux_current_fraction = 0.0D0 - inductive_current_fraction = 0.0D0 - f_alpha_electron = 0.0D0 - f_alpha_plasma = 0.95D0 - f_alpha_ion = 0.0D0 - f_deuterium = 0.5D0 - ftar = 1.0D0 - ffwal = 0.92D0 - fgwped = 0.85D0 - fgwsep = 0.50D0 - f_helium3 = 0.0D0 - figmer = 0.0D0 - fkzohm = 1.0D0 - fplhsep = 1.0D0 - fpdivlim = 1.0D0 - fne0 = 1.0D0 - f_tritium = 0.5D0 - fusion_rate_density_total = 0.0D0 - fusion_rate_density_plasma = 0.0D0 - fvsbrnni = 1.0D0 - ejima_coeff = 0.4D0 - f_beta_alpha_beam_thermal = 0.0D0 - hfac = 0.0D0 - hfact = 1.0D0 - taumax = 10.0D0 - i_bootstrap_current = 3 - i_beta_component = 0 - i_plasma_current = 4 - i_diamagnetic_current = 0 - i_density_limit = 8 - idivrt = 2 - i_beta_fast_alpha = 1 - ignite = 0 - ipedestal = 1 - i_pfirsch_schluter_current = 0 - neped = 4.0D19 - nesep = 3.0D19 - alpha_crit = 0.0D0 - nesep_crit = 0.0D0 - plasma_res_factor = 1.0D0 - rhopedn = 1.0D0 - rhopedt = 1.0D0 - tbeta = 2.0D0 - teped = 1.0D0 - tesep = 0.1D0 - iprofile = 1 - i_rad_loss = 1 - i_confinement_time = 34 - i_plasma_wall_gap = 1 - i_plasma_geometry = 0 - i_plasma_shape = 0 - itart = 0 - itartpf = 0 - iwalld = 1 - plasma_square = 0.0D0 - kappa = 1.792D0 - kappa95 = 1.6D0 - - kappa_ipb = 0.d0 - ne0 = 0.0D0 - ni0 = 0.0D0 - m_s_limit = 0.3D0 - p0 = 0.0D0 - j_plasma_0 = 0.0D0 - f_dd_branching_trit = 0.0D0 - alpha_power_density_plasma = 0.0D0 - alpha_power_density_total = 0.0D0 - alpha_power_electron_density = 0.0D0 - p_fw_alpha_mw = 0.0D0 - alpha_power_ions_density = 0.0D0 - alpha_power_total = 0.0D0 - alpha_power_plasma = 0.0D0 - alpha_power_beams = 0.0D0 - non_alpha_charged_power = 0.0D0 - charged_power_density = 0.0D0 - pcoef = 0.0D0 - p_plasma_inner_rad_mw = 0.0D0 - pden_plasma_core_rad_mw = 0.0D0 - dd_power = 0.0D0 - dhe3_power = 0.0D0 - pdivt = 0.0D0 - pdivl = 0.0D0 - pdivu = 0.0D0 - pdivmax = 0.0D0 - dt_power_total = 0.0D0 - dt_power_plasma = 0.0D0 - p_plasma_outer_rad_mw = 0.0D0 - pden_plasma_outer_rad_mw = 0.0D0 - charged_particle_power = 0.0D0 - vs_plasma_internal = 0.0D0 - pflux_fw_rad_mw = 0.0D0 - piepv = 0.0D0 - plasma_current = 0.0D0 - neutron_power_plasma = 0.0D0 - neutron_power_total = 0.0D0 - neutron_power_density_total = 0.0D0 - neutron_power_density_plasma = 0.0D0 - p_plasma_ohmic_mw = 0.0D0 - pden_plasma_ohmic_mw = 0.0D0 - p_plasma_loss_mw = 0.0D0 - fusion_power = 0.0D0 - len_plasma_poloidal = 0.0D0 - p_plasma_rad_mw = 0.0D0 - pden_plasma_rad_mw = 0.0D0 - pradsolmw = 0.0D0 - proton_rate_density = 0.0D0 - psolradmw = 0.0D0 - pden_plasma_sync_mw = 0.0D0 - p_plasma_sync_mw = 0.0D0 - i_l_h_threshold = 19 - p_l_h_threshold_mw = 0.0D0 - l_h_threshold_powers = 0.0D0 - p_electron_transport_loss_mw = 0.0D0 - pden_electron_transport_loss_mw = 0.0D0 - p_ion_transport_loss_mw = 0.0D0 - pscalingmw = 0.0D0 - pden_ion_transport_loss_mw = 0.0D0 - q0 = 1.0D0 - q95 = 0.0D0 - qfuel = 0.0D0 - tauratio = 1.0D0 - q95_min = 0.0D0 - qstar = 0.0D0 - rad_fraction_sol = 0.8D0 - rad_fraction_total = 0.0D0 - f_nd_alpha_electron = 0.10D0 - f_nd_protium_electrons = 0.0D0 - ind_plasma_internal_norm = 0.9D0 - ind_plasma = 0.0D0 - rmajor = 8.14D0 - rminor = 0.0D0 - f_nd_beam_electron = 0.005D0 - rncne = 0.0D0 - rndfuel = 0.0D0 - rnfene = 0.0D0 - rnone = 0.0D0 - f_res_plasma_neo = 0.0D0 - res_plasma = 0.0D0 - t_plasma_res_diffusion = 0.0D0 - a_plasma_surface = 0.0D0 - a_plasma_surface_outboard = 0.0D0 - i_single_null = 1 - f_sync_reflect = 0.6D0 - t_electron_energy_confinement = 0.0D0 - tauee_in = 0.0D0 - t_energy_confinement = 0.0D0 - t_ion_energy_confinement = 0.0D0 - t_alpha_confinement = 0.0D0 - f_alpha_energy_confinement = 0.0D0 - te = 12.9D0 - te0 = 0.0D0 - ten = 0.0D0 - ti = 12.9D0 - ti0 = 0.0D0 - tin = 0.0D0 - tratio = 1.0D0 - triang = 0.36D0 - triang95 = 0.24D0 - vol_plasma = 0.0D0 - vs_plasma_burn_required = 0.0D0 - v_plasma_loop_burn = 0.0D0 - vshift = 0.0D0 - vs_plasma_ind_ramp = 0.0D0 - vs_plasma_res_ramp = 0.0D0 - vs_plasma_total_required = 0.0D0 - pflux_fw_neutron_mw = 0.0D0 - wtgpd = 0.0D0 - a_plasma_poloidal = 0.0D0 - zeff = 0.0D0 - zeffai = 0.0D0 - end subroutine init_physics_variables end module physics_variables From 879f6970a327a379b8c7760f19920fb0893bd69c Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 15:58:40 +0000 Subject: [PATCH 13/34] Convert init_sctfcoil_module to Python --- process/init.py | 3 +- process/superconducting_tf_coil.py | 47 +++++++++++++++++++++++++++ source/fortran/sctfcoil.f90 | 51 ------------------------------ 3 files changed, 49 insertions(+), 52 deletions(-) diff --git a/process/init.py b/process/init.py index 1a302d3a8a..891a34c06e 100644 --- a/process/init.py +++ b/process/init.py @@ -21,6 +21,7 @@ from process.input import parse_input_file from process.pfcoil import init_pfcoil_module from process.physics import init_physics_variables +from process.sctfcoil import init_sctfcoil_module from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -233,7 +234,7 @@ def init_all_module_vars(): fortran.physics_module.init_physics_module() init_physics_variables() fortran.scan_module.init_scan_module() - fortran.sctfcoil_module.init_sctfcoil_module() + init_sctfcoil_module() fortran.stellarator_module.init_stellarator_module() fortran.stellarator_variables.init_stellarator_variables() fortran.tfcoil_variables.init_tfcoil_variables() diff --git a/process/superconducting_tf_coil.py b/process/superconducting_tf_coil.py index 58ec92fbca..f269faff38 100644 --- a/process/superconducting_tf_coil.py +++ b/process/superconducting_tf_coil.py @@ -3829,3 +3829,50 @@ def _inductance_factor( + 0.7629 * aspect_ratio**2 - 0.06298 * (theta1 / 90) ) + + +def init_sctfcoil_module(): + sctfcoil_module.is_leg_cp_temp_same = 0 + sctfcoil_module.tf_fit_t = 0.0 + sctfcoil_module.tf_fit_z = 0.0 + sctfcoil_module.tf_fit_y = 0.0 + sctfcoil_module.tfc_current = 0.0 + sctfcoil_module.awpc = 0.0 + sctfcoil_module.awptf = 0.0 + sctfcoil_module.a_tf_steel = 0.0 + sctfcoil_module.a_tf_ins = 0.0 + sctfcoil_module.f_tf_steel = 0.0 + sctfcoil_module.f_tf_ins = 0.0 + sctfcoil_module.h_cp_top = 0.0 + sctfcoil_module.r_tf_outboard_in = 0.0 + sctfcoil_module.r_tf_outboard_out = 0.0 + sctfcoil_module.r_wp_inner = 0.0 + sctfcoil_module.r_wp_outer = 0.0 + sctfcoil_module.r_wp_centre = 0.0 + sctfcoil_module.dr_tf_wp_top = 0.0 + sctfcoil_module.vol_ins_cp = 0.0 + sctfcoil_module.vol_gr_ins_cp = 0.0 + sctfcoil_module.vol_case_cp = 0.0 + sctfcoil_module.t_wp_toroidal = 0.0 + sctfcoil_module.t_wp_toroidal_av = 0.0 + sctfcoil_module.t_lat_case_av = 0.0 + sctfcoil_module.a_case_front = 0.0 + sctfcoil_module.a_case_nose = 0.0 + sctfcoil_module.a_ground_ins = 0.0 + sctfcoil_module.a_leg_ins = 0.0 + sctfcoil_module.a_leg_gr_ins = 0.0 + sctfcoil_module.a_leg_cond = 0.0 + sctfcoil_module.theta_coil = 0.0 + sctfcoil_module.tan_theta_coil = 0.0 + sctfcoil_module.t_conductor_radial = 0.0 + sctfcoil_module.t_conductor_toroidal = 0.0 + sctfcoil_module.t_cable_radial = 0.0 + sctfcoil_module.t_cable_toroidal = 0.0 + sctfcoil_module.t_turn_radial = 0.0 + sctfcoil_module.t_turn_toroidal = 0.0 + sctfcoil_module.t_cable = 0.0 + sctfcoil_module.vforce_inboard_tot = 0.0 + sctfcoil_module.t1 = 0.0 + sctfcoil_module.time2 = 0.0 + sctfcoil_module.tau2 = 0.0 + sctfcoil_module.estotft = 0.0 diff --git a/source/fortran/sctfcoil.f90 b/source/fortran/sctfcoil.f90 index 9aaaacf9ac..9dbf89823b 100755 --- a/source/fortran/sctfcoil.f90 +++ b/source/fortran/sctfcoil.f90 @@ -172,57 +172,6 @@ module sctfcoil_module integer :: is_leg_cp_temp_same contains - - subroutine init_sctfcoil_module - !! Initialise module variables - implicit none - - is_leg_cp_temp_same = 0 - tf_fit_t = 0.0D0 - tf_fit_z = 0.0D0 - tf_fit_y = 0.0D0 - tfc_current = 0.0D0 - awpc = 0.0D0 - awptf = 0.0D0 - a_tf_steel = 0.0D0 - a_tf_ins = 0.0D0 - f_tf_steel = 0.0D0 - f_tf_ins = 0.0D0 - h_cp_top = 0.0D0 - r_tf_outboard_in = 0.0D0 - r_tf_outboard_out = 0.0D0 - r_wp_inner = 0.0D0 - r_wp_outer = 0.0D0 - r_wp_centre = 0.0D0 - dr_tf_wp_top = 0.0D0 - vol_ins_cp = 0.0d0 - vol_gr_ins_cp = 0.0D0 - vol_case_cp = 0.0D0 - t_wp_toroidal = 0.0D0 - t_wp_toroidal_av = 0.0D0 - t_lat_case_av = 0.0D0 - a_case_front = 0.0D0 - a_case_nose = 0.0D0 - a_ground_ins = 0.0D0 - a_leg_ins = 0.0D0 - a_leg_gr_ins = 0.0D0 - a_leg_cond = 0.0D0 - theta_coil = 0.0D0 - tan_theta_coil = 0.0D0 - t_conductor_radial = 0.0D0 - t_conductor_toroidal = 0.0D0 - t_cable_radial = 0.0D0 - t_cable_toroidal = 0.0D0 - t_turn_radial = 0.0D0 - t_turn_toroidal = 0.0D0 - t_cable = 0.0D0 - vforce_inboard_tot = 0.0D0 - T1 = 0.0D0 - time2 = 0.0D0 - tau2 = 0.0D0 - estotft = 0.0D0 - end subroutine init_sctfcoil_module - ! -------------------------------------------------------------------------- subroutine initialise_cables() use rebco_variables, only: copper_rrr From a2ff5d1a1bb9897e5ca3155ee091db84e155d3b0 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 16:01:46 +0000 Subject: [PATCH 14/34] Convert init_stellarator_variables to Python --- process/init.py | 3 ++- process/stellarator.py | 23 ++++++++++++++++++++ source/fortran/stellarator_variables.f90 | 27 ------------------------ 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/process/init.py b/process/init.py index 891a34c06e..270b9fe2ef 100644 --- a/process/init.py +++ b/process/init.py @@ -22,6 +22,7 @@ from process.pfcoil import init_pfcoil_module from process.physics import init_physics_variables from process.sctfcoil import init_sctfcoil_module +from process.stellarator import init_stellarator_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -236,7 +237,7 @@ def init_all_module_vars(): fortran.scan_module.init_scan_module() init_sctfcoil_module() fortran.stellarator_module.init_stellarator_module() - fortran.stellarator_variables.init_stellarator_variables() + init_stellarator_variables() fortran.tfcoil_variables.init_tfcoil_variables() fortran.times_variables.init_times_variables() fortran.constants.init_constants() diff --git a/process/stellarator.py b/process/stellarator.py index ec25b2c796..4c148dbd54 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -5637,3 +5637,26 @@ def neoclassics_calc_q_flux(self): / neoclassics_module.temperatures ) ) + + +def init_stellarator_variables(): + stellarator_variables.istell = 0 + stellarator_variables.bmn = 1e-3 + stellarator_variables.f_asym = 1.0 + stellarator_variables.f_rad = 0.85 + stellarator_variables.f_w = 0.5 + stellarator_variables.fdivwet = 0.333333333333333 + stellarator_variables.flpitch = 1e-3 + stellarator_variables.hportamax = 0.0 + stellarator_variables.hportpmax = 0.0 + stellarator_variables.hporttmax = 0.0 + stellarator_variables.iotabar = 1.0 + stellarator_variables.isthtr = 3 + stellarator_variables.m_res = 5 + stellarator_variables.n_res = 5 + stellarator_variables.shear = 0.5 + stellarator_variables.vportamax = 0.0 + stellarator_variables.vportpmax = 0.0 + stellarator_variables.vporttmax = 0.0 + stellarator_variables.max_gyrotron_frequency = 1.0e9 + stellarator_variables.te0_ecrh_achievable = 1.0e2 diff --git a/source/fortran/stellarator_variables.f90 b/source/fortran/stellarator_variables.f90 index eec23506e9..88eb5f6b43 100644 --- a/source/fortran/stellarator_variables.f90 +++ b/source/fortran/stellarator_variables.f90 @@ -91,31 +91,4 @@ module stellarator_variables real(dp) :: powerht_constraint real(dp) :: powerscaling_constraint - contains - - subroutine init_stellarator_variables - !! Initialise module variables - implicit none - - istell = 0 - bmn = 1.0D-3 - f_asym = 1.0D0 - f_rad = 0.85D0 - f_w = 0.5D0 - fdivwet = 0.333333333333333D0 - flpitch = 1.0D-3 - hportamax = 0.0D0 - hportpmax = 0.0D0 - hporttmax = 0.0D0 - iotabar = 1.0D0 - isthtr = 3 - m_res = 5 - n_res = 5 - shear = 0.5D0 - vportamax = 0.0D0 - vportpmax = 0.0D0 - vporttmax = 0.0D0 - max_gyrotron_frequency = 1.0D9 - te0_ecrh_achievable = 1.0D2 - end subroutine init_stellarator_variables end module stellarator_variables From 02c5f8f6cba8bdfc76f140affe5b40b9f4238cb7 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 16:03:56 +0000 Subject: [PATCH 15/34] Convert init_stellarator_module to Python --- process/init.py | 4 ++-- process/stellarator.py | 10 ++++++++++ source/fortran/stellarator.f90 | 13 ------------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/process/init.py b/process/init.py index 270b9fe2ef..7b7c9939a5 100644 --- a/process/init.py +++ b/process/init.py @@ -22,7 +22,7 @@ from process.pfcoil import init_pfcoil_module from process.physics import init_physics_variables from process.sctfcoil import init_sctfcoil_module -from process.stellarator import init_stellarator_variables +from process.stellarator import init_stellarator_module, init_stellarator_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -236,7 +236,7 @@ def init_all_module_vars(): init_physics_variables() fortran.scan_module.init_scan_module() init_sctfcoil_module() - fortran.stellarator_module.init_stellarator_module() + init_stellarator_module() init_stellarator_variables() fortran.tfcoil_variables.init_tfcoil_variables() fortran.times_variables.init_times_variables() diff --git a/process/stellarator.py b/process/stellarator.py index 4c148dbd54..c0bbc2af93 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -5660,3 +5660,13 @@ def init_stellarator_variables(): stellarator_variables.vporttmax = 0.0 stellarator_variables.max_gyrotron_frequency = 1.0e9 stellarator_variables.te0_ecrh_achievable = 1.0e2 + + +def init_stellarator_module(): + st.first_call = True + st.first_call_stfwbs = True + st.f_n = 0.0 + st.f_r = 0.0 + st.f_a = 0.0 + st.f_b = 0.0 + st.f_i = 0.0 diff --git a/source/fortran/stellarator.f90 b/source/fortran/stellarator.f90 index 0cea8f82dc..a47a2994fa 100644 --- a/source/fortran/stellarator.f90 +++ b/source/fortran/stellarator.f90 @@ -24,19 +24,6 @@ module stellarator_module contains - subroutine init_stellarator_module - !! Initialise module variables - implicit none - - first_call = .true. - first_call_stfwbs = .true. - f_n = 0.0D0 - f_r = 0.0D0 - f_a = 0.0D0 - f_b = 0.0D0 - f_i = 0.0D0 - end subroutine init_stellarator_module - ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine stinit From 975d7a8aed026267d28a774d4cd62821b7b2e399 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 20 Mar 2025 16:28:55 +0000 Subject: [PATCH 16/34] Convert init_tfcoil_variables to Python --- process/init.py | 3 +- process/tf_coil.py | 224 +++++++++++++++++++++++++++ source/fortran/tfcoil_variables.f90 | 225 ---------------------------- 3 files changed, 226 insertions(+), 226 deletions(-) diff --git a/process/init.py b/process/init.py index 7b7c9939a5..bffa3894d5 100644 --- a/process/init.py +++ b/process/init.py @@ -23,6 +23,7 @@ from process.physics import init_physics_variables from process.sctfcoil import init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables +from process.tfcoil import init_tfcoil_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string @@ -238,7 +239,7 @@ def init_all_module_vars(): init_sctfcoil_module() init_stellarator_module() init_stellarator_variables() - fortran.tfcoil_variables.init_tfcoil_variables() + init_tfcoil_variables() fortran.times_variables.init_times_variables() fortran.constants.init_constants() fortran.current_drive_variables.init_current_drive_variables() diff --git a/process/tf_coil.py b/process/tf_coil.py index 206773a01e..6e316ab9f3 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -3707,3 +3707,227 @@ def eyoung_series(eyoung_j_1, l_1, poisson_j_perp_1, eyoung_j_2, l_2, poisson_j_ poisson_j_perp_3 = np.array(poisson_j_perp_3) return eyoung_j_3, l_3, poisson_j_perp_3 + + +def init_tfcoil_variables(): + tfv.acasetf = 0.0 + tfv.acasetfo = 0.0 + tfv.acndttf = 0.0 + tfv.acond = 0.0 + tfv.acstf = 0.0 + tfv.insulation_area = 0.0 + tfv.aiwp = 0.0 + tfv.sig_tf_case_max = 6.0e8 + tfv.sig_tf_wp_max = 6.0e8 + tfv.a_tf_leg_outboard = 0.0 + tfv.aswp = 0.0 + tfv.avwp = 0.0 + tfv.awphec = 0.0 + tfv.bcritsc = 24.0 + tfv.bmaxtf = 0.0 + tfv.bmaxtfrp = 0.0 + tfv.casestr = 0.0 + tfv.casthi = 0.0 + tfv.casthi_fraction = 0.05 + tfv.casthi_is_fraction = False + tfv.casths = 0.0 + tfv.casths_fraction = 0.06 + tfv.t_conductor = 0.0 + tfv.t_cable_tf = 0.0 + tfv.t_cable_tf_is_input = False + tfv.t_turn_tf = 0.0 + tfv.t_turn_tf_is_input = False + tfv.f_t_turn_tf = 1.0 + tfv.t_turn_tf_max = 0.05 + tfv.acs = 0.0 + tfv.cdtfleg = 0.0 + tfv.cforce = 0.0 + tfv.cplen = 0.0 + tfv.cpttf = 7.0e4 + tfv.cpttf_max = 9.0e4 + tfv.dcase = 8000.0 + tfv.dcond = [6080.0, 6080.0, 6070.0, 6080.0, 6080.0, 8500.0, 6070.0, 8500.0, 8500.0] + tfv.dcondins = 1800.0 + tfv.dhecoil = 0.005 + tfv.estotftgj = 0.0 + tfv.b_crit_upper_nbti = 14.86 + tfv.t_crit_nbti = 9.04 + tfv.max_force_density = 0.0 + tfv.fcutfsu = 0.69 + tfv.fhts = 0.5 + tfv.insstrain = 0.0 + tfv.i_tf_stress_model = 1 + tfv.i_tf_tresca = 0 + tfv.i_tf_wp_geom = -1 + tfv.i_tf_case_geom = 0 + tfv.i_tf_turns_integer = 0 + tfv.i_tf_sc_mat = 1 + tfv.i_tf_sup = 1 + tfv.i_tf_shape = 0 + tfv.i_tf_cond_eyoung_axial = 0 + tfv.i_tf_cond_eyoung_trans = 1 + tfv.n_pancake = 10 + tfv.n_layer = 20 + tfv.n_rad_per_layer = 100 + tfv.i_tf_bucking = -1 + tfv.n_tf_graded_layers = 1 + tfv.n_tf_stress_layers = 0 + tfv.n_tf_wp_layers = 5 + tfv.j_tf_bus = 1.25e6 + tfv.j_crit_str_tf = 0.0 + tfv.j_crit_str_0 = [ + 596905475.80390120, + 1925501534.8512938, + 724544682.96063495, + 549858624.45072436, + 669284509.85818779, + 0.0, + 898964415.36996782, + 1158752995.2559297, + 865652122.9071957, + ] + tfv.jwdgcrt = 0.0 + tfv.jwdgpro = 0.0 + tfv.jwptf = 0.0 + tfv.oacdcp = 0.0 + tfv.eyoung_ins = 1.0e8 + tfv.eyoung_steel = 2.05e11 + tfv.eyoung_cond_axial = 6.6e8 + tfv.eyoung_cond_trans = 0.0 + tfv.eyoung_res_tf_buck = 150.0e9 + tfv.eyoung_copper = 117.0e9 + tfv.eyoung_al = 69.0e9 + tfv.poisson_steel = 0.3 + tfv.poisson_copper = 0.35 + tfv.poisson_al = 0.35 + tfv.poisson_ins = 0.34 + tfv.poisson_cond_axial = 0.3 + tfv.poisson_cond_trans = 0.3 + tfv.rbmax = 0.0 + tfv.res_tf_leg = 0.0 + tfv.toroidalgap = 1.0 # [m] + tfv.ftoroidalgap = 1.0 + tfv.ripmax = 1.0 + tfv.ripple = 0.0 + tfv.c_tf_total = 0.0 + tfv.radial_array[:] = 0.0 + tfv.sig_tf_r[:] = 0.0 + tfv.sig_tf_t[:] = 0.0 + tfv.deflect[:] = 0.0 + tfv.sig_tf_z = 0.0 + tfv.sig_tf_vmises[:] = 0.0 + tfv.s_shear_tf[:] = 0.0 + tfv.sig_tf_cs_bucked = 0.0 + tfv.sig_tf_case = 0.0 + tfv.sig_tf_wp = 0.0 + tfv.str_cs_con_res = -0.005 + tfv.str_pf_con_res = -0.005 + tfv.str_tf_con_res = -0.005 + tfv.str_wp = 0.0 + tfv.str_wp_max = 0.7e-2 + tfv.i_str_wp = 1 + tfv.quench_model = string_to_f2py_compatible(tfv.quench_model, "exponential") + tfv.time1 = 0 + tfv.tcritsc = 16.0 + tfv.tdmptf = 10.0 + tfv.tfareain = 0.0 + tfv.len_tf_bus = 300.0 + tfv.m_tf_bus = 0.0 + tfv.tfckw = 0.0 + tfv.tfcmw = 0.0 + tfv.tfcpmw = 0.0 + tfv.tfjtsmw = 0.0 + tfv.tfcryoarea = 0.0 + tfv.tficrn = 0.0 + tfv.tfind = 0.0 + tfv.tfinsgap = 0.01 + tfv.tflegmw = 0.0 + tfv.rho_cp = 0.0 + tfv.rho_tf_leg = 0.0 + tfv.rho_tf_bus = 1.86e-8 + tfv.frhocp = 1.0 + tfv.frholeg = 1.0 + tfv.rho_tf_joints = 2.5e-10 + tfv.n_tf_joints_contact = 6 + tfv.n_tf_joints = 4 + tfv.th_joint_contact = 0.03 + tfv.pres_joints = 0.0 + tfv.len_tf_coil = 0.0 + tfv.eff_tf_cryo = -1.0 + tfv.n_tf_coils = 16.0 + tfv.tfocrn = 0.0 + tfv.tfsai = 0.0 + tfv.tfsao = 0.0 + tfv.tftmp = 4.5 + tfv.tftort = 1.0 + tfv.thicndut = 8e-4 + tfv.layer_ins = 0.0 + tfv.thkcas = 0.3 + tfv.dr_tf_wp = 0.0 + tfv.thwcndut = 8e-3 + tfv.tinstf = 0.018 + tfv.tmargmin_tf = 0.0 + tfv.tmargmin_cs = 0.0 + tfv.tmargmin = 0.0 + tfv.temp_margin = 0.0 + tfv.tmargtf = 0.0 + tfv.tmaxpro = 150.0 + tfv.tmax_croco = 200.0 + tfv.croco_quench_temperature = 0.0 + tfv.tmpcry = 4.5 + tfv.n_tf_turn = 0.0 + tfv.vdalw = 20.0 + tfv.vforce = 0.0 + tfv.f_vforce_inboard = 0.5 + tfv.vforce_outboard = 0.0 + tfv.vftf = 0.4 + tfv.voltfleg = 0.0 + tfv.vtfkv = 0.0 + tfv.vtfskv = 0.0 + tfv.whtcas = 0.0 + tfv.whtcon = 0.0 + tfv.whtconcu = 0.0 + tfv.whtconal = 0.0 + tfv.whtconin = 0.0 + tfv.whtconsc = 0.0 + tfv.whtconsh = 0.0 + tfv.whtgw = 0.0 + tfv.whttf = 0.0 + tfv.wwp1 = 0.0 + tfv.wwp2 = 0.0 + tfv.dthet[:] = 0.0 + tfv.radctf[:] = 0.0 + tfv.xarc[:] = 0.0 + tfv.xctfc[:] = 0.0 + tfv.yarc[:] = 0.0 + tfv.yctfc[:] = 0.0 + tfv.tfa[:] = 0.0 + tfv.tfb[:] = 0.0 + tfv.drtop = 0.0 + tfv.dztop = 0.0 + tfv.etapump = 0.8 + tfv.fcoolcp = 0.3 + tfv.f_a_tf_cool_outboard = 0.2 + tfv.a_cp_cool = 0.0 + tfv.ncool = 0.0 + tfv.ppump = 0.0 + tfv.p_cp_resistive = 0.0 + tfv.p_tf_leg_resistive = 0.0 + tfv.ptempalw = 473.15 # 200 C + tfv.rcool = 0.005 + tfv.tcoolin = 313.15 # 40 C + tfv.dtiocool = 0.0 + tfv.temp_cp_average = 373.15 # 100 C + tfv.tcpav2 = 0.0 + tfv.temp_tf_legs_outboard = -1.0 + tfv.tcpmax = 0.0 + tfv.vcool = 20.0 + tfv.vol_cond_cp = 0.0 + tfv.whtcp = 0.0 + tfv.whttflgs = 0.0 + tfv.tfc_sidewall_is_fraction = False + tfv.i_cp_joints = -1 + tfv.cryo_cool_req = 0.0 + tfv.theta1_coil = 45.0 + tfv.theta1_vv = 1.0 # 1 Deg + tfv.max_vv_stress = 143.0e6 diff --git a/source/fortran/tfcoil_variables.f90 b/source/fortran/tfcoil_variables.f90 index c91793faa2..0073c5155b 100644 --- a/source/fortran/tfcoil_variables.f90 +++ b/source/fortran/tfcoil_variables.f90 @@ -832,229 +832,4 @@ module tfcoil_variables real(dp) :: max_vv_stress !! The allowable peak maximum shear stress in the vacuum vessel due to quench and fast discharge of the TF coils [Pa] - - contains - - subroutine init_tfcoil_variables - !! Initialise module variables - implicit none - - acasetf = 0.0D0 - acasetfo = 0.0D0 - acndttf = 0.0D0 - acond = 0.0D0 - acstf = 0.0D0 - insulation_area = 0.0D0 - aiwp = 0.0D0 - sig_tf_case_max = 6.0D8 - sig_tf_wp_max = 6.0D8 - a_tf_leg_outboard = 0.0D0 - aswp = 0.0D0 - avwp = 0.0D0 - awphec = 0.0D0 - bcritsc = 24.0D0 - bmaxtf = 0.0D0 - bmaxtfrp = 0.0D0 - casestr = 0.0D0 - casthi = 0.0D0 - casthi_fraction = 0.05D0 - casthi_is_fraction = .false. - casths = 0.0D0 - casths_fraction = 0.06D0 - t_conductor = 0.0D0 - t_cable_tf = 0.0D0 - t_cable_tf_is_input = .false. - t_turn_tf = 0.0D0 - t_turn_tf_is_input = .false. - f_t_turn_tf = 1.0D0 - t_turn_tf_max = 0.05 - acs = 0.0D0 - cdtfleg = 0.0D0 - cforce = 0.0D0 - cplen = 0.0D0 - cpttf = 7.0e4 - cpttf_max = 9.0e4 - dcase = 8000.0D0 - dcond = (/6080.0D0, 6080.0D0, 6070.0D0, 6080.0D0, 6080.0D0, 8500.0D0, & - 6070.0D0, 8500.0D0, 8500.0D0/) - dcondins = 1800.0D0 - dhecoil = 0.005D0 - estotftgj = 0.0D0 - b_crit_upper_nbti = 14.86D0 - t_crit_nbti = 9.04D0 - max_force_density = 0.0D0 - fcutfsu = 0.69D0 - fhts = 0.5D0 - insstrain = 0.0D0 - i_tf_stress_model = 1 - i_tf_tresca = 0 - i_tf_wp_geom = -1 - i_tf_case_geom = 0 - i_tf_turns_integer = 0 - i_tf_sc_mat = 1 - i_tf_sup = 1 - i_tf_shape = 0 - i_tf_cond_eyoung_axial = 0 - i_tf_cond_eyoung_trans = 1 - n_pancake = 10 - n_layer = 20 - n_rad_per_layer = 100 - i_tf_bucking = -1 - n_tf_graded_layers = 1 - n_tf_stress_layers = 0 - n_tf_wp_layers = 5 - j_tf_bus = 1.25D6 - j_crit_str_tf = 0.0D0 - j_crit_str_0 = & - (/596905475.80390120D0,1925501534.8512938D0,& - 724544682.96063495D0,549858624.45072436D0, & - 669284509.85818779D0,0.0D0,& - 898964415.36996782D0,1158752995.2559297D0, & - 865652122.9071957D0/) - jwdgcrt = 0.0D0 - jwdgpro = 0.0D0 - jwptf = 0.0D0 - oacdcp = 0.0D0 - eyoung_ins = 1.0D8 - eyoung_steel = 2.05D11 - eyoung_cond_axial = 6.6D8 - eyoung_cond_trans = 0.0D0 - eyoung_res_tf_buck = 150.0D9 - eyoung_copper = 117.0D9 - eyoung_al = 69.0D9 - poisson_steel = 0.3D0 - poisson_copper = 0.35D0 - poisson_al = 0.35D0 - poisson_ins = 0.34D0 - poisson_cond_axial = 0.3 - poisson_cond_trans = 0.3 - rbmax = 0.0D0 - res_tf_leg = 0.0D0 - toroidalgap = 1.0D0 ![m] - ftoroidalgap = 1.0D0 - ripmax = 1.0D0 - ripple = 0.0D0 - c_tf_total = 0.0D0 - radial_array = 0.0D0 - sig_tf_r = 0.0D0 - sig_tf_t = 0.0D0 - deflect = 0.0D0 - sig_tf_z = 0.0D0 - sig_tf_vmises = 0.0D0 - s_shear_tf = 0.0D0 - sig_tf_cs_bucked = 0.0D0 - sig_tf_case = 0.0D0 - sig_tf_wp = 0.0D0 - str_cs_con_res = -0.005D0 - str_pf_con_res = -0.005D0 - str_tf_con_res = -0.005D0 - str_wp = 0.0D0 - str_wp_max = 0.7D-2 - i_str_wp = 1 - quench_model = 'exponential' - time1 = 0D0 - tcritsc = 16.0D0 - tdmptf = 10.0D0 - tfareain = 0.0D0 - len_tf_bus = 300.0D0 - m_tf_bus = 0.0D0 - tfckw = 0.0D0 - tfcmw = 0.0D0 - tfcpmw = 0.0D0 - tfjtsmw = 0.0D0 - tfcryoarea = 0.0D0 - tficrn = 0.0D0 - tfind = 0.0D0 - tfinsgap = 0.010D0 - tflegmw = 0.0D0 - rho_cp = 0.0D0 - rho_tf_leg = 0.0D0 - rho_tf_bus = 1.86D-8 - frhocp = 1.0D0 - frholeg = 1.0D0 - rho_tf_joints = 2.5D-10 - n_tf_joints_contact = 6 - n_tf_joints = 4 - th_joint_contact = 0.03D0 - pres_joints = 0.0D0 - len_tf_coil = 0.0D0 - eff_tf_cryo = -1.0D0 - n_tf_coils = 16.0D0 - tfocrn = 0.0D0 - tfsai = 0.0D0 - tfsao = 0.0D0 - tftmp = 4.5D0 - tftort = 1.0D0 - thicndut = 8.0D-4 - layer_ins = 0.0D0 - thkcas = 0.3D0 - dr_tf_wp = 0.0D0 - thwcndut = 8.0D-3 - tinstf = 0.018D0 - tmargmin_tf = 0D0 - tmargmin_cs = 0D0 - tmargmin = 0D0 - temp_margin = 0.00D0 - tmargtf = 0.0D0 - tmaxpro = 150.0D0 - tmax_croco = 200.0D0 - croco_quench_temperature = 0D0 - tmpcry = 4.5D0 - n_tf_turn = 0.0D0 - vdalw = 20.0D0 - vforce = 0.0D0 - f_vforce_inboard = 0.5D0 - vforce_outboard = 0.0D0 - vftf = 0.4D0 - voltfleg = 0.0D0 - vtfkv = 0.0D0 - vtfskv = 0.0D0 - whtcas = 0.0D0 - whtcon = 0.0D0 - whtconcu = 0.0D0 - whtconal = 0.0D0 - whtconin = 0.0D0 - whtconsc = 0.0D0 - whtconsh = 0.0D0 - whtgw = 0.0D0 - whttf = 0.0D0 - wwp1 = 0.0D0 - wwp2 = 0.0D0 - dthet = 0.0D0 - radctf = 0.0D0 - xarc = 0.0D0 - xctfc = 0.0D0 - yarc = 0.0D0 - yctfc = 0.0D0 - tfa = 0.0D0 - tfb = 0.0D0 - drtop = 0.0D0 - dztop = 0.0D0 - etapump = 0.8D0 - fcoolcp = 0.3D0 - f_a_tf_cool_outboard = 0.2D0 - a_cp_cool = 0.0D0 - ncool = 0.0D0 - ppump = 0.0D0 - p_cp_resistive = 0.0D0 - p_tf_leg_resistive = 0.0D0 - ptempalw = 473.15D0 ! 200 C - rcool = 0.005D0 - tcoolin = 313.15D0 ! 40 C - dtiocool = 0.0D0 - temp_cp_average = 373.15D0 ! 100 C - tcpav2 = 0.0D0 - temp_tf_legs_outboard = -1.0D0 - tcpmax = 0.0D0 - vcool = 20.0D0 - vol_cond_cp = 0.0D0 - whtcp = 0.0D0 - whttflgs = 0.0D0 - tfc_sidewall_is_fraction = .false. - i_cp_joints = -1 - cryo_cool_req = 0.0D0 - theta1_coil = 45.0D0 - theta1_vv = 1.0D0 ! 1 Deg - max_vv_stress = 143.0D6 - end subroutine init_tfcoil_variables end module tfcoil_variables From 92807a08c87129c7dcdf68c0272358ad3d58823c Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 26 Mar 2025 14:43:27 +0000 Subject: [PATCH 17/34] Convert init_current_drive_variables to Python --- process/current_drive.py | 69 ++++++++++++++++++++ process/init.py | 3 +- source/fortran/current_drive_variables.f90 | 73 ---------------------- 3 files changed, 71 insertions(+), 74 deletions(-) diff --git a/process/current_drive.py b/process/current_drive.py index ac97f186b2..581cfa7388 100644 --- a/process/current_drive.py +++ b/process/current_drive.py @@ -2149,3 +2149,72 @@ def sigbeam(self, eb, te, ne, rnhe, rnc, rno, rnfe): ) return max(1e-20 * (np.exp(s1) / eb * (1.0 + sz)), 1e-23) + + +def init_current_drive_variables(): + """Initialise current drive variables""" + current_drive_variables.beamwd = 0.58 + current_drive_variables.bigq = 0.0 + current_drive_variables.bootstrap_current_fraction = 0.0 + current_drive_variables.bootstrap_current_fraction_max = 0.9 + current_drive_variables.bscf_iter89 = 0.0 + current_drive_variables.bscf_nevins = 0.0 + current_drive_variables.bscf_sauter = 0.0 + current_drive_variables.bscf_wilson = 0.0 + current_drive_variables.bscf_sakai = 0.0 + current_drive_variables.bscf_aries = 0.0 + current_drive_variables.bscf_andrade = 0.0 + current_drive_variables.bscf_hoang = 0.0 + current_drive_variables.bscf_wong = 0.0 + current_drive_variables.bscf_gi_I = 0.0 + current_drive_variables.bscf_gi_II = 0.0 + current_drive_variables.cboot = 1.0 + current_drive_variables.beam_current = 0.0 + current_drive_variables.diacf_hender = 0.0 + current_drive_variables.diacf_scene = 0.0 + current_drive_variables.diamagnetic_current_fraction = 0.0 + current_drive_variables.echpwr = 0.0 + current_drive_variables.echwpow = 0.0 + current_drive_variables.effcd = 0.0 + current_drive_variables.harnum = 2.0 + current_drive_variables.wave_mode = 0 + current_drive_variables.beam_energy = 1.0e3 + current_drive_variables.etacd = 0.0 + current_drive_variables.etacdfix = 0.0 + current_drive_variables.etaech = 0.3 + current_drive_variables.etalh = 0.3 + current_drive_variables.etanbi = 0.3 + current_drive_variables.fpion = 0.5 + current_drive_variables.pnbitot = 0.0 + current_drive_variables.pscf_scene = 0.0 + current_drive_variables.nbshinemw = 0.0 + current_drive_variables.feffcd = 1.0 + current_drive_variables.forbitloss = 0.0 + current_drive_variables.frbeam = 1.05 + current_drive_variables.f_tritium_beam = 1e-6 + current_drive_variables.gamcd = 0.0 + current_drive_variables.gamma_ecrh = 0.35 + current_drive_variables.xi_ebw = 0.8 + current_drive_variables.iefrf = 5 + current_drive_variables.iefrffix = 0 + current_drive_variables.irfcd = 1 + current_drive_variables.nbshinef = 0.0 + current_drive_variables.nbshield = 0.5 + current_drive_variables.pheat = 0.0 + current_drive_variables.pheatfix = 0.0 + current_drive_variables.pinjalw = 150.0 + current_drive_variables.pinjemw = 0.0 + current_drive_variables.pinjimw = 0.0 + current_drive_variables.pinjmw = 0.0 + current_drive_variables.pinjfixmw = 0.0 + current_drive_variables.plasma_current_internal_fraction = 0.0 + current_drive_variables.plhybd = 0.0 + current_drive_variables.pnbeam = 0.0 + current_drive_variables.porbitlossmw = 0.0 + current_drive_variables.ps_current_fraction = 0.0 + current_drive_variables.pwplh = 0.0 + current_drive_variables.pwpnb = 0.0 + current_drive_variables.rtanbeam = 0.0 + current_drive_variables.rtanmax = 0.0 + current_drive_variables.taubeam = 0.0 + current_drive_variables.tbeamin = 3.0 diff --git a/process/init.py b/process/init.py index bffa3894d5..1e7ac3c8b8 100644 --- a/process/init.py +++ b/process/init.py @@ -13,6 +13,7 @@ from process.buildings import init_buildings_variables from process.costs import init_cost_variables from process.cs_fatigue import init_cs_fatigue_variables +from process.current_drive import init_current_drive_variables from process.dcll import init_dcll_module from process.divertor import init_divertor_variables from process.exceptions import ProcessValidationError @@ -242,7 +243,7 @@ def init_all_module_vars(): init_tfcoil_variables() fortran.times_variables.init_times_variables() fortran.constants.init_constants() - fortran.current_drive_variables.init_current_drive_variables() + init_current_drive_variables() fortran.primary_pumping_variables.init_primary_pumping_variables() fortran.pfcoil_variables.init_pfcoil_variables() fortran.structure_variables.init_structure_variables() diff --git a/source/fortran/current_drive_variables.f90 b/source/fortran/current_drive_variables.f90 index 5818527958..e48a142d1d 100644 --- a/source/fortran/current_drive_variables.f90 +++ b/source/fortran/current_drive_variables.f90 @@ -246,77 +246,4 @@ module current_drive_variables real(dp) :: tbeamin !! permitted neutral beam e-decay lengths to plasma centre - - contains - - subroutine init_current_drive_variables - !! Initialise module variables - implicit none - - beamwd = 0.58D0 - bigq = 0.0D0 - bootstrap_current_fraction = 0.0D0 - bootstrap_current_fraction_max = 0.9D0 - bscf_iter89 = 0.0D0 - bscf_nevins = 0.0D0 - bscf_sauter = 0.0D0 - bscf_wilson = 0.0D0 - bscf_sakai = 0.0D0 - bscf_aries = 0.0D0 - bscf_andrade = 0.0D0 - bscf_hoang = 0.0D0 - bscf_wong = 0.0D0 - bscf_gi_I = 0.0D0 - bscf_gi_II = 0.0D0 - cboot = 1.0D0 - beam_current = 0.0D0 - diacf_hender = 0.0D0 - diacf_scene = 0.0D0 - diamagnetic_current_fraction = 0.0D0 - echpwr = 0.0D0 - echwpow = 0.0D0 - effcd = 0.0D0 - harnum = 2.0 - wave_mode = 0 - beam_energy = 1.0D3 - etacd = 0.0D0 - etacdfix = 0.0D0 - etaech = 0.3D0 - etalh = 0.3D0 - etanbi = 0.3D0 - fpion = 0.5D0 - pnbitot = 0.0D0 - pscf_scene = 0.0D0 - nbshinemw = 0.0D0 - feffcd = 1.0D0 - forbitloss = 0.0D0 - frbeam = 1.05D0 - f_tritium_beam = 1.0D-6 - gamcd = 0.0D0 - gamma_ecrh = 0.35D0 - xi_ebw = 0.8D0 - iefrf = 5 - iefrffix = 0 - irfcd = 1 - nbshinef = 0.0D0 - nbshield = 0.5D0 - pheat = 0.0D0 - pheatfix = 0.0D0 - pinjalw = 150.0D0 - pinjemw = 0.0D0 - pinjimw = 0.0D0 - pinjmw = 0.0D0 - pinjfixmw = 0.0D0 - plasma_current_internal_fraction = 0.0D0 - plhybd = 0.0D0 - pnbeam = 0.0D0 - porbitlossmw = 0.0D0 - ps_current_fraction = 0.0D0 - pwplh = 0.0D0 - pwpnb = 0.0D0 - rtanbeam = 0.0D0 - rtanmax = 0.0D0 - taubeam = 0.0D0 - tbeamin = 3.0D0 - end subroutine init_current_drive_variables end module current_drive_variables From b1a86b6f064a52fabb9e71701084e2da17d0190d Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 26 Mar 2025 15:07:47 +0000 Subject: [PATCH 18/34] Convert init_pfcoil_variables to Python --- process/init.py | 4 +- process/pfcoil.py | 103 ++++++++++++++++++++++++ source/fortran/pfcoil_variables.f90 | 117 ---------------------------- 3 files changed, 105 insertions(+), 119 deletions(-) diff --git a/process/init.py b/process/init.py index 1e7ac3c8b8..3564d5d312 100644 --- a/process/init.py +++ b/process/init.py @@ -20,7 +20,7 @@ from process.hcpb import init_ccfe_hcpb_module from process.impurity_radiation import init_impurity_radiation_module from process.input import parse_input_file -from process.pfcoil import init_pfcoil_module +from process.pfcoil import init_pfcoil_module, init_pfcoil_variables from process.physics import init_physics_variables from process.sctfcoil import init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables @@ -245,7 +245,7 @@ def init_all_module_vars(): fortran.constants.init_constants() init_current_drive_variables() fortran.primary_pumping_variables.init_primary_pumping_variables() - fortran.pfcoil_variables.init_pfcoil_variables() + init_pfcoil_variables() fortran.structure_variables.init_structure_variables() fortran.vacuum_variables.init_vacuum_variables() fortran.pf_power_variables.init_pf_power_variables() diff --git a/process/pfcoil.py b/process/pfcoil.py index aff20fb69b..b94ed4b8cc 100644 --- a/process/pfcoil.py +++ b/process/pfcoil.py @@ -3508,3 +3508,106 @@ def init_pfcoil_module(): pf.ccl0[:] = 0.0 pf.bpf2[:] = 0.0 pf.vsdum[:] = 0.0 + + +def init_pfcoil_variables(): + """Initialise the PF coil variables""" + pfv.alfapf = 5e-10 + pfv.alstroh = 4.0e8 + pfv.i_cs_stress = 0 + pfv.a_cs_poloidal = 0.0 + pfv.a_cs_turn = 0.0 + pfv.awpoh = 0.0 + pfv.b_cs_peak_flat_top_end = 0.0 + pfv.b_cs_peak_pulse_start = 0.0 + pfv.b_pf_coil_peak[:] = 0.0 + pfv.ccl0_ma[:] = 0.0 + pfv.ccls_ma[:] = 0.0 + pfv.j_cs_pulse_start = 0.0 + pfv.j_cs_flat_top_end = 1.85e7 + pfv.c_pf_coil_turn[:] = 0.0 + pfv.c_pf_coil_turn_peak_input[:] = 4.0e4 + pfv.c_pf_cs_coil_pulse_start_ma[:] = 0.0 + pfv.c_pf_cs_coil_flat_top_ma[:] = 0.0 + pfv.c_pf_cs_coil_pulse_end_ma[:] = 0.0 + pfv.etapsu = 0.9 + pfv.f_j_cs_start_end_flat_top = 0.0 + pfv.f_j_cs_start_pulse_end_flat_top = 0.9 + pfv.fcuohsu = 0.7 + pfv.fcupfsu = 0.69 + pfv.fvs_cs_pf_total_ramp = 1.0 + pfv.i_pf_location = [2, 2, 3, 0, 0, 0, 0, 0, 0, 0] + pfv.i_pf_conductor = 0 + pfv.itr_sum = 0.0 + pfv.i_cs_superconductor = 1 + pfv.i_pf_superconductor = 1 + pfv.j_crit_str_cs = 0.0 + pfv.j_crit_str_pf = 0.0 + pfv.i_pf_current = 1 + pfv.i_sup_pf_shape = 0 + pfv.j_cs_conductor_critical_pulse_start = 0.0 + pfv.j_cs_conductor_critical_flat_top_end = 0.0 + pfv.jcableoh_bop = 0.0 + pfv.jcableoh_eof = 0.0 + pfv.n_pf_cs_plasma_circuits = 0 + pfv.n_pf_coils_in_group = [1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0] + pfv.nfxfh = 7 + pfv.n_pf_coil_groups = 3 + pfv.n_cs_pf_coils = 0 + pfv.f_z_cs_tf_internal = 0.71 + pfv.f_a_cs_steel = 0.5 + pfv.pf_current_safety_factor = 1.0 + pfv.pfcaseth[:] = 0.0 + pfv.rho_pf_coil = 2.5e-8 + pfv.rhopfbus = 3.93e-8 + pfv.m_pf_coil_max = 0.0 + pfv.r_pf_coil_outer_max = 0.0 + pfv.pfwpmw = 0.0 + pfv.p_cs_resistive_flat_top = 0.0 + pfv.p_pf_coil_resistive_total_flat_top = 0.0 + pfv.r_pf_coil_inner[:] = 0.0 + pfv.r_pf_coil_outer[:] = 0.0 + pfv.c_pf_cs_coils_peak_ma[:] = 0.0 + pfv.j_pf_coil_wp_peak[:] = 3.0e7 + pfv.j_cs_critical_flat_top_end = 0.0 + pfv.j_cs_critical_pulse_start = 0.0 + pfv.j_pf_wp_critical[:] = 0.0 + pfv.r_cs_middle = 0.0 + pfv.routr = 1.5 + pfv.r_pf_coil_middle[:] = 0.0 + pfv.rpf1 = 0.0 + pfv.rpf2 = -1.63 + pfv.rref[:] = 7.0 + pfv.s_shear_cs_peak = 0.0 + pfv.sigpfcalw = 500.0 + pfv.sigpfcf = 1.0 + pfv.ind_pf_cs_plasma_mutual[:] = 0.0 + pfv.temp_cs_margin = 0.0 + pfv.n_pf_coil_turns[:] = 0.0 + pfv.f_a_pf_coil_void[:] = 0.3 + pfv.f_a_cs_void = 0.3 + pfv.vs_cs_pf_total_burn = 0.0 + pfv.vs_pf_coils_total_burn = 0.0 + pfv.vs_pf_coils_total_ramp = 0.0 + pfv.vs_pf_coils_total_pulse = 0.0 + pfv.vs_cs_total_pulse = 0.0 + pfv.vs_cs_burn = 0.0 + pfv.vs_cs_ramp = 0.0 + pfv.vs_cs_pf_total_ramp = 0.0 + pfv.vs_cs_pf_total_pulse = 0.0 + pfv.waves[:] = 0.0 + pfv.m_pf_coil_conductor_total = 0.0 + pfv.m_pf_coil_structure_total = 0.0 + pfv.m_pf_coil_conductor[:] = 0.0 + pfv.m_pf_coil_structure[:] = 0.0 + pfv.z_pf_coil_upper[:] = 0.0 + pfv.z_pf_coil_lower[:] = 0.0 + pfv.z_pf_coil_middle[:] = 0.0 + pfv.zref = [3.6, 1.2, 2.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] + pfv.b_cs_limit_max = 13.0 + pfv.fb_cs_limit_max = 1.0 + pfv.ld_ratio_cst = 70.0 / 22.0 + pfv.l_cond_cst = 0.0 + pfv.d_cond_cst = 0.0 + pfv.r_in_cst = 0.0 + pfv.r_out_cst = 3.0e-3 diff --git a/source/fortran/pfcoil_variables.f90 b/source/fortran/pfcoil_variables.f90 index 4847cdd7e6..e7177af099 100644 --- a/source/fortran/pfcoil_variables.f90 +++ b/source/fortran/pfcoil_variables.f90 @@ -407,121 +407,4 @@ module pfcoil_variables real(dp) :: r_in_cst !! Length of CS of CS coil turn conduit length - - contains - - subroutine init_pfcoil_variables - !! Initialise module variables - implicit none - - alfapf = 5.0D-10 - alstroh = 4.0D8 - i_cs_stress = 0 - a_cs_poloidal = 0.0D0 - a_cs_turn = 0.0D0 - awpoh = 0.0D0 - b_cs_peak_flat_top_end = 0.0D0 - b_cs_peak_pulse_start = 0.0D0 - b_pf_coil_peak = 0.0D0 - ccl0_ma = (/0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0/) - ccls_ma = (/0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0/) - j_cs_pulse_start = 0.0D0 - j_cs_flat_top_end = 1.85D7 - c_pf_coil_turn = 0.0D0 - c_pf_coil_turn_peak_input = (/4.0D4, 4.0D4, 4.0D4, & - 4.0D4, 4.0D4, 4.0D4, 4.0D4, 4.0D4, 4.0D4, 4.0D4, & - 4.0D4, 4.0D4, 4.0D4, 4.0D4, 4.0D4, 4.0D4, 4.0D4, & - 4.0D4, 4.0D4, 4.0D4, 4.0D4, 4.0D4/) - c_pf_cs_coil_pulse_start_ma = 0.0D0 - c_pf_cs_coil_flat_top_ma = 0.0D0 - c_pf_cs_coil_pulse_end_ma = 0.0D0 - etapsu = 0.9D0 - f_j_cs_start_end_flat_top = 0.0D0 - f_j_cs_start_pulse_end_flat_top = 0.9D0 - fcuohsu = 0.7D0 - fcupfsu = 0.69D0 - fvs_cs_pf_total_ramp = 1.0 - i_pf_location = (/2,2,3,0,0,0,0,0,0,0/) - i_pf_conductor = 0 - itr_sum = 0.0D0 - i_cs_superconductor = 1 - i_pf_superconductor = 1 - j_crit_str_cs = 0.0D0 - j_crit_str_pf = 0.0D0 - i_pf_current = 1 - i_sup_pf_shape = 0 - j_cs_conductor_critical_pulse_start = 0.0D0 - j_cs_conductor_critical_flat_top_end = 0.0D0 - jcableoh_bop = 0.0D0 - jcableoh_eof = 0.0D0 - n_pf_cs_plasma_circuits = 0 - n_pf_coils_in_group = (/1,1,2,0,0,0,0,0,0,0,0,0/) - nfxfh = 7 - n_pf_coil_groups = 3 - n_cs_pf_coils = 0 - f_z_cs_tf_internal = 0.71D0 - f_a_cs_steel = 0.5D0 - pf_current_safety_factor = 1.0D0 - pfcaseth = 0.0D0 - rho_pf_coil = 2.5D-8 - rhopfbus = 3.93D-8 - m_pf_coil_max = 0.0D0 - r_pf_coil_outer_max = 0.0D0 - pfwpmw = 0.0D0 - p_cs_resistive_flat_top = 0.0D0 - p_pf_coil_resistive_total_flat_top = 0.0D0 - r_pf_coil_inner = 0.0D0 - r_pf_coil_outer = 0.0D0 - c_pf_cs_coils_peak_ma = 0.0D0 - j_pf_coil_wp_peak = (/3.0D7, 3.0D7, 3.0D7, & - 3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7, & - 3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7, & - 3.0D7, 3.0D7, 3.0D7, 3.0D7, 3.0D7/) - j_cs_critical_flat_top_end = 0.0D0 - j_cs_critical_pulse_start = 0.0D0 - j_pf_wp_critical = 0.0D0 - r_cs_middle = 0.0D0 - routr = 1.5D0 - r_pf_coil_middle = 0.0D0 - rpf1 = 0.0D0 - rpf2 = -1.63D0 - rref = (/7.0D0, 7.0D0, 7.0D0, & - 7.0D0, 7.0D0, 7.0D0, 7.0D0, 7.0D0, 7.0D0, 7.0D0/) - s_shear_cs_peak = 0.0D0 - sigpfcalw = 500.0D0 - sigpfcf = 1.0D0 - ind_pf_cs_plasma_mutual = 0.0D0 - temp_cs_margin = 0.0D0 - n_pf_coil_turns = 0.0D0 - f_a_pf_coil_void = 0.3D0 - f_a_cs_void = 0.3D0 - vs_cs_pf_total_burn = 0.0D0 - vs_pf_coils_total_burn = 0.0D0 - vs_pf_coils_total_ramp = 0.0D0 - vs_pf_coils_total_pulse = 0.0D0 - vs_cs_total_pulse = 0.0D0 - vs_cs_burn = 0.0D0 - vs_cs_ramp = 0.0D0 - vs_cs_pf_total_ramp = 0.0D0 - vs_cs_pf_total_pulse = 0.0D0 - waves = 0.0D0 - m_pf_coil_conductor_total = 0.0D0 - m_pf_coil_structure_total = 0.0D0 - m_pf_coil_conductor = 0.0D0 - m_pf_coil_structure = 0.0D0 - z_pf_coil_upper = 0.0D0 - z_pf_coil_lower = 0.0D0 - z_pf_coil_middle = 0.0D0 - zref = (/3.6D0, 1.2D0, 2.5D0, & - 1.0D0, 1.0D0, 1.0D0, 1.0D0, 1.0D0, 1.0D0, 1.0D0/) - b_cs_limit_max = 13.0 - fb_cs_limit_max = 1.0 - ld_ratio_cst = 70/22 - l_cond_cst = 0.0D0 - d_cond_cst = 0.0D0 - r_in_cst = 0.0D0 - r_out_cst = 3.0D-3 - end subroutine init_pfcoil_variables end module pfcoil_variables From c74e6a92df5519c9afef277b834065da0ee370c5 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 13:23:41 +0000 Subject: [PATCH 19/34] Convert init_watuse_variables to Python --- process/init.py | 3 ++- process/water_use.py | 17 +++++++++++++++++ source/fortran/water_usage_variables.f90 | 23 ----------------------- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/process/init.py b/process/init.py index 3564d5d312..180f1de737 100644 --- a/process/init.py +++ b/process/init.py @@ -26,6 +26,7 @@ from process.stellarator import init_stellarator_module, init_stellarator_variables from process.tfcoil import init_tfcoil_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string +from process.water_use import init_watuse_variables def init_process(): @@ -255,7 +256,7 @@ def init_all_module_vars(): fortran.rebco_variables.init_rebco_variables() fortran.reinke_variables.init_reinke_variables() fortran.define_iteration_variables.init_define_iteration_variables() - fortran.water_usage_variables.init_watuse_variables() + init_watuse_variables() init_cs_fatigue_variables() init_blanket_library() init_dcll_module() diff --git a/process/water_use.py b/process/water_use.py index d37be8b76f..91601ca77a 100644 --- a/process/water_use.py +++ b/process/water_use.py @@ -284,3 +284,20 @@ def cooling_water_body(self, wastetherm: float, output: bool): water_usage_variables.wateruseonethru, "OP ", ) + + +def init_watuse_variables(): + """Initialise water variables""" + water_usage_variables.airtemp = 15.0 + water_usage_variables.watertemp = 5.0 + water_usage_variables.windspeed = 4.0 + water_usage_variables.waterdens = 998.02 + water_usage_variables.latentheat = 2257000.0 + water_usage_variables.volheat = 0.0 + water_usage_variables.evapratio = 0.0 + water_usage_variables.evapvol = 0.0 + water_usage_variables.energypervol = 0.0 + water_usage_variables.volperenergy = 0.0 + water_usage_variables.waterusetower = 0.0 + water_usage_variables.wateruserecirc = 0.0 + water_usage_variables.wateruseonethru = 0.0 diff --git a/source/fortran/water_usage_variables.f90 b/source/fortran/water_usage_variables.f90 index fa670c954e..1c5761c63c 100644 --- a/source/fortran/water_usage_variables.f90 +++ b/source/fortran/water_usage_variables.f90 @@ -58,27 +58,4 @@ module water_usage_variables real(dp) :: wateruseonethru !! total volume of water used in once-through system (m3) - - contains - - subroutine init_watuse_variables - !! Initialise module variables - implicit none - - airtemp = 15.0D0 - watertemp = 5.0D0 - windspeed = 4.0D0 - waterdens = 998.02D0 - latentheat = 2257000.0D0 - volheat = 0.0D0 - evapratio = 0.0D0 - evapvol = 0.0D0 - energypervol = 0.0D0 - volperenergy = 0.0D0 - waterusetower = 0.0D0 - wateruserecirc = 0.0D0 - wateruseonethru = 0.0D0 - - end subroutine init_watuse_variables - end module water_usage_variables From 5f52fd53f418b9dd065332ce59a7b6067d84ab46 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 13:36:41 +0000 Subject: [PATCH 20/34] Convert init_ife_variables to Python --- process/ife.py | 326 +++++++++++++++++++++++++++++++ process/init.py | 3 +- source/fortran/ife_variables.f90 | 181 ----------------- 3 files changed, 328 insertions(+), 182 deletions(-) diff --git a/process/ife.py b/process/ife.py index 6775beb4f5..bc3ec4763d 100644 --- a/process/ife.py +++ b/process/ife.py @@ -2518,3 +2518,329 @@ def _material_string(material_index: int): ) return _material_string + + +def init_ife_variables(): + """Initialise IFE variables""" + ife_variables.bldr = 1.0 + ife_variables.bldrc = 1.0 + ife_variables.bldzl = 4.0 + ife_variables.bldzu = 4.0 + ife_variables.blmatf = np.reshape( + [ + 0.05, + 0.05, + 0.05, + 0.0, + 0.0, + 0.0, + 0.45, + 0.45, + 0.45, + 0.0, + 0.0, + 0.0, + 0.20, + 0.20, + 0.20, + 0.0, + 0.0, + 0.0, + 0.30, + 0.30, + 0.30, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + ife_variables.blmatf.shape, + ) + ife_variables.blmatm[:] = 0.0 + ife_variables.blmatv[:] = 0.0 + ife_variables.blvol[:] = 0.0 + ife_variables.cdriv0 = 154.3 + ife_variables.cdriv1 = 163.2 + ife_variables.cdriv2 = 244.9 + ife_variables.cdriv3 = 1.463 + ife_variables.chdzl = 9.0 + ife_variables.chdzu = 9.0 + ife_variables.chmatf = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] + ife_variables.chmatm[:] = 0.0 + ife_variables.chmatv[:] = 0.0 + ife_variables.chrad = 6.5 + ife_variables.chvol = 0.0 + ife_variables.dcdrv0 = 111.4 + ife_variables.dcdrv1 = 78.0 + ife_variables.dcdrv2 = 59.9 + ife_variables.drveff = 0.28 + ife_variables.edrive = 5.0e6 + ife_variables.etadrv = 0.0 + ife_variables.etali = 0.4 + ife_variables.etave = [ + 0.082, + 0.079, + 0.076, + 0.073, + 0.069, + 0.066, + 0.062, + 0.059, + 0.055, + 0.051, + ] + ife_variables.fauxbop = 0.06 + ife_variables.fbreed = 0.51 + ife_variables.fburn = 0.3333 + ife_variables.flirad = 0.78 + ife_variables.frrmax = 1.0 + ife_variables.fwdr = 0.01 + ife_variables.fwdzl = 0.01 + ife_variables.fwdzu = 0.01 + ife_variables.fwmatf = np.reshape( + [ + 0.05, + 0.05, + 0.05, + 0.0, + 0.0, + 0.0, + 0.95, + 0.95, + 0.95, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + ife_variables.fwmatf.shape, + ) + ife_variables.fwmatm[:] = 0.0 + ife_variables.fwmatv[:] = 0.0 + ife_variables.fwvol[:] = 0.0 + ife_variables.gain = 0.0 + ife_variables.gainve = [ + 60.0, + 95.0, + 115.0, + 125.0, + 133.0, + 141.0, + 152.0, + 160.0, + 165.0, + 170.0, + ] + ife_variables.htpmw_ife = 0.0 + ife_variables.ife = 0 + ife_variables.ifedrv = 2 + ife_variables.ifetyp = 0 + ife_variables.lipmw = 0.0 + ife_variables.mcdriv = 1.0 + ife_variables.mflibe = 0.0 + ife_variables.pdrive = 23.0e6 + ife_variables.pfusife = 1000.0 + ife_variables.pifecr = 10.0 + ife_variables.ptargf = 2.0 + ife_variables.r1 = 0.0 + ife_variables.r2 = 0.0 + ife_variables.r3 = 0.0 + ife_variables.r4 = 0.0 + ife_variables.r5 = 0.0 + ife_variables.r6 = 0.0 + ife_variables.r7 = 0.0 + ife_variables.reprat = 0.0 + ife_variables.rrin = 6.0 + ife_variables.rrmax = 20.0 + ife_variables.shdr = 1.7 + ife_variables.shdzl = 5.0 + ife_variables.shdzu = 5.0 + ife_variables.shmatf = np.reshape( + [ + 0.05, + 0.05, + 0.05, + 0.19, + 0.19, + 0.19, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.665, + 0.665, + 0.665, + 0.095, + 0.095, + 0.095, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + ife_variables.shmatf.shape, + ) + ife_variables.shmatm[:] = 0.0 + ife_variables.shmatv[:] = 0.0 + ife_variables.shvol[:] = 0.0 + ife_variables.sombdr = 2.7 + ife_variables.somtdr = 2.7 + ife_variables.taufall = 0.0 + ife_variables.tdspmw = 0.01 + ife_variables.tfacmw = 0.0 + ife_variables.tgain = 85.0 + ife_variables.uccarb = 50.0 + ife_variables.ucconc = 0.1 + ife_variables.ucflib = 84.0 + ife_variables.uctarg = 0.3 + ife_variables.v1dr = 0.0 + ife_variables.v1dzl = 0.0 + ife_variables.v1dzu = 0.0 + ife_variables.v1matf = np.reshape( + [ + 1.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + ife_variables.v1matf.shape, + ) + ife_variables.v1matm[:] = 0.0 + ife_variables.v1matv[:] = 0.0 + ife_variables.v1vol[:] = 0.0 + ife_variables.v2dr = 2.0 + ife_variables.v2dzl = 7.0 + ife_variables.v2dzu = 7.0 + ife_variables.v2matf = np.reshape( + [ + 1.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + ife_variables.v2matf.shape, + ) + ife_variables.v2matm[:] = 0.0 + ife_variables.v2matv[:] = 0.0 + ife_variables.v2vol[:] = 0.0 + ife_variables.v3dr = 43.3 + ife_variables.v3dzl = 30.0 + ife_variables.v3dzu = 20.0 + ife_variables.v3matf = np.reshape( + [ + 1.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + ife_variables.v3matf.shape, + ) + ife_variables.v3matm[:] = 0.0 + ife_variables.v3matv[:] = 0.0 + ife_variables.v3vol[:] = 0.0 + ife_variables.zl1 = 0.0 + ife_variables.zl2 = 0.0 + ife_variables.zl3 = 0.0 + ife_variables.zl4 = 0.0 + ife_variables.zl5 = 0.0 + ife_variables.zl6 = 0.0 + ife_variables.zl7 = 0.0 + ife_variables.zu1 = 0.0 + ife_variables.zu2 = 0.0 + ife_variables.zu3 = 0.0 + ife_variables.zu4 = 0.0 + ife_variables.zu5 = 0.0 + ife_variables.zu6 = 0.0 + ife_variables.zu7 = 0.0 diff --git a/process/init.py b/process/init.py index 180f1de737..00717a436d 100644 --- a/process/init.py +++ b/process/init.py @@ -18,6 +18,7 @@ from process.divertor import init_divertor_variables from process.exceptions import ProcessValidationError from process.hcpb import init_ccfe_hcpb_module +from process.ife import init_ife_variables from process.impurity_radiation import init_impurity_radiation_module from process.input import parse_input_file from process.pfcoil import init_pfcoil_module, init_pfcoil_variables @@ -232,7 +233,7 @@ def init_all_module_vars(): fortran.global_variables.init_global_variables() init_ccfe_hcpb_module() fortran.heat_transport_variables.init_heat_transport_variables() - fortran.ife_variables.init_ife_variables() + init_ife_variables() init_impurity_radiation_module() init_pfcoil_module() fortran.physics_module.init_physics_module() diff --git a/source/fortran/ife_variables.f90 b/source/fortran/ife_variables.f90 index fe15297bf6..be6c1c81a2 100644 --- a/source/fortran/ife_variables.f90 +++ b/source/fortran/ife_variables.f90 @@ -392,185 +392,4 @@ module ife_variables real(dp) :: zu7 !! IFE vertical build above centre (m) - - contains - - subroutine init_ife_variables - !! Initialise module variables - implicit none - - bldr = 1.0D0 - bldrc = 1.0D0 - bldzl = 4.0D0 - bldzu = 4.0D0 - blmatf = reshape( (/ & - 0.05D0,0.05D0,0.05D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.45D0,0.45D0,0.45D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.20D0,0.20D0,0.20D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.30D0,0.30D0,0.30D0, & - 0.0D0,0.0D0,0.0D0, & - 0.0D0, 0.0D0, 0.0D0 /), shape(blmatf)) - blmatm = 0.0D0 - blmatv = 0.0D0 - blvol = 0.0D0 - cdriv0 = 154.3D0 - cdriv1 = 163.2D0 - cdriv2 = 244.9D0 - cdriv3 = 1.463D0 - chdzl = 9.0D0 - chdzu = 9.0D0 - chmatf = & - (/1.0D0,0.0D0,0.0D0,0.0D0,0.0D0,0.0D0,0.0D0,0.0D0,0.0D0/) - chmatm = 0.0D0 - chmatv = 0.0D0 - chrad = 6.5D0 - chvol = 0.0D0 - dcdrv0 = 111.4D0 - dcdrv1 = 78.0D0 - dcdrv2 = 59.9D0 - drveff = 0.28D0 - edrive = 5.0D6 - etadrv = 0.0D0 - etali = 0.4D0 - etave = (/ & - 0.082D0,0.079D0,0.076D0,0.073D0,0.069D0, & - 0.066D0,0.062D0,0.059D0,0.055D0,0.051D0 /) - fauxbop = 0.06D0 - fbreed = 0.51D0 - fburn = 0.3333D0 - flirad = 0.78D0 - frrmax = 1.0D0 - fwdr = 0.01D0 - fwdzl = 0.01D0 - fwdzu = 0.01D0 - fwmatf = reshape( (/ & - 0.05D0,0.05D0,0.05D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.95D0,0.95D0,0.95D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0 /), shape(fwmatf)) - fwmatm = 0.0D0 - fwmatv = 0.0D0 - fwvol = 0.0D0 - gain = 0.0D0 - gainve = (/ & - 60.0D0, 95.0D0,115.0D0,125.0D0,133.0D0, & - 141.0D0,152.0D0,160.0D0,165.0D0,170.0D0 /) - htpmw_ife = 0.0D0 - ife = 0 - ifedrv = 2 - ifetyp = 0 - lipmw = 0.0D0 - mcdriv = 1.0D0 - mflibe = 0.0D0 - pdrive = 23.0D6 - pfusife = 1000.0D0 - pifecr = 10.0D0 - ptargf = 2.0D0 - r1 = 0.0D0 - r2 = 0.0D0 - r3 = 0.0D0 - r4 = 0.0D0 - r5 = 0.0D0 - r6 = 0.0D0 - r7 = 0.0D0 - reprat = 0.0D0 - rrin = 6.0D0 - rrmax = 20.0D0 - shdr = 1.7D0 - shdzl = 5.0D0 - shdzu = 5.0D0 - shmatf = reshape( (/ & - 0.05D0,0.05D0,0.05D0, & - 0.19D0,0.19D0,0.19D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.665D0,0.665D0,0.665D0, & - 0.095D0,0.095D0,0.095D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0 /), shape(shmatf)) - shmatm = 0.0D0 - shmatv = 0.0D0 - shvol = 0.0D0 - sombdr = 2.7D0 - somtdr = 2.7D0 - taufall = 0.0D0 - tdspmw = 0.01D0 - tfacmw = 0.0D0 - tgain = 85.0D0 - uccarb = 50.0D0 - ucconc = 0.1D0 - ucflib = 84.0D0 - uctarg = 0.3D0 - v1dr = 0.0D0 - v1dzl = 0.0D0 - v1dzu = 0.0D0 - v1matf = reshape( (/ & - 1.0D0, 1.0D0, 1.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0 /), shape(v1matf)) - v1matm = 0.0D0 - v1matv = 0.0D0 - v1vol = 0.0D0 - v2dr = 2.0D0 - v2dzl = 7.0D0 - v2dzu = 7.0D0 - v2matf = reshape( (/ & - 1.0D0, 1.0D0, 1.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0 /), shape(v2matf)) - v2matm = 0.0D0 - v2matv = 0.0D0 - v2vol = 0.0D0 - v3dr = 43.3D0 - v3dzl = 30.0D0 - v3dzu = 20.0D0 - v3matf = reshape( (/ & - 1.0D0, 1.0D0, 1.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0, & - 0.0D0, 0.0D0, 0.0D0 /), shape(v3matf)) - v3matm = 0.0D0 - v3matv = 0.0D0 - v3vol = 0.0D0 - zl1 = 0.0D0 - zl2 = 0.0D0 - zl3 = 0.0D0 - zl4 = 0.0D0 - zl5 = 0.0D0 - zl6 = 0.0D0 - zl7 = 0.0D0 - zu1 = 0.0D0 - zu2 = 0.0D0 - zu3 = 0.0D0 - zu4 = 0.0D0 - zu5 = 0.0D0 - zu6 = 0.0D0 - zu7 = 0.0D0 - end subroutine init_ife_variables end module ife_variables From 665b811dd5d900ede042b863bc319c7700724990 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 13:43:44 +0000 Subject: [PATCH 21/34] Convert init_fwbs_variables to Python --- process/fw.py | 194 +++++++++++++++++++++++++++++ process/init.py | 3 +- process/tf_coil.py | 5 +- source/fortran/fwbs_variables.f90 | 199 ------------------------------ 4 files changed, 200 insertions(+), 201 deletions(-) diff --git a/process/fw.py b/process/fw.py index 4228f81dd0..81112008db 100644 --- a/process/fw.py +++ b/process/fw.py @@ -561,3 +561,197 @@ def output_fw_pumping(self): fwbs_variables.temp_fw_peak, "OP ", ) + + +def init_fwbs_variables(): + """Initialise FWBS variables""" + fwbs_variables.life_blkt_fpy = 0.0 + fwbs_variables.life_blkt = 0.0 + fwbs_variables.m_fw_blkt_div_coolant_total = 0.0 + fwbs_variables.m_vv = 0.0 + fwbs_variables.denstl = 7800.0 + fwbs_variables.denwc = 15630.0 + fwbs_variables.dewmkg = 0.0 + fwbs_variables.emult = 1.269 + fwbs_variables.emultmw = 0.0 + fwbs_variables.fblss = 0.09705 + fwbs_variables.f_ster_div_single = 0.115 + fwbs_variables.f_a_fw_hcd = 0.0 + fwbs_variables.fhole = 0.0 + fwbs_variables.i_fw_blkt_vv_shape = 2 + fwbs_variables.life_fw_fpy = 0.0 + fwbs_variables.m_fw_total = 0.0 + fwbs_variables.fw_armour_mass = 0.0 + fwbs_variables.fw_armour_thickness = 0.005 + fwbs_variables.fw_armour_vol = 0.0 + fwbs_variables.i_blanket_type = 1 + fwbs_variables.i_blkt_inboard = 1 + fwbs_variables.inuclear = 0 + fwbs_variables.qnuc = 0.0 + fwbs_variables.f_blkt_li6_enrichment = 30.0 + fwbs_variables.p_blkt_nuclear_heat_total_mw = 0.0 + fwbs_variables.p_div_nuclear_heat_total_mw = 0.0 + fwbs_variables.p_fw_nuclear_heat_total_mw = 0.0 + fwbs_variables.p_fw_hcd_nuclear_heat_mw = 0.0 + fwbs_variables.pnucloss = 0.0 + fwbs_variables.pnucvvplus = 0.0 + fwbs_variables.pnucshld = 0.0 + fwbs_variables.m_blkt_total = 0.0 + fwbs_variables.m_blkt_steel_total = 0.0 + fwbs_variables.armour_fw_bl_mass = 0.0 + fwbs_variables.breeder_f = 0.5 + fwbs_variables.breeder_multiplier = 0.75 + fwbs_variables.vfcblkt = 0.05295 + fwbs_variables.vfpblkt = 0.1 + fwbs_variables.m_blkt_li4sio4 = 0.0 + fwbs_variables.m_blkt_tibe12 = 0.0 + fwbs_variables.f_neut_shield = -1.0 + fwbs_variables.f_a_fw_coolant_inboard = 0.0 + fwbs_variables.f_a_fw_coolant_outboard = 0.0 + fwbs_variables.psurffwi = 0.0 + fwbs_variables.psurffwo = 0.0 + fwbs_variables.vol_fw_total = 0.0 + fwbs_variables.f_vol_blkt_steel = 0.0 + fwbs_variables.f_vol_blkt_li4sio4 = 0.0 + fwbs_variables.f_vol_blkt_tibe12 = 0.0 + fwbs_variables.breedmat = 1 + fwbs_variables.densbreed = 0.0 + fwbs_variables.fblbe = 0.6 + fwbs_variables.fblbreed = 0.154 + fwbs_variables.fblhebmi = 0.4 + fwbs_variables.fblhebmo = 0.4 + fwbs_variables.fblhebpi = 0.6595 + fwbs_variables.fblhebpo = 0.6713 + fwbs_variables.hcdportsize = 1 + fwbs_variables.nflutf = 0.0 + fwbs_variables.npdiv = 2 + fwbs_variables.nphcdin = 2 + fwbs_variables.nphcdout = 2 + fwbs_variables.tbr = 0.0 + fwbs_variables.tritprate = 0.0 + fwbs_variables.wallpf = 1.21 + fwbs_variables.whtblbreed = 0.0 + fwbs_variables.m_blkt_beryllium = 0.0 + fwbs_variables.i_coolant_pumping = 2 + fwbs_variables.i_shield_mat = 0 + fwbs_variables.i_thermal_electric_conversion = 0 + fwbs_variables.secondary_cycle_liq = 4 + fwbs_variables.i_blkt_coolant_type = 1 + fwbs_variables.i_fw_coolant_type = "helium" + fwbs_variables.dr_fw_wall = 0.003 + fwbs_variables.radius_fw_channel = 0.006 + fwbs_variables.dx_fw_module = 0.02 + fwbs_variables.temp_fw_coolant_in = 573.0 + fwbs_variables.temp_fw_coolant_out = 823.0 + fwbs_variables.pres_fw_coolant = 15.5e6 + fwbs_variables.temp_fw_peak = 873.0 + fwbs_variables.roughness = 1.0e-6 + fwbs_variables.len_fw_channel = 4.0 + fwbs_variables.f_fw_peak = 1.0 + fwbs_variables.pres_blkt_coolant = 15.50e6 + fwbs_variables.temp_blkt_coolant_in = 573.0 + fwbs_variables.temp_blkt_coolant_out = 823.0 + fwbs_variables.coolp = 15.5e6 + fwbs_variables.n_blkt_outboard_modules_poloidal = 8 + fwbs_variables.n_blkt_inboard_modules_poloidal = 7 + fwbs_variables.n_blkt_outboard_modules_toroidal = 48 + fwbs_variables.n_blkt_inboard_modules_toroidal = 32 + fwbs_variables.temp_fw_max = 823.0 + fwbs_variables.fw_th_conductivity = 28.34 + fwbs_variables.fvoldw = 1.74 + fwbs_variables.fvolsi = 1.0 + fwbs_variables.fvolso = 0.64 + fwbs_variables.fwclfr = 0.15 + fwbs_variables.p_div_rad_total_mw = 0.0 + fwbs_variables.p_fw_rad_total_mw = 0.0 + fwbs_variables.p_fw_hcd_rad_total_mw = 0.0 + fwbs_variables.pradloss = 0.0 + fwbs_variables.ptfnuc = 0.0 + fwbs_variables.ptfnucpm3 = 0.0 + fwbs_variables.r_cryostat_inboard = 0.0 + fwbs_variables.z_cryostat_half_inside = 0.0 + fwbs_variables.dr_pf_cryostat = 0.5 + fwbs_variables.vol_cryostat = 0.0 + fwbs_variables.vol_cryostat_internal = 0.0 + fwbs_variables.vol_vv = 0.0 + fwbs_variables.vfshld = 0.25 + fwbs_variables.vol_blkt_total = 0.0 + fwbs_variables.vol_blkt_inboard = 0.0 + fwbs_variables.vol_blkt_outboard = 0.0 + fwbs_variables.volshld = 0.0 + fwbs_variables.whtshld = 0.0 + fwbs_variables.wpenshld = 0.0 + fwbs_variables.wtshldi = 0.0 + fwbs_variables.wtshldo = 0.0 + fwbs_variables.irefprop = 1 + fwbs_variables.fblli = 0.0 + fwbs_variables.fblli2o = 0.08 + fwbs_variables.fbllipb = 0.68 + fwbs_variables.fblvd = 0.0 + fwbs_variables.m_blkt_li2o = 0.0 + fwbs_variables.wtbllipb = 0.0 + fwbs_variables.m_blkt_vanadium = 0.0 + fwbs_variables.m_blkt_lithium = 0.0 + fwbs_variables.vfblkt = 0.25 + fwbs_variables.blktmodel = 0 + fwbs_variables.declblkt = 0.075 + fwbs_variables.declfw = 0.075 + fwbs_variables.declshld = 0.075 + fwbs_variables.blkttype = 3 + fwbs_variables.etaiso = 0.85 + fwbs_variables.etahtp = 0.95 + fwbs_variables.pnuc_cp = 0.0 + fwbs_variables.pnuc_cp_sh = 0.0 + fwbs_variables.pnuc_cp_tf = 0.0 + fwbs_variables.neut_flux_cp = 0.0 + fwbs_variables.i_fw_blkt_shared_coolant = 0 + fwbs_variables.i_blkt_liquid_breeder_type = 0 + fwbs_variables.i_blkt_dual_coolant = 0 + fwbs_variables.i_blkt_liquid_breeder_channel_type = 0 + fwbs_variables.ims = 0 + fwbs_variables.n_liq_recirc = 10 + fwbs_variables.r_f_liq_ib = 0.5 + fwbs_variables.r_f_liq_ob = 0.5 + fwbs_variables.w_f_liq_ib = 0.5 + fwbs_variables.w_f_liq_ob = 0.5 + fwbs_variables.den_ceramic = 3.21e3 + fwbs_variables.th_wall_secondary = 1.25e-2 + fwbs_variables.bz_channel_conduct_liq = 8.33e5 + fwbs_variables.a_bz_liq = 0.2 + fwbs_variables.b_bz_liq = 0.2 + fwbs_variables.nopol = 2 + fwbs_variables.nopipes = 4 + fwbs_variables.den_liq = 9.5e3 + fwbs_variables.specific_heat_liq = 1.9e2 + fwbs_variables.thermal_conductivity_liq = 30.0 + fwbs_variables.wht_liq = 0.0 + fwbs_variables.wht_liq_ib = 0.0 + fwbs_variables.wht_liq_ob = 0.0 + fwbs_variables.dynamic_viscosity_liq = 0.0 + fwbs_variables.electrical_conductivity_liq = 0.0 + fwbs_variables.hartmann_liq = (0.0, 0.0) + fwbs_variables.b_mag_blkt = (5.0, 5.0) + fwbs_variables.etaiso_liq = 0.85 + fwbs_variables.blpressure_liq = 1.7e6 + fwbs_variables.inlet_temp_liq = 570.0 + fwbs_variables.outlet_temp_liq = 720.0 + fwbs_variables.den_fw_coolant = 0.0 + fwbs_variables.visc_fw_coolant = 0.0 + fwbs_variables.den_blkt_coolant = 0.0 + fwbs_variables.visc_blkt_coolant = 0.0 + fwbs_variables.cp_fw = 0.0 + fwbs_variables.cv_fw = 0.0 + fwbs_variables.cp_bl = 0.0 + fwbs_variables.cv_bl = 0.0 + fwbs_variables.f_nuc_pow_bz_struct = 0.34 + fwbs_variables.f_nuc_pow_bz_liq = 0.66 + fwbs_variables.pnuc_fw_ratio_dcll = 0.14 + fwbs_variables.pnuc_blkt_ratio_dcll = 0.86 + fwbs_variables.bzfllengi_n_rad = 4 + fwbs_variables.bzfllengi_n_pol = 2 + fwbs_variables.bzfllengo_n_rad = 4 + fwbs_variables.bzfllengo_n_pol = 2 + fwbs_variables.bzfllengi_n_rad_liq = 2 + fwbs_variables.bzfllengi_n_pol_liq = 2 + fwbs_variables.bzfllengo_n_rad_liq = 2 + fwbs_variables.bzfllengo_n_pol_liq = 2 diff --git a/process/init.py b/process/init.py index 00717a436d..beaaefeba5 100644 --- a/process/init.py +++ b/process/init.py @@ -17,6 +17,7 @@ from process.dcll import init_dcll_module from process.divertor import init_divertor_variables from process.exceptions import ProcessValidationError +from process.fw import init_fwbs_variables from process.hcpb import init_ccfe_hcpb_module from process.ife import init_ife_variables from process.impurity_radiation import init_impurity_radiation_module @@ -229,7 +230,7 @@ def init_all_module_vars(): init_cost_variables() init_divertor_variables() fortran.error_handling.init_error_handling() - fortran.fwbs_variables.init_fwbs_variables() + init_fwbs_variables() fortran.global_variables.init_global_variables() init_ccfe_hcpb_module() fortran.heat_transport_variables.init_heat_transport_variables() diff --git a/process/tf_coil.py b/process/tf_coil.py index 6e316ab9f3..df3f6a0be7 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -22,7 +22,10 @@ from process.fortran import error_handling as eh from process.fortran import fwbs_variables as fwbsv from process.fortran import tfcoil_variables as tfv -from process.utilities.f2py_string_patch import f2py_compatible_to_string +from process.utilities.f2py_string_patch import ( + f2py_compatible_to_string, + string_to_f2py_compatible, +) RMU0 = constants.rmu0 diff --git a/source/fortran/fwbs_variables.f90 b/source/fortran/fwbs_variables.f90 index bf97b8779c..158c22bb50 100644 --- a/source/fortran/fwbs_variables.f90 +++ b/source/fortran/fwbs_variables.f90 @@ -638,203 +638,4 @@ module fwbs_variables integer :: bzfllengi_n_rad_liq, bzfllengi_n_pol_liq, bzfllengo_n_rad_liq, bzfllengo_n_pol_liq !! Number of radial and poloidal sections that make up the total secondary coolant/breeder !! flow length in a blanket module (IB and OB) - - contains - - subroutine init_fwbs_variables - !! Initialise fwbs variables - implicit none - - life_blkt_fpy = 0.0D0 - life_blkt = 0.0D0 - m_fw_blkt_div_coolant_total = 0.0D0 - m_vv = 0.0D0 - denstl = 7800.0D0 - denwc = 15630.0D0 - dewmkg = 0.0D0 - emult = 1.269D0 - emultmw = 0.0D0 - fblss = 0.09705D0 - f_ster_div_single = 0.115D0 - f_a_fw_hcd = 0.0D0 - fhole = 0.0D0 - i_fw_blkt_vv_shape = 2 - life_fw_fpy = 0.0D0 - m_fw_total = 0.0D0 - fw_armour_mass = 0.0D0 - fw_armour_thickness = 0.005D0 - fw_armour_vol = 0.0D0 - i_blanket_type = 1 - i_blkt_inboard = 1 - inuclear = 0 - qnuc = 0.0D0 - f_blkt_li6_enrichment = 30.0D0 - p_blkt_nuclear_heat_total_mw = 0.0D0 - p_div_nuclear_heat_total_mw = 0.0D0 - p_fw_nuclear_heat_total_mw = 0.0D0 - p_fw_hcd_nuclear_heat_mw = 0.0D0 - pnucloss = 0.0D0 - pnucvvplus = 0.0D0 - pnucshld = 0.0D0 - m_blkt_total = 0.0D0 - m_blkt_steel_total = 0.0D0 - armour_fw_bl_mass = 0.0D0 - breeder_f = 0.5D0 - breeder_multiplier = 0.75D0 - vfcblkt = 0.05295D0 - vfpblkt = 0.1D0 - m_blkt_li4sio4 = 0.0D0 - m_blkt_tibe12 = 0.0D0 - f_neut_shield = -1.0D0 - f_a_fw_coolant_inboard = 0.0D0 - f_a_fw_coolant_outboard = 0.0D0 - psurffwi = 0.0D0 - psurffwo = 0.0D0 - vol_fw_total = 0.0D0 - f_vol_blkt_steel = 0.0D0 - f_vol_blkt_li4sio4 = 0.0D0 - f_vol_blkt_tibe12 = 0.0D0 - breedmat = 1 - densbreed = 0.0D0 - fblbe = 0.6D0 - fblbreed = 0.154D0 - fblhebmi = 0.4D0 - fblhebmo = 0.4D0 - fblhebpi = 0.6595D0 - fblhebpo = 0.6713D0 - hcdportsize = 1 - nflutf = 0.0D0 - npdiv = 2 - nphcdin = 2 - nphcdout = 2 - tbr = 0.0D0 - tritprate = 0.0D0 - wallpf = 1.21D0 - whtblbreed = 0.0D0 - m_blkt_beryllium = 0.0D0 - i_coolant_pumping = 2 - i_shield_mat = 0 - i_thermal_electric_conversion = 0 - secondary_cycle_liq = 4 - i_blkt_coolant_type = 1 - i_fw_coolant_type = 'helium' - dr_fw_wall = 0.003D0 - radius_fw_channel = 0.006D0 - dx_fw_module = 0.02D0 - temp_fw_coolant_in = 573.0D0 - temp_fw_coolant_out = 823.0D0 - pres_fw_coolant = 15.5D6 - temp_fw_peak = 873.0D0 - roughness = 1.0D-6 - len_fw_channel = 4.0D0 - f_fw_peak = 1.0D0 - pres_blkt_coolant = 15.50D6 - temp_blkt_coolant_in = 573.0D0 - temp_blkt_coolant_out = 823.0D0 - coolp = 15.5D6 - n_blkt_outboard_modules_poloidal = 8 - n_blkt_inboard_modules_poloidal = 7 - n_blkt_outboard_modules_toroidal = 48 - n_blkt_inboard_modules_toroidal = 32 - temp_fw_max = 823.0D0 - fw_th_conductivity = 28.34D0 - fvoldw = 1.74D0 - fvolsi = 1.0D0 - fvolso = 0.64D0 - fwclfr = 0.15D0 - p_div_rad_total_mw = 0.0D0 - p_fw_rad_total_mw = 0.0D0 - p_fw_hcd_rad_total_mw = 0.0D0 - pradloss = 0.0D0 - ptfnuc = 0.0D0 - ptfnucpm3 = 0.0D0 - r_cryostat_inboard = 0.0D0 - z_cryostat_half_inside = 0.0D0 - dr_pf_cryostat = 0.5D0 - vol_cryostat = 0.0D0 - vol_cryostat_internal = 0.0D0 - vol_vv = 0.0D0 - vfshld = 0.25D0 - vol_blkt_total = 0.0D0 - vol_blkt_inboard = 0.0D0 - vol_blkt_outboard = 0.0D0 - volshld = 0.0D0 - whtshld = 0.0D0 - wpenshld = 0.0D0 - wtshldi = 0.0D0 - wtshldo = 0.0D0 - irefprop = 1 - fblli = 0.0D0 - fblli2o = 0.08D0 - fbllipb = 0.68D0 - fblvd = 0.0D0 - m_blkt_li2o = 0.0D0 - wtbllipb = 0.0D0 - m_blkt_vanadium = 0.0D0 - m_blkt_lithium = 0.0D0 - vfblkt = 0.25D0 - blktmodel = 0 - declblkt = 0.075D0 - declfw = 0.075D0 - declshld = 0.075D0 - blkttype = 3 - etaiso = 0.85D0 - etahtp = 0.95D0 - pnuc_cp = 0.0D0 - pnuc_cp_sh = 0.0D0 - pnuc_cp_tf = 0.0D0 - neut_flux_cp = 0.0D0 - i_fw_blkt_shared_coolant = 0 - i_blkt_liquid_breeder_type = 0 - i_blkt_dual_coolant = 0 - i_blkt_liquid_breeder_channel_type = 0 - ims = 0 - n_liq_recirc = 10 - r_f_liq_ib=0.5 - r_f_liq_ob=0.5 - w_f_liq_ib=0.5 - w_f_liq_ob=0.5 - den_ceramic = 3.21D3 - th_wall_secondary = 1.25D-2 - bz_channel_conduct_liq = 8.33D5 - a_bz_liq = 0.2D0 - b_bz_liq = 0.2D0 - nopol = 2 - nopipes = 4 - den_liq = 9.5D3 - specific_heat_liq = 1.9D2 - thermal_conductivity_liq = 30.0 - wht_liq = 0.0D0 - wht_liq_ib = 0.0D0 - wht_liq_ob = 0.0D0 - dynamic_viscosity_liq = 0.0D0 - electrical_conductivity_liq = 0.0D0 - hartmann_liq = (0.0D0, 0.0D0) - b_mag_blkt = (5.0D0, 5.0D0) - etaiso_liq = 0.85D0 - blpressure_liq = 1.7D6 - inlet_temp_liq = 570.0D0 - outlet_temp_liq = 720.0D0 - den_fw_coolant = 0.0D0 - visc_fw_coolant = 0.0D0 - den_blkt_coolant = 0.0D0 - visc_blkt_coolant = 0.0D0 - cp_fw = 0.0D0 - cv_fw = 0.0D0 - cp_bl = 0.0D0 - cv_bl = 0.0D0 - f_nuc_pow_bz_struct = 0.34D0 - f_nuc_pow_bz_liq = 0.66D0 - pnuc_fw_ratio_dcll = 0.14D0 - pnuc_blkt_ratio_dcll = 0.86D0 - bzfllengi_n_rad = 4 - bzfllengi_n_pol = 2 - bzfllengo_n_rad = 4 - bzfllengo_n_pol = 2 - bzfllengi_n_rad_liq = 2 - bzfllengi_n_pol_liq = 2 - bzfllengo_n_rad_liq = 2 - bzfllengo_n_pol_liq = 2 - - end subroutine init_fwbs_variables end module fwbs_variables From 6824f9d106cef21a6b84d6a49187b4801f5c6fc1 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 13:49:46 +0000 Subject: [PATCH 22/34] Convert init_physics_module to Python --- process/init.py | 4 ++-- process/physics.py | 28 ++++++++++++++++++++++++++++ source/fortran/physics.f90 | 33 --------------------------------- 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/process/init.py b/process/init.py index beaaefeba5..3d5aacc2fa 100644 --- a/process/init.py +++ b/process/init.py @@ -23,7 +23,7 @@ from process.impurity_radiation import init_impurity_radiation_module from process.input import parse_input_file from process.pfcoil import init_pfcoil_module, init_pfcoil_variables -from process.physics import init_physics_variables +from process.physics import init_physics_module, init_physics_variables from process.sctfcoil import init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables from process.tfcoil import init_tfcoil_variables @@ -237,7 +237,7 @@ def init_all_module_vars(): init_ife_variables() init_impurity_radiation_module() init_pfcoil_module() - fortran.physics_module.init_physics_module() + init_physics_module() init_physics_variables() fortran.scan_module.init_scan_module() init_sctfcoil_module() diff --git a/process/physics.py b/process/physics.py index d49bc418c9..f0dea692b3 100644 --- a/process/physics.py +++ b/process/physics.py @@ -8203,3 +8203,31 @@ def init_physics_variables(): physics_variables.a_plasma_poloidal = 0.0 physics_variables.zeff = 0.0 physics_variables.zeffai = 0.0 + + +def init_physics_module(): + """Initialise the physics module""" + physics_module.first_call = 1 + physics_module.iscz = 0 + physics_module.err242 = 0 + physics_module.err243 = 0 + physics_module.rad_fraction_lcfs = 0.0 + physics_module.e_plasma_beta = 0.0 + physics_module.total_loss_power = 0.0 + physics_module.t_energy_confinement_beta = 0.0 + physics_module.ptarmw = 0.0 + physics_module.lambdaio = 0.0 + physics_module.drsep = 0.0 + physics_module.fio = 0.0 + physics_module.fli = 0.0 + physics_module.flo = 0.0 + physics_module.fui = 0.0 + physics_module.fuo = 0.0 + physics_module.plimw = 0.0 + physics_module.plomw = 0.0 + physics_module.puimw = 0.0 + physics_module.puomw = 0.0 + physics_module.rho_star = 0.0 + physics_module.nu_star = 0.0 + physics_module.beta_mcdonald = 0.0 + physics_module.itart_r = 0.0 diff --git a/source/fortran/physics.f90 b/source/fortran/physics.f90 index 9598f1d98f..8fbf9b477d 100644 --- a/source/fortran/physics.f90 +++ b/source/fortran/physics.f90 @@ -32,37 +32,4 @@ module physics_module ! Var in subroutine plasma_composition which requires re-initialisation on ! each new run integer :: first_call - - contains - - subroutine init_physics_module - !! Initialise module variables - implicit none - - first_call = 1 - iscz = 0 - err242 = 0 - err243 = 0 - rad_fraction_LCFS = 0.0D0 - e_plasma_beta = 0.0D0 - total_loss_power = 0.0D0 - t_energy_confinement_beta = 0.0D0 - ptarmw = 0.0D0 - lambdaio = 0.0D0 - drsep = 0.0D0 - fio = 0.0D0 - fLI = 0.0D0 - fLO = 0.0D0 - fUI = 0.0D0 - fUO = 0.0D0 - pLImw = 0.0D0 - pLOmw = 0.0D0 - pUImw = 0.0D0 - pUOmw = 0.0D0 - rho_star = 0.0D0 - nu_star = 0.0D0 - beta_mcdonald = 0.0D0 - itart_r = 0.0D0 - end subroutine init_physics_module - end module physics_module From 33aee53000f15829597634530f5ffd7f22f4e410 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 13:51:42 +0000 Subject: [PATCH 23/34] Convert init_structure_variables to Python --- process/init.py | 3 ++- process/structure.py | 9 +++++++++ source/fortran/structure_variables.f90 | 13 ------------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/process/init.py b/process/init.py index 3d5aacc2fa..eb6451a733 100644 --- a/process/init.py +++ b/process/init.py @@ -26,6 +26,7 @@ from process.physics import init_physics_module, init_physics_variables from process.sctfcoil import init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables +from process.structure import init_structure_variables from process.tfcoil import init_tfcoil_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string from process.water_use import init_watuse_variables @@ -249,7 +250,7 @@ def init_all_module_vars(): init_current_drive_variables() fortran.primary_pumping_variables.init_primary_pumping_variables() init_pfcoil_variables() - fortran.structure_variables.init_structure_variables() + init_structure_variables() fortran.vacuum_variables.init_vacuum_variables() fortran.pf_power_variables.init_pf_power_variables() init_build_variables() diff --git a/process/structure.py b/process/structure.py index 1b41e8e2df..751f7fb56b 100644 --- a/process/structure.py +++ b/process/structure.py @@ -242,3 +242,12 @@ def structure( po.ovarre(self.outfile, "Ring legs mass (kg)", "(gsm3)", gsm3, "OP ") return fncmass, aintmass, clgsmass, coldmass, gsm + + +def init_structure_variables(): + """Initialise structure variables""" + stv.aintmass = 0.0 + stv.clgsmass = 0.0 + stv.coldmass = 0.0 + stv.fncmass = 0.0 + stv.gsmass = 0.0 diff --git a/source/fortran/structure_variables.f90 b/source/fortran/structure_variables.f90 index d5e483fa6f..c7427de52e 100644 --- a/source/fortran/structure_variables.f90 +++ b/source/fortran/structure_variables.f90 @@ -28,17 +28,4 @@ module structure_variables real(dp) :: gsmass !! reactor core gravity support mass (kg) - - contains - - subroutine init_structure_variables - !! Initialise module variables - implicit none - - aintmass = 0.0D0 - clgsmass = 0.0D0 - coldmass = 0.0D0 - fncmass = 0.0D0 - gsmass = 0.0D0 - end subroutine init_structure_variables end module structure_variables From 057ed403d58ff98aaf556fac8119f070d47cef26 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 13:58:10 +0000 Subject: [PATCH 24/34] Convert init_vacuum_variables to Python --- process/init.py | 3 ++- process/vacuum.py | 29 ++++++++++++++++++++++++++++- source/fortran/vacuum_variables.f90 | 28 ---------------------------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/process/init.py b/process/init.py index eb6451a733..7e32dc68e6 100644 --- a/process/init.py +++ b/process/init.py @@ -29,6 +29,7 @@ from process.structure import init_structure_variables from process.tfcoil import init_tfcoil_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string +from process.vacuum import init_vacuum_variables from process.water_use import init_watuse_variables @@ -251,7 +252,7 @@ def init_all_module_vars(): fortran.primary_pumping_variables.init_primary_pumping_variables() init_pfcoil_variables() init_structure_variables() - fortran.vacuum_variables.init_vacuum_variables() + init_vacuum_variables() fortran.pf_power_variables.init_pf_power_variables() init_build_variables() fortran.constraint_variables.init_constraint_variables() diff --git a/process/vacuum.py b/process/vacuum.py index 8b5ce426c5..da4fbc2799 100644 --- a/process/vacuum.py +++ b/process/vacuum.py @@ -11,7 +11,10 @@ from process.fortran import tfcoil_variables as tfv from process.fortran import times_variables as tv from process.fortran import vacuum_variables as vacv -from process.utilities.f2py_string_patch import f2py_compatible_to_string +from process.utilities.f2py_string_patch import ( + f2py_compatible_to_string, + string_to_f2py_compatible, +) logger = logging.getLogger(__name__) @@ -665,3 +668,27 @@ def vacuum( ) return pumpn, nduct, dlscalc, mvdsh, dimax + + +def init_vacuum_variables(): + """Initialise Vacuum variables""" + vacv.vacuum_model = string_to_f2py_compatible(vacv.vacuum_model, "old") + vacv.niterpump = 0.0 + vacv.ntype = 1 + vacv.nvduct = 0 + vacv.dlscal = 0.0 + vacv.pbase = 5.0e-4 + vacv.prdiv = 0.36 + vacv.pumptp = 1.2155e22 + vacv.rat = 1.3e-8 + vacv.tn = 300.0 + vacv.vacdshm = 0.0 + vacv.vcdimax = 0.0 + vacv.vpumpn = 0 + vacv.dwell_pump = 0 + vacv.pumpareafraction = 0.0203 + vacv.pumpspeedmax = 27.3 + vacv.pumpspeedfactor = 0.167 + vacv.initialpressure = 1.0 + vacv.outgasindex = 1.0 + vacv.outgasfactor = 0.0235 diff --git a/source/fortran/vacuum_variables.f90 b/source/fortran/vacuum_variables.f90 index 8c2e47d254..5f5f5a4c3d 100644 --- a/source/fortran/vacuum_variables.f90 +++ b/source/fortran/vacuum_variables.f90 @@ -90,32 +90,4 @@ module vacuum_variables real(dp) :: outgasfactor !! outgassing prefactor kw: outgassing rate at 1 s per unit area (Pa m s-1) - - contains - - subroutine init_vacuum_variables - !! Initialise module variables - implicit none - - vacuum_model = 'old' - niterpump = 0.0D0 - ntype = 1 - nvduct = 0 - dlscal = 0.0D0 - pbase = 5.0D-4 - prdiv = 0.36D0 - pumptp = 1.2155D22 - rat = 1.3D-8 - tn = 300.0D0 - vacdshm = 0.0D0 - vcdimax = 0.0D0 - vpumpn = 0 - dwell_pump = 0 - pumpareafraction = 0.0203D0 - pumpspeedmax = 27.3D0 - pumpspeedfactor = 0.167D0 - initialpressure = 1.0D0 - outgasindex = 1.0D0 - outgasfactor = 0.0235D0 - end subroutine init_vacuum_variables end module vacuum_variables From 3f4b8941535f01c605b5c8d922743e76e7055dfc Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 14:03:07 +0000 Subject: [PATCH 25/34] Convert init_scan_module to Python --- process/init.py | 3 ++- process/scan.py | 13 +++++++++++++ source/fortran/scan.f90 | 17 ----------------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/process/init.py b/process/init.py index 7e32dc68e6..c4ed1506ec 100644 --- a/process/init.py +++ b/process/init.py @@ -24,6 +24,7 @@ from process.input import parse_input_file from process.pfcoil import init_pfcoil_module, init_pfcoil_variables from process.physics import init_physics_module, init_physics_variables +from process.scan import init_scan_module from process.sctfcoil import init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables from process.structure import init_structure_variables @@ -241,7 +242,7 @@ def init_all_module_vars(): init_pfcoil_module() init_physics_module() init_physics_variables() - fortran.scan_module.init_scan_module() + init_scan_module() init_sctfcoil_module() init_stellarator_module() init_stellarator_variables() diff --git a/process/scan.py b/process/scan.py index 9a2776343e..bb54d65b3d 100644 --- a/process/scan.py +++ b/process/scan.py @@ -1031,3 +1031,16 @@ def scan_select(self, nwp, swp, iscn): raise ProcessValueError("Illegal scan variable number", nwp=nwp) return SCAN_VARIABLES[int(nwp)] + + +def init_scan_module(): + """Initialise the scan module""" + scan_module.scan_dim = 1 + scan_module.isweep = 0 + scan_module.isweep_2 = 0 + scan_module.nsweep = 1 + scan_module.nsweep_2 = 3 + scan_module.sweep[:] = 0.0 + scan_module.sweep_2[:] = 0.0 + scan_module.first_call_1d = True + scan_module.first_call_2d = True diff --git a/source/fortran/scan.f90 b/source/fortran/scan.f90 index f3aa98a219..774040b415 100644 --- a/source/fortran/scan.f90 +++ b/source/fortran/scan.f90 @@ -129,21 +129,4 @@ module scan_module ! each new run logical :: first_call_1d logical :: first_call_2d - -contains - - subroutine init_scan_module - !! Initialise module variables - implicit none - - scan_dim = 1 - isweep = 0 - isweep_2 = 0 - nsweep = 1 - nsweep_2 = 3 - sweep = 0.0D0 - sweep_2 = 0.0D0 - first_call_1d = .true. - first_call_2d = .true. - end subroutine init_scan_module end module scan_module From 35377c2d1103524e521ce25e3b839625e2c84a97 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 14:07:18 +0000 Subject: [PATCH 26/34] Convert init_pf_power_variables to Python --- process/init.py | 3 ++- process/power.py | 15 +++++++++++++++ source/fortran/pf_power_variables.f90 | 19 ------------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/process/init.py b/process/init.py index c4ed1506ec..0d8702667f 100644 --- a/process/init.py +++ b/process/init.py @@ -24,6 +24,7 @@ from process.input import parse_input_file from process.pfcoil import init_pfcoil_module, init_pfcoil_variables from process.physics import init_physics_module, init_physics_variables +from process.power import init_pf_power_variables from process.scan import init_scan_module from process.sctfcoil import init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables @@ -254,7 +255,7 @@ def init_all_module_vars(): init_pfcoil_variables() init_structure_variables() init_vacuum_variables() - fortran.pf_power_variables.init_pf_power_variables() + init_pf_power_variables() init_build_variables() fortran.constraint_variables.init_constraint_variables() fortran.pulse_variables.init_pulse_variables() diff --git a/process/power.py b/process/power.py index 06ecab832f..50227cb64f 100644 --- a/process/power.py +++ b/process/power.py @@ -3028,3 +3028,18 @@ def tfcpwr(self, output: bool, itfka, rmajor, ntfc, vtfskv, ettfmj, rptfc): ) return (tfckw, len_tf_bus, drarea, tfcbv, tfacpd) + + +def init_pf_power_variables(): + """Initialise PF coil power variables""" + pf_power_variables.acptmax = 0.0 + pf_power_variables.ensxpfm = 0.0 + pf_power_variables.iscenr = 2 + pf_power_variables.pfckts = 0.0 + pf_power_variables.spfbusl = 0.0 + pf_power_variables.spsmva = 0.0 + pf_power_variables.srcktpm = 0.0 + pf_power_variables.vpfskv = 0.0 + pf_power_variables.peakpoloidalpower = 0.0 + pf_power_variables.maxpoloidalpower = 1000.0 + pf_power_variables.poloidalpower[:] = 0.0 diff --git a/source/fortran/pf_power_variables.f90 b/source/fortran/pf_power_variables.f90 index 5fc94e7f92..8c22da39bf 100644 --- a/source/fortran/pf_power_variables.f90 +++ b/source/fortran/pf_power_variables.f90 @@ -51,23 +51,4 @@ module pf_power_variables real(dp), dimension(5) :: poloidalpower !! Poloidal power usage at time t (MW) - - contains - - subroutine init_pf_power_variables - !! Initialise module variables - implicit none - - acptmax = 0.0D0 - ensxpfm = 0.0D0 - iscenr = 2 - pfckts = 0.0D0 - spfbusl = 0.0D0 - spsmva = 0.0D0 - srcktpm = 0.0D0 - vpfskv = 0.0D0 - peakpoloidalpower = 0.0D0 - maxpoloidalpower = 1000.0D0 - poloidalpower = 0.0D0 - end subroutine init_pf_power_variables end module pf_power_variables From c0acc1999917272d2c2b7f733c6d3487c6f805c4 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 14:10:24 +0000 Subject: [PATCH 27/34] Convert init_pulse_variables to Python --- process/init.py | 3 ++- process/pulse.py | 9 +++++++++ source/fortran/pulse_variables.f90 | 13 ------------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/process/init.py b/process/init.py index 0d8702667f..35dd12f114 100644 --- a/process/init.py +++ b/process/init.py @@ -25,6 +25,7 @@ from process.pfcoil import init_pfcoil_module, init_pfcoil_variables from process.physics import init_physics_module, init_physics_variables from process.power import init_pf_power_variables +from process.pulse import init_pulse_variables from process.scan import init_scan_module from process.sctfcoil import init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables @@ -258,7 +259,7 @@ def init_all_module_vars(): init_pf_power_variables() init_build_variables() fortran.constraint_variables.init_constraint_variables() - fortran.pulse_variables.init_pulse_variables() + init_pulse_variables() fortran.rebco_variables.init_rebco_variables() fortran.reinke_variables.init_reinke_variables() fortran.define_iteration_variables.init_define_iteration_variables() diff --git a/process/pulse.py b/process/pulse.py index 687fd75561..a5dee23026 100644 --- a/process/pulse.py +++ b/process/pulse.py @@ -222,3 +222,12 @@ def burn(self, output: bool): self.outfile, " Error... burn time is zero; insufficient volt-seconds#", ) + + +def init_pulse_variables(): + """Initialise the pulse variables""" + pulse_variables.bctmp = 320.0 + pulse_variables.dtstor = 300.0 + pulse_variables.istore = 1 + pulse_variables.itcycl = 1 + pulse_variables.i_pulsed_plant = 0 diff --git a/source/fortran/pulse_variables.f90 b/source/fortran/pulse_variables.f90 index 7f7181eee6..ebbffa3604 100644 --- a/source/fortran/pulse_variables.f90 +++ b/source/fortran/pulse_variables.f90 @@ -40,17 +40,4 @@ module pulse_variables !! !! - =0 continuous operation !! - =1 pulsed operation - - contains - - subroutine init_pulse_variables - !! Initialise module variables - implicit none - - bctmp = 320.0D0 - dtstor = 300.0D0 - istore = 1 - itcycl = 1 - i_pulsed_plant = 0 - end subroutine init_pulse_variables end module pulse_variables From dc6bc430296d5f1c41049c9011045524b9fd59f4 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 14:14:24 +0000 Subject: [PATCH 28/34] Convert init_rebco_variables to Python --- process/init.py | 4 ++-- process/superconducting_tf_coil.py | 26 ++++++++++++++++++++++++++ source/fortran/rebco_variables.f90 | 30 ------------------------------ 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/process/init.py b/process/init.py index 35dd12f114..8389930711 100644 --- a/process/init.py +++ b/process/init.py @@ -27,7 +27,7 @@ from process.power import init_pf_power_variables from process.pulse import init_pulse_variables from process.scan import init_scan_module -from process.sctfcoil import init_sctfcoil_module +from process.sctfcoil import init_rebco_variables, init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables from process.structure import init_structure_variables from process.tfcoil import init_tfcoil_variables @@ -260,7 +260,7 @@ def init_all_module_vars(): init_build_variables() fortran.constraint_variables.init_constraint_variables() init_pulse_variables() - fortran.rebco_variables.init_rebco_variables() + init_rebco_variables() fortran.reinke_variables.init_reinke_variables() fortran.define_iteration_variables.init_define_iteration_variables() init_watuse_variables() diff --git a/process/superconducting_tf_coil.py b/process/superconducting_tf_coil.py index f269faff38..240b40b311 100644 --- a/process/superconducting_tf_coil.py +++ b/process/superconducting_tf_coil.py @@ -3876,3 +3876,29 @@ def init_sctfcoil_module(): sctfcoil_module.time2 = 0.0 sctfcoil_module.tau2 = 0.0 sctfcoil_module.estotft = 0.0 + + +def init_rebco_variables(): + """Initialise the REBCO variables""" + rebco_variables.rebco_thickness = 1.0e-6 + rebco_variables.copper_thick = 100.0e-6 + rebco_variables.hastelloy_thickness = 50.0e-6 + rebco_variables.tape_width = 4.0e-3 + rebco_variables.croco_od = 0.0 + rebco_variables.croco_id = 0.0 + rebco_variables.croco_thick = 2.5e-3 + rebco_variables.copper_rrr = 100.0 + rebco_variables.coppera_m2_max = 1.0e8 + rebco_variables.f_coppera_m2 = 1.0 + rebco_variables.tape_thickness = 6.5e-5 + rebco_variables.stack_thickness = 0.0 + rebco_variables.tapes = 0.0 + rebco_variables.rebco_area = 0.0 + rebco_variables.copper_area = 0.0 + rebco_variables.hastelloy_area = 0.0 + rebco_variables.solder_area = 0.0 + rebco_variables.croco_area = 0.0 + rebco_variables.copperA_m2 = 0.0 + rebco_variables.copperaoh_m2_max = 1.0e8 + rebco_variables.f_copperaoh_m2 = 1.0 + rebco_variables.copperaoh_m2 = 0.0 diff --git a/source/fortran/rebco_variables.f90 b/source/fortran/rebco_variables.f90 index 8e7b969c30..e08865b5bb 100755 --- a/source/fortran/rebco_variables.f90 +++ b/source/fortran/rebco_variables.f90 @@ -69,34 +69,4 @@ module rebco_variables real(dp) :: hastelloy_area real(dp) :: solder_area real(dp) :: croco_area - - contains - - subroutine init_rebco_variables - !! Initialise module variables - implicit none - - rebco_thickness = 1.0D-6 - copper_thick = 100.0D-6 - hastelloy_thickness = 50.0D-6 - tape_width = 4.0D-3 - croco_od = 0.0D0 - croco_id = 0.0D0 - croco_thick = 2.5D-3 - copper_rrr = 100d0 - coppera_m2_max = 1D8 - f_coppera_m2 = 1d0 - tape_thickness = 6.5D-5 - stack_thickness = 0.0D0 - tapes = 0.0D0 - rebco_area = 0.0D0 - copper_area = 0.0D0 - hastelloy_area = 0.0D0 - solder_area = 0.0D0 - croco_area = 0.0D0 - copperA_m2 = 0.0D0 - copperaoh_m2_max = 1D8 - f_copperaoh_m2 = 1d0 - copperaoh_m2 = 0.0D0 - end subroutine init_rebco_variables end module rebco_variables From 91ba2a28f58739538a5c9c2a7b6967a9e7ea763a Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 16:32:33 +0000 Subject: [PATCH 29/34] Convert init_heat_transport_variables to Python --- process/init.py | 4 +- process/power.py | 56 +++++++++++++++++++ source/fortran/heat_transport_variables.f90 | 60 --------------------- 3 files changed, 58 insertions(+), 62 deletions(-) diff --git a/process/init.py b/process/init.py index 8389930711..8cecea0436 100644 --- a/process/init.py +++ b/process/init.py @@ -24,7 +24,7 @@ from process.input import parse_input_file from process.pfcoil import init_pfcoil_module, init_pfcoil_variables from process.physics import init_physics_module, init_physics_variables -from process.power import init_pf_power_variables +from process.power import init_heat_transport_variables, init_pf_power_variables from process.pulse import init_pulse_variables from process.scan import init_scan_module from process.sctfcoil import init_rebco_variables, init_sctfcoil_module @@ -238,7 +238,7 @@ def init_all_module_vars(): init_fwbs_variables() fortran.global_variables.init_global_variables() init_ccfe_hcpb_module() - fortran.heat_transport_variables.init_heat_transport_variables() + init_heat_transport_variables() init_ife_variables() init_impurity_radiation_module() init_pfcoil_module() diff --git a/process/power.py b/process/power.py index 50227cb64f..4e443bc130 100644 --- a/process/power.py +++ b/process/power.py @@ -3043,3 +3043,59 @@ def init_pf_power_variables(): pf_power_variables.peakpoloidalpower = 0.0 pf_power_variables.maxpoloidalpower = 1000.0 pf_power_variables.poloidalpower[:] = 0.0 + + +def init_heat_transport_variables(): + """Initialise heat transport variables""" + heat_transport_variables.baseel = 5.0e6 + heat_transport_variables.crypmw = 0.0 + heat_transport_variables.crypmw_max = 50.0 + heat_transport_variables.f_crypmw = 1.0 + heat_transport_variables.etatf = 0.9 + heat_transport_variables.etath = 0.35 + heat_transport_variables.etath_liq = 0.35 + heat_transport_variables.fachtmw = 0.0 + heat_transport_variables.fcsht = 0.0 + heat_transport_variables.fgrosbop = 0.0 + heat_transport_variables.fmgdmw = 0.0 + heat_transport_variables.fpumpblkt = 0.005 + heat_transport_variables.fpumpdiv = 0.005 + heat_transport_variables.fpumpfw = 0.005 + heat_transport_variables.fpumpshld = 0.005 + heat_transport_variables.htpmw_min = 0.0 + heat_transport_variables.helpow = 0.0 + heat_transport_variables.helpow_cryal = 0.0 + heat_transport_variables.htpmw = 0.0 + heat_transport_variables.htpmw_blkt = 0.0 + heat_transport_variables.htpmw_blkt_liq = 0.0 + heat_transport_variables.htpmw_blkt_tot = 0.0 + heat_transport_variables.htpmw_div = 0.0 + heat_transport_variables.htpmw_fw = 0.0 + heat_transport_variables.htpmw_shld = 0.0 + heat_transport_variables.htpsecmw = 0.0 + heat_transport_variables.ipowerflow = 1 + heat_transport_variables.iprimshld = 1 + heat_transport_variables.nphx = 0 + heat_transport_variables.pacpmw = 0.0 + heat_transport_variables.peakmva = 0.0 + heat_transport_variables.pfwdiv = 0.0 + heat_transport_variables.pgrossmw = 0.0 + heat_transport_variables.pinjht = 0.0 + heat_transport_variables.pinjmax = 120.0 + heat_transport_variables.pinjwp = 0.0 + heat_transport_variables.pinjwpfix = 0.0 + heat_transport_variables.pnetelmw = 0.0 + heat_transport_variables.precircmw = 0.0 + heat_transport_variables.priheat = 0.0 + heat_transport_variables.psecdiv = 0.0 + heat_transport_variables.psechcd = 0.0 + heat_transport_variables.psechtmw = 0.0 + heat_transport_variables.pseclossmw = 0.0 + heat_transport_variables.psecshld = 0.0 + heat_transport_variables.pthermmw = 0.0 + heat_transport_variables.pwpm2 = 150.0 + heat_transport_variables.tfacpd = 0.0 + heat_transport_variables.tlvpmw = 0.0 + heat_transport_variables.trithtmw = 15.0 + heat_transport_variables.tturb = 0.0 + heat_transport_variables.vachtmw = 0.5 diff --git a/source/fortran/heat_transport_variables.f90 b/source/fortran/heat_transport_variables.f90 index d054a5bb56..04781a0d27 100644 --- a/source/fortran/heat_transport_variables.f90 +++ b/source/fortran/heat_transport_variables.f90 @@ -183,64 +183,4 @@ module heat_transport_variables real(dp) :: vachtmw !! vacuum pump power (MW) - - contains - - subroutine init_heat_transport_variables - !! Initialise module variables - implicit none - - baseel = 5.0D6 - crypmw = 0.0D0 - crypmw_max = 50.0D0 - f_crypmw = 1.0D0 - etatf = 0.9D0 - etath = 0.35D0 - etath_liq = 0.35D0 - fachtmw = 0.0D0 - fcsht = 0.0D0 - fgrosbop = 0.0D0 - fmgdmw = 0.0D0 - fpumpblkt = 0.005D0 - fpumpdiv = 0.005D0 - fpumpfw = 0.005D0 - fpumpshld = 0.005D0 - htpmw_min = 0.0D0 - helpow = 0.0D0 - helpow_cryal = 0.0D0 - htpmw = 0.0D0 - htpmw_blkt = 0.0D0 - htpmw_blkt_liq = 0.0D0 - htpmw_blkt_tot = 0.0D0 - htpmw_div = 0.0D0 - htpmw_fw = 0.0D0 - htpmw_shld = 0.0D0 - htpsecmw = 0.0D0 - ipowerflow = 1 - iprimshld = 1 - nphx = 0 - pacpmw = 0.0D0 - peakmva = 0.0D0 - pfwdiv = 0.0D0 - pgrossmw = 0.0D0 - pinjht = 0.0D0 - pinjmax = 120.0D0 - pinjwp = 0.0D0 - pinjwpfix = 0.0D0 - pnetelmw = 0.0D0 - precircmw = 0.0D0 - priheat = 0.0D0 - psecdiv = 0.0D0 - psechcd = 0.0D0 - psechtmw = 0.0D0 - pseclossmw = 0.0D0 - psecshld = 0.0D0 - pthermmw = 0.0D0 - pwpm2 = 150.0D0 - tfacpd = 0.0D0 - tlvpmw = 0.0D0 - trithtmw = 15.0D0 - tturb = 0.0D0 - vachtmw = 0.5D0 - end subroutine init_heat_transport_variables end module heat_transport_variables From aeecac96d5d6a9e426e75916f16651a812b7ff83 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 16:35:13 +0000 Subject: [PATCH 30/34] Convert init_primary_pumping_variables to Python --- process/blanket_library.py | 15 +++++++++++++ process/init.py | 4 ++-- source/fortran/primary_pumping_variables.f90 | 23 -------------------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/process/blanket_library.py b/process/blanket_library.py index 9846c1c5f6..9c6803a455 100644 --- a/process/blanket_library.py +++ b/process/blanket_library.py @@ -2970,3 +2970,18 @@ def init_blanket_library(): blanket_library.htpmw_blkto = 0.0 blanket_library.vfblkti = 0.0 blanket_library.vfblkto = 0.0 + + +def init_primary_pumping_variables(): + """Initialise primary pumping variables""" + primary_pumping_variables.gamma_he = 1.667 # Ratio of specific heats Helium + primary_pumping_variables.t_in_bb = 573.13 # K + primary_pumping_variables.t_out_bb = 773.13 # K + primary_pumping_variables.p_he = 8.0e6 # Pa + primary_pumping_variables.dp_he = 5.5e5 # Pa + primary_pumping_variables.dp_fw_blkt = 1.5e5 # Pa + primary_pumping_variables.dp_fw = 1.5e5 # Pa + primary_pumping_variables.dp_blkt = 3.5e3 # Pa + primary_pumping_variables.dp_liq = 1.0e7 # Pa + primary_pumping_variables.htpmw_fw_blkt = 0.0 + primary_pumping_variables.f_p_fw_blkt_pump = 1.0 diff --git a/process/init.py b/process/init.py index 8cecea0436..83bd92aeda 100644 --- a/process/init.py +++ b/process/init.py @@ -8,7 +8,7 @@ import process import process.fortran as fortran import process.process_output as process_output -from process.blanket_library import init_blanket_library +from process.blanket_library import init_blanket_library, init_primary_pumping_variables from process.build import init_build_variables from process.buildings import init_buildings_variables from process.costs import init_cost_variables @@ -252,7 +252,7 @@ def init_all_module_vars(): fortran.times_variables.init_times_variables() fortran.constants.init_constants() init_current_drive_variables() - fortran.primary_pumping_variables.init_primary_pumping_variables() + init_primary_pumping_variables() init_pfcoil_variables() init_structure_variables() init_vacuum_variables() diff --git a/source/fortran/primary_pumping_variables.f90 b/source/fortran/primary_pumping_variables.f90 index 4715bb9c00..492d83fa15 100644 --- a/source/fortran/primary_pumping_variables.f90 +++ b/source/fortran/primary_pumping_variables.f90 @@ -52,27 +52,4 @@ module primary_pumping_variables real(dp) :: f_p_fw_blkt_pump !! Pumping power for FW and Blanket multiplier factor - - contains - - subroutine init_primary_pumping_variables - !! Initialise module variables - implicit none - - !! initialise variables with default values in the absence of a value in the input file. - gamma_he = 1.667D0 ! Ratio of specific heats Helium - !! cp_he = 5.195.0D3 ! Specific Heat J/kg K (disabled at the moment) - t_in_bb = 573.13D0 ! K - t_out_bb = 773.13D0 ! K - p_he = 8.0D6 ! Pa - dp_he = 5.5D5 ! Pa - dp_fw_blkt = 1.5D5 ! Pa - dp_fw = 1.5D5 ! Pa - dp_blkt = 3.5D3 ! Pa - dp_liq = 1.0D7 ! Pa - htpmw_fw_blkt = 0.0D0 - f_p_fw_blkt_pump = 1.0D0 - - end subroutine init_primary_pumping_variables - end module primary_pumping_variables From eb6d8c711a6fc808e220d67c9f53ba4504fd7009 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 16:51:30 +0000 Subject: [PATCH 31/34] Convert init_times_variables to Python --- process/init.py | 8 ++++++-- process/physics.py | 25 +++++++++++++++++++++++ source/fortran/times_variables.f90 | 32 ------------------------------ 3 files changed, 31 insertions(+), 34 deletions(-) diff --git a/process/init.py b/process/init.py index 83bd92aeda..24ff581e85 100644 --- a/process/init.py +++ b/process/init.py @@ -23,7 +23,11 @@ from process.impurity_radiation import init_impurity_radiation_module from process.input import parse_input_file from process.pfcoil import init_pfcoil_module, init_pfcoil_variables -from process.physics import init_physics_module, init_physics_variables +from process.physics import ( + init_physics_module, + init_physics_variables, + init_times_variables, +) from process.power import init_heat_transport_variables, init_pf_power_variables from process.pulse import init_pulse_variables from process.scan import init_scan_module @@ -249,7 +253,7 @@ def init_all_module_vars(): init_stellarator_module() init_stellarator_variables() init_tfcoil_variables() - fortran.times_variables.init_times_variables() + init_times_variables() fortran.constants.init_constants() init_current_drive_variables() init_primary_pumping_variables() diff --git a/process/physics.py b/process/physics.py index f0dea692b3..144712d2bf 100644 --- a/process/physics.py +++ b/process/physics.py @@ -8231,3 +8231,28 @@ def init_physics_module(): physics_module.nu_star = 0.0 physics_module.beta_mcdonald = 0.0 physics_module.itart_r = 0.0 + + +def init_times_variables(): + """Initialise plasma pulse timing variables""" + times_variables.pulsetimings = 1.0 + times_variables.t_burn = 1000.0 + times_variables.t_burn_0 = 0.0 + times_variables.t_cycle = 0.0 + times_variables.tdown = 0.0 + times_variables.t_between_pulse = 1800.0 + times_variables.t_fusion_ramp = 10.0 + times_variables.tim[:] = 0.0 + times_variables.timelabel = ["Start", "BOP ", "EOR ", "BOF ", "EOF ", "EOP "] + times_variables.intervallabel = [ + "t_precharge ", + "t_current_ramp_up ", + "t_fusion_ramp ", + "t_burn ", + "t_ramp_down ", + ] + times_variables.t_current_ramp_up = 30.0 + times_variables.i_t_current_ramp_up = 0 + times_variables.t_pulse_repetition = 0.0 + times_variables.t_ramp_down = 15.0 + times_variables.t_precharge = 15.0 diff --git a/source/fortran/times_variables.f90 b/source/fortran/times_variables.f90 index 96daf7385a..34adeaf24d 100644 --- a/source/fortran/times_variables.f90 +++ b/source/fortran/times_variables.f90 @@ -66,36 +66,4 @@ module times_variables real(dp) :: t_precharge !! the time for the central solenoid and PF coils to ramp from zero to max current (s); if pulsed, = t_current_ramp_up - - contains - - subroutine init_times_variables - !! Initialise module variables - implicit none - - pulsetimings = 1.0D0 - t_burn = 1000.0D0 - t_burn_0 = 0.0D0 - t_cycle = 0.0D0 - tdown = 0.0D0 - t_between_pulse = 1800.0D0 - t_fusion_ramp = 10.0D0 - tim = 0.0D0 - timelabel = (/ 'Start', & - 'BOP ', & - 'EOR ', & - 'BOF ', & - 'EOF ', & - 'EOP ' /) - intervallabel = (/ 't_precharge ', & - 't_current_ramp_up ', & - 't_fusion_ramp ', & - 't_burn ', & - 't_ramp_down ' /) - t_current_ramp_up = 30.0D0 - i_t_current_ramp_up = 0 - t_pulse_repetition = 0.0D0 - t_ramp_down = 15.0D0 - t_precharge = 15.0D0 - end subroutine init_times_variables end module times_variables From 654e21737b86a2cf23d063548c3a101e1e6fad32 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Thu, 27 Mar 2025 16:53:22 +0000 Subject: [PATCH 32/34] Convert init_reinke_variables to Python --- process/init.py | 3 ++- process/physics.py | 9 +++++++++ source/fortran/reinke_variables.f90 | 13 ------------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/process/init.py b/process/init.py index 24ff581e85..a9f0906440 100644 --- a/process/init.py +++ b/process/init.py @@ -26,6 +26,7 @@ from process.physics import ( init_physics_module, init_physics_variables, + init_reinke_variables, init_times_variables, ) from process.power import init_heat_transport_variables, init_pf_power_variables @@ -265,7 +266,7 @@ def init_all_module_vars(): fortran.constraint_variables.init_constraint_variables() init_pulse_variables() init_rebco_variables() - fortran.reinke_variables.init_reinke_variables() + init_reinke_variables() fortran.define_iteration_variables.init_define_iteration_variables() init_watuse_variables() init_cs_fatigue_variables() diff --git a/process/physics.py b/process/physics.py index 144712d2bf..fefdf566f0 100644 --- a/process/physics.py +++ b/process/physics.py @@ -8256,3 +8256,12 @@ def init_times_variables(): times_variables.t_pulse_repetition = 0.0 times_variables.t_ramp_down = 15.0 times_variables.t_precharge = 15.0 + + +def init_reinke_variables(): + """Initialise Reinke criterion variables""" + reinke_variables.impvardiv = 9 + reinke_variables.lhat = 4.33 + reinke_variables.fzmin = 0.0 + reinke_variables.fzactual = 0.001 + reinke_variables.reinke_mode = 0 diff --git a/source/fortran/reinke_variables.f90 b/source/fortran/reinke_variables.f90 index 8bab31a5bd..d3b708f703 100644 --- a/source/fortran/reinke_variables.f90 +++ b/source/fortran/reinke_variables.f90 @@ -36,17 +36,4 @@ module reinke_variables !! !! - =0 H-mode !! - =1 I-mode - - contains - - subroutine init_reinke_variables - !! Initialise module variables - implicit none - - impvardiv = 9 - lhat = 4.33D0 - fzmin = 0.0D0 - fzactual = 0.001D0 - reinke_mode = 0 - end subroutine init_reinke_variables end module reinke_variables From 56a21732e257eafab697c34e6ee8ac939db4b3de Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Tue, 8 Apr 2025 16:39:51 +0000 Subject: [PATCH 33/34] Update TF coil module names --- process/init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/process/init.py b/process/init.py index a9f0906440..d6cd8ce946 100644 --- a/process/init.py +++ b/process/init.py @@ -32,10 +32,10 @@ from process.power import init_heat_transport_variables, init_pf_power_variables from process.pulse import init_pulse_variables from process.scan import init_scan_module -from process.sctfcoil import init_rebco_variables, init_sctfcoil_module from process.stellarator import init_stellarator_module, init_stellarator_variables from process.structure import init_structure_variables -from process.tfcoil import init_tfcoil_variables +from process.superconducting_tf_coil import init_rebco_variables, init_sctfcoil_module +from process.tf_coil import init_tfcoil_variables from process.utilities.f2py_string_patch import f2py_compatible_to_string from process.vacuum import init_vacuum_variables from process.water_use import init_watuse_variables From baf8548bdb5aad4faafca5d0b8709c5d431e370c Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Wed, 9 Apr 2025 08:41:20 +0000 Subject: [PATCH 34/34] Remove capital letters in current drive variables --- process/current_drive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/process/current_drive.py b/process/current_drive.py index 581cfa7388..9ce159e0db 100644 --- a/process/current_drive.py +++ b/process/current_drive.py @@ -2166,8 +2166,8 @@ def init_current_drive_variables(): current_drive_variables.bscf_andrade = 0.0 current_drive_variables.bscf_hoang = 0.0 current_drive_variables.bscf_wong = 0.0 - current_drive_variables.bscf_gi_I = 0.0 - current_drive_variables.bscf_gi_II = 0.0 + current_drive_variables.bscf_gi_i = 0.0 + current_drive_variables.bscf_gi_ii = 0.0 current_drive_variables.cboot = 1.0 current_drive_variables.beam_current = 0.0 current_drive_variables.diacf_hender = 0.0