fiqus 2024.7.0__py3-none-any.whl → 2024.12.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. fiqus/MainFiQuS.py +290 -134
  2. fiqus/data/DataConductor.py +301 -301
  3. fiqus/data/DataFiQuS.py +128 -84
  4. fiqus/data/DataFiQuSCCT.py +150 -150
  5. fiqus/data/DataFiQuSConductor.py +84 -84
  6. fiqus/data/DataFiQuSConductorAC_Strand.py +565 -565
  7. fiqus/data/DataFiQuSMultipole.py +716 -42
  8. fiqus/data/DataFiQuSPancake3D.py +737 -278
  9. fiqus/data/DataMultipole.py +180 -15
  10. fiqus/data/DataRoxieParser.py +90 -51
  11. fiqus/data/DataSettings.py +121 -0
  12. fiqus/data/DataWindingsCCT.py +37 -37
  13. fiqus/data/RegionsModelFiQuS.py +18 -6
  14. fiqus/geom_generators/GeometryCCT.py +905 -905
  15. fiqus/geom_generators/GeometryConductorAC_Strand.py +1391 -1391
  16. fiqus/geom_generators/GeometryMultipole.py +1827 -227
  17. fiqus/geom_generators/GeometryPancake3D.py +316 -117
  18. fiqus/geom_generators/GeometryPancake3DUtils.py +549 -0
  19. fiqus/getdp_runners/RunGetdpCCT.py +4 -4
  20. fiqus/getdp_runners/RunGetdpConductorAC_Strand.py +201 -201
  21. fiqus/getdp_runners/RunGetdpMultipole.py +115 -42
  22. fiqus/getdp_runners/RunGetdpPancake3D.py +28 -6
  23. fiqus/mains/MainCCT.py +2 -2
  24. fiqus/mains/MainConductorAC_Strand.py +132 -132
  25. fiqus/mains/MainMultipole.py +113 -62
  26. fiqus/mains/MainPancake3D.py +63 -23
  27. fiqus/mesh_generators/MeshCCT.py +209 -209
  28. fiqus/mesh_generators/MeshConductorAC_Strand.py +656 -656
  29. fiqus/mesh_generators/MeshMultipole.py +1243 -181
  30. fiqus/mesh_generators/MeshPancake3D.py +275 -192
  31. fiqus/parsers/ParserCOND.py +825 -0
  32. fiqus/parsers/ParserDAT.py +16 -16
  33. fiqus/parsers/ParserGetDPOnSection.py +212 -212
  34. fiqus/parsers/ParserGetDPTimeTable.py +134 -134
  35. fiqus/parsers/ParserMSH.py +53 -53
  36. fiqus/parsers/ParserPOS.py +214 -214
  37. fiqus/parsers/ParserRES.py +142 -142
  38. fiqus/plotters/PlotPythonCCT.py +133 -133
  39. fiqus/plotters/PlotPythonConductorAC.py +855 -855
  40. fiqus/plotters/PlotPythonMultipole.py +18 -18
  41. fiqus/post_processors/PostProcessCCT.py +440 -440
  42. fiqus/post_processors/PostProcessConductorAC.py +49 -49
  43. fiqus/post_processors/PostProcessMultipole.py +353 -229
  44. fiqus/post_processors/PostProcessPancake3D.py +8 -13
  45. fiqus/pre_processors/PreProcessCCT.py +175 -175
  46. fiqus/pro_assemblers/ProAssembler.py +14 -6
  47. fiqus/pro_material_functions/ironBHcurves.pro +246 -246
  48. fiqus/pro_templates/combined/CCT_template.pro +274 -274
  49. fiqus/pro_templates/combined/ConductorAC_template.pro +1025 -1025
  50. fiqus/pro_templates/combined/Multipole_template.pro +1694 -126
  51. fiqus/pro_templates/combined/Pancake3D_template.pro +2294 -1103
  52. fiqus/pro_templates/combined/TSA_materials.pro +162 -0
  53. fiqus/pro_templates/combined/materials.pro +36 -18
  54. fiqus/utils/Utils.py +508 -110
  55. fiqus/utils/update_data_settings.py +33 -0
  56. fiqus-2024.12.1.dist-info/METADATA +132 -0
  57. fiqus-2024.12.1.dist-info/RECORD +84 -0
  58. {fiqus-2024.7.0.dist-info → fiqus-2024.12.1.dist-info}/WHEEL +1 -1
  59. tests/test_FiQuS.py +1 -1
  60. tests/test_geometry_generators.py +101 -2
  61. tests/test_mesh_generators.py +154 -1
  62. tests/test_solvers.py +115 -21
  63. tests/utils/fiqus_test_classes.py +85 -21
  64. tests/utils/generate_reference_files_ConductorAC.py +57 -57
  65. tests/utils/generate_reference_files_Pancake3D.py +4 -5
  66. tests/utils/helpers.py +97 -97
  67. fiqus-2024.7.0.dist-info/METADATA +0 -103
  68. fiqus-2024.7.0.dist-info/RECORD +0 -79
  69. {fiqus-2024.7.0.dist-info → fiqus-2024.12.1.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,5 @@
1
1
  {% import "materials.pro" as materials %}
2
+ {% import "TSA_materials.pro" as TSA_materials %}
2
3
  {# ================================================================================== #}
3
4
  {# ================================================================================== #}
4
5
  {# ================================================================================== #}
@@ -9,6 +10,7 @@
9
10
  // TSA contributions following special indexing to restrict them to one side of the thin
10
11
  // layer split in plus and minus side.
11
12
  {% for i in range(1, NofSets+1) %}
13
+ {% if (type == "electromagnetic") or (type == "thermal") %}
12
14
  {
13
15
  Name BASISFUN_snMinus_<<i>>;
14
16
  NameOfCoef BASISFUN_snMinus_coeff_<<i>>;
@@ -19,30 +21,35 @@
19
21
  {% endif %}
20
22
  Support Region[
21
23
  {
22
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" and type == "electromagnetic" %}
24
+ {% if (dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" and type == "electromagnetic") %}
23
25
  DOM_terminalContactLayerSurface_<<i>>,
24
26
  DOM_terminalContactLayerSurface_<<i+1>>,
25
27
  {% else %}
26
28
  DOM_allInsulationSurface_<<i>>,
27
29
  DOM_allInsulationSurface_<<i+1>>,
28
30
  {% endif %}
31
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient and type == "thermal" %}
32
+ DOM_windingSurfaceMinus_<<i>>,
33
+ DOM_windingSurfaceMinus_<<i+1>>,
34
+ {% endif %}
29
35
  DOM_windingMinus_<<i>>,
30
36
  DOM_windingMinus_<<i+1>>
31
37
  }
32
38
  ];
33
39
  {% if type == "electromagnetic" %}
34
40
  Entity EdgesOf[
35
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
41
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
36
42
  DOM_terminalContactLayerSurface_<<i>>,
37
43
  {% else %}
38
44
  DOM_allInsulationSurface_<<i>>,
39
45
  {% endif %}
40
- Not {DOM_insulationBoundaryCurvesAir, DOM_insulationBoundaryCurvesTerminal, {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %} DOM_terminalContactLayerSurface_<<i-1>>, DOM_insulationSurface {% else %} DOM_allInsulationSurface_<<i-1>> {% endif %}}
46
+ Not {DOM_insulationBoundaryCurvesAir, DOM_insulationBoundaryCurvesTerminal, {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %} DOM_terminalContactLayerSurface_<<i-1>>, DOM_insulationSurface {% else %} DOM_allInsulationSurface_<<i-1>> {% endif %}}
41
47
  ];
42
48
  {% elif type == "thermal" %}
43
49
  Entity NodesOf[
44
- DOM_allInsulationSurface_<<i>>,
45
- Not { DOM_allInsulationSurface_<<i-1>>, DOM_insulationBoundaryCurvesTerminal }
50
+ DOM_allInsulationSurface_<<i>>,
51
+ Not { DOM_allInsulationSurface_<<i-1>>, DOM_insulationBoundaryCurvesTerminal
52
+ }
46
53
  ];
47
54
  {% endif %}
48
55
  }
@@ -57,33 +64,73 @@
57
64
  {% endif %}
58
65
  Support Region[
59
66
  {
60
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" and type == "electromagnetic" %}
67
+ {% if (dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" and type == "electromagnetic") %}
61
68
  DOM_terminalContactLayerSurface_<<i>>,
62
69
  DOM_terminalContactLayerSurface_<<i+1>>,
63
70
  {% else %}
64
71
  DOM_allInsulationSurface_<<i>>,
65
72
  DOM_allInsulationSurface_<<i+1>>,
66
73
  {% endif %}
74
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient and type == "thermal" %}
75
+ DOM_windingSurfacePlus_<<i>>,
76
+ DOM_windingSurfacePlus_<<i+1>>,
77
+ {% endif %}
67
78
  DOM_windingPlus_<<i>>,
68
79
  DOM_windingPlus_<<i+1>>
69
80
  }
70
81
  ];
71
82
  {% if type == "electromagnetic" %}
72
83
  Entity EdgesOf[
73
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
84
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
74
85
  DOM_terminalContactLayerSurface_<<i>>,
75
86
  {% else %}
76
87
  DOM_allInsulationSurface_<<i>>,
77
88
  {% endif %}
78
- Not {DOM_insulationBoundaryCurvesAir, DOM_insulationBoundaryCurvesTerminal, {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %} DOM_terminalContactLayerSurface_<<i-1>>, DOM_insulationSurface {% else %} DOM_allInsulationSurface_<<i-1>> {% endif %}}
89
+ Not {DOM_insulationBoundaryCurvesAir, DOM_insulationBoundaryCurvesTerminal, {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %} DOM_terminalContactLayerSurface_<<i-1>>, DOM_insulationSurface {% else %} DOM_allInsulationSurface_<<i-1>> {% endif %}}
79
90
  ];
80
91
  {% elif type == "thermal" %}
81
92
  Entity NodesOf[
82
- DOM_allInsulationSurface_<<i>>,
83
- Not { DOM_allInsulationSurface_<<i-1>>, DOM_insulationBoundaryCurvesTerminal }
84
- ];
93
+ DOM_allInsulationSurface_<<i>>,
94
+ Not { DOM_allInsulationSurface_<<i-1>>, DOM_insulationBoundaryCurvesTerminal
95
+ }
96
+ ];
85
97
  {% endif %}
86
98
  }
99
+ {% elif type == "thermal_adiabatic_half_tsa_minus" %}
100
+
101
+ {
102
+ Name BASISFUN_snMinus_not_connected_<<i>>;
103
+ NameOfCoef BASISFUN_snMinus_not_connected_coeff_<<i>>;
104
+ Function BF_Node;
105
+ Support Region[
106
+ {
107
+ DOM_insulationSurface_<<i>>,
108
+ DOM_insulationSurface_<<i+1>>
109
+ }
110
+ ];
111
+ Entity NodesOf[
112
+ DOM_insulationSurface_<<i>>,
113
+ Not DOM_insulationSurface_<<i-1>>
114
+ ];
115
+ }
116
+
117
+ {% elif type == "thermal_adiabatic_half_tsa_plus" %}
118
+ {
119
+ Name BASISFUN_snPlus_not_connected_<<i>>;
120
+ NameOfCoef BASISFUN_snPlus_not_connected_coeff_<<i>>;
121
+ Function BF_Node;
122
+ Support Region[
123
+ {
124
+ DOM_insulationSurface_<<i>>,
125
+ DOM_insulationSurface_<<i+1>>
126
+ }
127
+ ];
128
+ Entity NodesOf[
129
+ DOM_insulationSurface_<<i>>,
130
+ Not DOM_insulationSurface_<<i-1>>
131
+ ];
132
+ }
133
+ {% endif %}
87
134
  {% endfor %}
88
135
 
89
136
  // TSA basis functions ends ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -92,7 +139,23 @@
92
139
  {# ================================================================================== #}
93
140
  {# ================================================================================== #}
94
141
  {# ================================================================================== #}
95
- {% macro FUNCTIONSPACE_TSASubSpaces(aditionalBasisFunctions=[]) %}
142
+ {% macro FUNCTIONSPACE_CryocoolerTSABasisFunctions() %}
143
+ // Cryocooler TSA basis functions starts ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
144
+ {
145
+ Name BASISFUN_snOutside;
146
+ NameOfCoef BASISFUN_snOutside_coeff;
147
+ Function BF_Node;
148
+ Support DOM_terminalSurfaces;
149
+ Entity NodesOf[ DOM_terminalSurfaces ];
150
+ }
151
+
152
+ // Cryocooler TSA basis functions ends ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
153
+ {% endmacro %}
154
+ {# ================================================================================== #}
155
+ {# ================================================================================== #}
156
+ {# ================================================================================== #}
157
+ {# ================================================================================== #}
158
+ {% macro FUNCTIONSPACE_TSASubSpaces(aditionalBasisFunctions=[], additional_bf_for_adiabatic_tsa=false) %}
96
159
  // TSA subspaces starts ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
97
160
 
98
161
  // identification of the positive and negative side of the contact layer:
@@ -135,6 +198,59 @@
135
198
  };
136
199
  }
137
200
 
201
+ {% if additional_bf_for_adiabatic_tsa %}
202
+ {
203
+ Name SUBSPACE_adiabatic_minus_up;
204
+ NameOfBasisFunction{
205
+ {% for i in range(1, NofSets+1) %}
206
+ {% if loop.last %}
207
+ BASISFUN_snMinus_<<i>>
208
+ {% else %}
209
+ BASISFUN_snMinus_<<i>>,
210
+ {% endif %}
211
+ {% endfor %}
212
+ };
213
+ }
214
+ {
215
+ Name SUBSPACE_adiabatic_minus_down;
216
+ NameOfBasisFunction{
217
+ {% for i in range(1, NofSets+1) %}
218
+ {% if loop.last %}
219
+ BASISFUN_snMinus_not_connected_<<i>>
220
+ {% else %}
221
+ BASISFUN_snMinus_not_connected_<<i>>,
222
+ {% endif %}
223
+ {% endfor %}
224
+ };
225
+ }
226
+
227
+ {
228
+ Name SUBSPACE_adiabatic_plus_up;
229
+ NameOfBasisFunction{
230
+ {% for i in range(1, NofSets+1) %}
231
+ {% if loop.last %}
232
+ BASISFUN_snPlus_<<i>>
233
+ {% else %}
234
+ BASISFUN_snPlus_<<i>>,
235
+ {% endif %}
236
+ {% endfor %}
237
+ };
238
+ }
239
+ {
240
+ Name SUBSPACE_adiabatic_plus_down;
241
+ NameOfBasisFunction{
242
+ {% for i in range(1, NofSets+1) %}
243
+ {% if loop.last %}
244
+ BASISFUN_snPlus_not_connected_<<i>>
245
+ {% else %}
246
+ BASISFUN_snPlus_not_connected_<<i>>,
247
+ {% endif %}
248
+ {% endfor %}
249
+ };
250
+ }
251
+ {% endif %}
252
+
253
+
138
254
  For i In {1:INPUT_NumOfTSAElements - 1}
139
255
  {
140
256
  Name SUBSPACE_tsa~{i};
@@ -153,6 +269,21 @@ For i In {1:INPUT_NumOfTSAElements - 1}
153
269
  {% endfor %}
154
270
  };
155
271
  }
272
+
273
+ {% if additional_bf_for_adiabatic_tsa %}
274
+ {
275
+ Name SUBSPACE_adiabatic_plus_tsa~{i};
276
+ NameOfBasisFunction {
277
+ BASISFUN_snPlus_adiabatic~{i}
278
+ };
279
+ }
280
+ {
281
+ Name SUBSPACE_adiabatic_minus_tsa~{i};
282
+ NameOfBasisFunction {
283
+ BASISFUN_snMinus_adiabatic~{i}
284
+ };
285
+ }
286
+ {% endif %}
156
287
  EndFor
157
288
 
158
289
  // TSA subspaces ends ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -161,6 +292,38 @@ EndFor
161
292
  {# ================================================================================== #}
162
293
  {# ================================================================================== #}
163
294
  {# ================================================================================== #}
295
+ {% macro FUNCTIONSPACE_CryocoolerTSASubSpaces() %}
296
+ // Cryocooler TSA subspaces starts ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
297
+
298
+ // identification of the positive and negative side of the cryocooler lumped mass:
299
+ {
300
+ Name SUBSPACE_cryocooler_inside;
301
+ NameOfBasisFunction{
302
+ BASISFUN_sn
303
+ };
304
+ }
305
+ {
306
+ Name SUBSPACE_cryocooler_outside;
307
+ NameOfBasisFunction{
308
+ BASISFUN_snOutside
309
+ };
310
+ }
311
+
312
+ For i In {1:INPUT_NumOfCryocoolerTSAElements - 1}
313
+ {
314
+ Name SUBSPACE_cryocooler~{i};
315
+ NameOfBasisFunction {
316
+ BASISFUN_cryocooler_sn~{i}
317
+ };
318
+ }
319
+ EndFor
320
+
321
+ // Cryocooler TSA subspaces ends ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
322
+ {% endmacro %}
323
+ {# ================================================================================== #}
324
+ {# ================================================================================== #}
325
+ {# ================================================================================== #}
326
+ {# ================================================================================== #}
164
327
  {% macro FORMULATION_VolumetricQuantities(type) %}
165
328
  // Volumetric quantities starts ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
166
329
  {% if type == "electromagnetic" %}
@@ -186,6 +349,24 @@ EndFor
186
349
  Type Global;
187
350
  NameOfSpace SPACE_hPhi[GLOBALQUANT_V];
188
351
  }
352
+ {% elif type == "electricScalarPotential" %}
353
+ {
354
+ Name LOCALQUANT_electricScalarPotential;
355
+ Type Local;
356
+ NameOfSpace SPACE_electricScalarPotential;
357
+ }
358
+ {
359
+ Name LOCALQUANT_h;
360
+ Type Local;
361
+ NameOfSpace SPACE_hPhi;
362
+ }
363
+ {% if dm.magnet.solve.type == "weaklyCoupled" or dm.magnet.solve.type == "stronglyCoupled" %}
364
+ {
365
+ Name LOCALQUANT_T;
366
+ Type Local;
367
+ NameOfSpace SPACE_temperature;
368
+ }
369
+ {% endif %}
189
370
  {% elif type == "thermal" %}
190
371
  {
191
372
  Name LOCALQUANT_T;
@@ -202,6 +383,25 @@ EndFor
202
383
  {# ================================================================================== #}
203
384
  {# ================================================================================== #}
204
385
  {# ================================================================================== #}
386
+ {% macro FORMULATION_EECircuitQuantities() %}
387
+ // EECircuit quantities starts ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
388
+ {
389
+ Name CIRCUITQUANT_ICircuit;
390
+ Type Global;
391
+ NameOfSpace SPACE_circuit[ICircuit];
392
+ }
393
+ {
394
+ Name CIRCUITQUANT_UCircuit;
395
+ Type Global;
396
+ NameOfSpace SPACE_circuit[UCircuit];
397
+ }
398
+
399
+ // EECircuit quantities ends ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
400
+ {% endmacro %}
401
+ {# ================================================================================== #}
402
+ {# ================================================================================== #}
403
+ {# ================================================================================== #}
404
+ {# ================================================================================== #}
205
405
  {% macro FORMULATION_TSAQuantities(type) %}
206
406
  // TSA quantities starts +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
207
407
  {% if type == "electromagnetic" %}
@@ -224,6 +424,26 @@ EndFor
224
424
  Type Local;
225
425
  NameOfSpace SPACE_hPhi[SUBSPACE_insulationSurface_up];
226
426
  }
427
+ {% elif type == "electricScalarPotential" %}
428
+ {
429
+ Name LOCALQUANT_electricScalarPotentialThinShell~{0};
430
+ Type Local;
431
+ NameOfSpace SPACE_electricScalarPotential[SUBSPACE_insulationSurface_up];
432
+ }
433
+
434
+ For i In{1 : INPUT_NumOfTSAElements - 1}
435
+ {
436
+ Name LOCALQUANT_electricScalarPotentialThinShell~{i};
437
+ Type Local;
438
+ NameOfSpace SPACE_electricScalarPotential[SUBSPACE_tsa~{i}];
439
+ }
440
+ EndFor
441
+
442
+ {
443
+ Name LOCALQUANT_electricScalarPotentialThinShell~{INPUT_NumOfTSAElements};
444
+ Type Local;
445
+ NameOfSpace SPACE_electricScalarPotential[SUBSPACE_insulationSurface_down];
446
+ }
227
447
  {% elif type == "thermal" %}
228
448
  {
229
449
  Name LOCALQUANT_TThinShell~{0};
@@ -244,6 +464,46 @@ EndFor
244
464
  Type Local;
245
465
  NameOfSpace SPACE_temperature[SUBSPACE_insulationSurface_down];
246
466
  }
467
+ {% elif type == "thermal_adiabatic_half_tsa_minus" %}
468
+ {
469
+ Name LOCALQUANT_TThinShell_minus~{0};
470
+ Type Local;
471
+ NameOfSpace SPACE_temperature[SUBSPACE_adiabatic_minus_up];
472
+ }
473
+
474
+ For i In{1 : INPUT_NumOfTSAElements - 1}
475
+ {
476
+ Name LOCALQUANT_TThinShell_minus~{i};
477
+ Type Local;
478
+ NameOfSpace SPACE_temperature[SUBSPACE_adiabatic_minus_tsa~{i}];
479
+ }
480
+ EndFor
481
+
482
+ {
483
+ Name LOCALQUANT_TThinShell_minus~{INPUT_NumOfTSAElements};
484
+ Type Local;
485
+ NameOfSpace SPACE_temperature[SUBSPACE_adiabatic_minus_down];
486
+ }
487
+ {% elif type == "thermal_adiabatic_half_tsa_plus" %}
488
+ {
489
+ Name LOCALQUANT_TThinShell_plus~{0};
490
+ Type Local;
491
+ NameOfSpace SPACE_temperature[SUBSPACE_adiabatic_plus_up];
492
+ }
493
+
494
+ For i In{1 : INPUT_NumOfTSAElements - 1}
495
+ {
496
+ Name LOCALQUANT_TThinShell_plus~{i};
497
+ Type Local;
498
+ NameOfSpace SPACE_temperature[SUBSPACE_adiabatic_plus_tsa~{i}];
499
+ }
500
+ EndFor
501
+
502
+ {
503
+ Name LOCALQUANT_TThinShell_plus~{INPUT_NumOfTSAElements};
504
+ Type Local;
505
+ NameOfSpace SPACE_temperature[SUBSPACE_adiabatic_plus_down];
506
+ }
247
507
  {% else %}
248
508
  <<0/0>>
249
509
  // ERROR: wrong type for FORMULATION_TSAQuantities!
@@ -254,6 +514,34 @@ EndFor
254
514
  {# ================================================================================== #}
255
515
  {# ================================================================================== #}
256
516
  {# ================================================================================== #}
517
+ {% macro FORMULATION_CryocoolerTSAQuantities() %}
518
+ // Cryocooler TSA quantities starts +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
519
+ {
520
+ Name LOCALQUANT_cryocooler_TThinShell~{0};
521
+ Type Local;
522
+ NameOfSpace SPACE_temperature[SUBSPACE_cryocooler_inside];
523
+ }
524
+
525
+ For i In {1:INPUT_NumOfCryocoolerTSAElements-1}
526
+ {
527
+ Name LOCALQUANT_cryocooler_TThinShell~{i};
528
+ Type Local;
529
+ NameOfSpace SPACE_temperature[SUBSPACE_cryocooler~{i}];
530
+ }
531
+ EndFor
532
+
533
+ {
534
+ Name LOCALQUANT_cryocooler_TThinShell~{INPUT_NumOfCryocoolerTSAElements};
535
+ Type Local;
536
+ NameOfSpace SPACE_temperature[SUBSPACE_cryocooler_outside];
537
+ }
538
+
539
+ // Cryocooler TSA quantities ends +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
540
+ {% endmacro %}
541
+ {# ================================================================================== #}
542
+ {# ================================================================================== #}
543
+ {# ================================================================================== #}
544
+ {# ================================================================================== #}
257
545
  {% macro FORMULATION_VolumetricIntegrals(type) %}
258
546
  {% if type == "electromagnetic" %}
259
547
  Integral{
@@ -270,7 +558,7 @@ Integral{
270
558
  Jacobian JAC_vol;
271
559
  Integration Int;
272
560
  }
273
- {% if dm.magnet.solve.wi.superConductor and not dm.magnet.solve.wi.resistivity and type == "electromagnetic" %}
561
+ {% if dm.magnet.solve.winding.superConductor and not dm.magnet.solve.winding.resistivity and type == "electromagnetic" %}
274
562
  Integral
275
563
  {
276
564
  JacNL[d_of_rho_wrt_j_TIMES_j[<<rhoArguments>>] * Dof{d LOCALQUANT_h} , {d LOCALQUANT_h_Derivative} ];
@@ -284,6 +572,11 @@ GlobalTerm{
284
572
  [ Dof{GLOBALQUANT_V}, {GLOBALQUANT_I} ];
285
573
  In DOM_airCuts;
286
574
  }
575
+ {% elif type == "electricScalarPotential" %}
576
+
577
+ Integral { [electricScalarPotential_scalingFactor/rho[<<rhoArguments>>] * Dof{d LOCALQUANT_electricScalarPotential} , {d LOCALQUANT_electricScalarPotential} ];
578
+ In DOM_allConducting; Jacobian JAC_vol; Integration Int; }
579
+
287
580
  {% elif type == "thermal" %}
288
581
  Integral {
289
582
  [ kappa[<<kappaArguments>>] * Dof{d LOCALQUANT_T}, {d LOCALQUANT_T} ];
@@ -297,13 +590,50 @@ Integral {
297
590
  Jacobian JAC_vol;
298
591
  Integration Int;
299
592
  }
300
- {% if dm.magnet.solve.ti.cooling == "cryocooler" %}
593
+ {% if dm.magnet.solve.imposedPowerDensity.power %}
594
+ Integral {
595
+ [ -imposedPowerDensity[XYZ[], $Time], {LOCALQUANT_T} ];
596
+ In DOM_allWindings;
597
+ Jacobian JAC_vol;
598
+ Integration Int;
599
+ }
600
+ {% endif %}
601
+
602
+ {% if dm.magnet.solve.terminals.cooling == "cryocooler" %}
603
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
604
+ {% set cryocooler_quantity = "LOCALQUANT_cryocooler_TThinShell~{INPUT_NumOfCryocoolerTSAElements}" %}
605
+ {% else %}
606
+ {% set cryocooler_quantity = "LOCALQUANT_T" %}
607
+ {% endif %}
301
608
  Integral {
302
609
  // Division by area to compute Watts per meter squared
303
610
  // SurfaceArea function does not allow DOM_*** as argument, so we need to use
304
611
  // the actual ids
305
- [ CFUN_P2vsT2_cryocooler_SHI_SRDE_418D4_T[{LOCALQUANT_T}]/SurfaceArea[]{<< rm.powered['Pancake3D'].surf_in.numbers | join(', ') >>, << rm.powered['Pancake3D'].surf_out.numbers | join(', ') >> }, {LOCALQUANT_T} ];
306
- In Region[{DOM_bottomTerminalSurface, DOM_topTerminalSurface}];
612
+ [ cryocoolerCoolingPower[{<<cryocooler_quantity>>}], {<<cryocooler_quantity>>} ];
613
+ In DOM_terminalSurfaces;
614
+ Jacobian JAC_sur;
615
+ Integration Int;
616
+ }
617
+
618
+ // This Jacobian entry is extremely important for the convergence of the nonlinear solver
619
+ Integral {
620
+ JacNL [ cryocoolerCoolingPowerDerivativeT[{<<cryocooler_quantity>>}] * Dof{<<cryocooler_quantity>>}, {<<cryocooler_quantity>>} ];
621
+ In DOM_terminalSurfaces;
622
+ Jacobian JAC_sur;
623
+ Integration Int;
624
+ }
625
+ {% endif %}
626
+
627
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
628
+ Integral {
629
+ [ <<dm.magnet.solve.convectiveCooling.heatTransferCoefficient>> * Dof{LOCALQUANT_T}, {LOCALQUANT_T} ];
630
+ In DOM_allConvectiveSurface;
631
+ Jacobian JAC_sur;
632
+ Integration Int;
633
+ }
634
+ Integral {
635
+ [ - <<dm.magnet.solve.convectiveCooling.heatTransferCoefficient>> * <<dm.magnet.solve.convectiveCooling.exteriorBathTemperature>>, {LOCALQUANT_T} ];
636
+ In DOM_allConvectiveSurface;
307
637
  Jacobian JAC_sur;
308
638
  Integration Int;
309
639
  }
@@ -317,6 +647,27 @@ Integral {
317
647
  Integration Int;
318
648
  }
319
649
  {% endif %}
650
+ {% endmacro %}
651
+ {# ================================================================================== #}
652
+ {# ================================================================================== #}
653
+ {# ================================================================================== #}
654
+ {# ================================================================================== #}
655
+ {% macro FORMULATION_EECircuitIntegrals() %}
656
+ // U = R * I for resistor as global terms
657
+ GlobalTerm { [Dof{CIRCUITQUANT_UCircuit}, {CIRCUITQUANT_ICircuit}] ; In DOM_circuitResistance; }
658
+ GlobalTerm { [Resistance[] * Dof{CIRCUITQUANT_ICircuit}, {CIRCUITQUANT_ICircuit} ]; In DOM_circuitResistance; }
659
+
660
+ // U = L * dI/dt for inductor as global terms
661
+ GlobalTerm{ [ Dof{CIRCUITQUANT_UCircuit}, {CIRCUITQUANT_ICircuit} ]; In DOM_circuitInductance; }
662
+ GlobalTerm{ DtDof[ Inductance[] * Dof{CIRCUITQUANT_ICircuit}, {CIRCUITQUANT_ICircuit} ]; In DOM_circuitInductance; }
663
+
664
+ // Circuital equations related to circuit netlist
665
+ GlobalEquation{
666
+ Type Network; NameOfConstraint EECircuit_Netlist;
667
+ { Node {GLOBALQUANT_I}; Loop {GLOBALQUANT_V}; Equation {GLOBALQUANT_V}; In DOM_terminalCut; }
668
+ { Node {CIRCUITQUANT_ICircuit}; Loop {CIRCUITQUANT_UCircuit}; Equation {CIRCUITQUANT_UCircuit}; In DOM_circuit; }
669
+ }
670
+
320
671
  {% endmacro %}
321
672
  {# ================================================================================== #}
322
673
  {# ================================================================================== #}
@@ -325,41 +676,63 @@ Integral {
325
676
  {% macro FORMULATION_TSAIntegrals(type) %}
326
677
  {% if type == "electromagnetic" %}
327
678
  {% set quantityName = "LOCALQUANT_hThinShell" %}
679
+ {% set temperatureArgument = "LOCALQUANT_TThinShell" %}
328
680
  {% set functionKey = "electromagnetic" %}
329
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
681
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
330
682
  {% set integrationDomain = "DOM_terminalContactLayerSurface" %}
331
683
  {% else %}
332
684
  {% set integrationDomain = "DOM_allInsulationSurface" %}
333
685
  {% endif %}
334
686
  {% elif type == "thermal" %}
335
687
  {% set quantityName = "LOCALQUANT_TThinShell" %}
688
+ {% set temperatureArgument = "LOCALQUANT_TThinShell" %}
336
689
  {% set functionKey = "thermal" %}
690
+ {% if dm.magnet.solve.heatFlowBetweenTurns %}
337
691
  {% set integrationDomain = "DOM_allInsulationSurface" %}
692
+ {% else %}
693
+ {% set integrationDomain = "DOM_terminalContactLayerSurface" %}
694
+ {% endif %}
695
+ {% elif type == "electricScalarPotential" %}
696
+ {% set quantityName = "LOCALQUANT_electricScalarPotentialThinShell" %}
697
+ {% set temperatureArgument = "LOCALQUANT_TThinShell" %}
698
+ {% set functionKey = "electricScalarPotential" %}
699
+ {% set integrationDomain = "DOM_terminalContactLayerSurface_WithoutNotch" %}
338
700
  {% elif type == "resistiveHeating" %}
339
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
701
+ {% set temperatureArgument = "LOCALQUANT_TThinShell" %}
702
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
340
703
  {% set integrationDomain = "DOM_terminalContactLayerSurface" %}
341
704
  {% else %}
342
705
  {% set integrationDomain = "DOM_allInsulationSurface" %}
343
706
  {% endif %}
707
+ {% elif type == "thermal_adiabatic_half_tsa_minus" %}
708
+ {% set quantityName = "LOCALQUANT_TThinShell_minus" %}
709
+ {% set temperatureArgument = "LOCALQUANT_TThinShell_minus" %}
710
+ {% set functionKey = "thermal" %}
711
+ {% set integrationDomain = "DOM_insulationSurface" %}
712
+ {% elif type == "thermal_adiabatic_half_tsa_plus" %}
713
+ {% set quantityName = "LOCALQUANT_TThinShell_plus" %}
714
+ {% set temperatureArgument = "LOCALQUANT_TThinShell_plus" %}
715
+ {% set functionKey = "thermal" %}
716
+ {% set integrationDomain = "DOM_insulationSurface" %}
344
717
  {% else %}
345
718
  <<0/0>>
346
719
  // ERROR: wrong type for FORMULATION_TSAIntegrals!
347
720
  {% endif %}
348
721
 
349
722
  {% if dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled", "thermal"] %}
350
- {% set temperatureArgument1 = "{LOCALQUANT_TThinShell~{i}}" %}
351
- {% set temperatureArgument2 = "{LOCALQUANT_TThinShell~{i+1}}" %}
723
+ {% set temperatureArgument1 = "{" + temperatureArgument + "~{i}}" %}
724
+ {% set temperatureArgument2 = "{" + temperatureArgument + "~{i+1}}" %}
352
725
  {% elif dm.magnet.solve.type == "electromagnetic" %}
353
726
  {% set temperatureArgument1 = "INPUT_initialTemperature" %}
354
727
  {% set temperatureArgument2 = "INPUT_initialTemperature" %}
355
728
  {% endif %}
356
729
 
357
- {% if type == "electromagnetic" or type == "thermal" %}
730
+ {% if type == "electromagnetic" or type == "thermal" or type == "thermal_adiabatic_half_tsa_minus" or type == "thermal_adiabatic_half_tsa_plus" or type == "electricScalarPotential"%}
358
731
  For i In {0:INPUT_NumOfTSAElements-1}
359
732
  {% for a in range(1,3) %}
360
733
  {% for b in range(1,3) %}
361
734
  Integral {
362
- [
735
+ [ {% if type == "electricScalarPotential" %} electricScalarPotential_scalingFactor * {% endif %}
363
736
  <<functionKey>>MassFunctionNoDta<<a>>b<<b>>[
364
737
  <<temperatureArgument1>>,
365
738
  <<temperatureArgument2>>
@@ -372,7 +745,7 @@ For i In {0:INPUT_NumOfTSAElements-1}
372
745
  }
373
746
 
374
747
  Integral {
375
- [
748
+ [ {% if type == "electricScalarPotential" %} electricScalarPotential_scalingFactor * {% endif %}
376
749
  <<functionKey>>StiffnessFunctiona<<a>>b<<b>>[
377
750
  <<temperatureArgument1>>,
378
751
  <<temperatureArgument2>>
@@ -384,6 +757,7 @@ For i In {0:INPUT_NumOfTSAElements-1}
384
757
  Jacobian JAC_sur;
385
758
  }
386
759
 
760
+ {% if not type == "electricScalarPotential" %}
387
761
  Integral {
388
762
  DtDof[
389
763
  <<functionKey>>MassFunctionDta<<a>>b<<b>>[
@@ -396,6 +770,7 @@ For i In {0:INPUT_NumOfTSAElements-1}
396
770
  Integration Int;
397
771
  Jacobian JAC_sur;
398
772
  }
773
+ {% endif %}
399
774
  {% endfor %}
400
775
  {% endfor %}
401
776
  EndFor
@@ -408,7 +783,7 @@ For i In {0:INPUT_NumOfTSAElements-1}
408
783
  <<temperatureArgument1>>,
409
784
  <<temperatureArgument2>>
410
785
  ] * SquNorm[
411
- ({LOCALQUANT_hThinShell~{i + 1}} - {LOCALQUANT_hThinShell~{i}})/th_ins_k
786
+ ({LOCALQUANT_hThinShell~{i + 1}} - {LOCALQUANT_hThinShell~{i}})/th_terminal_k
412
787
  ],
413
788
  {LOCALQUANT_TThinShell~{i + <<k>> - 1}}
414
789
  ];
@@ -444,6 +819,64 @@ EndFor
444
819
  {# ================================================================================== #}
445
820
  {# ================================================================================== #}
446
821
  {# ================================================================================== #}
822
+ {% macro FORMULATION_CryocoolerTSAIntegrals(type) %}
823
+
824
+ {% set quantityName = "LOCALQUANT_cryocooler_TThinShell" %}
825
+ {% set temperatureArgument = "LOCALQUANT_cryocooler_TThinShell" %}
826
+ {% set functionKey = "thermal" %}
827
+ {% set integrationDomain = "DOM_terminalSurfaces" %}
828
+ {% set temperatureArgument1 = "{" + temperatureArgument + "~{i}}" %}
829
+ {% set temperatureArgument2 = "{" + temperatureArgument + "~{i+1}}" %}
830
+
831
+ For i In {0:INPUT_NumOfCryocoolerTSAElements-1}
832
+ {% for a in range(1,3) %}
833
+ {% for b in range(1,3) %}
834
+ Integral {
835
+ [
836
+ <<functionKey>>MassFunctionNoDta<<a>>b<<b>>[
837
+ <<temperatureArgument1>>,
838
+ <<temperatureArgument2>>
839
+ ] * Dof{d <<quantityName>>~{i + <<a>> - 1}},
840
+ {d <<quantityName>>~{i + <<b>> - 1}}
841
+ ];
842
+ In <<integrationDomain>>;
843
+ Integration Int;
844
+ Jacobian JAC_sur;
845
+ }
846
+
847
+ Integral {
848
+ [
849
+ <<functionKey>>StiffnessFunctiona<<a>>b<<b>>[
850
+ <<temperatureArgument1>>,
851
+ <<temperatureArgument2>>
852
+ ] * Dof{<<quantityName>>~{i + <<a>> - 1}},
853
+ {<<quantityName>>~{i + <<b>> - 1}}
854
+ ];
855
+ In <<integrationDomain>>;
856
+ Integration Int;
857
+ Jacobian JAC_sur;
858
+ }
859
+
860
+ Integral {
861
+ DtDof[
862
+ <<functionKey>>MassFunctionDta<<a>>b<<b>>[
863
+ <<temperatureArgument1>>,
864
+ <<temperatureArgument2>>
865
+ ] * Dof{<<quantityName>>~{i + <<a>> - 1}},
866
+ {<<quantityName>>~{i + <<b>> - 1}}
867
+ ];
868
+ In <<integrationDomain>>;
869
+ Integration Int;
870
+ Jacobian JAC_sur;
871
+ }
872
+ {% endfor %}
873
+ {% endfor %}
874
+ EndFor
875
+ {% endmacro %}
876
+ {# ================================================================================== #}
877
+ {# ================================================================================== #}
878
+ {# ================================================================================== #}
879
+ {# ================================================================================== #}
447
880
  {% macro RESOLUTION_tolerances(systemTolerances, postOperationTolerances, type) %}
448
881
  {% set map_quantity_to_system_name = {
449
882
  "coupledSolutionVector": "SYSTEM_stronglyCoupled",
@@ -504,41 +937,29 @@ IterativeLoopN[
504
937
  INPUT_NLSMaxNumOfIter,
505
938
  INPUT_NLSRelaxFactor,
506
939
  <<RESOLUTION_tolerances(
507
- dm.magnet.solve.nls.systemTolerances,
508
- dm.magnet.solve.nls.postOperationTolerances,
940
+ dm.magnet.solve.nonlinearSolver.systemTolerances,
941
+ dm.magnet.solve.nonlinearSolver.postOperationTolerances,
509
942
  type="nonlinearSolver")|indent(4)>>
510
943
  ]{
511
944
  {% for systemName, solveAfterThisTime in zip(systemNames, solveAfterThisTimes) %}
512
945
  {% if solveAfterThisTime == 0 %}
513
946
  GenerateJac <<systemName>>;
514
- // Print[<<systemName>>];
515
947
  SolveJac <<systemName>>;
516
948
 
517
- GetNormSolution[<<systemName>>, $normOfTheSolutionVector];
518
- Print[{$normOfTheSolutionVector}, Format "Critical: Solution vector norm: %.3g"];
519
-
520
- // PostOperation[POSTOP_CONV_temperature];
521
- // Print[{ $test }, Format "Critical: Temperature at tolerance point: %.3g"];
522
-
523
949
  {% else %}
524
950
  Test[$Time >= <<solveAfterThisTime>>]{
525
951
  GenerateJac <<systemName>>;
526
952
  SolveJac <<systemName>>;
527
- PostOperation[POSTOP_CONV_temperature];
528
- Print[{$test}];
529
953
  }
530
954
  {% endif %}
531
955
  {% endfor %}
532
-
533
- // PostOperation[POSTOP_Ic];
534
- // Print[{ #1 }, Format "Critical: Lowest Ic: %.3g"];
535
-
536
- PostOperation[POSTOP_I];
537
- Print[{ $I }, Format "Critical: I: %.3g"];
538
-
539
- // Test[$I > #1]{
540
- // Print[{10}, Format "Critical: Quench started! %.1g"];
541
- // }
956
+ }
957
+ // Check if the solution is NaN and remove it
958
+ Test[$KSPResidual != $KSPResidual]{
959
+ Print["Critical: Removing NaN solution from the solution vector."];
960
+ {% for systemName in systemNames %}
961
+ RemoveLastSolution[<<systemName>>];
962
+ {% endfor %}
542
963
  }
543
964
  // Nonlinear solver ends +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
544
965
  {% elif type == "linear" %}
@@ -584,13 +1005,22 @@ SetExtrapolationOrder[INPUT_extrapolationOrder];
584
1005
  {# ================================================================================== #}
585
1006
  {# ================================================================================== #}
586
1007
  {% macro RESOLUTION_SaveSolutions(systemNames, solveAfterThisTimes) %}
587
- {% for quantity in dm.magnet.postproc.timeSeriesPlots %}
588
- {% if quantity.quantity == "maximumTemperature" %}
589
- PostOperation[POSTOP_maximumTemperature];
590
- {% endif %}
591
- {% endfor %}
592
- {% if dm.magnet.solve.save %}
593
- {% for quantity in dm.magnet.solve.save %}
1008
+ {% if dm.magnet.postproc.timeSeriesPlots %}
1009
+ {% for quantity in dm.magnet.postproc.timeSeriesPlots %}
1010
+ {% if (quantity.quantity == "maximumTemperature") and (not dm.magnet.solve.stopWhenTemperatureReaches) %}
1011
+ PostOperation[POSTOP_maximumTemperature];
1012
+ {% endif %}
1013
+ {% endfor %}
1014
+ {% endif %}
1015
+ {% if dm.magnet.solve.stopWhenTemperatureReaches %}
1016
+ PostOperation[POSTOP_maximumTemperature];
1017
+ Test[#999 > <<dm.magnet.solve.stopWhenTemperatureReaches>>] {
1018
+ Print["Critical: stop simulation since maximum temperature surpassed threshold"];
1019
+ Break[];
1020
+ }
1021
+ {% endif %}
1022
+ {% if dm.magnet.solve.quantitiesToBeSaved %}
1023
+ {% for quantity in dm.magnet.solve.quantitiesToBeSaved %}
594
1024
  {% if quantity.timesToBeSaved %}
595
1025
  <<RESOLUTION_saveSpecificTimes(
596
1026
  postOperationName = quantity.getdpPostOperationName,
@@ -602,7 +1032,7 @@ SetExtrapolationOrder[INPUT_extrapolationOrder];
602
1032
  {% if solveAfterThisTime == 0 %}
603
1033
  SaveSolution[<<systemName>>];
604
1034
  {% else %}
605
- {% if 'solutionVector' in dm.magnet.solve.t.adaptive.tolerances|map(attribute="quantity") %}
1035
+ {% if 'solutionVector' in dm.magnet.solve.time.adaptiveSteppingSettings.tolerances|map(attribute="quantity") %}
606
1036
  SaveSolution[<<systemName>>];
607
1037
  {% else %}
608
1038
  Test[$Time < <<solveAfterThisTime>>]{
@@ -619,9 +1049,59 @@ Test[$Time < <<solveAfterThisTime>>]{
619
1049
  {# ================================================================================== #}
620
1050
  {# ================================================================================== #}
621
1051
  {# ================================================================================== #}
1052
+ {% macro RESOLUTION_electricScalarPotentialSolver() %}
1053
+ Generate SYSTEM_electricScalarPotential;
1054
+ Solve SYSTEM_electricScalarPotential;
1055
+ SaveSolution SYSTEM_electricScalarPotential;
1056
+
1057
+ {% if dm.quench_detection.voltage_tap_pairs and dm.magnet.solve.voltageTapPositions %}
1058
+ PostOperation[POSTOP_electricScalarPotential_<<dm.magnet.solve.type>>];
1059
+ PostOperation[POSTOP_electricScalarPotential];
1060
+
1061
+ Test[$quenchDetected == 0] {
1062
+ {% for idx, _ in enumerate(dm.quench_detection.voltage_tap_pairs) %}
1063
+
1064
+ Test[$surpassedVoltageThreshold_<<idx>> == 0 && Abs[$voltage_<<idx>>] > <<dm.quench_detection.voltage_thresholds[idx]>>]{
1065
+ Evaluate[$surpassedVoltageThreshold_<<idx>> = 1];
1066
+ Evaluate[$surpassedVoltageThresholdTime_<<idx>> = $Time];
1067
+ Print[{$surpassedVoltageThresholdTime_<<idx>>}, Format "Critical: surpassed dection voltage in voltage tap pair no. <<idx>> at t = %.12g s"];
1068
+ }
1069
+
1070
+ Test[Abs[$voltage_<<idx>>] <= <<dm.quench_detection.voltage_thresholds[idx]>>]{
1071
+ Evaluate[$surpassedVoltageThreshold_<<idx>> = 0];
1072
+ }
1073
+
1074
+ Test[$surpassedVoltageThreshold_<<idx>> == 1 && $Time - $surpassedVoltageThresholdTime_<<idx>> > <<dm.quench_detection.discrimination_times[idx]>>]{
1075
+ Evaluate[$quenchDetected = 1];
1076
+ Evaluate[$quenchDetectionTime = $Time];
1077
+
1078
+ Print[{$quenchDetectionTime}, Format "Critical: detected quench with voltage tap pair no. <<idx>> at t = %.12g s"];
1079
+ }
1080
+ {% endfor %}
1081
+ }
1082
+
1083
+ Test[$quenchDetected == 1] {
1084
+ PostOperation[POSTOP_I];
1085
+ Test[$currentThresholdReached == 0 && $I < <<dm.magnet.solve.EECircuit.stopSimulationAtCurrent>>] {
1086
+ Evaluate[$currentThresholdReached = 1];
1087
+ Evaluate[$currentThresholdReachedTime = $Time];
1088
+ Print[{$currentThresholdReachedTime}, Format "Critical: below stop simulation current at t = %.12g s"];
1089
+ }
1090
+
1091
+ Test[$currentThresholdReached == 1 && $Time - $currentThresholdReachedTime > <<dm.magnet.solve.EECircuit.stopSimulationWaitingTime>>] {
1092
+ Print["Critical: stop simulation due to low current"];
1093
+ Break[];
1094
+ }
1095
+ }
1096
+ {% endif %}
1097
+ {% endmacro %}
1098
+ {# ================================================================================== #}
1099
+ {# ================================================================================== #}
1100
+ {# ================================================================================== #}
1101
+ {# ================================================================================== #}
622
1102
  {% macro RESOLUTION_PostOperations() %}
623
- {% if dm.magnet.solve.save is not none %}
624
- {% for quantity in dm.magnet.solve.save %}
1103
+ {% if dm.magnet.solve.quantitiesToBeSaved is not none %}
1104
+ {% for quantity in dm.magnet.solve.quantitiesToBeSaved %}
625
1105
  {% if not quantity.timesToBeSaved %}
626
1106
  PostOperation[<<quantity.getdpPostOperationName>>];
627
1107
  {% endif %}
@@ -643,16 +1123,15 @@ PostOperation[POSTOP_magneticFieldOnCutPlaneMagnitude];
643
1123
  {# ================================================================================== #}
644
1124
  {% macro RESOLUTION_SolveTransientProblemFixedStepping(systemNames, solveAfterThisTimes=[0,0]) %}
645
1125
  <<RESOLUTION_InitializeSolutions(systemNames)>>
646
- {% set intervals = dm.magnet.solve.t.fixed %}
1126
+ {% set intervals = dm.magnet.solve.time.fixedSteppingSettings %}
647
1127
  {% for interval in intervals %}
648
1128
  TimeLoopTheta[<<interval.startTime>>, <<interval.endTime>>, <<interval.step>>, 1]{
649
1129
  <<RESOLUTION_systemsOfEquationsSolver(
650
1130
  systemNames = systemNames,
651
1131
  type=dm.magnet.solve.systemsOfEquationsType,
652
1132
  solveAfterThisTimes = solveAfterThisTimes)|indent(4)>>
653
- {% if dm.magnet.solve.systemsOfEquationsType == "linear" %}
654
- GetNormSolution[<<systemNames[0]>>, $normOfTheSolutionVector];
655
- Print[{$normOfTheSolutionVector}];
1133
+ {% if dm.magnet.solve.voltageTapPositions %}
1134
+ <<RESOLUTION_electricScalarPotentialSolver()|indent(4)>>
656
1135
  {% endif %}
657
1136
  <<RESOLUTION_SaveSolutions(systemNames, solveAfterThisTimes)|indent(4)>>
658
1137
  }
@@ -672,22 +1151,21 @@ TimeLoopAdaptive[
672
1151
  INPUT_tAdaptiveInitStep,
673
1152
  INPUT_tAdaptiveMinStep,
674
1153
  INPUT_tAdaptiveMaxStep,
675
- "<<dm.magnet.solve.t.adaptive.integrationMethod>>",
1154
+ "<<dm.magnet.solve.time.adaptiveSteppingSettings.integrationMethod>>",
676
1155
  List[INPUT_tAdaptiveBreakPoints],
677
1156
  <<RESOLUTION_tolerances(
678
- dm.magnet.solve.t.adaptive.systemTolerances,
679
- dm.magnet.solve.t.adaptive.postOperationTolerances,
1157
+ dm.magnet.solve.time.adaptiveSteppingSettings.systemTolerances,
1158
+ dm.magnet.solve.time.adaptiveSteppingSettings.postOperationTolerances,
680
1159
  type="timeLoop")|indent(4)>>
681
1160
  ]{
682
1161
  <<RESOLUTION_systemsOfEquationsSolver(
683
1162
  systemNames = systemNames,
684
1163
  type=dm.magnet.solve.systemsOfEquationsType,
685
1164
  solveAfterThisTimes = solveAfterThisTimes)|indent(4)>>
686
- {% if dm.magnet.solve.systemsOfEquationsType == "linear" %}
687
- GetNormSolution[<<systemNames[0]>>, $normOfTheSolutionVector];
688
- Print[{$normOfTheSolutionVector}];
689
- {% endif %}
690
1165
  }{
1166
+ {% if dm.magnet.solve.voltageTapPositions %}
1167
+ <<RESOLUTION_electricScalarPotentialSolver()|indent(4)>>
1168
+ {% endif %}
691
1169
  <<RESOLUTION_SaveSolutions(systemNames, solveAfterThisTimes)|indent(4)>>
692
1170
  }
693
1171
 
@@ -698,9 +1176,9 @@ TimeLoopAdaptive[
698
1176
  {# ================================================================================== #}
699
1177
  {# ================================================================================== #}
700
1178
  {% macro RESOLUTION_SolveTransientProblem(systemNames, solveAfterThisTimes=[0,0]) %}
701
- {% if dm.magnet.solve.t.timeSteppingType == "adaptive" %}
1179
+ {% if dm.magnet.solve.time.timeSteppingType == "adaptive" %}
702
1180
  <<RESOLUTION_SolveTransientProblemAdaptiveStepping(systemNames, solveAfterThisTimes)>>
703
- {% elif dm.magnet.solve.t.timeSteppingType == "fixed" %}
1181
+ {% elif dm.magnet.solve.time.timeSteppingType == "fixed" %}
704
1182
  <<RESOLUTION_SolveTransientProblemFixedStepping(systemNames, solveAfterThisTimes)>>
705
1183
  {% endif %}
706
1184
  {% endmacro %}
@@ -719,9 +1197,19 @@ TimeLoopAdaptive[
719
1197
  format="Default",
720
1198
  name="None",
721
1199
  fileName="None",
1200
+ atGaussPoints=False,
722
1201
  lastTimeStepOnly=False,
723
1202
  appendToExistingFile=False,
1203
+ storeInVariable=False,
724
1204
  noTitle=False) %}
1205
+ {% if dm.magnet.mesh.winding.elementType[0] == "prism" %}
1206
+ {% set noOfGaussPoints = 9 %}
1207
+ {% elif dm.magnet.mesh.winding.elementType[0] == "hexahedron" %}
1208
+ {% set noOfGaussPoints = 6 %}
1209
+ {% elif dm.magnet.mesh.winding.elementType[0] == "tetrahedron" %}
1210
+ {% set noOfGaussPoints = 4 %}
1211
+ {% endif %}
1212
+
725
1213
  Print[
726
1214
  <<quantity>>,
727
1215
  {% if onElementsOf != "None" %}
@@ -745,6 +1233,12 @@ Print[
745
1233
  {% if depth != "None" %}
746
1234
  Depth <<depth>>,
747
1235
  {% endif %}
1236
+ {% if atGaussPoints and noOfGaussPoints %}
1237
+ AtGaussPoints <<noOfGaussPoints>>,
1238
+ {% endif %}
1239
+ {% if storeInVariable %}
1240
+ StoreInVariable $<<storeInVariable>>,
1241
+ {% endif %}
748
1242
  {% if fileName != "None" %}
749
1243
  {% if format == "TimeTable" %}
750
1244
  File "<<fileName>>-<<format>>Format.csv",
@@ -768,8 +1262,8 @@ Print[
768
1262
  {% elif format != "Default" %}
769
1263
  Format <<format>>,
770
1264
  {% endif %}
771
- {% if dm.magnet.solve.save is not none %}
772
- {% for quantityDict in dm.magnet.solve.save %}
1265
+ {% if dm.magnet.solve.quantitiesToBeSaved is not none %}
1266
+ {% for quantityDict in dm.magnet.solve.quantitiesToBeSaved %}
773
1267
  {% if quantityDict.getdpQuantityName == quantity %}
774
1268
  {% if quantityDict.timesToBeSaved %}
775
1269
  AppendToExistingFile 1,
@@ -804,26 +1298,52 @@ Print[
804
1298
  // Physical regions: ===================================================================
805
1299
  //======================================================================================
806
1300
  Group{
807
- {% if dm.magnet.geometry.ii.tsa %}
808
- {% set NofSets = (len(rm.insulator.surf.numbers)/2)|int %}
1301
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
1302
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
1303
+ DOM_innerTerminalAndTransitionNotch_surface = Region[{ <<rm.powered["Pancake3D"].surf_th.numbers[0]>> }];
1304
+ DOM_outerTerminalAndTransitionNotch_surface = Region[{ <<rm.powered["Pancake3D"].surf_th.numbers[1]>> }];
1305
+ {% endif %}
1306
+
1307
+ {% set NofSets = (len(rm.insulator.surf.numbers)/3)|int %}
809
1308
  {% set HalfNofSets = (NofSets/2)|int %}
810
- DOM_allInsulationSurface_0 = Region[{ <<rm.insulator.surf.numbers[-2]>> }];
811
- DOM_allInsulationSurface_0 += Region[{ <<rm.insulator.surf.numbers[-1]>> }];
812
- DOM_terminalContactLayerSurface_0 = Region[{ <<rm.insulator.surf.numbers[-1]>> }];
1309
+ DOM_allInsulationSurface_0 = Region[{ <<rm.insulator.surf.numbers[-3]>>, <<rm.insulator.surf.numbers[-2]>>, <<rm.insulator.surf.numbers[-1]>> }];
1310
+
1311
+ DOM_terminalContactLayerSurface_WithoutNotch_0 = Region[{ <<rm.insulator.surf.numbers[-2]>> }];
1312
+ DOM_terminalContactLayerSurface_Notch_0 = Region[{ <<rm.insulator.surf.numbers[-1]>> }];
1313
+
1314
+ DOM_terminalContactLayerSurface_0 = Region[{ DOM_terminalContactLayerSurface_WithoutNotch_0, DOM_terminalContactLayerSurface_Notch_0 }];
1315
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
1316
+ DOM_insulationSurface_0 = Region[{ <<rm.insulator.surf.numbers[-3]>> }];
1317
+ {% endif %}
813
1318
 
814
1319
  {% for i in range(1, NofSets+2) %}
815
1320
  DOM_windingMinus_<<i>> = Region[{ <<rm.powered["Pancake3D"].vol.numbers[:-2][(i-1)%NofSets]>> }];
816
1321
  DOM_windingPlus_<<i>> = Region[{ <<rm.powered["Pancake3D"].vol.numbers[:-2][(i-1+HalfNofSets)%NofSets]>> }];
1322
+ {% if dm.magnet.solve.voltageTapPositions %}
1323
+ DOM_windingMinus_electricScalarPotential_<<i>> = Region[{ <<rm.powered["Pancake3D"].vol.numbers[:-2][(i-1)%NofSets]>> }];
1324
+ DOM_windingPlus_electricScalarPotential_<<i>> = Region[{ <<rm.powered["Pancake3D"].vol.numbers[:-2][(i-1+HalfNofSets)%NofSets]>> }];
1325
+ {% endif %}
817
1326
 
818
- DOM_allInsulationSurface_<<i>> = Region[{ <<rm.insulator.surf.numbers[(2 * (i-1))%(2 * NofSets)]>> }];
819
- DOM_allInsulationSurface_<<i>> += Region[{ <<rm.insulator.surf.numbers[(2 * (i-1))%(2 * NofSets) + 1]>> }];
1327
+ DOM_allInsulationSurface_<<i>> = Region[{ <<rm.insulator.surf.numbers[(3 * (i-1))%(3 * NofSets)]>> }];
1328
+ DOM_allInsulationSurface_<<i>> += Region[{ <<rm.insulator.surf.numbers[(3 * (i-1))%(3 * NofSets) + 1]>> }];
1329
+ DOM_allInsulationSurface_<<i>> += Region[{ <<rm.insulator.surf.numbers[(3 * (i-1))%(3 * NofSets) + 2]>> }];
820
1330
 
821
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
822
- DOM_terminalContactLayerSurface_<<i>> = Region[{ <<rm.insulator.surf.numbers[(2 * (i-1))%(2 * NofSets) + 1]>> }];
1331
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" or not dm.magnet.solve.heatFlowBetweenTurns %}
1332
+ DOM_terminalContactLayerSurface_WithoutNotch_<<i>> = Region[{ <<rm.insulator.surf.numbers[(3 * (i-1))%(3 * NofSets) + 1]>> }];
1333
+ DOM_terminalContactLayerSurface_Notch_<<i>> = Region[{ <<rm.insulator.surf.numbers[(3 * (i-1))%(3 * NofSets) + 2]>> }];
1334
+ DOM_terminalContactLayerSurface_<<i>> = Region[{ DOM_terminalContactLayerSurface_WithoutNotch_<<i>>, DOM_terminalContactLayerSurface_Notch_<<i>> }];
1335
+ {% endif %}
1336
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
1337
+ DOM_insulationSurface_<<i>> = Region[{ <<rm.insulator.surf.numbers[(3 * (i-1))%(3 * NofSets)]>> }];
1338
+ {% endif %}
1339
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
1340
+ DOM_windingSurfaceMinus_<<i>> = Region[{ <<rm.powered["Pancake3D"].surf_th.numbers[2::][(i-1)%NofSets]>> }];
1341
+ DOM_windingSurfacePlus_<<i>> = Region[{ <<rm.powered["Pancake3D"].surf_th.numbers[2::][(i-1+HalfNofSets)%NofSets]>> }];
823
1342
  {% endif %}
824
1343
 
825
1344
  {% endfor %}
826
1345
 
1346
+
827
1347
  // Add terminals to winding region logic:
828
1348
  // <<rm.powered["Pancake3D"].vol_in.number>>: inner terminal
829
1349
  // <<rm.powered["Pancake3D"].vol_out.number>>: outer terminal
@@ -831,17 +1351,36 @@ Group{
831
1351
  // <<rm.powered["Pancake3D"].vol.numbers[-1]>>: outer layer transition angle
832
1352
  {% for i in range(1, NofSets+2) %}
833
1353
  DOM_windingMinus_<<i>> += Region[{ <<rm.powered["Pancake3D"].vol_in.number>> }];
1354
+ {% if dm.magnet.solve.voltageTapPositions %}
1355
+ DOM_windingMinus_electricScalarPotential_<<i>> += Region[{ <<rm.powered["Pancake3D"].vol_in.number>> }];
1356
+ {% endif %}
834
1357
  DOM_windingMinus_<<i>> += Region[{ <<rm.powered["Pancake3D"].vol.numbers[-2]>> }];
1358
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
1359
+ DOM_windingSurfaceMinus_<<i>> += Region[{ <<rm.powered["Pancake3D"].surf_th.numbers[0]>> }];
1360
+ {% endif %}
835
1361
  {% endfor %}
836
1362
 
837
1363
  {% for i in range(1, NofSets+1) %}
838
1364
  DOM_windingPlus_<<i>> += Region[{ <<rm.powered["Pancake3D"].vol_out.number>> }];
1365
+ {% if dm.magnet.solve.voltageTapPositions %}
1366
+ DOM_windingPlus_electricScalarPotential_<<i>> += Region[{ <<rm.powered["Pancake3D"].vol_out.number>> }];
1367
+ {% endif %}
839
1368
  DOM_windingPlus_<<i>> += Region[{ <<rm.powered["Pancake3D"].vol.numbers[-1]>> }];
1369
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
1370
+ DOM_windingSurfacePlus_<<i>> += Region[{ <<rm.powered["Pancake3D"].surf_th.numbers[1]>> }];
1371
+ {% endif %}
840
1372
  {% endfor %}
841
1373
 
842
1374
  DOM_allInsulationSurface = Region[{ <<rm.insulator.surf.numbers|join(', ')>> }];
843
- DOM_insulationSurface = Region[{ <<rm.insulator.surf.numbers[::2]|join(', ')>> }];
844
- DOM_terminalContactLayerSurface = Region[{ <<rm.insulator.surf.numbers[1::2]|join(', ')>> }];
1375
+ DOM_insulationSurface = Region[{ <<rm.insulator.surf.numbers[::3]|join(', ')>> }];
1376
+ DOM_terminalContactLayerSurface_WithoutNotch = Region[{ <<rm.insulator.surf.numbers[1::3]|join(', ')>> }];
1377
+ DOM_terminalContactLayerSurface_Notch = Region[{ <<rm.insulator.surf.numbers[2::3]|join(', ')>> }];
1378
+ DOM_terminalContactLayerSurface = Region[{ DOM_terminalContactLayerSurface_WithoutNotch, DOM_terminalContactLayerSurface_Notch }];
1379
+
1380
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
1381
+ DOM_allWindingSurface = Region[{ <<rm.powered["Pancake3D"].surf_th.numbers[2::]|join(', ')>> }];
1382
+ DOM_allConvectiveSurface = Region[{ <<rm.powered["Pancake3D"].surf_th.numbers|join(', ')>> }];
1383
+ {% endif %}
845
1384
 
846
1385
  DOM_insulationBoundaryCurvesAir = Region[{ <<rm.insulator.curve.numbers[0]>> }];
847
1386
  DOM_insulationBoundaryCurvesTerminal = Region[{ <<rm.insulator.curve.numbers[1]>> }];
@@ -864,46 +1403,65 @@ Group{
864
1403
  DOM_powered = Region[{ DOM_allWindings, DOM_terminals, DOM_transitionNotchVolumes }];
865
1404
 
866
1405
  // support of edge-based magnetic field strength, i.e., all conducting doms:
867
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
868
- {% if dm.magnet.geometry.ii.tsa %}
1406
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
1407
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
869
1408
  DOM_allConducting = Region[{ DOM_powered}];
1409
+ {% if dm.magnet.solve.resistiveHeatingTerminals %}
870
1410
  DOM_resistiveHeating = Region[{ DOM_allWindings, DOM_terminals }];
1411
+ {% else %}
1412
+ DOM_resistiveHeating = Region[{ DOM_allWindings }];
1413
+ {% endif %}
871
1414
  DOM_thermal = Region[{ DOM_powered}];
872
1415
  {% else %}
873
1416
  DOM_thermal = Region[{ DOM_powered, DOM_allInsulations}];
874
1417
  DOM_allConducting = Region[{ DOM_powered, DOM_terminalContactLayer}];
1418
+ {% if dm.magnet.solve.resistiveHeatingTerminals %}
875
1419
  DOM_resistiveHeating = Region[{ DOM_allWindings, DOM_terminals, DOM_terminalContactLayer }];
1420
+ {% else %}
1421
+ DOM_resistiveHeating = Region[{ DOM_allWindings, DOM_terminalContactLayer }];
1422
+ {% endif %}
876
1423
  {% endif %}
877
1424
  {% else %}
878
- {% if dm.magnet.geometry.ii.tsa %}
1425
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
879
1426
  DOM_thermal = Region[{ DOM_powered}];
880
1427
  DOM_allConducting = Region[{ DOM_powered }];
1428
+ {% if dm.magnet.solve.resistiveHeatingTerminals %}
881
1429
  DOM_resistiveHeating = Region[{ DOM_allWindings, DOM_terminals }];
1430
+ {% else %}
1431
+ DOM_resistiveHeating = Region[{ DOM_allWindings }];
1432
+ {% endif %}
882
1433
  {% else %}
883
1434
  DOM_thermal = Region[{ DOM_powered, DOM_allInsulations}];
884
1435
  DOM_allConducting = Region[{ DOM_powered, DOM_allInsulations }];
885
- DOM_resistiveHeating = Region[{ DOM_allWindings, DOM_terminals, DOM_allInsulations }];
1436
+ {% if dm.magnet.solve.resistiveHeatingTerminals %}
1437
+ DOM_resistiveHeating = Region[{ DOM_allWindings, DOM_terminals }];
1438
+ {% else %}
1439
+ DOM_resistiveHeating = Region[{ DOM_allWindings }];
1440
+ {% endif %}
1441
+ DOM_resistiveHeating += Region[{ DOM_allInsulations }];
886
1442
  {% endif %}
887
1443
  {% endif %}
888
1444
  DOM_air = Region[{ <<rm.air.vol.number>> }];
889
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
1445
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
890
1446
  DOM_airPoints = Region[{ <<rm.air.point.numbers[0]>> }];
891
1447
  {% else %}
892
1448
  DOM_airPoints = Region[{ <<rm.air.point.numbers|join(', ')>> }];
893
1449
  {% endif %}
894
1450
 
1451
+ DOM_allConductingWithoutWindings = Region[DOM_allConducting];
1452
+ DOM_allConductingWithoutWindings -= Region[DOM_allWindings];
895
1453
 
896
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" and
897
- not dm.magnet.geometry.ii.tsa %}
1454
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" and
1455
+ not dm.magnet.geometry.contactLayer.thinShellApproximation %}
898
1456
  DOM_air += Region[ DOM_insulation ];
899
1457
  {% endif %}
900
1458
 
901
- {% if dm.magnet.geometry.ai.shellTransformation %}
902
- {% if dm.magnet.geometry.ai.type == "cylinder" %}
1459
+ {% if dm.magnet.geometry.air.shellTransformation %}
1460
+ {% if dm.magnet.geometry.air.type == "cylinder" %}
903
1461
  // add shell volume for shell transformation:
904
1462
  DOM_air += Region[{ <<rm.air_far_field.vol.numbers|join(", ")>> }];
905
1463
  DOM_airInf = Region[{ <<rm.air_far_field.vol.numbers|join(", ")>> }];
906
- {% elif dm.magnet.geometry.ai.type == "cuboid" %}
1464
+ {% elif dm.magnet.geometry.air.type == "cuboid" %}
907
1465
  // add shell volume for shell transformation:
908
1466
  DOM_air += Region[{ <<rm.air_far_field.vol.numbers|join(", ")>> }];
909
1467
  DOM_airInfX = Region[{ <<rm.air_far_field.vol.numbers[0]>> }];
@@ -913,7 +1471,7 @@ Group{
913
1471
 
914
1472
 
915
1473
  // boundary surface between the all conducting and non-conducting domains:
916
- {% if dm.magnet.geometry.ii.tsa or dm.magnet.solve.ii.resistivity != "perfectlyInsulating" %}
1474
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation or dm.magnet.solve.contactLayer.resistivity != "perfectlyInsulating" %}
917
1475
  DOM_pancakeBoundary = Region[{ <<rm.powered["Pancake3D"].surf.numbers[0]>> }];
918
1476
  {% else %}
919
1477
  DOM_pancakeBoundary = Region[{ <<rm.powered["Pancake3D"].surf.numbers[1]>> }];
@@ -923,7 +1481,7 @@ Group{
923
1481
  DOM_Phi = Region[{ DOM_air }];
924
1482
 
925
1483
  // cut inbetween current leads, used to impose current or voltage:
926
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
1484
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
927
1485
  DOM_terminalCut = Region[{ <<rm.air.cochain.numbers[1]>> }];
928
1486
  DOM_airHoleCut = Region[{ <<rm.air.cochain.numbers[2:]|join(', ')>> }];
929
1487
  DOM_airCuts = Region[{ DOM_terminalCut, DOM_airHoleCut }];
@@ -937,8 +1495,26 @@ Group{
937
1495
 
938
1496
  // top and bottom surfaces of the terminals for constant temperature BC:
939
1497
  DOM_bottomTerminalSurface = Region[{ << rm.powered['Pancake3D'].surf_in.numbers | join(', ') >> }];
940
-
941
1498
  DOM_topTerminalSurface = Region[{ << rm.powered['Pancake3D'].surf_out.numbers | join(', ') >> }];
1499
+ DOM_terminalSurfaces = Region[{ DOM_bottomTerminalSurface, DOM_topTerminalSurface }];
1500
+
1501
+ {% if dm.quench_detection.voltage_tap_pairs and dm.magnet.solve.voltageTapPositions %}
1502
+ DOM_dummyPrintResistiveVoltages = Region[ 9999999 ] ;
1503
+ {% endif %}
1504
+
1505
+ {% if dm.magnet.solve.EECircuit.enable %}
1506
+ DOM_currentSource = Region[ 9000000 ];
1507
+ DOM_resistanceCrowbar = Region[ 9000001 ];
1508
+ DOM_switchCrowbar = Region[ 9000002 ];
1509
+ DOM_resistanceEE = Region[ 9000003 ];
1510
+ DOM_switchEE = Region[ 9000004 ];
1511
+ DOM_inductanceEE = Region[ 9000005 ];
1512
+
1513
+ DOM_circuitResistance = Region[{ DOM_resistanceCrowbar, DOM_resistanceEE, DOM_switchCrowbar, DOM_switchEE }];
1514
+ DOM_circuitInductance = Region[{ DOM_inductanceEE }];
1515
+
1516
+ DOM_circuit = Region[{ DOM_currentSource, DOM_circuitResistance, DOM_circuitInductance }];
1517
+ {% endif %}
942
1518
  }
943
1519
 
944
1520
  //======================================================================================
@@ -948,120 +1524,77 @@ Function{
948
1524
  // Power supply / current source:
949
1525
  listOfTimeValues = {<<dm.power_supply.t_control_LUT|join(", ")>>};
950
1526
  listOfCurrentValues = {<<dm.power_supply.I_control_LUT|join(", ")>>};
1527
+ {% if dm.magnet.solve.EECircuit.enable %}
1528
+ {% if dm.magnet.solve.EECircuit.TurnOffDeltaTimePowerSupply == 0 %}
1529
+ current[] = $quenchDetected == 1? 0: InterpolationLinear[$1]{ListAlt[listOfTimeValues, listOfCurrentValues]};
1530
+ {% else %}
1531
+ current[] = $quenchDetected == 1? (
1532
+ $Time - $quenchDetectionTime > <<dm.magnet.solve.EECircuit.TurnOffDeltaTimePowerSupply>> ? 0 :
1533
+ InterpolationLinear[$quenchDetectionTime]{ListAlt[listOfTimeValues, listOfCurrentValues]} * (1 - ($Time - $quenchDetectionTime)/<<dm.magnet.solve.EECircuit.TurnOffDeltaTimePowerSupply>>) ) :
1534
+ InterpolationLinear[$1]{ListAlt[listOfTimeValues, listOfCurrentValues]};
1535
+ {% endif %}
1536
+ {% else %}
951
1537
  current[] = InterpolationLinear[$1]{ListAlt[listOfTimeValues, listOfCurrentValues]};
1538
+ {% endif %}
952
1539
 
953
1540
  // Pancake3D geometry related functions:
954
1541
 
955
1542
  // We use SetVariable and GetVariable to ensure some variables are only evaluated once
956
1543
  // and saved in the memory. Input of the functions below is the position vector XYZ[].
957
- {% if dm.magnet.geometry.ii.tsa %}
958
- {% set windingThickness = dm.magnet.geometry.wi.t + dm.magnet.geometry.ii.t * (dm.magnet.geometry.wi.N - 1) / dm.magnet.geometry.wi.N %}
1544
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
1545
+ {% set windingThickness = dm.magnet.geometry.winding.thickness + dm.magnet.geometry.contactLayer.thickness * (dm.magnet.geometry.winding.numberOfTurns - 1) / dm.magnet.geometry.winding.numberOfTurns %}
959
1546
  {# A scaling factor needs to be used for TSA because winding is slightly thicker in #}
960
1547
  {# TSA compared to volume insulation. #}
961
- {% set scalingFactor = dm.magnet.geometry.wi.t / windingThickness %}
1548
+ {% set scalingFactor = dm.magnet.geometry.winding.thickness / windingThickness %}
962
1549
  {% set gapThickness = 0 %}
963
1550
  {% else %}
964
- {% set windingThickness = dm.magnet.geometry.wi.t %}
1551
+ {% set windingThickness = dm.magnet.geometry.winding.thickness %}
965
1552
  {% set scalingFactor = 1 %}
966
- {% set gapThickness = dm.magnet.geometry.ii.t %}
1553
+ {% set gapThickness = dm.magnet.geometry.contactLayer.thickness %}
967
1554
  {% endif %}
968
1555
 
969
- normalVectorOfWinding[] = GetVariable[ElementNum[], QuadraturePointIndex[]]{$coilNormalVector} ?
970
- GetVariable[ElementNum[], QuadraturePointIndex[]]{$coilNormalVector}
971
- :
972
- SetVariable[
973
- Pancake3DGetNormal[XYZ[]]{
974
- <<dm.magnet.geometry.wi.r_i>>,
975
- <<windingThickness>>,
976
- <<gapThickness>>,
977
- <<dm.magnet.geometry.wi.theta_i>>,
978
- <<dm.magnet.mesh.wi.ane[0]>>,
979
- <<dm.magnet.geometry.N>>,
980
- <<dm.magnet.geometry.wi.h>>,
981
- <<dm.magnet.geometry.gap>>
982
- },
983
- ElementNum[],
984
- QuadraturePointIndex[]
985
- ]{$coilNormalVector};
986
-
987
- arcLengthOfWinding[] = GetVariable[ElementNum[], QuadraturePointIndex[]]{$arcLengthOfWinding} ?
988
- GetVariable[ElementNum[], QuadraturePointIndex[]]{$arcLengthOfWinding}
989
- :
990
- SetVariable[
991
- Pancake3DGetContinuousArcLength[XYZ[]]{
992
- <<dm.magnet.geometry.wi.r_i>>,
993
- <<windingThickness>>,
994
- <<gapThickness>>,
995
- <<dm.magnet.geometry.wi.theta_i>>,
996
- <<dm.magnet.mesh.wi.ane[0]>>,
997
- <<dm.magnet.geometry.N>>,
998
- <<dm.magnet.geometry.wi.h>>,
999
- <<dm.magnet.geometry.gap>>
1000
- },
1001
- ElementNum[],
1002
- QuadraturePointIndex[]
1003
- ]{$arcLengthOfWinding};
1004
1556
 
1005
- turnNumberOfWinding[] = GetVariable[ElementNum[], QuadraturePointIndex[]]{$turnNumberOfWinding} ?
1006
- GetVariable[ElementNum[], QuadraturePointIndex[]]{$turnNumberOfWinding}
1007
- :
1008
- SetVariable[
1009
- Pancake3DGetContinuousTurnNumber[XYZ[]]{
1010
- <<dm.magnet.geometry.wi.r_i>>,
1011
- <<windingThickness>>,
1012
- <<gapThickness>>,
1013
- <<dm.magnet.geometry.wi.theta_i>>,
1014
- <<dm.magnet.mesh.wi.ane[0]>>,
1015
- <<dm.magnet.geometry.N>>,
1016
- <<dm.magnet.geometry.wi.h>>,
1017
- <<dm.magnet.geometry.gap>>
1018
- },
1019
- ElementNum[],
1020
- QuadraturePointIndex[]
1021
- ]{$turnNumberOfWinding};
1022
-
1023
- // Transformation tensor from winding coordinate system to XYZ coordinate system:
1024
- // see: https://www.continuummechanics.org/coordxforms.html
1025
- // X, Y, Z are the global coordinate system, x, y, z are the winding coordinate system.
1026
- // x: normal to the winding, positive direction is from the inner radius to the outer radius
1027
- // y: parallel to the windng, positive direction is in counterclockwise direction (i.e., right-hand rule applies for the winding coordinate system, assuming z and Z are the same)
1028
- // z: the same with Z
1029
-
1030
- // n1: Unit vector of X in the winding coordinate system
1031
- // n2: Unit vector of Y in the winding coordinate system
1032
- // n3: Unit vector of Z in the winding coordinate system
1033
- n1[] = Vector[CompX[normalVectorOfWinding[]], -CompY[normalVectorOfWinding[]], 0];
1034
- n2[] = Vector[CompY[normalVectorOfWinding[]], CompX[normalVectorOfWinding[]], 0];
1035
- n3[] = Vector[0, 0, 1];
1036
- TransformationTensor[] = TensorV[
1037
- n1[],
1038
- n2[],
1039
- n3[]
1040
- ];
1557
+ {% if dm.magnet.solve.imposedPowerDensity.power and not dm.magnet.solve.type == "electromagnetic" %}
1558
+ imposedPowerDensity[] = Pancake3DPowerDensity[$1, $2]
1559
+ {<<dm.magnet.solve.imposedPowerDensity.startTime>>,
1560
+ <<dm.magnet.solve.imposedPowerDensity.endTime>>,
1561
+ <<dm.magnet.solve.imposedPowerDensity.startArcLength>>,
1562
+ <<dm.magnet.solve.imposedPowerDensity.endArcLength>>,
1563
+ <<dm.magnet.solve.imposedPowerDensity.power>>,
1564
+ <<dm.magnet.geometry.winding.innerRadius>>,
1565
+ <<windingThickness>>,
1566
+ <<gapThickness>>,
1567
+ <<dm.magnet.geometry.winding.theta_i>>,
1568
+ <<dm.magnet.mesh.winding.azimuthalNumberOfElementsPerTurn[0]>>,
1569
+ <<dm.magnet.geometry.numberOfPancakes>>,
1570
+ <<dm.magnet.geometry.winding.height>>,
1571
+ <<dm.magnet.geometry.gapBetweenPancakes>>
1572
+ };
1573
+ {% endif %}
1041
1574
 
1042
1575
  // to be templated below
1043
1576
  oneDGaussianOrder = 2;
1044
1577
  // to be templated above
1045
1578
 
1046
1579
  // Initial conditions:
1047
- INPUT_initialTemperature = <<dm.magnet.solve.ic.T>>; // initial temperature, [K]
1580
+ INPUT_initialTemperature = <<dm.magnet.solve.initialConditions.temperature>>; // initial temperature, [K]
1048
1581
 
1049
1582
  // Time stepping parameters:
1050
- INPUT_tStart = <<dm.magnet.solve.t.start>>; // start time, [s]
1051
- INPUT_tEnd = <<dm.magnet.solve.t.end>>; // end time, [s]
1052
- INPUT_extrapolationOrder = <<dm.magnet.solve.t.extrapolationOrder>>; // order of extrapolation for the time stepping scheme
1053
- {% if dm.magnet.solve.t.timeSteppingType == "adaptive" %}
1583
+ INPUT_tStart = <<dm.magnet.solve.time.start>>; // start time, [s]
1584
+ INPUT_tEnd = <<dm.magnet.solve.time.end>>; // end time, [s]
1585
+ INPUT_extrapolationOrder = <<dm.magnet.solve.time.extrapolationOrder>>; // order of extrapolation for the time stepping scheme
1586
+ {% if dm.magnet.solve.time.timeSteppingType == "adaptive" %}
1054
1587
  // Adaptive time stepping parameters:
1055
- INPUT_tAdaptiveMinStep = <<dm.magnet.solve.t.adaptive.minimumStep>>; // minimum time step, [s]
1056
- INPUT_tAdaptiveMaxStep = <<dm.magnet.solve.t.adaptive.maximumStep>>; // maximum time step, [s]
1057
- INPUT_tAdaptiveInitStep = <<dm.magnet.solve.t.adaptive.initialStep>>; // initial time step, [s]
1058
- INPUT_tAdaptiveBreakPoints ={ << list(set(dm.magnet.solve.t.adaptive.breakPoints+dm.power_supply.t_control_LUT))|sort|join(', ') >> }; // force solution at these time points, [s]
1588
+ INPUT_tAdaptiveMinStep = <<dm.magnet.solve.time.adaptiveSteppingSettings.minimumStep>>; // minimum time step, [s]
1589
+ INPUT_tAdaptiveMaxStep = <<dm.magnet.solve.time.adaptiveSteppingSettings.maximumStep>>; // maximum time step, [s]
1590
+ INPUT_tAdaptiveInitStep = <<dm.magnet.solve.time.adaptiveSteppingSettings.initialStep>>; // initial time step, [s]
1591
+ INPUT_tAdaptiveBreakPoints ={ << list(set(dm.magnet.solve.time.adaptiveSteppingSettings.breakPoints+dm.power_supply.t_control_LUT))|sort|join(', ') >> }; // force solution at these time points, [s]
1059
1592
  {% endif %}
1060
1593
 
1061
1594
  {% if dm.magnet.solve.systemsOfEquationsType == "nonlinear" %}
1062
1595
  // Nonlinear solver parameters:
1063
- INPUT_NLSMaxNumOfIter = <<dm.magnet.solve.nls.maxIter>>; // maximum number of iterations for the nonlinear solver
1064
- INPUT_NLSRelaxFactor = <<dm.magnet.solve.nls.relaxationFactor>>; // relaxation factor for the nonlinear solver
1596
+ INPUT_NLSMaxNumOfIter = <<dm.magnet.solve.nonlinearSolver.maximumNumberOfIterations>>; // maximum number of iterations for the nonlinear solver
1597
+ INPUT_NLSRelaxFactor = <<dm.magnet.solve.nonlinearSolver.relaxationFactor>>; // relaxation factor for the nonlinear solver
1065
1598
  {% endif %}
1066
1599
 
1067
1600
  //==================================================================================
@@ -1070,7 +1603,7 @@ Function{
1070
1603
  {% if dm.magnet.solve.type in ["electromagnetic", "weaklyCoupled", "stronglyCoupled"] %}
1071
1604
  // Air permeability starts =========================================================
1072
1605
  // Linear:
1073
- INPUT_airMagneticPermeability = <<dm.magnet.solve.ai.permeability>>;
1606
+ INPUT_airMagneticPermeability = <<dm.magnet.solve.air.permeability>>;
1074
1607
  mu[] = INPUT_airMagneticPermeability;
1075
1608
  // Air permeability ends ===========================================================
1076
1609
  {% endif %}
@@ -1079,77 +1612,95 @@ Function{
1079
1612
  if (
1080
1613
  (
1081
1614
  not (
1082
- dm.magnet.solve.wi.resistivity and
1083
- dm.magnet.solve.wi.thermalConductivity and
1084
- dm.magnet.solve.wi.specificHeatCapacity
1615
+ dm.magnet.solve.winding.resistivity and
1616
+ dm.magnet.solve.winding.thermalConductivity and
1617
+ dm.magnet.solve.winding.specificHeatCapacity
1085
1618
  ) and dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled"]
1086
1619
  )
1087
- or (not(dm.magnet.solve.wi.resistivity) and dm.magnet.solve.type in ["electromagnetic"])
1620
+ or (not(dm.magnet.solve.winding.resistivity) and dm.magnet.solve.type in ["electromagnetic"])
1088
1621
  or (not(
1089
- dm.magnet.solve.wi.thermalConductivity and
1090
- dm.magnet.solve.wi.specificHeatCapacity
1622
+ dm.magnet.solve.winding.thermalConductivity and
1623
+ dm.magnet.solve.winding.specificHeatCapacity
1091
1624
  ) and dm.magnet.solve.type in ["thermal"])
1092
1625
  )
1093
1626
  %}
1094
1627
  // Winding material combination parameters start ===================================
1095
- {% for material in dm.magnet.solve.wi.normalConductors %}
1096
- INPUT_relativeThickness<<material.name>> = <<material.relativeThickness>>;
1628
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1629
+ INPUT_relativeThickness<<material.getdpNormalMaterialGetDPName>> = <<material.relativeThickness>>;
1097
1630
  {% endfor %}
1098
1631
 
1099
- INPUT_relativeThicknessOfSuperConductor = <<dm.magnet.solve.wi.relativeThicknessOfSuperConductor>>;
1100
- INPUT_relativeThicknessOfNormalConductor = <<dm.magnet.solve.wi.relativeThicknessOfNormalConductor>>;
1101
- INPUT_relativeWidthOfPlating = <<dm.magnet.solve.wi.shuntLayer.material.relativeHeight>>;
1632
+ INPUT_relativeThicknessOfSuperConductor = <<dm.magnet.solve.winding.relativeThicknessOfSuperConductor>>;
1633
+ INPUT_relativeThicknessOfNormalConductor = <<dm.magnet.solve.winding.relativeThicknessOfNormalConductor>>;
1634
+ INPUT_relativeWidthOfPlating = <<dm.magnet.solve.winding.shuntLayer.material.relativeHeight>>;
1102
1635
  // Factor 1.0/<<scalingFactor>> is used equate the scaling applied to Jcritical in the parallel direction
1103
- INPUT_jCriticalScalingNormalToWinding = 1.0/<<scalingFactor>> * <<dm.magnet.solve.wi.superConductor.jCriticalScalingNormalToWinding>>;
1636
+ INPUT_jCriticalScalingNormalToWinding = 1.0/<<scalingFactor>> * <<dm.magnet.solve.winding.superConductor.jCriticalScalingNormalToWinding>>;
1104
1637
  // Winding material combination parameters end =====================================
1105
1638
  {% endif %}
1106
1639
 
1107
- {% if dm.magnet.geometry.ii.tsa %}
1640
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
1108
1641
  // TSA parameters start ============================================================
1109
- INPUT_insulationThickness = <<dm.magnet.geometry.ii.t>>; // thickness of the insulation, [m]
1110
- INPUT_NumOfTSAElements = <<dm.magnet.solve.ii.numberOfThinShellElements>>;
1111
- th_ins_k = INPUT_insulationThickness / (INPUT_NumOfTSAElements == 0 ? 1 : INPUT_NumOfTSAElements);
1642
+ INPUT_insulationThickness = <<dm.magnet.geometry.contactLayer.thickness>>; // thickness of the insulation, [m]
1643
+ INPUT_NumOfTSAElements = <<dm.magnet.solve.contactLayer.numberOfThinShellElements>>;
1644
+ th_terminal_k = INPUT_insulationThickness / (INPUT_NumOfTSAElements == 0 ? 1 : INPUT_NumOfTSAElements);
1645
+ {% if dm.magnet.solve.heatFlowBetweenTurns %}
1646
+ th_insulation_k = th_terminal_k;
1647
+ {% else %}
1648
+ th_insulation_k = 0.5 * th_terminal_k;
1649
+ {% endif %}
1112
1650
  // TSA parameters end ==============================================================
1651
+
1652
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
1653
+ // Cryocooler TSA parameters start ==================================================
1654
+ INPUT_NumOfCryocoolerTSAElements = <<dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.numberOfThinShellElements>>;
1655
+ cryocooler_thickness[] = <<dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume>>/SurfaceArea[]{<< rm.powered['Pancake3D'].surf_in.numbers | join(', ') >>, << rm.powered['Pancake3D'].surf_out.numbers | join(', ') >> } ;
1656
+ th_cryocooler_k[] = cryocooler_thickness[]/INPUT_NumOfCryocoolerTSAElements;
1657
+ // Cryocooler TSA parameters end ====================================================
1658
+ {% endif %}
1113
1659
  {% endif %}
1114
1660
 
1661
+ {% set materialCodes = {
1662
+ "Copper": 0,
1663
+ "Hastelloy": 1,
1664
+ "Silver": 2,
1665
+ "Indium": 3,
1666
+ "Stainless Steel": 4,
1667
+ "HTSSuperPower": 5,
1668
+ "HTSFujikura": 6,
1669
+ "HTSSucci": 7
1670
+ } %}
1671
+
1115
1672
  {% if dm.magnet.solve.type in ["electromagnetic", "weaklyCoupled", "stronglyCoupled"] %}
1116
- // Winding resistivity starts ======================================================
1117
- {% if dm.magnet.solve.wi.resistivity %}
1673
+ // Winding resistivity, Jc, and lambda starts ======================================================
1674
+ {% if dm.magnet.solve.winding.resistivity %}
1118
1675
  // Linear:
1119
- INPUT_coilResistivity = <<dm.magnet.solve.wi.resistivity>>; // resistivity of the coil, [Ohm*m]
1676
+ INPUT_coilResistivity = <<dm.magnet.solve.winding.resistivity>>; // resistivity of the coil, [Ohm*m]
1120
1677
  rho[DOM_allWindings] = INPUT_coilResistivity;
1121
1678
  {% else %}
1122
1679
 
1123
- {% set use_cpp_materials = True %}
1124
- {% if use_cpp_materials %}
1125
-
1126
- {% if dm.magnet.solve.wi.superConductor.lengthValues is not none %}
1127
- {% set numberOfIcValues = len(dm.magnet.solve.wi.superConductor.lengthValues) %}
1128
- {% set listOfLengthValues = dm.magnet.solve.wi.superConductor.lengthValues %}
1129
- {% set listOfIcValues = dm.magnet.solve.wi.superConductor.IcValues %}
1130
- {% else %}
1131
- {% set numberOfIcValues = 1 %}
1132
- {% set listOfLengthValues = [1] %}
1133
- {% set listOfIcValues = [dm.magnet.solve.wi.superConductor.IcAtTinit] %}
1134
- {% endif %}
1135
- {% set materialCodes = {
1136
- "Copper": 0,
1137
- "Hastelloy": 1,
1138
- "Silver": 2,
1139
- "Indium": 3,
1140
- "StainlessSteel": 4,
1141
- "HTSSuperPower": 5,
1142
- "HTSFujikura": 6,
1143
- } %}
1680
+ {% if dm.magnet.solve.winding.superConductor.lengthValues is not none %}
1681
+ {% set numberOfIcValues = len(dm.magnet.solve.winding.superConductor.lengthValues) %}
1682
+ {% set listOfLengthValues = dm.magnet.solve.winding.superConductor.lengthValues %}
1683
+ {% set listOfIcValues = dm.magnet.solve.winding.superConductor.IcValues %}
1684
+ {% else %}
1685
+ {% set numberOfIcValues = 1 %}
1686
+ {% set listOfLengthValues = [1] %}
1687
+ {% set listOfIcValues = [dm.magnet.solve.winding.superConductor.IcAtTinit] %}
1688
+ {% endif %}
1144
1689
  rhoWindingAndDerivative[] = WindingWithSuperConductorRhoAndDerivativeV1[
1145
1690
  $Time,
1146
1691
  XYZ[],
1147
1692
  $3,
1148
1693
  $2,
1149
1694
  $1
1150
- ]{ <<dm.magnet.solve.wi.superConductor.IcReferenceTemperature>>,
1151
- <<dm.magnet.solve.wi.superConductor.IcReferenceBmagnitude>>,
1152
- <<dm.magnet.solve.wi.superConductor.IcReferenceBangle>>,
1695
+ ]{ <<dm.magnet.solve.winding.superConductor.IcReferenceTemperature>>,
1696
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBmagnitude>>,
1697
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBangle>>,
1698
+ <<dm.magnet.solve.winding.superConductor.IcInArcLength>>,
1699
+ {% if dm.magnet.solve.winding.isotropic %}
1700
+ 1,
1701
+ {% else %}
1702
+ 0,
1703
+ {% endif %}
1153
1704
  <<numberOfIcValues>>, // N of Ic Values
1154
1705
  {% for lengthValue in listOfLengthValues %}
1155
1706
  <<lengthValue>>,
@@ -1157,46 +1708,60 @@ if (
1157
1708
  {% for IcValue in listOfIcValues %}
1158
1709
  <<IcValue>>,
1159
1710
  {% endfor %}
1160
- <<len(dm.magnet.solve.wi.normalConductors)>>, // N of materials,
1161
- {% for material in dm.magnet.solve.wi.normalConductors %}
1711
+ <<len(dm.magnet.solve.winding.normalConductors)>>, // N of materials,
1712
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1162
1713
  <<materialCodes[material.name]>>,
1163
1714
  {% endfor %}
1164
- {% for material in dm.magnet.solve.wi.normalConductors %}
1715
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1165
1716
  <<material.relativeThickness>>,
1166
1717
  {% endfor %}
1167
- {% for material in dm.magnet.solve.wi.normalConductors %}
1168
- <<material.rrr>>,
1718
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1719
+ <<material.RRR>>,
1169
1720
  {% endfor %}
1170
- {% for material in dm.magnet.solve.wi.normalConductors %}
1171
- <<material.rrrRefT>>,
1721
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1722
+ <<material.RRRRefTemp>>,
1172
1723
  {% endfor %}
1173
- <<materialCodes[dm.magnet.solve.wi.shuntLayer.material.name]>>,
1174
- <<dm.magnet.solve.wi.shuntLayer.material.relativeHeight>>,
1175
- <<dm.magnet.solve.wi.shuntLayer.material.rrr>>,
1176
- <<dm.magnet.solve.wi.shuntLayer.material.rrrRefT>>,
1177
- <<materialCodes[dm.magnet.solve.wi.superConductor.name]>>, // material integer: HTS
1178
- <<dm.magnet.solve.wi.relativeThicknessOfSuperConductor>>, // relative thickness of HTS
1179
- <<dm.magnet.solve.wi.superConductor.electricFieldCriterion>>, // electric field criterion of HTS
1180
- <<dm.magnet.solve.wi.superConductor.nValue>>, // n value of HTS
1181
- <<dm.magnet.solve.wi.superConductor.minimumPossibleResistivity>>, // winding minimum possible resistivity (or superconductor minimum? bug)
1182
- <<dm.magnet.solve.wi.superConductor.maximumPossibleResistivity>>, // winding maximum possible resistivity (or superconductor maximum? bug)
1183
- <<dm.magnet.solve.localDefects.jCritical.startTurn if dm.magnet.solve.localDefects.jCritical is not none else "0">>, // local defect start turn
1184
- <<dm.magnet.solve.localDefects.jCritical.endTurn if dm.magnet.solve.localDefects.jCritical is not none else "0">>, // local defect end turn
1185
- <<dm.magnet.solve.localDefects.jCritical.whichPancakeCoil if dm.magnet.solve.localDefects.jCritical is not none else "1">>, // local defect which pancake coil
1186
- <<dm.magnet.solve.localDefects.jCritical.value if dm.magnet.solve.localDefects.jCritical is not none else "0">>, // local defect value
1187
- <<dm.magnet.solve.localDefects.jCritical.startTime if dm.magnet.solve.localDefects.jCritical is not none else "99999999">>, // local defect start time
1188
- <<dm.magnet.geometry.wi.r_i>>,
1724
+ <<materialCodes[dm.magnet.solve.winding.shuntLayer.material.name]>>,
1725
+ <<dm.magnet.solve.winding.shuntLayer.material.relativeHeight>>,
1726
+ <<dm.magnet.solve.winding.shuntLayer.material.RRR>>,
1727
+ <<dm.magnet.solve.winding.shuntLayer.material.RRRRefTemp>>,
1728
+ <<materialCodes[dm.magnet.solve.winding.superConductor.name]>>, // material integer: HTS
1729
+ <<dm.magnet.solve.winding.relativeThicknessOfSuperConductor>>, // relative thickness of HTS
1730
+ <<dm.magnet.solve.winding.superConductor.electricFieldCriterion>>, // electric field criterion of HTS
1731
+ <<dm.magnet.solve.winding.superConductor.nValue>>, // n value of HTS
1732
+ <<dm.magnet.solve.winding.minimumPossibleResistivity>>, // winding minimum possible resistivity (or superconductor minimum? bug)
1733
+ <<dm.magnet.solve.winding.maximumPossibleResistivity>>, // winding maximum possible resistivity (or superconductor maximum? bug)
1734
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect start turn
1735
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.endTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect end turn
1736
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.whichPancakeCoil if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "1">>, // local defect which pancake coil
1737
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.value if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect value
1738
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTime if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "99999999">>, // local defect start time
1739
+ <<dm.magnet.geometry.winding.innerRadius>>,
1189
1740
  <<windingThickness>>,
1190
1741
  <<gapThickness>>,
1191
- <<dm.magnet.geometry.wi.theta_i>>,
1192
- <<dm.magnet.mesh.wi.ane[0]>>,
1193
- <<dm.magnet.geometry.N>>,
1194
- <<dm.magnet.geometry.wi.h>>,
1195
- <<dm.magnet.geometry.gap>>,
1742
+ <<dm.magnet.geometry.winding.theta_i>>,
1743
+ <<dm.magnet.mesh.winding.azimuthalNumberOfElementsPerTurn[0]>>,
1744
+ <<dm.magnet.geometry.numberOfPancakes>>,
1745
+ <<dm.magnet.geometry.winding.height>>,
1746
+ <<dm.magnet.geometry.gapBetweenPancakes>>,
1196
1747
  <<scalingFactor>>,
1197
1748
  1 // arbitrary jCritical scaling normal to winding
1198
1749
  };
1199
- rho[DOM_allWindings] = GetFirstTensor[
1750
+ rho[DOM_allWindings] = {% if dm.magnet.solve.winding.isotropic %}
1751
+ CompXX[
1752
+ GetFirstTensor[
1753
+ SetVariable[
1754
+ rhoWindingAndDerivative[$1, $2, $3],
1755
+ ElementNum[],
1756
+ QuadraturePointIndex[],
1757
+ $NLIteration
1758
+ ]{
1759
+ $rhoWindingAndDerivative
1760
+ }
1761
+ ]
1762
+ ];
1763
+ {% else %}
1764
+ GetFirstTensor[
1200
1765
  SetVariable[
1201
1766
  rhoWindingAndDerivative[$1, $2, $3],
1202
1767
  ElementNum[],
@@ -1206,491 +1771,254 @@ if (
1206
1771
  $rhoWindingAndDerivative
1207
1772
  }
1208
1773
  ];
1774
+ {% endif %}
1775
+
1776
+
1209
1777
  d_of_rho_wrt_j_TIMES_j[DOM_allWindings] = GetSecondTensor[
1210
1778
  GetVariable[ElementNum[], QuadraturePointIndex[], $NLIteration]{$rhoWindingAndDerivative}
1211
1779
  ];
1212
- {% else %}
1213
- // Nonlinear:
1214
-
1215
- // Generally, tapes consist of more than one material. They are modeled as one
1216
- // material (including the superconductor), and their effective homogenized
1217
- // resistivity, thermal conductivity, and specific heat capacity are calculated
1218
- // below.
1219
1780
 
1220
- // Resistivity calculation starts.
1221
- {% for material in dm.magnet.solve.wi.normalConductors %}
1222
- rho<<material.name>>[] = <<materials[material.resistivityMacroName](RRR=material.rrr, rrrRefT=material.rrrRefT)>>;
1223
-
1224
- {% endfor %}
1781
+ Jcritical[] = Pancake3DCriticalCurrentDensity[
1782
+ $Time,
1783
+ XYZ[],
1784
+ $2,
1785
+ $1
1786
+ ]{
1787
+ <<dm.magnet.solve.winding.superConductor.IcReferenceTemperature>>,
1788
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBmagnitude>>,
1789
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBangle>>,
1790
+ <<dm.magnet.solve.winding.superConductor.IcInArcLength>>,
1791
+ <<numberOfIcValues>>, // N of Ic Values
1792
+ {% for lengthValue in listOfLengthValues %}
1793
+ <<lengthValue>>,
1794
+ {% endfor %}
1795
+ {% for IcValue in listOfIcValues %}
1796
+ <<IcValue>>,
1797
+ {% endfor %}
1798
+ <<len(dm.magnet.solve.winding.normalConductors)>>, // N of materials,
1799
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1800
+ <<materialCodes[material.name]>>,
1801
+ {% endfor %}
1802
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1803
+ <<material.relativeThickness>>,
1804
+ {% endfor %}
1805
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1806
+ <<material.RRR>>,
1807
+ {% endfor %}
1808
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1809
+ <<material.RRRRefTemp>>,
1810
+ {% endfor %}
1811
+ <<materialCodes[dm.magnet.solve.winding.superConductor.name]>>, // material integer: HTS
1812
+ <<dm.magnet.solve.winding.relativeThicknessOfSuperConductor>>, // relative thickness of HTS
1813
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect start turn
1814
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.endTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect end turn
1815
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.whichPancakeCoil if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "1">>, // local defect which pancake coil
1816
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.value if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect value
1817
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTime if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "99999999">>, // local defect start time
1818
+ <<windingThickness>>,
1819
+ <<dm.magnet.geometry.winding.height>>,
1820
+ <<scalingFactor>>,
1821
+ <<materialCodes[dm.magnet.solve.winding.shuntLayer.material.name]>>,
1822
+ <<dm.magnet.solve.winding.shuntLayer.material.relativeHeight>>,
1823
+ <<dm.magnet.solve.winding.shuntLayer.material.RRR>>,
1824
+ <<dm.magnet.solve.winding.shuntLayer.material.RRRRefTemp>>
1825
+ };
1225
1826
 
1226
- rhoNormalConductorParallelToWinding[] =
1227
- EffectiveResistivity[
1228
- {% for material in dm.magnet.solve.wi.normalConductors %}
1229
- {% if loop.last %}
1230
- rho<<material.name>>[$1, $2]
1231
- {% else %}
1232
- rho<<material.name>>[$1, $2],
1233
- {% endif %}
1234
- {% endfor %}
1827
+ Icritical[] = Pancake3DCriticalCurrent[
1828
+ $Time,
1829
+ XYZ[],
1830
+ $2,
1831
+ $1
1235
1832
  ]{
1236
- {% for material in dm.magnet.solve.wi.normalConductors %}
1237
- {% if loop.last %}
1238
- INPUT_relativeThickness<<material.name>>
1239
- {% else %}
1240
- INPUT_relativeThickness<<material.name>>,
1241
- {% endif %}
1833
+ <<dm.magnet.solve.winding.superConductor.IcReferenceTemperature>>,
1834
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBmagnitude>>,
1835
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBangle>>,
1836
+ <<dm.magnet.solve.winding.superConductor.IcInArcLength>>,
1837
+ <<numberOfIcValues>>, // N of Ic Values
1838
+ {% for lengthValue in listOfLengthValues %}
1839
+ <<lengthValue>>,
1242
1840
  {% endfor %}
1243
- };
1244
-
1245
- rhoNormalConductorNormalToWinding[] =
1246
- RuleOfMixtures[
1247
- {% for material in dm.magnet.solve.wi.normalConductors %}
1248
- {% if loop.last %}
1249
- rho<<material.name>>[$1, $2]
1250
- {% else %}
1251
- rho<<material.name>>[$1, $2],
1252
- {% endif %}
1841
+ {% for IcValue in listOfIcValues %}
1842
+ <<IcValue>>,
1253
1843
  {% endfor %}
1254
- ]{
1255
- {% for material in dm.magnet.solve.wi.normalConductors %}
1256
- {% if loop.last %}
1257
- INPUT_relativeThickness<<material.name>>
1258
- {% else %}
1259
- INPUT_relativeThickness<<material.name>>,
1260
- {% endif %}
1844
+ <<len(dm.magnet.solve.winding.normalConductors)>>, // N of materials,
1845
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1846
+ <<materialCodes[material.name]>>,
1847
+ {% endfor %}
1848
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1849
+ <<material.relativeThickness>>,
1850
+ {% endfor %}
1851
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1852
+ <<material.RRR>>,
1261
1853
  {% endfor %}
1854
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1855
+ <<material.RRRRefTemp>>,
1856
+ {% endfor %}
1857
+ <<materialCodes[dm.magnet.solve.winding.superConductor.name]>>, // material integer: HTS
1858
+ <<dm.magnet.solve.winding.relativeThicknessOfSuperConductor>>, // relative thickness of HTS
1859
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect start turn
1860
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.endTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect end turn
1861
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.whichPancakeCoil if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "1">>, // local defect which pancake coil
1862
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.value if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect value
1863
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTime if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "99999999">>, // local defect start time
1864
+ <<windingThickness>>,
1865
+ <<dm.magnet.geometry.winding.height>>,
1866
+ <<scalingFactor>>,
1867
+ <<materialCodes[dm.magnet.solve.winding.shuntLayer.material.name]>>,
1868
+ <<dm.magnet.solve.winding.shuntLayer.material.relativeHeight>>,
1869
+ <<dm.magnet.solve.winding.shuntLayer.material.RRR>>,
1870
+ <<dm.magnet.solve.winding.shuntLayer.material.RRRRefTemp>>
1262
1871
  };
1263
-
1264
- // In normal direction, we consider the plating of the tape, typcially copper as a
1265
- // parallel connection between the series connection of all layers and the plating.
1266
- rhoPlatingNormalToWinding[] = rho<<dm.magnet.solve.wi.shuntLayer.material.name>>[$1, $2];
1267
-
1268
- {% if dm.magnet.solve.wi.superConductor %}
1269
- // There is a superconductor in the winding.
1270
-
1271
- // To make it easier for the linear solver, a lower bound for the resistivity in the
1272
- // superconductor is defined:
1273
- winding_minimumPossibleRho = <<dm.magnet.solve.wi.minimumPossibleResistivity>>;
1274
- // An upper bound for the resistivity in the normal direction is defined too:
1275
- winding_maximumPossibleRho = <<dm.magnet.solve.wi.maximumPossibleResistivity>>;
1276
-
1277
- // The critical current density is calculated based on the angle between the tape
1278
- // and the magnetic field. Pancake3DGetNormal is a function that returns the normal
1279
- // vector of the tape at a given point. Then, the angle between the tape and the
1280
- // magnetic field is calculated.
1281
- angle[] = Norm[$1] > 0 ?
1282
- Acos[normalVectorOfWinding[] * $1 / Norm[$1]] * 180/Pi
1283
- :
1284
- normalVectorOfWinding[] * Vector[0,0,0];
1285
-
1286
- {% if dm.magnet.solve.wi.superConductor.lengthValues is not none %}
1287
- listOfLengthValues = {<<dm.magnet.solve.wi.superConductor.lengthValues|join(", ")>>};
1288
- listOfIcValues = {<<dm.magnet.solve.wi.superConductor.IcValues|join(", ")>>};
1289
- IcAtTinit[] = InterpolationLinear[$1]{ListAlt[listOfLengthValues, listOfIcValues]};
1290
- {% else %}
1291
- IcAtTinit[] = <<dm.magnet.solve.wi.superConductor.IcAtTinit>>;
1292
- {% endif %}
1293
- JcriticalMultiplier[] =
1294
- IcAtTinit[$1]/(<<dm.magnet.solve.wi.superConductor.getdpCriticalCurrentDensityFunction>>[
1295
- INPUT_initialTemperature,
1296
- 0,
1297
- 0
1298
- ] * INPUT_relativeThicknessOfSuperConductor * 1/<<scalingFactor>> * <<dm.magnet.geometry.wi.t>> * <<dm.magnet.geometry.wi.h>>);
1299
-
1300
- JcriticalWithoutLocalDefects[] =
1301
- JcriticalMultiplier[$4] * <<dm.magnet.solve.wi.superConductor.getdpCriticalCurrentDensityFunction>>[$1, Norm[$2], angle[$2]];
1302
-
1303
- {% if dm.magnet.solve.localDefects.jCritical.startTime is not none %}
1304
- {% if dm.magnet.solve.localDefects.jCritical.transitionDuration or dm.magnet.solve.localDefects.jCritical.transitionDuration == 0 %}
1305
- Jcritical[] = (
1306
- turnNumberOfWinding[] >= <<dm.magnet.solve.localDefects.jCritical.startTurn>> &&
1307
- turnNumberOfWinding[] <= <<dm.magnet.solve.localDefects.jCritical.endTurn>> &&
1308
- ($Time >= <<dm.magnet.solve.localDefects.jCritical.startTime>>) &&
1309
- <<dm.magnet.solve.localDefects.jCritical.zTop>> >= Z[] &&
1310
- <<dm.magnet.solve.localDefects.jCritical.zBottom>> <= Z[]
1311
- ) ?
1312
- (
1313
- $Time < <<dm.magnet.solve.localDefects.jCritical.startTime>> + <<dm.magnet.solve.localDefects.jCritical.transitionDuration>>
1314
- ) ?
1315
- (JcriticalWithoutLocalDefects[$1, $2, $3, $4] - <<dm.magnet.solve.localDefects.jCritical.value>>)/(-<<dm.magnet.solve.localDefects.jCritical.transitionDuration>>) * ($Time - <<dm.magnet.solve.localDefects.jCritical.startTime>> - <<dm.magnet.solve.localDefects.jCritical.transitionDuration>>) + <<dm.magnet.solve.localDefects.jCritical.value>>
1316
- :
1317
- <<dm.magnet.solve.localDefects.jCritical.value>>
1318
- :
1319
- JcriticalWithoutLocalDefects[$1, $2, $3, $4];
1320
- {% else %}
1321
- Jcritical[] = (
1322
- turnNumberOfWinding[] >= <<dm.magnet.solve.localDefects.jCritical.startTurn>> &&
1323
- turnNumberOfWinding[] <= <<dm.magnet.solve.localDefects.jCritical.endTurn>> &&
1324
- $Time >= <<dm.magnet.solve.localDefects.jCritical.startTime>> &&
1325
- <<dm.magnet.solve.localDefects.jCritical.zTop>> >= Z[] &&
1326
- <<dm.magnet.solve.localDefects.jCritical.zBottom>> <= Z[]
1327
- ) ?
1328
- <<dm.magnet.solve.localDefects.jCritical.value>>
1329
- :
1330
- JcriticalWithoutLocalDefects[$1, $2, $3, $4];
1331
- {% endif %}
1332
- {% else %}
1333
- Jcritical[] = JcriticalWithoutLocalDefects[$1, $2, $3, $4];
1334
- {% endif %}
1335
-
1336
- // Lamba (current sharing index) is a number between 0 and 1. 1 means all the
1337
- // current flows through the superconductor. 0 means all the current flows through
1338
- // the normal conductor.
1339
1872
 
1340
- // the electric field at which the current density reaches the critical current density, [V/m]:
1341
- Ecriterion = <<dm.magnet.solve.wi.superConductor.electricFieldCriterion>>;
1342
- n = <<dm.magnet.solve.wi.superConductor.nValue>>; // n-value for the power law
1343
-
1344
- lambda[] =
1345
- AnisotropicCurrentSharing[
1873
+ lambda[] = Pancake3DHTSCurrentSharingIndex[
1874
+ $Time,
1875
+ XYZ[],
1346
1876
  $3,
1347
- Jcritical[$1, $2, $3, $4],
1348
- rhoNormalConductorParallelToWinding[$1, $2]
1349
- ]{
1350
- Ecriterion,
1351
- n,
1352
- INPUT_relativeThicknessOfSuperConductor * <<dm.magnet.geometry.wi.t>>,
1353
- INPUT_relativeThicknessOfNormalConductor * <<dm.magnet.geometry.wi.t>>,
1354
- 1.0, // scaling applied to J, not applicable
1355
- 20, // number of current sharing maximum iterations
1356
- 1E-5 // absolute tolerance current sharing
1877
+ $2,
1878
+ $1
1879
+ ]{ <<dm.magnet.solve.winding.superConductor.IcReferenceTemperature>>,
1880
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBmagnitude>>,
1881
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBangle>>,
1882
+ <<dm.magnet.solve.winding.superConductor.IcInArcLength>>,
1883
+ {% if dm.magnet.solve.winding.isotropic %}
1884
+ 1,
1885
+ {% else %}
1886
+ 0,
1887
+ {% endif %}
1888
+ <<numberOfIcValues>>, // N of Ic Values
1889
+ {% for lengthValue in listOfLengthValues %}
1890
+ <<lengthValue>>,
1891
+ {% endfor %}
1892
+ {% for IcValue in listOfIcValues %}
1893
+ <<IcValue>>,
1894
+ {% endfor %}
1895
+ <<len(dm.magnet.solve.winding.normalConductors)>>, // N of materials,
1896
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1897
+ <<materialCodes[material.name]>>,
1898
+ {% endfor %}
1899
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1900
+ <<material.relativeThickness>>,
1901
+ {% endfor %}
1902
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1903
+ <<material.RRR>>,
1904
+ {% endfor %}
1905
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1906
+ <<material.RRRRefTemp>>,
1907
+ {% endfor %}
1908
+ <<materialCodes[dm.magnet.solve.winding.superConductor.name]>>, // material integer: HTS
1909
+ <<dm.magnet.solve.winding.relativeThicknessOfSuperConductor>>, // relative thickness of HTS
1910
+ <<dm.magnet.solve.winding.superConductor.electricFieldCriterion>>, // electric field criterion of HTS
1911
+ <<dm.magnet.solve.winding.superConductor.nValue>>, // n value of HTS
1912
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect start turn
1913
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.endTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect end turn
1914
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.whichPancakeCoil if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "1">>, // local defect which pancake coil
1915
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.value if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect value
1916
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTime if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "99999999">>, // local defect start time
1917
+ <<windingThickness>>,
1918
+ <<dm.magnet.geometry.winding.height>>,
1919
+ <<scalingFactor>>,
1920
+ <<materialCodes[dm.magnet.solve.winding.shuntLayer.material.name]>>,
1921
+ <<dm.magnet.solve.winding.shuntLayer.material.relativeHeight>>,
1922
+ <<dm.magnet.solve.winding.shuntLayer.material.RRR>>,
1923
+ <<dm.magnet.solve.winding.shuntLayer.material.RRRRefTemp>>
1357
1924
  };
1358
1925
 
1359
- d_of_lambda_wrt_j[] =
1360
- AnisotropicCurrentSharingDerivative[
1926
+ jHTS[] = Pancake3DHTSCurrentDensity[
1927
+ $Time,
1928
+ XYZ[],
1361
1929
  $3,
1362
- Jcritical[$1, $2, $3, $4],
1363
- rhoNormalConductorParallelToWinding[$1, $2],
1364
- lambda[$1, $2, $3, $4]
1365
- ]{
1366
- Ecriterion,
1367
- n,
1368
- INPUT_relativeThicknessOfSuperConductor * <<dm.magnet.geometry.wi.t>>,
1369
- INPUT_relativeThicknessOfNormalConductor * <<dm.magnet.geometry.wi.t>>,
1370
- 1.0 // scaling applied to J, not applicable
1371
- };
1372
-
1373
- jHTS[] =
1374
- Vector[
1375
- CompX[$3],
1376
- lambda[$1, $2, $3, $4]#1/INPUT_relativeThicknessOfSuperConductor * CompY[$3], // get variable can be used
1377
- #1/INPUT_relativeThicknessOfSuperConductor * CompZ[$3] // get variable can be used
1378
- ];
1379
-
1380
- // Get variable can be used below
1381
- d_of_jHTS_wrt_j[] =
1382
- Tensor[
1930
+ $2,
1931
+ $1
1932
+ ]{ <<dm.magnet.solve.winding.superConductor.IcReferenceTemperature>>,
1933
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBmagnitude>>,
1934
+ <<dm.magnet.solve.winding.superConductor.IcReferenceBangle>>,
1935
+ <<dm.magnet.solve.winding.superConductor.IcInArcLength>>,
1936
+ {% if dm.magnet.solve.winding.isotropic %}
1383
1937
  1,
1938
+ {% else %}
1384
1939
  0,
1385
- 0,
1386
- CompX[d_of_lambda_wrt_j[$1, $2, $3, $4]#1]#2/INPUT_relativeThicknessOfSuperConductor * CompY[$3]#5,
1387
- CompY[#1]#3/INPUT_relativeThicknessOfSuperConductor * #5 + lambda[$1, $2, $3, $4]#7/INPUT_relativeThicknessOfSuperConductor,
1388
- CompZ[#1]#4/INPUT_relativeThicknessOfSuperConductor * #5,
1389
- #2/INPUT_relativeThicknessOfSuperConductor * CompZ[$3]#6,
1390
- #3/INPUT_relativeThicknessOfSuperConductor * #6,
1391
- #4/INPUT_relativeThicknessOfSuperConductor * #6 + #7/INPUT_relativeThicknessOfSuperConductor
1392
- ];
1393
-
1394
- rhoSuperConductorParallelToWinding[] =
1395
- Max[
1396
- rho_PowerLaw[
1397
- Norm[jHTS[$1, $2, $3, $4]],
1398
- Jcritical[$1, $2, $3, $4]
1399
- ]{
1400
- Ecriterion,
1401
- n
1402
- },
1403
- winding_minimumPossibleRho
1404
- ];
1405
-
1406
-
1407
- rhoSuperConductorParallelToWindingDerivative[] =
1408
- d_of_jHTS_wrt_j[$1, $2, $3, $4]*drhodj_PowerLaw[
1409
- jHTS[$1, $2, $3, $4],
1410
- Jcritical[$1, $2, $3, $4]
1411
- ]{
1412
- Ecriterion,
1413
- n
1414
- };
1415
-
1416
- rhoSuperConductorNormalToWinding[] =
1417
- Min[
1418
- rho_PowerLaw[
1419
- Norm[jHTS[$1, $2, $3, $4]],
1420
- INPUT_jCriticalScalingNormalToWinding * Jcritical[$1, $2, $3, $4]
1421
- ]{
1422
- Ecriterion,
1423
- n
1424
- },
1425
- winding_maximumPossibleRho
1426
- ];
1427
-
1428
- rhoSuperConductorNormalToWindingDerivative[] =
1429
- d_of_jHTS_wrt_j[$1, $2, $3, $4]*drhodj_PowerLaw[
1430
- jHTS[$1, $2, $3, $4],
1431
- INPUT_jCriticalScalingNormalToWinding * Jcritical[$1, $2, $3, $4]
1432
- ]{
1433
- Ecriterion,
1434
- n
1435
- };
1436
-
1437
- // The effective resistivity for currents parallel to the winding (parallel connection
1438
- // of materials):
1439
- rhoParallelToWinding[DOM_allWindings] =
1440
- EffectiveResistivity[
1441
- rhoNormalConductorParallelToWinding[$1, $2],
1442
- rhoSuperConductorParallelToWinding[$1, $2, $3, $4]
1443
- ]{
1444
- INPUT_relativeThicknessOfNormalConductor,
1445
- INPUT_relativeThicknessOfSuperConductor
1446
- };
1447
- // get variable can be used
1448
- rhoParallelToWindingDerivative[DOM_allWindings] =
1449
- EffectiveResistivityDerivative[
1450
- rhoParallelToWinding[$1, $2, $3, $4],
1451
- rhoSuperConductorParallelToWinding[$1, $2, $3, $4],
1452
- rhoSuperConductorParallelToWindingDerivative[$1, $2, $3, $4]
1453
- ]{
1454
- INPUT_relativeThicknessOfNormalConductor
1455
- };
1456
-
1457
- // The effective resistivity for currents perpendicular to the winding (series
1458
- // connection of materials):
1459
- rhoNormalToWindingWithoutPlating[DOM_allWindings] =
1460
- RuleOfMixtures[
1461
- rhoNormalConductorNormalToWinding[$1, $2],
1462
- rhoSuperConductorNormalToWinding[$1, $2, $3, $4]
1463
- ]{
1464
- INPUT_relativeThicknessOfNormalConductor,
1465
- INPUT_relativeThicknessOfSuperConductor
1466
- };
1467
-
1468
- rhoNormalToWinding[DOM_allWindings] =
1469
- EffectiveResistivity[
1470
- rhoNormalToWindingWithoutPlating[$1, $2, $3, $4],
1471
- rhoPlatingNormalToWinding[$1, $2]
1472
- ]{
1473
- 1.0 - INPUT_relativeWidthOfPlating,
1474
- INPUT_relativeWidthOfPlating
1475
- };
1476
-
1477
- rhoNormalToWindingDerivative[DOM_allWindings] =
1478
- EffectiveResistivityDerivative[
1479
- rhoNormalToWinding[$1, $2, $3, $4],
1480
- rhoNormalToWindingWithoutPlating[$1, $2, $3, $4],
1481
- INPUT_relativeThicknessOfSuperConductor * rhoSuperConductorNormalToWindingDerivative[$1, $2, $3, $4]
1482
- ]{
1483
- INPUT_relativeThicknessOfNormalConductor
1940
+ {% endif %}
1941
+ <<numberOfIcValues>>, // N of Ic Values
1942
+ {% for lengthValue in listOfLengthValues %}
1943
+ <<lengthValue>>,
1944
+ {% endfor %}
1945
+ {% for IcValue in listOfIcValues %}
1946
+ <<IcValue>>,
1947
+ {% endfor %}
1948
+ <<len(dm.magnet.solve.winding.normalConductors)>>, // N of materials,
1949
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1950
+ <<materialCodes[material.name]>>,
1951
+ {% endfor %}
1952
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1953
+ <<material.relativeThickness>>,
1954
+ {% endfor %}
1955
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1956
+ <<material.RRR>>,
1957
+ {% endfor %}
1958
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1959
+ <<material.RRRRefTemp>>,
1960
+ {% endfor %}
1961
+ <<materialCodes[dm.magnet.solve.winding.superConductor.name]>>, // material integer: HTS
1962
+ <<dm.magnet.solve.winding.relativeThicknessOfSuperConductor>>, // relative thickness of HTS
1963
+ <<dm.magnet.solve.winding.superConductor.electricFieldCriterion>>, // electric field criterion of HTS
1964
+ <<dm.magnet.solve.winding.superConductor.nValue>>, // n value of HTS
1965
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect start turn
1966
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.endTurn if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect end turn
1967
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.whichPancakeCoil if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "1">>, // local defect which pancake coil
1968
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.value if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "0">>, // local defect value
1969
+ <<dm.magnet.solve.localDefects.criticalCurrentDensity.startTime if dm.magnet.solve.localDefects.criticalCurrentDensity is not none else "99999999">>, // local defect start time
1970
+ <<windingThickness>>,
1971
+ <<dm.magnet.geometry.winding.height>>,
1972
+ <<scalingFactor>>,
1973
+ <<materialCodes[dm.magnet.solve.winding.shuntLayer.material.name]>>,
1974
+ <<dm.magnet.solve.winding.shuntLayer.material.relativeHeight>>,
1975
+ <<dm.magnet.solve.winding.shuntLayer.material.RRR>>,
1976
+ <<dm.magnet.solve.winding.shuntLayer.material.RRRRefTemp>>
1484
1977
  };
1485
-
1486
- rhoTensorInWindingCoordinates[] =
1487
- TensorDiag[
1488
- <<scalingFactor>> * rhoNormalToWinding[$1, $2, $3, $4],
1489
- 1.0/<<scalingFactor>> * rhoParallelToWinding[$1, $2, $3, $4]#1,
1490
- 1.0/<<scalingFactor>> * #1
1491
- ];
1492
-
1493
- // Homogenized resistivity tensor of the winding in XYZ coordinate system:
1494
- // rho($1 = T, $2 = b, $3 = jinWindingCoordinates)
1495
- rho[DOM_allWindings] =
1496
- TransformationTensor[] * rhoTensorInWindingCoordinates[$1, $2, $3, $4] * Transpose[TransformationTensor[]];
1497
-
1498
- // Moreover, for nonlinear simulations, we need the derivative of rho with respect
1499
- // to the current density for Newton-Raphson method.
1500
-
1501
- // ================================================================================
1502
- // FINITE DIFFERENCE DERIVATIVES BELOW ============================================
1503
- // ================================================================================
1504
- // step_j = 1E-1;
1505
-
1506
- // lambdaForFD[] = AnisotropicCurrentSharing[
1507
- // $3,
1508
- // Jcritical[$1, $2, $3, $4],
1509
- // rhoNormalConductorParallelToWinding[$1, $2]
1510
- // ]{
1511
- // Ecriterion,
1512
- // n,
1513
- // INPUT_relativeThicknessOfSuperConductor * <<dm.magnet.geometry.wi.t>>,
1514
- // INPUT_relativeThicknessOfNormalConductor * <<dm.magnet.geometry.wi.t>>,
1515
- // 1.0, // scaling applied to J, not applicable
1516
- // 20, // number of current sharing maximum iterations
1517
- // 1E-5 // absolute tolerance current sharing
1518
- // };
1519
-
1520
- // d_of_lambda_wrt_jFD[] = Vector[
1521
- // (lambdaForFD[$1, $2, $3 + Vector[step_j, 0, 0], $4] - lambdaForFD[$1, $2, $3 - Vector[step_j, 0, 0], $4])/2/step_j,
1522
- // (lambdaForFD[$1, $2, $3 + Vector[0, step_j, 0], $4] - lambdaForFD[$1, $2, $3 - Vector[0, step_j, 0], $4])/2/step_j,
1523
- // (lambdaForFD[$1, $2, $3 + Vector[0, 0, step_j], $4] - lambdaForFD[$1, $2, $3 - Vector[0, 0, step_j], $4])/2/step_j
1524
- // ];
1525
-
1526
- // jHTSForFD[] = Vector[
1527
- // CompX[$3],
1528
- // lambdaForFD[$1, $2, $3, $4]/INPUT_relativeThicknessOfSuperConductor * CompY[$3],
1529
- // lambdaForFD[$1, $2, $3, $4]/INPUT_relativeThicknessOfSuperConductor * CompZ[$3]
1530
- // ];
1531
-
1532
- // d_of_jHTS_wrt_jFD[] = TensorV[
1533
- // (jHTSForFD[$1, $2, $3 + Vector[step_j, 0, 0], $4] - jHTSForFD[$1, $2, $3 - Vector[step_j, 0, 0], $4])/2/step_j,
1534
- // (jHTSForFD[$1, $2, $3 + Vector[0, step_j, 0], $4] - jHTSForFD[$1, $2, $3 - Vector[0, step_j, 0], $4])/2/step_j,
1535
- // (jHTSForFD[$1, $2, $3 + Vector[0, 0, step_j], $4] - jHTSForFD[$1, $2, $3 - Vector[0, 0, step_j], $4])/2/step_j
1536
- // ];
1537
-
1538
- // rhoSuperConductorNormalToWindingForFD[] = rho_PowerLaw[
1539
- // Norm[jHTSForFD[$1, $2, $3, $4]],
1540
- // INPUT_jCriticalScalingNormalToWinding * Jcritical[$1, $2, $3, $4]
1541
- // ]{
1542
- // Ecriterion,
1543
- // n
1544
- // };
1545
-
1546
- // rhoSuperConductorParallelToWindingForFD[] = rho_PowerLaw[
1547
- // Norm[jHTSForFD[$1, $2, $3, $4]],
1548
- // Jcritical[$1, $2, $3, $4]
1549
- // ]{
1550
- // Ecriterion,
1551
- // n
1552
- // };
1553
-
1554
- // rhoNormalToWindingForFD[DOM_allWindings] = EffectiveResistivity[
1555
- // RuleOfMixtures[
1556
- // rhoNormalConductorNormalToWinding[$1, $2],
1557
- // rhoSuperConductorNormalToWindingForFD[$1, $2, $3, $4]]{
1558
- // INPUT_relativeThicknessOfNormalConductor,
1559
- // INPUT_relativeThicknessOfSuperConductor
1560
- // },
1561
- // rhoPlatingNormalToWinding[$1, $2]
1562
- // ]{
1563
- // 1.0 - INPUT_relativeWidthOfPlating,
1564
- // INPUT_relativeWidthOfPlating
1565
- // };
1566
-
1567
- // rhoParallelToWindingForFD[DOM_allWindings] = EffectiveResistivity[
1568
- // rhoNormalConductorParallelToWinding[$1, $2],
1569
- // rhoSuperConductorParallelToWindingForFD[$1, $2, $3, $4]
1570
- // ]{
1571
- // INPUT_relativeThicknessOfNormalConductor,
1572
- // INPUT_relativeThicknessOfSuperConductor
1573
- // };
1574
-
1575
- // rhoNormalToWindingDerivativeFD[] = SetVariable[
1576
- // Vector[
1577
- // <<scalingFactor>> * (rhoNormalToWindingForFD[$1, $2, $3 + Vector[step_j, 0, 0], $4] - rhoNormalToWindingForFD[$1, $2, $3 - Vector[step_j, 0, 0], $4])/(2 * step_j),
1578
- // <<scalingFactor>> * (rhoNormalToWindingForFD[$1, $2, $3 + Vector[0, step_j, 0], $4] - rhoNormalToWindingForFD[$1, $2, $3 - Vector[0, step_j, 0], $4])/(2 * step_j),
1579
- // <<scalingFactor>> * (rhoNormalToWindingForFD[$1, $2, $3 + Vector[0, 0, step_j], $4] - rhoNormalToWindingForFD[$1, $2, $3 - Vector[0, 0, step_j], $4])/(2 * step_j)
1580
- // ],
1581
- // ElementNum[],
1582
- // QuadraturePointIndex[],
1583
- // $Time,
1584
- // $NLIteration
1585
- // ]{
1586
- // $rhoNormalToWindingDerivativeFD
1587
- // };
1588
-
1589
- // rhoParallelToWindingDerivativeFD[] = SetVariable[
1590
- // Vector[
1591
- // 1/<<scalingFactor>> * (rhoParallelToWindingForFD[$1, $2, $3 + Vector[step_j, 0, 0], $4] - rhoParallelToWindingForFD[$1, $2, $3 - Vector[step_j, 0, 0], $4])/(2 * step_j),
1592
- // 1/<<scalingFactor>> * (rhoParallelToWindingForFD[$1, $2, $3 + Vector[0, step_j, 0], $4] - rhoParallelToWindingForFD[$1, $2, $3 - Vector[0, step_j, 0], $4])/(2 * step_j),
1593
- // 1/<<scalingFactor>> * (rhoParallelToWindingForFD[$1, $2, $3 + Vector[0, 0, step_j], $4] - rhoParallelToWindingForFD[$1, $2, $3 - Vector[0, 0, step_j], $4])/(2 * step_j)
1594
- // ],
1595
- // ElementNum[],
1596
- // QuadraturePointIndex[],
1597
- // $Time,
1598
- // $NLIteration
1599
- // ]{
1600
- // $rhoParallelToWindingDerivativeFD
1601
- // };
1602
-
1603
- // d_of_rho_wrt_jWindingCoords_windingCoordinates_TIMES_jWindingCoordsFD[] = Tensor[
1604
- // // ------------- first row ----------------
1605
- // CompX[rhoNormalToWindingDerivativeFD[$1, $2, $3, $4]] * CompX[$3],
1606
- // CompY[GetVariable[ElementNum[], QuadraturePointIndex[], $Time, $NLIteration]{$rhoNormalToWindingDerivativeFD}] * CompX[$3],
1607
- // CompZ[GetVariable[ElementNum[], QuadraturePointIndex[], $Time, $NLIteration]{$rhoNormalToWindingDerivativeFD}] * CompX[$3],
1608
- // // ------------- second row ----------------
1609
- // CompX[rhoParallelToWindingDerivativeFD[$1, $2, $3, $4]] * CompY[$3],
1610
- // CompY[GetVariable[ElementNum[], QuadraturePointIndex[], $Time, $NLIteration]{$rhoParallelToWindingDerivativeFD}] * CompY[$3],
1611
- // CompZ[GetVariable[ElementNum[], QuadraturePointIndex[], $Time, $NLIteration]{$rhoParallelToWindingDerivativeFD}] * CompY[$3],
1612
- // // ------------- third row ----------------
1613
- // CompX[GetVariable[ElementNum[], QuadraturePointIndex[], $Time, $NLIteration]{$rhoParallelToWindingDerivativeFD}] * CompZ[$3],
1614
- // CompY[GetVariable[ElementNum[], QuadraturePointIndex[], $Time, $NLIteration]{$rhoParallelToWindingDerivativeFD}] * CompZ[$3],
1615
- // CompZ[GetVariable[ElementNum[], QuadraturePointIndex[], $Time, $NLIteration]{$rhoParallelToWindingDerivativeFD}] * CompZ[$3]
1616
- // ];
1617
- // ================================================================================
1618
- // FINITE DIFFERENCE DERIVATIVES ABOVE ============================================
1619
- // ================================================================================
1620
-
1621
- // Please note that the expression below is not only the derivative, it's entries
1622
- // are multiplied by the current density.
1623
-
1624
- d_of_rho_wrt_jWindingCoords_windingCoordinates_TIMES_jWindingCoords[] = Pancake3DDerivativeTensorWRTjINWindingCoordsTimesJ[
1625
- rhoNormalToWindingDerivative[$1, $2, $3, $4],
1626
- rhoParallelToWindingDerivative[$1, $2, $3, $4],
1627
- rhoSuperConductorParallelToWinding[$1, $2, $3, $4],
1628
- rhoSuperConductorNormalToWinding[$1, $2, $3, $4],
1629
- $3
1630
- ]{
1631
- winding_minimumPossibleRho,
1632
- winding_maximumPossibleRho
1633
- };
1634
- d_of_rho_wrt_j_TIMES_j[DOM_allWindings] = TransformationTensor[] * d_of_rho_wrt_jWindingCoords_windingCoordinates_TIMES_jWindingCoords[$1, $2, $3, $4] * Transpose[TransformationTensor[]];
1635
-
1636
- {% else %}
1637
- // There is no superconductor in the winding.
1638
-
1639
- rhoTensorInWindingCoordinates[] = TensorDiag[
1640
- rhoNormalConductorNormalToWinding[$1, $2],
1641
- rhoNormalConductorParallelToWinding[$1, $2],
1642
- rhoNormalConductorParallelToWinding[$1, $2]
1643
- ];
1644
-
1645
- // Homogenized resistivity tensor of the winding in XYZ coordinate system:
1646
- // rho($1 = T, $2 = b, $3 = jinWindingCoordinates)
1647
- rho[DOM_allWindings] = TransformationTensor[] * rhoTensorInWindingCoordinates[$1, $2, $3] * Transpose[TransformationTensor[]];
1648
- {% endif %}
1649
- {% endif %}
1650
1978
  {% endif %}
1651
- // Winding resistivity ends ========================================================
1979
+ // Winding resistivity, Jc, and lambda ends ========================================================
1652
1980
 
1653
1981
  // Terminals resistivity starts ====================================================
1654
- {% if dm.magnet.solve.ti.transitionNotch.resistivity %}
1655
- rho[DOM_transitionNotchVolumes] = <<dm.magnet.solve.ti.transitionNotch.resistivity>>;
1982
+ {% if dm.magnet.solve.terminals.transitionNotch.resistivity %}
1983
+ rho[DOM_transitionNotchVolumes] = <<dm.magnet.solve.terminals.transitionNotch.resistivity>>;
1656
1984
  {% else %}
1657
- rho[DOM_transitionNotchVolumes] = <<materials[dm.magnet.solve.ti.transitionNotch.material.resistivityMacroName](RRR=dm.magnet.solve.ti.transitionNotch.material.rrr, rrrRefT=dm.magnet.solve.ti.transitionNotch.material.rrrRefT)>>;
1985
+ rho[DOM_transitionNotchVolumes] = <<materials[dm.magnet.solve.terminals.transitionNotch.material.resistivityMacroName](RRR=dm.magnet.solve.terminals.transitionNotch.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.transitionNotch.material.RRRRefTemp)>>;
1658
1986
  {% endif %}
1659
1987
 
1660
- {% if dm.magnet.solve.ti.resistivity %}
1988
+ {% if dm.magnet.solve.terminals.resistivity %}
1661
1989
  // Linear:
1662
- INPUT_terminalResistivity = <<dm.magnet.solve.ti.resistivity>>; // resistivity of the terminals, [Ohm*m]
1990
+ INPUT_terminalResistivity = <<dm.magnet.solve.terminals.resistivity>>; // resistivity of the terminals, [Ohm*m]
1663
1991
  rho[DOM_terminals] = INPUT_terminalResistivity;
1664
1992
  {% else %}
1665
1993
  // Nonlinear:
1666
- rho[DOM_terminals] = <<materials[dm.magnet.solve.ti.material.resistivityMacroName](RRR=dm.magnet.solve.ti.material.rrr, rrrRefT=dm.magnet.solve.ti.material.rrrRefT)>>;
1994
+ rho[DOM_terminals] = <<materials[dm.magnet.solve.terminals.material.resistivityMacroName](RRR=dm.magnet.solve.terminals.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.material.RRRRefTemp)>>;
1667
1995
 
1668
1996
  {% endif %}
1669
1997
  // Terminals resistivity ends ======================================================
1670
1998
 
1671
1999
  // Insulation resistivity starts ===================================================
1672
- {% if dm.magnet.solve.ii.resistivity != "perfectlyInsulating" %}
1673
- {% if dm.magnet.solve.ii.resistivity %}
2000
+ {% if dm.magnet.solve.contactLayer.resistivity != "perfectlyInsulating" %}
2001
+ {% if dm.magnet.solve.contactLayer.resistivity %}
1674
2002
  // Linear:
1675
- INPUT_insulationResistivity =<<dm.magnet.solve.ii.resistivity>>; // resistivity of the insulation, [Ohm*m]
2003
+ INPUT_insulationResistivity =<<dm.magnet.solve.contactLayer.resistivity>>; // resistivity of the insulation, [Ohm*m]
1676
2004
 
1677
- {% if dm.magnet.geometry.ii.tsa %}
2005
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
1678
2006
  electromagneticOnlyFunction[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_fct_only[]{
1679
- th_ins_k, INPUT_insulationResistivity
2007
+ th_terminal_k, INPUT_insulationResistivity
1680
2008
  };
1681
2009
  // Thin-shell insulation:
1682
2010
  {% for a in range(1,3) %}
1683
2011
  {% for b in range(1,3) %}
1684
2012
  electromagneticMassFunctionNoDta<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_mass[]{
1685
- th_ins_k, INPUT_insulationResistivity, <<a>>, <<b>>
2013
+ th_terminal_k, INPUT_insulationResistivity, <<a>>, <<b>>
1686
2014
  };
1687
2015
 
1688
2016
  electromagneticStiffnessFunctiona<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_stiffness[]{
1689
- th_ins_k, INPUT_insulationResistivity, <<a>>, <<b>>
2017
+ th_terminal_k, INPUT_insulationResistivity, <<a>>, <<b>>
1690
2018
  };
1691
2019
 
1692
2020
  electromagneticMassFunctionDta<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_mass[]{
1693
- th_ins_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
2021
+ th_terminal_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
1694
2022
  };
1695
2023
 
1696
2024
  {% endfor %}
@@ -1698,13 +2026,13 @@ if (
1698
2026
 
1699
2027
  {% for k in range(1,3) %}
1700
2028
  electromagneticRHSFunctionk<<k>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_rhs[]{
1701
- th_ins_k, INPUT_insulationResistivity
2029
+ th_terminal_k, INPUT_insulationResistivity
1702
2030
  };
1703
2031
 
1704
2032
  {% for a in range(1,3) %}
1705
2033
  {% for b in range(1,3) %}
1706
2034
  electromagneticTripleFunctionk<<k>>a<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_triple[]{
1707
- th_ins_k, INPUT_insulationResistivity, <<k>>, <<a>>, <<b>>
2035
+ th_terminal_k, INPUT_insulationResistivity, <<k>>, <<a>>, <<b>>
1708
2036
  };
1709
2037
 
1710
2038
  {% endfor %}
@@ -1715,39 +2043,36 @@ if (
1715
2043
  // Volume insulation:
1716
2044
  rho[DOM_insulation] = INPUT_insulationResistivity;
1717
2045
  {% endif %}
1718
- {% elif not dm.magnet.solve.ii.resistivity %}
2046
+ {% elif not dm.magnet.solve.contactLayer.resistivity %}
1719
2047
  // Nonlinear:
1720
- {% if dm.magnet.geometry.ii.tsa %}
1721
- electromagneticOnlyFunction[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSAOnlyResistivityFunction>>[$1, $2]{
1722
- oneDGaussianOrder, th_ins_k
2048
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2049
+ electromagneticOnlyFunction[DOM_insulationSurface] = <<dm.magnet.solve.contactLayer.material.getdpTSAOnlyResistivityFunction>>[$1, $2]{
2050
+ oneDGaussianOrder, th_terminal_k
1723
2051
  };
1724
2052
  // Thin-shell insulation:
1725
2053
  {% for a in range(1,3) %}
1726
2054
  {% for b in range(1,3) %}
1727
- electromagneticMassFunctionNoDta<<a>>b<<b>>[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSAMassResistivityFunction>>[$1, $2]{
1728
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
1729
- };
2055
+ electromagneticMassFunctionNoDta<<a>>b<<b>>[DOM_insulationSurface] = <<TSA_materials[dm.magnet.solve.contactLayer.material.getdpTSAMassResistivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.contactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.contactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_insulation_k")>>;
2056
+
2057
+ electromagneticStiffnessFunctiona<<a>>b<<b>>[DOM_insulationSurface] = <<TSA_materials[dm.magnet.solve.contactLayer.material.getdpTSAStiffnessResistivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.contactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.contactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_insulation_k")>>;
1730
2058
 
1731
- electromagneticStiffnessFunctiona<<a>>b<<b>>[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSAStiffnessResistivityFunction>>[$1, $2]{
1732
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
1733
- };
1734
2059
 
1735
2060
  electromagneticMassFunctionDta<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_mass[]{
1736
- th_ins_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
2061
+ th_terminal_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
1737
2062
  };
1738
2063
 
1739
2064
  {% endfor %}
1740
2065
  {% endfor %}
1741
2066
 
1742
2067
  {% for k in range(1,3) %}
1743
- electromagneticRHSFunctionk<<k>>[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSARHSFunction>>[$1, $2]{
1744
- <<k>>, oneDGaussianOrder, th_ins_k
2068
+ electromagneticRHSFunctionk<<k>>[DOM_insulationSurface] = <<dm.magnet.solve.contactLayer.material.getdpTSARHSFunction>>[$1, $2]{
2069
+ <<k>>, oneDGaussianOrder, th_terminal_k
1745
2070
  };
1746
2071
 
1747
2072
  {% for a in range(1,3) %}
1748
2073
  {% for b in range(1,3) %}
1749
- electromagneticTripleFunctionk<<k>>a<<a>>b<<b>>[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSATripleFunction>>[$1, $2]{
1750
- <<k>>, <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2074
+ electromagneticTripleFunctionk<<k>>a<<a>>b<<b>>[DOM_insulationSurface] = <<dm.magnet.solve.contactLayer.material.getdpTSATripleFunction>>[$1, $2]{
2075
+ <<k>>, <<a>>, <<b>>, oneDGaussianOrder, th_terminal_k
1751
2076
  };
1752
2077
 
1753
2078
  {% endfor %}
@@ -1755,7 +2080,7 @@ if (
1755
2080
  {% endfor %}
1756
2081
  {% else %}
1757
2082
  // Volume insulation:
1758
- rho[DOM_insulation] = <<materials[dm.magnet.solve.ii.material.resistivityMacroName](RRR=dm.magnet.solve.ii.material.rrr, rrrRefT=dm.magnet.solve.ii.material.rrrRefT)>>;
2083
+ rho[DOM_insulation] = <<materials[dm.magnet.solve.contactLayer.material.resistivityMacroName](RRR=dm.magnet.solve.contactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.contactLayer.material.RRRRefTemp)>>;
1759
2084
 
1760
2085
  {% endif %}
1761
2086
  {% endif %}
@@ -1763,27 +2088,27 @@ if (
1763
2088
  // Insulation resistivity ends =====================================================
1764
2089
 
1765
2090
  // Transition layer resistivity starts =============================================
1766
- {% if dm.magnet.solve.ti.terminalContactLayer.resistivity %}
2091
+ {% if dm.magnet.solve.terminals.terminalContactLayer.resistivity %}
1767
2092
  // Linear:
1768
- INPUT_terminalContactLayerResistivity = <<dm.magnet.solve.ti.terminalContactLayer.resistivity>>; // resistivity of the insulation, [Ohm*m]
2093
+ INPUT_terminalContactLayerResistivity = <<dm.magnet.solve.terminals.terminalContactLayer.resistivity>>; // resistivity of the insulation, [Ohm*m]
1769
2094
 
1770
- {% if dm.magnet.geometry.ii.tsa %}
2095
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
1771
2096
  electromagneticOnlyFunction[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_fct_only[]{
1772
- th_ins_k, INPUT_terminalContactLayerResistivity
2097
+ th_terminal_k, INPUT_terminalContactLayerResistivity
1773
2098
  };
1774
2099
  // Thin-shell insulation:
1775
2100
  {% for a in range(1,3) %}
1776
2101
  {% for b in range(1,3) %}
1777
2102
  electromagneticMassFunctionNoDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_mass[]{
1778
- th_ins_k, INPUT_terminalContactLayerResistivity, <<a>>, <<b>>
2103
+ th_terminal_k, INPUT_terminalContactLayerResistivity, <<a>>, <<b>>
1779
2104
  };
1780
2105
 
1781
2106
  electromagneticStiffnessFunctiona<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_stiffness[]{
1782
- th_ins_k, INPUT_terminalContactLayerResistivity, <<a>>, <<b>>
2107
+ th_terminal_k, INPUT_terminalContactLayerResistivity, <<a>>, <<b>>
1783
2108
  };
1784
2109
 
1785
2110
  electromagneticMassFunctionDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_mass[]{
1786
- th_ins_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
2111
+ th_terminal_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
1787
2112
  };
1788
2113
 
1789
2114
  {% endfor %}
@@ -1791,13 +2116,13 @@ if (
1791
2116
 
1792
2117
  {% for k in range(1,3) %}
1793
2118
  electromagneticRHSFunctionk<<k>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_rhs[]{
1794
- th_ins_k, INPUT_terminalContactLayerResistivity
2119
+ th_terminal_k, INPUT_terminalContactLayerResistivity
1795
2120
  };
1796
2121
 
1797
2122
  {% for a in range(1,3) %}
1798
2123
  {% for b in range(1,3) %}
1799
2124
  electromagneticTripleFunctionk<<k>>a<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_triple[]{
1800
- th_ins_k, INPUT_terminalContactLayerResistivity, <<k>>, <<a>>, <<b>>
2125
+ th_terminal_k, INPUT_terminalContactLayerResistivity, <<k>>, <<a>>, <<b>>
1801
2126
  };
1802
2127
 
1803
2128
  {% endfor %}
@@ -1807,39 +2132,35 @@ if (
1807
2132
  {% else %}
1808
2133
  rho[DOM_terminalContactLayer] = INPUT_terminalContactLayerResistivity;
1809
2134
  {% endif %}
1810
- {% elif not dm.magnet.solve.ti.terminalContactLayer.resistivity %}
2135
+ {% elif not dm.magnet.solve.terminals.terminalContactLayer.resistivity %}
1811
2136
  // Nonlinear:
1812
- {% if dm.magnet.geometry.ii.tsa %}
1813
- electromagneticOnlyFunction[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSAOnlyResistivityFunction>>[$1, $2]{
1814
- oneDGaussianOrder, th_ins_k
2137
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2138
+ electromagneticOnlyFunction[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSAOnlyResistivityFunction>>[$1, $2]{
2139
+ oneDGaussianOrder, th_terminal_k
1815
2140
  };
1816
2141
  // Thin-shell insulation:
1817
2142
  {% for a in range(1,3) %}
1818
2143
  {% for b in range(1,3) %}
1819
- electromagneticMassFunctionNoDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSAMassResistivityFunction>>[$1, $2]{
1820
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
1821
- };
2144
+ electromagneticMassFunctionNoDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<TSA_materials[dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSAMassResistivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_terminal_k")>>;
1822
2145
 
1823
- electromagneticStiffnessFunctiona<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSAStiffnessResistivityFunction>>[$1, $2]{
1824
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
1825
- };
2146
+ electromagneticStiffnessFunctiona<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<TSA_materials[dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSAStiffnessResistivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_terminal_k")>>;
1826
2147
 
1827
2148
  electromagneticMassFunctionDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_mass[]{
1828
- th_ins_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
2149
+ th_terminal_k, INPUT_airMagneticPermeability, <<a>>, <<b>>
1829
2150
  };
1830
2151
 
1831
2152
  {% endfor %}
1832
2153
  {% endfor %}
1833
2154
 
1834
2155
  {% for k in range(1,3) %}
1835
- electromagneticRHSFunctionk<<k>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSARHSFunction>>[$1, $2]{
1836
- <<k>>, oneDGaussianOrder, th_ins_k
2156
+ electromagneticRHSFunctionk<<k>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSARHSFunction>>[$1, $2]{
2157
+ <<k>>, oneDGaussianOrder, th_terminal_k
1837
2158
  };
1838
2159
 
1839
2160
  {% for a in range(1,3) %}
1840
2161
  {% for b in range(1,3) %}
1841
- electromagneticTripleFunctionk<<k>>a<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSATripleFunction>>[$1, $2]{
1842
- <<k>>, <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2162
+ electromagneticTripleFunctionk<<k>>a<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSATripleFunction>>[$1, $2]{
2163
+ <<k>>, <<a>>, <<b>>, oneDGaussianOrder, th_terminal_k
1843
2164
  };
1844
2165
 
1845
2166
  {% endfor %}
@@ -1847,157 +2168,123 @@ if (
1847
2168
  {% endfor %}
1848
2169
  {% else %}
1849
2170
  // Volume insulation:
1850
- rho[DOM_terminalContactLayer] = <<materials[dm.magnet.solve.ti.terminalContactLayer.material.resistivityMacroName](RRR=dm.magnet.solve.ti.terminalContactLayer.material.rrr, rrrRefT=dm.magnet.solve.ti.terminalContactLayer.material.rrrRefT)>>;
2171
+ rho[DOM_terminalContactLayer] = <<materials[dm.magnet.solve.terminals.terminalContactLayer.material.resistivityMacroName](RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp)>>;
1851
2172
 
1852
2173
  {% endif %}
1853
2174
  {% endif %}
1854
2175
  // Transition layer resistivity ends ===============================================
2176
+ {% if dm.magnet.solve.voltageTapPositions %}
2177
+ // the electric scalar potential formulation has to deal with very large conductivity values
2178
+ // to yield an equivalent system with better conditioning, it is scaled with this factor
2179
+ electricScalarPotential_scalingFactor = 1E-10;
2180
+ // Transition layer conductivity starts =============================================
2181
+ {% if dm.magnet.solve.terminals.terminalContactLayer.resistivity and dm.magnet.geometry.contactLayer.thinShellApproximation %}
2182
+
2183
+ // Linear:
2184
+ INPUT_terminalContactLayerConductivity = 1./<<dm.magnet.solve.terminals.terminalContactLayer.resistivity>>; // resistivity of the insulation, [S/m]
2185
+
2186
+ // Thin-shell insulation:
2187
+ {% for a in range(1,3) %}
2188
+ {% for b in range(1,3) %}
2189
+ electricScalarPotentialMassFunctionNoDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_mass[]{
2190
+ th_terminal_k, INPUT_terminalContactLayerConductivity, <<a>>, <<b>>
2191
+ };
2192
+
2193
+ electricScalarPotentialStiffnessFunctiona<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_stiffness[]{
2194
+ th_terminal_k, INPUT_terminalContactLayerConductivity, <<a>>, <<b>>
2195
+ };
2196
+
2197
+ {% endfor %}
2198
+ {% endfor %}
2199
+
2200
+ {% elif not dm.magnet.solve.terminals.terminalContactLayer.resistivity %}
2201
+ // Thin-shell insulation:
2202
+ {# Non-linear TSA conductivity not considered yet. #}
2203
+ <<0/0>>;
2204
+
2205
+ {% endif %}
2206
+ // Transition layer conductivity ends ===============================================
2207
+
2208
+ {% endif %}
1855
2209
  {% endif %}
1856
2210
 
1857
2211
  {% if dm.magnet.solve.type in ["thermal", "weaklyCoupled", "stronglyCoupled"] %}
1858
2212
  // Winding thermal conductivity starts =============================================
1859
- {% if dm.magnet.solve.wi.thermalConductivity %}
2213
+ {% if dm.magnet.solve.winding.thermalConductivity %}
1860
2214
  // Linear:
1861
- INPUT_windingThermalConductivity = <<dm.magnet.solve.wi.thermalConductivity>>; // thermal conductivity of the winding, [W/*(m*K)]
2215
+ INPUT_windingThermalConductivity = <<dm.magnet.solve.winding.thermalConductivity>>; // thermal conductivity of the winding, [W/*(m*K)]
1862
2216
  kappa[DOM_allWindings] = INPUT_windingThermalConductivity;
1863
2217
  {% else %}
1864
2218
  // Nonlinear:
1865
- {% if use_cpp_materials %}
1866
2219
  kappa[DOM_allWindings] = WindingThermalConductivityV1[
1867
2220
  XYZ[],
1868
2221
  $2,
1869
2222
  $1
1870
- ]{
1871
- <<len(dm.magnet.solve.wi.normalConductors)>>, // N of materials,
1872
- {% for material in dm.magnet.solve.wi.normalConductors %}
2223
+ ]{ {% if dm.magnet.solve.winding.isotropic %} 1 {% else %} 0 {% endif %},
2224
+ <<len(dm.magnet.solve.winding.normalConductors)>>, // N of materials,
2225
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1873
2226
  <<materialCodes[material.name]>>,
1874
2227
  {% endfor %}
1875
- {% for material in dm.magnet.solve.wi.normalConductors %}
2228
+ {% for material in dm.magnet.solve.winding.normalConductors %}
1876
2229
  <<material.relativeThickness>>,
1877
2230
  {% endfor %}
1878
- {% for material in dm.magnet.solve.wi.normalConductors %}
1879
- <<material.rrr>>,
2231
+ {% for material in dm.magnet.solve.winding.normalConductors %}
2232
+ <<material.RRR>>,
1880
2233
  {% endfor %}
1881
- {% for material in dm.magnet.solve.wi.normalConductors %}
1882
- <<material.rrrRefT>>,
2234
+ {% for material in dm.magnet.solve.winding.normalConductors %}
2235
+ <<material.RRRRefTemp>>,
1883
2236
  {% endfor %}
1884
- <<materialCodes[dm.magnet.solve.wi.shuntLayer.material.name]>>,
1885
- <<dm.magnet.solve.wi.shuntLayer.material.relativeHeight>>,
1886
- <<dm.magnet.solve.wi.shuntLayer.material.rrr>>,
1887
- <<dm.magnet.solve.wi.shuntLayer.material.rrrRefT>>,
1888
- <<dm.magnet.geometry.wi.r_i>>,
2237
+ <<materialCodes[dm.magnet.solve.winding.shuntLayer.material.name]>>,
2238
+ <<dm.magnet.solve.winding.shuntLayer.material.relativeHeight>>,
2239
+ <<dm.magnet.solve.winding.shuntLayer.material.RRR>>,
2240
+ <<dm.magnet.solve.winding.shuntLayer.material.RRRRefTemp>>,
2241
+ <<dm.magnet.geometry.winding.innerRadius>>,
1889
2242
  <<windingThickness>>,
1890
2243
  <<gapThickness>>,
1891
- <<dm.magnet.geometry.wi.theta_i>>,
1892
- <<dm.magnet.mesh.wi.ane[0]>>,
1893
- <<dm.magnet.geometry.N>>,
1894
- <<dm.magnet.geometry.wi.h>>,
1895
- <<dm.magnet.geometry.gap>>,
2244
+ <<dm.magnet.geometry.winding.theta_i>>,
2245
+ <<dm.magnet.mesh.winding.azimuthalNumberOfElementsPerTurn[0]>>,
2246
+ <<dm.magnet.geometry.numberOfPancakes>>,
2247
+ <<dm.magnet.geometry.winding.height>>,
2248
+ <<dm.magnet.geometry.gapBetweenPancakes>>,
1896
2249
  <<scalingFactor>>,
1897
2250
  1 // arbitrary jCritical scaling normal to winding
1898
2251
  };
1899
- {% else %}
1900
- {% for material in dm.magnet.solve.wi.normalConductors %}
1901
- kappa<<material.name>>[] = <<materials[material.thermalConductivityMacroName](RRR=material.rrr, rrrRefT=material.rrrRefT)>>;
1902
- {% endfor %}
1903
-
1904
- // The effective thermal conductivity parallel to the winding (parallel connection
1905
- // of materials):
1906
- kappaParallelToWinding[DOM_allWindings] = RuleOfMixtures[
1907
- {% for material in dm.magnet.solve.wi.normalConductors %}
1908
- {% if loop.last %}
1909
- kappa<<material.name>>[$1, $2]
1910
- {% else %}
1911
- kappa<<material.name>>[$1, $2],
1912
- {% endif %}
1913
- {% endfor %}
1914
- ]{
1915
- {% for material in dm.magnet.solve.wi.normalConductors %}
1916
- {% if loop.last %}
1917
- INPUT_relativeThickness<<material.name>>
1918
- {% else %}
1919
- INPUT_relativeThickness<<material.name>>,
1920
- {% endif %}
1921
- {% endfor %}
1922
- };
1923
-
1924
- // The effective resistivity for currents perpendicular to the winding (series
1925
- // connection of materials):
1926
- kappaNormalToWinding[DOM_allWindings] = RuleOfMixtures[
1927
- EffectiveResistivity[
1928
- {% for material in dm.magnet.solve.wi.normalConductors %}
1929
- {% if loop.last %}
1930
- kappa<<material.name>>[$1, $2]
1931
- {% else %}
1932
- kappa<<material.name>>[$1, $2],
1933
- {% endif %}
1934
- {% endfor %}
1935
- ]{
1936
- {% for material in dm.magnet.solve.wi.normalConductors %}
1937
- {% if loop.last %}
1938
- INPUT_relativeThickness<<material.name>>
1939
- {% else %}
1940
- INPUT_relativeThickness<<material.name>>,
1941
- {% endif %}
1942
- {% endfor %}
1943
- },
1944
- kappa<<dm.magnet.solve.wi.shuntLayer.material.name>>[$1, $2]
1945
- ]{
1946
- 1.0 - INPUT_relativeWidthOfPlating,
1947
- INPUT_relativeWidthOfPlating
1948
- };
1949
-
1950
- kappaTensorInWindingCoordinates[] = TensorDiag[
1951
- 1.0/<<scalingFactor>> * kappaNormalToWinding[$1, $2],
1952
- <<scalingFactor>> * kappaParallelToWinding[$1, $2],
1953
- <<scalingFactor>> * kappaParallelToWinding[$1, $2]
1954
- ];
1955
-
1956
- // Homogenized thermal conductivity tensor of the winding in XYZ coordinate system:
1957
- // rho($1 = T, $2 = b, $3 = jMagnitude)
1958
- kappa[DOM_allWindings] = TransformationTensor[] * kappaTensorInWindingCoordinates[$1, $2] * Transpose[TransformationTensor[]];
1959
- {% endif %}
1960
2252
  {% endif %}
1961
2253
  // Winding thermal conductivity ends ===============================================
1962
2254
 
1963
2255
  // Terminals thermal conductivity starts ===========================================
1964
- {% if dm.magnet.solve.ti.transitionNotch.thermalConductivity %}
1965
- kappa[DOM_transitionNotchVolumes] = <<dm.magnet.solve.ti.transitionNotch.thermalConductivity>>;
2256
+ {% if dm.magnet.solve.terminals.transitionNotch.thermalConductivity %}
2257
+ kappa[DOM_transitionNotchVolumes] = <<dm.magnet.solve.terminals.transitionNotch.thermalConductivity>>;
1966
2258
  {% else %}
1967
- kappa[DOM_transitionNotchVolumes] = <<materials[dm.magnet.solve.ti.transitionNotch.material.thermalConductivityMacroName](RRR=dm.magnet.solve.ti.transitionNotch.material.rrr, rrrRefT=dm.magnet.solve.ti.transitionNotch.material.rrrRefT)>>;
2259
+ kappa[DOM_transitionNotchVolumes] = <<materials[dm.magnet.solve.terminals.transitionNotch.material.thermalConductivityMacroName](RRR=dm.magnet.solve.terminals.transitionNotch.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.transitionNotch.material.RRRRefTemp)>>;
1968
2260
  {% endif %}
1969
2261
 
1970
- {% if dm.magnet.solve.ti.thermalConductivity %}
2262
+ {% if dm.magnet.solve.terminals.thermalConductivity %}
1971
2263
  // Linear:
1972
- INPUT_terminalThermalConductivity = <<dm.magnet.solve.ti.thermalConductivity>>; // thermal conductivity of the terminal, [W/*(m*K)]
2264
+ INPUT_terminalThermalConductivity = <<dm.magnet.solve.terminals.thermalConductivity>>; // thermal conductivity of the terminal, [W/*(m*K)]
1973
2265
  kappa[DOM_terminals] = INPUT_terminalThermalConductivity;
1974
- kappa[DOM_topTerminalSurface] = INPUT_terminalThermalConductivity;
1975
- kappa[DOM_bottomTerminalSurface] = INPUT_terminalThermalConductivity;
1976
2266
  {% else %}
1977
2267
  // Nonlinear:
1978
- kappa[DOM_terminals] = <<materials[dm.magnet.solve.ti.material.thermalConductivityMacroName](RRR=dm.magnet.solve.ti.material.rrr, rrrRefT=dm.magnet.solve.ti.material.rrrRefT)>>;
1979
- kappa[DOM_topTerminalSurface] = <<materials[dm.magnet.solve.ti.material.thermalConductivityMacroName](RRR=dm.magnet.solve.ti.material.rrr, rrrRefT=dm.magnet.solve.ti.material.rrrRefT)>>;
1980
- kappa[DOM_bottomTerminalSurface] = <<materials[dm.magnet.solve.ti.material.thermalConductivityMacroName](RRR=dm.magnet.solve.ti.material.rrr, rrrRefT=dm.magnet.solve.ti.material.rrrRefT)>>;
2268
+ kappa[DOM_terminals] = <<materials[dm.magnet.solve.terminals.material.thermalConductivityMacroName](RRR=dm.magnet.solve.terminals.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.material.RRRRefTemp)>>;
1981
2269
  {% endif %}
1982
2270
  // Terminals thermal conductivity ends =============================================
1983
2271
 
1984
2272
  // Insulation thermal conductivity starts ==========================================
1985
- {% if dm.magnet.solve.ii.thermalConductivity %}
2273
+ {% if dm.magnet.solve.contactLayer.thermalConductivity %}
1986
2274
  // Linear:
1987
- INPUT_insulationThermalConductivity = <<dm.magnet.solve.ii.thermalConductivity>>; // thermal conductivity of the insulation, [W/*(m*K)]
2275
+ INPUT_insulationThermalConductivity = <<dm.magnet.solve.contactLayer.thermalConductivity>>; // thermal conductivity of the insulation, [W/*(m*K)]
1988
2276
 
1989
- {% if dm.magnet.geometry.ii.tsa %}
2277
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
1990
2278
  // Thin-shell insulation:
1991
2279
  {% for a in range(1,3) %}
1992
2280
  {% for b in range(1,3) %}
1993
2281
  thermalMassFunctionNoDta<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_mass[]{
1994
- th_ins_k, INPUT_insulationThermalConductivity, <<a>>, <<b>>
2282
+ th_insulation_k, INPUT_insulationThermalConductivity, <<a>>, <<b>>
1995
2283
  };
1996
2284
 
1997
2285
  thermalStiffnessFunctiona<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_stiffness[]{
1998
- th_ins_k, INPUT_insulationThermalConductivity, <<a>>, <<b>>
2286
+ th_insulation_k, INPUT_insulationThermalConductivity, <<a>>, <<b>>
1999
2287
  };
2000
-
2001
2288
  {% endfor %}
2002
2289
  {% endfor %}
2003
2290
  {% else %}
@@ -2006,41 +2293,37 @@ if (
2006
2293
  {% endif %}
2007
2294
  {% else %}
2008
2295
  // Nonlinear:
2009
- {% if dm.magnet.geometry.ii.tsa %}
2296
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2010
2297
  // Thin-shell insulation:
2011
2298
  {% for a in range(1,3) %}
2012
2299
  {% for b in range(1,3) %}
2013
- thermalMassFunctionNoDta<<a>>b<<b>>[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSAMassThermalConductivityFunction>>[$1, $2]{
2014
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2015
- };
2300
+ thermalMassFunctionNoDta<<a>>b<<b>>[DOM_insulationSurface] = <<TSA_materials[dm.magnet.solve.contactLayer.material.getdpTSAMassThermalConductivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.contactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.contactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", thickness_TSA="th_insulation_k", constantThickness=True)>>;
2016
2301
 
2017
- thermalStiffnessFunctiona<<a>>b<<b>>[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSAStiffnessThermalConductivityFunction>>[$1, $2]{
2018
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2019
- };
2302
+ thermalStiffnessFunctiona<<a>>b<<b>>[DOM_insulationSurface] = <<TSA_materials[dm.magnet.solve.contactLayer.material.getdpTSAStiffnessThermalConductivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.contactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.contactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", thickness_TSA="th_insulation_k", constantThickness=True)>>;
2020
2303
  {% endfor %}
2021
2304
  {% endfor %}
2022
2305
  {% else %}
2023
2306
  // Volume insulation:
2024
- kappa[DOM_insulation] = <<materials[dm.magnet.solve.ii.material.thermalConductivityMacroName](RRR=dm.magnet.solve.ii.material.rrr, rrrRefT=dm.magnet.solve.ii.material.rrrRefT)>>;
2307
+ kappa[DOM_insulation] = <<materials[dm.magnet.solve.contactLayer.material.thermalConductivityMacroName](RRR=dm.magnet.solve.contactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.contactLayer.material.RRRRefTemp)>>;
2025
2308
  {% endif %}
2026
2309
  {% endif %}
2027
2310
  // Insulation thermal conductivity ends ============================================
2028
2311
 
2029
2312
  // Transition layer thermal conductivity starts ====================================
2030
- {% if dm.magnet.solve.ti.terminalContactLayer.thermalConductivity %}
2313
+ {% if dm.magnet.solve.terminals.terminalContactLayer.thermalConductivity %}
2031
2314
  // Linear:
2032
- INPUT_terminalContactLayerThermalConductivity = <<dm.magnet.solve.ti.terminalContactLayer.thermalConductivity>>; // thermal conductivity of the insulation, [W/*(m*K)]
2315
+ INPUT_terminalContactLayerThermalConductivity = <<dm.magnet.solve.terminals.terminalContactLayer.thermalConductivity>>; // thermal conductivity of the insulation, [W/*(m*K)]
2033
2316
 
2034
- {% if dm.magnet.geometry.ii.tsa %}
2317
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2035
2318
  // Thin-shell insulation:
2036
2319
  {% for a in range(1,3) %}
2037
2320
  {% for b in range(1,3) %}
2038
2321
  thermalMassFunctionNoDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_mass[]{
2039
- th_ins_k, INPUT_terminalContactLayerThermalConductivity, <<a>>, <<b>>
2322
+ th_terminal_k, INPUT_terminalContactLayerThermalConductivity, <<a>>, <<b>>
2040
2323
  };
2041
2324
 
2042
2325
  thermalStiffnessFunctiona<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_stiffness[]{
2043
- th_ins_k, INPUT_terminalContactLayerThermalConductivity, <<a>>, <<b>>
2326
+ th_terminal_k, INPUT_terminalContactLayerThermalConductivity, <<a>>, <<b>>
2044
2327
  };
2045
2328
 
2046
2329
  {% endfor %}
@@ -2051,51 +2334,81 @@ if (
2051
2334
  {% endif %}
2052
2335
  {% else %}
2053
2336
  // Nonlinear:
2054
- {% if dm.magnet.geometry.ii.tsa %}
2337
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2055
2338
  // Thin-shell insulation:
2056
2339
  {% for a in range(1,3) %}
2057
2340
  {% for b in range(1,3) %}
2058
- thermalMassFunctionNoDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSAMassThermalConductivityFunction>>[$1, $2]{
2059
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2060
- };
2341
+ thermalMassFunctionNoDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<TSA_materials[dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSAMassThermalConductivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_terminal_k")>>;
2061
2342
 
2062
- thermalStiffnessFunctiona<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSAStiffnessThermalConductivityFunction>>[$1, $2]{
2063
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2064
- };
2343
+ thermalStiffnessFunctiona<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<TSA_materials[dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSAStiffnessThermalConductivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_terminal_k")>>;
2344
+
2065
2345
  {% endfor %}
2066
2346
  {% endfor %}
2067
2347
  {% else %}
2068
2348
  // Volume insulation:
2069
- kappa[DOM_terminalContactLayer] = <<materials[dm.magnet.solve.ti.terminalContactLayer.material.thermalConductivityMacroName](RRR=dm.magnet.solve.ti.terminalContactLayer.material.rrr, rrrRefT=dm.magnet.solve.ti.terminalContactLayer.material.rrrRefT)>>;
2349
+ kappa[DOM_terminalContactLayer] = <<materials[dm.magnet.solve.terminals.terminalContactLayer.material.thermalConductivityMacroName](RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp)>>;
2070
2350
  {% endif %}
2071
2351
  {% endif %}
2072
2352
  // Transition layer thermal conductivity ends ======================================
2353
+
2354
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
2355
+ // Cryocooler thermal conductivity starts ====================================
2356
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.thermalConductivity %}
2357
+ // Linear:
2358
+ INPUT_cryocoolerThermalConductivity = <<dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.thermalConductivity>>; // thermal conductivity of the insulation, [W/*(m*K)]
2359
+
2360
+ {% for a in range(1,3) %}
2361
+ {% for b in range(1,3) %}
2362
+ thermalMassFunctionNoDta<<a>>b<<b>>[DOM_terminalSurfaces] = TSA_constantMaterial_mass[th_cryocooler_k[]]{
2363
+ INPUT_cryocoolerThermalConductivity, <<a>>, <<b>>
2364
+ };
2365
+
2366
+ thermalStiffnessFunctiona<<a>>b<<b>>[DOM_terminalSurfaces] = TSA_constantMaterial_stiffness[th_cryocooler_k[]]{
2367
+ INPUT_cryocoolerThermalConductivity, <<a>>, <<b>>
2368
+ };
2369
+
2370
+ {% endfor %}
2371
+ {% endfor %}
2372
+ {% else %}
2373
+ // Nonlinear:
2374
+ {% for a in range(1,3) %}
2375
+ {% for b in range(1,3) %}
2376
+ thermalMassFunctionNoDta<<a>>b<<b>>[DOM_terminalSurfaces] = <<TSA_materials[dm.magnet.solve.cryocooler.lumpedMass.material.getdpTSAMassThermalConductivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", thickness_TSA="th_cryocooler_k[]")>>;
2377
+
2378
+ thermalStiffnessFunctiona<<a>>b<<b>>[DOM_terminalSurfaces] = <<TSA_materials[dm.magnet.solve.cryocooler.lumpedMass.material.getdpTSAStiffnessThermalConductivityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", thickness_TSA="th_cryocooler_k[]")>>;
2379
+
2380
+ {% endfor %}
2381
+ {% endfor %}
2382
+
2383
+ {% endif %}
2384
+ // Cryocooler thermal conductivity ends ======================================
2385
+ {% endif %}
2073
2386
 
2074
2387
  // Winding specific heat capacity starts ===========================================
2075
- {% if dm.magnet.solve.wi.specificHeatCapacity %}
2388
+ {% if dm.magnet.solve.winding.specificHeatCapacity %}
2076
2389
  // Linear:
2077
- INPUT_coilSpecificHeatCapacity = <<dm.magnet.solve.wi.specificHeatCapacity>>; // specific heat capacity of the coil, [J/(kg*K)]
2390
+ INPUT_coilSpecificHeatCapacity = <<dm.magnet.solve.winding.specificHeatCapacity>>; // specific heat capacity of the coil, [J/(kg*K)]
2078
2391
  Cv[DOM_allWindings] = INPUT_coilSpecificHeatCapacity;
2079
2392
  {% else %}
2080
2393
  // Nonlinear:
2081
- {% for material in dm.magnet.solve.wi.normalConductors %}
2082
- Cv<<material.name>>[] = <<materials[material.heatCapacityMacroName]()>>;
2394
+ {% for material in dm.magnet.solve.winding.normalConductors %}
2395
+ Cv<<material.getdpNormalMaterialGetDPName>>[] = <<materials[material.heatCapacityMacroName]()>>;
2083
2396
  {% endfor %}
2084
2397
 
2085
2398
  Cv[DOM_allWindings] = <<scalingFactor>> * RuleOfMixtures[
2086
- {% for material in dm.magnet.solve.wi.normalConductors %}
2399
+ {% for material in dm.magnet.solve.winding.normalConductors %}
2087
2400
  {% if loop.last %}
2088
- Cv<<material.name>>[$1]
2401
+ Cv<<material.getdpNormalMaterialGetDPName>>[$1]
2089
2402
  {% else %}
2090
- Cv<<material.name>>[$1],
2403
+ Cv<<material.getdpNormalMaterialGetDPName>>[$1],
2091
2404
  {% endif %}
2092
2405
  {% endfor %}
2093
2406
  ]{
2094
- {% for material in dm.magnet.solve.wi.normalConductors %}
2407
+ {% for material in dm.magnet.solve.winding.normalConductors %}
2095
2408
  {% if loop.last %}
2096
- INPUT_relativeThickness<<material.name>>
2409
+ INPUT_relativeThickness<<material.getdpNormalMaterialGetDPName>>
2097
2410
  {% else %}
2098
- INPUT_relativeThickness<<material.name>>,
2411
+ INPUT_relativeThickness<<material.getdpNormalMaterialGetDPName>>,
2099
2412
  {% endif %}
2100
2413
  {% endfor %}
2101
2414
  };
@@ -2103,33 +2416,33 @@ if (
2103
2416
  // Winding specific heat capacity ends =============================================
2104
2417
 
2105
2418
  // Terminals specific heat capacity starts =========================================
2106
- {% if dm.magnet.solve.ti.transitionNotch.specificHeatCapacity %}
2107
- Cv[DOM_transitionNotchVolumes] = <<dm.magnet.solve.ti.transitionNotch.specificHeatCapacity>>;
2419
+ {% if dm.magnet.solve.terminals.transitionNotch.specificHeatCapacity %}
2420
+ Cv[DOM_transitionNotchVolumes] = <<dm.magnet.solve.terminals.transitionNotch.specificHeatCapacity>>;
2108
2421
  {% else %}
2109
- Cv[DOM_transitionNotchVolumes] = <<materials[dm.magnet.solve.ti.transitionNotch.material.heatCapacityMacroName]()>>;
2422
+ Cv[DOM_transitionNotchVolumes] = <<materials[dm.magnet.solve.terminals.transitionNotch.material.heatCapacityMacroName]()>>;
2110
2423
  {% endif %}
2111
2424
 
2112
- {% if dm.magnet.solve.ti.specificHeatCapacity %}
2425
+ {% if dm.magnet.solve.terminals.specificHeatCapacity %}
2113
2426
  // Linear:
2114
- INPUT_terminalSpecificHeatCapacity = <<dm.magnet.solve.ti.specificHeatCapacity>>; // specific heat capacity of the terminal, [J/(kg*K)]
2427
+ INPUT_terminalSpecificHeatCapacity = <<dm.magnet.solve.terminals.specificHeatCapacity>>; // specific heat capacity of the terminal, [J/(kg*K)]
2115
2428
  Cv[DOM_terminals] = INPUT_terminalSpecificHeatCapacity;
2116
2429
  {% else %}
2117
2430
  // Nonlinear:
2118
- Cv[DOM_terminals] = <<materials[dm.magnet.solve.ti.material.heatCapacityMacroName]()>>;
2431
+ Cv[DOM_terminals] = <<materials[dm.magnet.solve.terminals.material.heatCapacityMacroName]()>>;
2119
2432
  {% endif %}
2120
2433
  // Terminals specific heat capacity ends ===========================================
2121
2434
 
2122
2435
  // Insulation specific heat capacity starts ========================================
2123
- {% if dm.magnet.solve.ii.specificHeatCapacity %}
2436
+ {% if dm.magnet.solve.contactLayer.specificHeatCapacity %}
2124
2437
  // Linear:
2125
- INPUT_insulationSpecificHeatCapacity = <<dm.magnet.solve.ii.specificHeatCapacity>>; // specific heat capacity of the terminal, [J/(kg*K)]
2438
+ INPUT_insulationSpecificHeatCapacity = <<dm.magnet.solve.contactLayer.specificHeatCapacity>>; // specific heat capacity of the terminal, [J/(kg*K)]
2126
2439
 
2127
- {% if dm.magnet.geometry.ii.tsa %}
2440
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2128
2441
  // Thin-shell insulation:
2129
2442
  {% for a in range(1,3) %}
2130
2443
  {% for b in range(1,3) %}
2131
2444
  thermalMassFunctionDta<<a>>b<<b>>[DOM_insulationSurface] = TSA_constantMaterial_constantThickness_mass[]{
2132
- th_ins_k, INPUT_insulationSpecificHeatCapacity, <<a>>, <<b>>
2445
+ th_insulation_k, INPUT_insulationSpecificHeatCapacity, <<a>>, <<b>>
2133
2446
  };
2134
2447
 
2135
2448
  {% endfor %}
@@ -2141,34 +2454,32 @@ if (
2141
2454
 
2142
2455
  {% else %}
2143
2456
  // Nonlinear:
2144
- {% if dm.magnet.geometry.ii.tsa %}
2457
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2145
2458
  // Thin-shell insulation:
2146
2459
  {% for a in range(1,3) %}
2147
2460
  {% for b in range(1,3) %}
2148
- thermalMassFunctionDta<<a>>b<<b>>[DOM_insulationSurface] = <<dm.magnet.solve.ii.material.getdpTSAMassHeatCapacityFunction>>[$1, $2]{
2149
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2150
- };
2461
+ thermalMassFunctionDta<<a>>b<<b>>[DOM_insulationSurface] = <<TSA_materials[dm.magnet.solve.contactLayer.material.getdpTSAMassHeatCapacityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.contactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.contactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_insulation_k")>>;
2151
2462
 
2152
2463
  {% endfor %}
2153
2464
  {% endfor %}
2154
2465
  {% else %}
2155
2466
  // Volume insulation:
2156
- Cv[DOM_insulation] = <<materials[dm.magnet.solve.ii.material.heatCapacityMacroName]()>>;
2467
+ Cv[DOM_insulation] = <<materials[dm.magnet.solve.contactLayer.material.heatCapacityMacroName]()>>;
2157
2468
  {% endif %}
2158
2469
  {% endif %}
2159
2470
  // Insulation specific heat capacity ends ==========================================
2160
2471
 
2161
2472
  // Transition layer specific heat capacity starts ==================================
2162
- {% if dm.magnet.solve.ti.terminalContactLayer.specificHeatCapacity %}
2473
+ {% if dm.magnet.solve.terminals.terminalContactLayer.specificHeatCapacity %}
2163
2474
  // Linear:
2164
- INPUT_terminalContactLayerSpecificHeatCapacity = <<dm.magnet.solve.ti.terminalContactLayer.specificHeatCapacity>>; // specific heat capacity of the terminal, [J/(kg*K)]
2475
+ INPUT_terminalContactLayerSpecificHeatCapacity = <<dm.magnet.solve.terminals.terminalContactLayer.specificHeatCapacity>>; // specific heat capacity of the terminal, [J/(kg*K)]
2165
2476
 
2166
- {% if dm.magnet.geometry.ii.tsa %}
2477
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2167
2478
  // Thin-shell insulation:
2168
2479
  {% for a in range(1,3) %}
2169
2480
  {% for b in range(1,3) %}
2170
2481
  thermalMassFunctionDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = TSA_constantMaterial_constantThickness_mass[]{
2171
- th_ins_k, INPUT_terminalContactLayerSpecificHeatCapacity, <<a>>, <<b>>
2482
+ th_terminal_k, INPUT_terminalContactLayerSpecificHeatCapacity, <<a>>, <<b>>
2172
2483
  };
2173
2484
 
2174
2485
  {% endfor %}
@@ -2180,32 +2491,56 @@ if (
2180
2491
 
2181
2492
  {% else %}
2182
2493
  // Nonlinear:
2183
- {% if dm.magnet.geometry.ii.tsa %}
2494
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2184
2495
  // Thin-shell insulation:
2185
2496
  {% for a in range(1,3) %}
2186
2497
  {% for b in range(1,3) %}
2187
- thermalMassFunctionDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<dm.magnet.solve.ti.terminalContactLayer.material.getdpTSAMassHeatCapacityFunction>>[$1, $2]{
2188
- <<a>>, <<b>>, oneDGaussianOrder, th_ins_k
2189
- };
2190
-
2498
+ thermalMassFunctionDta<<a>>b<<b>>[DOM_terminalContactLayerSurface] = <<TSA_materials[dm.magnet.solve.terminals.terminalContactLayer.material.getdpTSAMassHeatCapacityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.terminalContactLayer.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.terminalContactLayer.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", constantThickness=True, thickness_TSA="th_terminal_k")>>;
2191
2499
  {% endfor %}
2192
2500
  {% endfor %}
2193
2501
  {% else %}
2194
2502
  // Volume insulation:
2195
- Cv[DOM_terminalContactLayer] = <<materials[dm.magnet.solve.ti.terminalContactLayer.material.heatCapacityMacroName]()>>;
2503
+ Cv[DOM_terminalContactLayer] = <<materials[dm.magnet.solve.terminals.terminalContactLayer.material.heatCapacityMacroName]()>>;
2196
2504
  {% endif %}
2197
2505
  {% endif %}
2198
2506
  // Transition layer specific heat capacity ends ====================================
2507
+
2508
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
2509
+ // Cryocooler specific heat capacity starts ==================================
2510
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.specificHeatCapacity %}
2511
+ // Linear:
2512
+ INPUT_cryocoolerSpecificHeatCapacity = <<dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.specificHeatCapacity>>; // specific heat capacity of the terminal, [J/(kg*K)]
2513
+
2514
+ {% for a in range(1,3) %}
2515
+ {% for b in range(1,3) %}
2516
+ thermalMassFunctionDta<<a>>b<<b>>[DOM_terminalSurfaces] = TSA_constantMaterial_mass[th_cryocooler_k[]]{
2517
+ INPUT_cryocoolerSpecificHeatCapacity, <<a>>, <<b>>
2518
+ };
2519
+
2520
+ {% endfor %}
2521
+ {% endfor %}
2522
+
2523
+ {% else %}
2524
+ // Nonlinear:
2525
+ {% for a in range(1,3) %}
2526
+ {% for b in range(1,3) %}
2527
+ thermalMassFunctionDta<<a>>b<<b>>[DOM_terminalSurfaces] = <<TSA_materials[dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.material.getdpTSAMassHeatCapacityMacroName](T_i="$1", T_iPlusOne="$2", RRR=dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.material.RRR, RRRRefTemp=dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.material.RRRRefTemp, BMagnitude="0", k=a, l=b, GaussianPoints="oneDGaussianOrder", thickness_TSA="th_cryocooler_k[]")>>;
2528
+ {% endfor %}
2529
+ {% endfor %}
2530
+
2531
+ {% endif %}
2532
+ // Cryocooler specific heat capacity ends ====================================
2533
+ {% endif %}
2199
2534
  {% endif %}
2200
- {% if dm.magnet.geometry.ai.shellTransformation %}
2535
+ {% if dm.magnet.geometry.air.shellTransformation %}
2201
2536
 
2202
2537
  // Shell transformation parameters:
2203
- {% if dm.magnet.geometry.ai.type == "cylinder" %}
2204
- INPUT_shellInnerRadius = <<dm.magnet.geometry.ai.r>>; // inner radius of the shell, [m]
2205
- INPUT_shellOuterRadius = <<dm.magnet.geometry.ai.shellOuterRadius>>; // outer radius of the shell, [m]
2206
- {% elif dm.magnet.geometry.ai.type == "cuboid" %}
2207
- {% set shellInnerDistance = dm.magnet.geometry.ai.a/2 %}
2208
- {% set shellOuterDistance = dm.magnet.geometry.ai.shellSideLength/2 %}
2538
+ {% if dm.magnet.geometry.air.type == "cylinder" %}
2539
+ INPUT_shellInnerRadius = <<dm.magnet.geometry.air.radius>>; // inner radius of the shell, [m]
2540
+ INPUT_shellOuterRadius = <<dm.magnet.geometry.air.shellOuterRadius>>; // outer radius of the shell, [m]
2541
+ {% elif dm.magnet.geometry.air.type == "cuboid" %}
2542
+ {% set shellInnerDistance = dm.magnet.geometry.air.a/2 %}
2543
+ {% set shellOuterDistance = dm.magnet.geometry.air.shellSideLength/2 %}
2209
2544
  INPUT_shellInnerDistance = <<shellInnerDistance>>; // inner radius of the shell, [m]
2210
2545
  INPUT_shellOuterDistance = <<shellOuterDistance>>; // outer radius of the shell, [m]
2211
2546
  <<0/0>>
@@ -2213,37 +2548,61 @@ if (
2213
2548
  {% endif %}
2214
2549
  {% endif %}
2215
2550
  {% if dm.magnet.solve.systemsOfEquationsType == "nonlinear" %}
2216
- {% if dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled"] %}
2217
- {% if use_cpp_materials %}
2218
- {% set rhoArguments = "{LOCALQUANT_T}, mu[] * {LOCALQUANT_h}, {d LOCALQUANT_h}, arcLengthOfWinding[]" %}
2219
- {% set kappaArguments = "{LOCALQUANT_T}, mu[] * {LOCALQUANT_h}" %}
2551
+ {% if dm.magnet.solve.boundaryConditions == "vanishingTangentialElectricField" %}
2552
+ {% if dm.magnet.solve.materialParametersUseCoilField and dm.magnet.solve.type != "thermal" %}
2553
+ {% set Bfield = "mu[] * {LOCALQUANT_h}" %}
2220
2554
  {% else %}
2221
- {% set rhoArguments = "{LOCALQUANT_T}, mu[] * {LOCALQUANT_h}, Transpose[TransformationTensor[]] * {d LOCALQUANT_h}, arcLengthOfWinding[]" %}
2222
- {% set kappaArguments = "{LOCALQUANT_T}, Norm[mu[] * {LOCALQUANT_h}]" %}
2555
+ {% set Bfield = "0" %}
2223
2556
  {% endif %}
2224
- {% set CvArguments = "{LOCALQUANT_T}, Norm[mu[] * {LOCALQUANT_h}]" %}
2225
- {% set JcriticalArguments = rhoArguments %}
2226
- {% elif dm.magnet.solve.type == "electromagnetic" %}
2227
- {% if use_cpp_materials %}
2228
- {% set rhoArguments = "INPUT_initialTemperature, mu[] * {LOCALQUANT_h}, {d LOCALQUANT_h}, arcLengthOfWinding[]" %}
2229
- {% set kappaArguments = "INPUT_initialTemperature, mu[] * {LOCALQUANT_h}" %}
2557
+ {% else %}
2558
+ {% if dm.magnet.solve.materialParametersUseCoilField and dm.magnet.solve.type != "thermal" %}
2559
+ {% set Bfield = "mu[] * {LOCALQUANT_h} + UnitVectorZ[] * " + str(dm.magnet.solve.boundaryConditions.imposedAxialField) %}
2230
2560
  {% else %}
2231
- {% set rhoArguments = "INPUT_initialTemperature, mu[] * {LOCALQUANT_h}, Transpose[TransformationTensor[]] * {d LOCALQUANT_h}, arcLengthOfWinding[]" %}
2232
- {% set kappaArguments = "INPUT_initialTemperature, Norm[mu[] * {LOCALQUANT_h}]" %}
2561
+ {% set Bfield = "UnitVectorZ[] * " + str(dm.magnet.solve.boundaryConditions.imposedAxialField) %}
2233
2562
  {% endif %}
2234
- {% set CvArguments = "INPUT_initialTemperature, Norm[mu[] * {LOCALQUANT_h}]" %}
2235
- {% set JcriticalArguments = rhoArguments %}
2563
+ {% endif %}
2564
+ {% if dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled"] %}
2565
+ {% set rhoArguments = "{LOCALQUANT_T}, " + Bfield + ", {d LOCALQUANT_h}" %}
2566
+ {% set kappaArguments = "{LOCALQUANT_T}, " + Bfield %}
2567
+ {% set CvArguments = "{LOCALQUANT_T}, Norm[" + Bfield + "]" %}
2568
+ {% elif dm.magnet.solve.type == "electromagnetic" %}
2569
+ {% set rhoArguments = "INPUT_initialTemperature, " + Bfield + ", {d LOCALQUANT_h}" %}
2570
+ {% set kappaArguments = "INPUT_initialTemperature, " + Bfield %}
2571
+ {% set CvArguments = "INPUT_initialTemperature, Norm[" + Bfield + "]" %}
2236
2572
  {% elif dm.magnet.solve.type == "thermal" %}
2237
- {% set rhoArguments = "{LOCALQUANT_T}, 0, 0, 0" %}
2238
- {% set kappaArguments = "{LOCALQUANT_T}, 0, 0" %}
2239
- {% set CvArguments = "{LOCALQUANT_T}, 0, 0" %}
2240
- {% set JcriticalArguments = rhoArguments %}
2573
+ {% set rhoArguments = "{LOCALQUANT_T}, " + Bfield + ", 0, 0" %}
2574
+ {% set kappaArguments = "{LOCALQUANT_T}, " + Bfield + ", 0, 0" %}
2575
+ {% set CvArguments = "{LOCALQUANT_T}, " + Bfield + ", 0, 0" %}
2241
2576
  {% endif %}
2242
2577
  {% elif dm.magnet.solve.systemsOfEquationsType == "linear" %}
2243
2578
  {% set rhoArguments = "" %}
2244
2579
  {% set kappaArguments = "" %}
2245
2580
  {% set CvArguments = "" %}
2246
2581
  {% endif %}
2582
+
2583
+ {% if dm.magnet.solve.EECircuit.enable %}
2584
+ // EE circuit quantities
2585
+ Resistance[DOM_resistanceCrowbar] = <<dm.power_supply.R_crowbar>>;
2586
+ Resistance[DOM_resistanceEE] = <<dm.quench_protection.energy_extraction.R_EE>>;
2587
+
2588
+ Resistance[DOM_switchCrowbar] = $quenchDetected == 0? <<dm.magnet.solve.EECircuit.ResistanceCrowbarOpenSwitch>>: <<dm.magnet.solve.EECircuit.ResistanceCrowbarClosedSwitch>>;
2589
+
2590
+ Resistance[DOM_switchEE] = $quenchDetected == 0? <<dm.magnet.solve.EECircuit.ResistanceEnergyExtractionClosedSwitch>>: <<dm.magnet.solve.EECircuit.ResistanceEnergyExtractionOpenSwitch>>;
2591
+
2592
+ Inductance[DOM_inductanceEE] = <<dm.magnet.solve.EECircuit.inductanceInSeriesWithPancakeCoil>>;
2593
+ {% endif %}
2594
+ {% if dm.magnet.solve.terminals.cooling == "cryocooler" %}
2595
+ // Cryocooler quantities
2596
+
2597
+ // Division by area to compute Watts per meter squared
2598
+ // SurfaceArea function does not allow DOM_*** as argument, so we need to use
2599
+ // the actual ids
2600
+ cryocoolerCoolingPower[] =
2601
+ (<<dm.magnet.solve.terminals.cryocoolerOptions.coolingPowerMultiplier>> * CFUN_P2vsT2_cryocooler_SHI_SRDE_418D4_T[$1] - <<dm.magnet.solve.terminals.cryocoolerOptions.staticHeatLoadPower>>)/SurfaceArea[]{<< rm.powered['Pancake3D'].surf_in.numbers | join(', ') >>, << rm.powered['Pancake3D'].surf_out.numbers | join(', ') >> };
2602
+
2603
+ cryocoolerCoolingPowerDerivativeT[] =
2604
+ <<dm.magnet.solve.terminals.cryocoolerOptions.coolingPowerMultiplier>> * CFUN_P2vsT2_cryocooler_SHI_SRDE_418D4_dT_T[$1]/SurfaceArea[]{<< rm.powered['Pancake3D'].surf_in.numbers | join(', ') >>, << rm.powered['Pancake3D'].surf_out.numbers | join(', ')>>};
2605
+ {% endif %}
2247
2606
  }
2248
2607
 
2249
2608
  //======================================================================================
@@ -2254,13 +2613,13 @@ Jacobian{
2254
2613
  Name JAC_vol; // volume Jacobian
2255
2614
  Case
2256
2615
  {
2257
- {% if dm.magnet.geometry.ai.shellTransformation %}
2258
- {% if dm.magnet.geometry.ai.type == "cylinder" %}
2616
+ {% if dm.magnet.geometry.air.shellTransformation %}
2617
+ {% if dm.magnet.geometry.air.type == "cylinder" %}
2259
2618
  {
2260
2619
  Region DOM_airInf;
2261
2620
  Jacobian VolCylShell {INPUT_shellInnerRadius, INPUT_shellOuterRadius};
2262
2621
  }
2263
- {% elif dm.magnet.geometry.ai.type == "cuboid" %}
2622
+ {% elif dm.magnet.geometry.air.type == "cuboid" %}
2264
2623
  {
2265
2624
  Region DOM_airInfX;
2266
2625
  Jacobian VolRectShell {INPUT_shellInnerDistance, INPUT_shellOuterDistance, 1};
@@ -2337,7 +2696,11 @@ Constraint{
2337
2696
  Name CONSTRAINT_current;
2338
2697
  Case{
2339
2698
  {
2699
+ {% if dm.magnet.solve.EECircuit.enable %}
2700
+ Region DOM_currentSource;
2701
+ {% else %}
2340
2702
  Region DOM_terminalCut;
2703
+ {% endif %}
2341
2704
  Type Assign;
2342
2705
  Value 1;
2343
2706
 
@@ -2348,7 +2711,7 @@ Constraint{
2348
2711
  }
2349
2712
  }
2350
2713
  }
2351
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
2714
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
2352
2715
  {
2353
2716
  // Impose current:
2354
2717
  Name CONSTRAINT_voltage;
@@ -2375,26 +2738,26 @@ Constraint{
2375
2738
  {
2376
2739
  Name CONSTRAINT_initialTemperature;
2377
2740
  Case {
2378
- {% if dm.magnet.solve.ti.cooling == "fixedTemperature" %}
2741
+ {% if dm.magnet.solve.terminals.cooling == "fixedTemperature" %}
2379
2742
  {
2380
2743
  Region DOM_bottomTerminalSurface;
2381
2744
  Type Assign;
2382
- Value <<dm.magnet.solve.ic.T>>;
2745
+ Value <<dm.magnet.solve.initialConditions.temperature>>;
2383
2746
  }
2384
2747
  {
2385
2748
  Region DOM_topTerminalSurface;
2386
2749
  Type Assign;
2387
- Value <<dm.magnet.solve.ic.T>>;
2750
+ Value <<dm.magnet.solve.initialConditions.temperature>>;
2388
2751
  }
2389
2752
  {% endif %}
2390
2753
  {% if dm.magnet.solve.isothermalInAxialDirection %}
2391
- {% if dm.magnet.geometry.ii.tsa %}
2754
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2392
2755
  {
2393
2756
  Region Region[{DOM_allWindings, DOM_allInsulationSurface}];
2394
2757
  Type Link;
2395
2758
  RegionRef Region[{DOM_allWindings, DOM_allInsulationSurface}];
2396
2759
  Coefficient 1;
2397
- Function Vector[X[], Y[], <<dm.magnet.geometry.wi.h/2>>];
2760
+ Function Vector[X[], Y[], <<dm.magnet.geometry.winding.height/2>>];
2398
2761
  }
2399
2762
  {% else %}
2400
2763
  {
@@ -2402,26 +2765,66 @@ Constraint{
2402
2765
  Type Link;
2403
2766
  RegionRef Region[{DOM_allWindings, DOM_allInsulations}];
2404
2767
  Coefficient 1;
2405
- Function Vector[X[], Y[], <<dm.magnet.geometry.wi.h/2>>];
2768
+ Function Vector[X[], Y[], <<dm.magnet.geometry.winding.height/2>>];
2406
2769
  }
2407
2770
  {% endif %}
2408
2771
  {% endif %}
2409
2772
  {
2410
- {% if dm.magnet.geometry.ii.tsa %}
2411
- Region Region[
2412
- {
2413
- DOM_powered,
2414
- DOM_allInsulationSurface
2415
- }
2416
- ];
2417
- {% else %}
2418
- Region Region[{DOM_powered, DOM_allInsulations}];
2419
- {% endif %}
2420
- Type Init;
2421
- Value <<dm.magnet.solve.ic.T>>;
2773
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2774
+ Region Region[
2775
+ {
2776
+ DOM_powered,
2777
+ DOM_allInsulationSurface
2778
+ }
2779
+ ];
2780
+ {% else %}
2781
+ Region Region[{DOM_powered, DOM_allInsulations}];
2782
+ {% endif %}
2783
+ Type Init;
2784
+ Value <<dm.magnet.solve.initialConditions.temperature>>;
2785
+ }
2786
+ }
2787
+ }
2788
+ {% if dm.magnet.solve.voltageTapPositions %}
2789
+ {
2790
+ Name CONSTRAINT_electricScalarPotential;
2791
+ Case{
2792
+ {
2793
+ Region DOM_topTerminalSurface;
2794
+ Type Assign;
2795
+ Value 1;
2796
+ }
2797
+ {
2798
+ Region DOM_bottomTerminalSurface;
2799
+ Type Assign;
2800
+ Value 0;
2422
2801
  }
2423
2802
  }
2424
2803
  }
2804
+ {% endif %}
2805
+
2806
+ {% if dm.magnet.solve.EECircuit.enable %}
2807
+ { Name EECircuit_Netlist; Type Network;
2808
+ Case Circuit1 { // Describes node connection of branches
2809
+ // power source
2810
+ { Region DOM_currentSource; Branch {1, 2} ; }
2811
+
2812
+ // crowbar resistance and switch in series
2813
+ { Region DOM_resistanceCrowbar; Branch {2, 3} ; }
2814
+ { Region DOM_switchCrowbar; Branch {3, 1} ; }
2815
+
2816
+ // energy extraction and switch in parallel
2817
+ { Region DOM_resistanceEE; Branch {2, 4} ; }
2818
+ { Region DOM_switchEE; Branch {2, 4} ; }
2819
+
2820
+ // magnet current via terminal cut
2821
+ { Region DOM_terminalCut; Branch {4, 5} ; }
2822
+
2823
+ // inductance in series with pancake coil
2824
+ { Region DOM_inductanceEE; Branch {5, 1} ; }
2825
+ }
2826
+ }
2827
+ {% endif %}
2425
2828
  }
2426
2829
 
2427
2830
  //======================================================================================
@@ -2437,8 +2840,8 @@ FunctionSpace{
2437
2840
  Name BASISFUN_gradpsin;
2438
2841
  NameOfCoef phin;
2439
2842
  Function BF_GradNode;
2440
- {% if dm.magnet.geometry.ii.tsa %}
2441
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
2843
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2844
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
2442
2845
  Support Region[{DOM_total, DOM_allInsulationSurface}];
2443
2846
  Entity NodesOf[{DOM_Phi, DOM_insulationSurface}, Not {DOM_insulationBoundaryCurvesAir}];
2444
2847
  {% else %}
@@ -2456,7 +2859,7 @@ FunctionSpace{
2456
2859
  NameOfCoef he;
2457
2860
  Function BF_Edge;
2458
2861
  Support DOM_allConducting;
2459
- {% if dm.magnet.geometry.ii.tsa %}
2862
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2460
2863
  Entity EdgesOf[All, Not {DOM_pancakeBoundary, DOM_allInsulationSurface}];
2461
2864
  {% else %}
2462
2865
  Entity EdgesOf[All, Not DOM_pancakeBoundary];
@@ -2467,14 +2870,18 @@ FunctionSpace{
2467
2870
  Name BASISFUN_sc;
2468
2871
  NameOfCoef Ii;
2469
2872
  Function BF_GroupOfEdges;
2470
- {% if dm.magnet.geometry.ii.tsa %}
2873
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2874
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
2875
+ Support Region[{DOM_total, DOM_terminalContactLayerSurface}];
2876
+ {% else %}
2471
2877
  Support Region[{DOM_total, DOM_allInsulationSurface}];
2878
+ {% endif %}
2472
2879
  {% else %}
2473
2880
  Support DOM_total;
2474
2881
  {% endif %}
2475
2882
  Entity GroupsOfEdgesOf[DOM_airCuts];
2476
2883
  }
2477
- {% if dm.magnet.geometry.ii.tsa %}
2884
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2478
2885
  <<FUNCTIONSPACE_TSABasisFunctions(type="electromagnetic")|indent(12)>>
2479
2886
  // TSA contribution on boundary of the thin layer
2480
2887
  {
@@ -2507,17 +2914,17 @@ FunctionSpace{
2507
2914
  Name BASISFUN_sn~{i};
2508
2915
  NameOfCoef he~{i};
2509
2916
  Function BF_Edge;
2510
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
2917
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
2511
2918
  Support DOM_terminalContactLayerSurface;
2512
2919
  {% else %}
2513
2920
  Support DOM_allInsulationSurface;
2514
2921
  {% endif %}
2515
- Entity EdgesOf[ All, Not {DOM_insulationBoundaryCurvesAir, DOM_insulationBoundaryCurvesTerminal{% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}, DOM_insulationSurface {% endif %}} ];
2922
+ Entity EdgesOf[ All, Not {DOM_insulationBoundaryCurvesAir, DOM_insulationBoundaryCurvesTerminal{% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}, DOM_insulationSurface {% endif %}} ];
2516
2923
  }
2517
2924
  EndFor
2518
2925
  }
2519
2926
 
2520
- {% if dm.magnet.solve.ii.resistivity != "perfectlyInsulating" %}
2927
+ {% if dm.magnet.solve.contactLayer.resistivity != "perfectlyInsulating" %}
2521
2928
  SubSpace{
2522
2929
  <<FUNCTIONSPACE_TSASubSpaces(["BASISFUN_sc", "BASISFUN_gradpsinBnd", "BASISFUN_psieBnd"])|indent(12)>>
2523
2930
  }
@@ -2546,12 +2953,14 @@ FunctionSpace{
2546
2953
  // imposing source current or voltage using global quantities
2547
2954
  Constraint
2548
2955
  {
2956
+ {% if not dm.magnet.solve.EECircuit.enable %}
2549
2957
  {
2550
2958
  NameOfCoef GLOBALQUANT_I;
2551
2959
  EntityType GroupsOfEdgesOf;
2552
2960
  NameOfConstraint CONSTRAINT_current;
2553
2961
  }
2554
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
2962
+ {% endif %}
2963
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
2555
2964
  {
2556
2965
  NameOfCoef GLOBALQUANT_V;
2557
2966
  EntityType GroupsOfEdgesOf;
@@ -2563,7 +2972,7 @@ FunctionSpace{
2563
2972
  EntityType NodesOf;
2564
2973
  NameOfConstraint CONSTRAINT_zeroPhiAtOuterPoint;
2565
2974
  }
2566
- {% if dm.magnet.geometry.ii.tsa and dm.magnet.solve.ii.resistivity != "perfectlyInsulating" %}
2975
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation and dm.magnet.solve.contactLayer.resistivity != "perfectlyInsulating" %}
2567
2976
  {
2568
2977
  NameOfCoef phin_bnd;
2569
2978
  EntityType NodesOf;
@@ -2580,25 +2989,47 @@ FunctionSpace{
2580
2989
  Name BASISFUN_sn;
2581
2990
  NameOfCoef Tn;
2582
2991
  Function BF_Node;
2583
- {% if dm.magnet.solve.ti.cooling == "cryocooler" %}
2584
- Support Region[{DOM_thermal, DOM_bottomTerminalSurface, DOM_topTerminalSurface}];
2992
+ {% if dm.magnet.solve.terminals.cooling == "cryocooler" %}
2993
+ Support Region[{DOM_thermal, DOM_terminalSurfaces
2994
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
2995
+ , DOM_innerTerminalAndTransitionNotch_surface, DOM_outerTerminalAndTransitionNotch_surface
2996
+ {% endif %}
2997
+ }];
2585
2998
  {% else %}
2586
- Support DOM_thermal;
2999
+ Support Region[{DOM_thermal
3000
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
3001
+ , DOM_innerTerminalAndTransitionNotch_surface, DOM_outerTerminalAndTransitionNotch_surface
3002
+ {% endif %}
3003
+ }];
2587
3004
  {% endif %}
2588
- {% if dm.magnet.geometry.ii.tsa %}
2589
- Entity NodesOf[DOM_thermal, Not DOM_allInsulationSurface];
3005
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
3006
+ Entity NodesOf[DOM_thermal,
3007
+ Not {DOM_allInsulationSurface}];
2590
3008
  {% else %}
2591
3009
  Entity NodesOf[DOM_thermal];
2592
3010
  {% endif %}
2593
3011
  }
2594
- {% if dm.magnet.geometry.ii.tsa %}
3012
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2595
3013
  <<FUNCTIONSPACE_TSABasisFunctions(type="thermal")|indent(12)>>
2596
3014
 
3015
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3016
+ <<FUNCTIONSPACE_TSABasisFunctions(type="thermal_adiabatic_half_tsa_plus")|indent(12)>>
3017
+ <<FUNCTIONSPACE_TSABasisFunctions(type="thermal_adiabatic_half_tsa_minus")|indent(12)>>
3018
+ {% endif %}
3019
+
3020
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3021
+ <<FUNCTIONSPACE_CryocoolerTSABasisFunctions()|indent(12)>>
3022
+ {% endif %}
3023
+
2597
3024
  {
2598
3025
  Name BASISFUN_snBndTerminal;
2599
3026
  NameOfCoef Tn_Bnd;
2600
3027
  Function BF_Node;
2601
- Support Region[{DOM_thermal, DOM_allInsulationSurface}];
3028
+ Support Region[{DOM_thermal, DOM_allInsulationSurface
3029
+ {% if dm.magnet.solve.convectiveCooling.heatTransferCoefficient %}
3030
+ , DOM_innerTerminalAndTransitionNotch_surface, DOM_outerTerminalAndTransitionNotch_surface, DOM_allWindingSurface
3031
+ {% endif %}
3032
+ }];
2602
3033
  Entity NodesOf[DOM_insulationBoundaryCurvesTerminal];
2603
3034
  }
2604
3035
 
@@ -2607,17 +3038,56 @@ FunctionSpace{
2607
3038
  Name BASISFUN_sn~{i};
2608
3039
  NameOfCoef sn~{i};
2609
3040
  Function BF_Node;
3041
+ {% if dm.magnet.solve.heatFlowBetweenTurns %}
2610
3042
  Support DOM_allInsulationSurface;
3043
+ {% else %}
3044
+ Support DOM_terminalContactLayerSurface;
3045
+ {% endif %}
2611
3046
  Entity NodesOf[ All, Not DOM_insulationBoundaryCurvesTerminal ];
2612
3047
  }
3048
+
3049
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3050
+ {
3051
+ Name BASISFUN_snMinus_adiabatic~{i};
3052
+ NameOfCoef snMinus_adiabatic~{i};
3053
+ Function BF_Node;
3054
+ Support DOM_insulationSurface;
3055
+ Entity NodesOf[ All ];
3056
+ }
3057
+ {
3058
+ Name BASISFUN_snPlus_adiabatic~{i};
3059
+ NameOfCoef snPlus_adiabatic~{i};
3060
+ Function BF_Node;
3061
+ Support DOM_insulationSurface;
3062
+ Entity NodesOf[ All ];
3063
+ }
3064
+ {% endif %}
2613
3065
  EndFor
2614
3066
 
3067
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3068
+ For i In {1:INPUT_NumOfCryocoolerTSAElements - 1}
3069
+ {
3070
+ Name BASISFUN_cryocooler_sn~{i};
3071
+ NameOfCoef sn_cryocooler~{i};
3072
+ Function BF_Node;
3073
+ Support DOM_terminalSurfaces;
3074
+ Entity NodesOf[ All ];
3075
+ }
3076
+ EndFor
3077
+ {% endif %}
2615
3078
 
2616
3079
  {% endif %}
2617
3080
  }
2618
- {% if dm.magnet.geometry.ii.tsa %}
3081
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2619
3082
  SubSpace {
3083
+ {% if dm.magnet.solve.heatFlowBetweenTurns %}
2620
3084
  <<FUNCTIONSPACE_TSASubSpaces(["BASISFUN_snBndTerminal"])|indent(12)>>
3085
+ {% else %}
3086
+ <<FUNCTIONSPACE_TSASubSpaces(["BASISFUN_snBndTerminal"], additional_bf_for_adiabatic_tsa=true)|indent(12)>>
3087
+ {% endif %}
3088
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3089
+ <<FUNCTIONSPACE_CryocoolerTSASubSpaces()|indent(12)>>
3090
+ {% endif %}
2621
3091
  }
2622
3092
  {% endif %}
2623
3093
  Constraint{
@@ -2626,7 +3096,7 @@ FunctionSpace{
2626
3096
  EntityType NodesOf;
2627
3097
  NameOfConstraint CONSTRAINT_initialTemperature;
2628
3098
  }
2629
- {% if dm.magnet.geometry.ii.tsa %}
3099
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2630
3100
  {% for i in range(1, NofSets+1) %}
2631
3101
  {
2632
3102
  NameOfCoef BASISFUN_snMinus_coeff_<<i>>;
@@ -2638,24 +3108,173 @@ FunctionSpace{
2638
3108
  EntityType NodesOf;
2639
3109
  NameOfConstraint CONSTRAINT_initialTemperature;
2640
3110
  }
2641
- For i In {1:INPUT_NumOfTSAElements - 1}
2642
- {
2643
- NameOfCoef sn~{i};
2644
- EntityType NodesOf;
2645
- NameOfConstraint CONSTRAINT_initialTemperature;
2646
- }
2647
- EndFor
3111
+
3112
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3113
+
3114
+ {
3115
+ NameOfCoef BASISFUN_snMinus_not_connected_coeff_<<i>>;
3116
+ EntityType NodesOf;
3117
+ NameOfConstraint CONSTRAINT_initialTemperature;
3118
+ }
3119
+ {
3120
+ NameOfCoef BASISFUN_snPlus_not_connected_coeff_<<i>>;
3121
+ EntityType NodesOf;
3122
+ NameOfConstraint CONSTRAINT_initialTemperature;
3123
+ }
3124
+ {% endif %}
2648
3125
  {% endfor %}
3126
+
3127
+ For i In {1:INPUT_NumOfTSAElements - 1}
3128
+ {
3129
+ NameOfCoef sn~{i};
3130
+ EntityType NodesOf;
3131
+ NameOfConstraint CONSTRAINT_initialTemperature;
3132
+ }
3133
+
3134
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3135
+ {
3136
+ NameOfCoef snMinus_adiabatic~{i};
3137
+ EntityType NodesOf;
3138
+ NameOfConstraint CONSTRAINT_initialTemperature;
3139
+ }
3140
+ {
3141
+ NameOfCoef snPlus_adiabatic~{i};
3142
+ EntityType NodesOf;
3143
+ NameOfConstraint CONSTRAINT_initialTemperature;
3144
+ }
3145
+ {% endif %}
3146
+ EndFor
3147
+
2649
3148
  {
2650
3149
  NameOfCoef Tn_Bnd;
2651
3150
  EntityType NodesOf;
2652
3151
  NameOfConstraint CONSTRAINT_initialTemperature;
2653
3152
  }
3153
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3154
+ {
3155
+ NameOfCoef BASISFUN_snOutside_coeff;
3156
+ EntityType NodesOf;
3157
+ NameOfConstraint CONSTRAINT_initialTemperature;
3158
+ }
3159
+ For i In {1:INPUT_NumOfCryocoolerTSAElements - 1}
3160
+ {
3161
+ NameOfCoef sn_cryocooler~{i};
3162
+ EntityType NodesOf;
3163
+ NameOfConstraint CONSTRAINT_initialTemperature;
3164
+ }
3165
+ EndFor
3166
+ {% endif %}
2654
3167
  {% endif %}
2655
3168
  }
2656
3169
  }
3170
+
3171
+ {% if dm.magnet.solve.voltageTapPositions %}
3172
+ {
3173
+ Name SPACE_electricScalarPotential;
3174
+ Type Form0;
3175
+ BasisFunction{
3176
+ {
3177
+ Name BASISFUN_sn;
3178
+ NameOfCoef sn;
3179
+ Function BF_Node;
3180
+ Support Region[{DOM_terminals, DOM_allWindings
3181
+ {% if not dm.magnet.geometry.contactLayer.thinShellApproximation %}
3182
+ , DOM_insulation
3183
+ {% endif %}
3184
+ }];
3185
+ Entity NodesOf[All
3186
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
3187
+ , Not DOM_allInsulationSurface
3188
+ {% endif %}
3189
+ ];
3190
+ }
3191
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
3192
+ {% for i in range(1, NofSets+1) %}
3193
+ {
3194
+ Name BASISFUN_snMinus_<<i>>;
3195
+ NameOfCoef snMinus_<<i>>;
3196
+ Function BF_Node;
3197
+ Support Region[
3198
+ {
3199
+ DOM_allInsulationSurface_<<i>>,
3200
+ DOM_allInsulationSurface_<<i+1>>,
3201
+ DOM_windingMinus_electricScalarPotential_<<i>>,
3202
+ DOM_windingMinus_electricScalarPotential_<<i+1>>
3203
+ }
3204
+ ];
3205
+ Entity NodesOf[
3206
+ DOM_allInsulationSurface_<<i>>,
3207
+ Not { DOM_allInsulationSurface_<<i-1>> }
3208
+ ];
3209
+ }
3210
+
3211
+ {
3212
+ Name BASISFUN_snPlus_<<i>>;
3213
+ NameOfCoef snPlus_<<i>>;
3214
+ Function BF_Node;
3215
+ Support Region[
3216
+ {
3217
+ DOM_allInsulationSurface_<<i>>,
3218
+ DOM_allInsulationSurface_<<i+1>>,
3219
+ DOM_windingPlus_electricScalarPotential_<<i>>,
3220
+ DOM_windingPlus_electricScalarPotential_<<i+1>>
3221
+ }
3222
+ ];
3223
+ Entity NodesOf[
3224
+ DOM_allInsulationSurface_<<i>>,
3225
+ Not { DOM_allInsulationSurface_<<i-1>> }
3226
+ ];
3227
+ }
3228
+ {% endfor %}
3229
+
3230
+ For i In {1:INPUT_NumOfTSAElements - 1}
3231
+ {
3232
+ Name BASISFUN_sn~{i};
3233
+ NameOfCoef sn~{i};
3234
+ Function BF_Node;
3235
+ Support DOM_terminalContactLayerSurface;
3236
+ Entity NodesOf[ All ];
3237
+ }
3238
+ EndFor
3239
+
3240
+
3241
+ {% endif %}
3242
+
3243
+ }
3244
+
3245
+ Constraint {
3246
+ { NameOfCoef sn ;
3247
+ EntityType NodesOf ; NameOfConstraint CONSTRAINT_electricScalarPotential ; }
3248
+ }
3249
+
3250
+ SubSpace {
3251
+ <<FUNCTIONSPACE_TSASubSpaces([])|indent(12)>>
3252
+ }
3253
+ }
3254
+ {% endif %}
3255
+ {% if dm.magnet.solve.EECircuit.enable %}
3256
+ { Name SPACE_circuit; Type Scalar;
3257
+ BasisFunction {
3258
+ {
3259
+ Name BASISFUN_ICircuit ; NameOfCoef ICircuit_coeff ; Function BF_Region ;
3260
+ Support DOM_circuit ; Entity DOM_circuit ;
3261
+ }
3262
+ }
3263
+
3264
+ GlobalQuantity {
3265
+ { Name ICircuit; Type AliasOf ; NameOfCoef ICircuit_coeff; }
3266
+ { Name UCircuit; Type AssociatedWith; NameOfCoef ICircuit_coeff; }
3267
+ }
3268
+
3269
+ Constraint {
3270
+ { NameOfCoef ICircuit; EntityType Region; NameOfConstraint CONSTRAINT_current; }
3271
+ }
3272
+ }
3273
+ {% endif %}
3274
+
2657
3275
  }
2658
3276
 
3277
+
2659
3278
  //======================================================================================
2660
3279
  // Formulations: =======================================================================
2661
3280
  //======================================================================================
@@ -2667,9 +3286,19 @@ Formulation{
2667
3286
  Quantity{
2668
3287
  <<FORMULATION_VolumetricQuantities("electromagnetic")|indent(12)>>
2669
3288
  <<FORMULATION_VolumetricQuantities("thermal")|indent(12)>>
2670
- {% if dm.magnet.geometry.ii.tsa %}
3289
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2671
3290
  <<FORMULATION_TSAQuantities("electromagnetic")|indent(12)>>
2672
3291
  <<FORMULATION_TSAQuantities("thermal")|indent(12)>>
3292
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3293
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_minus")|indent(12)>>
3294
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_plus")|indent(12)>>
3295
+ {% endif %}
3296
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3297
+ <<FORMULATION_CryocoolerTSAQuantities()|indent(12)>>
3298
+ {% endif %}
3299
+ {% endif %}
3300
+ {% if dm.magnet.solve.EECircuit.enable %}
3301
+ <<FORMULATION_EECircuitQuantities()|indent(12)>>
2673
3302
  {% endif %}
2674
3303
  }
2675
3304
 
@@ -2677,10 +3306,20 @@ Formulation{
2677
3306
  <<FORMULATION_VolumetricIntegrals("electromagnetic")|indent(12)>>
2678
3307
  <<FORMULATION_VolumetricIntegrals("thermal")|indent(12)>>
2679
3308
  <<FORMULATION_VolumetricIntegrals("resistiveHeating")|indent(12)>>
2680
- {% if dm.magnet.geometry.ii.tsa %}
3309
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2681
3310
  <<FORMULATION_TSAIntegrals("electromagnetic")|indent(12)>>
2682
3311
  <<FORMULATION_TSAIntegrals("resistiveHeating")|indent(12)>>
2683
3312
  <<FORMULATION_TSAIntegrals("thermal")|indent(12)>>
3313
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3314
+ <<FORMULATION_TSAIntegrals("thermal_adiabatic_half_tsa_minus")|indent(12)>>
3315
+ <<FORMULATION_TSAIntegrals("thermal_adiabatic_half_tsa_plus")|indent(12)>>
3316
+ {% endif %}
3317
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3318
+ <<FORMULATION_CryocoolerTSAIntegrals()|indent(12)>>
3319
+ {% endif %}
3320
+ {% endif %}
3321
+ {% if dm.magnet.solve.EECircuit.enable %}
3322
+ <<FORMULATION_EECircuitIntegrals()|indent(12)>>
2684
3323
  {% endif %}
2685
3324
  }
2686
3325
  }
@@ -2691,16 +3330,29 @@ Formulation{
2691
3330
  Quantity{
2692
3331
  <<FORMULATION_VolumetricQuantities("thermal")|indent(12)>>
2693
3332
  <<FORMULATION_VolumetricQuantities("electromagnetic")|indent(12)>>
2694
- {% if dm.magnet.geometry.ii.tsa %}
3333
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2695
3334
  <<FORMULATION_TSAQuantities("thermal")|indent(12)>>
3335
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3336
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_minus")|indent(12)>>
3337
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_plus")|indent(12)>>
3338
+ {% endif %}
2696
3339
  <<FORMULATION_TSAQuantities("electromagnetic")|indent(12)>>
3340
+ {% endif %}
3341
+ {% if dm.magnet.solve.EECircuit.enable %}
3342
+ <<FORMULATION_EECircuitQuantities()|indent(12)>>
3343
+ {% endif %}
3344
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3345
+ <<FORMULATION_CryocoolerTSAQuantities()|indent(12)>>
2697
3346
  {% endif %}
2698
3347
  }
2699
3348
 
2700
3349
  Equation{
2701
3350
  <<FORMULATION_VolumetricIntegrals("electromagnetic")|indent(12)>>
2702
- {% if dm.magnet.geometry.ii.tsa %}
3351
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2703
3352
  <<FORMULATION_TSAIntegrals("electromagnetic")|indent(12)>>
3353
+ {% endif %}
3354
+ {% if dm.magnet.solve.EECircuit.enable %}
3355
+ <<FORMULATION_EECircuitIntegrals()|indent(12)>>
2704
3356
  {% endif %}
2705
3357
  }
2706
3358
  }
@@ -2711,18 +3363,32 @@ Formulation{
2711
3363
  Quantity {
2712
3364
  <<FORMULATION_VolumetricQuantities("thermal")|indent(12)>>
2713
3365
  <<FORMULATION_VolumetricQuantities("electromagnetic")|indent(12)>>
2714
- {% if dm.magnet.geometry.ii.tsa %}
3366
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2715
3367
  <<FORMULATION_TSAQuantities("thermal")|indent(12)>>
3368
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3369
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_minus")|indent(12)>>
3370
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_plus")|indent(12)>>
3371
+ {% endif %}
2716
3372
  <<FORMULATION_TSAQuantities("electromagnetic")|indent(12)>>
3373
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3374
+ <<FORMULATION_CryocoolerTSAQuantities()|indent(12)>>
3375
+ {% endif %}
2717
3376
  {% endif %}
2718
3377
  }
2719
3378
 
2720
3379
  Equation{
2721
3380
  <<FORMULATION_VolumetricIntegrals("thermal")|indent(12)>>
2722
3381
  <<FORMULATION_VolumetricIntegrals("resistiveHeating")|indent(12)>>
2723
- {% if dm.magnet.geometry.ii.tsa %}
3382
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2724
3383
  <<FORMULATION_TSAIntegrals("thermal")|indent(12)>>
3384
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3385
+ <<FORMULATION_TSAIntegrals("thermal_adiabatic_half_tsa_minus")|indent(12)>>
3386
+ <<FORMULATION_TSAIntegrals("thermal_adiabatic_half_tsa_plus")|indent(12)>>
3387
+ {% endif %}
2725
3388
  <<FORMULATION_TSAIntegrals("resistiveHeating")|indent(12)>>
3389
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3390
+ <<FORMULATION_CryocoolerTSAIntegrals()|indent(12)>>
3391
+ {% endif %}
2726
3392
  {% endif %}
2727
3393
  }
2728
3394
  }
@@ -2733,15 +3399,21 @@ Formulation{
2733
3399
  Type FemEquation;
2734
3400
  Quantity{
2735
3401
  <<FORMULATION_VolumetricQuantities("electromagnetic")|indent(12)>>
2736
- {% if dm.magnet.geometry.ii.tsa %}
3402
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2737
3403
  <<FORMULATION_TSAQuantities("electromagnetic")|indent(12)>>
3404
+ {% endif %}
3405
+ {% if dm.magnet.solve.EECircuit.enable %}
3406
+ <<FORMULATION_EECircuitQuantities()|indent(12)>>
2738
3407
  {% endif %}
2739
3408
  }
2740
3409
 
2741
3410
  Equation{
2742
3411
  <<FORMULATION_VolumetricIntegrals("electromagnetic")|indent(12)>>
2743
- {% if dm.magnet.geometry.ii.tsa %}
3412
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2744
3413
  <<FORMULATION_TSAIntegrals("electromagnetic")|indent(12)>>
3414
+ {% endif %}
3415
+ {% if dm.magnet.solve.EECircuit.enable %}
3416
+ <<FORMULATION_EECircuitIntegrals()|indent(12)>>
2745
3417
  {% endif %}
2746
3418
  }
2747
3419
  }
@@ -2751,19 +3423,54 @@ Formulation{
2751
3423
  Type FemEquation;
2752
3424
  Quantity {
2753
3425
  <<FORMULATION_VolumetricQuantities("thermal")|indent(12)>>
2754
- {% if dm.magnet.geometry.ii.tsa %}
3426
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2755
3427
  <<FORMULATION_TSAQuantities("thermal")|indent(12)>>
3428
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3429
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_minus")|indent(12)>>
3430
+ <<FORMULATION_TSAQuantities("thermal_adiabatic_half_tsa_plus")|indent(12)>>
3431
+ {% endif %}
3432
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3433
+ <<FORMULATION_CryocoolerTSAQuantities()|indent(12)>>
3434
+ {% endif %}
2756
3435
  {% endif %}
2757
3436
  }
2758
3437
 
2759
3438
  Equation{
2760
3439
  <<FORMULATION_VolumetricIntegrals("thermal")|indent(12)>>
2761
- {% if dm.magnet.geometry.ii.tsa %}
3440
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
2762
3441
  <<FORMULATION_TSAIntegrals("thermal")|indent(12)>>
3442
+ {% if not dm.magnet.solve.heatFlowBetweenTurns %}
3443
+ <<FORMULATION_TSAIntegrals("thermal_adiabatic_half_tsa_minus")|indent(12)>>
3444
+ <<FORMULATION_TSAIntegrals("thermal_adiabatic_half_tsa_plus")|indent(12)>>
3445
+ {% endif %}
3446
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3447
+ <<FORMULATION_CryocoolerTSAIntegrals()|indent(12)>>
3448
+ {% endif %}
2763
3449
  {% endif %}
2764
3450
  }
2765
3451
  }
2766
3452
  {% endif %}
3453
+
3454
+ {% if dm.magnet.solve.voltageTapPositions %}
3455
+ { Name FORMULATION_electricScalarPotential; Type FemEquation;
3456
+ Quantity {
3457
+ <<FORMULATION_VolumetricQuantities("electricScalarPotential")|indent(12)>>
3458
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
3459
+ <<FORMULATION_TSAQuantities("electricScalarPotential")|indent(12)>>
3460
+ <<FORMULATION_TSAQuantities("thermal")|indent(12)>>
3461
+ {% endif %}
3462
+ }
3463
+
3464
+ Equation {
3465
+ <<FORMULATION_VolumetricIntegrals("electricScalarPotential")|indent(12)>>
3466
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
3467
+ <<FORMULATION_TSAIntegrals("electricScalarPotential")|indent(12)>>
3468
+ {% endif %}
3469
+ }
3470
+ }
3471
+ {% endif %}
3472
+
3473
+
2767
3474
  }
2768
3475
 
2769
3476
  //======================================================================================
@@ -2787,6 +3494,12 @@ Resolution{
2787
3494
  Name SYSTEM_<<dm.magnet.solve.type>>;
2788
3495
  NameOfFormulation FORMULATION_<<dm.magnet.solve.type>>;
2789
3496
  }
3497
+ {% endif %}
3498
+ {% if dm.magnet.solve.voltageTapPositions %}
3499
+ {
3500
+ Name SYSTEM_electricScalarPotential;
3501
+ NameOfFormulation FORMULATION_electricScalarPotential;
3502
+ }
2790
3503
  {% endif %}
2791
3504
  }
2792
3505
 
@@ -2822,6 +3535,28 @@ PostProcessing{
2822
3535
  {% if dm.magnet.solve.type == "electromagnetic" or dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled"] %}
2823
3536
  {
2824
3537
  Name RESULT_magneticField; // magnetic flux density (magnetic field)
3538
+ Value{
3539
+ Local{
3540
+ [mu[] * {LOCALQUANT_h}{% if dm.magnet.solve.boundaryConditions != "vanishingTangentialElectricField" %} + UnitVectorZ[] * <<dm.magnet.solve.boundaryConditions.imposedAxialField>> {% endif %}];
3541
+ In Region[{ DOM_total }];
3542
+ Jacobian JAC_vol;
3543
+ }
3544
+ }
3545
+ }
3546
+ {% if dm.magnet.solve.boundaryConditions != "vanishingTangentialElectricField" %}
3547
+ {
3548
+ Name RESULT_imposedAxialField; // axial field
3549
+ Value{
3550
+ Local{
3551
+ [UnitVectorZ[] * <<dm.magnet.solve.boundaryConditions.imposedAxialField>>];
3552
+ In Region[{ DOM_total }];
3553
+ Jacobian JAC_vol;
3554
+ }
3555
+ }
3556
+ }
3557
+
3558
+ {
3559
+ Name RESULT_reactionField; // axial field
2825
3560
  Value{
2826
3561
  Local{
2827
3562
  [mu[] * {LOCALQUANT_h}];
@@ -2830,6 +3565,7 @@ PostProcessing{
2830
3565
  }
2831
3566
  }
2832
3567
  }
3568
+ {% endif %}
2833
3569
 
2834
3570
  {
2835
3571
  Name RESULT_magnitudeOfMagneticField; // magnetic flux density magnitude
@@ -2875,39 +3611,103 @@ PostProcessing{
2875
3611
  }
2876
3612
  }
2877
3613
 
2878
- {% if dm.magnet.solve.wi.superConductor and not dm.magnet.solve.wi.resistivity and type != "thermal" %}
2879
- // {
2880
- // Name RESULT_criticalCurrentDensity; // critical current density of the winding
2881
- // Value{
2882
- // Local{
2883
- // [Jcritical[<<JcriticalArguments>>]];
2884
- // In Region[{ DOM_allWindings }];
2885
- // Jacobian JAC_vol;
2886
- // }
2887
- // }
2888
- // }
2889
-
2890
- // {
2891
- // Name RESULT_jHTSOverjCritical;
2892
- // Value{
2893
- // Local{
2894
- // [(TransformationTensor[]*jHTS[<<JcriticalArguments>>])/Jcritical[<<JcriticalArguments>>]];
2895
- // In Region[{ DOM_allWindings }];
2896
- // Jacobian JAC_vol;
2897
- // }
2898
- // }
2899
- // }
2900
-
2901
- // {
2902
- // Name RESULT_criticalCurrent;
2903
- // Value{
2904
- // Local{
2905
- // [Jcritical[<<JcriticalArguments>>] * INPUT_relativeThicknessOfSuperConductor * 1/<<scalingFactor>> * <<dm.magnet.geometry.wi.t>> * <<dm.magnet.geometry.wi.h>>];
2906
- // In Region[{ DOM_allWindings }];
2907
- // Jacobian JAC_vol;
2908
- // }
2909
- // }
2910
- // }
3614
+ {
3615
+ Name RESULT_arcLength;
3616
+ Value{
3617
+ Local{
3618
+ [Pancake3DGetContinuousArcLength[XYZ[]]{
3619
+ <<dm.magnet.geometry.winding.innerRadius>>,
3620
+ <<windingThickness>>,
3621
+ <<gapThickness>>,
3622
+ <<dm.magnet.geometry.winding.theta_i>>,
3623
+ <<dm.magnet.mesh.winding.azimuthalNumberOfElementsPerTurn[0]>>,
3624
+ <<dm.magnet.geometry.numberOfPancakes>>,
3625
+ <<dm.magnet.geometry.winding.height>>,
3626
+ <<dm.magnet.geometry.gapBetweenPancakes>>
3627
+ }];
3628
+ In DOM_allWindings;
3629
+ Jacobian JAC_vol;
3630
+ }
3631
+ }
3632
+ }
3633
+
3634
+
3635
+ {
3636
+ Name RESULT_turnNumber;
3637
+ Value{
3638
+ Local{
3639
+ [Pancake3DGetContinuousTurnNumber[XYZ[]]{
3640
+ <<dm.magnet.geometry.winding.innerRadius>>,
3641
+ <<windingThickness>>,
3642
+ <<gapThickness>>,
3643
+ <<dm.magnet.geometry.winding.theta_i>>,
3644
+ <<dm.magnet.mesh.winding.azimuthalNumberOfElementsPerTurn[0]>>,
3645
+ <<dm.magnet.geometry.numberOfPancakes>>,
3646
+ <<dm.magnet.geometry.winding.height>>,
3647
+ <<dm.magnet.geometry.gapBetweenPancakes>>
3648
+ }];
3649
+ In DOM_allWindings;
3650
+ Jacobian JAC_vol;
3651
+ }
3652
+ }
3653
+ }
3654
+
3655
+ {% if dm.magnet.solve.winding.superConductor and not dm.magnet.solve.winding.resistivity and type != "thermal" %}
3656
+ {
3657
+ Name RESULT_criticalCurrentDensity; // critical current density of the winding
3658
+ Value{
3659
+ Local{
3660
+ [Jcritical[<<rhoArguments>>]];
3661
+ In Region[{ DOM_allWindings }];
3662
+ Jacobian JAC_vol;
3663
+ }
3664
+ }
3665
+ }
3666
+
3667
+ {
3668
+ Name RESULT_criticalCurrent;
3669
+ Value{
3670
+ Local{
3671
+ [Icritical[<<rhoArguments>>]];
3672
+ In Region[{ DOM_allWindings }];
3673
+ Jacobian JAC_vol;
3674
+ }
3675
+ }
3676
+ }
3677
+
3678
+ {
3679
+ Name RESULT_currentSharingIndex;
3680
+ Value{
3681
+ Local{
3682
+ [lambda[<<rhoArguments>>]];
3683
+ In Region[{ DOM_allWindings }];
3684
+ Jacobian JAC_vol;
3685
+ }
3686
+ }
3687
+ }
3688
+
3689
+ {
3690
+ Name RESULT_jHTS;
3691
+ Value{
3692
+ Local{
3693
+ [jHTS[<<rhoArguments>>]];
3694
+ In Region[{ DOM_allWindings }];
3695
+ Jacobian JAC_vol;
3696
+ }
3697
+ }
3698
+ }
3699
+
3700
+ {
3701
+ Name RESULT_jHTSOverjCritical;
3702
+ Value{
3703
+ Local{
3704
+ // add small epsilon to avoid division by zero
3705
+ [jHTS[<<rhoArguments>>]/(Jcritical[<<rhoArguments>>] + 1e-10)];
3706
+ In Region[{ DOM_allWindings }];
3707
+ Jacobian JAC_vol;
3708
+ }
3709
+ }
3710
+ }
2911
3711
  {% endif %}
2912
3712
 
2913
3713
  {
@@ -2948,35 +3748,52 @@ PostProcessing{
2948
3748
  }
2949
3749
 
2950
3750
  {
2951
- Name RESULT_voltageBetweenTerminals; // voltages in cuts
3751
+ Name RESULT_voltageBetweenTerminals; // voltages in cuts
3752
+ Value{
3753
+ Local{
3754
+ [ - {GLOBALQUANT_V} ];
3755
+ In DOM_terminalCut;
3756
+ }
3757
+ }
3758
+ }
3759
+
3760
+ {
3761
+ Name RESULT_currentThroughCoil; // currents in cuts
2952
3762
  Value{
2953
3763
  Local{
2954
- [ - {GLOBALQUANT_V} ];
3764
+ [ {GLOBALQUANT_I} ];
2955
3765
  In DOM_terminalCut;
2956
3766
  }
2957
3767
  }
2958
3768
  }
2959
3769
 
3770
+ {% if dm.magnet.solve.EECircuit.enable %}
2960
3771
  {
2961
- Name RESULT_maximumTemperature; // voltages in cuts
3772
+ Name RESULT_current_DOM_currentSource; // currents in cuts
2962
3773
  Value{
2963
- Term {
2964
- Type Global;
2965
- [ #999 ];
2966
- In DOM_thermal;
3774
+ Local{
3775
+ [ {CIRCUITQUANT_ICircuit} ];
3776
+ In DOM_currentSource;
2967
3777
  }
2968
3778
  }
2969
3779
  }
2970
3780
 
2971
3781
  {
2972
- Name RESULT_currentThroughCoil; // currents in cuts
3782
+ Name RESULT_resistance_DOM_switches; // currents in cuts
2973
3783
  Value{
2974
- Local{
2975
- [ {GLOBALQUANT_I} ];
2976
- In DOM_terminalCut;
3784
+ Term {
3785
+ Type Global;
3786
+ [ Resistance[] ];
3787
+ In DOM_switchCrowbar;
3788
+ }
3789
+ Term {
3790
+ Type Global;
3791
+ [ Resistance[] ];
3792
+ In DOM_switchEE;
2977
3793
  }
2978
3794
  }
2979
3795
  }
3796
+ {% endif %}
2980
3797
 
2981
3798
  {
2982
3799
  Name RESULT_axialComponentOfTheMagneticField; // axial magnetic flux density
@@ -3007,7 +3824,7 @@ PostProcessing{
3007
3824
  {% set temperatureArgument1 = "INPUT_initialTemperature" %}
3008
3825
  {% set temperatureArgument2 = "INPUT_initialTemperature" %}
3009
3826
  {% endif %}
3010
- {% if dm.magnet.geometry.ii.tsa %}
3827
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
3011
3828
  For i In {0:INPUT_NumOfTSAElements-1}
3012
3829
  Integral {
3013
3830
  Type Global;
@@ -3016,10 +3833,10 @@ PostProcessing{
3016
3833
  <<temperatureArgument1>>,
3017
3834
  <<temperatureArgument2>>
3018
3835
  ] * SquNorm[
3019
- ({LOCALQUANT_hThinShell~{i + 1}} - {LOCALQUANT_hThinShell~{i}})/th_ins_k
3836
+ ({LOCALQUANT_hThinShell~{i + 1}} - {LOCALQUANT_hThinShell~{i}})/th_terminal_k
3020
3837
  ]
3021
3838
  ];
3022
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
3839
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
3023
3840
  In DOM_terminalContactLayerSurface;
3024
3841
  {% else %}
3025
3842
  In DOM_allInsulationSurface;
@@ -3038,7 +3855,7 @@ PostProcessing{
3038
3855
  <<temperatureArgument2>>
3039
3856
  ] * {d LOCALQUANT_hThinShell~{i + <<a>> - 1}} * {d LOCALQUANT_hThinShell~{i + <<b>> - 1}}
3040
3857
  ];
3041
- {% if dm.magnet.solve.ii.resistivity == "perfectlyInsulating" %}
3858
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
3042
3859
  In DOM_terminalContactLayerSurface;
3043
3860
  {% else %}
3044
3861
  In DOM_allInsulationSurface;
@@ -3065,6 +3882,17 @@ PostProcessing{
3065
3882
  }
3066
3883
  }
3067
3884
 
3885
+ {
3886
+ Name RESULT_maximumTemperature; // maximum temperature
3887
+ Value{
3888
+ Term {
3889
+ Type Global;
3890
+ [ #999 ];
3891
+ In DOM_thermal;
3892
+ }
3893
+ }
3894
+ }
3895
+
3068
3896
  {
3069
3897
  Name RESULT_heatFlux;
3070
3898
  Value {
@@ -3108,14 +3936,58 @@ PostProcessing{
3108
3936
  }
3109
3937
  }
3110
3938
  }
3939
+
3940
+ {% if dm.magnet.solve.terminals.cooling == "cryocooler" %}
3941
+ {
3942
+ Name RESULT_cryocoolerAveragePower; // power of cryocooler computed as surface integral
3943
+ Value{
3944
+ Integral{
3945
+ Type Global;
3946
+ // Division by area to compute Watts per meter squared
3947
+ // SurfaceArea function does not allow DOM_*** as argument, so we need to use
3948
+ // the actual ids
3949
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3950
+ {% set cryocooler_quantity = "LOCALQUANT_cryocooler_TThinShell~{INPUT_NumOfCryocoolerTSAElements}" %}
3951
+ {% else %}
3952
+ {% set cryocooler_quantity = "LOCALQUANT_T" %}
3953
+ {% endif %}
3954
+
3955
+ [ cryocoolerCoolingPower[{<<cryocooler_quantity>>}] ];
3956
+ In DOM_terminalSurfaces;
3957
+ Jacobian JAC_sur;
3958
+ Integration Int;
3959
+ }
3960
+ }
3961
+ }
3962
+
3963
+ {
3964
+ Name RESULT_cryocoolerAverageTemperature; // power of cryocooler computed as surface integral
3965
+ Value{
3966
+ Integral{
3967
+ Type Global;
3968
+ // Division by area to compute Watts per meter squared
3969
+ // SurfaceArea function does not allow DOM_*** as argument, so we need to use
3970
+ // the actual ids
3971
+ {% if dm.magnet.solve.terminals.cryocoolerOptions.lumpedMass.volume %}
3972
+ {% set cryocooler_quantity = "LOCALQUANT_cryocooler_TThinShell~{INPUT_NumOfCryocoolerTSAElements}" %}
3973
+ {% else %}
3974
+ {% set cryocooler_quantity = "LOCALQUANT_T" %}
3975
+ {% endif %}
3976
+
3977
+ [ {<<cryocooler_quantity>>}/SurfaceArea[]{<< rm.powered['Pancake3D'].surf_in.numbers | join(', ') >>, << rm.powered['Pancake3D'].surf_out.numbers | join(', ') >> } ];
3978
+ In DOM_terminalSurfaces;
3979
+ Jacobian JAC_sur;
3980
+ Integration Int;
3981
+ }
3982
+ }
3983
+ }
3984
+ {% endif %}
3111
3985
  {% endif %}
3112
- {% if dm.magnet.geometry.ii.tsa %} {
3986
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %} {
3113
3987
  Name RESULT_debug;
3114
3988
  Value{
3115
3989
  Local{
3116
- [
3117
- Normal[] /\ ({LOCALQUANT_hThinShell~{1}} - {LOCALQUANT_hThinShell~{0}})/th_ins_k + {d LOCALQUANT_hThinShell~{0}}
3118
- ];
3990
+ [ 5 ];
3119
3991
  In DOM_allInsulationSurface;
3120
3992
  Jacobian JAC_sur;
3121
3993
  }
@@ -3124,6 +3996,110 @@ PostProcessing{
3124
3996
  {% endif %}
3125
3997
  }
3126
3998
  }
3999
+
4000
+ {% if dm.quench_detection.voltage_tap_pairs and dm.magnet.solve.voltageTapPositions and not dm.magnet.solve.type == "thermal" %}
4001
+ {
4002
+ Name POSTPRO_electricScalarPotential;
4003
+ NameOfFormulation FORMULATION_electricScalarPotential;
4004
+ NameOfSystem SYSTEM_electricScalarPotential;
4005
+ Quantity{
4006
+ {
4007
+ Name RESULT_conductance;
4008
+ Value{
4009
+ Integral{
4010
+ Type Global;
4011
+ [1./rho[<<rhoArguments>>] * {d LOCALQUANT_electricScalarPotential} * {d LOCALQUANT_electricScalarPotential}];
4012
+ In Region[{DOM_terminals, DOM_allWindings}];
4013
+ Jacobian JAC_vol;
4014
+ Integration Int;
4015
+ }
4016
+
4017
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %}
4018
+ For i In {0:INPUT_NumOfTSAElements-1}
4019
+
4020
+ {% for a in range(1,3) %}
4021
+ {% for b in range(1,3) %}
4022
+
4023
+ Integral {
4024
+ Type Global;
4025
+ [
4026
+ electricScalarPotentialMassFunctionNoDta<<a>>b<<b>>[
4027
+ <<temperatureArgument1>>,
4028
+ <<temperatureArgument2>>
4029
+ ] * {d LOCALQUANT_electricScalarPotentialThinShell~{i + <<a>> - 1}} * {d LOCALQUANT_electricScalarPotentialThinShell~{i + <<b>> - 1}}
4030
+ ];
4031
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
4032
+ In DOM_terminalContactLayerSurface_WithoutNotch;
4033
+ {% else %}
4034
+ In DOM_allInsulationSurface;
4035
+ {% endif %}
4036
+ Integration Int;
4037
+ Jacobian JAC_sur;
4038
+ }
4039
+
4040
+ Integral {
4041
+ Type Global;
4042
+ [
4043
+ electricScalarPotentialStiffnessFunctiona<<a>>b<<b>>[
4044
+ <<temperatureArgument1>>,
4045
+ <<temperatureArgument2>>
4046
+ ] * {LOCALQUANT_electricScalarPotentialThinShell~{i + <<a>> - 1}} * {LOCALQUANT_electricScalarPotentialThinShell~{i + <<b>> - 1}}
4047
+ ];
4048
+ {% if dm.magnet.solve.contactLayer.resistivity == "perfectlyInsulating" %}
4049
+ In DOM_terminalContactLayerSurface_WithoutNotch;
4050
+ {% else %}
4051
+ In DOM_allInsulationSurface;
4052
+ {% endif %}
4053
+ Integration Int;
4054
+ Jacobian JAC_sur;
4055
+ }
4056
+
4057
+ {% endfor %}
4058
+ {% endfor %}
4059
+ EndFor
4060
+
4061
+ {% endif %}
4062
+ }
4063
+ }
4064
+
4065
+ {
4066
+ Name RESULT_electricScalarPotential;
4067
+ Value{
4068
+ Local{
4069
+ [{LOCALQUANT_electricScalarPotential}];
4070
+ In Region[{DOM_terminals, DOM_allWindings {% if not dm.magnet.geometry.contactLayer.thinShellApproximation %}, DOM_insulation{% endif %} }];
4071
+ Jacobian JAC_vol;
4072
+ }
4073
+ }
4074
+ }
4075
+ {
4076
+ Name RESULT_currentFromElectricScalarPotential;
4077
+ Value{
4078
+ Local{
4079
+ [1./rho[<<rhoArguments>>] * {d LOCALQUANT_electricScalarPotential}];
4080
+ In Region[{DOM_terminals, DOM_allWindings {% if not dm.magnet.geometry.contactLayer.thinShellApproximation %}, DOM_insulation{% endif %} }];
4081
+ Jacobian JAC_vol;
4082
+ }
4083
+ }
4084
+ }
4085
+
4086
+ {% for idx, voltage_tap_pair in enumerate(dm.quench_detection.voltage_tap_pairs) %}
4087
+
4088
+ {
4089
+ Name RESULT_resistiveVoltage_<<idx>>; // voltages in cuts
4090
+ Value{
4091
+ Term {
4092
+ Type Global;
4093
+ [ $currentThroughCoil/$conductance * ($potential_<<voltage_tap_pair[0]>> - $potential_<<voltage_tap_pair[1]>>) ];
4094
+ In DOM_dummyPrintResistiveVoltages;
4095
+ }
4096
+ }
4097
+ }
4098
+
4099
+ {% endfor %}
4100
+ }
4101
+ }
4102
+ {% endif %}
3127
4103
  }
3128
4104
 
3129
4105
  //======================================================================================
@@ -3136,7 +4112,7 @@ PostOperation{
3136
4112
  Operation {
3137
4113
  }
3138
4114
  }
3139
- {% if dm.magnet.geometry.ii.tsa %} {
4115
+ {% if dm.magnet.geometry.contactLayer.thinShellApproximation %} {
3140
4116
  Name POSTOP_debug;
3141
4117
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3142
4118
  Operation{
@@ -3162,6 +4138,21 @@ PostOperation{
3162
4138
  name="Magnetic Field [T]",
3163
4139
  fileName="MagneticField"
3164
4140
  )|indent(12)>>
4141
+ {% if dm.magnet.solve.boundaryConditions != "vanishingTangentialElectricField" %}
4142
+ <<POSTOPERATION_printResults(
4143
+ quantity="RESULT_imposedAxialField",
4144
+ onElementsOf="DOM_total",
4145
+ name="Imposed Magnetic Field [T]",
4146
+ fileName="ImposedMagneticField"
4147
+ )|indent(12)>>
4148
+
4149
+ <<POSTOPERATION_printResults(
4150
+ quantity="RESULT_reactionField",
4151
+ onElementsOf="DOM_total",
4152
+ name="Magnetic Reaction Field [T]",
4153
+ fileName="MagneticReactionField"
4154
+ )|indent(12)>>
4155
+ {% endif %}
3165
4156
  }
3166
4157
  }
3167
4158
  {
@@ -3203,6 +4194,34 @@ PostOperation{
3203
4194
  )|indent(12)>>
3204
4195
  }
3205
4196
  }
4197
+ {
4198
+ Name POSTOP_arcLength;
4199
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4200
+ Operation{
4201
+ <<POSTOPERATION_printResults(
4202
+ quantity="RESULT_arcLength",
4203
+ onElementsOf="DOM_allWindings",
4204
+ name="Arc Length [m]",
4205
+ fileName="arcLength",
4206
+ atGaussPoints=True,
4207
+ lastTimeStepOnly=True
4208
+ )|indent(12)>>
4209
+ }
4210
+ }
4211
+ {
4212
+ Name POSTOP_turnNumber;
4213
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4214
+ Operation{
4215
+ <<POSTOPERATION_printResults(
4216
+ quantity="RESULT_turnNumber",
4217
+ onElementsOf="DOM_allWindings",
4218
+ name="Turn number [m]",
4219
+ fileName="turnNumber",
4220
+ atGaussPoints=True,
4221
+ lastTimeStepOnly=True
4222
+ )|indent(12)>>
4223
+ }
4224
+ }
3206
4225
  {
3207
4226
  Name POSTOP_resistiveHeating;
3208
4227
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
@@ -3210,8 +4229,16 @@ PostOperation{
3210
4229
  // Resistive heating:
3211
4230
  <<POSTOPERATION_printResults(
3212
4231
  quantity="RESULT_resistiveHeating",
3213
- onElementsOf="DOM_allConducting",
3214
- name="Resistive Heating [W/m^3]",
4232
+ onElementsOf="DOM_allWindings",
4233
+ name="Resistive Heating Windings [W/m^3]",
4234
+ fileName="ResistiveHeating_Windings",
4235
+ atGaussPoints=True
4236
+ )|indent(12)>>
4237
+
4238
+ <<POSTOPERATION_printResults(
4239
+ quantity="RESULT_resistiveHeating",
4240
+ onElementsOf="DOM_allConductingWithoutWindings",
4241
+ name="Resistive Heating Without Windings [W/m^3]",
3215
4242
  fileName="ResistiveHeating"
3216
4243
  )|indent(12)>>
3217
4244
  }
@@ -3223,9 +4250,17 @@ PostOperation{
3223
4250
  // Resistive heating:
3224
4251
  <<POSTOPERATION_printResults(
3225
4252
  quantity="RESULT_resistivity",
3226
- onElementsOf="DOM_allConducting",
3227
- name="Resistivity [Ohm*m]",
3228
- fileName="Resistivity"
4253
+ onElementsOf="DOM_allWindings",
4254
+ name="Resistivity Windings [Ohm*m]",
4255
+ fileName="Resistivity_Windings",
4256
+ atGaussPoints=True
4257
+ )|indent(12)>>
4258
+
4259
+ <<POSTOPERATION_printResults(
4260
+ quantity="RESULT_resistivity",
4261
+ onElementsOf="DOM_allConductingWithoutWindings",
4262
+ name="Resistivity Without Windings [Ohm*m]",
4263
+ fileName="Resistivity_ConductingWithoutWindings"
3229
4264
  )|indent(12)>>
3230
4265
  }
3231
4266
  }
@@ -3258,46 +4293,77 @@ PostOperation{
3258
4293
  )|indent(12)>>
3259
4294
  }
3260
4295
  }
3261
- {% if dm.magnet.solve.wi.superConductor and not dm.magnet.solve.wi.resistivity %}
3262
- // {
3263
- // Name POSTOP_criticalCurrentDensity;
3264
- // NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3265
- // Operation{
3266
- // // Current at the cut:
3267
- // {# POSTOPERATION_printResults(
3268
- // quantity="RESULT_criticalCurrentDensity",
3269
- // onElementsOf="DOM_allWindings",
3270
- // name="Critical Current Density [A/m^2]",
3271
- // fileName="CriticalCurrentDensity"
3272
- // )|indent(12) #}
3273
- // }
3274
- // }
3275
- // {
3276
- // Name POSTOP_jHTSOverjCritical;
3277
- // NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3278
- // Operation{
3279
- // // Current at the cut:
3280
- // {# POSTOPERATION_printResults(
3281
- // quantity="RESULT_jHTSOverjCritical",
3282
- // onElementsOf="DOM_allWindings",
3283
- // name="(HTS Current Density)/(Critical Current Density)",
3284
- // fileName="HTSCurrentDensityOverCriticalCurrentDensity"
3285
- // )|indent(12) #}
3286
- // }
3287
- // }
3288
- // {
3289
- // Name POSTOP_criticalCurrent;
3290
- // NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3291
- // Operation{
3292
- // // Current at the cut:
3293
- // {# POSTOPERATION_printResults(
3294
- // quantity="RESULT_criticalCurrent",
3295
- // onElementsOf="DOM_allWindings",
3296
- // name="Critical Current [A]",
3297
- // fileName="CriticalCurrent"
3298
- // )|indent(12) #}
3299
- // }
3300
- // }
4296
+ {% if dm.magnet.solve.winding.superConductor and not dm.magnet.solve.winding.resistivity %}
4297
+ {
4298
+ Name POSTOP_criticalCurrentDensity;
4299
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4300
+ Operation{
4301
+ // Critical current density:
4302
+ <<POSTOPERATION_printResults(
4303
+ quantity="RESULT_criticalCurrentDensity",
4304
+ onElementsOf="DOM_allWindings",
4305
+ name="Critical Current Density [A/m^2]",
4306
+ fileName="CriticalCurrentDensity",
4307
+ atGaussPoints=True
4308
+ )|indent(12)>>
4309
+ }
4310
+ }
4311
+ {
4312
+ Name POSTOP_criticalCurrent;
4313
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4314
+ Operation{
4315
+ // Critical current:
4316
+ <<POSTOPERATION_printResults(
4317
+ quantity="RESULT_criticalCurrent",
4318
+ onElementsOf="DOM_allWindings",
4319
+ name="Critical Current [A]",
4320
+ fileName="CriticalCurrent",
4321
+ atGaussPoints=True
4322
+ )|indent(12)>>
4323
+ }
4324
+ }
4325
+ {
4326
+ Name POSTOP_currentSharingIndex;
4327
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4328
+ Operation{
4329
+ // Critical current:
4330
+ <<POSTOPERATION_printResults(
4331
+ quantity="RESULT_currentSharingIndex",
4332
+ onElementsOf="DOM_allWindings",
4333
+ name="Current Sharing Index [-]",
4334
+ fileName="currentSharingIndex",
4335
+ atGaussPoints=True
4336
+ )|indent(12)>>
4337
+ }
4338
+ }
4339
+ {
4340
+ Name POSTOP_jHTS;
4341
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4342
+ Operation{
4343
+ // Current density in HTS layer:
4344
+ <<POSTOPERATION_printResults(
4345
+ quantity="RESULT_jHTS",
4346
+ onElementsOf="DOM_allWindings",
4347
+ name="Current Density in HTS Layer [A/m^2]",
4348
+ fileName="jHTS",
4349
+ atGaussPoints=True
4350
+ )|indent(12)>>
4351
+ }
4352
+ }
4353
+ {
4354
+ Name POSTOP_jHTSOverjCritical;
4355
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4356
+ Operation{
4357
+ // Normalized HTS current density:
4358
+ <<POSTOPERATION_printResults(
4359
+ quantity="RESULT_jHTSOverjCritical",
4360
+ onElementsOf="DOM_allWindings",
4361
+ name="(HTS Current Density)/(Critical Current Density)",
4362
+ fileName="HTSCurrentDensityOverCriticalCurrentDensity",
4363
+ atGaussPoints=True
4364
+ )|indent(12)>>
4365
+ }
4366
+ }
3301
4367
  // {
3302
4368
  // Name POSTOP_Ic;
3303
4369
  // NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
@@ -3318,6 +4384,7 @@ PostOperation{
3318
4384
  Print[
3319
4385
  RESULT_currentThroughCoil,
3320
4386
  OnRegion DOM_terminalCut,
4387
+ Format Table,
3321
4388
  StoreInVariable $I
3322
4389
  ];
3323
4390
  }
@@ -3337,22 +4404,38 @@ PostOperation{
3337
4404
  )|indent(12)>>
3338
4405
  }
3339
4406
  }
3340
- {% if dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled", "thermal"] %}
4407
+ {
4408
+ Name POSTOP_currentThroughCoil;
4409
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4410
+ Operation{
4411
+ // Current at the cut:
4412
+ <<POSTOPERATION_printResults(
4413
+ quantity="RESULT_currentThroughCoil",
4414
+ onRegion="DOM_terminalCut",
4415
+ format="TimeTable",
4416
+ name="Current [A]",
4417
+ fileName="CurrentThroughCoil"
4418
+ )|indent(12)>>
4419
+ }
4420
+ }
4421
+ {% endif %}
4422
+ {% if dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled", "thermal"] %}
3341
4423
  {
3342
4424
  Name POSTOP_maximumTemperature;
3343
4425
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3344
4426
  Operation {
3345
- Print[ RESULT_temperature,
3346
- OnElementsOf DOM_thermal,
3347
- StoreMaxInRegister 999,
3348
- Format Table,
3349
- LastTimeStepOnly 1,
3350
- SendToServer "No"
4427
+ Print[ RESULT_temperature,
4428
+ OnElementsOf DOM_thermal,
4429
+ StoreMaxInRegister 999,
4430
+ Format Table,
4431
+ LastTimeStepOnly 1,
4432
+ SendToServer "No",
4433
+ File "maximumTemperature_dump.txt"
3351
4434
  ] ;
3352
4435
  // We can print the maximum temperature at any region that is part
3353
4436
  // of the thermal domain since the `StoreMaxInRegister` command
3354
4437
  // already searches all of the thermal region for the maximum and
3355
- //populates the same value for all physical regions of the thermal
4438
+ //populates the same value for all physical regions of the thermal
3356
4439
  // domain.
3357
4440
  // Printing in just one domain makes the parsing of the output easier.
3358
4441
  <<POSTOPERATION_printResults(
@@ -3367,21 +4450,6 @@ PostOperation{
3367
4450
  )|indent(12)>>
3368
4451
  }
3369
4452
  }
3370
- {% endif %}
3371
- {
3372
- Name POSTOP_currentThroughCoil;
3373
- NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3374
- Operation{
3375
- // Current at the cut:
3376
- <<POSTOPERATION_printResults(
3377
- quantity="RESULT_currentThroughCoil",
3378
- onRegion="DOM_terminalCut",
3379
- format="TimeTable",
3380
- name="Current [A]",
3381
- fileName="CurrentThroughCoil"
3382
- )|indent(12)>>
3383
- }
3384
- }
3385
4453
  {% endif %}
3386
4454
  {% if dm.magnet.solve.type in ["thermal", "weaklyCoupled", "stronglyCoupled"] %}
3387
4455
  {
@@ -3414,12 +4482,20 @@ PostOperation{
3414
4482
  Name POSTOP_thermalConductivity;
3415
4483
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3416
4484
  Operation{
3417
- // Resistive heating:
4485
+ // Thermal conductivity:
3418
4486
  <<POSTOPERATION_printResults(
3419
4487
  quantity="RESULT_thermalConductivity",
3420
- onElementsOf="DOM_thermal",
3421
- name="Thermal Conductivity [W/(m*K)]",
3422
- fileName="thermalConductivity"
4488
+ onElementsOf="DOM_allWindings",
4489
+ name="Thermal Conductivity Windings [W/(m*K)]",
4490
+ fileName="thermalConductivity_Windings",
4491
+ atGaussPoints=True
4492
+ )|indent(12)>>
4493
+
4494
+ <<POSTOPERATION_printResults(
4495
+ quantity="RESULT_thermalConductivity",
4496
+ onElementsOf="DOM_allConductingWithoutWindings",
4497
+ name="Thermal Conductivity Without Windings [W/(m*K)]",
4498
+ fileName="thermalConductivity_ConductingWithoutWindings"
3423
4499
  )|indent(12)>>
3424
4500
  }
3425
4501
  }
@@ -3427,7 +4503,7 @@ PostOperation{
3427
4503
  Name POSTOP_specificHeatCapacity;
3428
4504
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3429
4505
  Operation{
3430
- // Resistive heating:
4506
+ // Specific heat:
3431
4507
  <<POSTOPERATION_printResults(
3432
4508
  quantity="RESULT_specificHeatCapacity",
3433
4509
  onElementsOf="DOM_thermal",
@@ -3444,7 +4520,7 @@ PostOperation{
3444
4520
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3445
4521
  Operation{
3446
4522
  {% if timeSeriesPlot.quantity == "maximumTemperature" %}
3447
-
4523
+
3448
4524
  {% elif timeSeriesPlot.quantity in ["currentThroughCoil", "voltageBetweenTerminals"] %}
3449
4525
  <<POSTOPERATION_printResults(
3450
4526
  quantity=timeSeriesPlot.getdpQuantityName,
@@ -3459,6 +4535,24 @@ PostOperation{
3459
4535
  format="TimeTable",
3460
4536
  fileName=timeSeriesPlot.fileName
3461
4537
  )|indent(12)>>
4538
+ {% elif timeSeriesPlot.quantity == "cryocoolerAveragePower" %}
4539
+ {% if dm.magnet.solve.type != "electromagnetic" %}
4540
+ <<POSTOPERATION_printResults(
4541
+ quantity=timeSeriesPlot.getdpQuantityName,
4542
+ onGlobal=True,
4543
+ format="TimeTable",
4544
+ fileName=timeSeriesPlot.fileName
4545
+ )|indent(12)>>
4546
+ {% endif %}
4547
+ {% elif timeSeriesPlot.quantity == "cryocoolerAverageTemperature" %}
4548
+ {% if dm.magnet.solve.type != "electromagnetic" %}
4549
+ <<POSTOPERATION_printResults(
4550
+ quantity=timeSeriesPlot.getdpQuantityName,
4551
+ onGlobal=True,
4552
+ format="TimeTable",
4553
+ fileName=timeSeriesPlot.fileName,
4554
+ )|indent(12)>>
4555
+ {% endif %}
3462
4556
  {% elif timeSeriesPlot.position.x is none %}
3463
4557
  <<POSTOPERATION_printResults(
3464
4558
  quantity=timeSeriesPlot.getdpQuantityName,
@@ -3507,9 +4601,10 @@ PostOperation{
3507
4601
  {% endif %}
3508
4602
  {% endif %}
3509
4603
  // convergence criteria as postoperations:
3510
- {% for tolerance in (dm.magnet.solve.nls.postOperationTolerances + dm.magnet.solve.t.adaptive.postOperationTolerances)|unique(attribute="quantity") %}
4604
+ {% for tolerance in (dm.magnet.solve.nonlinearSolver.postOperationTolerances + dm.magnet.solve.time.adaptiveSteppingSettings.postOperationTolerances)|unique(attribute="quantity") %}
3511
4605
  {% if tolerance.quantity == "totalResistiveHeating" %}
3512
4606
  {
4607
+ // Does this work properly without explicitly specifying AtGaussPoints? Expectation: yes, since it should do the integration over the whole by Gaussian Integration
3513
4608
  Name POSTOP_CONV_totalResistiveHeating;
3514
4609
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
3515
4610
  LastTimeStepOnly 1;
@@ -3527,6 +4622,7 @@ PostOperation{
3527
4622
  }
3528
4623
  }
3529
4624
  {% elif tolerance.quantity == "maximumTemperature" %}
4625
+ {% if dm.magnet.solve.type in ["weaklyCoupled", "stronglyCoupled", "thermal"] %}
3530
4626
  {
3531
4627
  Name POSTOP_CONV_maximumTemperature;
3532
4628
  NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
@@ -3547,8 +4643,9 @@ PostOperation{
3547
4643
  appendToExistingFile=True,
3548
4644
  lastTimeStepOnly=True,
3549
4645
  )|indent(12)>>
3550
- }
4646
+ }
3551
4647
  }
4648
+ {% endif %}
3552
4649
  {% else %}
3553
4650
  {
3554
4651
  Name POSTOP_CONV_<<tolerance.quantity>>;
@@ -3564,4 +4661,98 @@ PostOperation{
3564
4661
  }
3565
4662
  {% endif %}
3566
4663
  {% endfor %}
4664
+
4665
+ {% if dm.quench_detection.voltage_tap_pairs and dm.magnet.solve.voltageTapPositions and not dm.magnet.solve.type == "thermal" %}
4666
+ {
4667
+ Name POSTOP_electricScalarPotential_<<dm.magnet.solve.type>>;
4668
+ NameOfPostProcessing POSTPRO_<<dm.magnet.solve.type>>;
4669
+ Operation {
4670
+ <<POSTOPERATION_printResults(
4671
+ quantity="RESULT_currentThroughCoil",
4672
+ onRegion="DOM_terminalCut",
4673
+ format="TimeTable",
4674
+ name="Current [A]",
4675
+ fileName="CurrentThroughCoil_quenchDetection",
4676
+ lastTimeStepOnly=True,
4677
+ appendToExistingFile=True,
4678
+ storeInVariable="currentThroughCoil",
4679
+ noTitle=True
4680
+ )|indent(12)>>
4681
+
4682
+ {% if dm.magnet.solve.EECircuit.enable %}
4683
+ <<POSTOPERATION_printResults(
4684
+ quantity="RESULT_current_DOM_currentSource",
4685
+ onRegion="DOM_currentSource",
4686
+ format="TimeTable",
4687
+ name="Current [A]",
4688
+ fileName="Current_DOM_currentSource",
4689
+ lastTimeStepOnly=True,
4690
+ appendToExistingFile=True,
4691
+ noTitle=True
4692
+ )|indent(12)>>
4693
+
4694
+ <<POSTOPERATION_printResults(
4695
+ quantity="RESULT_resistance_DOM_switches",
4696
+ onRegion="Region[{DOM_switchCrowbar, DOM_switchEE}]",
4697
+ format="TimeTable",
4698
+ name="Current [A]",
4699
+ fileName="Resistance_DOM_switches",
4700
+ lastTimeStepOnly=True,
4701
+ appendToExistingFile=True,
4702
+ noTitle=True
4703
+ )|indent(12)>>
4704
+ {% endif %}
4705
+ }
4706
+ }
4707
+
4708
+ {
4709
+ Name POSTOP_electricScalarPotential;
4710
+ NameOfPostProcessing POSTPRO_electricScalarPotential;
4711
+ Operation {
4712
+
4713
+ <<POSTOPERATION_printResults(
4714
+ quantity="RESULT_conductance",
4715
+ onGlobal=True,
4716
+ format="TimeTable",
4717
+ fileName="conductance",
4718
+ name="Conductance [S]",
4719
+ lastTimeStepOnly=True,
4720
+ appendToExistingFile=True,
4721
+ storeInVariable="conductance"
4722
+ )|indent(12)>>
4723
+
4724
+
4725
+ {% for idx, potential_point in enumerate(dm.magnet.solve.voltageTapPositions) %}
4726
+ <<POSTOPERATION_printResults(
4727
+ quantity="RESULT_electricScalarPotential",
4728
+ onPoint=[potential_point.x, potential_point.y, potential_point.z],
4729
+ name="Potential at point [" + str(potential_point.x) + ", " + str(potential_point.y) + ", " + str(potential_point.z) + "] [V]",
4730
+ fileName="electricScalarPotential_" + str(idx),
4731
+ format="TimeTable",
4732
+ lastTimeStepOnly=True,
4733
+ appendToExistingFile=True,
4734
+ storeInVariable="potential_" + str(idx)
4735
+ )|indent(12)>>
4736
+ {% endfor %}
4737
+
4738
+ // loop over voltage_tap_pairs to write voltage
4739
+ {% for idx, voltage_tap_pair in enumerate(dm.quench_detection.voltage_tap_pairs) %}
4740
+ <<POSTOPERATION_printResults(
4741
+ quantity="RESULT_resistiveVoltage_" + str(idx),
4742
+ onRegion="DOM_dummyPrintResistiveVoltages",
4743
+ name="Resistive voltage between voltage tap " + str(voltage_tap_pair[0]) + " and " + str(voltage_tap_pair[1]) + " [V]",
4744
+ fileName="resistiveVoltage_" + str(idx),
4745
+ format="TimeTable",
4746
+ lastTimeStepOnly=True,
4747
+ appendToExistingFile=True,
4748
+ storeInVariable="voltage_" + str(idx),
4749
+ noTitle=True
4750
+ )|indent(12)>>
4751
+ {% endfor %}
4752
+
4753
+ // Print[RESULT_electricScalarPotential, OnElementsOf Region[{DOM_terminals, DOM_allWindings {% if not dm.magnet.geometry.contactLayer.thinShellApproximation %}, DOM_insulation{% endif %} }], File "electricScalarPotential.pos"];
4754
+ // Print[RESULT_currentFromElectricScalarPotential, OnElementsOf DOM_allWindings, File "currentFromElectricScalarPotential.pos", AtGaussPoints 6];
4755
+ }
4756
+ }
4757
+ {% endif %}
3567
4758
  }