From 90b5f7ba5bcdcdae227efe752700e888bdf52b49 Mon Sep 17 00:00:00 2001 From: ym1906 Date: Mon, 25 Mar 2024 15:11:00 +0000 Subject: [PATCH 1/4] Added option to to output Lower Hybrid Current Drive and Ion Cyclotron CD. Removed option 9 from plot_proc as it has been removed from PROCESS. --- process/io/plot_proc.py | 85 ++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index d81ffdf0c0..80dee7f873 100755 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -917,9 +917,7 @@ def plot_radprofile(prof, mfile_data, scan, impp, demo_ranges) -> float: te = np.zeros(rho.shape[0]) for q in range(rho.shape[0]): if rho[q] <= rhopedn: - ne[q] = ( - neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan - ) + ne[q] = neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan else: ne[q] = nesep + (neped - nesep) * (1 - rho[q]) / ( 1 - min(0.9999, rhopedn) @@ -2045,6 +2043,9 @@ def plot_current_drive_info(axis, mfile_data, scan): nbi = False ecrh = False ebw = False + lhcd = False + iccd = False + if (iefrf == 5) or (iefrf == 8): nbi = True axis.text(-0.05, 1, "Neutral Beam Current Drive:", ha="left", va="center") @@ -2054,11 +2055,18 @@ def plot_current_drive_info(axis, mfile_data, scan): if iefrf == 12: ebw = True axis.text(-0.05, 1, "Electron Bernstein Wave Drive:", ha="left", va="center") - if (iefrf == 1) or (iefrf == 2) or (iefrf == 4) or (iefrf == 6) or (iefrf == 9): - print( - "Options 1, 2, 4, 6 and 9 not implemented yet in this python script plot_proc.py\n" + if iefrf in [1, 4, 6]: + lhcd = True + axis.text( + -0.05, + 1, + "Lower Hybrid Current Drive:", + ha="left", + va="center", ) - print("NEEDS TO BE IMPLEMENTED in plot_current_drive_info subroutine!!\n") + if iefrf == 2: + iccd = True + axis.text(-0.05, 1, "Ion Cyclotron Current Drive:", ha="left", va="center") if "iefrffix" in mfile_data.data.keys(): secondary_heating = "" @@ -2076,17 +2084,10 @@ def plot_current_drive_info(axis, mfile_data, scan): secondary_heating = "ECH" if iefrffix == 12: secondary_heating = "EBW" - if ( - (iefrffix == 1) - or (iefrffix == 2) - or (iefrffix == 4) - or (iefrffix == 6) - or (iefrffix == 9) - ): - print( - "Options 1, 2, 4, 6 and 9 not implemented yet in this python script plot_proc.py\n" - ) - print("NEEDS TO BE IMPLEMENTED in plot_current_drive_info subroutine!!\n") + if iefrffix in [1, 4, 6]: + secondary_heating = "LHCD" + if iefrffix == 2: + secondary_heating = "ICCD" axis.set_ylim([ymin, ymax]) axis.set_xlim([xmin, xmax]) @@ -2196,6 +2197,54 @@ def plot_current_drive_info(axis, mfile_data, scan): 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"), + ("pheat", "Power for heating only", "MW"), + ("bootipf", "Bootstrap fraction", ""), + ("faccd", "Auxiliary fraction", ""), + ("facoh", "Inductive fraction", ""), + ("powerht", "Plasma heating used for H factor", "MW"), + (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), + ( + pdivnr, + r"$\frac{P_{\mathrm{div}}}{ R_{0}}$", + r"$\times 10^{-20}$ MW m$^{2}$", + ), + (flh, r"$\frac{P_{\mathrm{div}}}{P_{\mathrm{LH}}}$", ""), + (hstar, "H* (non-rad. corr.)", ""), + ] + if "iefrffix" in mfile_data.data.keys(): + 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"), + ("pheat", "Power for heating only", "MW"), + ("bootipf", "Bootstrap fraction", ""), + ("faccd", "Auxiliary fraction", ""), + ("facoh", "Inductive fraction", ""), + ("powerht", "Plasma heating used for H factor", "MW"), + (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), + ( + pdivnr, + r"$\frac{P_{\mathrm{div}}}{ R_{0}}$", + r"$\times 10^{-20}$ MW m$^{2}$", + ), + (flh, r"$\frac{P_{\mathrm{div}}}{P_{\mathrm{LH}}}$", ""), + (hstar, "H* (non-rad. corr.)", ""), + ] + if "iefrffix" in mfile_data.data.keys(): + 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(("", "", "")) From 02b2ef3876e96b998282e2409424edfed31cb397 Mon Sep 17 00:00:00 2001 From: ym1906 Date: Mon, 25 Mar 2024 15:34:13 +0000 Subject: [PATCH 2/4] Fix black8 failure. --- process/io/plot_proc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 80dee7f873..9d78f4599a 100755 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -917,7 +917,9 @@ def plot_radprofile(prof, mfile_data, scan, impp, demo_ranges) -> float: te = np.zeros(rho.shape[0]) for q in range(rho.shape[0]): if rho[q] <= rhopedn: - ne[q] = neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan + ne[q] = ( + neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan + ) else: ne[q] = nesep + (neped - nesep) * (1 - rho[q]) / ( 1 - min(0.9999, rhopedn) From 9f59426617f75757bf7339309ca99e72f805dc81 Mon Sep 17 00:00:00 2001 From: ym1906 Date: Wed, 27 Mar 2024 13:55:07 +0000 Subject: [PATCH 3/4] Added lines to output gamcd --- process/io/plot_proc.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index 9d78f4599a..fc53e562c7 100755 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -917,9 +917,7 @@ def plot_radprofile(prof, mfile_data, scan, impp, demo_ranges) -> float: te = np.zeros(rho.shape[0]) for q in range(rho.shape[0]): if rho[q] <= rhopedn: - ne[q] = ( - neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan - ) + ne[q] = neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan else: ne[q] = nesep + (neped - nesep) * (1 - rho[q]) / ( 1 - min(0.9999, rhopedn) @@ -2133,6 +2131,11 @@ def plot_current_drive_info(axis, mfile_data, scan): ("faccd", "Auxiliary fraction", ""), ("facoh", "Inductive fraction", ""), ("powerht", "Plasma heating used for H factor", "MW"), + ( + "gamcd", + "Normalised current drive efficiency", + "(10$^{19}$ A/(Wm$^{2}$))", + ), (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), ( pdivnr, @@ -2183,6 +2186,11 @@ def plot_current_drive_info(axis, mfile_data, scan): ("faccd", "Auxiliary fraction", ""), ("facoh", "Inductive fraction", ""), ("powerht", "Plasma heating used for H factor", "MW"), + ( + "gamcd", + "Normalised current drive efficiency", + "(10$^{19}$ A/(Wm$^{2}$))", + ), (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), ( pdivnr, @@ -2207,6 +2215,11 @@ def plot_current_drive_info(axis, mfile_data, scan): ("faccd", "Auxiliary fraction", ""), ("facoh", "Inductive fraction", ""), ("powerht", "Plasma heating used for H factor", "MW"), + ( + "gamcd", + "Normalised current drive efficiency", + "(10$^{19}$ A/(Wm$^{2}$))", + ), (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), ( pdivnr, @@ -2231,6 +2244,11 @@ def plot_current_drive_info(axis, mfile_data, scan): ("faccd", "Auxiliary fraction", ""), ("facoh", "Inductive fraction", ""), ("powerht", "Plasma heating used for H factor", "MW"), + ( + "gamcd", + "Normalised current drive efficiency", + "(10$^{19}$ A/(Wm$^{2}$))", + ), (pdivr, r"$\frac{P_{\mathrm{div}}}{R_{0}}$", "MW m$^{-1}$"), ( pdivnr, From a3920e55d54d2e3375e75d97376acc9777f23719 Mon Sep 17 00:00:00 2001 From: ym1906 Date: Wed, 27 Mar 2024 14:01:03 +0000 Subject: [PATCH 4/4] added black fix --- process/io/plot_proc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index fc53e562c7..0a16f04576 100755 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -917,7 +917,9 @@ def plot_radprofile(prof, mfile_data, scan, impp, demo_ranges) -> float: te = np.zeros(rho.shape[0]) for q in range(rho.shape[0]): if rho[q] <= rhopedn: - ne[q] = neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan + ne[q] = ( + neped + (ne0 - neped) * (1 - rho[q] ** 2 / rhopedn**2) ** alphan + ) else: ne[q] = nesep + (neped - nesep) * (1 - rho[q]) / ( 1 - min(0.9999, rhopedn)