From c61d99a56a1f33d3238389a44770a57b4743e603 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 15:47:08 +0000 Subject: [PATCH 01/13] Add PlasmaExhaust class and integrate into Physics model --- process/main.py | 2 + process/models/physics/physics.py | 68 +++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/process/main.py b/process/main.py index 8165ede28..536559c3a 100644 --- a/process/main.py +++ b/process/main.py @@ -698,11 +698,13 @@ def __init__(self): ) self.plasma_beta = PlasmaBeta() self.plasma_inductance = PlasmaInductance() + self.plasma_exhaust = PlasmaExhaust() self.physics = Physics( plasma_profile=self.plasma_profile, current_drive=self.current_drive, plasma_beta=self.plasma_beta, plasma_inductance=self.plasma_inductance, + plasma_exhaust=self.plasma_exhaust, ) self.physics_detailed = DetailedPhysics( plasma_profile=self.plasma_profile, diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 66d06eb33..2ab7abd0f 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -1627,13 +1627,21 @@ def _trapped_particle_fraction_sauter( class Physics: - def __init__(self, plasma_profile, current_drive, plasma_beta, plasma_inductance): + def __init__( + self, + plasma_profile, + current_drive, + plasma_beta, + plasma_inductance, + plasma_exhaust, + ): self.outfile = constants.NOUT self.mfile = constants.MFILE self.plasma_profile = plasma_profile self.current_drive = current_drive self.beta = plasma_beta self.inductance = plasma_inductance + self.exhaust = plasma_exhaust def physics(self): """Routine to calculate tokamak plasma physics information @@ -2403,12 +2411,14 @@ def physics(self): ) physics_variables.p_plasma_separatrix_mw = ( - physics_variables.f_p_alpha_plasma_deposited - * physics_variables.p_alpha_total_mw - + physics_variables.p_non_alpha_charged_mw - + pinj - + physics_variables.p_plasma_ohmic_mw - - physics_variables.p_plasma_rad_mw + self.exhaust.calculate_separatrix_power( + f_p_alpha_plasma_deposited=physics_variables.f_p_alpha_plasma_deposited, + p_alpha_total_mw=physics_variables.p_alpha_total_mw, + p_non_alpha_charged_mw=physics_variables.p_non_alpha_charged_mw, + p_hcd_injected_total_mw=pinj, + p_plasma_ohmic_mw=physics_variables.p_plasma_ohmic_mw, + p_plasma_rad_mw=physics_variables.p_plasma_rad_mw, + ) ) physics_variables.plfux_plasma_surface_neutron_avg_mw = ( @@ -9861,6 +9871,50 @@ def output_volt_second_information(self): po.oblnkl(self.outfile) +class PlasmaExhaust: + """Class to hold plasma exhaust calculations for plasma processing.""" + + def __init__(self): + self.outfile = constants.NOUT + self.mfile = constants.MFILE + + @staticmethod + def calculate_separatrix_power( + f_p_alpha_plasma_deposited: float, + p_alpha_total_mw: float, + p_non_alpha_charged_mw: float, + p_hcd_injected_total_mw: float, + p_plasma_ohmic_mw: float, + p_plasma_rad_mw: float, + ) -> float: + """ + Calculate the power crossing the separatrix (P_sep). + + :param f_p_alpha_plasma_deposited: Fraction of alpha power deposited in plasma. + :type f_p_alpha_plasma_deposited: float + :param p_alpha_total_mw: Total alpha power produced (MW). + :type p_alpha_total_mw: float + :param p_non_alpha_charged_mw: Power from non-alpha charged particles (MW). + :type p_non_alpha_charged_mw: float + :param p_hcd_injected_total_mw: Total power injected by heating and current drive (MW). + :type p_hcd_injected_total_mw: float + :param p_plasma_ohmic_mw: Ohmic heating power (MW). + :type p_plasma_ohmic_mw: float + :param p_plasma_rad_mw: Radiated power from plasma (MW). + :type p_plasma_rad_mw: float + :return: Power crossing the separatrix (MW). + :rtype: float + """ + + return ( + f_p_alpha_plasma_deposited * p_alpha_total_mw + + p_non_alpha_charged_mw + + p_hcd_injected_total_mw + + p_plasma_ohmic_mw + - p_plasma_rad_mw + ) + + class DetailedPhysics: """Class to hold detailed physics models for plasma processing.""" From 64e49b5db4cc3d2b9c270cc13a5d7f30616cee29 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 16:02:28 +0000 Subject: [PATCH 02/13] Add p_plasma_separatrix_rmajor_mw variable to track power per major radius --- process/data_structure/physics_variables.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 4c6557296..92711a524 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -911,6 +911,9 @@ p_plasma_separatrix_mw: float = None """power to conducted to the divertor region (MW)""" +p_plasma_separatrix_rmajor_mw: float = None +"""Power to conducted to the divertor region per major radius (MW/m)""" + p_div_lower_separatrix_mw: float = None """Separatrix power conducted to the lower divertor region (calculated if `i_single_null = 0`) (MW)""" @@ -1567,6 +1570,7 @@ def init_physics_variables(): p_dd_total_mw, \ p_dhe3_total_mw, \ p_plasma_separatrix_mw, \ + p_plasma_separatrix_rmajor_mw, \ p_div_lower_separatrix_mw, \ p_div_upper_separatrix_mw, \ p_div_separatrix_max_mw, \ @@ -1838,6 +1842,7 @@ def init_physics_variables(): p_dd_total_mw = 0.0 p_dhe3_total_mw = 0.0 p_plasma_separatrix_mw = 0.0 + p_plasma_separatrix_rmajor_mw = 0.0 p_div_lower_separatrix_mw = 0.0 p_div_upper_separatrix_mw = 0.0 p_div_separatrix_max_mw = 0.0 From a903cc8a12393e6a46914e414b9ce79ff459a4e3 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 16:05:36 +0000 Subject: [PATCH 03/13] Add method to calculate power crossing the separatrix per unit major radius in PlasmaExhaust class --- process/models/physics/physics.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 2ab7abd0f..1b72d8f8a 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -9914,6 +9914,23 @@ def calculate_separatrix_power( - p_plasma_rad_mw ) + @staticmethod + def calculate_psep_over_r_metric( + p_plasma_separatrix_mw: float, rmajor: float + ) -> float: + """ + Calculate the power crossing the separatrix per unit major radius (P_sep/R). + + :param p_plasma_separatrix_mw: Power crossing the separatrix (MW). + :type p_plasma_separatrix_mw: float + :param rmajor: Plasma major radius (m). + :type rmajor: float + :return: Power crossing the separatrix per unit major radius (MW/m). + :rtype: float + + """ + return p_plasma_separatrix_mw / rmajor + class DetailedPhysics: """Class to hold detailed physics models for plasma processing.""" From d058eb8e8ed547b65a7ed63e3570b5a70e0fcfc2 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 12 Feb 2026 16:22:20 +0000 Subject: [PATCH 04/13] Add method to calculate EU DEMO divertor protection re-attachment metric in PlasmaExhaust class --- process/models/physics/physics.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 1b72d8f8a..211b58d2a 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -9931,6 +9931,35 @@ def calculate_psep_over_r_metric( """ return p_plasma_separatrix_mw / rmajor + @staticmethod + def calculate_eu_demo_re_attachment_metric( + p_plasma_separatrix_mw: float, + b_plasma_toroidal_on_axis: float, + q95: float, + aspect: float, + rmajor: float, + ) -> float: + """Calculate the EU DEMO divertor protection re-attachment metric for plasma exhaust. + + :param p_plasma_separatrix_mw: Power crossing the separatrix (MW). + :type p_plasma_separatrix_mw: float + :param b_plasma_toroidal_on_axis: Toroidal magnetic field on axis (T). + :type b_plasma_toroidal_on_axis: float + :param q95: Safety factor at 95% flux surface. + :type q95: float + :param aspect: Aspect ratio of the plasma. + :type aspect: float + :param rmajor: Plasma major radius (m). + :type rmajor: float + :return: EU DEMO re-attachment metric (MW T /m). + :rtype: float + + """ + + return (p_plasma_separatrix_mw * b_plasma_toroidal_on_axis) / ( + q95 * aspect * rmajor + ) + class DetailedPhysics: """Class to hold detailed physics models for plasma processing.""" From 41717e61de7328998ec857adb3e061a4f733a096 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Mon, 23 Feb 2026 21:14:18 +0000 Subject: [PATCH 05/13] post rebase structure update --- process/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/process/main.py b/process/main.py index 536559c3a..45a35e4b8 100644 --- a/process/main.py +++ b/process/main.py @@ -97,6 +97,7 @@ DetailedPhysics, Physics, PlasmaBeta, + PlasmaExhaust, PlasmaInductance, ) from process.models.physics.plasma_geometry import PlasmaGeom From 28ad979dedc3ba39766af96d9307f7de53ddff42 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 26 Feb 2026 13:47:55 +0000 Subject: [PATCH 06/13] Post rebase integration fixes --- tests/unit/test_physics.py | 2 ++ tests/unit/test_stellarator.py | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 956912aa7..8cb8ce999 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -24,6 +24,7 @@ DetailedPhysics, Physics, PlasmaBeta, + PlasmaExhaust, PlasmaInductance, calculate_current_coefficient_hastie, calculate_plasma_current_peng, @@ -56,6 +57,7 @@ def physics(): ), PlasmaBeta(), PlasmaInductance(), + PlasmaExhaust(), ) diff --git a/tests/unit/test_stellarator.py b/tests/unit/test_stellarator.py index 268a94b67..9d674a673 100644 --- a/tests/unit/test_stellarator.py +++ b/tests/unit/test_stellarator.py @@ -29,7 +29,12 @@ LowerHybrid, NeutralBeam, ) -from process.models.physics.physics import Physics, PlasmaBeta, PlasmaInductance +from process.models.physics.physics import ( + Physics, + PlasmaBeta, + PlasmaExhaust, + PlasmaInductance, +) from process.models.physics.plasma_profiles import PlasmaProfile from process.models.power import Power from process.models.stellarator.build import st_build @@ -82,6 +87,7 @@ def stellarator(): ), PlasmaBeta(), PlasmaInductance(), + PlasmaExhaust(), ), Neoclassics(), plasma_beta=PlasmaBeta(), From 7b20d92404552e1f13f639bfa65ad92f925a57cf Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 26 Feb 2026 13:55:12 +0000 Subject: [PATCH 07/13] Fix variable reference for power per major radius in plot_main_plasma_information and update physics calculations --- process/core/io/plot_proc.py | 2 +- process/models/physics/physics.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/process/core/io/plot_proc.py b/process/core/io/plot_proc.py index 40a1b1139..5774d8c00 100644 --- a/process/core/io/plot_proc.py +++ b/process/core/io/plot_proc.py @@ -2776,7 +2776,7 @@ def plot_main_plasma_information( # Add divertor information textstr_div = ( f"\n$P_{{\\text{{sep}}}}$: {mfile.get('p_plasma_separatrix_mw', scan=scan):.2f} MW \n" - f"$\\frac{{P_{{\\text{{sep}}}}}}{{R}}$: {mfile.get('p_plasma_separatrix_mw/rmajor', scan=scan):.2f} MW/m \n" + f"$\\frac{{P_{{\\text{{sep}}}}}}{{R}}$: {mfile.get('p_plasma_separatrix_rmajor_mw', scan=scan):.2f} MW/m \n" f"$\\frac{{P_{{\\text{{sep}}}}}}{{B_T q_a R}}$: {mfile.get('pdivtbt_over_qar', scan=scan):.2f} MW T/m " ) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 211b58d2a..0eb779625 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -2421,6 +2421,13 @@ def physics(self): ) ) + physics_variables.p_plasma_separatrix_rmajor_mw = ( + self.exhaust.calculate_psep_over_r_metric( + p_plasma_separatrix_mw=physics_variables.p_plasma_separatrix_mw, + rmajor=physics_variables.rmajor, + ) + ) + physics_variables.plfux_plasma_surface_neutron_avg_mw = ( physics_variables.p_neutron_total_mw / physics_variables.a_plasma_surface ) @@ -5318,7 +5325,7 @@ def outplas(self): po.oblnkl(self.outfile) po.ovarre( self.outfile, - "Power into divertor zone via charged particles (MW)", + "Plasma separatrix power (MW)", "(p_plasma_separatrix_mw)", physics_variables.p_plasma_separatrix_mw, "OP ", @@ -5345,8 +5352,8 @@ def outplas(self): po.ovarre( self.outfile, "Pdivt / R ratio (MW/m) (On peak divertor)", - "(p_div_separatrix_max_mw/physics_variables.rmajor)", - physics_variables.p_div_separatrix_max_mw / physics_variables.rmajor, + "(p_div_separatrix_rmajor_mw)", + physics_variables.p_div_separatrix_rmajor_mw, "OP ", ) po.ovarre( @@ -5371,8 +5378,8 @@ def outplas(self): po.ovarre( self.outfile, "Psep / R ratio (MW/m)", - "(p_plasma_separatrix_mw/rmajor)", - physics_variables.p_plasma_separatrix_mw / physics_variables.rmajor, + "(p_plasma_separatrix_rmajor_mw)", + physics_variables.p_plasma_separatrix_rmajor_mw, "OP ", ) po.ovarre( From c6da874e3c03174a51a835d2123a0f6fa44c90c8 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 26 Feb 2026 14:26:26 +0000 Subject: [PATCH 08/13] Add EU DEMO divertor protection parameter to physics variables --- process/data_structure/physics_variables.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 92711a524..136502830 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -914,6 +914,9 @@ p_plasma_separatrix_rmajor_mw: float = None """Power to conducted to the divertor region per major radius (MW/m)""" +p_div_bt_q_aspect_rmajor_mw: float = None +"""EU DEMO divertor protection parameter (MW/T/m)""" + p_div_lower_separatrix_mw: float = None """Separatrix power conducted to the lower divertor region (calculated if `i_single_null = 0`) (MW)""" @@ -1571,6 +1574,7 @@ def init_physics_variables(): p_dhe3_total_mw, \ p_plasma_separatrix_mw, \ p_plasma_separatrix_rmajor_mw, \ + p_div_bt_q_aspect_rmajor_mw, \ p_div_lower_separatrix_mw, \ p_div_upper_separatrix_mw, \ p_div_separatrix_max_mw, \ @@ -1844,6 +1848,7 @@ def init_physics_variables(): p_plasma_separatrix_mw = 0.0 p_plasma_separatrix_rmajor_mw = 0.0 p_div_lower_separatrix_mw = 0.0 + p_div_lower_separatrix_mw = 0.0 p_div_upper_separatrix_mw = 0.0 p_div_separatrix_max_mw = 0.0 p_dt_total_mw = 0.0 From 9a6ff70024b9c4e1cfda9ed3ec803397a16a920e Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 26 Feb 2026 14:29:52 +0000 Subject: [PATCH 09/13] Add calculation for p_div_bt_q_aspect_rmajor_mw in Physics class --- process/core/io/plot_proc.py | 2 +- process/core/io/variable_metadata.py | 2 +- process/models/physics/physics.py | 38 ++++++++++------------------ 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/process/core/io/plot_proc.py b/process/core/io/plot_proc.py index 5774d8c00..b2329f45c 100644 --- a/process/core/io/plot_proc.py +++ b/process/core/io/plot_proc.py @@ -2777,7 +2777,7 @@ def plot_main_plasma_information( textstr_div = ( f"\n$P_{{\\text{{sep}}}}$: {mfile.get('p_plasma_separatrix_mw', scan=scan):.2f} MW \n" f"$\\frac{{P_{{\\text{{sep}}}}}}{{R}}$: {mfile.get('p_plasma_separatrix_rmajor_mw', scan=scan):.2f} MW/m \n" - f"$\\frac{{P_{{\\text{{sep}}}}}}{{B_T q_a R}}$: {mfile.get('pdivtbt_over_qar', scan=scan):.2f} MW T/m " + f"$\\frac{{P_{{\\text{{sep}}}}}}{{B_T q_a R}}$: {mfile.get('p_div_bt_q_aspect_rmajor_mw', scan=scan):.2f} MW T/m " ) axis.text( diff --git a/process/core/io/variable_metadata.py b/process/core/io/variable_metadata.py index 3e9dfd5d2..2e4cdbdf4 100644 --- a/process/core/io/variable_metadata.py +++ b/process/core/io/variable_metadata.py @@ -247,7 +247,7 @@ class VariableMetadata: "p_plasma_rad_mw": VariableMetadata( latex=r"$P_{\mathrm{rad}}$ [$MW$]", description="Radiation power", units="MW" ), - "pdivtbt_over_qar": VariableMetadata( + "p_div_bt_q_aspect_rmajor_mw": VariableMetadata( latex=r"$\frac{P_{\mathrm{sep}}B_T}{q_{95}AR_{\mathrm{maj}}}$ [$MWTm^{-1}$]", description="", units="MWTm^{-1}", diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 0eb779625..385d7d819 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -2428,6 +2428,16 @@ def physics(self): ) ) + physics_variables.p_div_bt_q_aspect_rmajor_mw = ( + self.exhaust.calculate_eu_demo_re_attachment_metric( + p_plasma_separatrix_mw=physics_variables.p_plasma_separatrix_mw, + b_plasma_toroidal_on_axis=physics_variables.b_plasma_toroidal_on_axis, + q95=physics_variables.q95, + aspect=physics_variables.aspect, + rmajor=physics_variables.rmajor, + ) + ) + physics_variables.plfux_plasma_surface_neutron_avg_mw = ( physics_variables.p_neutron_total_mw / physics_variables.a_plasma_surface ) @@ -5359,18 +5369,8 @@ def outplas(self): po.ovarre( self.outfile, "Pdivt Bt / qAR ratio (MWT/m) (On peak divertor)", - "(pdivmaxbt/qar)", - ( - ( - physics_variables.p_div_separatrix_max_mw - * physics_variables.b_plasma_toroidal_on_axis - ) - / ( - physics_variables.q95 - * physics_variables.aspect - * physics_variables.rmajor - ) - ), + "(p_div_bt_q_aspect_rmajor_mw)", + physics_variables.p_div_bt_q_aspect_rmajor_mw, "OP ", ) else: @@ -5385,18 +5385,8 @@ def outplas(self): po.ovarre( self.outfile, "Psep Bt / qAR ratio (MWT/m)", - "(pdivtbt_over_qar)", - ( - ( - physics_variables.p_plasma_separatrix_mw - * physics_variables.b_plasma_toroidal_on_axis - ) - / ( - physics_variables.q95 - * physics_variables.aspect - * physics_variables.rmajor - ) - ), + "(p_div_bt_q_aspect_rmajor_mw)", + physics_variables.p_div_bt_q_aspect_rmajor_mw, "OP ", ) From cc155dc2f68060f3d3dcbce89caf74346f697a57 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 26 Feb 2026 14:41:24 +0000 Subject: [PATCH 10/13] Refactor docstrings in PlasmaExhaust class to use NumPy style formatting and add references for EU DEMO metric calculation --- process/models/physics/physics.py | 89 ++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 32 deletions(-) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 385d7d819..b95866cd9 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -9887,20 +9887,25 @@ def calculate_separatrix_power( """ Calculate the power crossing the separatrix (P_sep). - :param f_p_alpha_plasma_deposited: Fraction of alpha power deposited in plasma. - :type f_p_alpha_plasma_deposited: float - :param p_alpha_total_mw: Total alpha power produced (MW). - :type p_alpha_total_mw: float - :param p_non_alpha_charged_mw: Power from non-alpha charged particles (MW). - :type p_non_alpha_charged_mw: float - :param p_hcd_injected_total_mw: Total power injected by heating and current drive (MW). - :type p_hcd_injected_total_mw: float - :param p_plasma_ohmic_mw: Ohmic heating power (MW). - :type p_plasma_ohmic_mw: float - :param p_plasma_rad_mw: Radiated power from plasma (MW). - :type p_plasma_rad_mw: float - :return: Power crossing the separatrix (MW). - :rtype: float + Parameters + ---------- + f_p_alpha_plasma_deposited : float + Fraction of alpha power deposited in plasma. + p_alpha_total_mw : float + Total alpha power produced (MW). + p_non_alpha_charged_mw : float + Power from non-alpha charged particles (MW). + p_hcd_injected_total_mw : float + Total power injected by heating and current drive (MW). + p_plasma_ohmic_mw : float + Ohmic heating power (MW). + p_plasma_rad_mw : float + Radiated power from plasma (MW). + + Returns + ------- + float + Power crossing the separatrix (MW). """ return ( @@ -9918,13 +9923,17 @@ def calculate_psep_over_r_metric( """ Calculate the power crossing the separatrix per unit major radius (P_sep/R). - :param p_plasma_separatrix_mw: Power crossing the separatrix (MW). - :type p_plasma_separatrix_mw: float - :param rmajor: Plasma major radius (m). - :type rmajor: float - :return: Power crossing the separatrix per unit major radius (MW/m). - :rtype: float + Parameters + ---------- + p_plasma_separatrix_mw : float + Power crossing the separatrix (MW). + rmajor : float + Plasma major radius (m). + Returns + ------- + float + Power crossing the separatrix per unit major radius (MW/m). """ return p_plasma_separatrix_mw / rmajor @@ -9938,19 +9947,35 @@ def calculate_eu_demo_re_attachment_metric( ) -> float: """Calculate the EU DEMO divertor protection re-attachment metric for plasma exhaust. - :param p_plasma_separatrix_mw: Power crossing the separatrix (MW). - :type p_plasma_separatrix_mw: float - :param b_plasma_toroidal_on_axis: Toroidal magnetic field on axis (T). - :type b_plasma_toroidal_on_axis: float - :param q95: Safety factor at 95% flux surface. - :type q95: float - :param aspect: Aspect ratio of the plasma. - :type aspect: float - :param rmajor: Plasma major radius (m). - :type rmajor: float - :return: EU DEMO re-attachment metric (MW T /m). - :rtype: float + Parameters + ---------- + p_plasma_separatrix_mw : float + Power crossing the separatrix (MW). + b_plasma_toroidal_on_axis : float + Toroidal magnetic field on axis (T). + q95 : float + Safety factor at 95% flux surface. + aspect : float + Aspect ratio of the plasma. + rmajor : float + Plasma major radius (m). + Returns + ------- + float + EU DEMO re-attachment metric (MW T /m). + + References + ---------- + - M. Siccinio, G. Federici, R. Kembleton, H. Lux, F. Maviglia, and J. Morris, + "Figure of merit for divertor protection in the preliminary design of the EU-DEMO reactor," + Nuclear Fusion, vol. 59, no. 10, pp. 106026-106026, Jul. 2019, + doi: https://doi.org/10.1088/1741-4326/ab3153. + + - H. Zohm et al., + "A stepladder approach to a tokamak fusion power plant," + Nuclear Fusion, vol. 57, no. 8, pp. 086002-086002, May 2017, + doi: https://doi.org/10.1088/1741-4326/aa739e. """ return (p_plasma_separatrix_mw * b_plasma_toroidal_on_axis) / ( From 9ba0b574bb24e1a61bb89c1266f666756792bce5 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 26 Feb 2026 14:50:56 +0000 Subject: [PATCH 11/13] Create exhaust file --- process/main.py | 2 +- process/models/physics/exhaust.py | 120 ++++++++++++++++++++++++++++++ process/models/physics/physics.py | 115 ---------------------------- tests/unit/test_physics.py | 2 +- tests/unit/test_stellarator.py | 2 +- 5 files changed, 123 insertions(+), 118 deletions(-) create mode 100644 process/models/physics/exhaust.py diff --git a/process/main.py b/process/main.py index 45a35e4b8..554b9b85b 100644 --- a/process/main.py +++ b/process/main.py @@ -92,12 +92,12 @@ LowerHybrid, NeutralBeam, ) +from process.models.physics.exhaust import PlasmaExhaust from process.models.physics.impurity_radiation import initialise_imprad from process.models.physics.physics import ( DetailedPhysics, Physics, PlasmaBeta, - PlasmaExhaust, PlasmaInductance, ) from process.models.physics.plasma_geometry import PlasmaGeom diff --git a/process/models/physics/exhaust.py b/process/models/physics/exhaust.py new file mode 100644 index 000000000..d57e9ab7f --- /dev/null +++ b/process/models/physics/exhaust.py @@ -0,0 +1,120 @@ +import logging + +from process import constants + +logger = logging.getLogger(__name__) + + +class PlasmaExhaust: + """Class to hold plasma exhaust calculations for plasma processing.""" + + def __init__(self): + self.outfile = constants.NOUT + self.mfile = constants.MFILE + + @staticmethod + def calculate_separatrix_power( + f_p_alpha_plasma_deposited: float, + p_alpha_total_mw: float, + p_non_alpha_charged_mw: float, + p_hcd_injected_total_mw: float, + p_plasma_ohmic_mw: float, + p_plasma_rad_mw: float, + ) -> float: + """ + Calculate the power crossing the separatrix (P_sep). + + Parameters + ---------- + f_p_alpha_plasma_deposited : float + Fraction of alpha power deposited in plasma. + p_alpha_total_mw : float + Total alpha power produced (MW). + p_non_alpha_charged_mw : float + Power from non-alpha charged particles (MW). + p_hcd_injected_total_mw : float + Total power injected by heating and current drive (MW). + p_plasma_ohmic_mw : float + Ohmic heating power (MW). + p_plasma_rad_mw : float + Radiated power from plasma (MW). + + Returns + ------- + float + Power crossing the separatrix (MW). + """ + + return ( + f_p_alpha_plasma_deposited * p_alpha_total_mw + + p_non_alpha_charged_mw + + p_hcd_injected_total_mw + + p_plasma_ohmic_mw + - p_plasma_rad_mw + ) + + @staticmethod + def calculate_psep_over_r_metric( + p_plasma_separatrix_mw: float, rmajor: float + ) -> float: + """ + Calculate the power crossing the separatrix per unit major radius (P_sep/R). + + Parameters + ---------- + p_plasma_separatrix_mw : float + Power crossing the separatrix (MW). + rmajor : float + Plasma major radius (m). + + Returns + ------- + float + Power crossing the separatrix per unit major radius (MW/m). + """ + return p_plasma_separatrix_mw / rmajor + + @staticmethod + def calculate_eu_demo_re_attachment_metric( + p_plasma_separatrix_mw: float, + b_plasma_toroidal_on_axis: float, + q95: float, + aspect: float, + rmajor: float, + ) -> float: + """Calculate the EU DEMO divertor protection re-attachment metric for plasma exhaust. + + Parameters + ---------- + p_plasma_separatrix_mw : float + Power crossing the separatrix (MW). + b_plasma_toroidal_on_axis : float + Toroidal magnetic field on axis (T). + q95 : float + Safety factor at 95% flux surface. + aspect : float + Aspect ratio of the plasma. + rmajor : float + Plasma major radius (m). + + Returns + ------- + float + EU DEMO re-attachment metric (MW T /m). + + References + ---------- + - M. Siccinio, G. Federici, R. Kembleton, H. Lux, F. Maviglia, and J. Morris, + "Figure of merit for divertor protection in the preliminary design of the EU-DEMO reactor," + Nuclear Fusion, vol. 59, no. 10, pp. 106026-106026, Jul. 2019, + doi: https://doi.org/10.1088/1741-4326/ab3153. + + - H. Zohm et al., + "A stepladder approach to a tokamak fusion power plant," + Nuclear Fusion, vol. 57, no. 8, pp. 086002-086002, May 2017, + doi: https://doi.org/10.1088/1741-4326/aa739e. + """ + + return (p_plasma_separatrix_mw * b_plasma_toroidal_on_axis) / ( + q95 * aspect * rmajor + ) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index b95866cd9..7641a28c0 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -9868,121 +9868,6 @@ def output_volt_second_information(self): po.oblnkl(self.outfile) -class PlasmaExhaust: - """Class to hold plasma exhaust calculations for plasma processing.""" - - def __init__(self): - self.outfile = constants.NOUT - self.mfile = constants.MFILE - - @staticmethod - def calculate_separatrix_power( - f_p_alpha_plasma_deposited: float, - p_alpha_total_mw: float, - p_non_alpha_charged_mw: float, - p_hcd_injected_total_mw: float, - p_plasma_ohmic_mw: float, - p_plasma_rad_mw: float, - ) -> float: - """ - Calculate the power crossing the separatrix (P_sep). - - Parameters - ---------- - f_p_alpha_plasma_deposited : float - Fraction of alpha power deposited in plasma. - p_alpha_total_mw : float - Total alpha power produced (MW). - p_non_alpha_charged_mw : float - Power from non-alpha charged particles (MW). - p_hcd_injected_total_mw : float - Total power injected by heating and current drive (MW). - p_plasma_ohmic_mw : float - Ohmic heating power (MW). - p_plasma_rad_mw : float - Radiated power from plasma (MW). - - Returns - ------- - float - Power crossing the separatrix (MW). - """ - - return ( - f_p_alpha_plasma_deposited * p_alpha_total_mw - + p_non_alpha_charged_mw - + p_hcd_injected_total_mw - + p_plasma_ohmic_mw - - p_plasma_rad_mw - ) - - @staticmethod - def calculate_psep_over_r_metric( - p_plasma_separatrix_mw: float, rmajor: float - ) -> float: - """ - Calculate the power crossing the separatrix per unit major radius (P_sep/R). - - Parameters - ---------- - p_plasma_separatrix_mw : float - Power crossing the separatrix (MW). - rmajor : float - Plasma major radius (m). - - Returns - ------- - float - Power crossing the separatrix per unit major radius (MW/m). - """ - return p_plasma_separatrix_mw / rmajor - - @staticmethod - def calculate_eu_demo_re_attachment_metric( - p_plasma_separatrix_mw: float, - b_plasma_toroidal_on_axis: float, - q95: float, - aspect: float, - rmajor: float, - ) -> float: - """Calculate the EU DEMO divertor protection re-attachment metric for plasma exhaust. - - Parameters - ---------- - p_plasma_separatrix_mw : float - Power crossing the separatrix (MW). - b_plasma_toroidal_on_axis : float - Toroidal magnetic field on axis (T). - q95 : float - Safety factor at 95% flux surface. - aspect : float - Aspect ratio of the plasma. - rmajor : float - Plasma major radius (m). - - Returns - ------- - float - EU DEMO re-attachment metric (MW T /m). - - References - ---------- - - M. Siccinio, G. Federici, R. Kembleton, H. Lux, F. Maviglia, and J. Morris, - "Figure of merit for divertor protection in the preliminary design of the EU-DEMO reactor," - Nuclear Fusion, vol. 59, no. 10, pp. 106026-106026, Jul. 2019, - doi: https://doi.org/10.1088/1741-4326/ab3153. - - - H. Zohm et al., - "A stepladder approach to a tokamak fusion power plant," - Nuclear Fusion, vol. 57, no. 8, pp. 086002-086002, May 2017, - doi: https://doi.org/10.1088/1741-4326/aa739e. - """ - - return (p_plasma_separatrix_mw * b_plasma_toroidal_on_axis) / ( - q95 * aspect * rmajor - ) - - class DetailedPhysics: """Class to hold detailed physics models for plasma processing.""" diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 8cb8ce999..39af3e01f 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -19,12 +19,12 @@ LowerHybrid, NeutralBeam, ) +from process.models.physics.exhaust import PlasmaExhaust from process.models.physics.impurity_radiation import initialise_imprad from process.models.physics.physics import ( DetailedPhysics, Physics, PlasmaBeta, - PlasmaExhaust, PlasmaInductance, calculate_current_coefficient_hastie, calculate_plasma_current_peng, diff --git a/tests/unit/test_stellarator.py b/tests/unit/test_stellarator.py index 9d674a673..0d76a13b0 100644 --- a/tests/unit/test_stellarator.py +++ b/tests/unit/test_stellarator.py @@ -29,10 +29,10 @@ LowerHybrid, NeutralBeam, ) +from process.models.physics.exhaust import PlasmaExhaust from process.models.physics.physics import ( Physics, PlasmaBeta, - PlasmaExhaust, PlasmaInductance, ) from process.models.physics.plasma_profiles import PlasmaProfile From 064acfcc0322a29114b7ebaef5cee30d682069c1 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Mon, 2 Mar 2026 14:27:39 +0000 Subject: [PATCH 12/13] Fix import statement for constants in exhaust module --- process/models/physics/exhaust.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/models/physics/exhaust.py b/process/models/physics/exhaust.py index d57e9ab7f..eb0021fb8 100644 --- a/process/models/physics/exhaust.py +++ b/process/models/physics/exhaust.py @@ -1,6 +1,6 @@ import logging -from process import constants +from process.core import constants logger = logging.getLogger(__name__) From ee17a78fa80f8f7fcade4c16e60a4ae9ca89b1dd Mon Sep 17 00:00:00 2001 From: mn3981 Date: Mon, 2 Mar 2026 14:33:07 +0000 Subject: [PATCH 13/13] Fix variable name in output for plasma separatrix pressure calculation --- process/models/physics/physics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 7641a28c0..ac3202531 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -5362,8 +5362,8 @@ def outplas(self): po.ovarre( self.outfile, "Pdivt / R ratio (MW/m) (On peak divertor)", - "(p_div_separatrix_rmajor_mw)", - physics_variables.p_div_separatrix_rmajor_mw, + "(p_plasma_separatrix_rmajor_mw)", + physics_variables.p_plasma_separatrix_rmajor_mw, "OP ", ) po.ovarre(