From f5822968284c36ff1eb135264ab455bbea8a4fa0 Mon Sep 17 00:00:00 2001 From: apearce Date: Mon, 19 Jan 2026 15:23:05 +0000 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=8E=A8=20remove=20hstar=20calculation?= =?UTF-8?q?=20from=20output=20routines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/physics_variables.py | 6 ++ process/models/physics/physics.py | 61 +++++++-------------- 2 files changed, 25 insertions(+), 42 deletions(-) diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 7f6adaa12..4395e8e34 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -549,6 +549,10 @@ """H factor on energy confinement times, radiation corrected (`iteration variable 10`).""" +hstar : float = None +"""H* non-radiation corrected H factor on energy confinement times""" + + t_plasma_energy_confinement_max: float = None """Maximum allowed energy confinement time (s)""" @@ -1500,6 +1504,7 @@ def init_physics_variables(): f_beta_alpha_beam_thermal, \ hfac, \ hfact, \ + hstar, \ t_plasma_energy_confinement_max, \ i_bootstrap_current, \ i_beta_component, \ @@ -1769,6 +1774,7 @@ def init_physics_variables(): f_beta_alpha_beam_thermal = 0.0 hfac = np.zeros(N_CONFINEMENT_SCALINGS, dtype=np.float64) hfact = 1.0 + hstar = 1.0 t_plasma_energy_confinement_max = 10.0 i_bootstrap_current = 3 i_beta_component = 0 diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 91dd3bef0..9ecf3f272 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -5731,48 +5731,13 @@ def outplas(self): 0.0e0, ) po.ocmmnt(self.outfile, " (No radiation correction applied)") - if physics_variables.i_rad_loss == 1: - po.ovarrf( - self.outfile, - "H* non-radiation corrected", - "(hstar)", - physics_variables.hfact - * ( - physics_variables.p_plasma_loss_mw - / ( - physics_variables.p_plasma_loss_mw - + physics_variables.pden_plasma_sync_mw - + physics_variables.p_plasma_inner_rad_mw - ) - ) - ** 0.31, - "OP", - ) - elif physics_variables.i_rad_loss == 0: - po.ovarrf( - self.outfile, - "H* non-radiation corrected", - "(hstar)", - physics_variables.hfact - * ( - physics_variables.p_plasma_loss_mw - / ( - physics_variables.p_plasma_loss_mw - + physics_variables.pden_plasma_rad_mw - * physics_variables.vol_plasma - ) - ) - ** 0.31, - "OP", - ) - elif physics_variables.i_rad_loss == 2: - po.ovarrf( - self.outfile, - "H* non-radiation corrected", - "(hstar)", - physics_variables.hfact, - "OP", - ) + po.ovarrf( + self.outfile, + "H* non-radiation corrected", + "(hstar)", + physics_variables.hstar, + "OP", + ) po.ocmmnt(self.outfile, " (H* assumes IPB98(y,2), ELMy H-mode scaling)") po.ovarrf( self.outfile, @@ -8181,6 +8146,18 @@ def calculate_confinement_time( # Ion energy confinement time t_ion_energy_confinement = t_electron_energy_confinement + # Calculate H* non-radiation corrected H factor + # Note: we will assume the IPB-98y2 scaling. + if physics_variables.i_rad_loss == 1: + physics_variables.hstar = hfact * ( p_plasma_loss_mw / ( p_plasma_loss_mw + + physics_variables.pden_plasma_sync_mw + + physics_variables.p_plasma_inner_rad_mw ) ) ** 0.31 + elif physics_variables.i_rad_loss == 0: + physics_variables.hstar = hfact * ( p_plasma_loss_mw / ( p_plasma_loss_mw + + physics_variables.pden_plasma_rad_mw * vol_plasma ) ) ** 0.31 + elif physics_variables.i_rad_loss == 2: + physics_variables.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 # (here, temp_plasma_ion_density_weighted_kev and temp_plasma_electron_density_weighted_kev are in keV, and pden_electron_transport_loss_mw and pden_ion_transport_loss_mw are in MW/m3) From 9e9d640404f834b92d8552dcdf4011b18b82a1cd Mon Sep 17 00:00:00 2001 From: apearce Date: Mon, 19 Jan 2026 16:10:33 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9B=20fix=20sync=20rad=20term?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/models/physics/physics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 9ecf3f272..6a0f361f2 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -8150,7 +8150,7 @@ def calculate_confinement_time( # Note: we will assume the IPB-98y2 scaling. if physics_variables.i_rad_loss == 1: physics_variables.hstar = hfact * ( p_plasma_loss_mw / ( p_plasma_loss_mw - + physics_variables.pden_plasma_sync_mw + + physics_variables.pden_plasma_sync_mw * vol_plasma + physics_variables.p_plasma_inner_rad_mw ) ) ** 0.31 elif physics_variables.i_rad_loss == 0: physics_variables.hstar = hfact * ( p_plasma_loss_mw / ( p_plasma_loss_mw From dc8ca2252705f1fc9dfd788c4b5fc4434bd0cf33 Mon Sep 17 00:00:00 2001 From: apearce Date: Mon, 19 Jan 2026 16:27:21 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=8E=A8=20ruff=20formating?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/models/physics/physics.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index 6a0f361f2..69f80ef0a 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -8149,12 +8149,30 @@ def calculate_confinement_time( # Calculate H* non-radiation corrected H factor # Note: we will assume the IPB-98y2 scaling. if physics_variables.i_rad_loss == 1: - physics_variables.hstar = hfact * ( p_plasma_loss_mw / ( p_plasma_loss_mw + physics_variables.hstar = ( + hfact + * ( + p_plasma_loss_mw + / ( + p_plasma_loss_mw + physics_variables.pden_plasma_sync_mw * vol_plasma - + physics_variables.p_plasma_inner_rad_mw ) ) ** 0.31 + + physics_variables.p_plasma_inner_rad_mw + ) + ) + ** 0.31 + ) elif physics_variables.i_rad_loss == 0: - physics_variables.hstar = hfact * ( p_plasma_loss_mw / ( p_plasma_loss_mw - + physics_variables.pden_plasma_rad_mw * vol_plasma ) ) ** 0.31 + physics_variables.hstar = ( + hfact + * ( + p_plasma_loss_mw + / ( + p_plasma_loss_mw + + physics_variables.pden_plasma_rad_mw * vol_plasma + ) + ) + ** 0.31 + ) elif physics_variables.i_rad_loss == 2: physics_variables.hstar = hfact From 7f8b16a914f003f5c2974663123636c4fb546f0b Mon Sep 17 00:00:00 2001 From: apearce Date: Thu, 19 Feb 2026 15:55:45 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=9A=A8=20fix=20ruff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/physics_variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 4395e8e34..4c6557296 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -549,7 +549,7 @@ """H factor on energy confinement times, radiation corrected (`iteration variable 10`).""" -hstar : float = None +hstar: float = None """H* non-radiation corrected H factor on energy confinement times"""