From aeff79d3cce4f7d69d6011ba617bfd850d421236 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 6 Nov 2025 17:21:42 +0000 Subject: [PATCH 01/12] :memo: Add naming conventions for electric charges and charge numbers --- documentation/development/standards.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/documentation/development/standards.md b/documentation/development/standards.md index 306e6c9e32..3767925f44 100644 --- a/documentation/development/standards.md +++ b/documentation/development/standards.md @@ -308,6 +308,18 @@ This should be used for units of $\text{kg} \cdot \text{m}^{-2}\text{s}^{-1}$ --------------------- +##### Electric charges + +- Electric charges should start with the `charge_` prefix + +-------------------- + +###### Charge numbers + +- Electric charge numbers should start with the `n_charge_` prefix. + +------------------ + ##### Current densities - Current densities should start with the `j_` prefix From 53fc3dba63376a4f92e768462636dcd8da6f305d Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 6 Nov 2025 17:23:26 +0000 Subject: [PATCH 02/12] Add plasma effective charge profile variable and initialization --- 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 219b52e951..11eb59bc97 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -1310,6 +1310,9 @@ zeff: float = None """plasma effective charge""" +n_charge_plasma_effective_profile: list[float] = None +"""Profile of plasma effective charge""" + zeffai: float = None """mass weighted plasma effective charge""" @@ -1629,6 +1632,7 @@ def init_physics_variables(): global wtgpd global a_plasma_poloidal global zeff + global n_charge_plasma_effective_profile global zeffai m_beam_amu = 0.0 @@ -1887,4 +1891,5 @@ def init_physics_variables(): wtgpd = 0.0 a_plasma_poloidal = 0.0 zeff = 0.0 + n_charge_plasma_effective_profile = [] zeffai = 0.0 From fab8174dc49bdf22cbb7df197459c786961028ab Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 6 Nov 2025 17:51:54 +0000 Subject: [PATCH 03/12] Add calculation and output of effective charge zeff profile in plasma --- process/physics.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/process/physics.py b/process/physics.py index c3d91fce18..7ee41c69ff 100644 --- a/process/physics.py +++ b/process/physics.py @@ -4033,6 +4033,21 @@ def outplas(self): to a file, in a tidy format. """ + # Calculate the effective charge (zeff) profile across the plasma + # Returns an array of zeff at each radial point + zeff_profile = np.zeros_like(self.plasma_profile.teprofile.profile_y) + for i in range(len(zeff_profile)): + zeff_profile[i] = 0.0 + for imp in range(impurity_radiation_module.N_IMPURITIES): + zeff_profile[i] += ( + impurity_radiation_module.f_nd_impurity_electron_array[imp] + * impurity_radiation.zav_of_te( + imp, np.array([self.plasma_profile.teprofile.profile_y[i]]) + ).squeeze() + ** 2 + ) + physics_variables.n_charge_plasma_effective_profile = zeff_profile + # ############################################### # Dimensionless plasma parameters. See reference below. physics_variables.nu_star = ( @@ -5017,6 +5032,14 @@ def outplas(self): po.ovarrf( self.outfile, "Effective charge", "(zeff)", physics_variables.zeff, "OP " ) + for i in range(len(physics_variables.n_charge_plasma_effective_profile)): + po.ovarre( + self.outfile, + "Effective charge at point", + f"(n_charge_plasma_effective_profile{i})", + physics_variables.n_charge_plasma_effective_profile[i], + "OP ", + ) po.ovarrf( self.outfile, From 9fa4899b1d1a8aaf261546b0b1b1e8a0cda25be4 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 6 Nov 2025 17:58:42 +0000 Subject: [PATCH 04/12] Add function to plot plasma effective charge profile --- process/io/plot_proc.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 1e0d2c7258..b5056bc32b 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -12326,6 +12326,30 @@ def plot_plasma_outboard_toroidal_ripple_map( fig.tight_layout() +def plot_plasma_effective_charge_profile(axis, mfile_data, scan): + n_plasma_profile_elements = int( + mfile_data.data["n_plasma_profile_elements"].get_scan(scan) + ) + + n_charge_plasma_effective_profile = [ + mfile_data.data[f"n_charge_plasma_effective_profile{i}"].get_scan(scan) + for i in range(n_plasma_profile_elements) + ] + + axis.plot( + np.linspace(0, 1, n_plasma_profile_elements), + n_charge_plasma_effective_profile, + label="Effective Charge Profile", + ) + + axis.set_xlabel("Normalized Minor Radius (r/a)") + axis.set_ylabel("Effective Charge ($Z_{\\text{eff}}$)") + axis.set_title("Plasma Effective Charge Profile") + axis.minorticks_on() + axis.set_xlim(0, 1.025) + axis.grid(which="both", linestyle="--", alpha=0.5) + + def main_plot( fig0, fig1, @@ -12353,6 +12377,7 @@ def main_plot( fig23, fig24, fig25, + fig26, m_file_data, scan, imp="../data/lz_non_corona_14_elements/", @@ -12632,6 +12657,8 @@ def main_plot( ax24.set_position([0.08, 0.35, 0.84, 0.57]) plot_system_power_profiles_over_time(ax24, m_file_data, scan, fig25) + plot_plasma_effective_charge_profile(fig26.add_subplot(111), m_file_data, scan) + def main(args=None): # TODO The use of globals here isn't ideal, but is required to get main() @@ -12949,6 +12976,7 @@ def main(args=None): page23 = plt.figure(figsize=(12, 9), dpi=80) page24 = plt.figure(figsize=(12, 9), dpi=80) page25 = plt.figure(figsize=(12, 9), dpi=80) + page26 = plt.figure(figsize=(12, 9), dpi=80) # run main_plot main_plot( @@ -12978,6 +13006,7 @@ def main(args=None): page23, page24, page25, + page26, m_file, scan=scan, demo_ranges=demo_ranges, @@ -13012,6 +13041,7 @@ def main(args=None): pdf.savefig(page23) pdf.savefig(page24) pdf.savefig(page25) + pdf.savefig(page26) # show fig if option used if args.show: @@ -13043,6 +13073,7 @@ def main(args=None): plt.close(page23) plt.close(page24) plt.close(page25) + plt.close(page26) if __name__ == "__main__": From aff231f2e39e2b69f0ebac441302ac191a477a26 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 6 Nov 2025 18:24:28 +0000 Subject: [PATCH 05/12] Add charge profile initialization and assignment for impurities --- .../impurity_radiation_module.py | 5 ++++ process/physics.py | 25 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/process/data_structure/impurity_radiation_module.py b/process/data_structure/impurity_radiation_module.py index c3d23807c4..250e65d1a6 100644 --- a/process/data_structure/impurity_radiation_module.py +++ b/process/data_structure/impurity_radiation_module.py @@ -27,6 +27,9 @@ f_nd_impurity_electrons: list[float] = None +n_charge_impurity_profile: list[list[float]] = None +"""charge profile of impurities""" + imp_label: list[str] = None impurity_arr_label: list[str] = None @@ -53,6 +56,7 @@ def init_impurity_radiation_module(): global radius_plasma_core_norm global f_p_plasma_core_rad_reduction global f_nd_impurity_electrons + global n_charge_impurity_profile global imp_label global impurity_arr_label global impurity_arr_z @@ -101,6 +105,7 @@ def init_impurity_radiation_module(): impurity_arr_z = np.zeros(N_IMPURITIES) m_impurity_amu_array = np.zeros(N_IMPURITIES) f_nd_impurity_electron_array = np.zeros(N_IMPURITIES) + n_charge_impurity_profile = np.zeros((N_IMPURITIES, 200)) impurity_arr_len_tab = np.full(N_IMPURITIES, 0) temp_impurity_keV_array = np.zeros((N_IMPURITIES, 200)) pden_impurity_lz_nd_temp_array = np.zeros((N_IMPURITIES, 200)) diff --git a/process/physics.py b/process/physics.py index 7ee41c69ff..54ec32b3af 100644 --- a/process/physics.py +++ b/process/physics.py @@ -4048,6 +4048,21 @@ def outplas(self): ) physics_variables.n_charge_plasma_effective_profile = zeff_profile + # Assign the charge profiles of each species + n_impurities = impurity_radiation_module.N_IMPURITIES + te_profile = self.plasma_profile.teprofile.profile_y + n_points = len(te_profile) + # Create a 2D array: (n_impurities, n_points) + charge_profiles = np.zeros((n_impurities, n_points)) + for imp in range(n_impurities): + for i in range(n_points): + charge_profiles[imp, i] = impurity_radiation.zav_of_te( + imp, np.array([te_profile[i]]) + ).squeeze() + impurity_radiation_module.n_charge_impurity_profile = charge_profiles + + print(impurity_radiation_module.n_charge_impurity_profile) + # ############################################### # Dimensionless plasma parameters. See reference below. physics_variables.nu_star = ( @@ -5041,6 +5056,16 @@ def outplas(self): "OP ", ) + for imp in range(impurity_radiation_module.N_IMPURITIES): + for i in range(physics_variables.n_plasma_profile_elements): + po.ovarre( + self.outfile, + "Impurity charge at point", + f"(n_charge_plasma_profile{imp}_{i})", + impurity_radiation_module.n_charge_impurity_profile[imp][i], + "OP ", + ) + po.ovarrf( self.outfile, "Mass-weighted Effective charge", From 8fe8f1155c0c9301d067e7953f77f8d1a0781d2b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 6 Nov 2025 18:33:45 +0000 Subject: [PATCH 06/12] Add function to plot ion charge profile and update effective charge profile plotting --- process/io/plot_proc.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index b5056bc32b..2c2358f661 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -36,7 +36,7 @@ import process.io.mfile as mf import process.superconducting_tf_coil as sctf from process.build import Build -from process.data_structure import physics_variables +from process.data_structure import impurity_radiation_module, physics_variables from process.geometry.blanket_geometry import ( blanket_geometry_double_null, blanket_geometry_single_null, @@ -12350,6 +12350,26 @@ def plot_plasma_effective_charge_profile(axis, mfile_data, scan): axis.grid(which="both", linestyle="--", alpha=0.5) +def plot_ion_charge_profile(axis, mfile_data, scan): + n_plasma_profile_elements = int( + mfile_data.data["n_plasma_profile_elements"].get_scan(scan) + ) + + n_charge_plasma_profile = [] + for imp in range(impurity_radiation_module.N_IMPURITIES): + profile = [ + mfile_data.data[f"n_charge_plasma_profile{imp}_{i}"].get_scan(scan) + for i in range(n_plasma_profile_elements) + ] + n_charge_plasma_profile.append(profile) + axis.plot( + np.linspace(0, 1, n_plasma_profile_elements), + profile, + label=f"Ion Charge Profile {imp + 1}", + ) + axis.legend() + + def main_plot( fig0, fig1, @@ -12657,7 +12677,8 @@ def main_plot( ax24.set_position([0.08, 0.35, 0.84, 0.57]) plot_system_power_profiles_over_time(ax24, m_file_data, scan, fig25) - plot_plasma_effective_charge_profile(fig26.add_subplot(111), m_file_data, scan) + plot_plasma_effective_charge_profile(fig26.add_subplot(211), m_file_data, scan) + plot_ion_charge_profile(fig26.add_subplot(212), m_file_data, scan) def main(args=None): From 0db544049bec966272ba8b2faa2f1cbaa41f700e Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 6 Nov 2025 19:10:10 +0000 Subject: [PATCH 07/12] Enhance ion charge profile plotting by adding impurity density calculations and average ionization state representation --- process/io/plot_proc.py | 71 +++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 2c2358f661..d6e3f1bfc7 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -12355,19 +12355,70 @@ def plot_ion_charge_profile(axis, mfile_data, scan): mfile_data.data["n_plasma_profile_elements"].get_scan(scan) ) + # find impurity densities + imp_frac = np.array([ + mfile_data.data["f_nd_impurity_electrons(01)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(02)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(03)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(04)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(05)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(06)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(07)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(08)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(09)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(10)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(11)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(12)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(13)"].get_scan(scan), + mfile_data.data["f_nd_impurity_electrons(14)"].get_scan(scan), + ]) + + imp_label = [ + "H", + "He", + "Be", + "C", + "N", + "O", + "Ne", + "Si", + "Ar", + "Fe", + "Ni", + "Kr", + "Xe", + "W", + ] + full_charge_array = [1, 2, 4, 6, 7, 8, 10, 14, 18, 26, 28, 36, 54, 74] + n_charge_plasma_profile = [] + avg_ionisation_percentages = [] for imp in range(impurity_radiation_module.N_IMPURITIES): - profile = [ - mfile_data.data[f"n_charge_plasma_profile{imp}_{i}"].get_scan(scan) - for i in range(n_plasma_profile_elements) - ] - n_charge_plasma_profile.append(profile) - axis.plot( - np.linspace(0, 1, n_plasma_profile_elements), - profile, - label=f"Ion Charge Profile {imp + 1}", - ) + if imp_frac[imp] > 1.0e-30: + profile = [ + mfile_data.data[f"n_charge_plasma_profile{imp}_{i}"].get_scan(scan) + for i in range(n_plasma_profile_elements) + ] + n_charge_plasma_profile.append(profile) + z_max = full_charge_array[imp] + # Calculate relative ionisation state as percent of full ionisation + rel_ion_state = [ + 100.0 * (val / z_max if z_max > 0 else 0) for val in profile + ] + avg_ionisation = np.mean(rel_ion_state) + avg_ionisation_percentages.append((imp_label[imp], avg_ionisation)) + axis.plot( + np.linspace(0, 1, n_plasma_profile_elements), + rel_ion_state, + label=f"{imp_label[imp]} (Z={z_max}): avg {avg_ionisation:.1f}%", + ) + axis.set_ylabel("Relative Ionisation State [% of $Z$]") axis.legend() + axis.set_xlim(0, 1.025) + axis.set_xlabel("Normalized Minor Radius (r/a)") + axis.set_title("Impurity Ion Charge State Profiles") + axis.minorticks_on() + axis.grid(which="both", linestyle="--", alpha=0.5) def main_plot( From a617b6142d145cef85100efe3b61a24d8aa2d5c1 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 7 Nov 2025 09:44:57 +0000 Subject: [PATCH 08/12] Add volume-averaged Zeff line to plasma effective charge profile plot --- process/io/plot_proc.py | 105 ++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index d6e3f1bfc7..05dba96eff 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -12331,6 +12331,8 @@ def plot_plasma_effective_charge_profile(axis, mfile_data, scan): mfile_data.data["n_plasma_profile_elements"].get_scan(scan) ) + zeff = mfile_data.data["zeff"].get_scan(scan) + n_charge_plasma_effective_profile = [ mfile_data.data[f"n_charge_plasma_effective_profile{i}"].get_scan(scan) for i in range(n_plasma_profile_elements) @@ -12339,15 +12341,24 @@ def plot_plasma_effective_charge_profile(axis, mfile_data, scan): axis.plot( np.linspace(0, 1, n_plasma_profile_elements), n_charge_plasma_effective_profile, - label="Effective Charge Profile", ) - axis.set_xlabel("Normalized Minor Radius (r/a)") + axis.hlines( + zeff, + xmin=0, + xmax=1, + colors="red", + linestyles="--", + label=f"Volume-Averaged $Z_{{\\text{{eff}}}}$ = {zeff:.2f}", + ) + + axis.set_xlabel(r"$\rho \quad [r/a]$") axis.set_ylabel("Effective Charge ($Z_{\\text{eff}}$)") axis.set_title("Plasma Effective Charge Profile") axis.minorticks_on() axis.set_xlim(0, 1.025) axis.grid(which="both", linestyle="--", alpha=0.5) + axis.legend() def plot_ion_charge_profile(axis, mfile_data, scan): @@ -12415,7 +12426,7 @@ def plot_ion_charge_profile(axis, mfile_data, scan): axis.set_ylabel("Relative Ionisation State [% of $Z$]") axis.legend() axis.set_xlim(0, 1.025) - axis.set_xlabel("Normalized Minor Radius (r/a)") + axis.set_xlabel(r"$\rho \quad [r/a]$") axis.set_title("Impurity Ion Charge State Profiles") axis.minorticks_on() axis.grid(which="both", linestyle="--", alpha=0.5) @@ -12540,10 +12551,13 @@ def main_plot( ax13.set_position([0.7, 0.125, 0.25, 0.15]) plot_qprofile(ax13, demo_ranges, m_file_data, scan) - plot_fusion_rate_profiles(fig5.add_subplot(122), fig5, m_file_data, scan) + plot_plasma_effective_charge_profile(fig5.add_subplot(221), m_file_data, scan) + plot_ion_charge_profile(fig5.add_subplot(223), m_file_data, scan) + + plot_fusion_rate_profiles(fig6.add_subplot(122), fig6, m_file_data, scan) if m_file_data.data["i_plasma_shape"].get_scan(scan) == 1: - plot_fusion_rate_contours(fig6, fig7, m_file_data, scan) + plot_fusion_rate_contours(fig7, fig8, m_file_data, scan) i_shape = int(m_file_data.data["i_plasma_shape"].get_scan(scan)) if i_shape != 1: @@ -12554,19 +12568,19 @@ def main_plot( "see the 1D fusion rate/profile plots for available information." ) # Add explanatory text to both figures reserved for contour outputs - fig6.text(0.5, 0.5, msg, ha="center", va="center", wrap=True, fontsize=12) fig7.text(0.5, 0.5, msg, ha="center", va="center", wrap=True, fontsize=12) + fig8.text(0.5, 0.5, msg, ha="center", va="center", wrap=True, fontsize=12) - plot_plasma_pressure_profiles(fig8.add_subplot(222), m_file_data, scan) - plot_plasma_pressure_gradient_profiles(fig8.add_subplot(224), m_file_data, scan) + plot_plasma_pressure_profiles(fig9.add_subplot(222), m_file_data, scan) + plot_plasma_pressure_gradient_profiles(fig9.add_subplot(224), m_file_data, scan) # Currently only works with Sauter geometry as plasma has a closed surface i_shape = int(m_file_data.data["i_plasma_shape"].get_scan(scan)) if i_shape == 1: plot_plasma_poloidal_pressure_contours( - fig8.add_subplot(121, aspect="equal"), m_file_data, scan + fig9.add_subplot(121, aspect="equal"), m_file_data, scan ) else: - ax = fig8.add_subplot(131, aspect="equal") + ax = fig9.add_subplot(131, aspect="equal") msg = ( "Plasma poloidal pressure contours require a closed (Sauter) plasma boundary " "(i_plasma_shape == 1). " @@ -12585,12 +12599,12 @@ def main_plot( ) ax.axis("off") - plot_magnetic_fields_in_plasma(fig9.add_subplot(122), m_file_data, scan) - plot_beta_profiles(fig9.add_subplot(221), m_file_data, scan) + plot_magnetic_fields_in_plasma(fig10.add_subplot(122), m_file_data, scan) + plot_beta_profiles(fig10.add_subplot(221), m_file_data, scan) # Plot poloidal cross-section poloidal_cross_section( - fig10.add_subplot(121, aspect="equal"), + fig11.add_subplot(121, aspect="equal"), m_file_data, scan, demo_ranges, @@ -12599,7 +12613,7 @@ def main_plot( # Plot toroidal cross-section toroidal_cross_section( - fig10.add_subplot(122, aspect="equal"), + fig11.add_subplot(122, aspect="equal"), m_file_data, scan, demo_ranges, @@ -12607,19 +12621,19 @@ def main_plot( ) # Plot color key - ax17 = fig10.add_subplot(222) + ax17 = fig11.add_subplot(222) ax17.set_position([0.5, 0.5, 0.5, 0.5]) color_key(ax17, m_file_data, scan, colour_scheme) - ax18 = fig11.add_subplot(211) + ax18 = fig12.add_subplot(211) ax18.set_position([0.1, 0.33, 0.8, 0.6]) plot_radial_build(ax18, m_file_data, colour_scheme) # Make each axes smaller vertically to leave room for the legend - ax185 = fig12.add_subplot(211) + ax185 = fig13.add_subplot(211) ax185.set_position([0.1, 0.61, 0.8, 0.32]) - ax18b = fig12.add_subplot(212) + ax18b = fig13.add_subplot(212) ax18b.set_position([0.1, 0.13, 0.8, 0.32]) plot_upper_vertical_build(ax185, m_file_data, colour_scheme) plot_lower_vertical_build(ax18b, m_file_data, colour_scheme) @@ -12627,57 +12641,57 @@ def main_plot( # Can only plot WP and turn structure if superconducting coil at the moment if m_file_data.data["i_tf_sup"].get_scan(scan) == 1: # TF coil with WP - ax19 = fig13.add_subplot(221, aspect="equal") + ax19 = fig14.add_subplot(221, aspect="equal") ax19.set_position([ 0.025, 0.45, 0.5, 0.5, ]) # Half height, a bit wider, top left - plot_superconducting_tf_wp(ax19, m_file_data, scan, fig13) + plot_superconducting_tf_wp(ax19, m_file_data, scan, fig14) # TF coil turn structure - ax20 = fig14.add_subplot(325, aspect="equal") + ax20 = fig15.add_subplot(325, aspect="equal") ax20.set_position([0.025, 0.5, 0.4, 0.4]) - plot_tf_cable_in_conduit_turn(ax20, fig14, m_file_data, scan) - plot_205 = fig14.add_subplot(223, aspect="equal") + plot_tf_cable_in_conduit_turn(ax20, fig15, m_file_data, scan) + plot_205 = fig15.add_subplot(223, aspect="equal") plot_205.set_position([0.075, 0.1, 0.3, 0.3]) - plot_cable_in_conduit_cable(plot_205, fig14, m_file_data, scan) + plot_cable_in_conduit_cable(plot_205, fig15, m_file_data, scan) else: - ax19 = fig13.add_subplot(211, aspect="equal") + ax19 = fig14.add_subplot(211, aspect="equal") ax19.set_position([0.06, 0.55, 0.675, 0.4]) - plot_resistive_tf_wp(ax19, m_file_data, scan, fig13) + plot_resistive_tf_wp(ax19, m_file_data, scan, fig14) plot_tf_coil_structure( - fig15.add_subplot(111, aspect="equal"), m_file_data, scan, colour_scheme + fig16.add_subplot(111, aspect="equal"), m_file_data, scan, colour_scheme ) - plot_plasma_outboard_toroidal_ripple_map(fig16, m_file_data, scan) + plot_plasma_outboard_toroidal_ripple_map(fig17, m_file_data, scan) - axes = fig17.subplots(nrows=3, ncols=1, sharex=True).flatten() + axes = fig18.subplots(nrows=3, ncols=1, sharex=True).flatten() plot_tf_stress(axes) - plot_bootstrap_comparison(fig18.add_subplot(221), m_file_data, scan) - plot_h_threshold_comparison(fig18.add_subplot(224), m_file_data, scan) - plot_density_limit_comparison(fig19.add_subplot(221), m_file_data, scan) - plot_confinement_time_comparison(fig19.add_subplot(224), m_file_data, scan) - plot_current_profiles_over_time(fig20.add_subplot(111), m_file_data, scan) + plot_bootstrap_comparison(fig19.add_subplot(221), m_file_data, scan) + plot_h_threshold_comparison(fig19.add_subplot(224), m_file_data, scan) + plot_density_limit_comparison(fig20.add_subplot(221), m_file_data, scan) + plot_confinement_time_comparison(fig20.add_subplot(224), m_file_data, scan) + plot_current_profiles_over_time(fig21.add_subplot(111), m_file_data, scan) plot_cs_coil_structure( - fig21.add_subplot(121, aspect="equal"), fig21, m_file_data, scan + fig22.add_subplot(121, aspect="equal"), fig22, m_file_data, scan ) plot_cs_turn_structure( - fig21.add_subplot(224, aspect="equal"), fig21, m_file_data, scan + fig22.add_subplot(224, aspect="equal"), fig22, m_file_data, scan ) plot_first_wall_top_down_cross_section( - fig22.add_subplot(221, aspect="equal"), m_file_data, scan + fig23.add_subplot(221, aspect="equal"), m_file_data, scan ) - plot_first_wall_poloidal_cross_section(fig22.add_subplot(122), m_file_data, scan) - plot_fw_90_deg_pipe_bend(fig22.add_subplot(337), m_file_data, scan) + plot_first_wall_poloidal_cross_section(fig23.add_subplot(122), m_file_data, scan) + plot_fw_90_deg_pipe_bend(fig23.add_subplot(337), m_file_data, scan) - plot_blkt_pipe_bends(fig23, m_file_data, scan) - ax_blanket = fig23.add_subplot(122, aspect="equal") + plot_blkt_pipe_bends(fig24, m_file_data, scan) + ax_blanket = fig24.add_subplot(122, aspect="equal") plot_blanket(ax_blanket, m_file_data, scan, colour_scheme) plot_firstwall(ax_blanket, m_file_data, scan, colour_scheme) ax_blanket.set_xlabel("Radial position [m]") @@ -12720,16 +12734,13 @@ def main_plot( ) plot_main_power_flow( - fig24.add_subplot(111, aspect="equal"), m_file_data, scan, fig24 + fig25.add_subplot(111, aspect="equal"), m_file_data, scan, fig25 ) - ax24 = fig25.add_subplot(111) + ax24 = fig26.add_subplot(111) # set_position([left, bottom, width, height]) -> height ~ 0.66 => ~2/3 of page height ax24.set_position([0.08, 0.35, 0.84, 0.57]) - plot_system_power_profiles_over_time(ax24, m_file_data, scan, fig25) - - plot_plasma_effective_charge_profile(fig26.add_subplot(211), m_file_data, scan) - plot_ion_charge_profile(fig26.add_subplot(212), m_file_data, scan) + plot_system_power_profiles_over_time(ax24, m_file_data, scan, fig26) def main(args=None): From 84e3aeb31572b74c7048df07c2d009c423673bdc Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 7 Nov 2025 11:05:27 +0000 Subject: [PATCH 09/12] =?UTF-8?q?=F0=9F=94=84=20-=20Refactor=20plasma=20ef?= =?UTF-8?q?fective=20charge=20variable=20names=20to=20use=20`n=5Fcharge=5F?= =?UTF-8?q?plasma=5Feffective=5Fvol=5Favg`=20for=20consistency=20across=20?= =?UTF-8?q?the=20codebase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/constraints.py | 6 +-- process/current_drive.py | 18 ++++--- .../data_structure/constraint_variables.py | 2 +- process/data_structure/physics_variables.py | 8 +-- process/io/mfile_comparison.py | 2 +- process/io/plot_proc.py | 12 +++-- process/io/variable_metadata.py | 2 +- process/output.py | 1 + process/physics.py | 49 ++++++++++--------- process/stellarator.py | 2 +- .../data/large_tokamak_1_MFILE.DAT | 2 +- .../data/large_tokamak_2_MFILE.DAT | 2 +- .../data/large_tokamak_3_MFILE.DAT | 2 +- .../data/large_tokamak_4_MFILE.DAT | 2 +- .../integration/data/large_tokamak_MFILE.DAT | 2 +- tests/integration/data/ref_IN.DAT | 2 +- tests/integration/data/scan_2D_MFILE.DAT | 30 ++++++------ tests/integration/data/scan_MFILE.DAT | 20 ++++---- tests/unit/data/large_tokamak_MFILE.DAT | 2 +- tests/unit/test_current_drive.py | 4 +- tests/unit/test_physics.py | 16 ++++-- tracking/tracking_data.py | 2 +- 22 files changed, 105 insertions(+), 83 deletions(-) diff --git a/process/constraints.py b/process/constraints.py index b72e12f3c5..0001be1c0f 100644 --- a/process/constraints.py +++ b/process/constraints.py @@ -1654,12 +1654,12 @@ def constraint_equation_64(): """Upper limit on Zeff author: P B Lloyd, CCFE, Culham Science Centre - fzeff_max: f-value for maximum zeff + fzeff_max: f-value for maximum n_charge_plasma_effective_vol_avg zeff_max: maximum value for Zeff - zeff: plasma effective charge + n_charge_plasma_effective_vol_avg: plasma effective charge """ cc = ( - data_structure.physics_variables.zeff + data_structure.physics_variables.n_charge_plasma_effective_vol_avg / data_structure.constraint_variables.zeff_max - 1.0 * data_structure.constraint_variables.fzeff_max ) diff --git a/process/current_drive.py b/process/current_drive.py index 3c7cb4f7fe..25dc39b4da 100644 --- a/process/current_drive.py +++ b/process/current_drive.py @@ -102,7 +102,7 @@ def iternb(self): current_drive_variables.e_beam_kev, physics_variables.rmajor, physics_variables.temp_plasma_electron_density_weighted_kev, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) return effnbss, f_p_beam_injected_ions, fshine @@ -198,7 +198,7 @@ def culnbi(self): physics_variables.rmajor, physics_variables.rminor, physics_variables.temp_plasma_electron_density_weighted_kev, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) return effnbss, f_p_beam_injected_ions, fshine @@ -605,7 +605,7 @@ def culecd(self): epsloc = rrr * physics_variables.rminor / physics_variables.rmajor # Effective charge (use average value) - zlocal = physics_variables.zeff + zlocal = physics_variables.n_charge_plasma_effective_vol_avg # Coulomb logarithm for ion-electron collisions # (From J. A. Wesson, 'Tokamaks', Clarendon Press, Oxford, p.293) @@ -1066,7 +1066,11 @@ def cullhy(self): x = 24.0e0 / (nplacc * np.sqrt(tlocal)) - term01 = 6.1e0 / (nplacc * nplacc * (physics_variables.zeff + 5.0e0)) + term01 = 6.1e0 / ( + nplacc + * nplacc + * (physics_variables.n_charge_plasma_effective_vol_avg + 5.0e0) + ) term02 = 1.0e0 + (tlocal / 25.0e0) ** 1.16e0 term03 = epslh**0.77e0 * np.sqrt(12.25e0 + x * x) term04 = 3.5e0 * epslh**0.77e0 + x @@ -1351,7 +1355,7 @@ def cudriv(self) -> None: * current_drive_variables.feffcd, 2: lambda: self.ion_cyclotron.ion_cyclotron_ipdg89( temp_plasma_electron_density_weighted_kev=physics_variables.temp_plasma_electron_density_weighted_kev, - zeff=physics_variables.zeff, + zeff=physics_variables.n_charge_plasma_effective_vol_avg, rmajor=physics_variables.rmajor, dene20=dene20, ) @@ -1368,7 +1372,7 @@ def cudriv(self) -> None: beta=physics_variables.beta_total_vol_avg, rmajor=physics_variables.rmajor, dene20=dene20, - zeff=physics_variables.zeff, + zeff=physics_variables.n_charge_plasma_effective_vol_avg, ) * current_drive_variables.feffcd, 5: lambda: ( @@ -1393,7 +1397,7 @@ def cudriv(self) -> None: * current_drive_variables.feffcd, 13: lambda: self.electron_cyclotron.electron_cyclotron_freethy( te=physics_variables.temp_plasma_electron_vol_avg_kev, - zeff=physics_variables.zeff, + zeff=physics_variables.n_charge_plasma_effective_vol_avg, rmajor=physics_variables.rmajor, nd_plasma_electrons_vol_avg=physics_variables.nd_plasma_electrons_vol_avg, b_plasma_toroidal_on_axis=physics_variables.b_plasma_toroidal_on_axis, diff --git a/process/data_structure/constraint_variables.py b/process/data_structure/constraint_variables.py index 38f250553b..267c86c9ad 100644 --- a/process/data_structure/constraint_variables.py +++ b/process/data_structure/constraint_variables.py @@ -282,7 +282,7 @@ fzeff_max: float = None -"""f-value for maximum zeff (`constraint equation 64`, `iteration variable 112`)""" +"""f-value for maximum n_charge_plasma_effective_vol_avg (`constraint equation 64`, `iteration variable 112`)""" eta_cd_norm_hcd_primary_max: float = None diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index 11eb59bc97..f4b1898728 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -1307,8 +1307,8 @@ """plasma poloidal cross-sectional area [m^2]""" -zeff: float = None -"""plasma effective charge""" +n_charge_plasma_effective_vol_avg: float = None +"""Volume averaged plasma effective charge""" n_charge_plasma_effective_profile: list[float] = None """Profile of plasma effective charge""" @@ -1631,7 +1631,7 @@ def init_physics_variables(): global pflux_fw_neutron_mw global wtgpd global a_plasma_poloidal - global zeff + global n_charge_plasma_effective_vol_avg global n_charge_plasma_effective_profile global zeffai @@ -1890,6 +1890,6 @@ def init_physics_variables(): pflux_fw_neutron_mw = 0.0 wtgpd = 0.0 a_plasma_poloidal = 0.0 - zeff = 0.0 + n_charge_plasma_effective_vol_avg = 0.0 n_charge_plasma_effective_profile = [] zeffai = 0.0 diff --git a/process/io/mfile_comparison.py b/process/io/mfile_comparison.py index 4da104fadd..43e660a05f 100644 --- a/process/io/mfile_comparison.py +++ b/process/io/mfile_comparison.py @@ -128,7 +128,7 @@ "nd_plasma_separatrix_electron", "temp_plasma_pedestal_kev", "nd_plasma_pedestal_electron", - "zeff", + "n_charge_plasma_effective_vol_avg", "nd_plasma_impurities_vol_avg", "t_energy_confinement", "hfact", diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 05dba96eff..ecf75d3195 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -2928,7 +2928,7 @@ def plot_main_plasma_information( f" $\\mathbf{{Ion \\ to \\ electron}}$\n" f" $\\mathbf{{relative \\ number}}$\n" f" $\\mathbf{{densities:}}$\n \n" - f" Effective charge: {mfile_data.data['zeff'].get_scan(scan):.3f}\n\n" + f" Effective charge: {mfile_data.data['n_charge_plasma_effective_vol_avg'].get_scan(scan):.3f}\n\n" f" H: {mfile_data.data['f_nd_impurity_electrons(01)'].get_scan(scan):.4e}\n" f" He: {mfile_data.data['f_nd_impurity_electrons(02)'].get_scan(scan):.4e}\n" f" Be: {mfile_data.data['f_nd_impurity_electrons(03)'].get_scan(scan):.4e}\n" @@ -7498,7 +7498,7 @@ def plot_physics_info(axis, mfile_data, scan): (nong, r"$\langle n_{\mathrm{e,line}} \rangle \ / \ n_G$", ""), (tepeak, r"$T_{e0} \ / \ \langle T_e \rangle$", ""), (nepeak, r"$n_{e0} \ / \ \langle n_{\mathrm{e, vol}} \rangle$", ""), - ("zeff", r"$Z_{\mathrm{eff}}$", ""), + ("n_charge_plasma_effective_vol_avg", r"$Z_{\mathrm{eff}}$", ""), ( nd_plasma_impurities_vol_avg, r"$n_Z \ / \ \langle n_{\mathrm{e, vol}} \rangle$", @@ -12331,7 +12331,9 @@ def plot_plasma_effective_charge_profile(axis, mfile_data, scan): mfile_data.data["n_plasma_profile_elements"].get_scan(scan) ) - zeff = mfile_data.data["zeff"].get_scan(scan) + n_charge_plasma_effective_vol_avg = mfile_data.data[ + "n_charge_plasma_effective_vol_avg" + ].get_scan(scan) n_charge_plasma_effective_profile = [ mfile_data.data[f"n_charge_plasma_effective_profile{i}"].get_scan(scan) @@ -12344,12 +12346,12 @@ def plot_plasma_effective_charge_profile(axis, mfile_data, scan): ) axis.hlines( - zeff, + n_charge_plasma_effective_vol_avg, xmin=0, xmax=1, colors="red", linestyles="--", - label=f"Volume-Averaged $Z_{{\\text{{eff}}}}$ = {zeff:.2f}", + label=f"Volume-Averaged $Z_{{\\text{{eff}}}}$ = {n_charge_plasma_effective_vol_avg:.2f}", ) axis.set_xlabel(r"$\rho \quad [r/a]$") diff --git a/process/io/variable_metadata.py b/process/io/variable_metadata.py index 568479c9e2..58bcb3a061 100644 --- a/process/io/variable_metadata.py +++ b/process/io/variable_metadata.py @@ -267,7 +267,7 @@ class VariableMetadata: description="Blanket cycles", units="", ), - "zeff": VariableMetadata( + "n_charge_plasma_effective_vol_avg": VariableMetadata( latex=r"$Z_{\mathrm{eff}}$", description="Effective charge", units="" ), "t_plant_pulse_burn": VariableMetadata( diff --git a/process/output.py b/process/output.py index 527fc678dc..5cd8422f73 100644 --- a/process/output.py +++ b/process/output.py @@ -41,6 +41,7 @@ def write(models, _outfile): models.availability.run(output=True) # Writing the output from physics.f90 into OUT.DAT + MFILE.DAT + models.physics.calculate_effective_charge_ionisation_profiles() models.physics.outplas() # TODO what is this? Not in caller.f90? diff --git a/process/physics.py b/process/physics.py index 54ec32b3af..9d9ed60dd5 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2027,7 +2027,7 @@ def physics(self): physics_variables.rmajor, physics_variables.rminor, physics_variables.temp_plasma_electron_vol_avg_kev, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) ) @@ -2110,7 +2110,7 @@ def physics(self): pressure_index=physics_variables.alphap, temperature_index=physics_variables.alphat, inverse_aspect=physics_variables.eps, - effective_charge=physics_variables.zeff, + effective_charge=physics_variables.n_charge_plasma_effective_vol_avg, q95=physics_variables.q95, q0=physics_variables.q0, ) @@ -2123,7 +2123,7 @@ def physics(self): pressure_index=physics_variables.alphap, temperature_index=physics_variables.alphat, inverse_aspect=physics_variables.eps, - effective_charge=physics_variables.zeff, + effective_charge=physics_variables.n_charge_plasma_effective_vol_avg, ) ) current_drive_variables.f_c_plasma_bootstrap_sugiyama_l = ( @@ -2133,7 +2133,7 @@ def physics(self): beta_poloidal=physics_variables.beta_poloidal_vol_avg, alphan=physics_variables.alphan, alphat=physics_variables.alphat, - zeff=physics_variables.zeff, + zeff=physics_variables.n_charge_plasma_effective_vol_avg, q95=physics_variables.q95, q0=physics_variables.q0, ) @@ -2146,7 +2146,7 @@ def physics(self): alphan=physics_variables.alphan, alphat=physics_variables.alphat, tbeta=physics_variables.tbeta, - zeff=physics_variables.zeff, + zeff=physics_variables.n_charge_plasma_effective_vol_avg, q95=physics_variables.q95, q0=physics_variables.q0, radius_plasma_pedestal_density_norm=physics_variables.radius_plasma_pedestal_density_norm, @@ -2448,7 +2448,7 @@ def physics(self): physics_variables.rminor, physics_variables.temp_plasma_electron_density_weighted_kev, physics_variables.vol_plasma, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) # Calculate L- to H-mode power threshold for different scalings @@ -2539,7 +2539,7 @@ def physics(self): physics_variables.rmajor, physics_variables.rminor, physics_variables.a_plasma_surface, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) # Calculate transport losses and energy confinement time using the @@ -2576,7 +2576,7 @@ def physics(self): physics_variables.q95, physics_variables.qstar, physics_variables.vol_plasma, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) # Total transport power from scaling law (MW) @@ -3444,9 +3444,9 @@ def plasma_composition() -> None: # Effective charge # Calculation should be sum(ni.Zi^2) / sum(ni.Zi), # but ne = sum(ni.Zi) through quasineutrality - physics_variables.zeff = 0.0 + physics_variables.n_charge_plasma_effective_vol_avg = 0.0 for imp in range(impurity_radiation_module.N_IMPURITIES): - physics_variables.zeff += ( + physics_variables.n_charge_plasma_effective_vol_avg += ( impurity_radiation_module.f_nd_impurity_electron_array[imp] * impurity_radiation.zav_of_te( imp, np.array([physics_variables.temp_plasma_electron_vol_avg_kev]) @@ -4025,13 +4025,8 @@ def outtim(self): "OP ", ) - def outplas(self): - """Subroutine to output the plasma physics information - author: P J Knight, CCFE, Culham Science Centre - self.outfile : input integer : Fortran output unit identifier - This routine writes the plasma physics information - to a file, in a tidy format. - """ + def calculate_effective_charge_ionisation_profiles(self): + """Calculate the effective charge profiles for ionisation calculations.""" # Calculate the effective charge (zeff) profile across the plasma # Returns an array of zeff at each radial point @@ -4061,7 +4056,13 @@ def outplas(self): ).squeeze() impurity_radiation_module.n_charge_impurity_profile = charge_profiles - print(impurity_radiation_module.n_charge_impurity_profile) + def outplas(self): + """Subroutine to output the plasma physics information + author: P J Knight, CCFE, Culham Science Centre + self.outfile : input integer : Fortran output unit identifier + This routine writes the plasma physics information + to a file, in a tidy format. + """ # ############################################### # Dimensionless plasma parameters. See reference below. @@ -5045,7 +5046,11 @@ def outplas(self): po.oblnkl(self.outfile) po.ovarrf( - self.outfile, "Effective charge", "(zeff)", physics_variables.zeff, "OP " + self.outfile, + "Volume averaged plasma effective charge", + "(n_charge_plasma_effective_vol_avg)", + physics_variables.n_charge_plasma_effective_vol_avg, + "OP ", ) for i in range(len(physics_variables.n_charge_plasma_effective_profile)): po.ovarre( @@ -6878,7 +6883,7 @@ def output_confinement_comparison(self, istell: int) -> None: physics_variables.q95, physics_variables.qstar, physics_variables.vol_plasma, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) try: @@ -7197,7 +7202,7 @@ def bootstrap_fraction_sauter(plasma_profile: float) -> float: # Flat Zeff profile assumed # Return tempi like array object filled with zeff - zeff = np.full_like(tempi, physics_variables.zeff) + zeff = np.full_like(tempi, physics_variables.n_charge_plasma_effective_vol_avg) # inverse_q = 1/safety factor # Parabolic q profile assumed @@ -7813,7 +7818,7 @@ def fhz(hfact: float) -> float: physics_variables.q95, physics_variables.qstar, physics_variables.vol_plasma, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) # At power balance, fhz is zero. diff --git a/process/stellarator.py b/process/stellarator.py index 448eceded1..b4657e1afa 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4624,7 +4624,7 @@ def stphys(self, output): stellarator_variables.iotabar, physics_variables.qstar, physics_variables.vol_plasma, - physics_variables.zeff, + physics_variables.n_charge_plasma_effective_vol_avg, ) physics_variables.p_electron_transport_loss_mw = ( diff --git a/tests/integration/data/large_tokamak_1_MFILE.DAT b/tests/integration/data/large_tokamak_1_MFILE.DAT index 09034b780b..28ab3241ef 100644 --- a/tests/integration/data/large_tokamak_1_MFILE.DAT +++ b/tests/integration/data/large_tokamak_1_MFILE.DAT @@ -393,7 +393,7 @@ Xe_concentration________________________________________________________ (f_nd_impurity_electrons(13))____________________ 5.7149E-04 ITV W__concentration________________________________________________________ (f_nd_impurity_electrons(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7252E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5164E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5164E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 diff --git a/tests/integration/data/large_tokamak_2_MFILE.DAT b/tests/integration/data/large_tokamak_2_MFILE.DAT index bb79b1d629..4d861cfdee 100644 --- a/tests/integration/data/large_tokamak_2_MFILE.DAT +++ b/tests/integration/data/large_tokamak_2_MFILE.DAT @@ -394,7 +394,7 @@ Xe_concentration________________________________________________________ (f_nd_impurity_electrons(13))____________________ 5.7149E-04 ITV W__concentration________________________________________________________ (f_nd_impurity_electrons(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7252E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5164E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5164E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 diff --git a/tests/integration/data/large_tokamak_3_MFILE.DAT b/tests/integration/data/large_tokamak_3_MFILE.DAT index fec8b7cda6..1776ecc3b5 100644 --- a/tests/integration/data/large_tokamak_3_MFILE.DAT +++ b/tests/integration/data/large_tokamak_3_MFILE.DAT @@ -394,7 +394,7 @@ Xe_concentration________________________________________________________ (f_nd_impurity_electrons(13))____________________ 5.7149E-04 ITV W__concentration________________________________________________________ (f_nd_impurity_electrons(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7252E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5164E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5164E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 diff --git a/tests/integration/data/large_tokamak_4_MFILE.DAT b/tests/integration/data/large_tokamak_4_MFILE.DAT index 4886ac92c6..21ae93198b 100644 --- a/tests/integration/data/large_tokamak_4_MFILE.DAT +++ b/tests/integration/data/large_tokamak_4_MFILE.DAT @@ -394,7 +394,7 @@ Xe_concentration________________________________________________________ (f_nd_impurity_electrons(13))____________________ 5.7149E-04 ITV W__concentration________________________________________________________ (f_nd_impurity_electrons(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7252E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5164E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5164E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 diff --git a/tests/integration/data/large_tokamak_MFILE.DAT b/tests/integration/data/large_tokamak_MFILE.DAT index d328799cb5..0b8a55f80e 100644 --- a/tests/integration/data/large_tokamak_MFILE.DAT +++ b/tests/integration/data/large_tokamak_MFILE.DAT @@ -4510,7 +4510,7 @@ Average_mass_of_all_beam_ions_(amu)______________________________________ (m_bea Total_mass_of_all_alpha_particles_in_plasma_(kg)_________________________ (m_plasma_alpha)_______________ 8.32037190725057996e-05 OP Total_mass_of_all_electrons_in_plasma_(kg)_______________________________ (m_plasma_electron)____________ 1.48245625562320404e-07 OP Total_mass_of_the_plasma_(kg)____________________________________________ (m_plasma)_____________________ 6.59987636086803572e-04 OP -Effective_charge_________________________________________________________ (zeff)_________________________ 2.74033381777047635e+00 OP +Effective_charge_________________________________________________________ (n_charge_plasma_effective_vol_avg)_________________________ 2.74033381777047635e+00 OP Mass-weighted_Effective_charge___________________________________________ (zeffai)_______________________ 4.25922140400304239e-01 OP Density_profile_factor___________________________________________________ (alphan)_______________________ 1.00000000000000000e+00 Plasma_profile_model_____________________________________________________ (i_plasma_pedestal)____________ 1 diff --git a/tests/integration/data/ref_IN.DAT b/tests/integration/data/ref_IN.DAT index 01ddeac9c3..61e945e10c 100644 --- a/tests/integration/data/ref_IN.DAT +++ b/tests/integration/data/ref_IN.DAT @@ -174,7 +174,7 @@ p_hcd_primary_extra_heat_mw = 50.0 *----------------Divertor Variables----------------* -divdum = 1 * Switch for divertor zeff model; 0=calc; 1=input +divdum = 1 * Switch for divertor n_charge_plasma_effective_vol_avg model; 0=calc; 1=input dz_divertor = 0.621 * Divertor structure vertical thickness (m) pflux_div_heat_load_max_mw = 10 * Heat load limit (mw/m2) ksic = 1.4 * Power fraction for outboard double-null scrape-off plasma diff --git a/tests/integration/data/scan_2D_MFILE.DAT b/tests/integration/data/scan_2D_MFILE.DAT index 23d78ce0c5..80c322f217 100644 --- a/tests/integration/data/scan_2D_MFILE.DAT +++ b/tests/integration/data/scan_2D_MFILE.DAT @@ -395,7 +395,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.5660E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7049E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.4502E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.4502E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -1558,7 +1558,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.6035E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7047E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.4581E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.4581E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -2721,7 +2721,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.6875E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7061E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.4776E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.4776E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -3884,7 +3884,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.7385E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7081E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.4941E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.4941E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -5047,7 +5047,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.6877E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7066E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.4817E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.4817E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -6210,7 +6210,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.6468E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7048E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.4709E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.4709E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -7373,7 +7373,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.7087E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7069E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.4899E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.4899E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -8536,7 +8536,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.7717E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7078E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5045E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5045E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -9699,7 +9699,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.8195E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7085E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5155E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5155E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -10862,7 +10862,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.8813E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7109E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5350E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5350E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -12025,7 +12025,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.8551E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7108E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5291E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5291E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -13188,7 +13188,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.8022E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7097E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5166E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5166E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -14351,7 +14351,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.8614E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7121E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5348E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5348E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -15514,7 +15514,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.9111E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7135E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5471E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5471E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -16677,7 +16677,7 @@ Xe_concentration________________________________________________________ (fimp(13))____________________ 5.9603E-04 W__concentration________________________________________________________ (fimp(14))____________________ 5.0000E-06 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.7149E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.5593E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.5593E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 diff --git a/tests/integration/data/scan_MFILE.DAT b/tests/integration/data/scan_MFILE.DAT index 19a74809ff..8cf8c2ac36 100644 --- a/tests/integration/data/scan_MFILE.DAT +++ b/tests/integration/data/scan_MFILE.DAT @@ -249,7 +249,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -1244,7 +1244,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -2239,7 +2239,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -3234,7 +3234,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -4229,7 +4229,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -5224,7 +5224,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -6219,7 +6219,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -7214,7 +7214,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -8209,7 +8209,7 @@ Xe_concentration________________________________________________________ (fimp(13)_____________________ 3.5634E-04 W__concentration________________________________________________________ (fimp(14)_____________________ 5.0000E-05 Average_mass_of_all_ions_(amu)__________________________________________ (m_ions_total_amu)________________________ 2.6725E+00 OP - Effective_charge________________________________________________________ (zeff)________________________ 2.1247E+00 + Effective_charge________________________________________________________ (n_charge_plasma_effective_vol_avg)________________________ 2.1247E+00 Density_profile_factor__________________________________________________ (alphan)______________________ 1.0000E+00 Plasma_profile_model____________________________________________________ (i_plasma_pedestal)___________________ 1 Density_pedestal_r/a_location___________________________________________ (radius_plasma_pedestal_density_norm)_____________________ 9.4000E-01 @@ -9153,7 +9153,7 @@ p_hcd_primary_extra_heat_mw = 50.0 *----------------Divertor Variables----------------* -divdum = 1 * Switch for divertor zeff model; 0=calc; 1=input +divdum = 1 * Switch for divertor n_charge_plasma_effective_vol_avg model; 0=calc; 1=input dz_divertor = 0.621 * Divertor structure vertical thickness (m) pflux_div_heat_load_max_mw = 10 * Heat load limit (mw/m2) ksic = 1.4 * Power fraction for outboard double-null scrape-off plasma diff --git a/tests/unit/data/large_tokamak_MFILE.DAT b/tests/unit/data/large_tokamak_MFILE.DAT index 725020d517..bcee184a15 100644 --- a/tests/unit/data/large_tokamak_MFILE.DAT +++ b/tests/unit/data/large_tokamak_MFILE.DAT @@ -4510,7 +4510,7 @@ Average_mass_of_all_beam_ions_(amu)______________________________________ (m_bea Total_mass_of_all_alpha_particles_in_plasma_(kg)_________________________ (m_plasma_alpha)_______________ 7.96020255585685413e-05 OP Total_mass_of_all_electrons_in_plasma_(kg)_______________________________ (m_plasma_electron)____________ 1.37896263555503643e-07 OP Total_mass_of_the_plasma_(kg)____________________________________________ (m_plasma)_____________________ 6.13052659479275766e-04 OP -Effective_charge_________________________________________________________ (zeff)_________________________ 2.59190490771351412e+00 OP +Effective_charge_________________________________________________________ (n_charge_plasma_effective_vol_avg)_________________________ 2.59190490771351412e+00 OP Mass-weighted_Effective_charge___________________________________________ (zeffai)_______________________ 4.26523606426518598e-01 OP Density_profile_factor___________________________________________________ (alphan)_______________________ 1.00000000000000000e+00 Plasma_profile_model_____________________________________________________ (i_plasma_pedestal)____________ 1 diff --git a/tests/unit/test_current_drive.py b/tests/unit/test_current_drive.py index f18e27ed82..907c21f8ac 100644 --- a/tests/unit/test_current_drive.py +++ b/tests/unit/test_current_drive.py @@ -149,7 +149,7 @@ def test_cudriv_primary_neutral_beam(current_drive): current_drive_variables.eta_beam_injector_wall_plug = 0.3 physics_variables.m_beam_amu = 2.0 physics_variables.temp_plasma_electron_density_weighted_kev = 10.0 - physics_variables.zeff = 2.0 + physics_variables.n_charge_plasma_effective_vol_avg = 2.0 current_drive.cudriv() assert current_drive_variables.eta_cd_hcd_primary == pytest.approx( @@ -241,7 +241,7 @@ def test_cudriv_primary_ion_cyclotron(current_drive): physics_variables.plasma_current = 15e6 physics_variables.f_c_plasma_auxiliary = 0.2 current_drive_variables.eta_icrh_injector_wall_plug = 0.35 - physics_variables.zeff = 2.0 + physics_variables.n_charge_plasma_effective_vol_avg = 2.0 physics_variables.temp_plasma_electron_density_weighted_kev = 10.0 current_drive.cudriv() diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 407387851c..632ecaf7cb 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -463,7 +463,11 @@ def test_bootstrap_fraction_sauter(bootstrapfractionsauterparam, monkeypatch, ph physics_variables, "m_fuel_amu", bootstrapfractionsauterparam.m_fuel_amu ) - monkeypatch.setattr(physics_variables, "zeff", bootstrapfractionsauterparam.zeff) + monkeypatch.setattr( + physics_variables, + "n_charge_plasma_effective_vol_avg", + bootstrapfractionsauterparam.zeff, + ) monkeypatch.setattr( physics_variables, @@ -1834,7 +1838,11 @@ def test_plasma_composition(plasmacompositionparam, monkeypatch, physics): plasmacompositionparam.f_nd_beam_electron, ) - monkeypatch.setattr(physics_variables, "zeff", plasmacompositionparam.zeff) + monkeypatch.setattr( + physics_variables, + "n_charge_plasma_effective_vol_avg", + plasmacompositionparam.zeff, + ) monkeypatch.setattr( physics_variables, @@ -1972,7 +1980,9 @@ def test_plasma_composition(plasmacompositionparam, monkeypatch, physics): plasmacompositionparam.expected_f_alpha_ion ) - assert physics_variables.zeff == pytest.approx(plasmacompositionparam.expected_zeff) + assert physics_variables.n_charge_plasma_effective_vol_avg == pytest.approx( + plasmacompositionparam.expected_zeff + ) assert physics_variables.nd_plasma_impurities_vol_avg == pytest.approx( plasmacompositionparam.expected_nd_impurities diff --git a/tracking/tracking_data.py b/tracking/tracking_data.py index 8279d0c59c..61817d72a7 100644 --- a/tracking/tracking_data.py +++ b/tracking/tracking_data.py @@ -97,7 +97,7 @@ "Physics.temp_plasma_electron_vol_avg_kev", "Physics.beta_total_vol_avg", "Physics.f_c_plasma_inductive", - "Physics.zeff", + "Physics.n_charge_plasma_effective_vol_avg", "Physics.b_plasma_toroidal_on_axis", "Physics.hfact", "Physics.kappa", From 4c10ad91c2ed7301271fc723debf3789cdda9bcb Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 7 Nov 2025 13:29:20 +0000 Subject: [PATCH 10/12] Fix charge profile data type for impurities to a 1D list for consistency --- process/data_structure/impurity_radiation_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/data_structure/impurity_radiation_module.py b/process/data_structure/impurity_radiation_module.py index 250e65d1a6..b54522e300 100644 --- a/process/data_structure/impurity_radiation_module.py +++ b/process/data_structure/impurity_radiation_module.py @@ -27,7 +27,7 @@ f_nd_impurity_electrons: list[float] = None -n_charge_impurity_profile: list[list[float]] = None +n_charge_impurity_profile: list[float] = None """charge profile of impurities""" imp_label: list[str] = None From 951a65cff40787f18b274921675ba424f28d45ca Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 7 Nov 2025 13:41:40 +0000 Subject: [PATCH 11/12] =?UTF-8?q?=F0=9F=94=84=20-=20Refactor=20variable=20?= =?UTF-8?q?names=20for=20mass-weighted=20plasma=20effective=20charge=20to?= =?UTF-8?q?=20improve=20consistency=20across=20the=20codebase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/current_drive.py | 20 ++++++++++++----- process/data_structure/physics_variables.py | 8 +++---- process/fusion_reactions.py | 6 +++--- process/physics.py | 24 +++++++++++++-------- process/stellarator.py | 4 ++-- tests/unit/data/large_tokamak_MFILE.DAT | 2 +- tests/unit/test_physics.py | 17 +++++++++------ 7 files changed, 51 insertions(+), 30 deletions(-) diff --git a/process/current_drive.py b/process/current_drive.py index 25dc39b4da..6121164a81 100644 --- a/process/current_drive.py +++ b/process/current_drive.py @@ -88,7 +88,7 @@ def iternb(self): physics_variables.nd_plasma_electrons_vol_avg, dend, dent, - physics_variables.zeffai, + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg, physics_variables.dlamie, ) @@ -179,7 +179,7 @@ def culnbi(self): physics_variables.nd_plasma_electrons_vol_avg, dend, dent, - physics_variables.zeffai, + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg, physics_variables.dlamie, ) @@ -491,7 +491,17 @@ def sigbeam(self, eb, te, ne, rnhe, rnc, rno, rnfe): return max(1e-20 * (np.exp(s1) / eb * (1.0 + sz)), 1e-23) - def cfnbi(self, afast, efast, te, ne, _nd, _nt, zeffai, xlmbda): + def cfnbi( + self, + afast, + efast, + te, + ne, + _nd, + _nt, + n_charge_plasma_effective_mass_weighted_vol_avg, + xlmbda, + ): """Routine to calculate the fraction of the fast particle energy coupled to the ions author: P J Knight, CCFE, Culham Science Centre @@ -501,7 +511,7 @@ def cfnbi(self, afast, efast, te, ne, _nd, _nt, zeffai, xlmbda): ne : input real : volume averaged electron density (m**-3) nd : input real : deuterium beam density (m**-3) nt : input real : tritium beam density (m**-3) - zeffai : input real : mass weighted plasma effective charge + n_charge_plasma_effective_mass_weighted_vol_avg : input real : mass weighted plasma effective charge xlmbda : input real : ion-electron coulomb logarithm f_p_beam_injected_ions : output real : fraction of fast particle energy coupled to ions This routine calculates the fast particle energy coupled to @@ -522,7 +532,7 @@ def cfnbi(self, afast, efast, te, ne, _nd, _nt, zeffai, xlmbda): # ecritfix = 16.0e0 * te * afast * (sum / (ne * xlmbda)) ** (2.0e0 / 3.0e0) xlmbdai = self.xlmbdabi(afast, atmdt, efast, te, ne) - sumln = zeffai * xlmbdai / xlmbda + sumln = n_charge_plasma_effective_mass_weighted_vol_avg * xlmbdai / xlmbda xlnrat = ( 3.0e0 * np.sqrt(np.pi) / 4.0e0 * me / constants.PROTON_MASS * sumln ) ** (2.0e0 / 3.0e0) diff --git a/process/data_structure/physics_variables.py b/process/data_structure/physics_variables.py index f4b1898728..49f5d21484 100644 --- a/process/data_structure/physics_variables.py +++ b/process/data_structure/physics_variables.py @@ -1314,8 +1314,8 @@ """Profile of plasma effective charge""" -zeffai: float = None -"""mass weighted plasma effective charge""" +n_charge_plasma_effective_mass_weighted_vol_avg: float = None +"""Plasma mass-weighted volume averaged plasma effective charge""" def init_physics_module(): @@ -1633,7 +1633,7 @@ def init_physics_variables(): global a_plasma_poloidal global n_charge_plasma_effective_vol_avg global n_charge_plasma_effective_profile - global zeffai + global n_charge_plasma_effective_mass_weighted_vol_avg m_beam_amu = 0.0 m_fuel_amu = 0.0 @@ -1892,4 +1892,4 @@ def init_physics_variables(): a_plasma_poloidal = 0.0 n_charge_plasma_effective_vol_avg = 0.0 n_charge_plasma_effective_profile = [] - zeffai = 0.0 + n_charge_plasma_effective_mass_weighted_vol_avg = 0.0 diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 83e378ad49..08150f322f 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -916,7 +916,7 @@ def beam_fusion( temp_plasma_electron_density_weighted_kev: float, temp_plasma_ion_density_weighted_kev: float, vol_plasma: float, - zeffai: float, + n_charge_plasma_effective_mass_weighted_vol_avg: float, ) -> tuple: """ Routine to calculate beam slowing down properties. @@ -941,7 +941,7 @@ def beam_fusion( temp_plasma_electron_density_weighted_kev (float): Density-weighted electron temperature (keV). temp_plasma_ion_density_weighted_kev (float): Density-weighted ion temperature (keV). vol_plasma (float): Plasma volume (m^3). - zeffai (float): Mass weighted plasma effective charge. + n_charge_plasma_effective_mass_weighted_vol_avg (float): Mass weighted plasma effective charge. Returns: tuple: A tuple containing the following elements: @@ -987,7 +987,7 @@ def beam_fusion( 14.8 * constants.M_DEUTERON_AMU * temp_plasma_electron_density_weighted_kev - * zeffai ** (2 / 3) + * n_charge_plasma_effective_mass_weighted_vol_avg ** (2 / 3) * (ion_electron_coulomb_log + 4.0) / ion_electron_coulomb_log ) diff --git a/process/physics.py b/process/physics.py index 9d9ed60dd5..d983159135 100644 --- a/process/physics.py +++ b/process/physics.py @@ -41,7 +41,7 @@ def rether( dlamie, te, temp_plasma_ion_vol_avg_kev, - zeffai, + n_charge_plasma_effective_mass_weighted_vol_avg, ): """Routine to find the equilibration power between the ions and electrons @@ -52,7 +52,7 @@ def rether( dlamie : input real : ion-electron coulomb logarithm te : input real : electron temperature (keV) temp_plasma_ion_vol_avg_kev : input real : ion temperature (keV) - zeffai : input real : mass weighted plasma effective charge + n_charge_plasma_effective_mass_weighted_vol_avg : input real : mass weighted plasma effective charge pden_ion_electron_equilibration_mw : output real : ion/electron equilibration power (MW/m3) This routine calculates the equilibration power between the ions and electrons. @@ -61,7 +61,13 @@ def rether( profie = (1.0 + alphan) ** 2 / ( (2.0 * alphan - 0.5 * alphat + 1.0) * np.sqrt(1.0 + alphat) ) - conie = 2.42165e-41 * dlamie * nd_plasma_electrons_vol_avg**2 * zeffai * profie + conie = ( + 2.42165e-41 + * dlamie + * nd_plasma_electrons_vol_avg**2 + * n_charge_plasma_effective_mass_weighted_vol_avg + * profie + ) return conie * (temp_plasma_ion_vol_avg_kev - te) / (te**1.5) @@ -2281,7 +2287,7 @@ def physics(self): physics_variables.temp_plasma_electron_density_weighted_kev, physics_variables.temp_plasma_ion_density_weighted_kev, physics_variables.vol_plasma, - physics_variables.zeffai, + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg, ) physics_variables.fusden_total = ( physics_variables.fusden_plasma @@ -2396,7 +2402,7 @@ def physics(self): physics_variables.dlamie, physics_variables.temp_plasma_electron_vol_avg_kev, physics_variables.temp_plasma_ion_vol_avg_kev, - physics_variables.zeffai, + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg, ) # Calculate radiation power @@ -3525,7 +3531,7 @@ def plasma_composition() -> None: # Mass weighted plasma effective charge # Sum of (Zi^2*n_i) / m_i - physics_variables.zeffai = ( + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg = ( ( physics_variables.f_plasma_fuel_deuterium * physics_variables.nd_plasma_fuel_ions_vol_avg @@ -3557,7 +3563,7 @@ def plasma_composition() -> None: ) / physics_variables.nd_plasma_electrons_vol_avg for imp in range(impurity_radiation_module.N_IMPURITIES): if impurity_radiation_module.impurity_arr_z[imp] > 2: - physics_variables.zeffai += ( + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg += ( impurity_radiation_module.f_nd_impurity_electron_array[imp] * impurity_radiation.zav_of_te( imp, @@ -5074,8 +5080,8 @@ def outplas(self): po.ovarrf( self.outfile, "Mass-weighted Effective charge", - "(zeffai)", - physics_variables.zeffai, + "(n_charge_plasma_effective_mass_weighted_vol_avg)", + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg, "OP ", ) diff --git a/process/stellarator.py b/process/stellarator.py index b4657e1afa..7a34345e50 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4357,7 +4357,7 @@ def stphys(self, output): physics_variables.temp_plasma_electron_density_weighted_kev, physics_variables.temp_plasma_ion_density_weighted_kev, physics_variables.vol_plasma, - physics_variables.zeffai, + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg, ) physics_variables.fusden_total = ( physics_variables.fusden_plasma @@ -4455,7 +4455,7 @@ def stphys(self, output): physics_variables.dlamie, physics_variables.temp_plasma_electron_vol_avg_kev, physics_variables.temp_plasma_ion_vol_avg_kev, - physics_variables.zeffai, + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg, ) # Calculate radiation power diff --git a/tests/unit/data/large_tokamak_MFILE.DAT b/tests/unit/data/large_tokamak_MFILE.DAT index bcee184a15..b1a28d2197 100644 --- a/tests/unit/data/large_tokamak_MFILE.DAT +++ b/tests/unit/data/large_tokamak_MFILE.DAT @@ -4511,7 +4511,7 @@ Total_mass_of_all_alpha_particles_in_plasma_(kg)_________________________ (m_pla Total_mass_of_all_electrons_in_plasma_(kg)_______________________________ (m_plasma_electron)____________ 1.37896263555503643e-07 OP Total_mass_of_the_plasma_(kg)____________________________________________ (m_plasma)_____________________ 6.13052659479275766e-04 OP Effective_charge_________________________________________________________ (n_charge_plasma_effective_vol_avg)_________________________ 2.59190490771351412e+00 OP -Mass-weighted_Effective_charge___________________________________________ (zeffai)_______________________ 4.26523606426518598e-01 OP +Mass-weighted_Effective_charge___________________________________________ (n_charge_plasma_effective_mass_weighted_vol_avg)_______________________ 4.26523606426518598e-01 OP Density_profile_factor___________________________________________________ (alphan)_______________________ 1.00000000000000000e+00 Plasma_profile_model_____________________________________________________ (i_plasma_pedestal)____________ 1 Density_pedestal_r/a_location____________________________________________ (radius_plasma_pedestal_density_norm)_ 9.39999999999999947e-01 diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 632ecaf7cb..270032a9da 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -1382,7 +1382,7 @@ class PlasmaCompositionParam(NamedTuple): f_nd_protium_electrons: Any = None - zeffai: Any = None + n_charge_plasma_effective_mass_weighted_vol_avg: Any = None f_nd_plasma_carbon_electron: Any = None @@ -1543,7 +1543,7 @@ class PlasmaCompositionParam(NamedTuple): m_ions_total_amu=0, nd_plasma_ions_total_vol_avg=0, f_nd_protium_electrons=0, - zeffai=0, + n_charge_plasma_effective_mass_weighted_vol_avg=0, f_nd_plasma_carbon_electron=0, f_nd_plasma_oxygen_electron=0, f_alpha_ion=0, @@ -1661,7 +1661,7 @@ class PlasmaCompositionParam(NamedTuple): m_ions_total_amu=2.7395439636787726, nd_plasma_ions_total_vol_avg=6.6125550702454276e19, f_nd_protium_electrons=0, - zeffai=0.43046641789338563, + n_charge_plasma_effective_mass_weighted_vol_avg=0.43046641789338563, f_nd_plasma_carbon_electron=0, f_nd_plasma_oxygen_electron=0, f_alpha_ion=0.3154069116809366, @@ -1806,7 +1806,11 @@ def test_plasma_composition(plasmacompositionparam, monkeypatch, physics): plasmacompositionparam.f_nd_protium_electrons, ) - monkeypatch.setattr(physics_variables, "zeffai", plasmacompositionparam.zeffai) + monkeypatch.setattr( + physics_variables, + "n_charge_plasma_effective_mass_weighted_vol_avg", + plasmacompositionparam.n_charge_plasma_effective_mass_weighted_vol_avg, + ) monkeypatch.setattr( physics_variables, @@ -1972,8 +1976,9 @@ def test_plasma_composition(plasmacompositionparam, monkeypatch, physics): plasmacompositionparam.expected_nd_ions_total ) - assert physics_variables.zeffai == pytest.approx( - plasmacompositionparam.expected_zeffai + assert ( + physics_variables.n_charge_plasma_effective_mass_weighted_vol_avg + == pytest.approx(plasmacompositionparam.expected_zeffai) ) assert physics_variables.f_alpha_ion == pytest.approx( From 46226eaf300837fbcf9e0412f14ffcba5551cc5d Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 14 Nov 2025 13:50:36 +0000 Subject: [PATCH 12/12] Add effective charge ionization profile calculation to Stellarator run method --- process/stellarator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/process/stellarator.py b/process/stellarator.py index 7a34345e50..f0651583be 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -119,6 +119,7 @@ def run(self, output: bool): self.costs.run() self.costs.output() self.availability.run(output=True) + self.physics.calculate_effective_charge_ionisation_profiles() self.physics.outplas() self.stheat(True) self.stphys(True)