diff --git a/process/core/io/plot/summary.py b/process/core/io/plot/summary.py index bce8c6173..ac1e0951d 100644 --- a/process/core/io/plot/summary.py +++ b/process/core/io/plot/summary.py @@ -9762,8 +9762,8 @@ def plot_cs_coil_structure( ) axis.text( - 0.6, - 0.75, + 0.45, + 0.375, textstr_cs, fontsize=9, verticalalignment="bottom", @@ -9797,6 +9797,55 @@ def plot_cs_coil_structure( axis.legend() +def plot_cs_stress_time_profile(axis: plt.Axes, mfile: MFile, scan: int) -> None: + """Function to plot the time profile of the CS stress during the pulse.""" + t_plant_pulse_coil_precharge = mfile.get("t_plant_pulse_coil_precharge", scan=scan) + t_plant_pulse_plasma_current_ramp_up = mfile.get( + "t_plant_pulse_plasma_current_ramp_up", scan=scan + ) + t_plant_pulse_fusion_ramp = mfile.get("t_plant_pulse_fusion_ramp", scan=scan) + t_plant_pulse_burn = mfile.get("t_plant_pulse_burn", scan=scan) + t_plant_pulse_plasma_current_ramp_down = mfile.get( + "t_plant_pulse_plasma_current_ramp_down", scan=scan + ) + + # Define a cumulative sum list for each point in the pulse + t_steps = np.cumsum([ + 0, + t_plant_pulse_coil_precharge, + t_plant_pulse_plasma_current_ramp_up, + t_plant_pulse_fusion_ramp, + t_plant_pulse_burn, + t_plant_pulse_plasma_current_ramp_down, + ]) + + stress_times = t_steps[ + :6 + ] # Get the first 6 time points corresponding to the stress profile + + stress_z_cs_self_midplane_profile = np.zeros(6) + for i in range(6): + stress_z_cs_self_midplane_profile[i] = mfile.get( + f"stress_z_cs_self_midplane_profile[{i}]", scan=scan + ) + + # Plot stress vs time + axis.plot( + stress_times, + stress_z_cs_self_midplane_profile / 1e6, + "o-", + linewidth=2, + markersize=8, + label="Midplane Axial Stress", + ) + axis.set_xlabel("Pulse Time (s)") + axis.set_ylabel("Stress (MPa)") + axis.minorticks_on() + axis.legend(loc="best") + axis.set_title("Central Solenoid Stress") + axis.grid(True, alpha=0.3) + + def plot_cs_turn_structure(axis: plt.Axes, fig, mfile: MFile, scan: int): a_cs_turn = mfile.get("a_cs_turn", scan=scan) dz_cs_turn = mfile.get("dz_cs_turn", scan=scan) @@ -9877,8 +9926,8 @@ def plot_cs_turn_structure(axis: plt.Axes, fig, mfile: MFile, scan: int): ) axis.text( - 0.6, - 0.5, + 0.7, + 0.375, textstr_turn, fontsize=9, verticalalignment="bottom", @@ -14447,11 +14496,13 @@ def main_plot( plot_current_profiles_over_time(figs[29].add_subplot(111), m_file, scan) + plot_cs_stress_time_profile(axis=figs[30].add_subplot(311), mfile=m_file, scan=scan) + plot_cs_coil_structure( - figs[30].add_subplot(121, aspect="equal"), figs[30], m_file, scan + figs[30].add_subplot(223, aspect="equal"), figs[30], m_file, scan ) plot_cs_turn_structure( - figs[30].add_subplot(224, aspect="equal"), figs[30], m_file, scan + figs[30].add_subplot(326, aspect="equal"), figs[30], m_file, scan ) plot_first_wall_top_down_cross_section( diff --git a/process/data_structure/pfcoil_variables.py b/process/data_structure/pfcoil_variables.py index a20efcfa4..720e813ae 100644 --- a/process/data_structure/pfcoil_variables.py +++ b/process/data_structure/pfcoil_variables.py @@ -37,6 +37,11 @@ class PFCoilData: stress_z_cs_self_peak_midplane: float = 0.0 """Peak axial stress (z) in central solenoid at midplane due to its own field (when at peak current) (Pa)""" + stress_z_cs_self_midplane_profile: list[float] = field( + default_factory=lambda: np.zeros(6) + ) + """Axial stress (z) in central solenoid at midplane due to its own field at each time point (Pa)""" + sig_hoop: float = 0.0 forc_z_cs_self_peak_midplane: float = 0.0 diff --git a/process/models/pfcoil.py b/process/models/pfcoil.py index 3d7731a2b..71f73afe9 100644 --- a/process/models/pfcoil.py +++ b/process/models/pfcoil.py @@ -2543,6 +2543,13 @@ def outpf(self): f"(b_pf_coil_peak[{k}])", self.data.pf_coil.b_pf_coil_peak[k], ) + for time in range(6): + op.ovarre( + self.mfile, + f"CS coil midplane axial stress at time point {time} (MPa)", + f"(stress_z_cs_self_midplane_profile[{time}])", + self.data.pf_coil.stress_z_cs_self_midplane_profile[time], + ) self.tf_pf_collision_detector() # Central Solenoid, if present @@ -3558,6 +3565,7 @@ def ohcalc(self): self.data.pf_coil.p_pf_coil_resistive_total_flat_top += ( self.data.pf_coil.p_cs_resistive_flat_top ) + self.calculate_cs_self_midplane_axial_stress_time_profile() def calculate_cs_self_peak_magnetic_field( self, @@ -3726,15 +3734,16 @@ def calculate_cs_self_peak_midplane_axial_stress( The first element is the unsmeared axial stress in MPa. The second element is the axial force in newtons (N). - :note: - The axial force is computed using elliptic-integral based terms and the - unsmeared axial stress is obtained by dividing the axial force by - the effective steel area associated with the CS turns. + Notes + ----- + The axial force is computed using elliptic-integral based terms and the + unsmeared axial stress is obtained by dividing the axial force by + the effective steel area associated with the CS turns. References ---------- - - Case Studies in Superconducting Magnets. Boston, MA: Springer US, 2009. - doi: https://doi.org/10.1007/b112047. + [1] Case Studies in Superconducting Magnets. Boston, MA: Springer US, 2009. + doi: https://doi.org/10.1007/b112047. """ # kb term for elliptical integrals # kb2 = SQRT((4.0e0*b**2)/(4.0e0*b**2 + hl**2)) @@ -3781,6 +3790,29 @@ def calculate_cs_self_peak_midplane_axial_stress( return s_axial, forc_z_cs_self_peak_midplane + def calculate_cs_self_midplane_axial_stress_time_profile( + self, + ) -> None: + for time in range(6): + stress_value, _ = self.calculate_cs_self_peak_midplane_axial_stress( + r_cs_outer=self.data.pf_coil.r_pf_coil_outer[ + self.data.pf_coil.n_cs_pf_coils - 1 + ], + r_cs_inner=self.data.pf_coil.r_pf_coil_inner[ + self.data.pf_coil.n_cs_pf_coils - 1 + ], + dz_cs_half=self.data.pf_coil.dz_cs_full / 2.0, + c_cs_peak=( + self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_cs_pf_coils - 1, time + ] + * self.data.pf_coil.n_pf_coil_turns[ + self.data.pf_coil.n_cs_pf_coils - 1 + ] + ), + ) + self.data.pf_coil.stress_z_cs_self_midplane_profile[time] = stress_value + def hoop_stress(self, r): """Calculation of hoop stress of central solenoid.