From fc59b1fe0e9e323707c44305dd1d9424ed38a110 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 14:46:59 +0000 Subject: [PATCH 1/4] Fix variable name typo for plasma surface neutron flux in physics_variables and update references --- process/data_structure/physics_variables.py | 6 +++--- process/io/plot_proc.py | 2 +- process/models/physics/physics.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 7f6adaa12..eb8f711bb 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -1283,7 +1283,7 @@ pflux_fw_neutron_mw: float = None """average neutron wall load (MW/m2)""" -plfux_plasma_surface_neutron_avg_mw: float = None +pflux_plasma_surface_neutron_avg_mw: float = None """Average neutron flux at plasma surface (MW/m2)""" @@ -1651,7 +1651,7 @@ def init_physics_variables(): vs_plasma_res_ramp, \ vs_plasma_total_required, \ pflux_fw_neutron_mw, \ - plfux_plasma_surface_neutron_avg_mw, \ + pflux_plasma_surface_neutron_avg_mw, \ wtgpd, \ a_plasma_poloidal, \ n_charge_plasma_effective_vol_avg, \ @@ -1921,7 +1921,7 @@ def init_physics_variables(): vs_plasma_res_ramp = 0.0 vs_plasma_total_required = 0.0 pflux_fw_neutron_mw = 0.0 - plfux_plasma_surface_neutron_avg_mw = 0.0 + pflux_plasma_surface_neutron_avg_mw = 0.0 wtgpd = 0.0 a_plasma_poloidal = 0.0 n_charge_plasma_effective_vol_avg = 0.0 diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index d97d0bbcb..022850613 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -2901,7 +2901,7 @@ def plot_main_plasma_information( textstr_neutron = ( f"$P_{{\\text{{n,total}}}}$ {mfile.get('p_neutron_total_mw', scan=scan):.2f} MW \n" - f"$\\phi_{{\\text{{n,avg}}}}$ {mfile.get('plfux_plasma_surface_neutron_avg_mw', scan=scan):.3f} MW/m²" + f"$\\phi_{{\\text{{n,avg}}}}$ {mfile.get('pflux_plasma_surface_neutron_avg_mw', scan=scan):.3f} MW/m²" ) axis.text( diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 91dd3bef0..0cd1ebaa4 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -2411,7 +2411,7 @@ def physics(self): - physics_variables.p_plasma_rad_mw ) - physics_variables.plfux_plasma_surface_neutron_avg_mw = ( + physics_variables.pflux_plasma_surface_neutron_avg_mw = ( physics_variables.p_neutron_total_mw / physics_variables.a_plasma_surface ) @@ -5098,8 +5098,8 @@ def outplas(self): po.ovarre( self.outfile, "Average neutron flux at plasma surface (MW/m^2)", - "(plfux_plasma_surface_neutron_avg_mw)", - physics_variables.plfux_plasma_surface_neutron_avg_mw, + "(pflux_plasma_surface_neutron_avg_mw)", + physics_variables.pflux_plasma_surface_neutron_avg_mw, "OP ", ) From 5de3bbceef5148abfc606d183b38c1abc620a3ab Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 14:56:41 +0000 Subject: [PATCH 2/4] Refactor first wall power flux calculations into FirstWall class and remove redundant logic from Physics class --- process/models/fw.py | 30 +++++++++++ process/models/physics/physics.py | 87 ------------------------------- 2 files changed, 30 insertions(+), 87 deletions(-) diff --git a/process/models/fw.py b/process/models/fw.py index 342e842b3..7353d0263 100644 --- a/process/models/fw.py +++ b/process/models/fw.py @@ -8,6 +8,7 @@ from process.data_structure import ( blanket_library, build_variables, + constraint_variables, divertor_variables, first_wall_variables, fwbs_variables, @@ -97,6 +98,35 @@ def run(self): fwbs_variables.radius_fw_channel_180_bend, ) = self.blanket_library.calculate_pipe_bend_radius(i_ps=1) + # ============================== + # First wall power fluxes + # ============================== + + if physics_variables.i_pflux_fw_neutron == 1: + physics_variables.pflux_fw_neutron_mw = ( + physics_variables.ffwal + * physics_variables.pflux_plasma_surface_neutron_avg_mw + ) + else: + physics_variables.pflux_fw_neutron_mw = ( + physics_variables.p_neutron_total_mw / first_wall_variables.a_fw_total + ) + + if physics_variables.i_pflux_fw_neutron == 1: + physics_variables.pflux_fw_rad_mw = ( + physics_variables.ffwal + * physics_variables.p_plasma_rad_mw + / physics_variables.a_plasma_surface + ) + else: + physics_variables.pflux_fw_rad_mw = ( + physics_variables.p_plasma_rad_mw / build_variables.a_fw_total + ) + + constraint_variables.pflux_fw_rad_max_mw = ( + physics_variables.pflux_fw_rad_mw * constraint_variables.f_fw_rad_max + ) + @staticmethod def calculate_first_wall_half_height( z_plasma_xpoint_lower: float, diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 0cd1ebaa4..855b59a6d 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -16,11 +16,9 @@ from process import constants from process import process_output as po from process.data_structure import ( - build_variables, constraint_variables, current_drive_variables, divertor_variables, - fwbs_variables, impurity_radiation_module, numerics, physics_variables, @@ -2279,38 +2277,6 @@ def physics(self): i_beta_fast_alpha=physics_variables.i_beta_fast_alpha, ) - # Nominal mean neutron wall load on entire first wall area including divertor and beam holes - # Note that 'a_fw_total' excludes these, so they have been added back in. - if physics_variables.i_pflux_fw_neutron == 1: - physics_variables.pflux_fw_neutron_mw = ( - physics_variables.ffwal - * physics_variables.p_neutron_total_mw - / physics_variables.a_plasma_surface - ) - else: - if divertor_variables.n_divertors == 2: - # Double null configuration - physics_variables.pflux_fw_neutron_mw = ( - ( - 1.0e0 - - fwbs_variables.f_a_fw_outboard_hcd - - 2.0e0 * fwbs_variables.f_ster_div_single - ) - * physics_variables.p_neutron_total_mw - / build_variables.a_fw_total - ) - else: - # Single null Configuration - physics_variables.pflux_fw_neutron_mw = ( - ( - 1.0e0 - - fwbs_variables.f_a_fw_outboard_hcd - - fwbs_variables.f_ster_div_single - ) - * physics_variables.p_neutron_total_mw - / build_variables.a_fw_total - ) - # Calculate ion/electron equilibration power physics_variables.pden_ion_electron_equilibration_mw = rether( @@ -2578,59 +2544,6 @@ def physics(self): # ============================================================ - # MDK - # Nominal mean photon wall load on entire first wall area including divertor and beam holes - # Note that 'a_fw_total' excludes these, so they have been added back in. - if physics_variables.i_pflux_fw_neutron == 1: - physics_variables.pflux_fw_rad_mw = ( - physics_variables.ffwal - * physics_variables.p_plasma_rad_mw - / physics_variables.a_plasma_surface - ) - else: - if divertor_variables.n_divertors == 2: - # Double Null configuration in - including SoL radiation - physics_variables.pflux_fw_rad_mw = ( - ( - 1.0e0 - - fwbs_variables.f_a_fw_outboard_hcd - - 2.0e0 * fwbs_variables.f_ster_div_single - ) - * physics_variables.p_plasma_rad_mw - / build_variables.a_fw_total - + ( - 1.0e0 - - fwbs_variables.f_a_fw_outboard_hcd - - 2.0e0 * fwbs_variables.f_ster_div_single - ) - * physics_variables.rad_fraction_sol - * physics_variables.p_plasma_separatrix_mw - / (build_variables.a_fw_total) - ) - else: - # Single null configuration - including SoL radaition - physics_variables.pflux_fw_rad_mw = ( - ( - 1.0e0 - - fwbs_variables.f_a_fw_outboard_hcd - - fwbs_variables.f_ster_div_single - ) - * physics_variables.p_plasma_rad_mw - / build_variables.a_fw_total - + ( - 1.0e0 - - fwbs_variables.f_a_fw_outboard_hcd - - fwbs_variables.f_ster_div_single - ) - * physics_variables.rad_fraction_sol - * physics_variables.p_plasma_separatrix_mw - / build_variables.a_fw_total - ) - - constraint_variables.pflux_fw_rad_max_mw = ( - physics_variables.pflux_fw_rad_mw * constraint_variables.f_fw_rad_max - ) - # Calculate the target imbalances # find the total power into the targets physics_variables.ptarmw = physics_variables.p_plasma_separatrix_mw * ( From 8711d26b1d7b1524e8cf6eafd697c6b9b35229cd Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 15:56:02 +0000 Subject: [PATCH 3/4] Move alpha particle power transport calculation to FirstWall class --- process/models/fw.py | 5 +++++ process/models/physics/physics.py | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/process/models/fw.py b/process/models/fw.py index 7353d0263..c4511bd8b 100644 --- a/process/models/fw.py +++ b/process/models/fw.py @@ -127,6 +127,11 @@ def run(self): physics_variables.pflux_fw_rad_mw * constraint_variables.f_fw_rad_max ) + # Power transported to the first wall by escaped alpha particles + physics_variables.p_fw_alpha_mw = physics_variables.p_alpha_total_mw * ( + 1.0e0 - physics_variables.f_p_alpha_plasma_deposited + ) + @staticmethod def calculate_first_wall_half_height( z_plasma_xpoint_lower: float, diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 855b59a6d..3d40dbcdc 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -2412,11 +2412,6 @@ def physics(self): physics_variables.kappa95, ) - # Power transported to the first wall by escaped alpha particles - physics_variables.p_fw_alpha_mw = physics_variables.p_alpha_total_mw * ( - 1.0e0 - physics_variables.f_p_alpha_plasma_deposited - ) - # Density limit ( physics_variables.nd_plasma_electron_max_array, From e53191c0fe64f8013a8843ec044b6d4753d9153b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Sat, 21 Feb 2026 15:18:32 +0000 Subject: [PATCH 4/4] Add output method for first wall surface loads and integrate into output process --- process/models/fw.py | 49 +++++++++++++++++++++++++++++++ process/models/physics/physics.py | 44 +-------------------------- process/output.py | 3 ++ 3 files changed, 53 insertions(+), 43 deletions(-) diff --git a/process/models/fw.py b/process/models/fw.py index c4511bd8b..62de43dc8 100644 --- a/process/models/fw.py +++ b/process/models/fw.py @@ -99,7 +99,9 @@ def run(self): ) = self.blanket_library.calculate_pipe_bend_radius(i_ps=1) # ============================== + # First wall power fluxes + # ============================== if physics_variables.i_pflux_fw_neutron == 1: @@ -937,3 +939,50 @@ def output_fw_pumping(self): fwbs_variables.temp_fw_peak, "OP ", ) + + def output_fw_surface_loads(self): + """Outputs the first wall surface load details to the output file.""" + po.oheadr(self.outfile, "First wall surface loads") + + po.ovarre( + self.outfile, + "Nominal mean radiation load on vessel first-wall (MW/m^2)", + "(pflux_fw_rad_mw)", + physics_variables.pflux_fw_rad_mw, + "OP ", + ) + po.ovarre( + self.outfile, + "Peaking factor for radiation first-wall load", + "(f_fw_rad_max)", + constraint_variables.f_fw_rad_max, + "IP ", + ) + po.ovarre( + self.outfile, + "Maximum permitted radiation first-wall load (MW/m^2)", + "(pflux_fw_rad_max)", + constraint_variables.pflux_fw_rad_max, + "IP ", + ) + po.ovarre( + self.outfile, + "Peak radiation wall load (MW/m^2)", + "(pflux_fw_rad_max_mw)", + constraint_variables.pflux_fw_rad_max_mw, + "OP ", + ) + po.ovarre( + self.outfile, + "Fast alpha particle power incident on the first-wall (MW)", + "(p_fw_alpha_mw)", + physics_variables.p_fw_alpha_mw, + "OP ", + ) + po.ovarre( + self.outfile, + "Nominal mean neutron load on vessel first-wall (MW/m^2)", + "(pflux_fw_neutron_mw)", + physics_variables.pflux_fw_neutron_mw, + "OP ", + ) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 3d40dbcdc..bf2cac756 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -4996,13 +4996,7 @@ def outplas(self): physics_variables.f_p_plasma_separatrix_rad, "OP ", ) - po.ovarre( - self.outfile, - "Nominal mean radiation load on vessel first-wall (MW/m^2)", - "(pflux_fw_rad_mw)", - physics_variables.pflux_fw_rad_mw, - "OP ", - ) + po.ovarre( self.outfile, "Average neutron flux at plasma surface (MW/m^2)", @@ -5011,42 +5005,6 @@ def outplas(self): "OP ", ) - po.ovarre( - self.outfile, - "Peaking factor for radiation first-wall load", - "(f_fw_rad_max)", - constraint_variables.f_fw_rad_max, - "IP ", - ) - po.ovarre( - self.outfile, - "Maximum permitted radiation first-wall load (MW/m^2)", - "(pflux_fw_rad_max)", - constraint_variables.pflux_fw_rad_max, - "IP ", - ) - po.ovarre( - self.outfile, - "Peak radiation wall load (MW/m^2)", - "(pflux_fw_rad_max_mw)", - constraint_variables.pflux_fw_rad_max_mw, - "OP ", - ) - po.ovarre( - self.outfile, - "Fast alpha particle power incident on the first-wall (MW)", - "(p_fw_alpha_mw)", - physics_variables.p_fw_alpha_mw, - "OP ", - ) - po.ovarre( - self.outfile, - "Nominal mean neutron load on vessel first-wall (MW/m^2)", - "(pflux_fw_neutron_mw)", - physics_variables.pflux_fw_neutron_mw, - "OP ", - ) - if stellarator_variables.istell == 0: po.oblnkl(self.outfile) po.ovarre( diff --git a/process/output.py b/process/output.py index 48eaa89d8..6d1808fbc 100644 --- a/process/output.py +++ b/process/output.py @@ -118,6 +118,9 @@ def write(models, _outfile): # First wall geometry models.fw.output_fw_geometry() + # First wall surface loads + models.fw.output_fw_surface_loads() + # First wall pumping models.fw.output_fw_pumping()