Skip to content

Commit 4bd7013

Browse files
committed
🚚 Rearrange3
1 parent 8776200 commit 4bd7013

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

bluemira/magnets/tfcoil_designer.py

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -336,42 +336,26 @@ def _derived_values(self, op_config):
336336
strain=self.params.strain.value,
337337
)
338338

339-
def _make_conductor(self, optimisation_params, derived_params, n_WPs, WP_i=0):
340-
# current functionality requires conductors are the same for both WPs
341-
# in future allow for different conductor objects so can vary cable and strands
342-
# between the sets of the winding pack?
343-
stab_strand_config = self.build_config.get("stabilising_strand")
344-
sc_strand_config = self.build_config.get("superconducting_strand")
345-
cable_config = self.build_config.get("cable")
346-
conductor_config = self.build_config.get("conductor")
347-
348-
stab_strand_params = self._check_arrays_match(
349-
n_WPs, stab_strand_config.get("params")
350-
)
351-
sc_strand_params = self._check_arrays_match(
352-
n_WPs, sc_strand_config.get("params")
353-
)
354-
conductor_params = self._check_arrays_match(
355-
n_WPs, conductor_config.get("params")
356-
)
357-
358-
cable_params = self._check_arrays_match(n_WPs, cable_config.get("params"))
339+
def B_TF_r(self, tf_current, r):
340+
"""
341+
Compute the magnetic field generated by the TF coils,
342+
including ripple correction.
359343
360-
stab_strand = self._make_strand(WP_i, stab_strand_config, stab_strand_params)
361-
sc_strand = self._make_strand(WP_i, sc_strand_config, sc_strand_params)
362-
cable = self._make_cable(WP_i, n_WPs)
363-
# param frame optimisation stuff?
364-
result = cable.optimise_n_stab_ths(
365-
t0=optimisation_params["t0"],
366-
tf=optimisation_params["Tau_discharge"],
367-
initial_temperature=derived_params.T_op,
368-
target_temperature=optimisation_params["hotspot_target_temperature"],
369-
B_fun=derived_params.B_fun,
370-
I_fun=derived_params.I_fun,
371-
bounds=[1, 10000],
372-
)
344+
Parameters
345+
----------
346+
tf_current : float
347+
Toroidal field coil current [A].
348+
n_TF : int
349+
Number of toroidal field coils.
350+
r : float
351+
Radial position from the tokamak center [m].
373352
374-
return self._make_conductor_cls(cable, WP_i, conductor_config, conductor_params)
353+
Returns
354+
-------
355+
float
356+
Magnetic field intensity [T].
357+
"""
358+
return 1.08 * (MU_0_2PI * self.params.n_TF.value * tf_current / r)
375359

376360
def run(self):
377361
"""
@@ -436,27 +420,6 @@ def _check_arrays_match(self, n_WPs, param_list):
436420
"Value should be an integer >= 1."
437421
)
438422

439-
def B_TF_r(self, tf_current, r):
440-
"""
441-
Compute the magnetic field generated by the TF coils,
442-
including ripple correction.
443-
444-
Parameters
445-
----------
446-
tf_current : float
447-
Toroidal field coil current [A].
448-
n_TF : int
449-
Number of toroidal field coils.
450-
r : float
451-
Radial position from the tokamak center [m].
452-
453-
Returns
454-
-------
455-
float
456-
Magnetic field intensity [T].
457-
"""
458-
return 1.08 * (MU_0_2PI * self.params.n_TF.value * tf_current / r)
459-
460423
def _make_strand(self, i_WP, config, params):
461424
cls_name = config["class"]
462425
stab_strand_cls = get_class_from_module(
@@ -545,6 +508,43 @@ def _make_conductor_cls(self, cable, i_WP, config, params):
545508
),
546509
)
547510

511+
def _make_conductor(self, optimisation_params, derived_params, n_WPs, WP_i=0):
512+
# current functionality requires conductors are the same for both WPs
513+
# in future allow for different conductor objects so can vary cable and strands
514+
# between the sets of the winding pack?
515+
stab_strand_config = self.build_config.get("stabilising_strand")
516+
sc_strand_config = self.build_config.get("superconducting_strand")
517+
cable_config = self.build_config.get("cable")
518+
conductor_config = self.build_config.get("conductor")
519+
520+
stab_strand_params = self._check_arrays_match(
521+
n_WPs, stab_strand_config.get("params")
522+
)
523+
sc_strand_params = self._check_arrays_match(
524+
n_WPs, sc_strand_config.get("params")
525+
)
526+
conductor_params = self._check_arrays_match(
527+
n_WPs, conductor_config.get("params")
528+
)
529+
530+
cable_params = self._check_arrays_match(n_WPs, cable_config.get("params"))
531+
532+
stab_strand = self._make_strand(WP_i, stab_strand_config, stab_strand_params)
533+
sc_strand = self._make_strand(WP_i, sc_strand_config, sc_strand_params)
534+
cable = self._make_cable(WP_i, n_WPs)
535+
# param frame optimisation stuff?
536+
result = cable.optimise_n_stab_ths(
537+
t0=optimisation_params["t0"],
538+
tf=optimisation_params["Tau_discharge"],
539+
initial_temperature=derived_params.T_op,
540+
target_temperature=optimisation_params["hotspot_target_temperature"],
541+
B_fun=derived_params.B_fun,
542+
I_fun=derived_params.I_fun,
543+
bounds=[1, 10000],
544+
)
545+
546+
return self._make_conductor_cls(cable, WP_i, conductor_config, conductor_params)
547+
548548
def _make_winding_pack(self, conductor, i_WP, config, params):
549549
cls_name = config["class"]
550550
winding_pack_cls = get_class_from_module(

0 commit comments

Comments
 (0)