From c30ac8510935974566f1db7368272a6c87634554 Mon Sep 17 00:00:00 2001 From: Timothy Nunn Date: Mon, 29 Jun 2026 14:15:43 +0100 Subject: [PATCH] Correct hstar being stored on data structure --- process/models/physics/confinement_time.py | 14 ++++++++++---- process/models/physics/physics.py | 1 + process/models/stellarator/stellarator.py | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/process/models/physics/confinement_time.py b/process/models/physics/confinement_time.py index 6e697c71c..1781fa2c0 100644 --- a/process/models/physics/confinement_time.py +++ b/process/models/physics/confinement_time.py @@ -37,6 +37,8 @@ class ConfinementTimeData: """Plasma energy confinement time in seconds.""" p_plasma_loss_mw: float """Total plasma loss power in MW.""" + hstar: float + """Non-radiation corrected H factor on energy confinement times""" class PlasmaConfinementTime(Model): @@ -936,8 +938,11 @@ def calculate_confinement_time( # Calculate H* non-radiation corrected H factor # Note: we will assume the IPB-98y2 scaling. - if self.data.physics.i_rad_loss == ConfinementRadiationLossModel.CORE_ONLY: - self.data.physics.hstar = ( + if ( + ConfinementRadiationLossModel(self.data.physics.i_rad_loss) + == ConfinementRadiationLossModel.CORE_ONLY + ): + hstar = ( hfact * ( p_plasma_loss_mw @@ -952,7 +957,7 @@ def calculate_confinement_time( elif ( self.data.physics.i_rad_loss == ConfinementRadiationLossModel.FULL_RADIATION ): - self.data.physics.hstar = ( + hstar = ( hfact * ( p_plasma_loss_mw @@ -964,7 +969,7 @@ def calculate_confinement_time( ** 0.31 ) elif self.data.physics.i_rad_loss == ConfinementRadiationLossModel.NO_RADIATION: - self.data.physics.hstar = hfact + hstar = hfact # Calculation of the transport power loss terms # Transport losses in Watts/m3 are 3/2 * n.e.T / tau , with T in eV @@ -1002,6 +1007,7 @@ def calculate_confinement_time( t_ion_energy_confinement=t_ion_energy_confinement, t_plasma_energy_confinement=t_energy_confinement, p_plasma_loss_mw=p_plasma_loss_mw, + hstar=hstar, ) @staticmethod diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 3987ad7a0..9dfa228e0 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -886,6 +886,7 @@ def run(self): confinement_time_data.t_ion_energy_confinement ) self.data.physics.p_plasma_loss_mw = confinement_time_data.p_plasma_loss_mw + self.data.physics.hstar = confinement_time_data.hstar # Total transport power from scaling law (MW) self.data.physics.p_electron_transport_loss_mw = ( diff --git a/process/models/stellarator/stellarator.py b/process/models/stellarator/stellarator.py index a2f6129e6..4127b69c4 100644 --- a/process/models/stellarator/stellarator.py +++ b/process/models/stellarator/stellarator.py @@ -2295,6 +2295,7 @@ def st_phys(self, output): confinement_time_data.t_ion_energy_confinement ) self.data.physics.p_plasma_loss_mw = confinement_time_data.p_plasma_loss_mw + self.data.physics.hstar = confinement_time_data.hstar self.data.physics.ntau, self.data.physics.nTtau = ( self.physics.confinement.calculate_double_and_triple_product(