Skip to content

Commit

Permalink
🎨 Add first wall pumping output functionality and update plotting wit…
Browse files Browse the repository at this point in the history
…h coolant temperatures and pressure annotations
  • Loading branch information
chris-ashe committed Feb 21, 2025
1 parent 3c9b4f8 commit e02489f
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
44 changes: 44 additions & 0 deletions process/fw.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,3 +468,47 @@ def output_fw_geometry(self):
build_variables.dr_fw_outboard,
"OP ",
)

def output_fw_pumping(self):
"""
Outputs the first wall pumping details to the output file.
Returns:
None
"""
po.oheadr(self.outfile, "First wall pumping")

po.ovarst(
self.outfile,
"First wall coolant type",
"(i_fw_coolant_type)",
f'"{fwbs_variables.i_fw_coolant_type}"',
)
po.ovarrf(
self.outfile,
"Outlet temperature of first wall coolant [K]",
"(temp_fw_coolant_out)",
fwbs_variables.temp_fw_coolant_out,
"OP ",
)
po.ovarrf(
self.outfile,
"Inlet temperature of first wall coolant [K]",
"(temp_fw_coolant_in)",
fwbs_variables.temp_fw_coolant_in,
"OP ",
)
po.ovarrf(
self.outfile,
"Pressure of first wall coolant [Pa]",
"(pres_fw_coolant)",
fwbs_variables.pres_fw_coolant,
"OP ",
)
po.ovarrf(
self.outfile,
"Peak temperature of first wall [K]",
"(temp_fw_peak)",
fwbs_variables.temp_fw_peak,
"OP ",
)
70 changes: 70 additions & 0 deletions process/io/plot_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,11 @@ def plot_first_wall_poloidal_cross_section(axis, mfile_data, scan):
dr_fw_wall = mfile_data.data["dr_fw_wall"].get_scan(scan)
dx_fw_module = mfile_data.data["dx_fw_module"].get_scan(scan)
len_fw_channel = mfile_data.data["len_fw_channel"].get_scan(scan)
temp_fw_coolant_in = mfile_data.data["temp_fw_coolant_in"].get_scan(scan)
temp_fw_coolant_out = mfile_data.data["temp_fw_coolant_out"].get_scan(scan)
i_fw_coolant_type = mfile_data.data["i_fw_coolant_type"].get_scan(scan)
temp_fw_peak = mfile_data.data["temp_fw_peak"].get_scan(scan)
pres_fw_coolant = mfile_data.data["pres_fw_coolant"].get_scan(scan)

# Plot first wall structure facing plasma
axis.add_patch(
Expand Down Expand Up @@ -1612,6 +1617,71 @@ def plot_first_wall_poloidal_cross_section(axis, mfile_data, scan):
)
)

# Draw an upward pointing arrow
axis.arrow(
dx_fw_module + 0.5 * dr_fw_wall,
dr_fw_wall + radius_fw_channel,
0,
len_fw_channel / 6,
head_width=dr_fw_wall,
head_length=len_fw_channel / 20,
fc="black",
ec="black",
)

# Add the inlet temperature beside the arrow
axis.text(
dx_fw_module + 2 * dr_fw_wall,
dr_fw_wall + radius_fw_channel + len_fw_channel / 6,
f"$T_{{inlet}} = ${temp_fw_coolant_in:.2f} K",
ha="left",
va="bottom",
fontsize=10,
color="black",
)

# Draw a right pointing arrow
axis.arrow(
dx_fw_module + 0.5 * dr_fw_wall,
len_fw_channel,
2 * dr_fw_wall,
0,
head_width=len_fw_channel / 30,
head_length=dr_fw_wall,
fc="black",
ec="black",
linewidth=5, # Thicker stem
)

# Add the outlet temperature beside the arrow
axis.text(
dx_fw_module + 0.5 * dr_fw_wall,
len_fw_channel * 0.9,
f"$T_{{outlet}} = ${temp_fw_coolant_out:.2f} K",
ha="left",
va="bottom",
fontsize=10,
color="black",
)

textstr_fw = "\n".join((
rf"Coolant type: {i_fw_coolant_type}",
rf"$T_{{FW,peak}}$: {temp_fw_peak:.3f} K",
rf"$P_{{FW}}$: {pres_fw_coolant / 1e3:.3f} kPa",
rf"$P_{{FW}}$: {pres_fw_coolant / 1e5:.3f} bar",
))

props_fw = {"boxstyle": "round", "facecolor": "wheat", "alpha": 0.5}
axis.text(
-0.7,
0.05,
textstr_fw,
transform=axis.transAxes,
fontsize=11,
verticalalignment="bottom",
bbox=props_fw,
)

axis.set_xlabel("R [m]")
axis.set_ylabel("Z [m]")
axis.set_title("First Wall Poloidal Cross Section")
Expand Down
3 changes: 3 additions & 0 deletions process/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def write(models, _outfile):
# First wall geometry
models.fw.output_fw_geometry()

# First wall pumping
models.fw.output_fw_pumping()

if ft.fwbs_variables.i_blanket_type == 1:
# CCFE HCPB model
models.ccfe_hcpb.run(output=True)
Expand Down

0 comments on commit e02489f

Please sign in to comment.