Skip to content
Draft
2 changes: 1 addition & 1 deletion documentation/development/standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ The unit declaration `_fpy` can be used to specify that it is the full-power yea

##### Forces

- Forces should start with the `forc_` prefix.
- Forces should start with the `force_` prefix.

---------------------

Expand Down
28 changes: 14 additions & 14 deletions process/data_structure/tfcoil_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@
"""TF outboard leg current density (A/m2) (resistive coils only)"""


cforce: float = None
"""centering force on inboard leg (per coil) (N/m)"""
force_tf_coil_inboard_centering: float = None
"""Centering force on inboard leg (per coil) (N)"""


cplen: float = None
Expand Down Expand Up @@ -841,17 +841,17 @@
"""max voltage across TF coil during quench (kV) (`iteration variable 52`)"""


vforce: float = None
"""vertical tension on inboard leg/coil (N)"""
force_tf_coil_inboard_vertical: float = None
"""Vertical tension on inboard leg of TF coil (N)"""


f_vforce_inboard: float = None
f_force_tf_coil_inboard_vertical: float = None
"""Fraction of the total vertical force taken by the TF inboard leg tension
Not used for resistive `itart=1` (sliding joints)
"""


vforce_outboard: float = None
force_tf_coil_outboard_vertical: float = None
"""Vertical tension on outboard leg/coil (N)"""


Expand Down Expand Up @@ -1121,7 +1121,7 @@ def init_tfcoil_variables():
global i_dx_tf_turn_cable_space_general_input
global acs
global cdtfleg
global cforce
global force_tf_coil_inboard_centering
global cplen
global c_tf_turn
global c_tf_turn_max
Expand Down Expand Up @@ -1249,9 +1249,9 @@ def init_tfcoil_variables():
global temp_tf_cryo
global n_tf_coil_turns
global v_tf_coil_dump_quench_max_kv
global vforce
global f_vforce_inboard
global vforce_outboard
global force_tf_coil_inboard_vertical
global f_force_tf_coil_inboard_vertical
global force_tf_coil_outboard_vertical
global f_a_tf_turn_cable_space_extra_void
global voltfleg
global vtfkv
Expand Down Expand Up @@ -1337,7 +1337,7 @@ def init_tfcoil_variables():
t_turn_tf_max = 0.05
acs = 0.0
cdtfleg = 0.0
cforce = 0.0
force_tf_coil_inboard_centering = 0.0
cplen = 0.0
c_tf_turn = 7.0e4
c_tf_turn_max = 9.0e4
Expand Down Expand Up @@ -1484,9 +1484,9 @@ def init_tfcoil_variables():
temp_tf_cryo = 4.5
n_tf_coil_turns = 0.0
v_tf_coil_dump_quench_max_kv = 20.0
vforce = 0.0
f_vforce_inboard = 0.5
vforce_outboard = 0.0
force_tf_coil_inboard_vertical = 0.0
f_force_tf_coil_inboard_vertical = 0.5
force_tf_coil_outboard_vertical = 0.0
f_a_tf_turn_cable_space_extra_void = 0.4
voltfleg = 0.0
vtfkv = 0.0
Expand Down
2 changes: 1 addition & 1 deletion process/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def __post_init__(self):
"f_beam_tritium": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
),
"f_vforce_inboard": InputVariable(
"f_force_tf_coil_inboard_vertical": InputVariable(
data_structure.tfcoil_variables, float, range=(0.0, 1.0)
),
"f_w": InputVariable(data_structure.stellarator_variables, float, range=(0.1, 1.0)),
Expand Down
181 changes: 181 additions & 0 deletions process/io/plot_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12434,6 +12434,177 @@ def plot_ion_charge_profile(axis, mfile_data, scan):
axis.grid(which="both", linestyle="--", alpha=0.5)


def plot_tf_coil_forces(axis, mfile_data, scan, colour_scheme=1):
# Plot the TF coil poloidal cross-section
plot_tf_coils(axis, mfile_data, scan, colour_scheme)

force_tf_coil_inboard_centering = mfile_data.data[
"force_tf_coil_inboard_centering"
].get_scan(scan)
force_tf_coil_inboard_vertical = mfile_data.data[
"force_tf_coil_inboard_vertical"
].get_scan(scan)
force_tf_coil_outboard_vertical = mfile_data.data[
"force_tf_coil_outboard_vertical"
].get_scan(scan)
z_tf_inside_half = mfile_data.data["z_tf_inside_half"].get_scan(scan)

# ==============================

# Get the left side of the inboard leg (r_tf_inboard_in)
r_tf_inboard_in = mfile_data.data["r_tf_inboard_in"].get_scan(scan)
y_center = 0.0 # Assume midplane for arrow

# Draw a red arrow pointing right from the left side of the inboard leg
axis.annotate(
"",
xy=(0, y_center),
xytext=(r_tf_inboard_in, y_center),
arrowprops={"arrowstyle": "-|>", "color": "red", "lw": 4},
annotation_clip=False,
)

# Show the centering force in MN next to the arrow
axis.text(
r_tf_inboard_in - 0.55,
z_tf_inside_half / 3,
f"{force_tf_coil_inboard_centering / 1e6:.2f} MN",
color="red",
fontsize=10,
va="center",
ha="right",
fontweight="bold",
bbox={
"boxstyle": "round,pad=0.2",
"facecolor": "white",
"edgecolor": "red",
"alpha": 0.8,
},
)

# Draw vertical arrows at the inboard to show the separation vertical force (up and down)
axis.annotate(
"",
xy=(r_tf_inboard_in, z_tf_inside_half / 2),
xytext=(r_tf_inboard_in, 0),
arrowprops={"arrowstyle": "-|>", "color": "blue", "lw": 4},
annotation_clip=False,
)
axis.annotate(
"",
xy=(r_tf_inboard_in, -z_tf_inside_half / 2),
xytext=(r_tf_inboard_in, 0),
arrowprops={"arrowstyle": "-|>", "color": "blue", "lw": 4},
annotation_clip=False,
)

# Show the vertical separation force in MN next to the arrows (up)
axis.text(
r_tf_inboard_in + 0.1,
z_tf_inside_half / 2,
f"{force_tf_coil_inboard_vertical / 1e6:.2f} MN",
color="blue",
fontsize=10,
va="center",
ha="left",
fontweight="bold",
bbox={
"boxstyle": "round,pad=0.2",
"facecolor": "white",
"edgecolor": "blue",
"alpha": 0.8,
},
)
# Show the vertical separation force in MN next to the arrows (down)
axis.text(
r_tf_inboard_in + 0.1,
-z_tf_inside_half / 2,
f"{force_tf_coil_inboard_vertical / 1e6:.2f} MN",
color="blue",
fontsize=10,
va="center",
ha="left",
fontweight="bold",
bbox={
"boxstyle": "round,pad=0.2",
"facecolor": "white",
"edgecolor": "blue",
"alpha": 0.8,
},
)

# Draw vertical arrows at the outboard to show the outboard vertical tension force (up and down)
r_tf_outboard_in = mfile_data.data["r_tf_outboard_in"].get_scan(scan)
force_tf_coil_outboard_vertical = mfile_data.data[
"force_tf_coil_outboard_vertical"
].get_scan(scan)
z_tf_inside_half = mfile_data.data["z_tf_inside_half"].get_scan(scan)

axis.annotate(
"",
xy=(r_tf_outboard_in, z_tf_inside_half / 2),
xytext=(r_tf_outboard_in, 0),
arrowprops={"arrowstyle": "-|>", "color": "purple", "lw": 4},
annotation_clip=False,
)
axis.annotate(
"",
xy=(r_tf_outboard_in, -z_tf_inside_half / 2),
xytext=(r_tf_outboard_in, 0),
arrowprops={"arrowstyle": "-|>", "color": "purple", "lw": 4},
annotation_clip=False,
)

axis.text(
r_tf_outboard_in + 0.1,
z_tf_inside_half / 2,
f"{force_tf_coil_outboard_vertical / 1e6:.2f} MN",
color="purple",
fontsize=10,
va="center",
ha="left",
fontweight="bold",
bbox={
"boxstyle": "round,pad=0.2",
"facecolor": "white",
"edgecolor": "purple",
"alpha": 0.8,
},
)
axis.text(
r_tf_outboard_in + 0.1,
-z_tf_inside_half / 2,
f"{force_tf_coil_outboard_vertical / 1e6:.2f} MN",
color="purple",
fontsize=10,
va="center",
ha="left",
fontweight="bold",
bbox={
"boxstyle": "round,pad=0.2",
"facecolor": "white",
"edgecolor": "purple",
"alpha": 0.8,
},
)

# Plot a red dot at (0,0)
axis.plot(0, 0, marker="o", color="red", markersize=7)

# Plot a red dashed vertical line at R=0
axis.axvline(0, color="red", linestyle="--", linewidth=1)

# Add centre line at
axis.axhline(y=0, color="red", linestyle="--", linewidth=1)
# axis.set_xlim(-3.0, (r_tf_outboard_in + dr_tf_outboard) * 1.4)
# axis.set_ylim((y4 - dr_tf_inboard) * 1.2, (y2 + dr_tf_inboard) * 1.2)
axis.set_xlabel("R [m]")
axis.set_ylabel("Z [m]")
axis.set_title("TF Coil Poloidal Cross-Section")
axis.minorticks_on()
axis.grid(True, which="both", linestyle="--", linewidth=0.5, alpha=0.2)


def main_plot(
fig0,
fig1,
Expand Down Expand Up @@ -12462,6 +12633,7 @@ def main_plot(
fig24,
fig25,
fig26,
fig27,
m_file_data,
scan,
imp="../data/lz_non_corona_14_elements/",
Expand Down Expand Up @@ -12744,6 +12916,11 @@ 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, fig26)

ax_tf_forces = fig27.add_subplot(121, aspect="equal")
# Set position: [left, bottom, width, height] -- width ~0.66 (2/3), height ~0.8 (taller)
ax_tf_forces.set_position([0.08, 0.15, 0.66, 0.8])
plot_tf_coil_forces(ax_tf_forces, m_file_data, scan, colour_scheme)


def main(args=None):
# TODO The use of globals here isn't ideal, but is required to get main()
Expand Down Expand Up @@ -13062,6 +13239,7 @@ def main(args=None):
page24 = plt.figure(figsize=(12, 9), dpi=80)
page25 = plt.figure(figsize=(12, 9), dpi=80)
page26 = plt.figure(figsize=(12, 9), dpi=80)
page27 = plt.figure(figsize=(12, 9), dpi=80)

# run main_plot
main_plot(
Expand Down Expand Up @@ -13092,6 +13270,7 @@ def main(args=None):
page24,
page25,
page26,
page27,
m_file,
scan=scan,
demo_ranges=demo_ranges,
Expand Down Expand Up @@ -13127,6 +13306,7 @@ def main(args=None):
pdf.savefig(page24)
pdf.savefig(page25)
pdf.savefig(page26)
pdf.savefig(page27)

# show fig if option used
if args.show:
Expand Down Expand Up @@ -13159,6 +13339,7 @@ def main(args=None):
plt.close(page24)
plt.close(page25)
plt.close(page26)
plt.close(page27)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion process/io/variable_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class VariableMetadata:
description="Outer FW to plasma gap",
units="m",
),
"vforce": VariableMetadata(
"force_tf_coil_inboard_vertical": VariableMetadata(
latex=r"$F_\mathrm{z}^\mathrm{in}$ [$N$]",
description="TF coil vertical force",
units="N",
Expand Down
12 changes: 6 additions & 6 deletions process/resistive_tf_coil.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def run(self, output: bool):
)

(
tfcoil_variables.cforce,
tfcoil_variables.vforce,
tfcoil_variables.vforce_outboard,
tfcoil_variables.force_tf_coil_inboard_centering,
tfcoil_variables.force_tf_coil_inboard_vertical,
tfcoil_variables.force_tf_coil_outboard_vertical,
superconducting_tf_coil_variables.vforce_inboard_tot,
tfcoil_variables.f_vforce_inboard,
tfcoil_variables.f_force_tf_coil_inboard_vertical,
) = self.tf_field_and_force(
i_tf_sup=tfcoil_variables.i_tf_sup,
r_tf_wp_inboard_outer=superconducting_tf_coil_variables.r_tf_wp_inboard_outer,
Expand All @@ -77,7 +77,7 @@ def run(self, output: bool):
r_cp_top=build_variables.r_cp_top,
itart=physics_variables.itart,
i_cp_joints=tfcoil_variables.i_cp_joints,
f_vforce_inboard=tfcoil_variables.f_vforce_inboard,
f_force_tf_coil_inboard_vertical=tfcoil_variables.f_force_tf_coil_inboard_vertical,
)

# Calculate TF coil areas and masses
Expand Down Expand Up @@ -190,7 +190,7 @@ def run(self, output: bool):
superconducting_tf_coil_variables.vforce_inboard_tot,
tfcoil_variables.i_tf_tresca,
tfcoil_variables.a_tf_coil_inboard_case,
tfcoil_variables.vforce,
tfcoil_variables.force_tf_coil_inboard_vertical,
tfcoil_variables.a_tf_turn_steel,
)

Expand Down
Loading
Loading