From 4c77d3c364f5aef37bbe55952e8ae21c8ebfee4e Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 14:46:59 +0000 Subject: [PATCH 1/5] Fix variable name typo for plasma surface neutron flux in physics_variables and update references --- process/core/io/plot_proc.py | 2 +- process/data_structure/physics_variables.py | 6 +++--- process/models/physics/physics.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/process/core/io/plot_proc.py b/process/core/io/plot_proc.py index 40a1b1139..af8b0dd94 100644 --- a/process/core/io/plot_proc.py +++ b/process/core/io/plot_proc.py @@ -2903,7 +2903,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/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 4c6557296..6ff494442 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -1287,7 +1287,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)""" @@ -1656,7 +1656,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, \ @@ -1927,7 +1927,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/models/physics/physics.py b/process/models/physics/physics.py index 66d06eb33..fb8e1b6b1 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 0d7b7626e35775407d24a03b22cdb75136bb5d32 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 14:56:41 +0000 Subject: [PATCH 2/5] 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 d2d35dbe3..4162b376b 100644 --- a/process/models/fw.py +++ b/process/models/fw.py @@ -9,6 +9,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 fb8e1b6b1..e27c24077 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -17,11 +17,9 @@ from process.core import process_output as po from process.core.exceptions import ProcessValueError 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 bcf329aaa09c3f3761e7155656ef782f661f06cf Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 15:56:02 +0000 Subject: [PATCH 3/5] 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 4162b376b..c0f83d0cf 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 e27c24077..93c808e23 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 aead031ef81d0e6d8653eabbb25fd525dd709337 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Sat, 21 Feb 2026 15:18:32 +0000 Subject: [PATCH 4/5] Add output method for first wall surface loads and integrate into output process --- process/core/output.py | 3 ++ process/models/fw.py | 49 +++++++++++++++++++++++++++++++ process/models/physics/physics.py | 44 +-------------------------- 3 files changed, 53 insertions(+), 43 deletions(-) diff --git a/process/core/output.py b/process/core/output.py index 3f911e16b..34481f90c 100644 --- a/process/core/output.py +++ b/process/core/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() diff --git a/process/models/fw.py b/process/models/fw.py index c0f83d0cf..26475137c 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 93c808e23..d2405c263 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( From 5a34c30cbbfd625693adddcf0d4e8e8cb3283feb Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 26 Feb 2026 13:09:49 +0000 Subject: [PATCH 5/5] Remove commented-out section for first wall power fluxes in FirstWall class --- process/models/fw.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/process/models/fw.py b/process/models/fw.py index 26475137c..d59342e24 100644 --- a/process/models/fw.py +++ b/process/models/fw.py @@ -98,12 +98,6 @@ 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