diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index ea914a7ed0..5c565be712 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -61,9 +61,6 @@ vacuum_vessel_geometry_single_null, ) from process.impurity_radiation import read_impurity_file -from process.io.mfile import MFileErrorClass -from process.objectives import OBJECTIVE_NAMES -from process.superconducting_tf_coil import SUPERCONDUCTING_TF_TYPES if os.name == "posix" and "DISPLAY" not in os.environ: mpl.use("Agg") @@ -7203,804 +7200,6 @@ def plot_pf_coils(axis, mfile_data, scan, colour_scheme): ) -def plot_info(axis, data, mfile_data, scan): - """Function to plot data in written form on a matplotlib plot. - - Arguments: - axis --> axis object to plot to - data --> plot information - mfile_data --> MFILE.DAT object - scan --> scan number to use - - """ - eqpos = 0.75 - for i in range(len(data)): - colorflag = "black" - if mfile_data.data[data[i][0]].exists: - if mfile_data.data[data[i][0]].var_flag == "ITV": - colorflag = "red" - elif mfile_data.data[data[i][0]].var_flag == "OP": - colorflag = "blue" - axis.text(0, -i, data[i][1], color=colorflag, ha="left", va="center") - if isinstance(data[i][0], str): - if data[i][0] == "": - axis.text(eqpos, -i, "\n", ha="left", va="center") - elif data[i][0][0] == "#": - axis.text(-0.05, -i, f"{data[i][0][1:]}\n", ha="left", va="center") - elif data[i][0][0] == "!": - value = data[i][0][1:].replace('"', "") - axis.text( - 0.4, - -i, - f"--> {value} {data[i][2]}", - ha="left", - va="center", - ) - else: - if mfile_data.data[data[i][0]].exists: - dat = mfile_data.data[data[i][0]].get_scan(scan) - if isinstance(dat, str): - value = dat - else: - value = f"{mfile_data.data[data[i][0]].get_scan(scan):.4g}" - if "alpha" in data[i][0]: - value = str(float(value) + 1.0) - axis.text( - eqpos, - -i, - f"= {value} {data[i][2]}", - color=colorflag, - ha="left", - va="center", - ) - else: - mfile_data.data[data[i][0]].get_scan(-1) - axis.text( - eqpos, - -i, - "= ERROR! Var missing", - color=colorflag, - ha="left", - va="center", - ) - else: - dat = data[i][0] - value = dat if isinstance(dat, str) else f"{data[i][0]:.4g}" - axis.text( - eqpos, - -i, - f"= {value} {data[i][2]}", - color=colorflag, - ha="left", - va="center", - ) - - -def plot_header(axis, mfile_data, scan): - """Function to plot header info: date, rutitle etc - - Arguments: - axis --> axis object to plot to - mfile_data --> MFILE.DAT object - scan --> scan number to use - - """ - xmin = 0 - xmax = 1 - ymin = -16 - ymax = 1 - - axis.set_ylim([ymin, ymax]) - axis.set_xlim([xmin, xmax]) - axis.set_axis_off() - axis.set_autoscaley_on(False) - axis.set_autoscalex_on(False) - - data2 = [ - (f"!{mfile_data.data['runtitle'].get_scan(-1)}", "Run title", ""), - (f"!{mfile_data.data['procver'].get_scan(-1)}", "PROCESS Version", ""), - (f"!{mfile_data.data['date'].get_scan(-1)}", "Date:", ""), - (f"!{mfile_data.data['time'].get_scan(-1)}", "Time:", ""), - (f"!{mfile_data.data['username'].get_scan(-1)}", "User:", ""), - ("!Evaluation", "Run type", "") - if isinstance(mfile_data.data["minmax"], MFileErrorClass) - else ( - f"!{OBJECTIVE_NAMES[abs(int(mfile_data.data['minmax'].get_scan(-1)))]}", - "Optimising:", - "", - ), - ] - - axis.text(-0.05, 4.0, "Colour Legend:", ha="left", va="center") - axis.text( - 0.0, 3.0, "ITR --> Iteration variable", color="red", ha="left", va="center" - ) - axis.text(0.0, 2.0, "OP --> Output variable", color="blue", ha="left", va="center") - - H = mfile_data.data["f_nd_impurity_electrons(01)"].get_scan(scan) - He = mfile_data.data["f_nd_impurity_electrons(02)"].get_scan(scan) - Be = mfile_data.data["f_nd_impurity_electrons(03)"].get_scan(scan) - C = mfile_data.data["f_nd_impurity_electrons(04)"].get_scan(scan) - N = mfile_data.data["f_nd_impurity_electrons(05)"].get_scan(scan) - O = mfile_data.data["f_nd_impurity_electrons(06)"].get_scan(scan) # noqa: E741 - Ne = mfile_data.data["f_nd_impurity_electrons(07)"].get_scan(scan) - Si = mfile_data.data["f_nd_impurity_electrons(08)"].get_scan(scan) - Ar = mfile_data.data["f_nd_impurity_electrons(09)"].get_scan(scan) - Fe = mfile_data.data["f_nd_impurity_electrons(10)"].get_scan(scan) - Ni = mfile_data.data["f_nd_impurity_electrons(11)"].get_scan(scan) - Kr = mfile_data.data["f_nd_impurity_electrons(12)"].get_scan(scan) - Xe = mfile_data.data["f_nd_impurity_electrons(13)"].get_scan(scan) - W = mfile_data.data["f_nd_impurity_electrons(14)"].get_scan(scan) - - data = [("", "", ""), ("", "", "")] - count = 0 - - data = [*data, (H, "D + T", "")] - count += 1 - - data = [*data, (He, "He", "")] - count += 1 - if Be > 1e-10: - data = [*data, (Be, "Be", "")] - count += +1 - if C > 1e-10: - data = [*data, (C, "C", "")] - count += 1 - if N > 1e-10: - data = [*data, (N, "N", "")] - count += 1 - if O > 1e-10: - data = [*data, (O, "O", "")] - count += 1 - if Ne > 1e-10: - data = [*data, (Ne, "Ne", "")] - count += 1 - if Si > 1e-10: - data = [*data, (Si, "Si", "")] - count += 1 - if Ar > 1e-10: - data = [*data, (Ar, "Ar", "")] - count += 1 - if Fe > 1e-10: - data = [*data, (Fe, "Fe", "")] - count += 1 - if Ni > 1e-10: - data = [*data, (Ni, "Ni", "")] - count += 1 - if Kr > 1e-10: - data = [*data, (Kr, "Kr", "")] - count += 1 - if Xe > 1e-10: - data = [*data, (Xe, "Xe", "")] - count += 1 - if W > 1e-10: - data = [*data, (W, "W", "")] - count += 1 - - if count > 11: - data = [("", "", ""), ("", "", ""), ("", "More than 11 impurities", "")] - else: - axis.text(-0.05, -6.4, "Plasma composition:", ha="left", va="center") - axis.text( - -0.05, - -7.2, - "Number densities relative to electron density:", - ha="left", - va="center", - ) - data2 = data2 + data - - plot_info(axis, data2, mfile_data, scan) - - -def plot_geometry_info(axis, mfile_data, scan): - """Function to plot geometry info - - Arguments: - axis --> axis object to plot to - mfile_data --> MFILE.DAT object - scan --> scan number to use - - """ - xmin = 0 - xmax = 1 - ymin = -16 - ymax = 1 - - axis.text(-0.05, 1, "Geometry:", ha="left", va="center") - axis.set_ylim([ymin, ymax]) - axis.set_xlim([xmin, xmax]) - axis.set_axis_off() - axis.set_autoscaley_on(False) - axis.set_autoscalex_on(False) - - in_blanket_thk = mfile_data.data["dr_shld_inboard"].get_scan( - scan - ) + mfile_data.data["dr_blkt_inboard"].get_scan(scan) - out_blanket_thk = mfile_data.data["dr_shld_outboard"].get_scan( - scan - ) + mfile_data.data["dr_blkt_outboard"].get_scan(scan) - - data = [ - ("rmajor", "$R_0$", "m"), - ("rminor", "a", "m"), - ("aspect", "A", ""), - ("kappa95", r"$\kappa_{95}$", ""), - ("triang95", r"$\delta_{95}$", ""), - ("a_plasma_surface", "Plasma surface area", "m$^2$"), - ("a_plasma_poloidal", "Plasma cross-sectional area", "m$^2$"), - ("vol_plasma", "Plasma volume", "m$^3$"), - ("n_tf_coils", "No. of TF coils", ""), - (in_blanket_thk, "Inboard blanket+shield", "m"), - ("dr_inboard_build", "Inboard build thickness", "m"), - (out_blanket_thk, "Outboard blanket+shield", "m"), - ] - - plot_info(axis, data, mfile_data, scan) - - -def plot_physics_info(axis, mfile_data, scan): - """Function to plot geometry info - - Arguments: - axis --> axis object to plot to - mfile_data --> MFILE.DAT object - scan --> scan number to use - - """ - xmin = 0 - xmax = 1 - ymin = -16 - ymax = 1 - - axis.text(-0.05, 1, "Physics:", ha="left", va="center") - axis.set_ylim([ymin, ymax]) - axis.set_xlim([xmin, xmax]) - axis.set_axis_off() - axis.set_autoscaley_on(False) - axis.set_autoscalex_on(False) - - nong = mfile_data.data["nd_plasma_electron_line"].get_scan(scan) / mfile_data.data[ - "nd_plasma_electron_max_array(7)" - ].get_scan(scan) - - nd_plasma_impurities_vol_avg = mfile_data.data[ - "nd_plasma_impurities_vol_avg" - ].get_scan(scan) / mfile_data.data["nd_plasma_electrons_vol_avg"].get_scan(scan) - - tepeak = mfile_data.data["temp_plasma_electron_on_axis_kev"].get_scan( - scan - ) / mfile_data.data["temp_plasma_electron_vol_avg_kev"].get_scan(scan) - - nepeak = mfile_data.data["nd_plasma_electron_on_axis"].get_scan( - scan - ) / mfile_data.data["nd_plasma_electrons_vol_avg"].get_scan(scan) - - # Assume Martin scaling if pthresh is not printed - # Accounts for pthresh not being written prior to issue #679 and #680 - if "p_l_h_threshold_mw" in mfile_data.data: - pthresh = mfile_data.data["p_l_h_threshold_mw"].get_scan(scan) - else: - pthresh = mfile_data.data["l_h_threshold_powers(6)"].get_scan(scan) - - data = [ - ("p_fusion_total_mw", "Fusion power", "MW"), - ("big_q_plasma", "$Q_{p}$", ""), - ("plasma_current_ma", "$I_p$", "MA"), - ("b_plasma_toroidal_on_axis", "Vacuum $B_T$ at $R_0$", "T"), - ("q95", r"$q_{\mathrm{95}}$", ""), - ("beta_norm_thermal", r"$\beta_N$, thermal", "% m T MA$^{-1}$"), - ("beta_norm_toroidal", r"$\beta_N$, toroidal", "% m T MA$^{-1}$"), - ("beta_thermal_poloidal_vol_avg", r"$\beta_P$, thermal", ""), - ("beta_poloidal_vol_avg", r"$\beta_P$, total", ""), - ("temp_plasma_electron_vol_avg_kev", r"$\langle T_e \rangle$", "keV"), - ("nd_plasma_electrons_vol_avg", r"$\langle n_e \rangle$", "m$^{-3}$"), - (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}}$", ""), - ( - nd_plasma_impurities_vol_avg, - r"$n_Z \ / \ \langle n_{\mathrm{e, vol}} \rangle$", - "", - ), - ("t_energy_confinement", r"$\tau_e$", "s"), - ("hfact", "H-factor", ""), - (pthresh, "H-mode threshold", "MW"), - ("tauelaw", "Scaling law", ""), - ] - - plot_info(axis, data, mfile_data, scan) - - -def plot_magnetics_info(axis, mfile_data, scan): - """Function to plot magnet info - - Arguments: - axis --> axis object to plot to - mfile_data --> MFILE.DAT object - scan --> scan number to use - - """ - # Check for Copper magnets - if "i_tf_sup" in mfile_data.data: - i_tf_sup = int(mfile_data.data["i_tf_sup"].get_scan(scan)) - else: - i_tf_sup = 1 - - xmin = 0 - xmax = 1 - ymin = -16 - ymax = 1 - - axis.text(-0.05, 1, "Coil currents etc:", ha="left", va="center") - axis.set_ylim([ymin, ymax]) - axis.set_xlim([xmin, xmax]) - axis.set_axis_off() - axis.set_autoscaley_on(False) - axis.set_autoscalex_on(False) - - # Number of coils (1 is OH coil) - number_of_coils = 0 - for item in mfile_data.data: - if "r_pf_coil_middle[" in item: - number_of_coils += 1 - - pf_info = [ - ( - mfile_data.data[f"c_pf_cs_coils_peak_ma[{i:01}]"].get_scan(scan), - f"PF {i}", - ) - for i in range(1, number_of_coils) - if i % 2 != 0 - ] - - if len(pf_info) > 2: - pf_info_3_a = pf_info[2][0] - pf_info_3_b = pf_info[2][1] - else: - pf_info_3_a = "" - pf_info_3_b = "" - - t_plant_pulse_burn = mfile_data.data["t_plant_pulse_burn"].get_scan(scan) / 3600.0 - - if "i_tf_bucking" in mfile_data.data: - i_tf_bucking = int(mfile_data.data["i_tf_bucking"].get_scan(scan)) - else: - i_tf_bucking = 1 - - # Get superconductor material (i_tf_sc_mat) - # If i_tf_sc_mat not present, assume resistive - if "i_tf_sc_mat" in mfile_data.data: - i_tf_sc_mat = int(mfile_data.data["i_tf_sc_mat"].get_scan(scan)) - else: - i_tf_sc_mat = 0 - - if i_tf_sc_mat > 0: - tftype = SUPERCONDUCTING_TF_TYPES[ - int(mfile_data.data["i_tf_sc_mat"].get_scan(scan)) - ] - else: - tftype = "Resistive Copper" - - vssoft = mfile_data.data["vs_plasma_res_ramp"].get_scan(scan) + mfile_data.data[ - "vs_plasma_ind_ramp" - ].get_scan(scan) - - sig_case = 1.0e-6 * mfile_data.data[f"s_shear_tf_peak({i_tf_bucking})"].get_scan( - scan - ) - sig_cond = 1.0e-6 * mfile_data.data[ - f"s_shear_tf_peak({i_tf_bucking + 1})" - ].get_scan(scan) - - if i_tf_sup == 1: - data = [ - (pf_info[0][0], pf_info[0][1], "MA"), - (pf_info[1][0], pf_info[1][1], "MA"), - (pf_info_3_a, pf_info_3_b, "MA"), - (vssoft, "Startup flux swing", "Wb"), - ("vs_cs_pf_total_pulse", "Available flux swing", "Wb"), - (t_plant_pulse_burn, "Burn time", "hrs"), - ("", "", ""), - (f"#TF coil type is {tftype}", "", ""), - ("b_tf_inboard_peak_with_ripple", "Peak field at conductor (w. rip.)", "T"), - ("f_c_tf_turn_operating_critical", r"I/I$_{\mathrm{crit}}$", ""), - ("temp_tf_superconductor_margin", "TF Temperature margin", "K"), - ("temp_cs_superconductor_margin", "CS Temperature margin", "K"), - (sig_cond, "TF Cond max TRESCA stress", "MPa"), - (sig_case, "TF Case max TRESCA stress", "MPa"), - ("m_tf_coils_total/n_tf_coils", "Mass per TF coil", "kg"), - ] - - else: - p_cp_resistive = 1.0e-6 * mfile_data.data["p_cp_resistive"].get_scan(scan) - p_tf_leg_resistive = 1.0e-6 * mfile_data.data["p_tf_leg_resistive"].get_scan( - scan - ) - p_tf_joints_resistive = 1.0e-6 * mfile_data.data[ - "p_tf_joints_resistive" - ].get_scan(scan) - fcoolcp = 100.0 * mfile_data.data["fcoolcp"].get_scan(scan) - - data = [ - (pf_info[0][0], pf_info[0][1], "MA"), - (pf_info[1][0], pf_info[1][1], "MA"), - (pf_info_3_a, pf_info_3_b, "MA"), - (vssoft, "Startup flux swing", "Wb"), - ("vs_cs_pf_total_pulse", "Available flux swing", "Wb"), - (t_plant_pulse_burn, "Burn time", "hrs"), - ("", "", ""), - (f"#TF coil type is {tftype}", "", ""), - ("b_tf_inboard_peak_symmetric", "Peak field at conductor (w. rip.)", "T"), - ("c_tf_total", "TF coil currents sum", "A"), - ("", "", ""), - ("#TF coil forces/stresses", "", ""), - (sig_cond, "TF conductor max TRESCA stress", "MPa"), - (sig_case, "TF bucking max TRESCA stress", "MPa"), - (fcoolcp, "CP cooling fraction", "%"), - ("vcool", "Maximum coolant flow speed", "ms$^{-1}$"), - (p_cp_resistive, "CP Resisitive heating", "MW"), - ( - p_tf_leg_resistive, - "legs Resisitive heating (all legs)", - "MW", - ), - (p_tf_joints_resistive, "TF joints resisitive heating ", "MW"), - ] - - plot_info(axis, data, mfile_data, scan) - - -def plot_power_info(axis, mfile_data, scan): - """Function to plot power info - - Arguments: - axis --> axis object to plot to - mfile_data --> MFILE.DAT object - scan --> scan number to use - - """ - - xmin = 0 - xmax = 1 - ymin = -16 - ymax = 1 - - axis.text(-0.05, 1, "Power flows:", ha="left", va="center") - axis.set_ylim([ymin, ymax]) - axis.set_xlim([xmin, xmax]) - axis.set_axis_off() - axis.set_autoscaley_on(False) - axis.set_autoscalex_on(False) - - gross_eff = 100.0 * ( - mfile_data.data["p_plant_electric_gross_mw"].get_scan(scan) - / mfile_data.data["p_plant_primary_heat_mw"].get_scan(scan) - ) - - net_eff = 100.0 * ( - ( - mfile_data.data["p_plant_electric_gross_mw"].get_scan(scan) - - mfile_data.data["p_coolant_pump_elec_total_mw"].get_scan(scan) - ) - / ( - mfile_data.data["p_plant_primary_heat_mw"].get_scan(scan) - - mfile_data.data["p_coolant_pump_elec_total_mw"].get_scan(scan) - ) - ) - - plant_eff = 100.0 * ( - mfile_data.data["p_plant_electric_net_mw"].get_scan(scan) - / mfile_data.data["p_fusion_total_mw"].get_scan(scan) - ) - - # Define appropriate pedestal and impurity parameters - coredescription = ( - "radius_plasma_core_norm", - "Normalised radius of 'core' region", - "", - ) - if i_plasma_pedestal == 1: - ped_height = ( - "nd_plasma_pedestal_electron", - "Electron density at pedestal", - "m$^{-3}$", - ) - ped_pos = ("radius_plasma_pedestal_density_norm", "r/a at density pedestal", "") - else: - ped_height = ("", "No pedestal model used", "") - ped_pos = ("", "", "") - - p_cryo_plant_electric_mw = mfile_data.data["p_cryo_plant_electric_mw"].get_scan( - scan - ) - - data = [ - ("pflux_fw_neutron_mw", "Nominal neutron wall load", "MW m$^{-2}$"), - coredescription, - ped_height, - ped_pos, - ("p_plasma_inner_rad_mw", "Inner zone radiation", "MW"), - ("p_plasma_rad_mw", "Total radiation in LCFS", "MW"), - ("p_blkt_nuclear_heat_total_mw", "Nuclear heating in blanket", "MW"), - ("p_shld_nuclear_heat_mw", "Nuclear heating in shield", "MW"), - (p_cryo_plant_electric_mw, "TF cryogenic power", "MW"), - ("p_plasma_separatrix_mw", "Power to divertor", "MW"), - ("divlife", "Divertor life", "years"), - ("p_plant_primary_heat_mw", "Primary (high grade) heat", "MW"), - (gross_eff, "Gross cycle efficiency", "%"), - (net_eff, "Net cycle efficiency", "%"), - ("p_plant_electric_gross_mw", "Gross electric power", "MW"), - ("p_plant_electric_net_mw", "Net electric power", "MW"), - ( - plant_eff, - r"Fusion-to-electric efficiency $\frac{P_{\mathrm{e,net}}}{P_{\mathrm{fus}}}$", - "%", - ), - ] - - plot_info(axis, data, mfile_data, scan) - - -def plot_current_drive_info(axis, mfile_data, scan): - """Function to plot current drive info - - Arguments: - axis --> axis object to plot to - mfile_data --> MFILE.DAT object - scan --> scan number to use - - """ - - xmin = 0 - xmax = 1 - ymin = -16 - ymax = 1 - i_hcd_primary = mfile_data.data["i_hcd_primary"].get_scan(scan) - nbi = False - ecrh = False - ebw = False - lhcd = False - iccd = False - - if (i_hcd_primary == 5) or (i_hcd_primary == 8): - nbi = True - axis.text(-0.05, 1, "Neutral Beam Current Drive:", ha="left", va="center") - if ( - (i_hcd_primary == 3) - or (i_hcd_primary == 7) - or (i_hcd_primary == 10) - or (i_hcd_primary == 11) - or (i_hcd_primary == 13) - ): - ecrh = True - axis.text(-0.05, 1, "Electron Cyclotron Current Drive:", ha="left", va="center") - if i_hcd_primary == 12: - ebw = True - axis.text(-0.05, 1, "Electron Bernstein Wave Drive:", ha="left", va="center") - if i_hcd_primary in [1, 4, 6]: - lhcd = True - axis.text( - -0.05, - 1, - "Lower Hybrid Current Drive:", - ha="left", - va="center", - ) - if i_hcd_primary == 2: - iccd = True - axis.text(-0.05, 1, "Ion Cyclotron Current Drive:", ha="left", va="center") - - if "i_hcd_secondary" in mfile_data.data: - secondary_heating = "" - i_hcd_secondary = mfile_data.data["i_hcd_secondary"].get_scan(scan) - - if (i_hcd_secondary == 5) or (i_hcd_secondary == 8): - secondary_heating = "NBI" - if ( - (i_hcd_secondary == 3) - or (i_hcd_secondary == 7) - or (i_hcd_secondary == 10) - or (i_hcd_secondary == 11) - or (i_hcd_secondary == 13) - ): - secondary_heating = "ECH" - if i_hcd_secondary == 12: - secondary_heating = "EBW" - if i_hcd_secondary in [1, 4, 6]: - secondary_heating = "LHCD" - if i_hcd_secondary == 2: - secondary_heating = "ICCD" - - axis.set_ylim([ymin, ymax]) - axis.set_xlim([xmin, xmax]) - axis.set_axis_off() - axis.set_autoscaley_on(False) - axis.set_autoscalex_on(False) - - pinjie = mfile_data.data["p_hcd_injected_total_mw"].get_scan(scan) - p_plasma_separatrix_mw = mfile_data.data["p_plasma_separatrix_mw"].get_scan(scan) - pdivr = p_plasma_separatrix_mw / mfile_data.data["rmajor"].get_scan(scan) - - if mfile_data.data["i_hcd_secondary"].get_scan(scan) != 0: - pinjmwfix = mfile_data.data["pinjmwfix"].get_scan(scan) - - pdivnr = ( - 1.0e20 - * mfile_data.data["p_plasma_separatrix_mw"].get_scan(scan) - / ( - mfile_data.data["rmajor"].get_scan(scan) - * mfile_data.data["nd_plasma_electrons_vol_avg"].get_scan(scan) - ) - ) - - # Assume Martin scaling if pthresh is not printed - # Accounts for pthresh not being written prior to issue #679 and #680 - if "p_l_h_threshold_mw" in mfile_data.data: - pthresh = mfile_data.data["p_l_h_threshold_mw"].get_scan(scan) - else: - pthresh = mfile_data.data["l_h_threshold_powers(6)"].get_scan(scan) - flh = p_plasma_separatrix_mw / pthresh - - hstar = mfile_data.data["hstar"].get_scan(scan) - - if ecrh: - data = [ - (pinjie, "Steady state auxiliary power", "MW"), - ("p_hcd_primary_extra_heat_mw", "Power for heating only", "MW"), - ("f_c_plasma_bootstrap", "Bootstrap fraction", ""), - ("f_c_plasma_auxiliary", "Auxiliary fraction", ""), - ("f_c_plasma_inductive", "Inductive fraction", ""), - ("p_plasma_loss_mw", "Plasma heating used for H factor", "MW"), - ( - "eta_cd_hcd_primary", - "Current drive efficiency", - "A W$^{-1}$", - ), - (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), - ( - pdivnr, - r"$\frac{P_{\mathrm{div}}}{\langle n \rangle R_{0}}$", - r"$\times 10^{-20}$ MW m$^{2}$", - ), - (flh, r"$\frac{P_{\mathrm{div}}}{P_{\mathrm{LH}}}$", ""), - (hstar, "H* (non-rad. corr.)", ""), - ] - # i_hcd_secondary is now always in the MFILE with = 0 meaning no fixed heating - if mfile_data.data["i_hcd_secondary"].get_scan(scan) != 0: - data.insert( - 1, ("pinjmwfix", f"{secondary_heating} secondary auxiliary power", "MW") - ) - data[0] = ((pinjie - pinjmwfix), "Primary auxiliary power", "MW") - data.insert(2, (pinjie, "Total auxillary power", "MW")) - - if nbi: - data = [ - (pinjie, "Steady state auxiliary power", "MW"), - ("p_hcd_primary_extra_heat_mw", "Power for heating only", "MW"), - ("f_c_plasma_bootstrap", "Bootstrap fraction", ""), - ("f_c_plasma_auxiliary", "Auxiliary fraction", ""), - ("f_c_plasma_inductive", "Inductive fraction", ""), - ("gamnb", "NB gamma", "$10^{20}$ A W$^{-1}$ m$^{-2}$"), - ("e_beam_kev", "NB energy", "keV"), - ("p_plasma_loss_mw", "Plasma heating used for H factor", "MW"), - (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), - ( - pdivnr, - r"$\frac{P_{\mathrm{div}}}{\langle n \rangle R_{0}}$", - r"$\times 10^{-20}$ MW m$^{2}$", - ), - (flh, r"$\frac{P_{\mathrm{div}}}{P_{\mathrm{LH}}}$", ""), - (hstar, "H* (non-rad. corr.)", ""), - ] - if mfile_data.data["i_hcd_secondary"].get_scan(scan) != 0: - data.insert( - 1, ("pinjmwfix", f"{secondary_heating} secondary auxiliary power", "MW") - ) - data[0] = ((pinjie - pinjmwfix), "Primary auxiliary power", "MW") - data.insert(2, (pinjie, "Total auxillary power", "MW")) - - if ebw: - data = [ - (pinjie, "Steady state auxiliary power", "MW"), - ("p_hcd_primary_extra_heat_mw", "Power for heating only", "MW"), - ("f_c_plasma_bootstrap", "Bootstrap fraction", ""), - ("f_c_plasma_auxiliary", "Auxiliary fraction", ""), - ("f_c_plasma_inductive", "Inductive fraction", ""), - ("p_plasma_loss_mw", "Plasma heating used for H factor", "MW"), - ( - "eta_cd_norm_hcd_primary", - "Normalised current drive efficiency of primary HCD system", - "(10$^{20}$ A/(Wm$^{2}$))", - ), - (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), - ( - pdivnr, - r"$\frac{P_{\mathrm{div}}}{\langle n \rangle R_{0}}$", - r"$\times 10^{-20}$ MW m$^{2}$", - ), - (flh, r"$\frac{P_{\mathrm{div}}}{P_{\mathrm{LH}}}$", ""), - (hstar, "H* (non-rad. corr.)", ""), - ] - if "i_hcd_secondary" in mfile_data.data: - data.insert( - 1, ("pinjmwfix", f"{secondary_heating} secondary auxiliary power", "MW") - ) - data[0] = ((pinjie - pinjmwfix), "Primary auxiliary power", "MW") - data.insert(2, (pinjie, "Total auxillary power", "MW")) - - if lhcd: - data = [ - (pinjie, "Steady state auxiliary power", "MW"), - ("p_hcd_primary_extra_heat_mw", "Power for heating only", "MW"), - ("f_c_plasma_bootstrap", "Bootstrap fraction", ""), - ("f_c_plasma_auxiliary", "Auxiliary fraction", ""), - ("f_c_plasma_inductive", "Inductive fraction", ""), - ("p_plasma_loss_mw", "Plasma heating used for H factor", "MW"), - ( - "eta_cd_norm_hcd_primary", - "Normalised current drive efficiency", - "(10$^{20}$ A/(Wm$^{2}$))", - ), - (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), - ( - pdivnr, - r"$\frac{P_{\mathrm{div}}}{\langle n \rangle R_{0}}$", - r"$\times 10^{-20}$ MW m$^{2}$", - ), - (flh, r"$\frac{P_{\mathrm{div}}}{P_{\mathrm{LH}}}$", ""), - (hstar, "H* (non-rad. corr.)", ""), - ] - if "i_hcd_secondary" in mfile_data.data: - data.insert( - 1, ("pinjmwfix", f"{secondary_heating} secondary auxiliary power", "MW") - ) - data[0] = ((pinjie - pinjmwfix), "Primary auxiliary power", "MW") - data.insert(2, (pinjie, "Total auxillary power", "MW")) - - if iccd: - data = [ - (pinjie, "Steady state auxiliary power", "MW"), - ("p_hcd_primary_extra_heat_mw", "Power for heating only", "MW"), - ("f_c_plasma_bootstrap", "Bootstrap fraction", ""), - ("f_c_plasma_auxiliary", "Auxiliary fraction", ""), - ("f_c_plasma_inductive", "Inductive fraction", ""), - ("p_plasma_loss_mw", "Plasma heating used for H factor", "MW"), - ( - "eta_cd_norm_hcd_primary", - "Normalised current drive efficiency", - "(10$^{20}$ A/(Wm$^{2}$))", - ), - (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), - ( - pdivnr, - r"$\frac{P_{\mathrm{div}}}{\langle n \rangle R_{0}}$", - r"$\times 10^{-20}$ MW m$^{2}$", - ), - (flh, r"$\frac{P_{\mathrm{div}}}{P_{\mathrm{LH}}}$", ""), - (hstar, "H* (non-rad. corr.)", ""), - ] - if "i_hcd_secondary" in mfile_data.data: - data.insert( - 1, ("pinjmwfix", f"{secondary_heating} secondary auxiliary power", "MW") - ) - data[0] = ((pinjie - pinjmwfix), "Primary auxiliary power", "MW") - data.insert(2, (pinjie, "Total auxillary power", "MW")) - - coe = mfile_data.data["coe"].get_scan(scan) - if coe == 0.0: - data.append(("", "", "")) - data.append(("#Costs", "", "")) - data.append(("", "Cost output not selected", "")) - else: - data.append(("", "", "")) - data.append(("#Costs", "", "")) - data.append((coe, "Cost of electricity", r"\$/MWh")) - - plot_info(axis, data, mfile_data, scan) - - def plot_bootstrap_comparison(axis, mfile_data, scan): """Function to plot a scatter box plot of bootstrap current fractions. @@ -12328,7 +11527,6 @@ def plot_plasma_outboard_toroidal_ripple_map( def main_plot( fig0, - fig1, fig2, fig3, fig4, @@ -12391,25 +11589,6 @@ def main_plot( plot_0 = fig0.add_subplot(111) plot_cover_page(plot_0, m_file_data, scan, fig0, colour_scheme) - # Plot header info - plot_header(fig1.add_subplot(231), m_file_data, scan) - - # Geometry - plot_geometry_info(fig1.add_subplot(232), m_file_data, scan) - - # Physics - plot_physics_info(fig1.add_subplot(233), m_file_data, scan) - - # Magnetics - plot_magnetics_info(fig1.add_subplot(234), m_file_data, scan) - - # power/flow economics - plot_power_info(fig1.add_subplot(235), m_file_data, scan) - - # Current drive - plot_current_drive_info(fig1.add_subplot(236), m_file_data, scan) - fig1.subplots_adjust(wspace=0.25, hspace=0.25) - ax7 = fig2.add_subplot(121) ax7.set_position([0.175, 0.1, 0.35, 0.8]) # Move plot slightly to the right plot_iteration_variables(ax7, m_file_data, scan) @@ -12924,7 +12103,6 @@ def main(args=None): # create main plot page0 = plt.figure(figsize=(12, 9), dpi=80) - page1 = plt.figure(figsize=(12, 9), dpi=80) page2 = plt.figure(figsize=(12, 9), dpi=80) page3 = plt.figure(figsize=(12, 9), dpi=80) page4 = plt.figure(figsize=(12, 9), dpi=80) @@ -12953,7 +12131,6 @@ def main(args=None): # run main_plot main_plot( page0, - page1, page2, page3, page4, @@ -12987,7 +12164,6 @@ def main(args=None): # with bpdf.PdfPages(args.o) as pdf: with bpdf.PdfPages(args.f + "SUMMARY.pdf") as pdf: pdf.savefig(page0) - pdf.savefig(page1) pdf.savefig(page2) pdf.savefig(page3) pdf.savefig(page4) @@ -13018,7 +12194,6 @@ def main(args=None): plt.show(block=True) plt.close(page0) - plt.close(page1) plt.close(page2) plt.close(page3) plt.close(page4)