From 73bc6f89e8673252abe2d64302f6bb9485584b2d Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 3 Oct 2025 16:08:08 +0100 Subject: [PATCH 1/7] =?UTF-8?q?=F0=9F=94=84=20-=20Rename=20variable=20t=5F?= =?UTF-8?q?turn=5Ftf=5Fis=5Finput=20to=20i=5Fdx=5Ftf=5Fturn=5Fgeneral=5Fin?= =?UTF-8?q?put=20for=20clarity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/tfcoil_variables.py | 6 +++--- process/init.py | 8 ++++---- process/superconducting_tf_coil.py | 2 +- tests/unit/test_sctfcoil.py | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index 53792a570d..e1b02fd267 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -126,7 +126,7 @@ """ -t_turn_tf_is_input: bool = None +i_dx_tf_turn_general_input: bool = None """Boolean switch to activated when the user set the TF coil turn dimensions Not an input """ @@ -1110,7 +1110,7 @@ def init_tfcoil_variables(): global tfc_sidewall_is_fraction global t_conductor global t_turn_tf - global t_turn_tf_is_input + global i_dx_tf_turn_general_input global f_t_turn_tf global t_turn_tf_max global t_cable_tf @@ -1327,7 +1327,7 @@ def init_tfcoil_variables(): t_cable_tf = 0.0 t_cable_tf_is_input = False t_turn_tf = 0.0 - t_turn_tf_is_input = False + i_dx_tf_turn_general_input = False f_t_turn_tf = 1.0 t_turn_tf_max = 0.05 acs = 0.0 diff --git a/process/init.py b/process/init.py index 5645c8d1be..aad5c808c2 100644 --- a/process/init.py +++ b/process/init.py @@ -1051,14 +1051,14 @@ def check_process(inputs): # noqa: ARG001 dr_tf_wp_min=dr_tf_wp_min, ) - # Setting t_turn_tf_is_input to true if t_turn_tf is an input - data_structure.tfcoil_variables.t_turn_tf_is_input = ( + # Setting i_dx_tf_turn_general_input to true if t_turn_tf is an input + data_structure.tfcoil_variables.i_dx_tf_turn_general_input = ( abs(data_structure.tfcoil_variables.t_turn_tf) > 0 ) # Impossible to set the turn size of integer turn option if ( - data_structure.tfcoil_variables.t_turn_tf_is_input + data_structure.tfcoil_variables.i_dx_tf_turn_general_input and data_structure.tfcoil_variables.i_tf_turns_integer == 1 ): raise ProcessValidationError( @@ -1097,7 +1097,7 @@ def check_process(inputs): # noqa: ARG001 # Impossible to set both the TF coil turn and the cable dimension if ( - data_structure.tfcoil_variables.t_turn_tf_is_input + data_structure.tfcoil_variables.i_dx_tf_turn_general_input and data_structure.tfcoil_variables.t_cable_tf_is_input ): raise ProcessValidationError( diff --git a/process/superconducting_tf_coil.py b/process/superconducting_tf_coil.py index 0c7d6416c3..e5f1bd68bd 100644 --- a/process/superconducting_tf_coil.py +++ b/process/superconducting_tf_coil.py @@ -2624,7 +2624,7 @@ def tf_cable_in_conduit_averaged_turn_geometry( """ # Turn dimension is a an input - if tfcoil_variables.t_turn_tf_is_input: + if tfcoil_variables.i_dx_tf_turn_general_input: # Turn area [m2] a_turn = tfcoil_variables.t_turn_tf**2 diff --git a/tests/unit/test_sctfcoil.py b/tests/unit/test_sctfcoil.py index 93aa52c1b8..ca057c4ab0 100644 --- a/tests/unit/test_sctfcoil.py +++ b/tests/unit/test_sctfcoil.py @@ -1233,7 +1233,7 @@ class TfAveragedTurnGeomParam(NamedTuple): t_turn_tf: Any = None - t_turn_tf_is_input: Any = None + i_dx_tf_turn_general_input: Any = None c_tf_turn: Any = None @@ -1283,7 +1283,7 @@ class TfAveragedTurnGeomParam(NamedTuple): layer_ins=0, t_conductor=0, t_turn_tf=0, - t_turn_tf_is_input=False, + i_dx_tf_turn_general_input=False, c_tf_turn=65000, t_cable_tf=0, t_cable_tf_is_input=False, @@ -1309,7 +1309,7 @@ class TfAveragedTurnGeomParam(NamedTuple): layer_ins=0, t_conductor=0.047932469413859431, t_turn_tf=0.049532469413859428, - t_turn_tf_is_input=False, + i_dx_tf_turn_general_input=False, c_tf_turn=65000, t_cable_tf=0, t_cable_tf_is_input=False, @@ -1335,7 +1335,7 @@ class TfAveragedTurnGeomParam(NamedTuple): layer_ins=0, t_conductor=5.712e-02, t_turn_tf=0.05872, - t_turn_tf_is_input=True, + i_dx_tf_turn_general_input=True, c_tf_turn=0, t_cable_tf=0, t_cable_tf_is_input=False, @@ -1361,7 +1361,7 @@ class TfAveragedTurnGeomParam(NamedTuple): layer_ins=0, t_conductor=0.058296, t_turn_tf=0, - t_turn_tf_is_input=False, + i_dx_tf_turn_general_input=False, c_tf_turn=0, t_cable_tf=0.042, t_cable_tf_is_input=True, @@ -1414,8 +1414,8 @@ def test_tf_cable_in_conduit_averaged_turn_geometry( monkeypatch.setattr( tfcoil_variables, - "t_turn_tf_is_input", - tfaveragedturngeomparam.t_turn_tf_is_input, + "i_dx_tf_turn_general_input", + tfaveragedturngeomparam.i_dx_tf_turn_general_input, ) monkeypatch.setattr( From d4785bc9b08b5dc4f08fda5587a58b8ad073ea06 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 3 Oct 2025 16:13:21 +0100 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=94=84=20-=20Updated=20the=20variable?= =?UTF-8?q?=20name=20't=5Fturn=5Ftf'=20to=20'dx=5Ftf=5Fturn=5Fgeneral'=20a?= =?UTF-8?q?cross=20multiple=20files=20to=20enhance=20clarity=20and=20consi?= =?UTF-8?q?stency=20in=20the=20codebase.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eng-models/tf-coil-superconducting.md | 6 +-- documentation/eng-models/tf-coil.md | 4 +- documentation/fusion-devices/stellarator.md | 4 +- .../data/csv_output_large_tokamak_MFILE.DAT | 2 +- examples/data/large_tokamak_1_MFILE.DAT | 2 +- examples/data/large_tokamak_2_MFILE.DAT | 2 +- examples/data/large_tokamak_3_MFILE.DAT | 2 +- examples/data/large_tokamak_4_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/constraints.py | 4 +- process/data_structure/tfcoil_variables.py | 8 ++-- process/init.py | 4 +- process/input.py | 2 +- process/io/obsolete_vars.py | 2 +- process/io/plot_proc.py | 2 +- process/stellarator.py | 20 ++++----- process/superconducting_tf_coil.py | 21 +++++---- process/tf_coil.py | 4 +- .../data/large_tokamak_1_MFILE.DAT | 2 +- .../data/large_tokamak_2_MFILE.DAT | 2 +- .../data/large_tokamak_3_MFILE.DAT | 2 +- .../data/large_tokamak_4_MFILE.DAT | 2 +- .../integration/data/large_tokamak_MFILE.DAT | 2 +- tests/integration/data/scan_2D_MFILE.DAT | 30 ++++++------- tests/regression/input_files/helias_5b.IN.DAT | 2 +- .../input_files/st_regression.IN.DAT | 4 +- .../stellarator_helias_eval.IN.DAT | 2 +- tests/unit/data/large_tokamak_MFILE.DAT | 2 +- tests/unit/test_sctfcoil.py | 44 ++++++++++--------- 30 files changed, 98 insertions(+), 91 deletions(-) diff --git a/documentation/eng-models/tf-coil-superconducting.md b/documentation/eng-models/tf-coil-superconducting.md index a4b8b5c6f8..b0580e47ad 100644 --- a/documentation/eng-models/tf-coil-superconducting.md +++ b/documentation/eng-models/tf-coil-superconducting.md @@ -133,13 +133,13 @@ turns. The number of turns can be parametrized in three different ways : `c_tf_turn`. There is no guarantee that a realistic turn configuration (with all the turn geometrically fitting in the allocated space) or even have an integer number of turn is used with this parametrization. If the turn - thickness `t_turn_tf` or the cable thickness `t_cable_tf` is defined by + thickness `dx_tf_turn_general` or the cable thickness `t_cable_tf` is defined by the user, this parametrization is not selected.

-

- **Turn size parametrization:** the dimension of the turn `t_turn_tf` can be + **Turn size parametrization:** the dimension of the turn `dx_tf_turn_general` can be set by the user. To do so, the user just have to select the following option: - `i_tf_turns_integer = 0` and to set a value to the variable `t_turn_tf`. The + `i_tf_turns_integer = 0` and to set a value to the variable `dx_tf_turn_general`. The area of the corresponding squared turn and the number of turns necessary to fill the WP area is deduced. There is no guarantee that a realistic turn configuration (with all the turn geometrically fitting in the allocated diff --git a/documentation/eng-models/tf-coil.md b/documentation/eng-models/tf-coil.md index ac0b1aa026..11fc73007f 100644 --- a/documentation/eng-models/tf-coil.md +++ b/documentation/eng-models/tf-coil.md @@ -968,11 +968,11 @@ considered/implemented in PROCESS. | `i_tf_turns_integer` | Switch activating the integer turn parametrization
- 0 : Integer number of turns
- 1 : non integer number of turn | - | 0 | - | | `n_tf_wp_layers` | Number of turns in the radial direction (`i_tf_turns_integer = 1` only) | - | 20 | - | | `n_tf_wp_pancakes` | Number of turns in the toroidal direction (`i_tf_turns_integer = 1` only) | - | 10 | - | -| `t_turn_tf` | TF turn squared size | - | No default | m | +| `dx_tf_turn_general` | TF turn squared size | - | No default | m | | `t_cable_tf` | TF cable diameter size | - | No default | m | | `f_t_turn_tf` | f-value for TF turn squared size constraint (icc = 86) | 175 | 1. | m | | `t_turn_tf_max` | Maximum turn squared size for constraint (icc = 86) | - | 0.05 | m | -| `c_tf_turn` | Current per turn
Overwitten if `t_turn_tf` is set by the user | ixc = 60 | $70.10^3$ | A | +| `c_tf_turn` | Current per turn
Overwitten if `dx_tf_turn_general` is set by the user | ixc = 60 | $70.10^3$ | A | | `dx_tf_turn_insulation` | Turn insulation layer thickness | - | $0.8.10^{-3}$ | m | | `dx_tf_turn_steel` | Steekl jacket/conduit thickness | 58 | $8.10^{-3}$ | m | | `dia_tf_turn_coolant_channel` | Helium cooling channel diameter | - | $5.10^{-3}$ | m | diff --git a/documentation/fusion-devices/stellarator.md b/documentation/fusion-devices/stellarator.md index a507c10867..e58de803cf 100644 --- a/documentation/fusion-devices/stellarator.md +++ b/documentation/fusion-devices/stellarator.md @@ -210,7 +210,7 @@ The fully three-dimensional shape of the coils is assumed to be fixed, but the s The stellarator coils are assumed to be superconducting - no resistive coil calculations are performed. The critical field at the superconductor is calculated using circular approximations for the coils in the inductance and field calculations, and the limit is enforced automatically. All superconductor materials that are available for tokamaks are also available for stellarators. The winding pack cross-section is rectangular for the stellarator coils, rather than the two-step cross-section assumed for tokamaks. The coil thicknesses and most of the dimensions of the materials within the coil cross-section are outputs from the model, instead of being inputs as is the case for tokamaks; see the variable descriptor file for details. In addition, certain iteration variables (`dr_tf_inboard`, no. 13; `dr_tf_nose_case`, no. 57; `c_tf_turn`, no. 60 and `dx_tf_inboard_out_toroidal`, no. 77) should not be turned on in the input file as they are calculated self-consistently (`dr_tf_nose_case` is required as input); the code will stop with an error message of this is attempted. -The conduit insulation thickness (`dx_tf_turn_insulation`), as well as the steel thickness around each conductor (`dx_tf_turn_steel`) should be given as input parameters together with the dimension of the conductor area (`t_turn_tf`). +The conduit insulation thickness (`dx_tf_turn_insulation`), as well as the steel thickness around each conductor (`dx_tf_turn_steel`) should be given as input parameters together with the dimension of the conductor area (`dx_tf_turn_general`). stellarator-PROCESS returns a set of parameters for the coil force densities, which are scaled from the reference calculation. @@ -230,7 +230,7 @@ fiooic = 0.78 *Fraction TF coil critical current to operation current (should be v_tf_coil_dump_quench_max_kv = 12.64 * Max voltage across tf coil during quench (kV) t_tf_superconductor_quench = 20 * Dump time (should be iteration variable) dr_tf_nose_case = 0.1 * Thickness TF Coil case (for stellarators: Also for toroidal direction) -t_turn_tf = 0.048 * Dimension conductor area including steel and insulation. Important parameter. +dx_tf_turn_general = 0.048 * Dimension conductor area including steel and insulation. Important parameter. dx_tf_turn_insulation = 0.0015 * Conduit insulation thickness (one side) (m) dx_tf_turn_steel = 0.006 * thickness of steel around each conductor (one side) (m) dx_tf_wp_insulation = 0.1 * insulation on top of winding pack (one side) (m) diff --git a/examples/data/csv_output_large_tokamak_MFILE.DAT b/examples/data/csv_output_large_tokamak_MFILE.DAT index 6c1869a46a..5007d37210 100644 --- a/examples/data/csv_output_large_tokamak_MFILE.DAT +++ b/examples/data/csv_output_large_tokamak_MFILE.DAT @@ -711,7 +711,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2482E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.5709E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.7439E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.7439E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.5839E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 3.9839E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0000E-03 ITV diff --git a/examples/data/large_tokamak_1_MFILE.DAT b/examples/data/large_tokamak_1_MFILE.DAT index 895d75f982..b93816bdb0 100644 --- a/examples/data/large_tokamak_1_MFILE.DAT +++ b/examples/data/large_tokamak_1_MFILE.DAT @@ -708,7 +708,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/examples/data/large_tokamak_2_MFILE.DAT b/examples/data/large_tokamak_2_MFILE.DAT index 153bc0a4f9..4c2cf34cd6 100644 --- a/examples/data/large_tokamak_2_MFILE.DAT +++ b/examples/data/large_tokamak_2_MFILE.DAT @@ -708,7 +708,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/examples/data/large_tokamak_3_MFILE.DAT b/examples/data/large_tokamak_3_MFILE.DAT index 7529ec3f15..138d7f813d 100644 --- a/examples/data/large_tokamak_3_MFILE.DAT +++ b/examples/data/large_tokamak_3_MFILE.DAT @@ -708,7 +708,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/examples/data/large_tokamak_4_MFILE.DAT b/examples/data/large_tokamak_4_MFILE.DAT index 3ac986dac4..bf82e9863e 100644 --- a/examples/data/large_tokamak_4_MFILE.DAT +++ b/examples/data/large_tokamak_4_MFILE.DAT @@ -708,7 +708,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index e1d77b2528..9d375f7dbf 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -670,7 +670,7 @@ Cable_WP_fraction________________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-aiwp)/a_tf_wp_with_insulation)________ 5.29144615941500196e-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil______________________________________________ (n_tf_coil_turns)____________________ 1.55574412294225624e+02 OP - Width_of_turn_including_inter-turn_insulation_(m)________________________ (t_turn_tf)____________________ 5.82428732675677810e-02 OP + Width_of_turn_including_inter-turn_insulation_(m)________________________ (dx_tf_turn_general)____________________ 5.82428732675677810e-02 OP Width_of_conductor_(square)_(m)__________________________________________ (t_conductor)__________________ 5.66428732675677837e-02 OP Width_of_space_inside_conductor_(m)______________________________________ (dx_tf_turn_cable_space_average)______________________ 4.06186532016039326e-02 OP Steel_conduit_thickness_(m)______________________________________________ (dx_tf_turn_steel)_____________________ 8.01211003298192385e-03 diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index cdd794dd89..0e54d8a8a9 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -744,7 +744,7 @@ Cable_WP_fraction________________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-aiwp)/a_tf_wp_with_insulation)________ 5.08389576488017192e-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil______________________________________________ (n_tf_coil_turns)____________________ 1.54382962574717794e+02 OP - Width_of_turn_including_inter-turn_insulation_(m)________________________ (t_turn_tf)____________________ 5.64999376912919751e-02 OP + Width_of_turn_including_inter-turn_insulation_(m)________________________ (dx_tf_turn_general)____________________ 5.64999376912919751e-02 OP Width_of_conductor_(square)_(m)__________________________________________ (t_conductor)__________________ 5.48999376912919779e-02 OP Width_of_space_inside_conductor_(m)______________________________________ (dx_tf_turn_cable_space_average)______________________ 3.83854185774860357e-02 OP Steel_conduit_thickness_(m)______________________________________________ (dx_tf_turn_steel)_____________________ 8.25725955690296935e-03 diff --git a/process/constraints.py b/process/constraints.py index 0d9fc5c766..841ccdcf13 100644 --- a/process/constraints.py +++ b/process/constraints.py @@ -2220,12 +2220,12 @@ def constraint_equation_86(): """Upper limit on the turn edge length in the TF winding pack Author : S Kahn - t_turn_tf: TF coil turn edge length including turn insulation [m] + dx_tf_turn_general: TF coil turn edge length including turn insulation [m] f_t_turn_tf: f-value for TF turn edge length constraint t_turn_tf_max: TF turn edge length including turn insulation upper limit [m] """ cc = ( - data_structure.tfcoil_variables.t_turn_tf + data_structure.tfcoil_variables.dx_tf_turn_general / data_structure.tfcoil_variables.t_turn_tf_max - 1.0 * data_structure.tfcoil_variables.f_t_turn_tf ) diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index e1b02fd267..24bf28c560 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -118,11 +118,11 @@ """Conductor (cable + steel conduit) area averaged dimension [m]""" -t_turn_tf: float = None +dx_tf_turn_general: float = None """TF coil turn edge length including turn insulation [m] If the turn is not a square (i_tf_turns_integer = 1) a squared turn of equivelent size is use to calculated this quantity -If the t_turn_tf is non zero, c_tf_turn is calculated +If the dx_tf_turn_general is non zero, c_tf_turn is calculated """ @@ -1109,7 +1109,7 @@ def init_tfcoil_variables(): global casths_fraction global tfc_sidewall_is_fraction global t_conductor - global t_turn_tf + global dx_tf_turn_general global i_dx_tf_turn_general_input global f_t_turn_tf global t_turn_tf_max @@ -1326,7 +1326,7 @@ def init_tfcoil_variables(): t_conductor = 0.0 t_cable_tf = 0.0 t_cable_tf_is_input = False - t_turn_tf = 0.0 + dx_tf_turn_general = 0.0 i_dx_tf_turn_general_input = False f_t_turn_tf = 1.0 t_turn_tf_max = 0.05 diff --git a/process/init.py b/process/init.py index aad5c808c2..e53fc5b1ac 100644 --- a/process/init.py +++ b/process/init.py @@ -1051,9 +1051,9 @@ def check_process(inputs): # noqa: ARG001 dr_tf_wp_min=dr_tf_wp_min, ) - # Setting i_dx_tf_turn_general_input to true if t_turn_tf is an input + # Setting i_dx_tf_turn_general_input to true if dx_tf_turn_general is an input data_structure.tfcoil_variables.i_dx_tf_turn_general_input = ( - abs(data_structure.tfcoil_variables.t_turn_tf) > 0 + abs(data_structure.tfcoil_variables.dx_tf_turn_general) > 0 ) # Impossible to set the turn size of integer turn option diff --git a/process/input.py b/process/input.py index 9496aad34b..28462cdd14 100644 --- a/process/input.py +++ b/process/input.py @@ -1633,7 +1633,7 @@ def __post_init__(self): "dz_cs_turn_conduit": InputVariable( data_structure.cs_fatigue_variables, float, range=(0.001, 1.0) ), - "t_turn_tf": InputVariable( + "dx_tf_turn_general": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 0.1) ), "t_turn_tf_max": InputVariable( diff --git a/process/io/obsolete_vars.py b/process/io/obsolete_vars.py index 6e37bb316b..0ecc803100 100644 --- a/process/io/obsolete_vars.py +++ b/process/io/obsolete_vars.py @@ -53,7 +53,7 @@ "ddwi": "dr_vv_outboard", "pnuccp": "pnuc_cp", "nuc_pow_dep_tot": "pnuc_tot_blk_sector", - "t_turn": "t_turn_tf", + "t_turn": "dx_tf_turn_general", "ratecdol": "discount_rate", "strtf1": "sig_tf_case", "strtf2": "sig_tf_wp", diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index e149229d3d..b2a418eae5 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -6185,7 +6185,7 @@ def plot_tf_turn(axis, fig, mfile_data, scan: int) -> None: ) elif i_tf_turns_integer == 0: - turn_width = mfile_data.data["t_turn_tf"].get_scan(scan) + turn_width = mfile_data.data["dx_tf_turn_general"].get_scan(scan) cable_space_width = mfile_data.data["dx_tf_turn_cable_space_average"].get_scan( scan ) diff --git a/process/stellarator.py b/process/stellarator.py index 83af2c9a80..acd0a4bd55 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -2561,7 +2561,7 @@ def stcoil(self, output: bool): # # [m] Dimension of square cable space inside insulation # and case of the conduit of each turn - dx_tf_turn_cable_space_average = tfcoil_variables.t_turn_tf - 2.0e0 * ( + dx_tf_turn_cable_space_average = tfcoil_variables.dx_tf_turn_general - 2.0e0 * ( tfcoil_variables.dx_tf_turn_steel + tfcoil_variables.dx_tf_turn_insulation ) # dx_tf_turn_cable_space_average = t_w if dx_tf_turn_cable_space_average < 0: @@ -2643,7 +2643,7 @@ def stcoil(self, output: bool): tfcoil_variables.a_tf_turn_cable_space_no_void * (1.0e0 - tfcoil_variables.f_a_tf_turn_cable_space_extra_void) ) - / (tfcoil_variables.t_turn_tf**2) + / (tfcoil_variables.dx_tf_turn_general**2) * (1.0e0 - tfcoil_variables.f_a_tf_turn_cable_copper) ) # fraction that is SC of wp. # print *, "f_scu. ",f_scu,"Awp min: ",Awp(1) @@ -2666,7 +2666,7 @@ def stcoil(self, output: bool): ) # Maximum field at superconductor surface (T) - wp_width_r_min = max(tfcoil_variables.t_turn_tf**2, wp_width_r_min) + wp_width_r_min = max(tfcoil_variables.dx_tf_turn_general**2, wp_width_r_min) # Recalculate tfcoil_variables.b_tf_inboard_peak_symmetric at the found awp_min: tfcoil_variables.b_tf_inboard_peak_symmetric = self.bmax_from_awp( @@ -2709,7 +2709,7 @@ def stcoil(self, output: bool): coilcurrent * 1.0e6 / a_tf_wp_no_insulation ) # [A/m^2] winding pack current density tfcoil_variables.n_tf_coil_turns = ( - a_tf_wp_no_insulation / (tfcoil_variables.t_turn_tf**2) + a_tf_wp_no_insulation / (tfcoil_variables.dx_tf_turn_general**2) ) # estimated number of turns for a given turn size (not global). Take at least 1. tfcoil_variables.c_tf_turn = ( coilcurrent * 1.0e6 / tfcoil_variables.n_tf_coil_turns @@ -2730,7 +2730,7 @@ def stcoil(self, output: bool): tfcoil_variables.a_tf_coil_wp_turn_insulation = ( tfcoil_variables.n_tf_coil_turns * ( - tfcoil_variables.t_turn_tf**2 + tfcoil_variables.dx_tf_turn_general**2 - tfcoil_variables.a_tf_turn_steel - tfcoil_variables.a_tf_turn_cable_space_no_void ) @@ -3092,7 +3092,7 @@ def stcoil(self, output: bool): 1 - tfcoil_variables.f_a_tf_turn_cable_space_extra_void, tfcoil_variables.tftmp, tfcoil_variables.a_tf_turn_cable_space_no_void, - tfcoil_variables.t_turn_tf**2, + tfcoil_variables.dx_tf_turn_general**2, ) # print *, "Jmax, comparison: ", j_tf_wp_quench_heat_max, " ", jwdgpro2," ",j_tf_wp/j_tf_wp_quench_heat_max, " , tfcoil_variables.t_tf_superconductor_quench: ",t_tf_superconductor_quench, " tfcoil_variables.f_a_tf_turn_cable_copper: ",f_a_tf_turn_cable_copper @@ -3212,7 +3212,7 @@ def stcoil(self, output: bool): r_coil_minor, r_tf_inleg_mid, tfcoil_variables.sig_tf_wp, - tfcoil_variables.t_turn_tf, + tfcoil_variables.dx_tf_turn_general, tfcoil_variables.t_tf_superconductor_quench, tf_total_h_width, tfborev, @@ -3720,7 +3720,7 @@ def stcoil_output( r_coil_minor, r_tf_inleg_mid, sig_tf_wp, - t_turn_tf, + dx_tf_turn_general, t_tf_superconductor_quench, tf_total_h_width, tfborev, @@ -4000,8 +4000,8 @@ def stcoil_output( po.ovarre( self.outfile, "Width of each turn (incl. insulation) (m)", - "(t_turn_tf)", - t_turn_tf, + "(dx_tf_turn_general)", + dx_tf_turn_general, ) po.ovarre( self.outfile, diff --git a/process/superconducting_tf_coil.py b/process/superconducting_tf_coil.py index e5f1bd68bd..10b3b31164 100644 --- a/process/superconducting_tf_coil.py +++ b/process/superconducting_tf_coil.py @@ -2501,7 +2501,7 @@ def tf_cable_in_conduit_integer_turn_geometry( ) # Average turn dimension [m] - tfcoil_variables.t_turn_tf = np.sqrt(dr_tf_turn * dx_tf_turn) + tfcoil_variables.dx_tf_turn_general = np.sqrt(dr_tf_turn * dx_tf_turn) # Number of TF turns n_tf_coil_turns = np.double(n_tf_wp_layers * n_tf_wp_pancakes) @@ -2626,7 +2626,7 @@ def tf_cable_in_conduit_averaged_turn_geometry( # Turn dimension is a an input if tfcoil_variables.i_dx_tf_turn_general_input: # Turn area [m2] - a_turn = tfcoil_variables.t_turn_tf**2 + a_turn = tfcoil_variables.dx_tf_turn_general**2 # Current per turn [A] tfcoil_variables.c_tf_turn = a_turn * j_tf_wp @@ -2634,12 +2634,13 @@ def tf_cable_in_conduit_averaged_turn_geometry( # Turn cable dimension is an input elif tfcoil_variables.t_cable_tf_is_input: # Turn squared dimension [m] - tfcoil_variables.t_turn_tf = tfcoil_variables.t_cable_tf + 2.0e0 * ( - dx_tf_turn_insulation + dx_tf_turn_steel + tfcoil_variables.dx_tf_turn_general = ( + tfcoil_variables.t_cable_tf + + 2.0e0 * (dx_tf_turn_insulation + dx_tf_turn_steel) ) # Turn area [m2] - a_turn = tfcoil_variables.t_turn_tf**2 + a_turn = tfcoil_variables.dx_tf_turn_general**2 # Current per turn [A] tfcoil_variables.c_tf_turn = a_turn * j_tf_wp @@ -2652,11 +2653,15 @@ def tf_cable_in_conduit_averaged_turn_geometry( a_turn = tfcoil_variables.c_tf_turn / j_tf_wp # Dimension of square cross-section of each turn including inter-turn insulation [m] - tfcoil_variables.t_turn_tf = np.sqrt(a_turn) + tfcoil_variables.dx_tf_turn_general = np.sqrt(a_turn) # Square turn assumption - superconducting_tf_coil_variables.dr_tf_turn = tfcoil_variables.t_turn_tf - superconducting_tf_coil_variables.dx_tf_turn = tfcoil_variables.t_turn_tf + superconducting_tf_coil_variables.dr_tf_turn = ( + tfcoil_variables.dx_tf_turn_general + ) + superconducting_tf_coil_variables.dx_tf_turn = ( + tfcoil_variables.dx_tf_turn_general + ) # See derivation in the following document # k:\power plant physics and technology\process\hts\hts coil module for process.docx diff --git a/process/tf_coil.py b/process/tf_coil.py index 9c5ec71b8d..fff7f74344 100644 --- a/process/tf_coil.py +++ b/process/tf_coil.py @@ -1149,8 +1149,8 @@ def outtf(self): po.ovarre( self.outfile, "Width of turn including inter-turn insulation (m)", - "(t_turn_tf)", - tfcoil_variables.t_turn_tf, + "(dx_tf_turn_general)", + tfcoil_variables.dx_tf_turn_general, "OP ", ) po.ovarre( diff --git a/tests/integration/data/large_tokamak_1_MFILE.DAT b/tests/integration/data/large_tokamak_1_MFILE.DAT index 0313148835..c76aa34f0a 100644 --- a/tests/integration/data/large_tokamak_1_MFILE.DAT +++ b/tests/integration/data/large_tokamak_1_MFILE.DAT @@ -707,7 +707,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/tests/integration/data/large_tokamak_2_MFILE.DAT b/tests/integration/data/large_tokamak_2_MFILE.DAT index 1a71b0d07f..334bba70ac 100644 --- a/tests/integration/data/large_tokamak_2_MFILE.DAT +++ b/tests/integration/data/large_tokamak_2_MFILE.DAT @@ -708,7 +708,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/tests/integration/data/large_tokamak_3_MFILE.DAT b/tests/integration/data/large_tokamak_3_MFILE.DAT index 9f6adad6c4..a5474c4985 100644 --- a/tests/integration/data/large_tokamak_3_MFILE.DAT +++ b/tests/integration/data/large_tokamak_3_MFILE.DAT @@ -708,7 +708,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/tests/integration/data/large_tokamak_4_MFILE.DAT b/tests/integration/data/large_tokamak_4_MFILE.DAT index 09897db283..024e6f94e1 100644 --- a/tests/integration/data/large_tokamak_4_MFILE.DAT +++ b/tests/integration/data/large_tokamak_4_MFILE.DAT @@ -708,7 +708,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3656E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4739E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.9223E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.9223E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7623E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1604E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0099E-03 ITV diff --git a/tests/integration/data/large_tokamak_MFILE.DAT b/tests/integration/data/large_tokamak_MFILE.DAT index 1cf005fc1a..66e8a75b85 100644 --- a/tests/integration/data/large_tokamak_MFILE.DAT +++ b/tests/integration/data/large_tokamak_MFILE.DAT @@ -952,7 +952,7 @@ Cable_WP_fraction________________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_ 5.36572232293409002e-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil______________________________________________ (n_tf_coil_turns)______________ 1.57080208524349899e+02 OP - Width_of_turn_including_inter-turn_insulation_(m)________________________ (t_turn_tf)____________________ 5.95643536626516285e-02 OP + Width_of_turn_including_inter-turn_insulation_(m)________________________ (dx_tf_turn_general)____________________ 5.95643536626516285e-02 OP Width_of_conductor_(square)_(m)__________________________________________ (t_conductor)__________________ 5.79643536626516312e-02 OP Width_of_space_inside_conductor_(m)______________________________________ (dx_tf_turn_cable_space_average)_ 4.19600383778606506e-02 OP Steel_conduit_thickness_(m)______________________________________________ (dx_tf_turn_steel)_____________ 8.00215764239549203e-03 diff --git a/tests/integration/data/scan_2D_MFILE.DAT b/tests/integration/data/scan_2D_MFILE.DAT index 5e2f2527ae..88a97816b6 100644 --- a/tests/integration/data/scan_2D_MFILE.DAT +++ b/tests/integration/data/scan_2D_MFILE.DAT @@ -709,7 +709,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2910E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4728E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.7774E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.7774E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6174E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0174E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0000E-03 ITV @@ -1872,7 +1872,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2643E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4446E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.7926E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.7926E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6326E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0137E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0947E-03 ITV @@ -3035,7 +3035,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2475E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4275E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.7852E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.7852E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6252E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 3.9985E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1335E-03 ITV @@ -4198,7 +4198,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2458E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4281E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.7899E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.7899E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6299E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0014E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1427E-03 ITV @@ -5361,7 +5361,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2526E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4390E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8141E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8141E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6541E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0240E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1506E-03 ITV @@ -6524,7 +6524,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2599E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4469E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8549E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8549E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6949E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0589E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1797E-03 ITV @@ -7687,7 +7687,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2584E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4484E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8590E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8590E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6990E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0616E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1874E-03 ITV @@ -8850,7 +8850,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2527E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4315E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8451E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8451E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6851E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0465E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1933E-03 ITV @@ -10013,7 +10013,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2495E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4163E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8278E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8278E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6678E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0301E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1885E-03 ITV @@ -11176,7 +11176,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2487E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4162E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8312E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8312E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6712E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0324E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1944E-03 ITV @@ -12339,7 +12339,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2496E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4306E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8526E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8526E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6926E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0506E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.2099E-03 ITV @@ -13502,7 +13502,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2608E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4446E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8724E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8724E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7124E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0722E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.2008E-03 ITV @@ -14665,7 +14665,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2598E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4447E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8762E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8762E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7162E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0746E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.2077E-03 ITV @@ -15828,7 +15828,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2576E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4281E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8585E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8585E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6985E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0584E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.2007E-03 ITV @@ -16991,7 +16991,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.2561E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.4117E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8398E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8398E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.6798E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.0416E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.1912E-03 ITV diff --git a/tests/regression/input_files/helias_5b.IN.DAT b/tests/regression/input_files/helias_5b.IN.DAT index 8d64d82da0..3c7fe69065 100644 --- a/tests/regression/input_files/helias_5b.IN.DAT +++ b/tests/regression/input_files/helias_5b.IN.DAT @@ -171,7 +171,7 @@ f_a_tf_turn_cable_copper = 0.69 *Copper fraction of cable conductor (TF i_tf_sc_mat = 1 *Switch for superconductor material in tf coils (1: ITER Nb3Sn) tftmp = 4.2 *Peak helium coolant temperature in TF coils and PF coils (k) temp_tf_cryo = 4.2 *Coil temperature for cryogenic plant power calculation (K) -t_turn_tf = 0.056 *Dimension conductor area including steel and insulation. +dx_tf_turn_general = 0.056 *Dimension conductor area including steel and insulation. dx_tf_turn_insulation = 0.002 *Conduit insulation thickness (m) dx_tf_turn_steel = 0.0012 *TF coil conduit case thickness (m) f_a_tf_turn_cable_space_extra_void = 0.3 *Coolant fraction of TF coil leg (i_tf_sup=0) diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index d05f7da51f..c7d351a7ec 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -1110,9 +1110,9 @@ i_tf_turns_integer = 0 *icc = 86 * DESCRIPTION: Constraint equation for limiting the numer of turns in the TF coil * JUSTIFICATION: Turned off, not concerned with number of TF turns -* VARIABLES: t_turn_tf_max. t_turn_tf calculated in-situ +* VARIABLES: t_turn_tf_max. dx_tf_turn_general calculated in-situ -*t_turn_tf = +*dx_tf_turn_general = * DESCRIPTION: TF coil turn edge length including turn insulation [m] * JUSTIFICATION: diff --git a/tests/regression/input_files/stellarator_helias_eval.IN.DAT b/tests/regression/input_files/stellarator_helias_eval.IN.DAT index 5378adc165..07b18d7169 100644 --- a/tests/regression/input_files/stellarator_helias_eval.IN.DAT +++ b/tests/regression/input_files/stellarator_helias_eval.IN.DAT @@ -336,7 +336,7 @@ te0_ecrh_achievable = 14.880956269519242 * maximal central electron temperature *-----------------Tfcoil Variables-----------------* sig_tf_wp_max = 4.e8 * Allowable maximum shear stress (Tresca criterion) in TF coil conduit (Pa) -t_turn_tf = 0.037 * TF coil turn edge length including turn insulation [m] +dx_tf_turn_general = 0.037 * TF coil turn edge length including turn insulation [m] f_a_tf_turn_cable_copper = 0.7630096974258808 * copper fraction of cable conductor (TF coils) i_tf_sc_mat = 8 * Switch for superconductor material in TF coils; ftoroidalgap = 1. * F-value for minimum dx_tf_inboard_out_toroidal (`constraint equation 82`) diff --git a/tests/unit/data/large_tokamak_MFILE.DAT b/tests/unit/data/large_tokamak_MFILE.DAT index 8c9b2d9745..e01ddf22be 100644 --- a/tests/unit/data/large_tokamak_MFILE.DAT +++ b/tests/unit/data/large_tokamak_MFILE.DAT @@ -711,7 +711,7 @@ Cable_WP_fraction_______________________________________________________ ((a_tf_wp_with_insulation-a_tf_wp_steel-a_tf_coil_wp_turn_insulation)/a_tf_wp_with_insulation)_______ 5.3296E-01 Turn_parametrisation____________________________________________________ (i_tf_turns_integer)__________ 0 Number_of_turns_per_TF_coil_____________________________________________ (n_tf_coil_turns)___________________ 1.5197E+02 OP - Width_of_turn_including_inter-turn_insulation_(m)_______________________ (t_turn_tf)___________________ 5.8716E-02 OP + Width_of_turn_including_inter-turn_insulation_(m)_______________________ (dx_tf_turn_general)___________________ 5.8716E-02 OP Width_of_conductor_(square)_(m)_________________________________________ (t_conductor)_________________ 5.7116E-02 OP Width_of_space_inside_conductor_(m)_____________________________________ (dx_tf_turn_cable_space_average)_____________________ 4.1107E-02 OP Steel_conduit_thickness_(m)_____________________________________________ (dx_tf_turn_steel)____________________ 8.0042E-03 ITV diff --git a/tests/unit/test_sctfcoil.py b/tests/unit/test_sctfcoil.py index ca057c4ab0..958be489c9 100644 --- a/tests/unit/test_sctfcoil.py +++ b/tests/unit/test_sctfcoil.py @@ -1003,7 +1003,7 @@ class TfIntegerTurnGeomParam(NamedTuple): t_conductor: Any = None - t_turn_tf: Any = None + dx_tf_turn_general: Any = None c_tf_coil: Any = None @@ -1033,7 +1033,7 @@ class TfIntegerTurnGeomParam(NamedTuple): expected_t_conductor: Any = None - expected_t_turn_tf: Any = None + expected_dx_tf_turn_general: Any = None expected_t_conductor_radial: Any = None @@ -1068,7 +1068,7 @@ class TfIntegerTurnGeomParam(NamedTuple): dx_tf_wp_insulation=0.0080000000000000019, dx_tf_wp_insertion_gap=0.01, t_conductor=0, - t_turn_tf=0, + dx_tf_turn_general=0, c_tf_coil=14805350.287500001, dx_tf_wp_toroidal_min=1.299782604942499, t_conductor_radial=0, @@ -1083,7 +1083,7 @@ class TfIntegerTurnGeomParam(NamedTuple): dx_tf_turn_steel=0.0080000000000000002, dx_tf_turn_insulation=0.002, expected_t_conductor=0.052553108427885735, - expected_t_turn_tf=0.056579413904423038, + expected_dx_tf_turn_general=0.056579413904423038, expected_t_conductor_radial=0.046661087836601015, expected_t_conductor_toroidal=0.059189130247124938, expected_dr_tf_turn_cable_space=0.030661087836601014, @@ -1102,7 +1102,7 @@ class TfIntegerTurnGeomParam(NamedTuple): dx_tf_wp_insulation=0.0080000000000000019, dx_tf_wp_insertion_gap=0.01, t_conductor=0.052553108427885735, - t_turn_tf=0.056579413904423038, + dx_tf_turn_general=0.056579413904423038, c_tf_coil=14805350.287500001, dx_tf_wp_toroidal_min=1.299782604942499, t_conductor_radial=0.046661087836601015, @@ -1117,7 +1117,7 @@ class TfIntegerTurnGeomParam(NamedTuple): dx_tf_turn_steel=0.0080000000000000002, dx_tf_turn_insulation=0.002, expected_t_conductor=0.052553108427885735, - expected_t_turn_tf=0.056579413904423038, + expected_dx_tf_turn_general=0.056579413904423038, expected_t_conductor_radial=0.046661087836601015, expected_t_conductor_toroidal=0.059189130247124938, expected_dr_tf_turn_cable_space=0.030661087836601014, @@ -1179,8 +1179,8 @@ def test_tf_cable_in_conduit_integer_turn_geometry(tfintegerturngeomparam, sctfc assert t_conductor == pytest.approx(tfintegerturngeomparam.expected_t_conductor) - assert tfcoil_variables.t_turn_tf == pytest.approx( - tfintegerturngeomparam.expected_t_turn_tf + assert tfcoil_variables.dx_tf_turn_general == pytest.approx( + tfintegerturngeomparam.expected_dx_tf_turn_general ) assert t_conductor_radial == pytest.approx( @@ -1231,7 +1231,7 @@ class TfAveragedTurnGeomParam(NamedTuple): t_conductor: Any = None - t_turn_tf: Any = None + dx_tf_turn_general: Any = None i_dx_tf_turn_general_input: Any = None @@ -1259,7 +1259,7 @@ class TfAveragedTurnGeomParam(NamedTuple): expected_t_conductor: Any = None - expected_t_turn_tf: Any = None + expected_dx_tf_turn_general: Any = None expected_t_turn_radial: Any = None @@ -1282,7 +1282,7 @@ class TfAveragedTurnGeomParam(NamedTuple): TfAveragedTurnGeomParam( layer_ins=0, t_conductor=0, - t_turn_tf=0, + dx_tf_turn_general=0, i_dx_tf_turn_general_input=False, c_tf_turn=65000, t_cable_tf=0, @@ -1296,7 +1296,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_steel=0.0080000000000000019, dx_tf_turn_insulation=0.00080000000000000004, expected_t_conductor=0.047932469413859431, - expected_t_turn_tf=0.049532469413859428, + expected_dx_tf_turn_general=0.049532469413859428, expected_t_turn_radial=0.049532469413859428, expected_dx_tf_turn=0.049532469413859428, expected_t_cable=0.031932469413859424, @@ -1308,7 +1308,7 @@ class TfAveragedTurnGeomParam(NamedTuple): TfAveragedTurnGeomParam( layer_ins=0, t_conductor=0.047932469413859431, - t_turn_tf=0.049532469413859428, + dx_tf_turn_general=0.049532469413859428, i_dx_tf_turn_general_input=False, c_tf_turn=65000, t_cable_tf=0, @@ -1322,7 +1322,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_steel=0.0080000000000000019, dx_tf_turn_insulation=0.00080000000000000004, expected_t_conductor=0.047932469413859431, - expected_t_turn_tf=0.049532469413859428, + expected_dx_tf_turn_general=0.049532469413859428, expected_t_turn_radial=0.049532469413859428, expected_dx_tf_turn=0.049532469413859428, expected_t_cable=0.031932469413859424, @@ -1334,7 +1334,7 @@ class TfAveragedTurnGeomParam(NamedTuple): TfAveragedTurnGeomParam( layer_ins=0, t_conductor=5.712e-02, - t_turn_tf=0.05872, + dx_tf_turn_general=0.05872, i_dx_tf_turn_general_input=True, c_tf_turn=0, t_cable_tf=0, @@ -1348,7 +1348,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_steel=8.015e-03, dx_tf_turn_insulation=8.0e-4, expected_t_conductor=5.712e-02, - expected_t_turn_tf=0.05872, + expected_dx_tf_turn_general=0.05872, expected_t_turn_radial=0.05872, expected_dx_tf_turn=0.05872, expected_t_cable=0.04109, @@ -1360,7 +1360,7 @@ class TfAveragedTurnGeomParam(NamedTuple): TfAveragedTurnGeomParam( layer_ins=0, t_conductor=0.058296, - t_turn_tf=0, + dx_tf_turn_general=0, i_dx_tf_turn_general_input=False, c_tf_turn=0, t_cable_tf=0.042, @@ -1374,7 +1374,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_steel=8.148e-03, dx_tf_turn_insulation=8.0e-4, expected_t_conductor=0.058296, - expected_t_turn_tf=0.059896, + expected_dx_tf_turn_general=0.059896, expected_t_turn_radial=0.059896, expected_dx_tf_turn=0.059896, expected_t_cable=0.042, @@ -1409,7 +1409,9 @@ def test_tf_cable_in_conduit_averaged_turn_geometry( ) monkeypatch.setattr( - tfcoil_variables, "t_turn_tf", tfaveragedturngeomparam.t_turn_tf + tfcoil_variables, + "dx_tf_turn_general", + tfaveragedturngeomparam.dx_tf_turn_general, ) monkeypatch.setattr( @@ -1472,8 +1474,8 @@ def test_tf_cable_in_conduit_averaged_turn_geometry( tfaveragedturngeomparam.expected_t_conductor ) - assert tfcoil_variables.t_turn_tf == pytest.approx( - tfaveragedturngeomparam.expected_t_turn_tf + assert tfcoil_variables.dx_tf_turn_general == pytest.approx( + tfaveragedturngeomparam.expected_dx_tf_turn_general ) assert superconducting_tf_coil_variables.dr_tf_turn == pytest.approx( From b86a10e8b09f537f10230892cfa673cd28eb9bbb Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 3 Oct 2025 16:30:08 +0100 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=94=84=20-=20Renamed=20variable=20't?= =?UTF-8?q?=5Fcable=5Ftf=5Fis=5Finput'=20to=20'i=5Fdx=5Ftf=5Fturn=5Fcable?= =?UTF-8?q?=5Fspace=5Fgeneral=5Finput'=20for=20improved=20clarity=20and=20?= =?UTF-8?q?consistency=20across=20the=20codebase.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process/data_structure/tfcoil_variables.py | 6 +++--- process/init.py | 8 ++++---- process/superconducting_tf_coil.py | 2 +- tests/unit/test_sctfcoil.py | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index 24bf28c560..1dbf591c7e 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -157,7 +157,7 @@ """ -t_cable_tf_is_input: bool = None +i_dx_tf_turn_cable_space_general_input: bool = None """Boolean switch to activated when the user set the TF coil cable dimensions Not an input """ @@ -1114,7 +1114,7 @@ def init_tfcoil_variables(): global f_t_turn_tf global t_turn_tf_max global t_cable_tf - global t_cable_tf_is_input + global i_dx_tf_turn_cable_space_general_input global acs global cdtfleg global cforce @@ -1325,7 +1325,7 @@ def init_tfcoil_variables(): casths_fraction = 0.06 t_conductor = 0.0 t_cable_tf = 0.0 - t_cable_tf_is_input = False + i_dx_tf_turn_cable_space_general_input = False dx_tf_turn_general = 0.0 i_dx_tf_turn_general_input = False f_t_turn_tf = 1.0 diff --git a/process/init.py b/process/init.py index e53fc5b1ac..483c0afc57 100644 --- a/process/init.py +++ b/process/init.py @@ -1081,14 +1081,14 @@ def check_process(inputs): # noqa: ARG001 "i_diamagnetic_current = 0 should be used with the Sakai plasma current scaling" ) - # Setting t_cable_tf_is_input to true if t_cable_tf is an input - data_structure.tfcoil_variables.t_cable_tf_is_input = ( + # Setting i_dx_tf_turn_cable_space_general_input to true if t_cable_tf is an input + data_structure.tfcoil_variables.i_dx_tf_turn_cable_space_general_input = ( abs(data_structure.tfcoil_variables.t_cable_tf) > 0 ) # Impossible to set the cable size of integer turn option if ( - data_structure.tfcoil_variables.t_cable_tf_is_input + data_structure.tfcoil_variables.i_dx_tf_turn_cable_space_general_input and data_structure.tfcoil_variables.i_tf_turns_integer == 1 ): raise ProcessValidationError( @@ -1098,7 +1098,7 @@ def check_process(inputs): # noqa: ARG001 # Impossible to set both the TF coil turn and the cable dimension if ( data_structure.tfcoil_variables.i_dx_tf_turn_general_input - and data_structure.tfcoil_variables.t_cable_tf_is_input + and data_structure.tfcoil_variables.i_dx_tf_turn_cable_space_general_input ): raise ProcessValidationError( "Impossible to set the TF coil turn and cable size simultaneously" diff --git a/process/superconducting_tf_coil.py b/process/superconducting_tf_coil.py index 10b3b31164..ebc2ad71df 100644 --- a/process/superconducting_tf_coil.py +++ b/process/superconducting_tf_coil.py @@ -2632,7 +2632,7 @@ def tf_cable_in_conduit_averaged_turn_geometry( tfcoil_variables.c_tf_turn = a_turn * j_tf_wp # Turn cable dimension is an input - elif tfcoil_variables.t_cable_tf_is_input: + elif tfcoil_variables.i_dx_tf_turn_cable_space_general_input: # Turn squared dimension [m] tfcoil_variables.dx_tf_turn_general = ( tfcoil_variables.t_cable_tf diff --git a/tests/unit/test_sctfcoil.py b/tests/unit/test_sctfcoil.py index 958be489c9..f02fe67dbb 100644 --- a/tests/unit/test_sctfcoil.py +++ b/tests/unit/test_sctfcoil.py @@ -1239,7 +1239,7 @@ class TfAveragedTurnGeomParam(NamedTuple): t_cable_tf: Any = None - t_cable_tf_is_input: Any = None + i_dx_tf_turn_cable_space_general_input: Any = None a_tf_wp_no_insulation: Any = None @@ -1286,7 +1286,7 @@ class TfAveragedTurnGeomParam(NamedTuple): i_dx_tf_turn_general_input=False, c_tf_turn=65000, t_cable_tf=0, - t_cable_tf_is_input=False, + i_dx_tf_turn_cable_space_general_input=False, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0, dx_tf_turn=0, @@ -1312,7 +1312,7 @@ class TfAveragedTurnGeomParam(NamedTuple): i_dx_tf_turn_general_input=False, c_tf_turn=65000, t_cable_tf=0, - t_cable_tf_is_input=False, + i_dx_tf_turn_cable_space_general_input=False, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0.049532469413859428, dx_tf_turn=0.049532469413859428, @@ -1338,7 +1338,7 @@ class TfAveragedTurnGeomParam(NamedTuple): i_dx_tf_turn_general_input=True, c_tf_turn=0, t_cable_tf=0, - t_cable_tf_is_input=False, + i_dx_tf_turn_cable_space_general_input=False, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0.05872, dx_tf_turn=0.05872, @@ -1364,7 +1364,7 @@ class TfAveragedTurnGeomParam(NamedTuple): i_dx_tf_turn_general_input=False, c_tf_turn=0, t_cable_tf=0.042, - t_cable_tf_is_input=True, + i_dx_tf_turn_cable_space_general_input=True, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0.05872, dx_tf_turn=0.05872, @@ -1430,8 +1430,8 @@ def test_tf_cable_in_conduit_averaged_turn_geometry( monkeypatch.setattr( tfcoil_variables, - "t_cable_tf_is_input", - tfaveragedturngeomparam.t_cable_tf_is_input, + "i_dx_tf_turn_cable_space_general_input", + tfaveragedturngeomparam.i_dx_tf_turn_cable_space_general_input, ) monkeypatch.setattr( From 4a9a230813ab0bf07aa0ddd12ff7b4eac184d0e1 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 3 Oct 2025 16:33:07 +0100 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=94=84=20-=20Renamed=20variable=20't?= =?UTF-8?q?=5Fcable=5Ftf'=20to=20'dx=5Ftf=5Fturn=5Fcable=5Fspace=5Fgeneral?= =?UTF-8?q?'=20for=20improved=20clarity=20and=20consistency=20across=20the?= =?UTF-8?q?=20codebase.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eng-models/tf-coil-superconducting.md | 6 +++--- documentation/eng-models/tf-coil.md | 2 +- process/data_structure/tfcoil_variables.py | 8 ++++---- process/init.py | 4 ++-- process/input.py | 2 +- process/superconducting_tf_coil.py | 2 +- tests/regression/input_files/st_regression.IN.DAT | 4 ++-- tests/unit/test_sctfcoil.py | 14 ++++++++------ 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/documentation/eng-models/tf-coil-superconducting.md b/documentation/eng-models/tf-coil-superconducting.md index b0580e47ad..0869529a23 100644 --- a/documentation/eng-models/tf-coil-superconducting.md +++ b/documentation/eng-models/tf-coil-superconducting.md @@ -133,7 +133,7 @@ turns. The number of turns can be parametrized in three different ways : `c_tf_turn`. There is no guarantee that a realistic turn configuration (with all the turn geometrically fitting in the allocated space) or even have an integer number of turn is used with this parametrization. If the turn - thickness `dx_tf_turn_general` or the cable thickness `t_cable_tf` is defined by + thickness `dx_tf_turn_general` or the cable space thickness `dx_tf_turn_cable_space_general` is defined by the user, this parametrization is not selected.

-

@@ -147,10 +147,10 @@ turns. The number of turns can be parametrized in three different ways : The current per turn `c_tf_turn` will be overwitten.

-

- **Cable size parametrization:** the dimension of the SC cable `t_cable_tf` + **Cable size parametrization:** the dimension of the SC cable `dx_tf_turn_cable_space_general` can be set by the user. To do so, the user just have to select the following option: `i_tf_turns_integer = 0` and to set a value to the variable - `t_cable_tf`. The area of the corresponding squared turn is deduced adding + `dx_tf_turn_cable_space_general`. The area of the corresponding squared turn is deduced adding the steel conduit structure and the turn insulation. The number of turns necessary to fill the WP area is then deduced. There is no guarantee that a realistic turn configuration (with all the turn geometrically fitting in the diff --git a/documentation/eng-models/tf-coil.md b/documentation/eng-models/tf-coil.md index 11fc73007f..4724bad96f 100644 --- a/documentation/eng-models/tf-coil.md +++ b/documentation/eng-models/tf-coil.md @@ -969,7 +969,7 @@ considered/implemented in PROCESS. | `n_tf_wp_layers` | Number of turns in the radial direction (`i_tf_turns_integer = 1` only) | - | 20 | - | | `n_tf_wp_pancakes` | Number of turns in the toroidal direction (`i_tf_turns_integer = 1` only) | - | 10 | - | | `dx_tf_turn_general` | TF turn squared size | - | No default | m | -| `t_cable_tf` | TF cable diameter size | - | No default | m | +| `dx_tf_turn_cable_space_general` | TF cable diameter size | - | No default | m | | `f_t_turn_tf` | f-value for TF turn squared size constraint (icc = 86) | 175 | 1. | m | | `t_turn_tf_max` | Maximum turn squared size for constraint (icc = 86) | - | 0.05 | m | | `c_tf_turn` | Current per turn
Overwitten if `dx_tf_turn_general` is set by the user | ixc = 60 | $70.10^3$ | A | diff --git a/process/data_structure/tfcoil_variables.py b/process/data_structure/tfcoil_variables.py index 1dbf591c7e..9221a19d7c 100644 --- a/process/data_structure/tfcoil_variables.py +++ b/process/data_structure/tfcoil_variables.py @@ -149,11 +149,11 @@ """ -t_cable_tf: float = None +dx_tf_turn_cable_space_general: float = None """TF coil superconducting cable squared/rounded dimensions [m] If the turn is not a square (i_tf_turns_integer = 1) a squared cable of equivelent size is use to calculated this quantity -If the t_cable_tf is non zero, c_tf_turn is calculated +If the dx_tf_turn_cable_space_general is non zero, c_tf_turn is calculated """ @@ -1113,7 +1113,7 @@ def init_tfcoil_variables(): global i_dx_tf_turn_general_input global f_t_turn_tf global t_turn_tf_max - global t_cable_tf + global dx_tf_turn_cable_space_general global i_dx_tf_turn_cable_space_general_input global acs global cdtfleg @@ -1324,7 +1324,7 @@ def init_tfcoil_variables(): dx_tf_side_case_min = 0.0 casths_fraction = 0.06 t_conductor = 0.0 - t_cable_tf = 0.0 + dx_tf_turn_cable_space_general = 0.0 i_dx_tf_turn_cable_space_general_input = False dx_tf_turn_general = 0.0 i_dx_tf_turn_general_input = False diff --git a/process/init.py b/process/init.py index 483c0afc57..b4fff3c9d1 100644 --- a/process/init.py +++ b/process/init.py @@ -1081,9 +1081,9 @@ def check_process(inputs): # noqa: ARG001 "i_diamagnetic_current = 0 should be used with the Sakai plasma current scaling" ) - # Setting i_dx_tf_turn_cable_space_general_input to true if t_cable_tf is an input + # Setting i_dx_tf_turn_cable_space_general_input to true if dx_tf_turn_cable_space_general is an input data_structure.tfcoil_variables.i_dx_tf_turn_cable_space_general_input = ( - abs(data_structure.tfcoil_variables.t_cable_tf) > 0 + abs(data_structure.tfcoil_variables.dx_tf_turn_cable_space_general) > 0 ) # Impossible to set the cable size of integer turn option diff --git a/process/input.py b/process/input.py index 28462cdd14..46ea6775e3 100644 --- a/process/input.py +++ b/process/input.py @@ -1594,7 +1594,7 @@ def __post_init__(self): "t_burn_min": InputVariable( data_structure.constraint_variables, float, range=(0.001, 1000000.0) ), - "t_cable_tf": InputVariable( + "dx_tf_turn_cable_space_general": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 0.1) ), "t_crack_radial": InputVariable( diff --git a/process/superconducting_tf_coil.py b/process/superconducting_tf_coil.py index ebc2ad71df..1d4c71e328 100644 --- a/process/superconducting_tf_coil.py +++ b/process/superconducting_tf_coil.py @@ -2635,7 +2635,7 @@ def tf_cable_in_conduit_averaged_turn_geometry( elif tfcoil_variables.i_dx_tf_turn_cable_space_general_input: # Turn squared dimension [m] tfcoil_variables.dx_tf_turn_general = ( - tfcoil_variables.t_cable_tf + tfcoil_variables.dx_tf_turn_cable_space_general + 2.0e0 * (dx_tf_turn_insulation + dx_tf_turn_steel) ) diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index c7d351a7ec..77f88eb97b 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -1142,11 +1142,11 @@ i_tf_turns_integer = 0 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*t_cable_tf = +*dx_tf_turn_cable_space_general = * DESCRIPTION: TF coil superconducting cable squared/rounded dimensions [m] * If the turn is not a square (i_tf_turns_integer = 1) a squared cable of * equivelent size is use to calculated this quantity -* If the t_cable_tf is non zero, c_tf_turn is calculated +* If the dx_tf_turn_cable_space_general is non zero, c_tf_turn is calculated * Sets the cable space and allows the turn size to be calculated * JUSTIFICATION: Not set, as i_tf_turns_integer = 0 diff --git a/tests/unit/test_sctfcoil.py b/tests/unit/test_sctfcoil.py index f02fe67dbb..e837f3c73a 100644 --- a/tests/unit/test_sctfcoil.py +++ b/tests/unit/test_sctfcoil.py @@ -1237,7 +1237,7 @@ class TfAveragedTurnGeomParam(NamedTuple): c_tf_turn: Any = None - t_cable_tf: Any = None + dx_tf_turn_cable_space_general: Any = None i_dx_tf_turn_cable_space_general_input: Any = None @@ -1285,7 +1285,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_general=0, i_dx_tf_turn_general_input=False, c_tf_turn=65000, - t_cable_tf=0, + dx_tf_turn_cable_space_general=0, i_dx_tf_turn_cable_space_general_input=False, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0, @@ -1311,7 +1311,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_general=0.049532469413859428, i_dx_tf_turn_general_input=False, c_tf_turn=65000, - t_cable_tf=0, + dx_tf_turn_cable_space_general=0, i_dx_tf_turn_cable_space_general_input=False, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0.049532469413859428, @@ -1337,7 +1337,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_general=0.05872, i_dx_tf_turn_general_input=True, c_tf_turn=0, - t_cable_tf=0, + dx_tf_turn_cable_space_general=0, i_dx_tf_turn_cable_space_general_input=False, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0.05872, @@ -1363,7 +1363,7 @@ class TfAveragedTurnGeomParam(NamedTuple): dx_tf_turn_general=0, i_dx_tf_turn_general_input=False, c_tf_turn=0, - t_cable_tf=0.042, + dx_tf_turn_cable_space_general=0.042, i_dx_tf_turn_cable_space_general_input=True, a_tf_wp_no_insulation=0.60510952642236249, dr_tf_turn=0.05872, @@ -1425,7 +1425,9 @@ def test_tf_cable_in_conduit_averaged_turn_geometry( ) monkeypatch.setattr( - tfcoil_variables, "t_cable_tf", tfaveragedturngeomparam.t_cable_tf + tfcoil_variables, + "dx_tf_turn_cable_space_general", + tfaveragedturngeomparam.dx_tf_turn_cable_space_general, ) monkeypatch.setattr( From c45c570e698917378543e9c17672c4851474cb42 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 3 Oct 2025 17:03:44 +0100 Subject: [PATCH 5/7] Refactor tf_cable_in_conduit_averaged_turn_geometry method to improve variable handling and clarity --- process/superconducting_tf_coil.py | 147 ++++++++++++++++------------- 1 file changed, 81 insertions(+), 66 deletions(-) diff --git a/process/superconducting_tf_coil.py b/process/superconducting_tf_coil.py index 1d4c71e328..f60eea9e1b 100644 --- a/process/superconducting_tf_coil.py +++ b/process/superconducting_tf_coil.py @@ -1921,11 +1921,30 @@ def sc_tf_internal_geom(self, i_tf_wp_geom, i_tf_case_geom, i_tf_turns_integer): tfcoil_variables.a_tf_turn_steel, tfcoil_variables.a_tf_turn_insulation, tfcoil_variables.n_tf_coil_turns, + tfcoil_variables.dx_tf_turn_general, + tfcoil_variables.c_tf_turn, + tfcoil_variables.dx_tf_turn_general, + superconducting_tf_coil_variables.dr_tf_turn, + superconducting_tf_coil_variables.dx_tf_turn, + tfcoil_variables.t_conductor, + superconducting_tf_coil_variables.radius_tf_turn_cable_space_corners, + superconducting_tf_coil_variables.dx_tf_turn_cable_space_average, + superconducting_tf_coil_variables.a_tf_turn_cable_space_effective, + superconducting_tf_coil_variables.f_a_tf_turn_cable_space_cooling, ) = self.tf_cable_in_conduit_averaged_turn_geometry( - tfcoil_variables.j_tf_wp, - tfcoil_variables.dx_tf_turn_steel, - tfcoil_variables.dx_tf_turn_insulation, - tfcoil_variables.i_tf_sc_mat, + j_tf_wp=tfcoil_variables.j_tf_wp, + dx_tf_turn_steel=tfcoil_variables.dx_tf_turn_steel, + dx_tf_turn_insulation=tfcoil_variables.dx_tf_turn_insulation, + i_tf_sc_mat=tfcoil_variables.i_tf_sc_mat, + dx_tf_turn_general=tfcoil_variables.dx_tf_turn_general, + c_tf_turn=tfcoil_variables.c_tf_turn, + i_dx_tf_turn_general_input=tfcoil_variables.i_dx_tf_turn_general_input, + i_dx_tf_turn_cable_space_general_input=tfcoil_variables.i_dx_tf_turn_cable_space_general_input, + dx_tf_turn_cable_space_general=tfcoil_variables.dx_tf_turn_cable_space_general, + layer_ins=tfcoil_variables.layer_ins, + a_tf_wp_no_insulation=superconducting_tf_coil_variables.a_tf_wp_no_insulation, + dia_tf_turn_coolant_channel=tfcoil_variables.dia_tf_turn_coolant_channel, + f_a_tf_turn_cable_space_extra_void=tfcoil_variables.f_a_tf_turn_cable_space_extra_void, ) else: @@ -2610,7 +2629,20 @@ def tf_wp_currents(self): ) def tf_cable_in_conduit_averaged_turn_geometry( - self, j_tf_wp, dx_tf_turn_steel, dx_tf_turn_insulation, i_tf_sc_mat + self, + j_tf_wp, + dx_tf_turn_steel, + dx_tf_turn_insulation, + i_tf_sc_mat, + dx_tf_turn_general, + c_tf_turn, + i_dx_tf_turn_general_input, + i_dx_tf_turn_cable_space_general_input, + dx_tf_turn_cable_space_general, + layer_ins, + a_tf_wp_no_insulation, + dia_tf_turn_coolant_channel, + f_a_tf_turn_cable_space_extra_void, ): """ subroutine straight from Python, see comments in tf_averaged_turn_geom_wrapper @@ -2624,59 +2656,51 @@ def tf_cable_in_conduit_averaged_turn_geometry( """ # Turn dimension is a an input - if tfcoil_variables.i_dx_tf_turn_general_input: + if i_dx_tf_turn_general_input: # Turn area [m2] - a_turn = tfcoil_variables.dx_tf_turn_general**2 + a_tf_turn = dx_tf_turn_general**2 # Current per turn [A] - tfcoil_variables.c_tf_turn = a_turn * j_tf_wp + c_tf_turn = a_tf_turn * j_tf_wp # Turn cable dimension is an input - elif tfcoil_variables.i_dx_tf_turn_cable_space_general_input: + elif i_dx_tf_turn_cable_space_general_input: # Turn squared dimension [m] - tfcoil_variables.dx_tf_turn_general = ( - tfcoil_variables.dx_tf_turn_cable_space_general - + 2.0e0 * (dx_tf_turn_insulation + dx_tf_turn_steel) + dx_tf_turn_general = dx_tf_turn_cable_space_general + 2.0e0 * ( + dx_tf_turn_insulation + dx_tf_turn_steel ) # Turn area [m2] - a_turn = tfcoil_variables.dx_tf_turn_general**2 + a_tf_turn = dx_tf_turn_general**2 # Current per turn [A] - tfcoil_variables.c_tf_turn = a_turn * j_tf_wp + c_tf_turn = a_tf_turn * j_tf_wp # Current per turn is an input else: # Turn area [m2] # Allow for additional inter-layer insulation MDK 13/11/18 # Area of turn including conduit and inter-layer insulation - a_turn = tfcoil_variables.c_tf_turn / j_tf_wp + a_tf_turn = c_tf_turn / j_tf_wp # Dimension of square cross-section of each turn including inter-turn insulation [m] - tfcoil_variables.dx_tf_turn_general = np.sqrt(a_turn) + dx_tf_turn_general = np.sqrt(a_tf_turn) # Square turn assumption - superconducting_tf_coil_variables.dr_tf_turn = ( - tfcoil_variables.dx_tf_turn_general - ) - superconducting_tf_coil_variables.dx_tf_turn = ( - tfcoil_variables.dx_tf_turn_general - ) + dr_tf_turn = dx_tf_turn_general + dx_tf_turn = dx_tf_turn_general # See derivation in the following document # k:\power plant physics and technology\process\hts\hts coil module for process.docx - tfcoil_variables.t_conductor = ( - -tfcoil_variables.layer_ins - + np.sqrt(tfcoil_variables.layer_ins**2 + 4.0e00 * a_turn) + t_conductor = ( + -layer_ins + np.sqrt(layer_ins**2 + 4.0e00 * a_tf_turn) ) / 2 - 2.0e0 * dx_tf_turn_insulation # Total number of turns per TF coil (not required to be an integer) - n_tf_coil_turns = ( - superconducting_tf_coil_variables.a_tf_wp_no_insulation / a_turn - ) + n_tf_coil_turns = a_tf_wp_no_insulation / a_tf_turn # Area of inter-turn insulation: single turn [m2] - a_tf_turn_insulation = a_turn - tfcoil_variables.t_conductor**2 + a_tf_turn_insulation = a_tf_turn - t_conductor**2 # NOTE: Fortran has a_tf_turn_cable_space_no_void as an intent(out) variable that was outputting # into tfcoil_variables.a_tf_turn_cable_space_no_void. The local variable, however, appears to @@ -2689,87 +2713,78 @@ def tf_cable_in_conduit_averaged_turn_geometry( # ITER like turn structure if i_tf_sc_mat != 6: # Radius of rounded corners of cable space inside conduit [m] - superconducting_tf_coil_variables.radius_tf_turn_cable_space_corners = ( - dx_tf_turn_steel * 0.75e0 - ) + radius_tf_turn_cable_space_corners = dx_tf_turn_steel * 0.75e0 # Dimension of square cable space inside conduit [m] - superconducting_tf_coil_variables.dx_tf_turn_cable_space_average = ( - tfcoil_variables.t_conductor - 2.0e0 * dx_tf_turn_steel - ) + dx_tf_turn_cable_space_average = t_conductor - 2.0e0 * dx_tf_turn_steel # Cross-sectional area of cable space per turn # taking account of rounded inside corners [m2] a_tf_turn_cable_space_no_void = ( - superconducting_tf_coil_variables.dx_tf_turn_cable_space_average**2 - - (4.0e0 - np.pi) - * superconducting_tf_coil_variables.radius_tf_turn_cable_space_corners - ** 2 + dx_tf_turn_cable_space_average**2 + - (4.0e0 - np.pi) * radius_tf_turn_cable_space_corners**2 ) # Calculate the true effective cable space by taking away the cooling # channel and the extra void fraction - superconducting_tf_coil_variables.a_tf_turn_cable_space_effective = ( + a_tf_turn_cable_space_effective = ( a_tf_turn_cable_space_no_void - # Coolant channel area ( (np.pi / 4.0e0) - * tfcoil_variables.dia_tf_turn_coolant_channel - * tfcoil_variables.dia_tf_turn_coolant_channel + * dia_tf_turn_coolant_channel + * dia_tf_turn_coolant_channel ) # Additional void area deduction - - ( - a_tf_turn_cable_space_no_void - * tfcoil_variables.f_a_tf_turn_cable_space_extra_void - ) + - (a_tf_turn_cable_space_no_void * f_a_tf_turn_cable_space_extra_void) ) - superconducting_tf_coil_variables.f_a_tf_turn_cable_space_cooling = 1 - ( - superconducting_tf_coil_variables.a_tf_turn_cable_space_effective - / a_tf_turn_cable_space_no_void + f_a_tf_turn_cable_space_cooling = 1 - ( + a_tf_turn_cable_space_effective / a_tf_turn_cable_space_no_void ) if a_tf_turn_cable_space_no_void <= 0.0e0: - if tfcoil_variables.t_conductor < 0.0e0: + if t_conductor < 0.0e0: logger.error( f"Negative cable space dimension. {a_tf_turn_cable_space_no_void=} " - f"{superconducting_tf_coil_variables.dx_tf_turn_cable_space_average=}" + f"{dx_tf_turn_cable_space_average=}" ) else: logger.error( "Cable space area problem; artificially set rounded corner radius to 0. " - f"{a_tf_turn_cable_space_no_void=} {superconducting_tf_coil_variables.dx_tf_turn_cable_space_average=}" - ) - superconducting_tf_coil_variables.radius_tf_turn_cable_space_corners = 0.0e0 - a_tf_turn_cable_space_no_void = ( - superconducting_tf_coil_variables.dx_tf_turn_cable_space_average - ** 2 + f"{a_tf_turn_cable_space_no_void=} {dx_tf_turn_cable_space_average=}" ) + radius_tf_turn_cable_space_corners = 0.0e0 + a_tf_turn_cable_space_no_void = dx_tf_turn_cable_space_average**2 # Cross-sectional area of conduit jacket per turn [m2] - a_tf_turn_steel = ( - tfcoil_variables.t_conductor**2 - a_tf_turn_cable_space_no_void - ) + a_tf_turn_steel = t_conductor**2 - a_tf_turn_cable_space_no_void # REBCO turn structure elif i_tf_sc_mat == 6: # Diameter of circular cable space inside conduit [m] - superconducting_tf_coil_variables.dx_tf_turn_cable_space_average = ( - tfcoil_variables.t_conductor - 2.0e0 * dx_tf_turn_steel - ) + dx_tf_turn_cable_space_average = t_conductor - 2.0e0 * dx_tf_turn_steel # Cross-sectional area of conduit jacket per turn [m2] - a_tf_turn_steel = ( - tfcoil_variables.t_conductor**2 - a_tf_turn_cable_space_no_void - ) + a_tf_turn_steel = t_conductor**2 - a_tf_turn_cable_space_no_void return ( a_tf_turn_cable_space_no_void, a_tf_turn_steel, a_tf_turn_insulation, n_tf_coil_turns, + dx_tf_turn_general, + c_tf_turn, + dx_tf_turn_general, + dr_tf_turn, + dx_tf_turn, + t_conductor, + radius_tf_turn_cable_space_corners, + dx_tf_turn_cable_space_average, + a_tf_turn_cable_space_effective, + f_a_tf_turn_cable_space_cooling, ) def superconducting_tf_coil_areas_and_masses(self): From 720091127837bf340cb28fce3161cef4287a9b31 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 9 Oct 2025 13:32:00 +0100 Subject: [PATCH 6/7] =?UTF-8?q?=E2=9C=85=20Update=20unit=20tests=20for=20n?= =?UTF-8?q?ew=20formulation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/test_sctfcoil.py | 128 +++++++++++++----------------------- 1 file changed, 44 insertions(+), 84 deletions(-) diff --git a/tests/unit/test_sctfcoil.py b/tests/unit/test_sctfcoil.py index e837f3c73a..1721252803 100644 --- a/tests/unit/test_sctfcoil.py +++ b/tests/unit/test_sctfcoil.py @@ -1400,115 +1400,75 @@ def test_tf_cable_in_conduit_averaged_turn_geometry( :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr( - tfcoil_variables, "layer_ins", tfaveragedturngeomparam.layer_ins - ) - - monkeypatch.setattr( - tfcoil_variables, "t_conductor", tfaveragedturngeomparam.t_conductor - ) - - monkeypatch.setattr( - tfcoil_variables, - "dx_tf_turn_general", - tfaveragedturngeomparam.dx_tf_turn_general, - ) - - monkeypatch.setattr( - tfcoil_variables, - "i_dx_tf_turn_general_input", - tfaveragedturngeomparam.i_dx_tf_turn_general_input, - ) - - monkeypatch.setattr( - tfcoil_variables, "c_tf_turn", tfaveragedturngeomparam.c_tf_turn - ) - - monkeypatch.setattr( - tfcoil_variables, - "dx_tf_turn_cable_space_general", - tfaveragedturngeomparam.dx_tf_turn_cable_space_general, - ) - - monkeypatch.setattr( - tfcoil_variables, - "i_dx_tf_turn_cable_space_general_input", - tfaveragedturngeomparam.i_dx_tf_turn_cable_space_general_input, - ) - - monkeypatch.setattr( - superconducting_tf_coil_variables, - "a_tf_wp_no_insulation", - tfaveragedturngeomparam.a_tf_wp_no_insulation, - ) - - monkeypatch.setattr( - superconducting_tf_coil_variables, - "dr_tf_turn", - tfaveragedturngeomparam.dr_tf_turn, - ) - - monkeypatch.setattr( - superconducting_tf_coil_variables, - "dx_tf_turn", - tfaveragedturngeomparam.dx_tf_turn, - ) - - monkeypatch.setattr( - superconducting_tf_coil_variables, - "dx_tf_turn_cable_space_average", - tfaveragedturngeomparam.dx_tf_turn_cable_space_average, - ) - ( a_tf_turn_cable_space_no_void, a_tf_turn_steel, a_tf_turn_insulation, n_tf_coil_turns, + dx_tf_turn_general, + c_tf_turn, + dx_tf_turn_general2, + dr_tf_turn, + dx_tf_turn, + t_conductor, + radius_tf_turn_cable_space_corners, + dx_tf_turn_cable_space_average, + a_tf_turn_cable_space_effective, + f_a_tf_turn_cable_space_cooling, ) = sctfcoil.tf_cable_in_conduit_averaged_turn_geometry( - i_tf_sc_mat=tfaveragedturngeomparam.i_tf_sc_mat, j_tf_wp=tfaveragedturngeomparam.j_tf_wp, dx_tf_turn_steel=tfaveragedturngeomparam.dx_tf_turn_steel, dx_tf_turn_insulation=tfaveragedturngeomparam.dx_tf_turn_insulation, - ) - - assert tfcoil_variables.t_conductor == pytest.approx( - tfaveragedturngeomparam.expected_t_conductor - ) - - assert tfcoil_variables.dx_tf_turn_general == pytest.approx( + i_tf_sc_mat=tfaveragedturngeomparam.i_tf_sc_mat, + dx_tf_turn_general=tfaveragedturngeomparam.dx_tf_turn_general, + c_tf_turn=tfaveragedturngeomparam.c_tf_turn, + i_dx_tf_turn_general_input=tfaveragedturngeomparam.i_dx_tf_turn_general_input, + i_dx_tf_turn_cable_space_general_input=tfaveragedturngeomparam.i_dx_tf_turn_cable_space_general_input, + dx_tf_turn_cable_space_general=tfaveragedturngeomparam.dx_tf_turn_cable_space_general, + layer_ins=tfaveragedturngeomparam.layer_ins, + a_tf_wp_no_insulation=tfaveragedturngeomparam.a_tf_wp_no_insulation, + dia_tf_turn_coolant_channel=0.004, + f_a_tf_turn_cable_space_extra_void=0.3, + ) + + # Existing checks + assert t_conductor == pytest.approx(tfaveragedturngeomparam.expected_t_conductor) + assert dx_tf_turn_general == pytest.approx( tfaveragedturngeomparam.expected_dx_tf_turn_general ) - - assert superconducting_tf_coil_variables.dr_tf_turn == pytest.approx( - tfaveragedturngeomparam.expected_t_turn_radial - ) - - assert superconducting_tf_coil_variables.dx_tf_turn == pytest.approx( - tfaveragedturngeomparam.expected_dx_tf_turn - ) - - assert ( - superconducting_tf_coil_variables.dx_tf_turn_cable_space_average - == pytest.approx(tfaveragedturngeomparam.expected_t_cable) + assert dr_tf_turn == pytest.approx(tfaveragedturngeomparam.expected_t_turn_radial) + assert dx_tf_turn == pytest.approx(tfaveragedturngeomparam.expected_dx_tf_turn) + assert dx_tf_turn_cable_space_average == pytest.approx( + tfaveragedturngeomparam.expected_t_cable ) - assert a_tf_turn_cable_space_no_void == pytest.approx( tfaveragedturngeomparam.expected_a_tf_turn_cable_space ) - assert a_tf_turn_steel == pytest.approx( tfaveragedturngeomparam.expected_a_tf_turn_steel ) - assert a_tf_turn_insulation == pytest.approx( tfaveragedturngeomparam.expected_a_tf_turn_insulation ) - assert n_tf_coil_turns == pytest.approx( tfaveragedturngeomparam.expected_n_tf_coil_turns ) + # Expanded checks for unchecked variables + assert radius_tf_turn_cable_space_corners == pytest.approx( + 0.75 * tfaveragedturngeomparam.dx_tf_turn_steel + ) + # c_tf_turn is an input, so just check it matches input if input is used + if ( + not tfaveragedturngeomparam.i_dx_tf_turn_general_input + and tfaveragedturngeomparam.c_tf_turn != 0 + ): + assert c_tf_turn == pytest.approx(tfaveragedturngeomparam.c_tf_turn) + # dx_tf_turn_general2 should match dx_tf_turn_general + assert dx_tf_turn_general2 == pytest.approx(dx_tf_turn_general) + # f_a_tf_turn_cable_space_cooling should be a float between 0 and 1 + assert 0.0 <= f_a_tf_turn_cable_space_cooling <= 1.0 + class TfWpCurrentsParam(NamedTuple): c_tf_total: Any = None From f9647e22b0980a343caa0195528faf91cad8d375 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 9 Oct 2025 13:35:18 +0100 Subject: [PATCH 7/7] Add obsolete variable mappings for 't_cable_tf' and 't_turn_tf' to enhance input validation --- process/io/obsolete_vars.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/process/io/obsolete_vars.py b/process/io/obsolete_vars.py index 0ecc803100..4af269207d 100644 --- a/process/io/obsolete_vars.py +++ b/process/io/obsolete_vars.py @@ -449,6 +449,8 @@ "f_a_cs_steel": "f_a_cs_turn_steel", "t_structural_radial": "dr_cs_turn_conduit", "t_structural_vertical": "dz_cs_turn_conduit", + "t_cable_tf": "dx_tf_turn_cable_space_general", + "t_turn_tf": "dx_tf_turn_general", } OBS_VARS_HELP = {