fiqus 2025.12.0__py3-none-any.whl → 2026.1.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.
- fiqus/MainFiQuS.py +4 -8
- fiqus/data/DataConductor.py +108 -11
- fiqus/data/DataFiQuS.py +2 -1
- fiqus/data/DataFiQuSConductorAC_CC.py +345 -0
- fiqus/data/DataFiQuSConductorAC_Strand.py +3 -3
- fiqus/data/DataFiQuSMultipole.py +363 -165
- fiqus/data/DataModelCommon.py +30 -15
- fiqus/data/DataMultipole.py +33 -10
- fiqus/data/DataWindingsCCT.py +37 -37
- fiqus/data/RegionsModelFiQuS.py +1 -1
- fiqus/geom_generators/GeometryConductorAC_CC.py +1906 -0
- fiqus/geom_generators/GeometryMultipole.py +751 -54
- fiqus/getdp_runners/RunGetdpConductorAC_CC.py +123 -0
- fiqus/getdp_runners/RunGetdpMultipole.py +181 -31
- fiqus/mains/MainConductorAC_CC.py +148 -0
- fiqus/mains/MainMultipole.py +109 -17
- fiqus/mesh_generators/MeshCCT.py +209 -209
- fiqus/mesh_generators/MeshConductorAC_CC.py +1305 -0
- fiqus/mesh_generators/MeshMultipole.py +938 -263
- fiqus/parsers/ParserCOND.py +2 -1
- fiqus/parsers/ParserDAT.py +16 -16
- fiqus/parsers/ParserGetDPOnSection.py +212 -212
- fiqus/parsers/ParserGetDPTimeTable.py +134 -134
- fiqus/parsers/ParserMSH.py +53 -53
- fiqus/parsers/ParserRES.py +142 -142
- fiqus/plotters/PlotPythonCCT.py +133 -133
- fiqus/plotters/PlotPythonMultipole.py +18 -18
- fiqus/post_processors/PostProcessAC_CC.py +65 -0
- fiqus/post_processors/PostProcessMultipole.py +16 -6
- fiqus/pre_processors/PreProcessCCT.py +175 -175
- fiqus/pro_assemblers/ProAssembler.py +3 -3
- fiqus/pro_material_functions/ironBHcurves.pro +246 -246
- fiqus/pro_templates/combined/CAC_CC_template.pro +542 -0
- fiqus/pro_templates/combined/CC_Module.pro +1213 -0
- fiqus/pro_templates/combined/Multipole_template.pro +2738 -1338
- fiqus/pro_templates/combined/TSA_materials.pro +102 -2
- fiqus/pro_templates/combined/materials.pro +54 -3
- fiqus/utils/Utils.py +18 -25
- fiqus/utils/update_data_settings.py +1 -1
- {fiqus-2025.12.0.dist-info → fiqus-2026.1.1.dist-info}/METADATA +81 -77
- {fiqus-2025.12.0.dist-info → fiqus-2026.1.1.dist-info}/RECORD +52 -44
- {fiqus-2025.12.0.dist-info → fiqus-2026.1.1.dist-info}/WHEEL +1 -1
- tests/test_geometry_generators.py +47 -30
- tests/test_mesh_generators.py +69 -30
- tests/test_solvers.py +67 -29
- tests/utils/fiqus_test_classes.py +396 -147
- tests/utils/generate_reference_files_ConductorAC.py +57 -57
- tests/utils/helpers.py +76 -1
- /fiqus/pro_templates/combined/{ConductorACRutherford_template.pro → CAC_Rutherford_template.pro} +0 -0
- /fiqus/pro_templates/combined/{ConductorAC_template.pro → CAC_Strand_template.pro} +0 -0
- {fiqus-2025.12.0.dist-info → fiqus-2026.1.1.dist-info/licenses}/LICENSE.txt +0 -0
- {fiqus-2025.12.0.dist-info → fiqus-2026.1.1.dist-info}/top_level.txt +0 -0
|
@@ -1,170 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{%
|
|
15
|
-
|
|
16
|
-
{%
|
|
17
|
-
|
|
18
|
-
{%
|
|
19
|
-
|
|
1
|
+
{% set USE_THERMAL_PROJECTION = False %}
|
|
2
|
+
{#
|
|
3
|
+
DefineConstant[
|
|
4
|
+
C_ = {"-solve -v2 -pos -mat_mumps_icntl_14 100", Name "Updated_CvFUN/9ComputeCommand"}];// C_ = {"-solve -v2 -pos -pc_type lu -pc_factor_mat_solver_type umfpack", Name "GetDP/9ComputeCommand"}];
|
|
5
|
+
#}
|
|
6
|
+
{# // DEFINITION OF THE OPERATION MODE #}
|
|
7
|
+
{# // - Magnetostatics: Mag_sta #}
|
|
8
|
+
{# // - Magnetodynamics (Zero initial condition): Mag_dyn_0 #}
|
|
9
|
+
{# // - Magnetodynamics: Mag_dyn #}
|
|
10
|
+
{# // - Thermal-Magnetostatics: Th_Mag_sta #}
|
|
11
|
+
{# // - Thermal-Magnetodynamics (Zero initial condition): Th_Mag_0 #}
|
|
12
|
+
{# // - Thermal-Magnetodynamics: Th_Mag #}
|
|
13
|
+
{% if dm.magnet.solve.electromagnetics.solve_type == 'stationary' %}
|
|
14
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
15
|
+
{% set SIM_MODE = 'Th_Mag_sta'%}
|
|
16
|
+
{% else %}
|
|
17
|
+
{% set SIM_MODE = 'Mag_sta'%}
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% elif dm.magnet.solve.thermal.solve_type %}
|
|
20
|
+
{% if dm.power_supply.I_control_LUT[0] != 0 %}
|
|
21
|
+
{% set SIM_MODE = 'Th_Mag'%}
|
|
22
|
+
{% else %}
|
|
23
|
+
{% set SIM_MODE = 'Th_Mag_0'%}
|
|
24
|
+
{% endif %}
|
|
25
|
+
{% else %}
|
|
26
|
+
{% if dm.power_supply.I_control_LUT[0] != 0%}
|
|
27
|
+
{% set SIM_MODE = 'Mag_dyn'%}
|
|
28
|
+
{% else %}
|
|
29
|
+
{% set SIM_MODE = 'Mag_dyn_0'%}
|
|
30
|
+
{% endif %}
|
|
20
31
|
{% endif %}
|
|
21
|
-
{% endmacro %}
|
|
22
32
|
|
|
23
|
-
{
|
|
33
|
+
{#//Critical Current depending on the material of the superconductor #}
|
|
34
|
+
{%- macro criticalCurrentDensity(region_name, cond, time_trigger, cond_name) %}
|
|
35
|
+
{%- if cond.Jc_fit.type == 'CUDI1' %}
|
|
36
|
+
{%- if cond.strand.type == 'Round' %}
|
|
37
|
+
{%- set wire_diameter = (cond.cable.n_strands)**(1/2) * cond.strand.diameter %}
|
|
38
|
+
{%- elif cond.strand.type == 'Rectangular' %}
|
|
39
|
+
{%- set n_strands = cond.cable.n_strands if cond.cable.type == 'Rutherford' else 1 %}
|
|
40
|
+
{%- set wire_diameter = (4 * n_strands * cond.strand.bare_width * cond.strand.bare_height / Pi) ** (1 / 2) %}
|
|
41
|
+
{%- endif -%}
|
|
42
|
+
criticalCurrentDensity[<<region_name>>] = $Time > <<time_trigger>>? 0: <<materials[criticalCurrentDensityMacroName[cond.strand.material_superconductor + '_' + cond.Jc_fit.type]](C1=cond.Jc_fit.C1_CUDI1, C2=cond.Jc_fit.C2_CUDI1, Tc0=cond.Jc_fit.Tc0_CUDI1, Bc20=cond.Jc_fit.Bc20_CUDI1, wireDiameter=wire_diameter, Cu_noCu=cond.strand.Cu_noCu_in_strand)>> * f_sc_<<cond_name>>;
|
|
43
|
+
{%- elif cond.Jc_fit.type == 'Summers' -%}
|
|
44
|
+
criticalCurrentDensity[<<region_name>>] = $Time > <<time_trigger>>? 0: <<materials[criticalCurrentDensityMacroName[cond.strand.material_superconductor + '_' + cond.Jc_fit.type]](Jc0=cond.Jc_fit.Jc0_Summers, Tc0=cond.Jc_fit.Tc0_Summers, Bc20=cond.Jc_fit.Bc20_Summers)>> * f_sc_<<cond_name>>;
|
|
45
|
+
{%- elif cond.Jc_fit.type == 'Bordini' %}
|
|
46
|
+
criticalCurrentDensity[<<region_name>>] = $Time > <<time_trigger>>? 0: <<materials[criticalCurrentDensityMacroName[cond.strand.material_superconductor + '_' + cond.Jc_fit.type]](Tc0=cond.Jc_fit.Tc0_Bordini, Bc20=cond.Jc_fit.Bc20_Bordini, C0=cond.Jc_fit.C0_Bordini, alpha=cond.Jc_fit.alpha_Bordini)>> * f_sc_<<cond_name>>;
|
|
47
|
+
{%- elif cond.Jc_fit.type == 'BSCCO_2212_LBNL' %}
|
|
48
|
+
criticalCurrentDensity[<<region_name>>] = $Time > <<time_trigger>>? 0: <<materials[criticalCurrentDensityMacroName[cond.strand.material_superconductor + '_' + cond.Jc_fit.type]](f_scaling=cond.Jc_fit.f_scaling_Jc_BSCCO2212)>> * f_sc_<<cond_name>>;
|
|
49
|
+
{%- endif -%}
|
|
50
|
+
{% endmacro %}
|
|
24
51
|
|
|
25
|
-
|
|
52
|
+
Include "<<BHcurves>>";?
|
|
53
|
+
{% import "materials.pro" as materials %}
|
|
54
|
+
{% import "TSA_materials.pro" as TSA_materials %}
|
|
55
|
+
{% import "CC_Module.pro" as cc_macros2 -%}
|
|
56
|
+
{% set areas_to_build = {'EM': dm.magnet.geometry.electromagnetics.areas, 'TH': dm.magnet.geometry.thermal.areas } %}
|
|
57
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
58
|
+
// Preamble
|
|
59
|
+
// Stop the simulation when the Avg. temperature of any of the half-turns reaches the stop temp.
|
|
60
|
+
{% if dm.magnet.solve.thermal.solve_type and dm.magnet.solve.electromagnetics.solve_type == 'transient'%}
|
|
61
|
+
stop_temperature = <<dm.magnet.solve.time_stepping.stop_temperature>>; // [K]
|
|
62
|
+
{% else %}
|
|
63
|
+
stop_temperature = <<dm.magnet.solve.thermal.time_stepping.stop_temperature>>; // [K]
|
|
64
|
+
{% endif %}
|
|
26
65
|
/* -------------------------------------------------------------------------- */
|
|
27
66
|
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
bare_2_1 = {<<bare_2_1|join(', ')>>};
|
|
45
|
-
bare_1_2 = {<<bare_1_2|join(', ')>>};
|
|
46
|
-
bare_2_2 = {<<bare_2_2|join(', ')>>};
|
|
47
|
-
|
|
48
|
-
// Shell lines belonging to the bare parts as indexed above
|
|
49
|
-
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
50
|
-
{% set bare_layers_1_1 = rm_TH.powered['r1_a1'].surf_in.numbers + rm_TH.induced['r1_a1'].surf_in.numbers %}
|
|
51
|
-
{% set bare_layers_2_1 = rm_TH.powered['r2_a1'].surf_in.numbers + rm_TH.induced['r2_a1'].surf_in.numbers %}
|
|
52
|
-
{% set bare_layers_1_2 = rm_TH.powered['r1_a2'].surf_in.numbers + rm_TH.induced['r1_a2'].surf_in.numbers %}
|
|
53
|
-
{% set bare_layers_2_2 = rm_TH.powered['r2_a2'].surf_in.numbers + rm_TH.induced['r2_a2'].surf_in.numbers %}
|
|
54
|
-
{% else %}
|
|
55
|
-
{% set bare_layers_1_1 = rm_TH.powered['r1_a1'].surf_in.numbers %}
|
|
56
|
-
{% set bare_layers_2_1 = rm_TH.powered['r2_a1'].surf_in.numbers %}
|
|
57
|
-
{% set bare_layers_1_2 = rm_TH.powered['r1_a2'].surf_in.numbers %}
|
|
58
|
-
{% set bare_layers_2_2 = rm_TH.powered['r2_a2'].surf_in.numbers %}
|
|
59
|
-
{% endif %}
|
|
60
|
-
|
|
61
|
-
bare_layers_1_1() = {<<bare_layers_1_1|join(', ')>>};
|
|
62
|
-
bare_layers_2_1() = {<<bare_layers_2_1|join(', ')>>};
|
|
63
|
-
bare_layers_1_2() = {<<bare_layers_1_2|join(', ')>>};
|
|
64
|
-
bare_layers_2_2() = {<<bare_layers_2_2|join(', ')>>};
|
|
65
|
-
|
|
66
|
-
// ------------ BOUNDARY CONDITIONS --------------------------------------------
|
|
67
|
-
// boundary shells where Dirichlet BC applied, there we need two Tdisc
|
|
68
|
-
// indexing follows the one with the bares BUT we have to think of these lines
|
|
69
|
-
// as neighbors belonging to the non-existing exterior bare part, i.e.,
|
|
70
|
-
// the line touching bare_2_1 will then be bare_1_1
|
|
71
|
-
bndDir_1_1() = {<<rm_TH.boundaries.thermal.temperature.groups['r1_a1']|join(', ')>>};
|
|
72
|
-
bndDir_2_1() = {<<rm_TH.boundaries.thermal.temperature.groups['r2_a1']|join(', ')>>};
|
|
73
|
-
bndDir_1_2() = {<<rm_TH.boundaries.thermal.temperature.groups['r1_a2']|join(', ')>>};
|
|
74
|
-
bndDir_2_2() = {<<rm_TH.boundaries.thermal.temperature.groups['r2_a2']|join(', ')>>};
|
|
75
|
-
|
|
76
|
-
// boundary shells where Neumann BC applied, there we need two Tdisc
|
|
77
|
-
// indexing follows the one with the bares BUT we have to think of these lines
|
|
78
|
-
// as neighbors belonging to the non-existing exterior bare part, i.e.,
|
|
79
|
-
// the line touching bare_2_1 will then be bare_1_1
|
|
80
|
-
bndNeu_1_1() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r1_a1']|join(', ')>>};
|
|
81
|
-
bndNeu_2_1() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r2_a1']|join(', ')>>};
|
|
82
|
-
bndNeu_1_2() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r1_a2']|join(', ')>>};
|
|
83
|
-
bndNeu_2_2() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r2_a2']|join(', ')>>};
|
|
84
|
-
|
|
85
|
-
// boundary shells where Robin BC applied, follows the same indexing scheme as
|
|
86
|
-
// Dirichlet, i.e.,
|
|
87
|
-
// indexing follows the one with the bares BUT we have to think of these lines
|
|
88
|
-
// as neighbors belonging to the non-existing exterior bare part, i.e.,
|
|
89
|
-
// the line touching bare_2_1 will then be bare_1_1
|
|
90
|
-
bndRobin_1_1() = { <<rm_TH.boundaries.thermal.cooling.groups['r1_a1']|join(', ')>>};
|
|
91
|
-
bndRobin_2_1() = { <<rm_TH.boundaries.thermal.cooling.groups['r2_a1']|join(', ')>>};
|
|
92
|
-
bndRobin_1_2() = { <<rm_TH.boundaries.thermal.cooling.groups['r1_a2']|join(', ')>>};
|
|
93
|
-
bndRobin_2_2() = { <<rm_TH.boundaries.thermal.cooling.groups['r2_a2']|join(', ')>>};
|
|
94
|
-
|
|
95
|
-
// for Robin and Neumann, we also need to store some information for GetDP to know the
|
|
96
|
-
// outer virtual shell element
|
|
97
|
-
// first index: same as first index of horVer_layers of Robin (simplified) or midLayers (non-simplified)
|
|
98
|
-
// second index: same as first index of bndRobin or bndNeumann
|
|
99
|
-
// third index: same as second index of bndRobin or bndNeumann
|
|
100
|
-
{% set bndRobinInt_1_1_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a1']).intersection(bare_layers_2_1)) %}
|
|
101
|
-
{% set bndRobinInt_2_1_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a1']).intersection(bare_layers_1_2)) %}
|
|
102
|
-
|
|
103
|
-
{% set bndRobinInt_1_2_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a1']).intersection(bare_layers_1_1)) %}
|
|
104
|
-
{% set bndRobinInt_2_2_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a1']).intersection(bare_layers_2_2)) %}
|
|
105
|
-
|
|
106
|
-
{% set bndRobinInt_1_1_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a2']).intersection(bare_layers_2_2)) %}
|
|
107
|
-
{% set bndRobinInt_2_1_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a2']).intersection(bare_layers_1_1)) %}
|
|
108
|
-
|
|
109
|
-
{% set bndRobinInt_1_2_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a2']).intersection(bare_layers_1_2)) %}
|
|
110
|
-
{% set bndRobinInt_2_2_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a2']).intersection(bare_layers_2_1)) %}
|
|
111
|
-
|
|
112
|
-
// Neumann
|
|
113
|
-
{% set bndNeuInt_1_1_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a1']).intersection(bare_layers_2_1)) %}
|
|
114
|
-
{% set bndNeuInt_2_1_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a1']).intersection(bare_layers_1_2)) %}
|
|
115
|
-
|
|
116
|
-
{% set bndNeuInt_1_2_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a1']).intersection(bare_layers_1_1)) %}
|
|
117
|
-
{% set bndNeuInt_2_2_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a1']).intersection(bare_layers_2_2)) %}
|
|
118
|
-
|
|
119
|
-
{% set bndNeuInt_1_1_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a2']).intersection(bare_layers_2_2)) %}
|
|
120
|
-
{% set bndNeuInt_2_1_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a2']).intersection(bare_layers_1_1)) %}
|
|
121
|
-
|
|
122
|
-
{% set bndNeuInt_1_2_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a2']).intersection(bare_layers_1_2)) %}
|
|
123
|
-
{% set bndNeuInt_2_2_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a2']).intersection(bare_layers_2_1)) %}
|
|
124
|
-
|
|
125
|
-
// QH
|
|
126
|
-
{% set ns = namespace(all_QH=[]) %}
|
|
127
|
-
|
|
128
|
-
{% for taglist in rm_TH.thin_shells.quench_heaters.thin_shells %}
|
|
129
|
-
{% set ns.all_QH = ns.all_QH + taglist %}
|
|
130
|
-
{% endfor %}
|
|
67
|
+
{#
|
|
68
|
+
// Checkered support indexing for bare part
|
|
69
|
+
// first index: neighboring information in azimuthal direction
|
|
70
|
+
// second index: neighboring information in radial direction
|
|
71
|
+
#}
|
|
72
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
73
|
+
{% set bare_1_1 = rm_TH.powered['r1_a1'].vol.numbers + rm_TH.induced['r1_a1'].vol.numbers %}
|
|
74
|
+
{% set bare_2_1 = rm_TH.powered['r2_a1'].vol.numbers + rm_TH.induced['r2_a1'].vol.numbers %}
|
|
75
|
+
{% set bare_1_2 = rm_TH.powered['r1_a2'].vol.numbers + rm_TH.induced['r1_a2'].vol.numbers %}
|
|
76
|
+
{% set bare_2_2 = rm_TH.powered['r2_a2'].vol.numbers + rm_TH.induced['r2_a2'].vol.numbers %}
|
|
77
|
+
{% else %}
|
|
78
|
+
{% set bare_1_1 = rm_TH.powered['r1_a1'].vol.numbers %}
|
|
79
|
+
{% set bare_2_1 = rm_TH.powered['r2_a1'].vol.numbers %}
|
|
80
|
+
{% set bare_1_2 = rm_TH.powered['r1_a2'].vol.numbers %}
|
|
81
|
+
{% set bare_2_2 = rm_TH.powered['r2_a2'].vol.numbers %}
|
|
82
|
+
{% endif %}
|
|
131
83
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
{% set midLayers_1_1 = rm_TH.powered['r1_a1'].surf_out.numbers %}
|
|
150
|
-
{% set midLayers_2_1 = rm_TH.powered['r2_a1'].surf_out.numbers %}
|
|
151
|
-
{% set midLayers_1_2 = rm_TH.powered['r1_a2'].surf_out.numbers %}
|
|
152
|
-
{% set midLayers_2_2 = rm_TH.powered['r2_a2'].surf_out.numbers %}
|
|
153
|
-
{% endif %}
|
|
154
|
-
midLayers_1_1() = {<<midLayers_1_1|join(', ')>>};
|
|
155
|
-
midLayers_2_1() = {<<midLayers_2_1|join(', ')>>};
|
|
156
|
-
midLayers_1_2() = {<<midLayers_1_2|join(', ')>>};
|
|
157
|
-
midLayers_2_2() = {<<midLayers_2_2|join(', ')>>};
|
|
158
|
-
midLayers() = {<<rm_TH.thin_shells.mid_turns_layers_poles|join(', ')>>};
|
|
159
|
-
|
|
160
|
-
{# midLayers_1: oriented along radial direction, connecting half-turns and poles #}
|
|
161
|
-
{# part of the vertical and horizontal splitting #}
|
|
162
|
-
{# it needs to match the definition of the function spaces for identifying plus and minus side correctly #}
|
|
163
|
-
{% set midLayers_1 = list(set(rm_TH.thin_shells.normals_directed['azimuthally']).intersection(rm_TH.thin_shells.mid_turns_layers_poles)) %}
|
|
164
|
-
{# midLayers_2: oriented along azimuth direction, connecting layer # }
|
|
165
|
-
{# part of the vertical and horizontal splitting #}
|
|
166
|
-
{% set midLayers_2 = list(set(rm_TH.thin_shells.normals_directed['radially']).intersection(rm_TH.thin_shells.mid_turns_layers_poles)) %}
|
|
84
|
+
bare_1_1 = {<<bare_1_1|join(', ')>>};
|
|
85
|
+
bare_2_1 = {<<bare_2_1|join(', ')>>};
|
|
86
|
+
bare_1_2 = {<<bare_1_2|join(', ')>>};
|
|
87
|
+
bare_2_2 = {<<bare_2_2|join(', ')>>};
|
|
88
|
+
|
|
89
|
+
// Shell lines belonging to the bare parts as indexed above
|
|
90
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
91
|
+
{% set bare_layers_1_1 = rm_TH.powered['r1_a1'].surf_in.numbers + rm_TH.induced['r1_a1'].surf_in.numbers %}
|
|
92
|
+
{% set bare_layers_2_1 = rm_TH.powered['r2_a1'].surf_in.numbers + rm_TH.induced['r2_a1'].surf_in.numbers %}
|
|
93
|
+
{% set bare_layers_1_2 = rm_TH.powered['r1_a2'].surf_in.numbers + rm_TH.induced['r1_a2'].surf_in.numbers %}
|
|
94
|
+
{% set bare_layers_2_2 = rm_TH.powered['r2_a2'].surf_in.numbers + rm_TH.induced['r2_a2'].surf_in.numbers %}
|
|
95
|
+
{% else %}
|
|
96
|
+
{% set bare_layers_1_1 = rm_TH.powered['r1_a1'].surf_in.numbers %}
|
|
97
|
+
{% set bare_layers_2_1 = rm_TH.powered['r2_a1'].surf_in.numbers %}
|
|
98
|
+
{% set bare_layers_1_2 = rm_TH.powered['r1_a2'].surf_in.numbers %}
|
|
99
|
+
{% set bare_layers_2_2 = rm_TH.powered['r2_a2'].surf_in.numbers %}
|
|
100
|
+
{% endif %}
|
|
167
101
|
|
|
102
|
+
bare_layers_1_1() = {<<bare_layers_1_1|join(', ')>>};
|
|
103
|
+
bare_layers_2_1() = {<<bare_layers_2_1|join(', ')>>};
|
|
104
|
+
bare_layers_1_2() = {<<bare_layers_1_2|join(', ')>>};
|
|
105
|
+
bare_layers_2_2() = {<<bare_layers_2_2|join(', ')>>};
|
|
106
|
+
|
|
107
|
+
// ------------ BOUNDARY CONDITIONS --------------------------------------------
|
|
108
|
+
{#
|
|
109
|
+
// boundary shells where Dirichlet BC applied, there we need two Tdisc
|
|
110
|
+
// indexing follows the one with the bares BUT we have to think of these lines
|
|
111
|
+
// as neighbors belonging to the non-existing exterior bare part, i.e.,
|
|
112
|
+
// the line touching bare_2_1 will then be bare_1_1
|
|
113
|
+
#}
|
|
114
|
+
bndDir_1_1() = {<<rm_TH.boundaries.thermal.temperature.groups['r1_a1']|join(', ')>>};
|
|
115
|
+
bndDir_2_1() = {<<rm_TH.boundaries.thermal.temperature.groups['r2_a1']|join(', ')>>};
|
|
116
|
+
bndDir_1_2() = {<<rm_TH.boundaries.thermal.temperature.groups['r1_a2']|join(', ')>>};
|
|
117
|
+
bndDir_2_2() = {<<rm_TH.boundaries.thermal.temperature.groups['r2_a2']|join(', ')>>};
|
|
118
|
+
{#
|
|
119
|
+
// boundary shells where Neumann BC applied, there we need two Tdisc
|
|
120
|
+
// indexing follows the one with the bares BUT we have to think of these lines
|
|
121
|
+
// as neighbors belonging to the non-existing exterior bare part, i.e.,
|
|
122
|
+
// the line touching bare_2_1 will then be bare_1_1
|
|
123
|
+
#}
|
|
124
|
+
bndNeu_1_1() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r1_a1']|join(', ')>>};
|
|
125
|
+
bndNeu_2_1() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r2_a1']|join(', ')>>};
|
|
126
|
+
bndNeu_1_2() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r1_a2']|join(', ')>>};
|
|
127
|
+
bndNeu_2_2() = {<<rm_TH.boundaries.thermal.heat_flux.groups['r2_a2']|join(', ')>>};
|
|
128
|
+
{#
|
|
129
|
+
// boundary shells where Robin BC applied, follows the same indexing scheme as
|
|
130
|
+
// Dirichlet, i.e.,
|
|
131
|
+
// indexing follows the one with the bares BUT we have to think of these lines
|
|
132
|
+
// as neighbors belonging to the non-existing exterior bare part, i.e.,
|
|
133
|
+
// the line touching bare_2_1 will then be bare_1_1
|
|
134
|
+
#}
|
|
135
|
+
bndRobin_1_1() = { <<rm_TH.boundaries.thermal.cooling.groups['r1_a1']|join(', ')>>};
|
|
136
|
+
bndRobin_2_1() = { <<rm_TH.boundaries.thermal.cooling.groups['r2_a1']|join(', ')>>};
|
|
137
|
+
bndRobin_1_2() = { <<rm_TH.boundaries.thermal.cooling.groups['r1_a2']|join(', ')>>};
|
|
138
|
+
bndRobin_2_2() = { <<rm_TH.boundaries.thermal.cooling.groups['r2_a2']|join(', ')>>};
|
|
139
|
+
{#
|
|
140
|
+
// for Robin and Neumann, we also need to store some information for GetDP to know the
|
|
141
|
+
// outer virtual shell element
|
|
142
|
+
// first index: same as first index of horVer_layers of Robin (simplified) or midLayers (non-simplified)
|
|
143
|
+
// second index: same as first index of bndRobin or bndNeumann
|
|
144
|
+
// third index: same as second index of bndRobin or bndNeumann
|
|
145
|
+
#}
|
|
146
|
+
{% set bndRobinInt_1_1_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a1']).intersection(bare_layers_2_1)) %}
|
|
147
|
+
{% set bndRobinInt_2_1_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a1']).intersection(bare_layers_1_2)) %}
|
|
148
|
+
{% set bndRobinInt_1_2_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a1']).intersection(bare_layers_1_1)) %}
|
|
149
|
+
{% set bndRobinInt_2_2_1 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a1']).intersection(bare_layers_2_2)) %}
|
|
150
|
+
{% set bndRobinInt_1_1_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a2']).intersection(bare_layers_2_2)) %}
|
|
151
|
+
{% set bndRobinInt_2_1_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r1_a2']).intersection(bare_layers_1_1)) %}
|
|
152
|
+
{% set bndRobinInt_1_2_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a2']).intersection(bare_layers_1_2)) %}
|
|
153
|
+
{% set bndRobinInt_2_2_2 = list(set(rm_TH.boundaries.thermal.cooling.groups['r2_a2']).intersection(bare_layers_2_1)) %}
|
|
154
|
+
|
|
155
|
+
// Neumann
|
|
156
|
+
{% set bndNeuInt_1_1_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a1']).intersection(bare_layers_2_1)) %}
|
|
157
|
+
{% set bndNeuInt_2_1_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a1']).intersection(bare_layers_1_2)) %}
|
|
158
|
+
{% set bndNeuInt_1_2_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a1']).intersection(bare_layers_1_1)) %}
|
|
159
|
+
{% set bndNeuInt_2_2_1 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a1']).intersection(bare_layers_2_2)) %}
|
|
160
|
+
{% set bndNeuInt_1_1_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a2']).intersection(bare_layers_2_2)) %}
|
|
161
|
+
{% set bndNeuInt_2_1_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r1_a2']).intersection(bare_layers_1_1)) %}
|
|
162
|
+
{% set bndNeuInt_1_2_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a2']).intersection(bare_layers_1_2)) %}
|
|
163
|
+
{% set bndNeuInt_2_2_2 = list(set(rm_TH.boundaries.thermal.heat_flux.groups['r2_a2']).intersection(bare_layers_2_1)) %}
|
|
164
|
+
|
|
165
|
+
// QH
|
|
166
|
+
{% set ns = namespace(all_QH=[]) %}
|
|
167
|
+
{% for taglist in rm_TH.thin_shells.quench_heaters.thin_shells %}
|
|
168
|
+
{% set ns.all_QH = ns.all_QH + taglist %}
|
|
169
|
+
{% endfor %}
|
|
170
|
+
{% set QH_1_1 = set(ns.all_QH).intersection(set(bare_layers_2_1).intersection(rm_TH.thin_shells.normals_directed['azimuthally']).union(set(bare_layers_1_2).intersection(rm_TH.thin_shells.normals_directed['radially']))) %}
|
|
171
|
+
{% set QH_2_1 = set(ns.all_QH).intersection(set(bare_layers_1_1).intersection(rm_TH.thin_shells.normals_directed['azimuthally']).union(set(bare_layers_2_2).intersection(rm_TH.thin_shells.normals_directed['radially']))) %}
|
|
172
|
+
{% set QH_1_2 = set(ns.all_QH).intersection(set(bare_layers_2_2).intersection(rm_TH.thin_shells.normals_directed['azimuthally']).union(set(bare_layers_1_1).intersection(rm_TH.thin_shells.normals_directed['radially']))) %}
|
|
173
|
+
{% set QH_2_2 = set(ns.all_QH).intersection(set(bare_layers_1_2).intersection(rm_TH.thin_shells.normals_directed['azimuthally']).union(set(bare_layers_2_1).intersection(rm_TH.thin_shells.normals_directed['radially']))) %}
|
|
174
|
+
QH_1_1() = {<<QH_1_1|join(', ')>>};
|
|
175
|
+
QH_2_1() = {<<QH_2_1|join(', ')>>};
|
|
176
|
+
QH_1_2() = {<<QH_1_2|join(', ')>>};
|
|
177
|
+
QH_2_2() = {<<QH_2_2|join(', ')>>};
|
|
178
|
+
// midLayers
|
|
179
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
180
|
+
{% set midLayers_1_1 = rm_TH.powered['r1_a1'].surf_out.numbers + rm_TH.induced['r1_a1'].surf_out.numbers %}
|
|
181
|
+
{% set midLayers_2_1 = rm_TH.powered['r2_a1'].surf_out.numbers + rm_TH.induced['r2_a1'].surf_out.numbers %}
|
|
182
|
+
{% set midLayers_1_2 = rm_TH.powered['r1_a2'].surf_out.numbers + rm_TH.induced['r1_a2'].surf_out.numbers %}
|
|
183
|
+
{% set midLayers_2_2 = rm_TH.powered['r2_a2'].surf_out.numbers + rm_TH.induced['r2_a2'].surf_out.numbers %}
|
|
184
|
+
{% else %}
|
|
185
|
+
{% set midLayers_1_1 = rm_TH.powered['r1_a1'].surf_out.numbers %}
|
|
186
|
+
{% set midLayers_2_1 = rm_TH.powered['r2_a1'].surf_out.numbers %}
|
|
187
|
+
{% set midLayers_1_2 = rm_TH.powered['r1_a2'].surf_out.numbers %}
|
|
188
|
+
{% set midLayers_2_2 = rm_TH.powered['r2_a2'].surf_out.numbers %}
|
|
189
|
+
{% endif %}
|
|
190
|
+
midLayers_1_1() = {<<midLayers_1_1|join(', ')>>};
|
|
191
|
+
midLayers_2_1() = {<<midLayers_2_1|join(', ')>>};
|
|
192
|
+
midLayers_1_2() = {<<midLayers_1_2|join(', ')>>};
|
|
193
|
+
midLayers_2_2() = {<<midLayers_2_2|join(', ')>>};
|
|
194
|
+
midLayers() = {<<rm_TH.thin_shells.mid_turns_layers_poles|join(', ')>>};
|
|
195
|
+
|
|
196
|
+
{# midLayers_1: oriented along radial direction, connecting half-turns and poles #}
|
|
197
|
+
{# part of the vertical and horizontal splitting #}
|
|
198
|
+
{# it needs to match the definition of the function spaces for identifying plus and minus side correctly #}
|
|
199
|
+
{% set midLayers_1 = list(set(rm_TH.thin_shells.normals_directed['azimuthally']).intersection(rm_TH.thin_shells.mid_turns_layers_poles)) %}
|
|
200
|
+
{# midLayers_2: oriented along azimuth direction, connecting layer # }
|
|
201
|
+
{# part of the vertical and horizontal splitting #}
|
|
202
|
+
{% set midLayers_2 = list(set(rm_TH.thin_shells.normals_directed['radially']).intersection(rm_TH.thin_shells.mid_turns_layers_poles)) %}
|
|
203
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
204
|
+
inner_collar = {<<rm_TH.thin_shells.bdry_curves.collar|join(',')>>};
|
|
205
|
+
pole_bdry_lines = {<<rm_TH.thin_shells.bdry_curves.poles|join(',')>>};
|
|
206
|
+
{% endif %}
|
|
207
|
+
{% endif %}
|
|
208
|
+
outer_collar = {<<rm_TH.thin_shells.bdry_curves.outer_collar|join(',')>>};
|
|
209
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
210
|
+
indLayers={{% if rm_TH.induced['r1_a1'].surf_in.numbers %} <<rm_TH.induced['r1_a1'].surf_in.numbers|join(', ')>>{% endif %}
|
|
211
|
+
{% if rm_TH.induced['r2_a1'].surf_in.numbers %}, <<rm_TH.induced['r2_a1'].surf_in.numbers|join(', ')>>{% endif %}
|
|
212
|
+
{% if rm_TH.induced['r1_a2'].surf_in.numbers %}, <<rm_TH.induced['r1_a2'].surf_in.numbers|join(', ')>>{% endif %}
|
|
213
|
+
{% if rm_TH.induced['r2_a2'].surf_in.numbers %}, <<rm_TH.induced['r2_a2'].surf_in.numbers|join(', ')>>{% endif %}
|
|
214
|
+
};
|
|
215
|
+
{% endif %}
|
|
168
216
|
// AUX GROUPS ------------------------------------------------------------------
|
|
169
217
|
allLayers = {{% if rm_TH.powered['r1_a1'].surf_in.numbers %}<<rm_TH.powered['r1_a1'].surf_in.numbers|join(', ')>>{% endif %}
|
|
170
218
|
{% if rm_TH.powered['r2_a1'].surf_in.numbers %}, <<rm_TH.powered['r2_a1'].surf_in.numbers|join(', ')>>{% endif %}
|
|
@@ -176,98 +224,245 @@ Include "<<BHcurves>>";
|
|
|
176
224
|
{% if rm_TH.induced['r1_a2'].surf_in.numbers %}, <<rm_TH.induced['r1_a2'].surf_in.numbers|join(', ')>>{% endif %}
|
|
177
225
|
{% if rm_TH.induced['r2_a2'].surf_in.numbers %}, <<rm_TH.induced['r2_a2'].surf_in.numbers|join(', ')>>{% endif %}
|
|
178
226
|
{% endif %}};
|
|
179
|
-
{% endif %}
|
|
180
|
-
|
|
181
227
|
{% endif %}
|
|
182
228
|
|
|
183
229
|
Group {
|
|
184
|
-
|
|
230
|
+
// Extra groups: cooling of the collar
|
|
231
|
+
bndCollarGaps = Region[{ {% if dm.magnet.solve.thermal.collar_cooling.enabled %}<<rm_TH.boundaries.thermal.collar.bc.numbers|join(',')>> {% endif %}}];
|
|
185
232
|
|
|
186
|
-
|
|
187
|
-
|
|
233
|
+
// Air Volume Regions
|
|
234
|
+
<<rm_EM.air.vol.name>> = Region[ <<rm_EM.air.vol.number>> ]; // Air
|
|
235
|
+
<<rm_EM.air_far_field.vol.names[0]>> = Region[ <<rm_EM.air_far_field.vol.numbers[0]>> ]; // AirInf
|
|
236
|
+
// Half-turn Volume Regions
|
|
188
237
|
{% for name, number in zip(rm_EM.powered['r1_a1'].vol.names, rm_EM.powered['r1_a1'].vol.numbers) %}
|
|
189
|
-
|
|
238
|
+
<<name>> = Region[ <<number>> ];
|
|
190
239
|
{% endfor %}
|
|
191
240
|
{% for name, number in zip(rm_EM.powered['r2_a1'].vol.names, rm_EM.powered['r2_a1'].vol.numbers) %}
|
|
192
|
-
|
|
241
|
+
<<name>> = Region[ <<number>> ];
|
|
193
242
|
{% endfor %}
|
|
194
243
|
{% for name, number in zip(rm_EM.powered['r1_a2'].vol.names, rm_EM.powered['r1_a2'].vol.numbers) %}
|
|
195
|
-
|
|
244
|
+
<<name>> = Region[ <<number>> ];
|
|
196
245
|
{% endfor %}
|
|
197
246
|
{% for name, number in zip(rm_EM.powered['r2_a2'].vol.names, rm_EM.powered['r2_a2'].vol.numbers) %}
|
|
198
|
-
|
|
247
|
+
<<name>> = Region[ <<number>> ];
|
|
199
248
|
{% endfor %}
|
|
200
249
|
|
|
250
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
251
|
+
// Half-turn Volume Regions for Thermal
|
|
252
|
+
{% for name, number in zip(rm_TH.powered['r1_a1'].vol.names, rm_TH.powered['r1_a1'].vol.numbers) %}
|
|
253
|
+
<<name>> = Region[ <<number>> ];
|
|
254
|
+
{% endfor %}
|
|
255
|
+
{% for name, number in zip(rm_TH.powered['r2_a1'].vol.names, rm_TH.powered['r2_a1'].vol.numbers) %}
|
|
256
|
+
<<name>> = Region[ <<number>> ];
|
|
257
|
+
{% endfor %}
|
|
258
|
+
{% for name, number in zip(rm_TH.powered['r1_a2'].vol.names, rm_TH.powered['r1_a2'].vol.numbers) %}
|
|
259
|
+
<<name>> = Region[ <<number>> ];
|
|
260
|
+
{% endfor %}
|
|
261
|
+
{% for name, number in zip(rm_TH.powered['r2_a2'].vol.names, rm_TH.powered['r2_a2'].vol.numbers) %}
|
|
262
|
+
<<name>> = Region[ <<number>> ];
|
|
263
|
+
{% endfor %}
|
|
264
|
+
{% endif -%}
|
|
265
|
+
|
|
201
266
|
{% if dm.magnet.geometry.electromagnetics.with_wedges %}
|
|
267
|
+
//Wedges Volume Regions for EM
|
|
202
268
|
{% for name, number in zip(rm_EM.induced['r1_a1'].vol.names, rm_EM.induced['r1_a1'].vol.numbers) %}
|
|
203
|
-
|
|
269
|
+
<<name>> = Region[ <<number>> ];
|
|
204
270
|
{% endfor %}
|
|
205
271
|
{% for name, number in zip(rm_EM.induced['r2_a1'].vol.names, rm_EM.induced['r2_a1'].vol.numbers) %}
|
|
206
|
-
|
|
272
|
+
<<name>> = Region[ <<number>> ];
|
|
207
273
|
{% endfor %}
|
|
208
274
|
{% for name, number in zip(rm_EM.induced['r1_a2'].vol.names, rm_EM.induced['r1_a2'].vol.numbers) %}
|
|
209
|
-
|
|
275
|
+
<<name>> = Region[ <<number>> ];
|
|
210
276
|
{% endfor %}
|
|
211
277
|
{% for name, number in zip(rm_EM.induced['r2_a2'].vol.names, rm_EM.induced['r2_a2'].vol.numbers) %}
|
|
212
|
-
|
|
278
|
+
<<name>> = Region[ <<number>> ];
|
|
213
279
|
{% endfor %}
|
|
214
|
-
{% endif
|
|
280
|
+
{% endif -%}
|
|
215
281
|
|
|
216
|
-
{% if dm.magnet.geometry.electromagnetics.with_iron_yoke %}
|
|
217
|
-
{% for name, number in zip(rm_EM.iron_yoke.vol.names, rm_EM.iron_yoke.vol.numbers) %}
|
|
218
|
-
<<name>> = Region[ <<number>> ];
|
|
219
|
-
{% endfor %}
|
|
220
|
-
{% endif %}
|
|
221
282
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
283
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
284
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
285
|
+
//Wedges Volume Regions for EM
|
|
286
|
+
{% for name, number in zip(rm_TH.induced['r1_a1'].vol.names, rm_TH.induced['r1_a1'].vol.numbers) %}
|
|
287
|
+
<<name>> = Region[ <<number>> ];
|
|
288
|
+
{% endfor %}
|
|
289
|
+
{% for name, number in zip(rm_TH.induced['r2_a1'].vol.names, rm_TH.induced['r2_a1'].vol.numbers) %}
|
|
290
|
+
<<name>> = Region[ <<number>> ];
|
|
291
|
+
{% endfor %}
|
|
292
|
+
{% for name, number in zip(rm_TH.induced['r1_a2'].vol.names, rm_TH.induced['r1_a2'].vol.numbers) %}
|
|
293
|
+
<<name>> = Region[ <<number>> ];
|
|
294
|
+
{% endfor %}
|
|
295
|
+
{% for name, number in zip(rm_TH.induced['r2_a2'].vol.names, rm_TH.induced['r2_a2'].vol.numbers) %}
|
|
296
|
+
<<name>> = Region[ <<number>> ];
|
|
297
|
+
{% endfor %}
|
|
298
|
+
{% endif %}
|
|
299
|
+
{% endif -%}
|
|
300
|
+
//Iron Volumes Region for EM
|
|
301
|
+
{% for area in areas_to_build['EM'] %}
|
|
302
|
+
{% for name, number in zip(rm_EM[area].vol.names, rm_EM[area].vol.numbers) %}
|
|
303
|
+
S<<nc[area]>>_<<name>> = Region[ <<number>> ];
|
|
304
|
+
{% endfor %}
|
|
305
|
+
{% endfor %}
|
|
306
|
+
|
|
307
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
308
|
+
//Iron Volumes Region for Thermal
|
|
309
|
+
{% for region in areas_to_build['TH'] %}
|
|
310
|
+
{% for name, number in zip(rm_TH[region].vol.names, rm_TH[region].vol.numbers) %}
|
|
311
|
+
S<<nc[region]>>_<<name>>_TH = Region[ <<number>> ];
|
|
312
|
+
{% endfor %}
|
|
313
|
+
{% endfor %}
|
|
314
|
+
{% if dm.magnet.mesh.thermal.reference.enabled %}
|
|
315
|
+
// reference solution
|
|
316
|
+
{% for name, number in zip(rm_TH['ref_mesh'].vol.names, rm_TH['ref_mesh'].vol.numbers) %}
|
|
317
|
+
S<<nc['ref_mesh']>>_<<name>>_TH = Region[ <<number>> ];
|
|
318
|
+
{% endfor %}
|
|
319
|
+
{% endif %}
|
|
225
320
|
{% endif %}
|
|
226
321
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
322
|
+
// Air Far Field Surface Region
|
|
323
|
+
<<rm_EM.air_far_field.surf.name>> = Region[ <<rm_EM.air_far_field.surf.number>> ];
|
|
324
|
+
{% if rm_EM.boundaries.symmetry.normal_free.number %}
|
|
325
|
+
<<rm_EM.boundaries.symmetry.normal_free.name>> = Region[ <<rm_EM.boundaries.symmetry.normal_free.number>> ];
|
|
326
|
+
{% endif -%}
|
|
232
327
|
|
|
233
|
-
{% if dm.magnet.
|
|
234
|
-
|
|
328
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
329
|
+
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
330
|
+
// Insulator Volume Regions for TSA
|
|
331
|
+
{% for name, number in zip(rm_TH.insulator.vol.names, rm_TH.insulator.vol.numbers) %}
|
|
332
|
+
<<name>> = Region[ <<number>> ];
|
|
333
|
+
{% endfor %}
|
|
334
|
+
{% for name, number in zip(rm_TH.insulator.surf.names, rm_TH.insulator.surf.numbers) %}
|
|
335
|
+
<<name>> = Region[ <<number>> ];
|
|
336
|
+
{% endfor %}
|
|
337
|
+
{% endif %}
|
|
235
338
|
{% endif %}
|
|
236
339
|
|
|
340
|
+
//Groups
|
|
341
|
+
<<nc.omega>><<nc.air>>_EM = Region[ <<rm_EM.air.vol.name>> ];
|
|
342
|
+
<<nc.omega>><<nc.air_far_field>>_EM = Region[ <<rm_EM.air_far_field.vol.names[0]>> ];
|
|
343
|
+
// Half-Turn Conductors Groups for EM
|
|
344
|
+
{% for cond_name in dm.conductors.keys() %}
|
|
345
|
+
<<nc.omega>><<nc.powered>>_<<cond_name>>_EM = Region[ {
|
|
346
|
+
{%- if rm_EM.powered['r1_a1'].conductors[cond_name] %} <<rm_EM.powered['r1_a1'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
347
|
+
{% if rm_EM.powered['r1_a2'].conductors[cond_name] %}, <<rm_EM.powered['r1_a2'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
348
|
+
{% if rm_EM.powered['r2_a1'].conductors[cond_name] %}, <<rm_EM.powered['r2_a1'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
349
|
+
{% if rm_EM.powered['r2_a2'].conductors[cond_name] %}, <<rm_EM.powered['r2_a2'].conductors[cond_name]|join(', ')>>{% endif %}} ];
|
|
350
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
351
|
+
<<nc.omega>><<nc.powered>>_<<cond_name>>_TH = Region[ {
|
|
352
|
+
{%- if rm_TH.powered['r1_a1'].conductors[cond_name] %}<<rm_TH.powered['r1_a1'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
353
|
+
{% if rm_TH.powered['r1_a2'].conductors[cond_name] %}, <<rm_TH.powered['r1_a2'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
354
|
+
{% if rm_TH.powered['r2_a1'].conductors[cond_name] %}, <<rm_TH.powered['r2_a1'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
355
|
+
{% if rm_TH.powered['r2_a2'].conductors[cond_name] %}, <<rm_TH.powered['r2_a2'].conductors[cond_name]|join(', ')>>{% endif %}} ];
|
|
356
|
+
{% endif %}
|
|
357
|
+
{% endfor %}
|
|
358
|
+
//Powered Group
|
|
359
|
+
<<nc.omega>><<nc.powered>>_EM = Region[ {<<nc.omega>><<nc.powered>>_<<dm.conductors.keys()|join('_EM, ' + nc.omega + nc.powered + '_')>>_EM} ];
|
|
360
|
+
// Polarity Groups (electrical connection of the half-turns)
|
|
361
|
+
{% set pol_ = ({}) %}
|
|
362
|
+
<<cc_macros2.generate_polarity_groups(dm, rm_EM,aux,pol_)>>
|
|
363
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
364
|
+
// Half-Turn Conductors Groups for TH
|
|
365
|
+
<<nc.omega>><<nc.powered>>_TH = Region[ {<<nc.omega>><<nc.powered>>_<<dm.conductors.keys()|join('_TH, ' + nc.omega + nc.powered + '_')>>_TH} ];
|
|
366
|
+
{% endif %}
|
|
237
367
|
{% if dm.magnet.geometry.electromagnetics.with_wedges %}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
368
|
+
// Wedges' Group for EM
|
|
369
|
+
<<nc.omega>><<nc.induced>>_EM = Region[ {
|
|
370
|
+
{%- if rm_EM.induced['r1_a1'].vol.names %}<<rm_EM.induced['r1_a1'].vol.names|join(', ')>>{% endif %}
|
|
371
|
+
{% if rm_EM.induced['r1_a2'].vol.names %}, <<rm_EM.induced['r1_a2'].vol.names|join(', ')>>{% endif %}
|
|
372
|
+
{% if rm_EM.induced['r2_a1'].vol.names %}, <<rm_EM.induced['r2_a1'].vol.names|join(', ')>>{% endif %}
|
|
373
|
+
{% if rm_EM.induced['r2_a2'].vol.names %}, <<rm_EM.induced['r2_a2'].vol.names|join(', ')>>{% endif %}} ];
|
|
374
|
+
{% endif %}
|
|
375
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
376
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
377
|
+
// Wedges' Group for TH
|
|
378
|
+
<<nc.omega>><<nc.induced>>_TH = Region[ {
|
|
379
|
+
{%- if rm_TH.induced['r1_a1'].vol.names %}<<rm_TH.induced['r1_a1'].vol.names|join(', ')>>{% endif %}
|
|
380
|
+
{% if rm_TH.induced['r1_a2'].vol.names %}, <<rm_TH.induced['r1_a2'].vol.names|join(', ')>>{% endif %}
|
|
381
|
+
{% if rm_TH.induced['r2_a1'].vol.names %}, <<rm_TH.induced['r2_a1'].vol.names|join(', ')>>{% endif %}
|
|
382
|
+
{% if rm_TH.induced['r2_a2'].vol.names %}, <<rm_TH.induced['r2_a2'].vol.names|join(', ')>>{% endif %}} ];
|
|
383
|
+
{% endif %}
|
|
243
384
|
{% endif %}
|
|
244
385
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
{%
|
|
254
|
-
|
|
255
|
-
|
|
386
|
+
// Iron Yoke Group for EM
|
|
387
|
+
{% for area in areas_to_build['EM']%}
|
|
388
|
+
<<nc.omega>><<nc[area]>>_EM = Region[ {S<<nc[area]>>_<<rm_EM[area].vol.names|join(', ')>>} ];
|
|
389
|
+
{% endfor %}
|
|
390
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
391
|
+
// Iron Yoke Group for TH
|
|
392
|
+
{% for area in areas_to_build['TH']%}
|
|
393
|
+
<<nc.omega>><<nc[area]>>_TH = Region[{S<<nc[area]>>_<<rm_TH[area].vol.names|join(', ')>>_TH}];
|
|
394
|
+
{% endfor %}
|
|
395
|
+
{% if dm.magnet.mesh.thermal.reference.enabled%}
|
|
396
|
+
// reference
|
|
397
|
+
<<nc.omega>>_refmesh_TH = Region[ {S_refmesh_<<rm_TH.ref_mesh.vol.names|join(', ')>>_TH}];
|
|
398
|
+
{% endif %}
|
|
399
|
+
{% endif %}
|
|
400
|
+
// Conductor group (Powered + Induced) for EM
|
|
401
|
+
<<nc.omega>><<nc.conducting>>_EM = Region[ {<<nc.omega>><<nc.powered>>_EM{% if 'iron_yoke' in areas_to_build['EM'] %}, <<nc.omega>><<nc.iron_yoke>>_EM{% endif %}
|
|
402
|
+
{% if dm.magnet.geometry.electromagnetics.with_wedges %}, <<nc.omega>><<nc.induced>>_EM{% endif %}} ];
|
|
403
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
404
|
+
// Conductor group (Powered + Induced) for TH
|
|
405
|
+
<<nc.omega>><<nc.conducting>>_TH = Region[ {<<nc.omega>><<nc.powered>>_TH{% if 'iron_yoke' in areas_to_build['TH'] %}, <<nc.omega>><<nc.iron_yoke>>_TH{% endif %}
|
|
406
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %}} ];
|
|
407
|
+
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
408
|
+
// Insulator group (TSA) for TH
|
|
409
|
+
<<nc.omega>><<nc.insulator>>_TH = Region[ {<<rm_TH.insulator.vol.names|join(', ')>>} ];
|
|
410
|
+
{% endif %}
|
|
411
|
+
{% endif %}
|
|
412
|
+
// EM Domain
|
|
413
|
+
<<nc.omega>>_EM = Region[ {<<rm_EM.air.vol.name>>, <<rm_EM.air_far_field.vol.names[0]>>, <<nc.omega>><<nc.powered>>_EM{% for area in areas_to_build['EM'] %}, <<nc.omega>><<nc[area]>>_EM{% endfor %}
|
|
414
|
+
{% if dm.magnet.geometry.electromagnetics.with_wedges %}, <<nc.omega>><<nc.induced>>_EM{% endif %}} ];
|
|
415
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
416
|
+
// TH Domain
|
|
417
|
+
<<nc.omega>>_TH = Region[ {<<nc.omega>><<nc.powered>>_TH{% for area in areas_to_build['TH'] %}, <<nc.omega>><<nc[area]>>_TH{% endfor %}
|
|
418
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %}
|
|
419
|
+
{% if not dm.magnet.geometry.thermal.use_TSA %}, <<nc.omega>><<nc.insulator>>_TH{% endif %}
|
|
420
|
+
{% if dm.magnet.mesh.thermal.reference.enabled%}, <<nc.omega>>_refmesh_TH{% endif %} }];
|
|
421
|
+
<<nc.omega>>_noninsulation_areas_TH = Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %}{% for area in areas_to_build['TH'] %}, <<nc.omega>><<nc[area]>>_TH{% endfor %}}];
|
|
422
|
+
{% endif %}
|
|
423
|
+
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
424
|
+
// additional help segment (see integration and insulators)
|
|
425
|
+
<<nc.omega>>_TH_not<<nc.powered>> = Region[{<<nc.omega>><<nc.insulator>>_TH {% if 'collar' in areas_to_build['TH'] %}, <<nc.omega>><<nc.collar>>_TH {% endif %}{% if dm.magnet.mesh.thermal.reference.enabled%}, <<nc.omega>>_refmesh_TH {% endif %}}];
|
|
426
|
+
{% endif %}
|
|
427
|
+
// Boundary of Air Far Field
|
|
428
|
+
<<nc.boundary>><<nc.omega>> = Region[ {<<rm_EM.air_far_field.surf.name>>{% if rm_EM.boundaries.symmetry.normal_free.number %}, <<rm_EM.boundaries.symmetry.normal_free.name>>{% endif %}}];
|
|
429
|
+
|
|
430
|
+
{% set jcZero_ht = {} %}
|
|
431
|
+
{% for cond_name in dm.conductors.keys() %}
|
|
432
|
+
{% do jcZero_ht.update({cond_name: []}) %}
|
|
433
|
+
{% endfor %}
|
|
434
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
435
|
+
{% for turn in dm.magnet.solve.thermal.jc_degradation_to_zero.turns %}
|
|
436
|
+
jcZero_ht<<turn>> = Region[{ht<<turn>>_TH}];
|
|
437
|
+
{% for cond_name in dm.conductors.keys() %}
|
|
438
|
+
{% if 'ht' + str(turn) + '_TH' in rm_TH.powered['r1_a1'].conductors[cond_name] + rm_TH.powered['r1_a2'].conductors[cond_name] + rm_TH.powered['r2_a1'].conductors[cond_name] + rm_TH.powered['r2_a2'].conductors[cond_name] %}
|
|
439
|
+
{% do jcZero_ht.update({cond_name: jcZero_ht[cond_name] + ['ht' + str(turn) + '_TH']}) %}
|
|
440
|
+
{% endif %}
|
|
441
|
+
{% endfor %}
|
|
442
|
+
{% endfor %}
|
|
443
|
+
{% endif %}
|
|
444
|
+
{% for cond_name in dm.conductors.keys() %}
|
|
445
|
+
jcNonZero_<<cond_name>> = Region[<<nc.omega>><<nc.powered>>_<<cond_name>>_EM];
|
|
446
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
447
|
+
jcNonZero_<<cond_name>> += Region[<<nc.omega>><<nc.powered>>_<<cond_name>>_TH];
|
|
448
|
+
jcZero_<<cond_name>> = Region[{<<jcZero_ht[cond_name]|join(', ')>>}];
|
|
449
|
+
jcNonZero_<<cond_name>> -= Region[jcZero_<<cond_name>>];
|
|
450
|
+
{% endif %}
|
|
451
|
+
{% endfor %}
|
|
256
452
|
|
|
257
|
-
|
|
453
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
454
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
258
455
|
// --------------------- BARE ------------------------------------------------
|
|
259
|
-
|
|
260
456
|
// physical regions of the bare blocks
|
|
261
457
|
For i In {1:2}
|
|
262
|
-
|
|
458
|
+
For j In {1:2}
|
|
263
459
|
Bare~{i}~{j} = Region[ bare~{i}~{j} ];
|
|
264
460
|
<<nc.omega>>_TH += Region[ bare~{i}~{j} ];
|
|
265
|
-
EndFor
|
|
266
461
|
EndFor
|
|
267
|
-
|
|
462
|
+
EndFor
|
|
268
463
|
// ------------------- SHELLS ------------------------------------------------
|
|
269
464
|
For i In {1:2}
|
|
270
|
-
|
|
465
|
+
For j In {1:2}
|
|
271
466
|
// integration domains
|
|
272
467
|
Bare_Layers~{i}~{j} = Region[ bare_layers~{i}~{j} ];
|
|
273
468
|
Bare_Layers~{i}~{j} += Region[ bndDir~{i}~{j} ];
|
|
@@ -277,130 +472,48 @@ Group {
|
|
|
277
472
|
Bare_Layers~{i}~{j} += Region[ QH~{i}~{j} ];
|
|
278
473
|
|
|
279
474
|
Domain_Insulated_Str~{i}~{j} = Region[ { Bare~{i}~{j},
|
|
280
|
-
|
|
475
|
+
Bare_Layers~{i}~{j} } ];
|
|
281
476
|
|
|
282
477
|
midLayers~{i}~{j} = Region[midLayers~{i}~{j}];
|
|
283
|
-
|
|
284
|
-
EndFor
|
|
285
478
|
EndFor
|
|
286
|
-
|
|
479
|
+
EndFor
|
|
287
480
|
midLayers = Region[midLayers];
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
{%
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
{% for name, number in zip(rm_TH.iron_yoke.vol.names, rm_TH.iron_yoke.vol.numbers) %}
|
|
321
|
-
<<name>> = Region[ <<number>> ];
|
|
322
|
-
{% endfor %}
|
|
323
|
-
{% endif %}
|
|
324
|
-
|
|
325
|
-
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
326
|
-
{% for name, number in zip(rm_TH.insulator.vol.names, rm_TH.insulator.vol.numbers) %}
|
|
327
|
-
<<name>> = Region[ <<number>> ];
|
|
328
|
-
{% endfor %}
|
|
329
|
-
{% for name, number in zip(rm_TH.insulator.surf.names, rm_TH.insulator.surf.numbers) %}
|
|
330
|
-
<<name>> = Region[ <<number>> ];
|
|
331
|
-
{% endfor %}
|
|
332
|
-
{% endif %}
|
|
333
|
-
|
|
334
|
-
{% for cond_name in dm.conductors.keys() %}
|
|
335
|
-
<<nc.omega>><<nc.powered>>_<<cond_name>>_TH = Region[ {
|
|
336
|
-
{% if rm_TH.powered['r1_a1'].conductors[cond_name] %}<<rm_TH.powered['r1_a1'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
337
|
-
{% if rm_TH.powered['r1_a2'].conductors[cond_name] %}, <<rm_TH.powered['r1_a2'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
338
|
-
{% if rm_TH.powered['r2_a1'].conductors[cond_name] %}, <<rm_TH.powered['r2_a1'].conductors[cond_name]|join(', ')>>{% endif %}
|
|
339
|
-
{% if rm_TH.powered['r2_a2'].conductors[cond_name] %}, <<rm_TH.powered['r2_a2'].conductors[cond_name]|join(', ')>>{% endif %}} ];
|
|
340
|
-
{% endfor %}
|
|
341
|
-
<<nc.omega>><<nc.powered>>_TH = Region[ {<<nc.omega>><<nc.powered>>_<<dm.conductors.keys()|join('_TH, ' + nc.omega + nc.powered + '_')>>_TH} ];
|
|
342
|
-
{% if dm.magnet.geometry.thermal.with_iron_yoke %}
|
|
343
|
-
<<nc.omega>><<nc.iron>>_TH = Region[ {<<rm_TH.iron_yoke.vol.names|join(', ')>>} ];
|
|
344
|
-
{% endif %}
|
|
345
|
-
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
346
|
-
<<nc.omega>><<nc.induced>>_TH = Region[ {
|
|
347
|
-
{% if rm_TH.induced['r1_a1'].vol.names %}<<rm_TH.induced['r1_a1'].vol.names|join(', ')>>{% endif %}
|
|
348
|
-
{% if rm_TH.induced['r1_a2'].vol.names %}, <<rm_TH.induced['r1_a2'].vol.names|join(', ')>>{% endif %}
|
|
349
|
-
{% if rm_TH.induced['r2_a1'].vol.names %}, <<rm_TH.induced['r2_a1'].vol.names|join(', ')>>{% endif %}
|
|
350
|
-
{% if rm_TH.induced['r2_a2'].vol.names %}, <<rm_TH.induced['r2_a2'].vol.names|join(', ')>>{% endif %}} ];
|
|
351
|
-
{% endif %}
|
|
352
|
-
<<nc.omega>><<nc.conducting>>_TH = Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_iron_yoke %}, <<nc.omega>><<nc.iron>>_TH{% endif %}
|
|
353
|
-
{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %}} ];
|
|
354
|
-
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
355
|
-
<<nc.omega>><<nc.insulator>>_TH = Region[ {<<rm_TH.insulator.vol.names|join(', ')>>} ];
|
|
356
|
-
{% endif %}
|
|
357
|
-
<<nc.omega>>_TH = Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_iron_yoke %}, <<nc.omega>><<nc.iron>>_TH{% endif %}
|
|
358
|
-
{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %}{% if not dm.magnet.geometry.thermal.use_TSA %}, <<nc.omega>><<nc.insulator>>_TH{% endif %}} ];
|
|
359
|
-
|
|
360
|
-
{# the jinja 'do' extension allows to perform actions without variable assignments, practically enabling jinja dicts since '{% dict[new_key] = new_value %}' is not allowed #}
|
|
361
|
-
{% set jcZero_ht = {} %}
|
|
362
|
-
{% for cond_name in dm.conductors.keys() %}
|
|
363
|
-
{% do jcZero_ht.update({cond_name: []}) %}
|
|
364
|
-
{% endfor %}
|
|
365
|
-
{% for turn in dm.magnet.solve.thermal.jc_degradation_to_zero.turns %}
|
|
366
|
-
jcZero_ht<<turn>> = Region[{ht<<turn>>_TH}];
|
|
367
|
-
{% for cond_name in dm.conductors.keys() %}
|
|
368
|
-
{% if 'ht' + str(turn) + '_TH' in rm_TH.powered['r1_a1'].conductors[cond_name] + rm_TH.powered['r1_a2'].conductors[cond_name] + rm_TH.powered['r2_a1'].conductors[cond_name] + rm_TH.powered['r2_a2'].conductors[cond_name] %}
|
|
369
|
-
{% do jcZero_ht.update({cond_name: jcZero_ht[cond_name] + ['ht' + str(turn) + '_TH']}) %}
|
|
370
|
-
{% endif %}
|
|
371
|
-
{% endfor %}
|
|
372
|
-
{% endfor %}
|
|
373
|
-
{% for cond_name in dm.conductors.keys() %}
|
|
374
|
-
jcZero_<<cond_name>> = Region[{<<jcZero_ht[cond_name]|join(', ')>>}];
|
|
375
|
-
jcNonZero_<<cond_name>> = Region[<<nc.omega>><<nc.powered>>_<<cond_name>>_TH];
|
|
376
|
-
jcNonZero_<<cond_name>> -= Region[jcZero_<<cond_name>>];
|
|
377
|
-
{% endfor %}
|
|
378
|
-
|
|
379
|
-
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
380
|
-
// {% set more_elems = [3348, 3349] %}
|
|
381
|
-
// {% set bare_layers = bare_layers_1_1 + bare_layers_1_2 + bare_layers_2_1 + bare_layers_2_2 %}
|
|
382
|
-
// {% set not_more_elems = list(set(rm_TH.thin_shells.mid_turns_layers_poles + bare_layers) - set(more_elems)) %}
|
|
383
|
-
|
|
384
|
-
//{% set tags_with_same_tsa_structure = [more_elems, not_more_elems] %}
|
|
385
|
-
//{% set thicknesses_tsa_layers = [[2 * 8.4E-5/4, 2 * 8.4E-5 / 4, 2 * 8.4E-5 / 4, 2 * 8.4E-5 /4], [2 * 8.4E-5/2, 2 * 8.4E-5/2]] %}
|
|
386
|
-
{% set materials_tsa_layers = [[], []] %}
|
|
387
|
-
|
|
388
|
-
//{% set n_tsa_layers = [4, 2] %} // sum of all
|
|
389
|
-
|
|
390
|
-
{% set bndDir_1 = list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a1']).intersection(bare_layers_2_1)) +
|
|
391
|
-
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a1']).intersection(bare_layers_1_1)) +
|
|
392
|
-
list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a2']).intersection(bare_layers_2_2)) +
|
|
393
|
-
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a2']).intersection(bare_layers_1_2)) %}
|
|
394
|
-
|
|
395
|
-
{% set bndDir_2 = list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a1']).intersection(bare_layers_1_2)) +
|
|
396
|
-
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a1']).intersection(bare_layers_2_2)) +
|
|
397
|
-
list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a2']).intersection(bare_layers_1_1)) +
|
|
398
|
-
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a2']).intersection(bare_layers_2_1)) %}
|
|
399
|
-
|
|
400
|
-
{% for nr, tags in enumerate(rm_TH.thin_shells.insulation_types.thin_shells + rm_TH.thin_shells.quench_heaters.thin_shells) %}
|
|
481
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
482
|
+
midLayers_col_2_1 = Region[{<<rm_TH.thin_shells.ts_collar_groups['2_1']|join(',')>>}];
|
|
483
|
+
midLayers_col_1_1 = Region[{<<rm_TH.thin_shells.ts_collar_groups['1_1']|join(',')>>}];
|
|
484
|
+
midLayers_col_1_2 = Region[{<<rm_TH.thin_shells.ts_collar_groups['1_2']|join(',')>>}];
|
|
485
|
+
midLayers_col_2_2 = Region[{<<rm_TH.thin_shells.ts_collar_groups['2_2']|join(',')>>}];
|
|
486
|
+
midLayers_col = Region[{midLayers_col_1_1, midLayers_col_2_1, midLayers_col_1_2, midLayers_col_2_2}];
|
|
487
|
+
|
|
488
|
+
midLayers_pol_2_1 = Region[{<<(rm_TH.thin_shells.ts_pole_groups['a_2_1']+rm_TH.thin_shells.ts_pole_groups['r_2_1'])|join(',')>>}];
|
|
489
|
+
midLayers_pol_1_1 = Region[{<<(rm_TH.thin_shells.ts_pole_groups['a_1_1']+rm_TH.thin_shells.ts_pole_groups['r_1_1'])|join(',')>>}];
|
|
490
|
+
midLayers_pol_1_2 = Region[{<<(rm_TH.thin_shells.ts_pole_groups['a_1_2']+rm_TH.thin_shells.ts_pole_groups['r_1_2'])|join(',')>>}];
|
|
491
|
+
midLayers_pol_2_2 = Region[{<<(rm_TH.thin_shells.ts_pole_groups['a_2_2']+rm_TH.thin_shells.ts_pole_groups['r_2_2'])|join(',')>>}];
|
|
492
|
+
midLayers_pol = Region[{<<rm_TH.thin_shells.poles.thin_shells| map('join', ',') |join(',') >>}]; // equivalent to Region[{midLayers_pol_1_1, midLayers_pol_2_1, midLayers_pol_1_2, midLayers_pol_2_2}];
|
|
493
|
+
|
|
494
|
+
{% set midLayers_col = list(rm_TH.thin_shells.ts_collar_groups['1_1']) + list(rm_TH.thin_shells.ts_collar_groups['2_1']) + list(rm_TH.thin_shells.ts_collar_groups['1_2']) + list(rm_TH.thin_shells.ts_collar_groups['2_2'])%}
|
|
495
|
+
{% set midLayers_a_pol = list(rm_TH.thin_shells.ts_pole_groups['a_1_1']) + list(rm_TH.thin_shells.ts_pole_groups['a_2_1']) + list(rm_TH.thin_shells.ts_pole_groups['a_1_2']) + list(rm_TH.thin_shells.ts_pole_groups['a_2_2'])%}
|
|
496
|
+
{% set midLayers_r_pol = list(rm_TH.thin_shells.ts_pole_groups['r_1_1']) + list(rm_TH.thin_shells.ts_pole_groups['r_2_1']) + list(rm_TH.thin_shells.ts_pole_groups['r_1_2']) + list(rm_TH.thin_shells.ts_pole_groups['r_2_2'])%}
|
|
497
|
+
{% endif %}
|
|
498
|
+
{% set materials_tsa_layers = [[], []] %}
|
|
499
|
+
{% set bndDir_1 = list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a1']).intersection(bare_layers_2_1)) +
|
|
500
|
+
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a1']).intersection(bare_layers_1_1)) +
|
|
501
|
+
list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a2']).intersection(bare_layers_2_2)) +
|
|
502
|
+
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a2']).intersection(bare_layers_1_2)) %}
|
|
503
|
+
|
|
504
|
+
{% set bndDir_2 = list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a1']).intersection(bare_layers_1_2)) +
|
|
505
|
+
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a1']).intersection(bare_layers_2_2)) +
|
|
506
|
+
list(set(rm_TH.boundaries.thermal.temperature.groups['r1_a2']).intersection(bare_layers_1_1)) +
|
|
507
|
+
list(set(rm_TH.boundaries.thermal.temperature.groups['r2_a2']).intersection(bare_layers_2_1)) %}
|
|
508
|
+
{% for nr, tags in enumerate(rm_TH.thin_shells.insulation_types.thin_shells + rm_TH.thin_shells.quench_heaters.thin_shells + rm_TH.thin_shells.collar.thin_shells + rm_TH.thin_shells.poles.thin_shells) %}
|
|
509
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
510
|
+
intDomain_1_<<nr + 1>> = Region[{<<set(midLayers_1 + midLayers_a_pol).intersection(tags)|join(', ')>>}]; // normals azimuthal
|
|
511
|
+
intDomain_2_<<nr + 1>> = Region[{<<set(midLayers_2 + midLayers_r_pol + midLayers_col).intersection(tags)|join(', ')>>}]; // normals radial
|
|
512
|
+
{% else %}
|
|
401
513
|
intDomain_1_<<nr + 1>> = Region[{<<set(midLayers_1).intersection(tags)|join(', ')>>}];
|
|
402
514
|
intDomain_2_<<nr + 1>> = Region[{<<set(midLayers_2).intersection(tags)|join(', ')>>}];
|
|
403
|
-
|
|
515
|
+
{% endif %}
|
|
516
|
+
// these boundary conditions are only applied to sides without a thermal shell approximation
|
|
404
517
|
// add Robin boundary conditions
|
|
405
518
|
intDomain_1_<<nr + 1>> += Region[{<<set(bndRobinInt_1_1_1 + bndRobinInt_1_1_2 + bndRobinInt_1_2_1 + bndRobinInt_1_2_2).intersection(tags)|join(', ')>>}];
|
|
406
519
|
intDomain_2_<<nr + 1>> += Region[{<<set(bndRobinInt_2_1_1 + bndRobinInt_2_1_2 + bndRobinInt_2_2_1 + bndRobinInt_2_2_2).intersection(tags)|join(', ')>>}];
|
|
@@ -432,403 +545,801 @@ Group {
|
|
|
432
545
|
bndNeuInt_2_1_2_<<nr + 1>> = Region[{<<set(bndNeuInt_2_1_2).intersection(tags)|join(', ')>>}];
|
|
433
546
|
bndNeuInt_2_2_1_<<nr + 1>> = Region[{<<set(bndNeuInt_2_2_1).intersection(tags)|join(', ')>>}];
|
|
434
547
|
bndNeuInt_2_2_2_<<nr + 1>> = Region[{<<set(bndNeuInt_2_2_2).intersection(tags)|join(', ')>>}];
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
{% for nr, names in enumerate(rm_TH.boundaries.thermal.temperature.bc.names) %}
|
|
548
|
+
{% endfor %}
|
|
549
|
+
{% else %} {# not TSA #}
|
|
550
|
+
{% for nr, names in enumerate(rm_TH.boundaries.thermal.temperature.bc.names) %}
|
|
440
551
|
<<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.temperature)[nr]>> = Region[ {<<names|join(', ')>>} ];
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
{% if dm.magnet.solve.thermal.He_cooling.sides != 'external' and nr == 0 %}
|
|
552
|
+
{% endfor %}
|
|
553
|
+
{% for nr, names in enumerate(rm_TH.boundaries.thermal.heat_flux.bc.names) %}
|
|
554
|
+
{% if dm.magnet.solve.thermal.He_cooling.sides != 'external' and nr == 0 %}
|
|
445
555
|
general_adiabatic = Region[ {<<names|join(', ')>>} ];
|
|
446
|
-
|
|
556
|
+
{% else %}
|
|
447
557
|
<<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.heat_flux)[nr - 1 if dm.magnet.solve.thermal.He_cooling.sides != 'external' else nr]>> = Region[ {<<names|join(', ')>>} ];
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
{% if dm.magnet.solve.thermal.He_cooling.enabled and nr == 0 %}
|
|
558
|
+
{% endif %}
|
|
559
|
+
{% endfor %}
|
|
560
|
+
{% for nr, names in enumerate(rm_TH.boundaries.thermal.cooling.bc.names) %}
|
|
561
|
+
{% if dm.magnet.solve.thermal.He_cooling.enabled and nr == 0 %}
|
|
453
562
|
general_cooling = Region[ {<<names|join(', ')>>} ];
|
|
454
|
-
|
|
563
|
+
{% else %}
|
|
455
564
|
<<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.cooling)[nr - 1 if dm.magnet.solve.thermal.He_cooling.enabled else nr]>> = Region[ {<<names|join(', ')>>} ];
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
565
|
+
{% endif %}
|
|
566
|
+
{% endfor %}
|
|
459
567
|
Bnds_dirichlet = Region[ {<<dm.magnet.solve.thermal.overwrite_boundary_conditions.temperature|join(', ')>>} ];
|
|
460
568
|
Bnds_neumann = Region[ {} ];
|
|
461
|
-
|
|
569
|
+
{% if dm.magnet.solve.thermal.He_cooling.sides != 'external' %}
|
|
462
570
|
Bnds_neumann += Region[ general_adiabatic ];
|
|
463
|
-
|
|
464
|
-
|
|
571
|
+
{% endif %}
|
|
572
|
+
{% if dm.magnet.solve.thermal.overwrite_boundary_conditions.heat_flux %}
|
|
465
573
|
Bnds_neumann += Region[ {<<dm.magnet.solve.thermal.overwrite_boundary_conditions.heat_flux|join(', ')>>} ];
|
|
466
|
-
|
|
467
|
-
|
|
574
|
+
{% endif %}
|
|
575
|
+
|
|
468
576
|
Bnds_robin = Region[ {} ];
|
|
469
|
-
|
|
577
|
+
{% if dm.magnet.solve.thermal.He_cooling.enabled %}
|
|
470
578
|
Bnds_robin += Region[ general_cooling ];
|
|
471
|
-
|
|
472
|
-
|
|
579
|
+
{% endif %}
|
|
580
|
+
{% if dm.magnet.solve.thermal.overwrite_boundary_conditions.cooling %}
|
|
473
581
|
Bnds_robin += Region[ {<<dm.magnet.solve.thermal.overwrite_boundary_conditions.cooling|join(', ')>>} ];
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
{% endif %}
|
|
479
|
-
|
|
480
|
-
{% if dm.magnet.solve.electromagnetics.solve_type %}
|
|
582
|
+
{% endif %}
|
|
583
|
+
Bnds_support = Region[ {Bnds_neumann, Bnds_robin{% if dm.magnet.solve.thermal.collar_cooling.enabled %}, bndCollarGaps{% endif %}} ];
|
|
584
|
+
{% endif %}
|
|
481
585
|
<<rm_TH.projection_points.name>> = Region[ <<rm_TH.projection_points.number>> ];
|
|
482
|
-
|
|
586
|
+
<<cc_macros2.generate_polarity_groups_TH(dm,aux,rm_EM,rm_TH)>>
|
|
587
|
+
{% endif %}
|
|
483
588
|
|
|
484
|
-
{%
|
|
589
|
+
{% if dm.circuit.field_circuit %}
|
|
590
|
+
// Power supply & Circuit Regions
|
|
591
|
+
{% set flag_active = ({}) %}
|
|
592
|
+
{% set regions_CC = ({}) %}
|
|
593
|
+
{% set CLIQ_dict= {"Units": 0,"groups": [], "leads": [], "Comp":[] } %}
|
|
594
|
+
{% set ECLIQ_dict={"Units": 0,"groups": [], "leads": [], "Comp":[] } %}
|
|
595
|
+
{% set ESC_dict= {"Units": 0 ,"groups": [], "leads": [], "Comp":[] } %}
|
|
596
|
+
{% set init_ht = 0 %}
|
|
597
|
+
{% set end_ht = len(dm.magnet.solve.coil_windings.electrical_pairs.overwrite_electrical_order)%}
|
|
598
|
+
{% set flag_R = 0 -%}
|
|
599
|
+
{% set CC_dict = [] %}
|
|
600
|
+
<<cc_macros2.regions_FCC(dm,rm_EM,flag_active,regions_CC,end_ht,CLIQ_dict,ECLIQ_dict,ESC_dict,CC_dict,aux)>>
|
|
601
|
+
<<cc_macros2.groups_FCC(dm,rm_EM, flag_active,CLIQ_dict,ECLIQ_dict,ESC_dict,CC_dict,aux) >>
|
|
602
|
+
{%if dm.magnet.solve.thermal.solve_type and flag_active['ECLIQ']%}
|
|
603
|
+
Omega_p_TH_r -= Region[Omega_ECLIQ_ht_TH];
|
|
604
|
+
Omega_p_TH_l -= Region[Omega_ECLIQ_ht_TH];
|
|
605
|
+
{% endif %}
|
|
606
|
+
{% endif %}
|
|
607
|
+
{%if dm.magnet.solve.thermal.solve_type and dm.quench_protection.quench_heaters.N_strips >0 and dm.quench_protection.quench_heaters.quench_propagation == '2Dx1D'%}
|
|
608
|
+
QH_HT_EM = Region[{<<'ht'~dm.quench_protection.quench_heaters.iQH_toHalfTurn_To|join('_EM, ht')~'_EM'>>}];
|
|
609
|
+
noQH_HT_EM = Region[<<nc.omega>><<nc.powered>>_EM];
|
|
610
|
+
noQH_HT_EM -= Region[QH_HT_EM];
|
|
611
|
+
QH_HT_TH = Region[{<<'ht'~dm.quench_protection.quench_heaters.iQH_toHalfTurn_To|join('_TH, ht')~'_TH'>>}];
|
|
612
|
+
noQH_HT_TH = Region[<<nc.omega>><<nc.powered>>_TH];
|
|
613
|
+
noQH_HT_TH -= Region[QH_HT_TH];
|
|
614
|
+
{% for i in aux.half_turns.ht.keys() %}
|
|
615
|
+
{% set QH_half_turns_in_block_EM = [] %}
|
|
616
|
+
{% set QH_half_turns_in_block_TH = [] %}
|
|
617
|
+
{% for ht in aux.half_turns.ht[i] %}
|
|
618
|
+
{% if ht in dm.quench_protection.quench_heaters.iQH_toHalfTurn_To %}
|
|
619
|
+
{% set _ = QH_half_turns_in_block_EM.append('ht' ~ ht ~ '_EM') %}
|
|
620
|
+
{% set _ = QH_half_turns_in_block_TH.append('ht' ~ ht ~ '_TH') %}
|
|
621
|
+
{% endif %}
|
|
622
|
+
{% endfor %}
|
|
623
|
+
{% set ht_names_EM = [] %}
|
|
624
|
+
{% set ht_names_TH = [] %}
|
|
625
|
+
{% for ht in aux.half_turns.ht[i] %}
|
|
626
|
+
{% set _ = ht_names_EM.append('ht' ~ ht ~ '_EM') %}
|
|
627
|
+
{% set _ = ht_names_TH.append('ht' ~ ht ~ '_TH') %}
|
|
628
|
+
{% endfor %}
|
|
629
|
+
Omega_Block_<<i>>_EM = Region[ { << ht_names_EM|join(', ') >> } ];
|
|
630
|
+
Omega_Block_<<i>>_TH = Region[ { << ht_names_TH|join(', ') >> } ];
|
|
631
|
+
{% if QH_half_turns_in_block_EM %}
|
|
632
|
+
Omega_QH_<<i>>_EM = Region[ { << QH_half_turns_in_block_EM|join(', ') >> } ];
|
|
633
|
+
{% endif %}
|
|
634
|
+
{% if QH_half_turns_in_block_TH %}
|
|
635
|
+
Omega_QH_<<i>>_TH = Region[ { << QH_half_turns_in_block_TH|join(', ') >> } ];
|
|
636
|
+
{% endif %}
|
|
637
|
+
{% endfor %}
|
|
638
|
+
{% endif %}
|
|
639
|
+
{%if dm.magnet.solve.thermal.solve_type and dm.quench_protection.e_cliq.quench_propagation == '2Dx1D'%}
|
|
640
|
+
ECLIQ_HT_EM = Region[{<<'ht'~dm.quench_protection.e_cliq.iECLIQ_toHalfTurn_To|join('_EM, ht')~'_EM'>>}];
|
|
641
|
+
noECLIQ_HT_EM = Region[<<nc.omega>><<nc.powered>>_EM];
|
|
642
|
+
noECLIQ_HT_EM -= Region[ECLIQ_HT_EM];
|
|
643
|
+
ECLIQ_HT_TH = Region[{<<'ht'~dm.quench_protection.e_cliq.iECLIQ_toHalfTurn_To|join('_TH, ht')~'_TH'>>}];
|
|
644
|
+
noECLIQ_HT_TH = Region[<<nc.omega>><<nc.powered>>_TH];
|
|
645
|
+
noECLIQ_HT_TH -= Region[ECLIQ_HT_TH];
|
|
646
|
+
{% for i in aux.half_turns.ht.keys() %}
|
|
647
|
+
{% set ECLIQ_half_turns_in_block_EM = [] %}
|
|
648
|
+
{% set ECLIQ_half_turns_in_block_TH = [] %}
|
|
649
|
+
{% for ht in aux.half_turns.ht[i] %}
|
|
650
|
+
{% if ht in dm.quench_protection.e_cliq.iECLIQ_toHalfTurn_To %}
|
|
651
|
+
{% set _ = ECLIQ_half_turns_in_block_EM.append('ht' ~ ht ~ '_EM') %}
|
|
652
|
+
{% set _ = ECLIQ_half_turns_in_block_TH.append('ht' ~ ht ~ '_TH') %}
|
|
653
|
+
{% endif %}
|
|
654
|
+
{% endfor %}
|
|
655
|
+
{% set ht_names_EM = [] %}
|
|
656
|
+
{% set ht_names_TH = [] %}
|
|
657
|
+
{% for ht in aux.half_turns.ht[i] %}
|
|
658
|
+
{% set _ = ht_names_EM.append('ht' ~ ht ~ '_EM') %}
|
|
659
|
+
{% set _ = ht_names_TH.append('ht' ~ ht ~ '_TH') %}
|
|
660
|
+
{% endfor %}
|
|
661
|
+
Omega_Block_<<i>>_EM = Region[ { << ht_names_EM|join(', ') >> } ];
|
|
662
|
+
Omega_Block_<<i>>_TH = Region[ { << ht_names_TH|join(', ') >> } ];
|
|
663
|
+
{% if ECLIQ_half_turns_in_block_EM %}
|
|
664
|
+
Omega_ECLIQ_<<i>>_EM = Region[ { << ECLIQ_half_turns_in_block_EM|join(', ') >> } ];
|
|
665
|
+
{% endif %}
|
|
666
|
+
{% if ECLIQ_half_turns_in_block_TH %}
|
|
667
|
+
Omega_ECLIQ_<<i>>_TH = Region[ { << ECLIQ_half_turns_in_block_TH|join(', ') >> } ];
|
|
668
|
+
{% endif %}
|
|
669
|
+
{% endfor %}
|
|
670
|
+
{% endif %}
|
|
485
671
|
}
|
|
486
672
|
|
|
487
673
|
Function {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
674
|
+
//------------------------ EM ------------------------------------------------
|
|
675
|
+
// TODO: Hardcoded, change to mat func.
|
|
676
|
+
mu0 = 4 * Pi * 1E-7;
|
|
677
|
+
nuBH_air[] = 1/mu0;
|
|
678
|
+
dnuBH_air[] = 0;
|
|
679
|
+
nuAl[] = 1/1256e-9;
|
|
680
|
+
dnuAl[] = 0;
|
|
681
|
+
nu [ Region[{<<rm_EM.air.vol.name>>, <<nc.omega>><<nc.powered>>_EM, <<rm_EM.air_far_field.vol.names[0]>>{% if dm.magnet.geometry.electromagnetics.with_wedges %}, <<nc.omega>><<nc.induced>>_EM{% endif %}}] ] = 1. / mu0;
|
|
682
|
+
|
|
683
|
+
{% for area in areas_to_build['EM'] %}
|
|
684
|
+
{% for name in rm_EM[area].vol.names %}
|
|
685
|
+
nu [ <<nc.omega>><<nc[area]>>_EM ] = nu<<name>>[$1];
|
|
686
|
+
dnu_db [ <<nc.omega>><<nc[area]>>_EM ] = dnu<<name>>[$1];
|
|
687
|
+
{% endfor %}
|
|
688
|
+
{% endfor %}
|
|
689
|
+
// Stranded conductor
|
|
690
|
+
Ns=<<len(rm_EM.powered['r1_a1'].vol.names + rm_EM.powered['r1_a2'].vol.names + rm_EM.powered['r2_a1'].vol.names + rm_EM.powered['r2_a2'].vol.names)>>/10000;
|
|
691
|
+
pre_eddy[]=$Time <= {% if SIM_MODE == 'Th_Mag_sta'%} <<dm.magnet.solve.thermal.time_stepping.initial_time>>{% elif SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %} <<dm.magnet.solve.time_stepping.initial_time>>{% else %}<<dm.magnet.solve.electromagnetics.time_stepping.initial_time>>{% endif %}?0:1;
|
|
692
|
+
|
|
693
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
694
|
+
// Correction factors for the thin shells collar
|
|
695
|
+
{% for nr, factor in enumerate(rm_TH.thin_shells.insulation_types.correction_factors + rm_TH.thin_shells.quench_heaters.correction_factors + rm_TH.thin_shells.collar.correction_factors + rm_TH.thin_shells.poles.correction_factors) %}
|
|
696
|
+
TSA_new_correction_1_<<nr+1>> = <<factor>>; // for shells in azimuthal direction
|
|
697
|
+
TSA_new_correction_2_<<nr+1>> = <<factor>>;
|
|
698
|
+
{% endfor %}
|
|
699
|
+
{% endif %}
|
|
492
700
|
|
|
493
|
-
{% if dm.magnet.
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
701
|
+
{% if dm.magnet.solve.thermal.collar_cooling.enabled %}
|
|
702
|
+
T_ref = <<rm_TH.boundaries.thermal.collar.bc.values[1]>>;
|
|
703
|
+
{% if isinstance(rm_TH.boundaries.thermal.collar.bc.values[0], str) %}
|
|
704
|
+
col_heatExchCoeff[] = <<rm_TH.boundaries.thermal.collar.bc.values[0]>>[$1, $2];
|
|
705
|
+
{% else %}
|
|
706
|
+
col_heatExchCoeff[] = <<rm_TH.boundaries.thermal.collar.bc.values[0]>>;
|
|
707
|
+
{% endif %}
|
|
498
708
|
{% endif %}
|
|
499
709
|
|
|
710
|
+
// Area fct for 2D
|
|
500
711
|
{% for name, current, number in zip(rm_EM.powered['r1_a1'].vol.names + rm_EM.powered['r1_a2'].vol.names + rm_EM.powered['r2_a1'].vol.names + rm_EM.powered['r2_a2'].vol.names,
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
{% endfor %}
|
|
506
|
-
|
|
507
|
-
{% endif %}
|
|
508
|
-
|
|
509
|
-
{% if dm.magnet.solve.thermal.solve_type %}
|
|
510
|
-
|
|
511
|
-
{% for name, number in zip(rm_TH.powered['r1_a1'].vol.names + rm_TH.powered['r1_a2'].vol.names + rm_TH.powered['r2_a1'].vol.names + rm_TH.powered['r2_a2'].vol.names,
|
|
512
|
-
rm_TH.powered['r1_a1'].vol.numbers + rm_TH.powered['r1_a2'].vol.numbers + rm_TH.powered['r2_a1'].vol.numbers + rm_TH.powered['r2_a2'].vol.numbers
|
|
513
|
-
) %}
|
|
514
|
-
area_fct[ <<name>> ] = SurfaceArea[]{ <<number>> };
|
|
515
|
-
{% endfor %}
|
|
516
|
-
|
|
517
|
-
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
518
|
-
{% for nr, tags in enumerate(rm_TH.boundaries.thermal.temperature.bc.numbers) %}
|
|
519
|
-
bnd_dirichlet_<<nr + 1>>() = {<<tags|join(', ')>>};
|
|
520
|
-
val_temperature_<<nr + 1>> = <<rm_TH.boundaries.thermal.temperature.bc.value[nr]>>;
|
|
521
|
-
{% endfor %}
|
|
522
|
-
num_dirichlet = <<len(rm_TH.boundaries.thermal.temperature.bc.numbers)>>; // number of different dirichlet boundary cond.
|
|
523
|
-
|
|
524
|
-
{% for nr, tags in enumerate(rm_TH.boundaries.thermal.heat_flux.bc.numbers) %}
|
|
525
|
-
bnd_neumann_<<nr + 1>>() = {<<tags|join(', ')>>};
|
|
526
|
-
val_heatFlux_<<nr + 1>> = <<rm_TH.boundaries.thermal.heat_flux.bc.value[nr]>>;
|
|
712
|
+
rm_EM.powered['r1_a1'].vol.currents + rm_EM.powered['r1_a2'].vol.currents + rm_EM.powered['r2_a1'].vol.currents + rm_EM.powered['r2_a2'].vol.currents,
|
|
713
|
+
rm_EM.powered['r1_a1'].vol.numbers + rm_EM.powered['r1_a2'].vol.numbers + rm_EM.powered['r2_a1'].vol.numbers + rm_EM.powered['r2_a2'].vol.numbers
|
|
714
|
+
) %}
|
|
715
|
+
area_fct[ <<name>> ] = SurfaceArea[]{ <<number>> };
|
|
527
716
|
{% endfor %}
|
|
528
|
-
num_neumann = <<len(rm_TH.boundaries.thermal.heat_flux.bc.numbers)>>; // number of different neumann boundary cond.
|
|
529
717
|
|
|
530
|
-
{%
|
|
531
|
-
|
|
532
|
-
{%
|
|
533
|
-
|
|
718
|
+
{% if dm.circuit.field_circuit%}
|
|
719
|
+
<<cc_macros2.function_FCC(nc,dm,rm_EM, flag_active,CLIQ_dict,ECLIQ_dict,ESC_dict,CC_dict,aux)>>
|
|
720
|
+
{% endif %}
|
|
721
|
+
// Generate the sign function to impose polarity of current going through the half-turns
|
|
722
|
+
{% set polarities = dm.magnet.solve.coil_windings.polarities_in_group %}
|
|
723
|
+
{% if len(polarities)>0 %}
|
|
724
|
+
{% for i in range(polarities | length) %}
|
|
725
|
+
{% set polarity = polarities[i] %}
|
|
726
|
+
{% set half_turns = aux.half_turns.ht[i+1] %}
|
|
727
|
+
{% for half_turn in half_turns %}
|
|
728
|
+
sign_fct[<<'ht' ~ half_turn ~ '_EM'>> ] = <<polarity>>;
|
|
729
|
+
{% endfor %}
|
|
730
|
+
{% endfor %}
|
|
534
731
|
{% else %}
|
|
535
|
-
|
|
732
|
+
{% for name, current, number in zip(rm_EM.powered['r1_a1'].vol.names + rm_EM.powered['r1_a2'].vol.names + rm_EM.powered['r2_a1'].vol.names + rm_EM.powered['r2_a2'].vol.names,
|
|
733
|
+
rm_EM.powered['r1_a1'].vol.currents + rm_EM.powered['r1_a2'].vol.currents + rm_EM.powered['r2_a1'].vol.currents + rm_EM.powered['r2_a2'].vol.currents,
|
|
734
|
+
rm_EM.powered['r1_a1'].vol.numbers + rm_EM.powered['r1_a2'].vol.numbers + rm_EM.powered['r2_a1'].vol.numbers + rm_EM.powered['r2_a2'].vol.numbers
|
|
735
|
+
) %}
|
|
736
|
+
sign_fct[ <<name>> ] = Sign[<<current>>];
|
|
737
|
+
{% endfor %}
|
|
536
738
|
{% endif %}
|
|
537
|
-
|
|
538
|
-
{
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
739
|
+
{% if not dm.circuit.field_circuit%}
|
|
740
|
+
i_fct[] =InterpolationLinear[$Time]{List[{
|
|
741
|
+
{%- for t, i in zip(dm.power_supply.t_control_LUT, dm.power_supply.I_control_LUT) -%}
|
|
742
|
+
<< t >>, << i >>{% if not loop.last %}, {% endif %}
|
|
743
|
+
{%- endfor -%}
|
|
744
|
+
}]};
|
|
745
|
+
{% endif %}
|
|
746
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
747
|
+
//------------------------ TH ------------------------------------------------
|
|
748
|
+
// 2D Areas in TH
|
|
749
|
+
{% for name, number in zip(rm_TH.powered['r1_a1'].vol.names + rm_TH.powered['r1_a2'].vol.names + rm_TH.powered['r2_a1'].vol.names + rm_TH.powered['r2_a2'].vol.names,
|
|
750
|
+
rm_TH.powered['r1_a1'].vol.numbers + rm_TH.powered['r1_a2'].vol.numbers + rm_TH.powered['r2_a1'].vol.numbers + rm_TH.powered['r2_a2'].vol.numbers
|
|
751
|
+
) %}
|
|
752
|
+
area_fct[ <<name>> ] = SurfaceArea[]{ <<number>> };
|
|
753
|
+
{% endfor %}
|
|
754
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
755
|
+
{% for name, number in zip(rm_TH.induced['r1_a1'].vol.names + rm_TH.induced['r1_a2'].vol.names + rm_TH.induced['r2_a1'].vol.names + rm_TH.induced['r2_a2'].vol.names, rm_TH.induced['r1_a1'].vol.numbers + rm_TH.induced['r1_a2'].vol.numbers + rm_TH.induced['r2_a1'].vol.numbers + rm_TH.induced['r2_a2'].vol.numbers) %}
|
|
756
|
+
area_fct[ <<name>> ] = SurfaceArea[]{ <<number>> };
|
|
757
|
+
{% endfor %}
|
|
758
|
+
{% endif %}
|
|
759
|
+
|
|
760
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
761
|
+
//Piecewise Temp function for coupled sim
|
|
762
|
+
{% if dm.magnet.geometry.electromagnetics.with_wedges%}
|
|
763
|
+
{% set T_regions = rm_EM.powered['r1_a1'].vol.numbers + rm_EM.powered['r2_a1'].vol.numbers + rm_EM.powered['r1_a2'].vol.numbers + rm_EM.powered['r2_a2'].vol.numbers + rm_EM.induced['r1_a1'].vol.numbers + rm_EM.induced['r2_a1'].vol.numbers + rm_EM.induced['r1_a2'].vol.numbers + rm_EM.induced['r2_a2'].vol.numbers %}
|
|
764
|
+
{% else %}
|
|
765
|
+
{% set T_regions =rm_EM.powered['r1_a1'].vol.numbers + rm_EM.powered['r2_a1'].vol.numbers + rm_EM.powered['r1_a2'].vol.numbers + rm_EM.powered['r2_a2'].vol.numbers %}
|
|
766
|
+
{% endif %}
|
|
767
|
+
// Temperature function per Half-turn for EM
|
|
768
|
+
{% for idx, phy_elem in enumerate(T_regions) %}
|
|
769
|
+
T_EM_fct[Region[<<phy_elem>>]] = $T_a_<<idx>>;
|
|
770
|
+
{% endfor %}
|
|
771
|
+
// Current function per Half-turn for TH (will need to be revised for DISCC)
|
|
772
|
+
I2TH_fct[Region[<<nc.omega>><<nc.powered>>_TH_r]] = Abs[CompZ[$I2TH_1]];
|
|
773
|
+
I2TH_fct[Region[<<nc.omega>><<nc.powered>>_TH_l]] = Abs[CompZ[$I2TH_2]];
|
|
774
|
+
{% for i,ht in enumerate(aux.half_turns.ADD_COILS) %}
|
|
775
|
+
I2TH_fct[Region[<<'ht'~ht~'_TH'>>]]= Abs[CompZ[$I2TH_<<i+3>>]] ;
|
|
562
776
|
{% endfor %}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
{%
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
777
|
+
{% else %}
|
|
778
|
+
I2TH_fct[Region[<<nc.omega>><<nc.powered>>_TH_r]] = <<dm.power_supply.I_control_LUT[0]>>;
|
|
779
|
+
I2TH_fct[Region[<<nc.omega>><<nc.powered>>_TH_l]] = <<dm.power_supply.I_control_LUT[0]>>;
|
|
780
|
+
{% endif %}
|
|
781
|
+
{% endif %}
|
|
782
|
+
// --------------- MATERIAL FUNCTIONS ----------------------------------------
|
|
783
|
+
{% set resistivityMacroName = {'Cu': 'MATERIAL_Resistivity_Copper_T_B',
|
|
784
|
+
'CFUN_rhoCu_NIST': 'MATERIAL_Resistivity_Copper_T_B',
|
|
785
|
+
'Ag': 'MATERIAL_Resistivity_Silver_T_B',
|
|
786
|
+
'SS': 'MATERIAL_Resistivity_SSteel_T',
|
|
787
|
+
'BHiron8': 'MATERIAL_Resistivity_SSteel_T',
|
|
788
|
+
'Al': 'MATERIAL_Resistivity_Aluminum_T'
|
|
789
|
+
} -%}
|
|
790
|
+
{% set criticalCurrentDensityMacroName = {'Nb-Ti_CUDI1': 'MATERIAL_CriticalCurrentDensity_NiobiumTitanium_CUDI1_T_B',
|
|
791
|
+
'Nb3Sn_Summers': 'MATERIAL_CriticalCurrentDensity_Niobium3Tin_Summers_T_B',
|
|
792
|
+
'Nb3Sn_Bordini': 'MATERIAL_CriticalCurrentDensity_Niobium3Tin_Bordini_T_B',
|
|
793
|
+
'BSCCO2212': 'MATERIAL_CriticalCurrentDensity_BSCCO2212_BSCCO_2212_LBNL_T_B'} %}
|
|
794
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
795
|
+
{% set thermalConductivityMacroName = {'Cu': 'MATERIAL_ThermalConductivity_Copper_T_B',
|
|
796
|
+
'CFUN_kCu_NIST': 'MATERIAL_ThermalConductivity_Copper_T_B',
|
|
581
797
|
'Ag': 'MATERIAL_ThermalConductivity_Silver_T', 'SS': 'MATERIAL_ThermalConductivity_SSteel_T',
|
|
582
|
-
'
|
|
583
|
-
|
|
584
|
-
'
|
|
585
|
-
|
|
798
|
+
'BHiron8': 'MATERIAL_ThermalConductivity_SSteel_T',
|
|
799
|
+
'kapton': 'MATERIAL_ThermalConductivity_Kapton_T', 'G10': 'MATERIAL_ThermalConductivity_G10_T',
|
|
800
|
+
'Al': 'MATERIAL_ThermalConductivity_Aluminum_T', 'BHiron2': 'MATERIAL_ThermalConductivity_BHiron2_T'} %}
|
|
801
|
+
{% set specificHeatCapacityMacroName = {'Cu': 'MATERIAL_SpecificHeatCapacity_Copper_T',
|
|
802
|
+
'CFUN_CvCu_NIST': 'MATERIAL_SpecificHeatCapacity_Copper_T',
|
|
803
|
+
'Ag': 'MATERIAL_SpecificHeatCapacity_Silver_T',
|
|
804
|
+
'SS': 'MATERIAL_SpecificHeatCapacity_SSteel_T',
|
|
805
|
+
'BHiron8': 'MATERIAL_SpecificHeatCapacity_SSteel_T',
|
|
806
|
+
'Nb-Ti': 'MATERIAL_SpecificHeatCapacity_NiobiumTitanium_T_B_I',
|
|
807
|
+
'Nb3Sn': 'MATERIAL_SpecificHeatCapacity_Niobium3Tin_T_B',
|
|
586
808
|
'BSCCO2212': 'MATERIAL_SpecificHeatCapacity_BSCCO2212_T',
|
|
587
809
|
'kapton': 'MATERIAL_SpecificHeatCapacity_Kapton_T', 'G10': 'MATERIAL_SpecificHeatCapacity_G10_T',
|
|
588
|
-
'helium': 'MATERIAL_SpecificHeatCapacity_Helium_T'
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
'
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
f_inner_voids_<<name>> = <<cond.cable.f_inner_voids>>;
|
|
605
|
-
f_outer_voids_<<name>> = <<cond.cable.f_outer_voids>>;
|
|
606
|
-
f_strand_<<name>> = 1.0 - (<<cond.cable.f_inner_voids>> + <<cond.cable.f_outer_voids>>);
|
|
607
|
-
{% else %}
|
|
608
|
-
{% if cond.strand.type == 'Round' %}
|
|
609
|
-
{% set n_strands = cond.cable.n_strands %}
|
|
610
|
-
{% set A_Strand = cond.cable.n_strands * Pi/4.0 * cond.strand.diameter**2 %}
|
|
611
|
-
{% elif cond.strand.type == 'Rectangular' %}
|
|
612
|
-
{% set n_strands = cond.cable.n_strands if cond.cable.type == 'Rutherford' else 1 %}
|
|
613
|
-
{% set A_Strand = n_strands * cond.strand.bare_width * cond.strand.bare_height %}
|
|
810
|
+
'helium': 'MATERIAL_SpecificHeatCapacity_Helium_T',
|
|
811
|
+
'Al': 'MATERIAL_SpecificHeatCapacity_Aluminum_T', 'BHiron2': 'MATERIAL_SpecificHeatCapacity_BHiron2_T'} %}
|
|
812
|
+
{% set QuenchPropVelMacroName = {'Nb-Ti': 'MATERIAL_QuenchProp_NbTi',
|
|
813
|
+
'Nb3Sn': 'MATERIAL_QuenchProp_Nb3Sn'} %}
|
|
814
|
+
|
|
815
|
+
{% set thermalConductivityTSAStiffnessMacroName = {'Cu': 'MATERIAL_ThermalConductivity_Copper_TSAStiffness_T_k_l', 'SS': 'MATERIAL_ThermalConductivity_SSteel_TSAStiffness_T_k_l','BHiron8': 'MATERIAL_ThermalConductivity_SSteel_TSAStiffness_T_k_l',
|
|
816
|
+
'kapton': 'MATERIAL_ThermalConductivity_Kapton_TSAStiffness_T_k_l', 'G10': 'MATERIAL_ThermalConductivity_G10_TSAStiffness_T_k_l',
|
|
817
|
+
'stycast': 'MATERIAL_ThermalConductivity_Stycast_TSAStiffness_T_k_l'} %}
|
|
818
|
+
|
|
819
|
+
{% set thermalConductivityTSAMassMacroName = {'Cu': 'MATERIAL_ThermalConductivity_Copper_TSAMass_T_k_l', 'SS': 'MATERIAL_ThermalConductivity_SSteel_TSAMass_T_k_l', 'BHiron8': 'MATERIAL_ThermalConductivity_SSteel_TSAMass_T_k_l',
|
|
820
|
+
'kapton': 'MATERIAL_ThermalConductivity_Kapton_TSAMass_T_k_l', 'G10': 'MATERIAL_ThermalConductivity_G10_TSAMass_T_k_l',
|
|
821
|
+
'stycast': 'MATERIAL_ThermalConductivity_Stycast_TSAMass_T_k_l'} %}
|
|
822
|
+
|
|
823
|
+
{% set specificHeatCapacityTSAMacroName = {'Cu': 'MATERIAL_SpecificHeatCapacity_Copper_TSAMass_T_k_l', 'SS': 'MATERIAL_SpecificHeatCapacity_SSteel_TSAMass_T_k_l','BHiron8': 'MATERIAL_SpecificHeatCapacity_SSteel_TSAMass_T_k_l',
|
|
824
|
+
'kapton': 'MATERIAL_SpecificHeatCapacity_Kapton_TSAMass_T_k_l', 'G10': 'MATERIAL_SpecificHeatCapacity_G10_TSAMass_T_k_l',
|
|
825
|
+
'stycast': 'MATERIAL_SpecificHeatCapacity_Stycast_TSAMass_T_k_l'} %}
|
|
614
826
|
{% endif %}
|
|
615
|
-
{%
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
827
|
+
{% for name, cond in dm.conductors.items() %}
|
|
828
|
+
{% if cond.cable.f_inner_voids and cond.cable.f_outer_voids %}
|
|
829
|
+
f_inner_voids_<<name>> = <<cond.cable.f_inner_voids>>;
|
|
830
|
+
f_outer_voids_<<name>> = <<cond.cable.f_outer_voids>>;
|
|
831
|
+
f_strand_<<name>> = 1.0 - (<<cond.cable.f_inner_voids>> + <<cond.cable.f_outer_voids>>);
|
|
832
|
+
{% else %}
|
|
833
|
+
{% if cond.strand.type == 'Round' %}
|
|
834
|
+
{% set n_strands = cond.cable.n_strands %}
|
|
835
|
+
{% set A_Strand = cond.cable.n_strands * Pi/4.0 * cond.strand.diameter**2 %}
|
|
836
|
+
{% elif cond.strand.type == 'Rectangular' %}
|
|
837
|
+
{% set n_strands = cond.cable.n_strands if cond.cable.type == 'Rutherford' else 1 %}
|
|
838
|
+
{% set A_Strand = n_strands * cond.strand.bare_width * cond.strand.bare_height %}
|
|
839
|
+
{% endif %}
|
|
840
|
+
{% set A_cable = cond.cable.bare_cable_width * cond.cable.bare_cable_height_mean %}
|
|
841
|
+
|
|
842
|
+
{% set f_both_voids = 1.0 - A_Strand / A_cable %}
|
|
843
|
+
{% set f_inner_voids = f_both_voids * (0.5 - 1.0/n_strands) %}
|
|
844
|
+
{% set f_outer_voids = f_both_voids * (0.5 + 1.0/n_strands) %}
|
|
845
|
+
|
|
846
|
+
f_inner_voids_<<name>> = <<f_inner_voids>>;
|
|
847
|
+
f_outer_voids_<<name>> = <<f_outer_voids>>;
|
|
848
|
+
f_strand_<<name>> = 1.0 - <<f_both_voids>>;
|
|
849
|
+
{% endif %}
|
|
620
850
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
{% endif %}
|
|
851
|
+
f_stabilizer_<<name>> = f_strand_<<name>> * <<cond.strand.Cu_noCu_in_strand>> / (1. + <<cond.strand.Cu_noCu_in_strand>>);
|
|
852
|
+
f_sc_<<name>> = f_strand_<<name>> * (1.0 - <<cond.strand.Cu_noCu_in_strand>> / (1. + <<cond.strand.Cu_noCu_in_strand>>));
|
|
853
|
+
{% endfor %}
|
|
625
854
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
855
|
+
{% set current_cond = namespace(conductor={}) %}
|
|
856
|
+
{% for name, cond in dm.conductors.items() %}
|
|
857
|
+
<<criticalCurrentDensity("jcNonZero_" + name, cond, time_trigger=1e6, cond_name=name)>>
|
|
858
|
+
{% endfor %}
|
|
859
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
860
|
+
{% for turn, t_trigger in zip(dm.magnet.solve.thermal.jc_degradation_to_zero.turns, dm.magnet.solve.thermal.jc_degradation_to_zero.t_trigger) %}
|
|
861
|
+
{% for name, cond in dm.conductors.items() %}
|
|
862
|
+
{% if 'ht' + str(turn) + '_TH' in jcZero_ht[name] %}
|
|
863
|
+
{% set current_cond.conductor = cond %}
|
|
864
|
+
{% set current_cond.name = name %}
|
|
865
|
+
{% endif %}
|
|
866
|
+
{% endfor %}
|
|
867
|
+
<<criticalCurrentDensity("jcZero_ht" + str(turn), cond=current_cond.conductor, time_trigger=t_trigger, cond_name=current_cond.name)>>
|
|
868
|
+
{% endfor %}
|
|
869
|
+
{% endif %}
|
|
870
|
+
TestQuench[] = CFUN_quenchState_I_Ic[$3,criticalCurrentDensity[$1, $2] * area_fct[]];
|
|
871
|
+
|
|
872
|
+
// Resistivity of the strands
|
|
873
|
+
// -$1: Temperature [K]
|
|
874
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
875
|
+
{% if SIM_MODE == Mag_dyn or SIM_MODE == Mag_dyn_0 or SIM_MODE == Mag_sta%}
|
|
876
|
+
{% set T_sim = dm.magnet.solve.electromagnetics.time_stepping.T_sim %}
|
|
877
|
+
{% else %}
|
|
878
|
+
{% set T_sim = "$1" %}
|
|
879
|
+
{% endif %}
|
|
880
|
+
{% for name, cond in dm.conductors.items() %}
|
|
881
|
+
rho[<<nc.omega>><<nc.powered>>_<<name>>_EM] = EffectiveResistivity[<<materials[resistivityMacroName[cond.strand.rho_material_stabilizer]](RRR=cond.strand.RRR,T=T_sim)>>]{f_stabilizer_<<name>>};
|
|
882
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
883
|
+
rho[<<nc.omega>><<nc.powered>>_<<name>>_TH] = EffectiveResistivity[<<materials[resistivityMacroName[cond.strand.rho_material_stabilizer]](RRR=cond.strand.RRR)>>]{f_stabilizer_<<name>>};
|
|
884
|
+
{% endif %}
|
|
885
|
+
{% endfor %}
|
|
886
|
+
{% if dm.magnet.geometry.electromagnetics.with_wedges %}
|
|
887
|
+
// Resistivity of the wedges
|
|
888
|
+
rho[<<nc.omega>><<nc.induced>>_EM] = <<materials[resistivityMacroName[dm.magnet.solve.wedges.material]](RRR=dm.magnet.solve.wedges.RRR,T=T_sim)>>;
|
|
889
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
890
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
891
|
+
rho[<<nc.omega>><<nc.induced>>_TH] = <<materials[resistivityMacroName[dm.magnet.solve.wedges.material]](RRR=dm.magnet.solve.wedges.RRR)>>;
|
|
892
|
+
{% endif %}
|
|
893
|
+
{% endif %}
|
|
894
|
+
{% endif %}
|
|
895
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
896
|
+
|
|
897
|
+
// AUX FUNCTIONS
|
|
898
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
899
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
900
|
+
// --------------------- TSA BC FUNCTIONS & CONST. --------------------------------
|
|
901
|
+
{% for nr, tags in enumerate(rm_TH.boundaries.thermal.temperature.bc.numbers) %}
|
|
902
|
+
bnd_dirichlet_<<nr + 1>>() = {<<tags|join(', ')>>};
|
|
903
|
+
val_temperature_<<nr + 1>> = <<rm_TH.boundaries.thermal.temperature.bc.value[nr]>>;
|
|
904
|
+
{% endfor %}
|
|
905
|
+
num_dirichlet = <<len(rm_TH.boundaries.thermal.temperature.bc.numbers)>>; // number of different dirichlet boundary cond.
|
|
629
906
|
|
|
630
|
-
|
|
907
|
+
{% for nr, tags in enumerate(rm_TH.boundaries.thermal.heat_flux.bc.numbers) %}
|
|
908
|
+
bnd_neumann_<<nr + 1>>() = {<<tags|join(', ')>>};
|
|
909
|
+
val_heatFlux_<<nr + 1>> = <<rm_TH.boundaries.thermal.heat_flux.bc.value[nr]>>;
|
|
910
|
+
{% endfor %}
|
|
911
|
+
num_neumann = <<len(rm_TH.boundaries.thermal.heat_flux.bc.numbers)>>; // number of different neumann boundary cond.
|
|
912
|
+
|
|
913
|
+
{% for nr, tags in enumerate(rm_TH.boundaries.thermal.cooling.bc.numbers) %}
|
|
914
|
+
bnd_robin_<<nr + 1>>() = {<<tags|join(', ')>>};
|
|
915
|
+
{% if isinstance(rm_TH.boundaries.thermal.cooling.bc.values[nr][0], str) %}
|
|
916
|
+
val_heatExchCoeff_<<nr + 1>>[] = <<rm_TH.boundaries.thermal.cooling.bc.values[nr][0]>>[$1, $2];
|
|
917
|
+
{% else %}
|
|
918
|
+
val_heatExchCoeff_<<nr + 1>>[] = <<rm_TH.boundaries.thermal.cooling.bc.values[nr][0]>>;
|
|
919
|
+
{% endif %}
|
|
920
|
+
val_Tinf_<<nr + 1>> = <<rm_TH.boundaries.thermal.cooling.bc.values[nr][1]>>;
|
|
921
|
+
{% endfor %}
|
|
922
|
+
num_robin = <<len(rm_TH.boundaries.thermal.cooling.bc.numbers)>>; // number of different robin boundary cond.
|
|
923
|
+
{#
|
|
924
|
+
// first idx: 1 layers parallel to radial direction (== normal to phi unit vector)
|
|
925
|
+
// 2 layers parallel to azimuthal direction (== normal to r unit vector)
|
|
926
|
+
// second and third idx: same as bare layers
|
|
927
|
+
// this gives the relation between radius/angle and index 0 to n_ele
|
|
928
|
+
#}
|
|
929
|
+
{% for nr, n_ele in enumerate(rm_TH.thin_shells.insulation_types.layers_number + rm_TH.thin_shells.quench_heaters.layers_number + rm_TH.thin_shells.collar.layers_number + rm_TH.thin_shells.poles.layers_number) %}
|
|
930
|
+
outerElem_1_1_1_<<nr + 1>> = 0;
|
|
931
|
+
outerElem_2_1_1_<<nr + 1>> = 0;
|
|
932
|
+
outerElem_1_2_1_<<nr + 1>> = <<n_ele>>;
|
|
933
|
+
outerElem_2_2_1_<<nr + 1>> = 0;
|
|
934
|
+
outerElem_1_1_2_<<nr + 1>> = 0;
|
|
935
|
+
outerElem_2_1_2_<<nr + 1>> = <<n_ele>>;
|
|
936
|
+
outerElem_1_2_2_<<nr + 1>> = <<n_ele>>;
|
|
937
|
+
outerElem_2_2_2_<<nr + 1>> = <<n_ele>>;
|
|
938
|
+
{% endfor %}
|
|
631
939
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
{% endfor %}
|
|
637
|
-
{% for turn, t_trigger in zip(dm.magnet.solve.thermal.jc_degradation_to_zero.turns, dm.magnet.solve.thermal.jc_degradation_to_zero.t_trigger) %}
|
|
638
|
-
{% for name, cond in dm.conductors.items() %}
|
|
639
|
-
{% if 'ht' + str(turn) + '_TH' in jcZero_ht[name] %}
|
|
640
|
-
{% set current_cond.conductor = cond %}
|
|
641
|
-
{% set current_cond.name = name %}
|
|
940
|
+
{% set no_flip_tags = rm_TH.thin_shells.second_group_is_next['azimuthally'] + rm_TH.thin_shells.second_group_is_next['radially'] %}
|
|
941
|
+
{% set all_dir = bndDir_1 + bndDir_2 %}
|
|
942
|
+
{% set all_neu = bndNeuInt_1_1_1 + bndNeuInt_1_1_2 + bndNeuInt_1_2_1 + bndNeuInt_1_2_2 + bndNeuInt_2_1_1 + bndNeuInt_2_1_2 + bndNeuInt_2_2_1 + bndNeuInt_2_2_2 %}
|
|
943
|
+
{% set all_robin = bndRobinInt_1_1_1 + bndRobinInt_1_1_2 + bndRobinInt_1_2_1 + bndRobinInt_1_2_2 + bndRobinInt_2_1_1 + bndRobinInt_2_1_2 + bndRobinInt_2_2_1 + bndRobinInt_2_2_2 %}
|
|
642
944
|
|
|
945
|
+
{% set flip_tags = list(set(rm_TH.thin_shells.mid_turns_layers_poles + all_neu + all_dir + all_robin + ns.all_QH) - set(no_flip_tags)) %}
|
|
946
|
+
{% endif %}
|
|
643
947
|
{% endif %}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
948
|
+
// Effective thermal conductivity of the bare part
|
|
949
|
+
// -$1: Temperature [K]
|
|
950
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
951
|
+
{% for name, cond in dm.conductors.items() %}
|
|
952
|
+
kappa[<<nc.omega>><<nc.powered>>_<<name>>_TH] = RuleOfMixtures[
|
|
953
|
+
<<materials[thermalConductivityMacroName[cond.strand.k_material_stabilizer]
|
|
954
|
+
](RRR=cond.strand.RRR)>>
|
|
955
|
+
{% if cond.cable.material_inner_voids != 'helium' %}
|
|
956
|
+
, <<materials[thermalConductivityMacroName[cond.cable.material_inner_voids]]()>>
|
|
957
|
+
{% endif %}
|
|
958
|
+
{% if cond.cable.material_outer_voids != 'helium' %}
|
|
959
|
+
, <<materials[thermalConductivityMacroName[cond.cable.material_outer_voids]]()>>
|
|
960
|
+
{% endif %}
|
|
961
|
+
]
|
|
962
|
+
{f_stabilizer_<<name>>
|
|
963
|
+
{% if cond.cable.material_inner_voids != 'helium' %}
|
|
964
|
+
, f_inner_voids_<<name>>
|
|
965
|
+
{% endif %}
|
|
966
|
+
{% if cond.cable.material_outer_voids != 'helium' %}
|
|
967
|
+
, f_outer_voids_<<name>>
|
|
968
|
+
{% endif %}
|
|
969
|
+
};
|
|
970
|
+
{% endfor %}
|
|
651
971
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
972
|
+
// Heat capacity of bare part
|
|
973
|
+
// -$1: Temperature [K]
|
|
974
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
975
|
+
{% for name, cond in dm.conductors.items() %}
|
|
976
|
+
{% if cond.strand.material_superconductor == 'Nb-Ti' %}
|
|
977
|
+
heatCap[<<nc.omega>><<nc.powered>>_<<name>>_TH] = RuleOfMixtures[
|
|
978
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.Cv_material_stabilizer]]()>>,
|
|
979
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.material_superconductor]](C1=cond.Jc_fit.C1_CUDI1, C2=cond.Jc_fit.C2_CUDI1, current="I2TH_fct[]")>>,
|
|
980
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_inner_voids]]()>>,
|
|
981
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_outer_voids]]()>>
|
|
982
|
+
]
|
|
983
|
+
{
|
|
984
|
+
f_stabilizer_<<name>>,
|
|
985
|
+
f_sc_<<name>>,
|
|
986
|
+
f_inner_voids_<<name>>,
|
|
987
|
+
f_outer_voids_<<name>>
|
|
988
|
+
};
|
|
989
|
+
{% else %}
|
|
990
|
+
heatCap[<<nc.omega>><<nc.powered>>_<<name>>_TH] = RuleOfMixtures[
|
|
991
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.Cv_material_stabilizer]]()>>,
|
|
992
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.material_superconductor]]()>>,
|
|
993
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_inner_voids]]()>>,
|
|
994
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_outer_voids]]()>>
|
|
995
|
+
]
|
|
996
|
+
{
|
|
997
|
+
f_stabilizer_<<name>>,
|
|
998
|
+
f_sc_<<name>>,
|
|
999
|
+
f_inner_voids_<<name>>,
|
|
1000
|
+
f_outer_voids_<<name>>
|
|
1001
|
+
};
|
|
1002
|
+
{% endif %}
|
|
1003
|
+
{% endfor %}
|
|
1004
|
+
{% if (dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D") and dm.magnet.solve.thermal.solve_type%}
|
|
1005
|
+
// Quench Propagation 2Dx1D
|
|
1006
|
+
{% set counter = {"counter1": 0} %}
|
|
1007
|
+
{% for i in aux.half_turns.ht.keys() %}
|
|
1008
|
+
L_Mag[Region[{<<nc.omega>>_Block_<<i>>_EM,<<nc.omega>>_Block_<<i>>_TH}]] = <<dm.magnet.solve.coil_windings.half_turn_length[i-1]>>; // Magnetic Length [m]
|
|
1009
|
+
{% set QH_half_turns_in_block = [] %}
|
|
1010
|
+
{% set ECLIQ_half_turns_in_block = [] %}
|
|
1011
|
+
{% set ECLIQ_coil = [] %}
|
|
1012
|
+
{% for ht in aux.half_turns.ht[i] %}
|
|
1013
|
+
{% if ht in dm.quench_protection.quench_heaters.iQH_toHalfTurn_To and dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D"%}
|
|
1014
|
+
{% set _ = QH_half_turns_in_block.append('ht' ~ ht ~ '_EM') %}
|
|
1015
|
+
{% endif %}
|
|
1016
|
+
{% if ht in dm.quench_protection.e_cliq.iECLIQ_toHalfTurn_To and dm.quench_protection.e_cliq.quench_propagation == "2Dx1D"%}
|
|
1017
|
+
{% set _ = ECLIQ_half_turns_in_block.append('ht' ~ ht ~ '_EM') %}
|
|
1018
|
+
{% set _ = ECLIQ_coil.append(dm.quench_protection.e_cliq.iECLIQ_toHalfTurn_From[dm.quench_protection.e_cliq.iECLIQ_toHalfTurn_To.index(ht)]) %}
|
|
1019
|
+
{% endif %}
|
|
1020
|
+
{% endfor %}
|
|
1021
|
+
{% if QH_half_turns_in_block %}
|
|
1022
|
+
L_QH[Region[{Omega_QH_<<i>>_EM,Omega_QH_<<i>>_TH}]] = <<dm.quench_protection.quench_heaters.l[counter["counter1"]]>>; // QH Length [m]
|
|
1023
|
+
L_Cu[Region[{Omega_QH_<<i>>_EM,Omega_QH_<<i>>_TH}]] = <<dm.quench_protection.quench_heaters.l_copper[counter["counter1"]]>>; // QH Cu coil length
|
|
1024
|
+
L_SS[Region[{Omega_QH_<<i>>_EM,Omega_QH_<<i>>_TH}]] = <<dm.quench_protection.quench_heaters.l_stainless_steel[counter["counter1"]]>>; // QH SS coil length [m]
|
|
1025
|
+
{% if dm.quench_protection.quench_heaters.L_QH_offset %}
|
|
1026
|
+
L_QH_Offset[Region[{Omega_QH_<<i>>_EM,Omega_QH_<<i>>_TH}]] = <<dm.quench_protection.quench_heaters.L_QH_offset[counter["counter1"]]>>; // QH Length offset [m]
|
|
1027
|
+
{% else %}
|
|
1028
|
+
L_QH_Offset[Region[{Omega_QH_<<i>>_EM,Omega_QH_<<i>>_TH}]] = 0; // QH Length offset [m]
|
|
1029
|
+
{% endif %}
|
|
1030
|
+
<<cc_macros2.increment(counter, "counter1") >>
|
|
1031
|
+
{% endif %}
|
|
1032
|
+
{% if ECLIQ_half_turns_in_block %}
|
|
1033
|
+
L_ECLIQ[Region[{Omega_ECLIQ_<<i>>_EM,Omega_ECLIQ_<<i>>_TH}]] = <<dm.quench_protection.e_cliq.l_ecliq[ECLIQ_coil[0]-1]>>; // ECLIQ Length [m]
|
|
1034
|
+
h_ECLIQ[Region[{Omega_ECLIQ_<<i>>_EM,Omega_ECLIQ_<<i>>_TH}]] = <<dm.quench_protection.e_cliq.h_ecliq[ECLIQ_coil[0]-1]>>; // ECLIQ spacing [m]
|
|
1035
|
+
N_ECLIQ_units[Region[{Omega_ECLIQ_<<i>>_EM,Omega_ECLIQ_<<i>>_TH}]]=<<dm.quench_protection.e_cliq.N_units[ECLIQ_coil[0]-1]>>; // Number of ECLIQs per cross-section in the 2D representation
|
|
1036
|
+
{% if dm.quench_protection.e_cliq.L_ecliq_offset %}
|
|
1037
|
+
L_ECLIQ_Offset[Region[{Omega_ECLIQ_<<i>>_EM,Omega_ECLIQ_<<i>>_TH}]] = <<dm.quench_protection.e_cliq.L_ecliq_offset[ECLIQ_coil[0]-1]>>; // ECLIQ Length offset [m]
|
|
1038
|
+
{% else %}
|
|
1039
|
+
L_ECLIQ_Offset[Region[{Omega_ECLIQ_<<i>>_EM,Omega_ECLIQ_<<i>>_TH}]] = 0; // ECLIQ Length offset [m]
|
|
1040
|
+
{% endif %}
|
|
1041
|
+
{% endif %}
|
|
672
1042
|
{% endfor %}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
{%
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
f_inner_voids_<<name>>,
|
|
687
|
-
f_outer_voids_<<name>>
|
|
688
|
-
};
|
|
1043
|
+
{% if dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" %}
|
|
1044
|
+
N_SS[Region[{QH_HT_EM,QH_HT_TH}]]= (L_QH[]+L_Cu[])/(L_SS[]+L_Cu[]); //Number of SS strips (where QH) [-]
|
|
1045
|
+
L_strip_0[]= N_SS[]*L_SS[]; // Initial Normal Zone [m]
|
|
1046
|
+
{% endif %}
|
|
1047
|
+
{% if dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" %}
|
|
1048
|
+
L_strip_0[]= N_ECLIQ_units[]*L_ECLIQ[]; // Initial Normal Zone [m]
|
|
1049
|
+
{% endif %}
|
|
1050
|
+
//Normal Zone Propagation Velocity
|
|
1051
|
+
// -$1: Temperature [K]
|
|
1052
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
1053
|
+
// -$3: Current [A]
|
|
1054
|
+
{% if dm.quench_protection.quench_heaters.quench_prop_model == "Wilson" %}
|
|
1055
|
+
{% set cv_temp = dm.magnet.solve.thermal.init_temperature %}
|
|
689
1056
|
{% else %}
|
|
690
|
-
|
|
691
|
-
<<materials[specificHeatCapacityMacroName[cond.strand.material_stabilizer]]()>>,
|
|
692
|
-
<<materials[specificHeatCapacityMacroName[cond.strand.material_superconductor]]()>>,
|
|
693
|
-
<<materials[specificHeatCapacityMacroName[cond.cable.material_inner_voids]]()>>,
|
|
694
|
-
<<materials[specificHeatCapacityMacroName[cond.cable.material_outer_voids]]()>>
|
|
695
|
-
]
|
|
696
|
-
{
|
|
697
|
-
f_stabilizer_<<name>>,
|
|
698
|
-
f_sc_<<name>>,
|
|
699
|
-
f_inner_voids_<<name>>,
|
|
700
|
-
f_outer_voids_<<name>>
|
|
701
|
-
};
|
|
1057
|
+
{% set cv_temp = "Ts[$1,$2,$3]" %}
|
|
702
1058
|
{% endif %}
|
|
1059
|
+
{% set ECLIQ_conductors = [] %}
|
|
1060
|
+
{% for i in range(len(dm.magnet.solve.coil_windings.conductor_to_group)) %}
|
|
1061
|
+
{% if dm.magnet.solve.coil_windings.group_to_coil_section[i]>1 %}
|
|
1062
|
+
{% set _ = ECLIQ_conductors.append(dm.magnet.solve.coil_windings.conductor_to_group[i]) %}
|
|
1063
|
+
{% endif %}
|
|
703
1064
|
{% endfor %}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
{% if
|
|
707
|
-
|
|
708
|
-
{
|
|
709
|
-
|
|
1065
|
+
{% for name, cond in dm.conductors.items() %}
|
|
1066
|
+
{% if cond.strand.material_superconductor == 'Nb-Ti' %}
|
|
1067
|
+
Tc[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]]=CFUN_TcNbTi_B[$2]{{% if cond.Jc_fit.type == 'Summers' %}<<cond.Jc_fit.Tc0_Summers>>,<<cond.Jc_fit.Bc20_Summers>>{% else %}<<cond.Jc_fit.Tc0_CUDI1>>,<<cond.Jc_fit.Bc20_CUDI1>> {% endif %}}; // Critical temperature of the superconductor [K]
|
|
1068
|
+
Tcs[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]]=CFUN_TcsNbTi_B_I[$2,$3]{<<cond.Jc_fit.C1_CUDI1>>,<< cond.Jc_fit.C2_CUDI1>>}; // Current sharing temperature [K]
|
|
1069
|
+
Ts[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]]=(Tc[$1,$2,$3]+Tcs[$1,$2,$3])/2 ; // Avg temperature between Tc and Tcs [K]
|
|
1070
|
+
NZPV[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]] = CFUN_NZPV_T[$3/area_fct[],Tcs[$1,$2,$3],Tc[$1,$2,$3], // NZPV from Suoerconducting Magnets (Wilson) [m/s]
|
|
1071
|
+
{% if dm.quench_protection.quench_heaters.quench_prop_model == "Wilson" %}(Tc[$1,$2,$3]^4-<<dm.magnet.solve.thermal.init_temperature>>^4)/(4*<<dm.magnet.solve.thermal.init_temperature>>^3*(Tc[$1,$2,$3]-<<dm.magnet.solve.thermal.init_temperature>>))*{% endif %}
|
|
1072
|
+
RuleOfMixtures[
|
|
1073
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.Cv_material_stabilizer]](T=cv_temp)>>,
|
|
1074
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.material_superconductor]](C1=cond.Jc_fit.C1_CUDI1, C2=cond.Jc_fit.C2_CUDI1, current="$3",T=cv_temp)>>,
|
|
1075
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_inner_voids]](T=cv_temp)>>,
|
|
1076
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_outer_voids]](T=cv_temp)>>
|
|
1077
|
+
]
|
|
1078
|
+
{
|
|
1079
|
+
f_stabilizer_<<name>>,
|
|
1080
|
+
f_sc_<<name>>,
|
|
1081
|
+
f_inner_voids_<<name>>,
|
|
1082
|
+
f_outer_voids_<<name>>
|
|
1083
|
+
}]{<<dm.magnet.solve.thermal.init_temperature>>};
|
|
1084
|
+
{% else %}
|
|
1085
|
+
Tc[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]]=CFUN_TcNb3Sn_B[$2]{<<cond.Jc_fit.Tc0_Summers>>,<<cond.Jc_fit.Bc20_Summers>>}; // Critical temperature of the superconductor [K]
|
|
1086
|
+
Tcs[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]]=CFUN_TcsNb3Sn_J_B_Jc0[$3/area_fct[],$2,CFUN_Jc_Nb3Sn_Summers_T_B[$1,$2]{<<cond.Jc_fit.Jc0_Summers>>,<<cond.Jc_fit.Tc0_Summers>>,<<cond.Jc_fit.Bc20_Summers>>}]{<<cond.Jc_fit.Jc0_Summers>>,<<cond.Jc_fit.Tc0_Summers>>,<<cond.Jc_fit.Bc20_Summers>>}; // Current sharing temperature [K]
|
|
1087
|
+
Ts[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]]=(Tcs[$1,$2,$3]+Tc[$1,$2,$3])/2; // Avg temperature between Tc and Tcs [K]
|
|
1088
|
+
NZPV[Region[{<<nc.omega>><<nc.powered>>_<<name>>_EM,<<nc.omega>><<nc.powered>>_<<name>>_TH}]] = CFUN_NZPV_T[$3/area_fct[],CFUN_TcsNb3Sn_J_B_Jc0[$3/area_fct[],$2,CFUN_Jc_Nb3Sn_Summers_T_B[$1,$2]{<<cond.Jc_fit.Jc0_Summers>>,<<cond.Jc_fit.Tc0_Summers>>,<<cond.Jc_fit.Bc20_Summers>>}]{<<cond.Jc_fit.Jc0_Summers>>,<<cond.Jc_fit.Tc0_Summers>>,<<cond.Jc_fit.Bc20_Summers>>},CFUN_TcNb3Sn_B[$2]{<<cond.Jc_fit.Tc0_Summers>>,<<cond.Jc_fit.Bc20_Summers>>}, // NZPV from Suoerconducting Magnets (Wilson) [m/s]
|
|
1089
|
+
{% if dm.quench_protection.quench_heaters.quench_prop_model == "Wilson" %}(Tc[$1,$2,$3]^4-<<dm.magnet.solve.thermal.init_temperature>>^4)/(4*<<dm.magnet.solve.thermal.init_temperature>>^3*(Tc[$1,$2,$3]-<<dm.magnet.solve.thermal.init_temperature>>))*{% endif %}
|
|
1090
|
+
RuleOfMixtures[
|
|
1091
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.Cv_material_stabilizer]](T=cv_temp)>>,
|
|
1092
|
+
<<materials[specificHeatCapacityMacroName[cond.strand.material_superconductor]](T=cv_temp)>>,
|
|
1093
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_inner_voids]](T=cv_temp)>>,
|
|
1094
|
+
<<materials[specificHeatCapacityMacroName[cond.cable.material_outer_voids]](T=cv_temp)>>
|
|
1095
|
+
]
|
|
1096
|
+
{
|
|
1097
|
+
f_stabilizer_<<name>>,
|
|
1098
|
+
f_sc_<<name>>,
|
|
1099
|
+
f_inner_voids_<<name>>,
|
|
1100
|
+
f_outer_voids_<<name>>
|
|
1101
|
+
}]{<<dm.magnet.solve.thermal.init_temperature>>};
|
|
1102
|
+
{% endif %}
|
|
1103
|
+
{% endfor %}
|
|
1104
|
+
{% if dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" %}
|
|
1105
|
+
N_QH[QH_HT_EM] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_SS[]+1)>=L_Cu[]/L_Mag[] ? 2*(N_SS[] -1): 0; // Reduction of QPF if the whole QH length is already quenched (QH_EM) [-]
|
|
1106
|
+
N_QH[QH_HT_TH] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_SS[]+1)>=L_Cu[]/L_Mag[] ? 2*(N_SS[] -1): 0; // Reduction of QPF if the whole QH length is already quenched (QH_TH) [-]
|
|
1107
|
+
L_QH_F[Region[{QH_HT_EM,QH_HT_TH}]] = (L_Mag[]-L_QH[])/2-L_QH_Offset[]; // Front length to magnet end
|
|
1108
|
+
L_QH_B[Region[{QH_HT_EM,QH_HT_TH}]] = (L_Mag[]-L_QH[])/2+L_QH_Offset[]; // Back length to magnet end
|
|
1109
|
+
N_QH_Offset[QH_HT_EM] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_SS[]+1)>=L_QH_F[]/L_Mag[] ? GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_SS[]+1)>=L_QH_B[]/L_Mag[] ? 2: 1 :GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_SS[]+1)>=L_QH_B[]/L_Mag[] ? 1: 0; // Number of QPF reduction if the front and/or back length is already quenched (QH_EM) [-]
|
|
1110
|
+
N_QH_Offset[QH_HT_TH] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_SS[]+1)>=L_QH_F[]/L_Mag[] ? GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_SS[]+1)>=L_QH_B[]/L_Mag[] ? 2: 1 :GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_SS[]+1)>=L_QH_B[]/L_Mag[] ? 1: 0; // Number of QPF reduction if the front and/or back length is already quenched (QH_TH) [-]
|
|
1111
|
+
N_QPF[Region[{QH_HT_EM,QH_HT_TH}]] = N_SS[]*2-N_QH_Offset[]-N_QH[]; //Number of Normal Zone Propagation Front Origins (QH_HT) [-]
|
|
1112
|
+
N_QPF[Region[{noQH_HT_EM,noQH_HT_TH}]]= 2; //Number of Normal Zone Propagation Front Origins (where no QH) [-]
|
|
710
1113
|
{% endif %}
|
|
711
|
-
|
|
712
|
-
{
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
1114
|
+
{% if dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" %}
|
|
1115
|
+
N_ECLIQ[ECLIQ_HT_EM] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_ECLIQ_units[]+1)>=h_ECLIQ[]/L_Mag[] ? 2*(N_ECLIQ_units[] -1): 0; // Reduction of QPF if the length between ECLIQ units is already quenched (ECLIQ_EM) [-]
|
|
1116
|
+
N_ECLIQ[ECLIQ_HT_TH] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_ECLIQ_units[]+1)>=h_ECLIQ[]/L_Mag[] ? 2*(N_ECLIQ_units[] -1): 0; // Reduction of QPF if the length between ECLIQ units is already quenched (ECLIQ_TH) [-]
|
|
1117
|
+
L_ECLIQ_F[Region[{ECLIQ_HT_EM,ECLIQ_HT_TH}]] = (L_Mag[]-N_ECLIQ_units[]*L_ECLIQ[])/2-L_ECLIQ_Offset[]; // Front length to magnet end
|
|
1118
|
+
L_ECLIQ_B[Region[{ECLIQ_HT_EM,ECLIQ_HT_TH}]] = (L_Mag[]-N_ECLIQ_units[]*L_ECLIQ[])/2+L_ECLIQ_Offset[]; // Back length to magnet end
|
|
1119
|
+
N_ECLIQ_Offset[ECLIQ_HT_EM] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_ECLIQ[]+1)>=L_ECLIQ_F[]/L_Mag[] ? GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_ECLIQ_units[]+1)>=L_ECLIQ_B[]/L_Mag[] ? 2: 1 :GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}/(N_ECLIQ_units[]+1)>=L_ECLIQ_B[]/L_Mag[] ? 1: 0; // Number of QPF reduction if the front and/or back length is already quenched (ECLIQ_EM) [-]
|
|
1120
|
+
N_ECLIQ_Offset[ECLIQ_HT_TH] = GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_ECLIQ[]+1)>=L_ECLIQ_F[]/L_Mag[] ? GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_ECLIQ_units[]+1)>=L_ECLIQ_B[]/L_Mag[] ? 2: 1 :GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}/(N_ECLIQ_units[]+1)>=L_ECLIQ_B[]/L_Mag[] ? 1: 0; // Number of QPF reduction if the front and/or back length is already quenched (ECLIQ_TH) [-]
|
|
1121
|
+
N_QPF[Region[{ECLIQ_HT_EM,ECLIQ_HT_TH}]] = N_ECLIQ_units[]*2-N_ECLIQ_Offset[]-N_ECLIQ[]; //Number of Normal Zone Propagation Front Origins (ECLIQ_HT) [-]
|
|
1122
|
+
N_QPF[Region[{noECLIQ_HT_EM,noECLIQ_HT_TH}]]= 2; //Number of Normal Zone Propagation Front Origins (where no ECLIQ) [-]
|
|
718
1123
|
{% endif %}
|
|
1124
|
+
NZ[]=(N_QPF[]*NZPV[$1,$2,$3]*$DTime*{% if dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" %}<<dm.quench_protection.quench_heaters.NZPV_multiplier>>{% else %}<<dm.quench_protection.e_cliq.NZPV_multiplier>>{% endif %})/(L_Mag[]) ; // Normal Zone increase per Dt ratio in noECLIQ_zone [-]
|
|
1125
|
+
quench_ratio_TH[{% if dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" %}ECLIQ_HT_TH{% else %}QH_HT_TH{% endif %}] = TestQuench[$1,$2,$3]>0? Min[GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH}+L_strip_0[]/(L_Mag[]),1]:0; // Total quench ratio in EM [-]
|
|
1126
|
+
quench_ratio_TH[{% if dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" %}noECLIQ_HT_TH{% else %}noQH_HT_TH{% endif %}] = TestQuench[$1,$2,$3]>0? Min[GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_TH},1]:0; // Total quench ratio in TH [-]
|
|
1127
|
+
quench_ratio_EM[{% if dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" %}ECLIQ_HT_EM{% else %}QH_HT_EM{% endif %}] = TestQuench[$1,$2,$3]>0? Min[GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM}+L_strip_0[]/(L_Mag[]),1]:0; // Total quench ratio in EM [-]
|
|
1128
|
+
quench_ratio_EM[{% if dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" %}noECLIQ_HT_EM{% else %}noQH_HT_EM{% endif %}] = TestQuench[$1,$2,$3]>0? Min[GetVariable[ElementNum[],QuadraturePointIndex[]]{$Quench_ratio_EM},1]:0; // Total quench ratio in EM [-]
|
|
1129
|
+
|
|
1130
|
+
{% endif %}
|
|
1131
|
+
// Joule losses of bare part
|
|
1132
|
+
// -$1: Temperature [K]
|
|
1133
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
1134
|
+
// -$3: Current [A]
|
|
1135
|
+
jouleLosses[] = CFUN_quenchState_I_Ic[$3,criticalCurrentDensity[$1, $2] * area_fct[]] * rho[$1, $2] * SquNorm[$3/area_fct[]]{% if dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" %}*quench_ratio_TH[$1,$2,$3]{% endif %};
|
|
719
1136
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
1137
|
+
|
|
1138
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
1139
|
+
// Thermal conductivity of the wedges
|
|
1140
|
+
// -$1: Temperature [K]
|
|
1141
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
1142
|
+
kappa[<<nc.omega>><<nc.induced>>_TH] = <<materials[thermalConductivityMacroName[dm.magnet.solve.wedges.material]](RRR=dm.magnet.solve.wedges.RRR)>>;
|
|
1143
|
+
|
|
1144
|
+
// heat capacity of wedges
|
|
1145
|
+
// -$1: Temperature [K]
|
|
1146
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
1147
|
+
heatCap[<<nc.omega>><<nc.induced>>_TH] = <<materials[specificHeatCapacityMacroName[dm.magnet.solve.wedges.material]]()>>;
|
|
1148
|
+
{% endif %}
|
|
723
1149
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
1150
|
+
{% for area in areas_to_build['TH'] %}
|
|
1151
|
+
{% if area == 'iron_yoke' %}
|
|
1152
|
+
// thermal conductivity of the iron yoke TODO: Hardcoded
|
|
1153
|
+
kappa[<<nc.omega>><<nc.iron_yoke>>_TH] = 300;
|
|
1154
|
+
// heat capacity of iron yoke TODO: Hardcoded
|
|
1155
|
+
heatCap[ <<nc.omega>><<nc.iron_yoke>>_TH ] = 50;
|
|
1156
|
+
{% else %}
|
|
1157
|
+
{% for name in rm_TH[area].vol.names %}
|
|
1158
|
+
kappa[<<nc.omega>><<nc[area]>>_TH ] = <<materials[thermalConductivityMacroName[name]](RRR=dm.magnet.solve.collar.RRR)>>;
|
|
1159
|
+
heatCap[ <<nc.omega>><<nc[area]>>_TH ] = <<materials[specificHeatCapacityMacroName[name]]()>>;
|
|
1160
|
+
{% endfor %}
|
|
1161
|
+
{% endif %}
|
|
1162
|
+
{% endfor %}
|
|
727
1163
|
|
|
728
|
-
|
|
729
|
-
|
|
1164
|
+
|
|
1165
|
+
{% if dm.magnet.solve.collar.transient_effects_enabled %}
|
|
1166
|
+
{% set name = rm_EM['collar'].vol.names[0] %} // debug iron
|
|
1167
|
+
{% if 'collar' in areas_to_build['EM'] %}
|
|
1168
|
+
rho[<<nc.omega>><<nc.collar>>_EM] = {% if not name.startswith('BHiron')%} <<materials[resistivityMacroName[name]](RRR=dm.magnet.solve.collar.RRR)>> {% else %} <<materials[resistivityMacroName['SS']](RRR=dm.magnet.solve.collar.RRR)>> {% endif %};
|
|
1169
|
+
{% endif %}
|
|
1170
|
+
{% if 'collar' in areas_to_build['TH'] %}
|
|
1171
|
+
rho[<<nc.omega>><<nc.collar>>_TH] = {% if not name.startswith('BHiron')%} <<materials[resistivityMacroName[name]](RRR=dm.magnet.solve.collar.RRR)>> {% else %} <<materials[resistivityMacroName['SS']](RRR=dm.magnet.solve.collar.RRR)>> {% endif %};
|
|
1172
|
+
{% endif %}
|
|
1173
|
+
{% endif %}
|
|
1174
|
+
{% if dm.magnet.solve.poles.transient_effects_enabled %}
|
|
1175
|
+
{% set name = rm_EM['poles'].vol.names[0] %} // debug iron
|
|
1176
|
+
{% if 'poles' in areas_to_build['EM'] %}
|
|
1177
|
+
rho[<<nc.omega>><<nc.poles>>_EM] = {% if not name.startswith('BHiron')%} <<materials[resistivityMacroName[name]](RRR=dm.magnet.solve.poles.RRR)>> {% else %} <<materials[resistivityMacroName['SS']](RRR=dm.magnet.solve.collar.RRR)>> {% endif %};
|
|
1178
|
+
{% endif %}
|
|
1179
|
+
{% if 'poles' in areas_to_build['TH'] %}
|
|
1180
|
+
rho[<<nc.omega>><<nc.poles>>_TH] ={% if not name.startswith('BHiron')%} <<materials[resistivityMacroName[name]](RRR=dm.magnet.solve.poles.RRR)>> {% else %} <<materials[resistivityMacroName['SS']](RRR=dm.magnet.solve.collar.RRR)>> {% endif %};
|
|
1181
|
+
{% endif %}
|
|
1182
|
+
{% endif %}
|
|
1183
|
+
{% if dm.magnet.mesh.thermal.reference.enabled %}
|
|
1184
|
+
// thermal conductivity of the material of the reference mesh.
|
|
1185
|
+
{% for name in rm_TH.ref_mesh.vol.names %}
|
|
1186
|
+
kappa[ <<nc.omega>>_refmesh_TH ] = <<materials[thermalConductivityMacroName[name]]()>>;
|
|
1187
|
+
heatCap[ <<nc.omega>>_refmesh_TH ] = <<materials[specificHeatCapacityMacroName[name]]()>>;
|
|
1188
|
+
{% endfor %}
|
|
1189
|
+
{% endif %}
|
|
1190
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1191
|
+
For i In {1:num_dirichlet}
|
|
730
1192
|
// piece-wise defined const_temp
|
|
731
1193
|
const_temp[Region[bnd_dirichlet~{i}]] = val_temperature~{i};
|
|
732
|
-
|
|
1194
|
+
EndFor
|
|
733
1195
|
|
|
734
|
-
|
|
1196
|
+
For n In {1:num_neumann}
|
|
735
1197
|
// piece-wise defined heatFlux
|
|
736
1198
|
heatFlux[Region[bnd_neumann~{n}]] = val_heatFlux~{n};
|
|
737
|
-
|
|
1199
|
+
EndFor
|
|
738
1200
|
|
|
739
|
-
|
|
1201
|
+
For r In {1:num_robin}
|
|
740
1202
|
// piece-wise defined heatExchCoeff
|
|
741
1203
|
heatExchCoeff[Region[bnd_robin~{r}]] = val_heatExchCoeff~{r}[$1, $2];
|
|
742
1204
|
Tinf[Region[bnd_robin~{r}]] = val_Tinf~{r};
|
|
743
|
-
|
|
744
|
-
{% else %}
|
|
745
|
-
// thermal conductivity of the insulation
|
|
746
|
-
kappa[<<nc.omega>><<nc.insulator>>_TH] = <<materials[thermalConductivityMacroName[list(dm.conductors.values())[0].cable.material_insulation]]()>>;
|
|
747
|
-
|
|
748
|
-
// heat capacity of insulation
|
|
749
|
-
heatCap[ <<nc.omega>><<nc.insulator>>_TH ] = <<materials[specificHeatCapacityMacroName[list(dm.conductors.values())[0].cable.material_insulation]]()>>;
|
|
750
|
-
{% endif %}
|
|
1205
|
+
EndFor
|
|
751
1206
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
1207
|
+
// TSA material and thickness functions
|
|
1208
|
+
// instead of k and l as arguments, we could add it to the function name increasing the number of functions
|
|
1209
|
+
{% set TSAinsulation_layers_number = rm_TH.thin_shells.insulation_types.layers_number + rm_TH.thin_shells.quench_heaters.layers_number + rm_TH.thin_shells.collar.layers_number + rm_TH.thin_shells.poles.layers_number %} //
|
|
1210
|
+
{% set TSAinsulation_thicknesses = rm_TH.thin_shells.insulation_types.thicknesses + rm_TH.thin_shells.quench_heaters.thicknesses + rm_TH.thin_shells.collar.thicknesses + rm_TH.thin_shells.poles.thicknesses %} //
|
|
1211
|
+
{% set TSAinsulation_thin_shells = rm_TH.thin_shells.insulation_types.thin_shells + rm_TH.thin_shells.quench_heaters.thin_shells + rm_TH.thin_shells.collar.thin_shells + rm_TH.thin_shells.poles.thin_shells %} //
|
|
1212
|
+
{% set TSAinsulation_material = rm_TH.thin_shells.insulation_types.layers_material + rm_TH.thin_shells.quench_heaters.layers_material + rm_TH.thin_shells.collar.layers_material + rm_TH.thin_shells.poles.layers_material %}//
|
|
1213
|
+
|
|
1214
|
+
{% for nr, n_ele in enumerate(TSAinsulation_layers_number) %}
|
|
1215
|
+
n_ele_per_tsa_group_<<nr + 1>> = <<n_ele>>;
|
|
1216
|
+
{% for nr_thickness, thickness in enumerate(TSAinsulation_thicknesses[nr]) %}
|
|
1217
|
+
{% for tag in TSAinsulation_thin_shells[nr] %}
|
|
1218
|
+
{% if tag in flip_tags %}
|
|
1219
|
+
delta_<<n_ele - nr_thickness - 1>>[Region[<<tag>>]] = <<thickness>>;
|
|
1220
|
+
thermalConductivityMass~{<<n_ele - nr_thickness - 1>>}[Region[<<tag>>]] = <<TSA_materials[thermalConductivityTSAMassMacroName[TSAinsulation_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", l="$5", GaussianPoints=2)>>;
|
|
1221
|
+
thermalConductivityStiffness~{<<n_ele - nr_thickness - 1>>}[Region[<<tag>>]] = <<TSA_materials[thermalConductivityTSAStiffnessMacroName[TSAinsulation_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", l="$5", GaussianPoints=2)>>;
|
|
1222
|
+
specificHeatCapacity~{<<n_ele - nr_thickness - 1>>}[Region[<<tag>>]] = <<TSA_materials[specificHeatCapacityTSAMacroName[TSAinsulation_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", l="$5", GaussianPoints=2)>>;
|
|
1223
|
+
{% else %}
|
|
1224
|
+
delta_<<nr_thickness>>[Region[<<tag>>]] = <<thickness>>;
|
|
1225
|
+
thermalConductivityMass~{<<nr_thickness>>}[Region[<<tag>>]] = <<TSA_materials[thermalConductivityTSAMassMacroName[TSAinsulation_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", l="$5", GaussianPoints=2)>>;
|
|
1226
|
+
thermalConductivityStiffness~{<<nr_thickness>>}[Region[<<tag>>]] = <<TSA_materials[thermalConductivityTSAStiffnessMacroName[TSAinsulation_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", l="$5", GaussianPoints=2)>>;
|
|
1227
|
+
specificHeatCapacity~{<<nr_thickness>>}[Region[<<tag>>]] = <<TSA_materials[specificHeatCapacityTSAMacroName[TSAinsulation_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", l="$5", GaussianPoints=2)>>;
|
|
1228
|
+
{% endif %}
|
|
1229
|
+
{% endfor %}
|
|
1230
|
+
{% endfor %}
|
|
1231
|
+
{% endfor %}
|
|
1232
|
+
{% for nr, n_ele in enumerate(rm_TH.thin_shells.quench_heaters.layers_number) %}
|
|
1233
|
+
{% for nr_thickness, thickness in enumerate(rm_TH.thin_shells.quench_heaters.thicknesses[nr]) %}
|
|
1234
|
+
{% for tag in rm_TH.thin_shells.quench_heaters.thin_shells[nr] %}
|
|
1235
|
+
{% set qh_indexPlusOne = rm_TH.thin_shells.quench_heaters.label[nr][nr_thickness] %}
|
|
1236
|
+
{% if qh_indexPlusOne %}
|
|
1237
|
+
{% set qh_dict = dm.quench_protection.quench_heaters %}
|
|
1238
|
+
{% set qh_index = int(qh_indexPlusOne or 1E20) - 1 %}
|
|
1239
|
+
{% set l_SS = qh_dict.l_stainless_steel[qh_index] / (qh_dict.l_copper[qh_index] + qh_dict.l_stainless_steel[qh_index]) * qh_dict.l[qh_index] %}
|
|
1240
|
+
{% endif %}
|
|
1241
|
+
{% if tag in flip_tags %}
|
|
1242
|
+
{% if qh_indexPlusOne %}
|
|
1243
|
+
powerDensity~{<<n_ele - nr_thickness - 1>>}[Region[<<tag>>]] = <<TSA_materials['MATERIAL_QuenchHeater_SSteel_t_T_k'](t_on=qh_dict.t_trigger[qh_index], U_0=qh_dict.U0[qh_index], C=qh_dict.C[qh_index], R_warm=qh_dict.R_warm[qh_index], w_SS=qh_dict.w[qh_index], h_SS=qh_dict.h[qh_index], l_SS=l_SS, mode=1, time="$Time", T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", GaussianPoints=2)>>;
|
|
1244
|
+
{% else %}
|
|
1245
|
+
powerDensity~{<<n_ele - nr_thickness - 1>>}[Region[<<tag>>]] = 0;
|
|
1246
|
+
{% endif %}
|
|
1247
|
+
{% else %}
|
|
1248
|
+
{% if qh_indexPlusOne %}
|
|
1249
|
+
powerDensity~{<<nr_thickness>>}[Region[<<tag>>]] = <<TSA_materials['MATERIAL_QuenchHeater_SSteel_t_T_k'](t_on=qh_dict.t_trigger[qh_index], U_0=qh_dict.U0[qh_index], C=qh_dict.C[qh_index], R_warm=qh_dict.R_warm[qh_index], w_SS=qh_dict.w[qh_index], h_SS=qh_dict.h[qh_index], l_SS=l_SS, mode=1, time="$Time",T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k="$4", GaussianPoints=2)>>;
|
|
1250
|
+
{% else %}
|
|
1251
|
+
powerDensity~{<<nr_thickness>>}[Region[<<tag>>]] = 0;
|
|
1252
|
+
{% endif %}
|
|
1253
|
+
{% endif %}
|
|
1254
|
+
{% endfor %}
|
|
1255
|
+
{% endfor %}
|
|
774
1256
|
{% endfor %}
|
|
775
|
-
{% endfor %}
|
|
776
1257
|
{% else %}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
{% for l in range(1,3) %}
|
|
780
|
-
thermalConductivityMass_<<k>>_<<l>>_<<nr_thickness>>[Region[<<tag>>]] = <<TSA_materials[thermalConductivityTSAMassMacroName[TSAinsulationAndQH_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k=k, l=l, GaussianPoints=2)>>;
|
|
781
|
-
|
|
782
|
-
thermalConductivityStiffness_<<k>>_<<l>>_<<nr_thickness>>[Region[<<tag>>]] = <<TSA_materials[thermalConductivityTSAStiffnessMacroName[TSAinsulationAndQH_material[nr][nr_thickness]]](T_i="$1", T_iPlusOne="$2", thickness_TSA="$3", k=k, l=l, GaussianPoints=2)>>;
|
|
1258
|
+
// Thermal conductivity of the insulation
|
|
1259
|
+
kappa[<<nc.omega>><<nc.insulator>>_TH] = <<materials[thermalConductivityMacroName[list(dm.conductors.values())[0].cable.material_insulation]]()>>;
|
|
783
1260
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
{% endfor %}
|
|
1261
|
+
// Heat capacity of insulation
|
|
1262
|
+
heatCap[ <<nc.omega>><<nc.insulator>>_TH ] = <<materials[specificHeatCapacityMacroName[list(dm.conductors.values())[0].cable.material_insulation]]()>>;
|
|
787
1263
|
{% endif %}
|
|
788
|
-
|
|
789
|
-
{% endfor %}
|
|
790
|
-
{% endfor %}
|
|
791
|
-
|
|
792
|
-
{% for nr, n_ele in enumerate(rm_TH.thin_shells.quench_heaters.layers_number) %}
|
|
793
|
-
{% for nr_thickness, thickness in enumerate(rm_TH.thin_shells.quench_heaters.thicknesses[nr]) %}
|
|
794
|
-
{% for tag in rm_TH.thin_shells.quench_heaters.thin_shells[nr] %}
|
|
795
|
-
{% set qh_indexPlusOne = rm_TH.thin_shells.quench_heaters.label[nr][nr_thickness] %}
|
|
796
|
-
{% if qh_indexPlusOne %}
|
|
797
|
-
{% set qh_dict = dm.quench_protection.quench_heaters %}
|
|
798
|
-
{% set qh_index = int(qh_indexPlusOne or 1E20) - 1 %}
|
|
799
|
-
{% set l_SS = qh_dict.l_stainless_steel[qh_index] / (qh_dict.l_copper[qh_index] + qh_dict.l_stainless_steel[qh_index]) * qh_dict.l[qh_index] %}
|
|
800
|
-
{% endif %}
|
|
1264
|
+
{% endif %}
|
|
801
1265
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1266
|
+
{% if dm.magnet.solve.electromagnetics.solve_type == 'transient' or dm.magnet.solve.thermal.solve_type %}
|
|
1267
|
+
// Breakpoints for the adaptative time stepping scheme (default is the LUT from PS)
|
|
1268
|
+
{% if len(dm.magnet.solve.time_stepping.breakpoints)>0 or len(dm.magnet.solve.electromagnetics.time_stepping.breakpoints)>0 or len(dm.magnet.solve.thermal.time_stepping.breakpoints)>0%}
|
|
1269
|
+
{% if SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
1270
|
+
Breakpoints= {<<dm.magnet.solve.electromagnetics.time_stepping.breakpoints|join(', ')>>};
|
|
1271
|
+
{% elif SIM_MODE == 'Th_Mag_sta'%}
|
|
1272
|
+
Breakpoints= {<<dm.magnet.solve.thermal.time_stepping.breakpoints|join(', ')>>};
|
|
1273
|
+
{% else %}
|
|
1274
|
+
Breakpoints= {<<dm.magnet.solve.time_stepping.breakpoints|join(', ')>>};
|
|
1275
|
+
{% endif %}
|
|
1276
|
+
{% else %}
|
|
1277
|
+
Breakpoints= {<<dm.power_supply.t_control_LUT|join(', ')>>};
|
|
1278
|
+
{% endif %}
|
|
1279
|
+
{% endif %}
|
|
1280
|
+
// Resititivity of the strands accounting for quench propagation
|
|
1281
|
+
// -$1: Temperature [K]
|
|
1282
|
+
// -$2: Norm of the magnetic flux density [T]
|
|
1283
|
+
// -$3: Current [A]
|
|
1284
|
+
resistivity[<<nc.omega>><<nc.powered>>_EM]= rho[$1, $2] {% if (dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" ) and dm.magnet.solve.thermal.solve_type %}*quench_ratio_EM[$1,$2,$3]{% else %}*TestQuench[$1,$2,$3]{% endif %};
|
|
1285
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
1286
|
+
resistivity[<<nc.omega>><<nc.powered>>_TH]= rho[$1, $2] {% if (dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D") and dm.magnet.solve.thermal.solve_type %}*quench_ratio_TH[$1,$2,$3]{% else %}*TestQuench[$1,$2,$3]{% endif %};
|
|
1287
|
+
{% endif %}
|
|
822
1288
|
|
|
823
|
-
|
|
1289
|
+
}
|
|
824
1290
|
|
|
825
|
-
|
|
1291
|
+
// ------------------- EM CONSTRAINTS -----------------------------------
|
|
1292
|
+
Constraint {
|
|
1293
|
+
// Dirichlet at Boundary of EM domain
|
|
1294
|
+
{ Name Dirichlet_a_Mag;
|
|
1295
|
+
Case {
|
|
1296
|
+
{ Region <<nc.boundary>><<nc.omega>> ; Value 0.; }
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
{% if dm.circuit.field_circuit %}
|
|
1300
|
+
<<cc_macros2.constraints_FCC(dm,rm_EM, flag_active, init_ht, end_ht,CLIQ_dict,ECLIQ_dict, ESC_dict,CC_dict,aux,pol_)>>
|
|
1301
|
+
{% endif %}
|
|
1302
|
+
{% if not dm.circuit.field_circuit%}
|
|
1303
|
+
{ Name SourceCurrentDensityZ;
|
|
1304
|
+
Case {
|
|
1305
|
+
{ Region <<nc.omega>><<nc.powered>>_EM; Type Assign; Value 1; TimeFunction i_fct[];}
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
{% endif %}
|
|
1309
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' %}
|
|
1310
|
+
{ Name Init_from_Static;
|
|
1311
|
+
Case {
|
|
1312
|
+
{ Region <<nc.omega>>_EM; Type InitFromResolution; NameOfResolution Static_2_Dynamic ; }
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
{% if dm.circuit.field_circuit %}
|
|
1316
|
+
{ Name Init_from_Static2;
|
|
1317
|
+
Case {
|
|
1318
|
+
{ Region <<nc.omega>>_circuit; Type InitFromResolution; NameOfResolution Static_2_Dynamic ; }
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
{% endif %}
|
|
1322
|
+
{% endif %}
|
|
826
1323
|
}
|
|
827
1324
|
|
|
828
1325
|
{% if dm.magnet.solve.thermal.solve_type %}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
{
|
|
1326
|
+
// ------------------- TH CONSTRAINTS -----------------------------------
|
|
1327
|
+
Constraint {
|
|
1328
|
+
{ Name initTemp ;
|
|
1329
|
+
Case {
|
|
1330
|
+
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
1331
|
+
{% for nr, _ in enumerate(rm_TH.boundaries.thermal.temperature.bc.names) %}
|
|
1332
|
+
{ Region <<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.temperature)[nr]>>; Value <<rm_TH.boundaries.thermal.temperature.bc.value[nr]>>; Type Assign; } // boundary condition
|
|
1333
|
+
{% endfor %}
|
|
1334
|
+
{% endif %}
|
|
1335
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1336
|
+
{ Region Region[{allLayers, midLayers {% if dm.magnet.geometry.thermal.use_TSA_new %}, midLayers_col, inner_collar, midLayers_pol, pole_bdry_lines {% endif %}}] ; Value <<dm.magnet.solve.thermal.init_temperature>> ; Type Init; }
|
|
1337
|
+
{% endif %}
|
|
1338
|
+
{ Region <<nc.omega>>_TH ; Value <<dm.magnet.solve.thermal.init_temperature>> ; Type Init; } // init. condition
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1342
|
+
{% set lines_tags = rm_TH.boundaries.thermal.temperature.groups['r1_a1'] +
|
|
832
1343
|
rm_TH.boundaries.thermal.temperature.groups['r1_a2'] +
|
|
833
1344
|
rm_TH.boundaries.thermal.temperature.groups['r2_a1'] +
|
|
834
1345
|
rm_TH.boundaries.thermal.temperature.groups['r2_a2'] +
|
|
@@ -839,227 +1350,276 @@ Function {
|
|
|
839
1350
|
rm_TH.thin_shells.mid_turns_layers_poles %}
|
|
840
1351
|
|
|
841
1352
|
// split to avoid error for two touching lines in different intDomains
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1353
|
+
{% set lines_tags_1 = set(lines_tags).intersection(midLayers_1 + bndDir_1 + bndNeuInt_1_1_1 + bndNeuInt_1_2_1 + bndNeuInt_1_1_2 + bndNeuInt_1_2_2 + bndRobinInt_1_1_1 + bndRobinInt_1_2_1 + bndRobinInt_1_1_2 + bndRobinInt_1_2_2) %}
|
|
1354
|
+
{% set lines_tags_2 = set(lines_tags).intersection(midLayers_2 + bndDir_2 + bndNeuInt_2_1_1 + bndNeuInt_2_2_1 + bndNeuInt_2_1_2 + bndNeuInt_2_2_2 + bndRobinInt_2_1_1 + bndRobinInt_2_2_1 + bndRobinInt_2_1_2 + bndRobinInt_2_2_2) %}
|
|
1355
|
+
|
|
1356
|
+
coordList_Python_1_1() = {<<rc.neighbouring_nodes.groups['1_1']|join(', ')>>};
|
|
1357
|
+
coordList_Python_2_1() = {<<rc.neighbouring_nodes.groups['2_1']|join(', ')>>};
|
|
1358
|
+
coordList_Python_1_2() = {<<rc.neighbouring_nodes.groups['1_2']|join(', ')>>};
|
|
1359
|
+
coordList_Python_2_2() = {<<rc.neighbouring_nodes.groups['2_2']|join(', ')>>};
|
|
1360
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
1361
|
+
coordList_Python_col_1_1() = {<<rc.neighbouring_nodes.groups['mid2ht_1_1']|join(', ')>>};
|
|
1362
|
+
coordList_Python_col_2_1() = {<<rc.neighbouring_nodes.groups['mid2ht_2_1']|join(', ')>>};
|
|
1363
|
+
coordList_Python_col_1_2() = {<<rc.neighbouring_nodes.groups['mid2ht_1_2']|join(', ')>>};
|
|
1364
|
+
coordList_Python_col_2_2() = {<<rc.neighbouring_nodes.groups['mid2ht_2_2']|join(', ')>>};
|
|
1365
|
+
coordList_Python_col() = {<<rc.neighbouring_nodes.groups['mid2col']|join(', ')>>};
|
|
1366
|
+
|
|
1367
|
+
coordList_Python_pol_1_1() = {<<rc.neighbouring_nodes.groups['pole_mid2ht_1_1']|join(', ')>>};
|
|
1368
|
+
coordList_Python_pol_2_1() = {<<rc.neighbouring_nodes.groups['pole_mid2ht_2_1']|join(', ')>>};
|
|
1369
|
+
coordList_Python_pol_1_2() = {<<rc.neighbouring_nodes.groups['pole_mid2ht_1_2']|join(', ')>>};
|
|
1370
|
+
coordList_Python_pol_2_2() = {<<rc.neighbouring_nodes.groups['pole_mid2ht_2_2']|join(', ')>>};
|
|
1371
|
+
coordList_Python_mid2pol() = {<<rc.neighbouring_nodes.groups['mid2pol']|join(',')>>};
|
|
1372
|
+
{% endif %}
|
|
1373
|
+
// apply the mapping
|
|
1374
|
+
For i In {1:2}
|
|
851
1375
|
For j In {1:2}
|
|
852
1376
|
{ Name Temperature~{i}~{j} ;
|
|
853
1377
|
Case {
|
|
1378
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
1379
|
+
// apply TSL mapping at the collar side
|
|
1380
|
+
{ Region midLayers_col~{i}~{j}; Type Link;
|
|
1381
|
+
RegionRef Bare_Layers~{i}~{j};
|
|
1382
|
+
Coefficient 1;
|
|
1383
|
+
// coordinate list
|
|
1384
|
+
//Function shiftCoordinate[X[], Y[], Z[]]{coordList_Python_col_1()};
|
|
1385
|
+
Function shiftCoordinate[X[], Y[], Z[]]{coordList_Python_col~{i}~{j}()};
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
{ Region midLayers_pol~{i}~{j}; Type Link;
|
|
1389
|
+
RegionRef Bare_Layers~{i}~{j};
|
|
1390
|
+
Coefficient 1;
|
|
1391
|
+
Function shiftCoordinate[X[], Y[], Z[]]{coordList_Python_pol~{i}~{j}()};
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
{% endif %}
|
|
854
1395
|
// Link DoF of auxiliary shells to actual temperature
|
|
855
1396
|
{ Region midLayers~{i}~{j} ; Type Link;
|
|
856
1397
|
RegionRef Bare_Layers~{i}~{j} ; Coefficient 1;
|
|
857
1398
|
// coordList or coordList_Python
|
|
858
1399
|
Function shiftCoordinate[X[], Y[], Z[]]{coordList_Python~{i}~{j}()};
|
|
859
1400
|
}
|
|
860
|
-
|
|
1401
|
+
If (num_dirichlet > 0)
|
|
861
1402
|
// TODO: proper time dependent boundary conditions
|
|
862
1403
|
{ Region Region[bndDir~{i}~{j}]; Type Assign;
|
|
863
1404
|
Value const_temp[]; }
|
|
864
|
-
|
|
1405
|
+
EndIf
|
|
865
1406
|
}
|
|
866
1407
|
}
|
|
867
1408
|
EndFor
|
|
868
|
-
|
|
1409
|
+
EndFor
|
|
1410
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
1411
|
+
{ Name Temperature_TSA_sides;
|
|
1412
|
+
{% if 'collar' in areas_to_build['TH'] %}
|
|
1413
|
+
Case{
|
|
1414
|
+
// apply TSL mapping at the collar side
|
|
1415
|
+
{ Region midLayers_col; Type Link;
|
|
1416
|
+
RegionRef Region[{ inner_collar }]; Coefficient 1;
|
|
1417
|
+
Function shiftCoordinate[X[], Y[], Z[]]{coordList_Python_col()};// coordinate list
|
|
1418
|
+
}}
|
|
1419
|
+
{% endif %}
|
|
1420
|
+
{% if 'poles' in areas_to_build['TH'] %}
|
|
1421
|
+
Case{
|
|
1422
|
+
// apply TSL mapping at the pole side
|
|
1423
|
+
{ Region midLayers_pol; Type Link;
|
|
1424
|
+
RegionRef Region[{ pole_bdry_lines }]; Coefficient 1;
|
|
1425
|
+
Function shiftCoordinate[X[], Y[], Z[]]{coordList_Python_mid2pol()};// coordinate list
|
|
1426
|
+
}}
|
|
1427
|
+
{% endif %}
|
|
1428
|
+
}
|
|
1429
|
+
{% endif %}
|
|
869
1430
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
1431
|
+
{% if dm.magnet.mesh.thermal.isothermal_conductors or dm.magnet.mesh.thermal.isothermal_wedges %}
|
|
1432
|
+
{ Name isothermal_surs~{1}~{1} ;
|
|
1433
|
+
Case {
|
|
1434
|
+
{% if dm.magnet.mesh.thermal.isothermal_conductors %}
|
|
1435
|
+
{% for tag in rm_TH.powered['r1_a1'].vol.numbers %}
|
|
875
1436
|
{ Region Region[<<tag>>] ; Type Link;
|
|
876
1437
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
877
1438
|
Function Vector[<<rc.isothermal_nodes.conductors['1_1'][tag]|join(', ')>>];
|
|
878
1439
|
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
1440
|
+
{% endfor %}
|
|
1441
|
+
{% endif %}
|
|
1442
|
+
{% if dm.magnet.mesh.thermal.isothermal_wedges %}
|
|
1443
|
+
{% for tag in rm_TH.induced['r1_a1'].vol.numbers %}
|
|
883
1444
|
{ Region Region[<<tag>>] ; Type Link;
|
|
884
1445
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
885
1446
|
Function Vector[<<rc.isothermal_nodes.wedges['1_1'][tag]|join(', ')>>];
|
|
886
1447
|
}
|
|
887
|
-
|
|
888
|
-
|
|
1448
|
+
{% endfor %}
|
|
1449
|
+
{% endif %}
|
|
889
1450
|
}
|
|
890
1451
|
}
|
|
891
1452
|
{ Name isothermal_surs~{2}~{1} ;
|
|
892
1453
|
Case {
|
|
893
|
-
|
|
894
|
-
|
|
1454
|
+
{% if dm.magnet.mesh.thermal.isothermal_conductors %}
|
|
1455
|
+
{% for tag in rm_TH.powered['r2_a1'].vol.numbers %}
|
|
895
1456
|
{ Region Region[<<tag>>] ; Type Link;
|
|
896
1457
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
897
1458
|
Function Vector[<<rc.isothermal_nodes.conductors['2_1'][tag]|join(', ')>>];
|
|
898
1459
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1460
|
+
{% endfor %}
|
|
1461
|
+
{% endif %}
|
|
1462
|
+
{% if dm.magnet.mesh.thermal.isothermal_wedges %}
|
|
1463
|
+
{% for tag in rm_TH.induced['r2_a1'].vol.numbers %}
|
|
903
1464
|
{ Region Region[<<tag>>] ; Type Link;
|
|
904
1465
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
905
1466
|
Function Vector[<<rc.isothermal_nodes.wedges['2_1'][tag]|join(', ')>>];
|
|
906
1467
|
}
|
|
907
|
-
|
|
908
|
-
|
|
1468
|
+
{% endfor %}
|
|
1469
|
+
{% endif %}
|
|
909
1470
|
}
|
|
910
1471
|
}
|
|
911
1472
|
{ Name isothermal_surs~{1}~{2} ;
|
|
912
1473
|
Case {
|
|
913
|
-
|
|
914
|
-
|
|
1474
|
+
{% if dm.magnet.mesh.thermal.isothermal_conductors %}
|
|
1475
|
+
{% for tag in rm_TH.powered['r1_a2'].vol.numbers %}
|
|
915
1476
|
{ Region Region[<<tag>>] ; Type Link;
|
|
916
1477
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
917
1478
|
Function Vector[<<rc.isothermal_nodes.conductors['1_2'][tag]|join(', ')>>];
|
|
918
1479
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1480
|
+
{% endfor %}
|
|
1481
|
+
{% endif %}
|
|
1482
|
+
{% if dm.magnet.mesh.thermal.isothermal_wedges %}
|
|
1483
|
+
{% for tag in rm_TH.induced['r1_a2'].vol.numbers %}
|
|
923
1484
|
{ Region Region[<<tag>>] ; Type Link;
|
|
924
1485
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
925
1486
|
Function Vector[<<rc.isothermal_nodes.wedges['1_2'][tag]|join(', ')>>];
|
|
926
1487
|
}
|
|
927
|
-
|
|
928
|
-
|
|
1488
|
+
{% endfor %}
|
|
1489
|
+
{% endif %}
|
|
929
1490
|
}
|
|
930
1491
|
}
|
|
931
1492
|
{ Name isothermal_surs~{2}~{2} ;
|
|
932
1493
|
Case {
|
|
933
|
-
|
|
934
|
-
|
|
1494
|
+
{% if dm.magnet.mesh.thermal.isothermal_conductors %}
|
|
1495
|
+
{% for tag in rm_TH.powered['r2_a2'].vol.numbers %}
|
|
935
1496
|
{ Region Region[<<tag>>] ; Type Link;
|
|
936
1497
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
937
1498
|
Function Vector[<<rc.isothermal_nodes.conductors['2_2'][tag]|join(', ')>>];
|
|
938
1499
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1500
|
+
{% endfor %}
|
|
1501
|
+
{% endif %}
|
|
1502
|
+
{% if dm.magnet.mesh.thermal.isothermal_wedges %}
|
|
1503
|
+
{% for tag in rm_TH.induced['r2_a2'].vol.numbers %}
|
|
943
1504
|
{ Region Region[<<tag>>] ; Type Link;
|
|
944
1505
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
945
1506
|
Function Vector[<<rc.isothermal_nodes.wedges['2_2'][tag]|join(', ')>>];
|
|
946
1507
|
}
|
|
947
|
-
|
|
948
|
-
|
|
1508
|
+
{% endfor %}
|
|
1509
|
+
{% endif %}
|
|
949
1510
|
}
|
|
950
1511
|
}
|
|
951
1512
|
|
|
952
|
-
|
|
1513
|
+
{% if dm.magnet.mesh.thermal.isothermal_conductors %}
|
|
953
1514
|
{ Name isothermal_lines_1 ;
|
|
954
1515
|
Case {
|
|
955
|
-
|
|
1516
|
+
{% for tag in lines_tags_1 %}
|
|
956
1517
|
{ Region Region[<<tag>>] ; Type Link;
|
|
957
1518
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
958
1519
|
Function Vector[<<rc.isothermal_nodes.thin_shells[tag]|join(', ')>>];
|
|
959
1520
|
}
|
|
960
|
-
|
|
1521
|
+
{% endfor %}
|
|
961
1522
|
}
|
|
962
1523
|
}
|
|
963
1524
|
{ Name isothermal_lines_2 ;
|
|
964
1525
|
Case {
|
|
965
|
-
|
|
1526
|
+
{% for tag in lines_tags_2 %}
|
|
966
1527
|
{ Region Region[<<tag>>] ; Type Link;
|
|
967
1528
|
RegionRef Region[<<tag>>] ; Coefficient 1;
|
|
968
1529
|
Function Vector[<<rc.isothermal_nodes.thin_shells[tag]|join(', ')>>];
|
|
969
1530
|
}
|
|
970
|
-
|
|
1531
|
+
{% endfor %}
|
|
971
1532
|
}
|
|
972
1533
|
}
|
|
1534
|
+
{% endif %}
|
|
973
1535
|
{% endif %}
|
|
974
|
-
|
|
1536
|
+
{% endif %}
|
|
975
1537
|
}
|
|
976
|
-
{% endif %}
|
|
977
|
-
|
|
978
1538
|
{% endif %}
|
|
979
1539
|
|
|
980
|
-
|
|
981
|
-
{% if dm.
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
{ Region <<nc.boundary>><<nc.omega>> ; Value 0.; }
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
{ Name SourceCurrentDensityZ;
|
|
988
|
-
Case {
|
|
989
|
-
{ Region <<nc.omega>><<nc.powered>>_EM ; Value js_fct[]; }
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
{% endif %}
|
|
1540
|
+
FunctionSpace {
|
|
1541
|
+
{% if dm.circuit.field_circuit %}
|
|
1542
|
+
<<cc_macros2.function_space_FCC(nc,dm,flag_active,SIM_MODE)>>
|
|
1543
|
+
{% endif %}
|
|
993
1544
|
|
|
994
|
-
{
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
{
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
Case {
|
|
1011
|
-
{ Region <<rm_TH.projection_points.name>> ; Value 0; Type Assign; }
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
{% endif %}
|
|
1015
|
-
{% endif %}
|
|
1016
|
-
}
|
|
1545
|
+
{%- if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
1546
|
+
{ Name H_curl_a_after_projection; Type Form1P;
|
|
1547
|
+
BasisFunction {
|
|
1548
|
+
{ Name se_after_projection; NameOfCoef ae_after_projection; Function BF_PerpendicularEdge;
|
|
1549
|
+
Support Region[{<<nc.omega>>_TH, allLayers, outer_collar}] ; Entity NodesOf[ All ]; }
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
{% endif %}
|
|
1553
|
+
{% if USE_THERMAL_PROJECTION or dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D"%}
|
|
1554
|
+
{ Name Hgrad_T_artificial_dof; Type Scalar;
|
|
1555
|
+
BasisFunction {
|
|
1556
|
+
{ Name T_artificial; NameOfCoef T_artificial; Function BF_Node;
|
|
1557
|
+
Support Region[{{%if 'collar' in areas_to_build['EM']%}<<nc.omega>><<nc.collar>>_EM {% endif %}<<nc.omega>><<nc.powered>>_EM}] ; Entity NodesOf[ All ]; }
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
{% endif %}
|
|
1017
1561
|
|
|
1018
|
-
|
|
1019
|
-
{
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1562
|
+
{ Name Hcurl_a_Mag_2D; Type Form1P; // Magnetic vector potential a
|
|
1563
|
+
BasisFunction {
|
|
1564
|
+
{ Name se; NameOfCoef ae; Function BF_PerpendicularEdge;
|
|
1565
|
+
Support Region[{<<nc.omega>>_EM{%- if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}, allLayers, outer_collar{% endif %}}] ; Entity NodesOf[ All ]; }
|
|
1566
|
+
}
|
|
1567
|
+
Constraint {
|
|
1568
|
+
{ NameOfCoef ae; EntityType NodesOf;
|
|
1569
|
+
NameOfConstraint Dirichlet_a_Mag; }
|
|
1570
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' %}
|
|
1571
|
+
{ NameOfCoef ae; EntityType NodesOf;
|
|
1572
|
+
NameOfConstraint Init_from_Static; }
|
|
1573
|
+
{% endif %}
|
|
1574
|
+
}
|
|
1024
1575
|
}
|
|
1025
|
-
|
|
1026
|
-
{
|
|
1027
|
-
|
|
1576
|
+
{ Name Hregion_j_Mag_2D; Type Vector; // Electric current density js
|
|
1577
|
+
BasisFunction {
|
|
1578
|
+
{ Name sr; NameOfCoef jsr; Function BF_RegionZ;
|
|
1579
|
+
Support <<nc.omega>><<nc.powered>>_EM; Entity <<nc.omega>><<nc.powered>>_EM; }
|
|
1580
|
+
}
|
|
1581
|
+
{% if dm.circuit.field_circuit %}
|
|
1582
|
+
GlobalQuantity {
|
|
1583
|
+
{ Name I_mag; Type AliasOf; NameOfCoef jsr; }
|
|
1584
|
+
{ Name U_mag; Type AssociatedWith; NameOfCoef jsr; }
|
|
1585
|
+
}
|
|
1586
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' %}
|
|
1587
|
+
Constraint {
|
|
1588
|
+
{ NameOfCoef I_mag; EntityType Region;
|
|
1589
|
+
NameOfConstraint Init_from_Static; }
|
|
1590
|
+
{ NameOfCoef U_mag; EntityType Region;
|
|
1591
|
+
NameOfConstraint Init_from_Static; }
|
|
1592
|
+
}
|
|
1593
|
+
{% endif %}
|
|
1594
|
+
|
|
1595
|
+
{% else %}
|
|
1596
|
+
Constraint {
|
|
1597
|
+
{ NameOfCoef jsr; EntityType Region;
|
|
1598
|
+
NameOfConstraint SourceCurrentDensityZ; }
|
|
1599
|
+
}
|
|
1600
|
+
{% endif %}
|
|
1028
1601
|
}
|
|
1029
|
-
}
|
|
1030
1602
|
|
|
1031
|
-
{ Name Hregion_j_Mag_2D; Type Vector; // Electric current density js
|
|
1032
|
-
BasisFunction {
|
|
1033
|
-
{ Name sr; NameOfCoef jsr; Function BF_RegionZ;
|
|
1034
|
-
Support <<nc.omega>><<nc.powered>>_EM; Entity <<nc.omega>><<nc.powered>>_EM; }
|
|
1035
|
-
}
|
|
1036
|
-
Constraint {
|
|
1037
|
-
{ NameOfCoef jsr; EntityType Region;
|
|
1038
|
-
NameOfConstraint SourceCurrentDensityZ; }
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
1603
|
|
|
1042
|
-
|
|
1043
|
-
|
|
1604
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
1605
|
+
{ Name H_curl_a_artificial_dof; Type Form1P;
|
|
1044
1606
|
BasisFunction {
|
|
1045
|
-
|
|
1607
|
+
{ Name se_after_projection; NameOfCoef ae_after_projection; Function BF_PerpendicularEdge;
|
|
1046
1608
|
Support <<nc.omega>>_TH ; Entity NodesOf[ All ]; }
|
|
1047
1609
|
}
|
|
1048
|
-
// not needed since boundary is not part of <<nc.omega>>_TH
|
|
1049
1610
|
Constraint {
|
|
1050
|
-
{ NameOfCoef ae_after_projection; EntityType NodesOf;
|
|
1051
|
-
NameOfConstraint Dirichlet_a_projection; }
|
|
1052
1611
|
}
|
|
1053
|
-
|
|
1054
|
-
{% endif %}
|
|
1055
|
-
{% endif %}
|
|
1612
|
+
}
|
|
1056
1613
|
|
|
1057
|
-
{
|
|
1058
|
-
{ Name Hgrad_T; Type Form0;
|
|
1614
|
+
{ Name Hgrad_T; Type Form0;
|
|
1059
1615
|
BasisFunction {
|
|
1060
1616
|
{ Name un; NameOfCoef ui; Function BF_Node;
|
|
1061
|
-
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1062
|
-
Support Region[ <<nc.omega>>_TH
|
|
1617
|
+
{% if dm.magnet.geometry.thermal.use_TSA and not dm.magnet.geometry.thermal.use_TSA_new%}
|
|
1618
|
+
Support Region[ {<<nc.omega>>_TH {% if dm.magnet.solve.thermal.collar_cooling.enabled %}, bndCollarGaps {% endif %} } ];
|
|
1619
|
+
Entity NodesOf[All, Not allLayers];
|
|
1620
|
+
{% elif dm.magnet.geometry.thermal.use_TSA_new %}
|
|
1621
|
+
Support Region[ {<<nc.omega>>_TH {% if dm.magnet.solve.thermal.collar_cooling.enabled %}, bndCollarGaps {% endif %} } ];
|
|
1622
|
+
Entity NodesOf[All, Not {allLayers, inner_collar {% if 'poles' in areas_to_build['TH']%}, pole_bdry_lines {% endif %}} ];
|
|
1063
1623
|
{% else %}
|
|
1064
1624
|
Support Region[{<<nc.omega>>_TH, Bnds_support}] ; Entity NodesOf[All];
|
|
1065
1625
|
{% endif %}
|
|
@@ -1073,29 +1633,47 @@ FunctionSpace {
|
|
|
1073
1633
|
For i In {1:2}
|
|
1074
1634
|
For j In {1:2}
|
|
1075
1635
|
{ Name udn~{i}~{j}; NameOfCoef udi~{i}~{j}; Function BF_Node;
|
|
1076
|
-
Support Region[{midLayers~{i}~{j}, Domain_Insulated_Str~{i}~{j}}];
|
|
1077
|
-
Entity NodesOf[{midLayers~{i}~{j}, Bare_Layers~{i}~{j}}]; }
|
|
1636
|
+
Support Region[{midLayers~{i}~{j}, Domain_Insulated_Str~{i}~{j} {% if dm.magnet.geometry.thermal.use_TSA_new %}, midLayers_col~{i}~{j}, midLayers_pol~{i}~{j} {% endif %}}];
|
|
1637
|
+
Entity NodesOf[{midLayers~{i}~{j}, Bare_Layers~{i}~{j} {% if dm.magnet.geometry.thermal.use_TSA_new %}, midLayers_col~{i}~{j}, midLayers_pol~{i}~{j} {% endif %}}]; }
|
|
1078
1638
|
EndFor
|
|
1079
1639
|
EndFor
|
|
1080
1640
|
{% endif %}
|
|
1641
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
1642
|
+
{ Name udn_TSA_not_ht_side; NameOfCoef udi_TSA_not_ht; Function BF_Node;
|
|
1643
|
+
Support Region[{midLayers_col, inner_collar, <<nc.omega>><<nc.collar>>_TH {% if 'poles' in areas_to_build['TH'] %}, midLayers_pol, pole_bdry_lines, <<nc.omega>><<nc.poles>>_TH {% endif %}}]; // poles needed here for the one point disconnection, REMOVED FOR NOW: % if 'poles' in areas_to_build['TH'] %, <<nc.omega>><<nc.poles>>_TH % endif %
|
|
1644
|
+
Entity NodesOf[{midLayers_col, inner_collar {% if 'poles' in areas_to_build['TH'] %}, midLayers_pol, pole_bdry_lines {% endif %}}]; }
|
|
1645
|
+
{% endif %}
|
|
1081
1646
|
}
|
|
1082
1647
|
|
|
1083
1648
|
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1084
1649
|
SubSpace {
|
|
1085
1650
|
// "vertical" subspaces, up and down are connected via thin shell
|
|
1086
|
-
// vertical thin shells
|
|
1087
1651
|
{ Name Shell_Up_1; NameOfBasisFunction {udn_1_1, udn_1_2};}
|
|
1088
1652
|
{ Name Shell_Down_1; NameOfBasisFunction {udn_2_2, udn_2_1};}
|
|
1089
1653
|
|
|
1090
1654
|
// "horizontal" subspaces, up and down are connected via thin shell
|
|
1091
1655
|
{ Name Shell_Up_2; NameOfBasisFunction {udn_1_1, udn_2_1}; }
|
|
1092
1656
|
{ Name Shell_Down_2; NameOfBasisFunction {udn_2_2, udn_1_2}; }
|
|
1657
|
+
|
|
1658
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %}
|
|
1659
|
+
// add up and down for the new layer
|
|
1660
|
+
{ Name Shell_Up_collar_1; NameOfBasisFunction {}; }
|
|
1661
|
+
{ Name Shell_Down_collar_1; NameOfBasisFunction {};}
|
|
1662
|
+
{ Name Shell_Up_collar_2; NameOfBasisFunction {udn_1_2, udn_2_2, udn_1_1, udn_2_1 }; }
|
|
1663
|
+
{ Name Shell_Down_collar_2; NameOfBasisFunction {udn_TSA_not_ht_side};}
|
|
1664
|
+
{% if 'poles' in areas_to_build['TH'] %}
|
|
1665
|
+
{ Name Shell_Up_pole_1; NameOfBasisFunction {udn_1_2, udn_2_2, udn_1_1, udn_2_1 }; }
|
|
1666
|
+
{ Name Shell_Down_pole_1; NameOfBasisFunction {udn_TSA_not_ht_side};}
|
|
1667
|
+
{ Name Shell_Up_pole_2; NameOfBasisFunction {udn_1_2, udn_2_2, udn_1_1, udn_2_1 }; } // technically only two are needed here (not all four)
|
|
1668
|
+
{ Name Shell_Down_pole_2; NameOfBasisFunction {udn_TSA_not_ht_side};}
|
|
1669
|
+
{% endif %}
|
|
1670
|
+
{% endif %}
|
|
1093
1671
|
}
|
|
1094
1672
|
{% endif %}
|
|
1095
1673
|
|
|
1096
1674
|
Constraint {
|
|
1097
1675
|
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1098
|
-
For i In {1:2}
|
|
1676
|
+
For i In {1:2} // includes halfturns and shell lines
|
|
1099
1677
|
For j In {1:2}
|
|
1100
1678
|
{ NameOfCoef udi~{i}~{j}; EntityType NodesOf;
|
|
1101
1679
|
NameOfConstraint Temperature~{i}~{j}; }
|
|
@@ -1108,79 +1686,79 @@ FunctionSpace {
|
|
|
1108
1686
|
EndFor
|
|
1109
1687
|
EndFor
|
|
1110
1688
|
{% endif %}
|
|
1111
|
-
|
|
1112
|
-
|
|
1689
|
+
{% if dm.magnet.geometry.thermal.use_TSA_new %} // apply link + initial temperature on the collar+pole boundary lines
|
|
1690
|
+
{ NameOfCoef udi_TSA_not_ht; EntityType NodesOf; NameOfConstraint Temperature_TSA_sides; }
|
|
1691
|
+
{ NameOfCoef udi_TSA_not_ht; EntityType NodesOf; NameOfConstraint initTemp; }
|
|
1692
|
+
{% endif %}
|
|
1693
|
+
{NameOfCoef ui; EntityType NodesOf; NameOfConstraint initTemp; } // do not constraint second order basis function as it's already covered by ui
|
|
1113
1694
|
}
|
|
1114
1695
|
}
|
|
1115
1696
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1697
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1698
|
+
// virtual thermal shell layers
|
|
1699
|
+
For tsaGroup In {1: <<len(TSAinsulation_layers_number)>>}
|
|
1700
|
+
For i In {1:n_ele_per_tsa_group~{tsaGroup}-1}
|
|
1701
|
+
For j In {1:2} // horizontal vs vertical
|
|
1702
|
+
{ Name Hgrad_T~{i}~{j}~{tsaGroup}; Type Form0 ;
|
|
1121
1703
|
BasisFunction {
|
|
1122
|
-
{ Name sn~{i}~{j}~{
|
|
1123
|
-
Support intDomain~{j}~{
|
|
1704
|
+
{ Name sn~{i}~{j}~{tsaGroup}; NameOfCoef Tn~{i}~{j}~{tsaGroup} ; Function BF_Node ;
|
|
1705
|
+
Support intDomain~{j}~{tsaGroup} ; Entity NodesOf[ All ] ; }
|
|
1124
1706
|
}
|
|
1125
1707
|
Constraint {
|
|
1126
|
-
|
|
1127
|
-
{ NameOfCoef Tn~{i}~{j}~{
|
|
1708
|
+
{% if dm.magnet.mesh.thermal.isothermal_conductors %}
|
|
1709
|
+
{ NameOfCoef Tn~{i}~{j}~{tsaGroup}; EntityType NodesOf;
|
|
1128
1710
|
NameOfConstraint isothermal_lines~{j}; }
|
|
1129
|
-
|
|
1130
|
-
{ NameOfCoef Tn~{i}~{j}~{
|
|
1711
|
+
{% endif %}
|
|
1712
|
+
{ NameOfCoef Tn~{i}~{j}~{tsaGroup}; EntityType NodesOf;
|
|
1131
1713
|
NameOfConstraint initTemp; }
|
|
1132
1714
|
}
|
|
1133
1715
|
}
|
|
1134
1716
|
EndFor
|
|
1135
1717
|
EndFor
|
|
1136
|
-
|
|
1137
|
-
|
|
1718
|
+
EndFor
|
|
1719
|
+
{% endif %}
|
|
1138
1720
|
{% endif %}
|
|
1139
1721
|
}
|
|
1140
1722
|
|
|
1141
|
-
Jacobian {
|
|
1142
|
-
{% if dm.magnet.solve.electromagnetics.solve_type %}
|
|
1143
|
-
{ Name Jac_Vol_EM ;
|
|
1144
|
-
Case {
|
|
1145
|
-
{ Region <<nc.omega>><<nc.air_far_field>>_EM ;
|
|
1146
|
-
Jacobian VolSphShell {<<rm_EM.air_far_field.vol.radius_in>>, <<rm_EM.air_far_field.vol.radius_out>>} ; }
|
|
1147
|
-
{ Region All ; Jacobian Vol ; }
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
{% endif %}
|
|
1151
1723
|
|
|
1152
|
-
{
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1724
|
+
Jacobian {
|
|
1725
|
+
{ Name Jac_Vol_EM ;
|
|
1726
|
+
Case {
|
|
1727
|
+
{ Region <<nc.omega>><<nc.air_far_field>>_EM ;
|
|
1728
|
+
Jacobian VolSphShell {<<rm_EM.air_far_field.vol.radius_in>>, <<rm_EM.air_far_field.vol.radius_out>>} ; }
|
|
1729
|
+
{ Region All ; Jacobian Vol ; }
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
1733
|
+
{ Name Jac_Vol_TH ;
|
|
1734
|
+
Case {
|
|
1735
|
+
{ Region All ; Jacobian Vol ; }
|
|
1736
|
+
}
|
|
1156
1737
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1738
|
+
{ Name Jac_Sur_TH ;
|
|
1739
|
+
Case {
|
|
1740
|
+
{ Region All ; Jacobian Sur ; }
|
|
1741
|
+
}
|
|
1161
1742
|
}
|
|
1162
|
-
|
|
1163
|
-
{% endif %}
|
|
1743
|
+
{% endif %}
|
|
1164
1744
|
}
|
|
1165
1745
|
|
|
1166
1746
|
Integration {
|
|
1167
|
-
{
|
|
1168
|
-
{ Name Int_EM ;
|
|
1169
|
-
Case {
|
|
1170
|
-
{ Type Gauss ;
|
|
1747
|
+
{ Name Int_EM ;
|
|
1171
1748
|
Case {
|
|
1172
|
-
{
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1749
|
+
{ Type Gauss ;
|
|
1750
|
+
Case {
|
|
1751
|
+
{ GeoElement Point ; NumberOfPoints 1 ; }
|
|
1752
|
+
{ GeoElement Line ; NumberOfPoints 2 ; }
|
|
1753
|
+
{ GeoElement Triangle ; NumberOfPoints 3 ; }
|
|
1754
|
+
{ GeoElement Quadrangle ; NumberOfPoints 4 ; }
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1176
1757
|
}
|
|
1177
|
-
}
|
|
1178
1758
|
}
|
|
1179
|
-
}
|
|
1180
|
-
{% endif %}
|
|
1181
1759
|
|
|
1182
|
-
{% if dm.magnet.solve.thermal.solve_type %}
|
|
1183
|
-
|
|
1760
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
1761
|
+
{ Name Int_line_TH ;
|
|
1184
1762
|
Case {
|
|
1185
1763
|
{ Type Gauss ;
|
|
1186
1764
|
Case {
|
|
@@ -1188,20 +1766,9 @@ Integration {
|
|
|
1188
1766
|
}
|
|
1189
1767
|
}
|
|
1190
1768
|
}
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
{ Name Int_conducting_TH ;
|
|
1194
|
-
Case {
|
|
1195
|
-
{ Type Gauss ;
|
|
1196
|
-
Case {
|
|
1197
|
-
{ GeoElement Triangle ; NumberOfPoints 3 ; }
|
|
1198
|
-
{ GeoElement Quadrangle ; NumberOfPoints 4 ; }
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
1769
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
{ Name Int_insulating_TH ;
|
|
1770
|
+
|
|
1771
|
+
{ Name Int_TH ;
|
|
1205
1772
|
Case {
|
|
1206
1773
|
{ Type Gauss ;
|
|
1207
1774
|
Case {
|
|
@@ -1210,607 +1777,1440 @@ Integration {
|
|
|
1210
1777
|
}
|
|
1211
1778
|
}
|
|
1212
1779
|
}
|
|
1213
|
-
|
|
1214
|
-
{% endif %}
|
|
1780
|
+
}
|
|
1781
|
+
{% endif %}
|
|
1215
1782
|
}
|
|
1216
1783
|
|
|
1217
1784
|
Formulation {
|
|
1218
|
-
{% if
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1785
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_sta' or SIM_MODE == 'Th_Mag_sta' %}
|
|
1786
|
+
{ Name Magnetostatics_a_2D; Type FemEquation;
|
|
1787
|
+
Quantity {
|
|
1788
|
+
{ Name a ; Type Local; NameOfSpace Hcurl_a_Mag_2D; }
|
|
1789
|
+
{ Name is; Type Local; NameOfSpace Hregion_j_Mag_2D; }
|
|
1790
|
+
{% if dm.circuit.field_circuit %}
|
|
1791
|
+
{ Name I_mag; Type Global; NameOfSpace Hregion_j_Mag_2D[I_mag]; }
|
|
1792
|
+
{ Name U_mag; Type Global; NameOfSpace Hregion_j_Mag_2D[U_mag]; }
|
|
1793
|
+
{ Name Iz; Type Global; NameOfSpace CircuitSpace[Iz]; }
|
|
1794
|
+
{ Name Uz; Type Global; NameOfSpace CircuitSpace[Uz]; }
|
|
1795
|
+
{% endif %}
|
|
1796
|
+
}
|
|
1797
|
+
Equation {
|
|
1798
|
+
Integral { [ nu[{d a}] * Dof{d a} , {d a} ];
|
|
1799
|
+
In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1800
|
+
|
|
1801
|
+
{% if 'iron_yoke' in areas_to_build['EM'] %}
|
|
1802
|
+
Integral { JacNL[ dnu_db[{d a}] * Dof{d a} , {d a} ];
|
|
1803
|
+
In <<nc.omega>><<nc.iron_yoke>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1804
|
+
{% endif %}
|
|
1805
|
+
Integral { [ -Dof{is}{% if not dm.circuit.field_circuit %}*sign_fct[]{% endif %}/area_fct[], {a} ];
|
|
1806
|
+
In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1807
|
+
{% if SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' or SIM_MODE == 'Mag_sta' %}
|
|
1808
|
+
Integral { [ resistivity[<<dm.magnet.solve.electromagnetics.time_stepping.T_sim>>,Norm[{d a}],Abs[CompZ[{is}]]]* Dof{is} , {is} ]; // Resistive Term
|
|
1809
|
+
{% else %}
|
|
1810
|
+
Integral { [resistivity[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]* Dof{is} , {is} ]; // Resistive Term
|
|
1811
|
+
{% endif %}
|
|
1812
|
+
In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1813
|
+
|
|
1814
|
+
{% if dm.circuit.field_circuit %}
|
|
1815
|
+
GlobalTerm {[-Dof{U_mag} , {I_mag}] ; In Omega_p_EM_r ; }
|
|
1816
|
+
GlobalTerm {[Dof{U_mag} , {I_mag}] ; In Omega_p_EM_l ; }
|
|
1817
|
+
// U = L dI/dt in inductive elements
|
|
1818
|
+
{% if flag_active['L']==1 %}
|
|
1819
|
+
GlobalTerm {DtDof[L[] * Dof{Iz}, {Iz}] ; In Omega_inductance ; }
|
|
1820
|
+
GlobalTerm {[ -Dof{Uz} , {Iz}] ; In Omega_inductance; }
|
|
1821
|
+
{% endif %}
|
|
1822
|
+
|
|
1823
|
+
// U = R I in resistive elements
|
|
1824
|
+
{% if flag_active['R']==1 %}
|
|
1825
|
+
GlobalTerm {NeverDt[R[] * Dof{Iz}, {Iz}] ; In Omega_resistance ; }
|
|
1826
|
+
GlobalTerm {NeverDt[-Dof{Uz} , {Iz}] ; In Omega_resistance ; }
|
|
1827
|
+
{% endif %}
|
|
1828
|
+
|
|
1829
|
+
// Switch
|
|
1830
|
+
{% if flag_active['SW']==1 %}
|
|
1831
|
+
GlobalTerm {NeverDt[ Coef_switch[]*Dof{Uz}/R[], {Iz}] ; In Omega_switch ; }
|
|
1832
|
+
GlobalTerm {NeverDt[-Dof{Iz} , {Iz}] ; In Omega_switch ; }
|
|
1833
|
+
{% endif %}
|
|
1834
|
+
|
|
1835
|
+
// U = R(I) I in varistor elements
|
|
1836
|
+
{% if flag_active['V']==1 %}
|
|
1837
|
+
GlobalTerm {NeverDt[R[{Iz}]*Dof{Iz}, {Iz}] ; In Omega_varistor ; }
|
|
1838
|
+
GlobalTerm {NeverDt[-Dof{Uz} , {Iz}] ; In Omega_varistor ; }
|
|
1839
|
+
{% endif %}
|
|
1840
|
+
|
|
1841
|
+
// U = R(I) I in diode elements
|
|
1842
|
+
{% if flag_active['D']==1 %}
|
|
1843
|
+
GlobalTerm { NeverDt[ R[{Iz}] * Dof{Iz} , {Iz} ]; In Omega_diode; }
|
|
1844
|
+
GlobalTerm { NeverDt[ -Dof{Uz} , {Iz} ]; In Omega_diode; }
|
|
1845
|
+
{% endif %}
|
|
1846
|
+
|
|
1847
|
+
// U = R(I) I in thyristor elements (Same as diode but with switch)
|
|
1848
|
+
{% if flag_active['Th']==1 %}
|
|
1849
|
+
GlobalTerm { NeverDt[ R[{Iz}] * Dof{Iz} , {Iz} ]; In Omega_thyristor; }
|
|
1850
|
+
GlobalTerm { NeverDt[ -Dof{Uz} , {Iz} ]; In Omega_thyristor; }
|
|
1851
|
+
{% endif %}
|
|
1852
|
+
|
|
1853
|
+
// I = C dU/dt Capacitive elements
|
|
1854
|
+
{% if flag_active['C']==1 %}
|
|
1855
|
+
GlobalTerm{ DtDof[ C[] * Dof{Uz}, {Iz} ]; In Omega_capacitance; }
|
|
1856
|
+
GlobalTerm{ NeverDt[ -Dof{Iz} , {Iz} ]; In Omega_capacitance; }
|
|
1857
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Mag_sta'%}
|
|
1858
|
+
{% if flag_active["CLIQ"] %}
|
|
1859
|
+
GlobalTerm{ [ <<dm.quench_protection.cliq.U0>>, {Iz} ]; In Omega_CLIQ_C; }
|
|
1860
|
+
GlobalTerm{ [ -Dof{Uz} , {Iz} ]; In Omega_CLIQ_C; }
|
|
1861
|
+
{% endif %}
|
|
1862
|
+
{% if flag_active["ESC"] %}
|
|
1863
|
+
{%for i in range(ESC_dict["Units"])%}
|
|
1864
|
+
GlobalTerm{ [ <<dm.quench_protection.esc.U0[i]>>, {Iz} ]; In Region[{<<'Omega_ESC_C1_'~(i+1)>>,<<'Omega_ESC_C2_'~(i+1)>>}]; }
|
|
1865
|
+
GlobalTerm{ [ -Dof{Uz} , {Iz} ]; In Region[{<<'Omega_ESC_C1_'~(i+1)>>,<<'Omega_ESC_C2_'~(i+1)>>}]; }
|
|
1227
1866
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1867
|
+
{% endfor %}
|
|
1868
|
+
{% endif %}
|
|
1869
|
+
{% endif %}
|
|
1870
|
+
{% endif %}
|
|
1871
|
+
|
|
1872
|
+
GlobalTerm { [0 * Dof{Uz} , {Iz}] ; In Omega_circuit; }
|
|
1873
|
+
GlobalTerm { [0 * Dof{Iz} , {Iz}] ; In Omega_circuit; }
|
|
1874
|
+
GlobalEquation{
|
|
1875
|
+
Type Network; NameOfConstraint ElectricalCircuit;
|
|
1876
|
+
{ Node {I_mag}; Loop {U_mag}; Equation {U_mag}; In <<nc.omega>><<nc.powered>>_EM; }
|
|
1877
|
+
{ Node {Iz}; Loop {Uz}; Equation {Uz}; In Omega_circuit; }
|
|
1878
|
+
}
|
|
1879
|
+
{% endif %}
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1231
1882
|
{% endif %}
|
|
1883
|
+
{% if SIM_MODE != 'Mag_sta' and SIM_MODE != 'Th_Mag_sta' %}
|
|
1884
|
+
{ Name Magnetodynamics_a_2D; Type FemEquation;
|
|
1885
|
+
Quantity {
|
|
1886
|
+
{ Name a ; Type Local; NameOfSpace Hcurl_a_Mag_2D; }
|
|
1887
|
+
{ Name is; Type Local; NameOfSpace Hregion_j_Mag_2D; }
|
|
1888
|
+
{% if dm.circuit.field_circuit %}
|
|
1889
|
+
{ Name I_mag; Type Global; NameOfSpace Hregion_j_Mag_2D[I_mag]; }
|
|
1890
|
+
{ Name U_mag; Type Global; NameOfSpace Hregion_j_Mag_2D[U_mag]; }
|
|
1891
|
+
{ Name Iz; Type Global; NameOfSpace CircuitSpace[Iz]; }
|
|
1892
|
+
{ Name Uz; Type Global; NameOfSpace CircuitSpace[Uz]; }
|
|
1893
|
+
{% endif %}
|
|
1894
|
+
}
|
|
1895
|
+
Equation {
|
|
1896
|
+
Integral { [ nu[{d a}] * Dof{d a} , {d a} ];
|
|
1897
|
+
In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1898
|
+
|
|
1899
|
+
{% if 'iron_yoke' in areas_to_build['EM'] %}
|
|
1900
|
+
Integral { JacNL[ dnu_db[{d a}] * Dof{d a} , {d a} ];
|
|
1901
|
+
In <<nc.omega>><<nc.iron_yoke>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1902
|
+
{% endif %}
|
|
1903
|
+
Integral { [ -Dof{is}{% if not dm.circuit.field_circuit %}*sign_fct[]{% endif %}/area_fct[], {a} ];
|
|
1904
|
+
In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1905
|
+
{% if SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
1906
|
+
Integral { [ resistivity[<<dm.magnet.solve.electromagnetics.time_stepping.T_sim>>,Norm[{d a}],Abs[CompZ[{is}]]]* Dof{is} , {is} ]; // Resistive Term
|
|
1907
|
+
{% else %}
|
|
1908
|
+
Integral { [resistivity[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]* Dof{is} , {is} ]; // Resistive Term
|
|
1909
|
+
{% endif %}
|
|
1910
|
+
In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1911
|
+
/*
|
|
1912
|
+
// @emma: removed voltage response of cable
|
|
1913
|
+
// final formulation:
|
|
1914
|
+
// DISCC --> inter-strand coupling effects, ROHM -> Strand-level respose to applied field, ROHF --> Strand-level response to transport current
|
|
1915
|
+
// --> P in W/m^3, M in A/m, U in V
|
|
1916
|
+
*/
|
|
1917
|
+
{% if 'collar' in areas_to_build['EM'] and dm.magnet.solve.collar.transient_effects_enabled %}
|
|
1918
|
+
{% if USE_THERMAL_PROJECTION %}
|
|
1919
|
+
Integral { DtDof [ 1.0/rho[GetVariable[ElementNum[], QuadraturePointIndex[]]{$T_a_collar}]*Dof{a} , {a} ]; // inductive response of eddy currents in the collar
|
|
1920
|
+
In <<nc.omega>><<nc.collar>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1921
|
+
{% else %}
|
|
1922
|
+
Integral { DtDof [ 1.0/rho[<<dm.magnet.solve.thermal.init_temperature>>]*Dof{a} , {a} ]; // inductive response of eddy currents in the collar
|
|
1923
|
+
In <<nc.omega>><<nc.collar>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1924
|
+
{% endif %}
|
|
1925
|
+
{% endif %}
|
|
1926
|
+
{% if 'poles' in areas_to_build['EM'] and dm.magnet.solve.poles.transient_effects_enabled %}
|
|
1927
|
+
Integral { DtDof [ 1.0/rho[<<dm.magnet.solve.thermal.init_temperature>>]*Dof{a} , {a} ]; // inductive response of eddy currents in the poles
|
|
1928
|
+
In <<nc.omega>><<nc.poles>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1929
|
+
{% endif %}
|
|
1232
1930
|
|
|
1233
|
-
|
|
1234
|
-
|
|
1931
|
+
{% if dm.magnet.geometry.thermal.with_wedges and dm.magnet.solve.wedges.transient_effects_enabled %}
|
|
1932
|
+
Integral { DtDof [ 1.0/rho[T_EM_fct[], Norm[{d a}]]*Dof{a} , {a} ]; // inductive response of eddy currents in the wedges
|
|
1933
|
+
In Region [{<<nc.omega>><<nc.induced>>_EM}]; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
1934
|
+
{% endif %}
|
|
1935
|
+
/*
|
|
1936
|
+
// DEBUG: init_temperature is to be replaced with the temperature T, but for this we need a projection TH -> EM. This is not possible in the collar region due to an interpolation error in getdp.
|
|
1937
|
+
// 1. we could use the average temperature as an approximation -> see USE_THERMAL_PROJECTION
|
|
1938
|
+
// 2. we could assume the temperature doesn't change much so we can use the initial temperature (no projection)
|
|
1939
|
+
*/
|
|
1940
|
+
|
|
1941
|
+
{% if dm.circuit.field_circuit %}
|
|
1942
|
+
|
|
1943
|
+
GlobalTerm {[-Dof{U_mag} , {I_mag}] ; In Omega_p_EM_r ; }
|
|
1944
|
+
GlobalTerm {[Dof{U_mag} , {I_mag}] ; In Omega_p_EM_l ; }
|
|
1945
|
+
|
|
1946
|
+
// U = L dI/dt in inductive elements
|
|
1947
|
+
{% if flag_active['L']==1 %}
|
|
1948
|
+
GlobalTerm {DtDof[L[] * Dof{Iz}, {Iz}] ; In Omega_inductance ; }
|
|
1949
|
+
GlobalTerm {[ -Dof{Uz} , {Iz}] ; In Omega_inductance; }
|
|
1950
|
+
{% endif %}
|
|
1951
|
+
|
|
1952
|
+
// U = R I in resistive elements
|
|
1953
|
+
{% if flag_active['R']==1 %}
|
|
1954
|
+
GlobalTerm {NeverDt[R[] * Dof{Iz}, {Iz}] ; In Omega_resistance ; }
|
|
1955
|
+
GlobalTerm {NeverDt[-Dof{Uz} , {Iz}] ; In Omega_resistance ; }
|
|
1956
|
+
{% endif %}
|
|
1957
|
+
|
|
1958
|
+
// Switch
|
|
1959
|
+
{% if flag_active['SW']==1 %}
|
|
1960
|
+
GlobalTerm {NeverDt[ Coef_switch[]*Dof{Uz}/R[], {Iz}] ; In Omega_switch ; }
|
|
1961
|
+
GlobalTerm {NeverDt[-Dof{Iz} , {Iz}] ; In Omega_switch ; }
|
|
1962
|
+
{% endif %}
|
|
1963
|
+
|
|
1964
|
+
// U = R(I) I in varistor elements
|
|
1965
|
+
{% if flag_active['V']==1 %}
|
|
1966
|
+
GlobalTerm {NeverDt[R[{Iz}]*Dof{Iz}, {Iz}] ; In Omega_varistor ; }
|
|
1967
|
+
GlobalTerm {NeverDt[-Dof{Uz} , {Iz}] ; In Omega_varistor ; }
|
|
1968
|
+
{% endif %}
|
|
1969
|
+
|
|
1970
|
+
// U = R(I) I in diode elements
|
|
1971
|
+
{% if flag_active['D']==1 %}
|
|
1972
|
+
GlobalTerm { NeverDt[ R[{Iz}] * Dof{Iz} , {Iz} ]; In Omega_diode; }
|
|
1973
|
+
GlobalTerm { NeverDt[ -Dof{Uz} , {Iz} ]; In Omega_diode; }
|
|
1974
|
+
{% endif %}
|
|
1975
|
+
|
|
1976
|
+
// U = R(I) I in thyristor elements (Same as diode but with switch)
|
|
1977
|
+
{% if flag_active['Th']==1 %}
|
|
1978
|
+
GlobalTerm { NeverDt[ R[{Iz}] * Dof{Iz} , {Iz} ]; In Omega_thyristor; }
|
|
1979
|
+
GlobalTerm { NeverDt[ -Dof{Uz} , {Iz} ]; In Omega_thyristor; }
|
|
1980
|
+
{% endif %}
|
|
1981
|
+
|
|
1982
|
+
// I = C dU/dt Capacitive elements
|
|
1983
|
+
{% if flag_active['C']==1 %}
|
|
1984
|
+
GlobalTerm{ DtDof[ C[] * Dof{Uz}, {Iz} ]; In Omega_capacitance; }
|
|
1985
|
+
GlobalTerm{ NeverDt[ -Dof{Iz} , {Iz} ]; In Omega_capacitance; }
|
|
1986
|
+
{% endif %}
|
|
1987
|
+
|
|
1988
|
+
GlobalTerm { [0 * Dof{Uz} , {Iz}] ; In Omega_circuit; }
|
|
1989
|
+
GlobalTerm { [0 * Dof{Iz} , {Iz}] ; In Omega_circuit; }
|
|
1990
|
+
GlobalEquation{
|
|
1991
|
+
Type Network; NameOfConstraint ElectricalCircuit;
|
|
1992
|
+
{ Node {I_mag}; Loop {U_mag}; Equation {U_mag}; In <<nc.omega>><<nc.powered>>_EM; }
|
|
1993
|
+
{ Node {Iz}; Loop {Uz}; Equation {Uz}; In Omega_circuit; }
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
|
|
1997
|
+
{% endif %}
|
|
1998
|
+
}
|
|
1235
1999
|
}
|
|
1236
|
-
|
|
2000
|
+
{% endif %}
|
|
1237
2001
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
2002
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
2003
|
+
// Dummy formulation just to save the values of the norm of B from the EM mesh on the Gaussian points of
|
|
2004
|
+
// the thermal mesh. Alternatively, a Galerkin projection could be used.
|
|
2005
|
+
{ Name Projection_EM_to_TH; Type FemEquation;
|
|
2006
|
+
Quantity {
|
|
2007
|
+
{Name a_before_projection; Type Local; NameOfSpace Hcurl_a_Mag_2D; }
|
|
2008
|
+
{Name a_after_projection; Type Local; NameOfSpace H_curl_a_after_projection; }
|
|
2009
|
+
}
|
|
2010
|
+
Equation {
|
|
2011
|
+
// HT + Wedge + collar/poles etc
|
|
2012
|
+
Integral { [ - SetVariable[{d a_before_projection}, ElementNum[], QuadraturePointIndex[]]{$b_before_projection}, {d a_after_projection} ];
|
|
2013
|
+
In <<nc.omega>>_noninsulation_areas_TH; Integration Int_TH; Jacobian Jac_Vol_TH; }
|
|
2014
|
+
Integral { [ Dof{d a_after_projection}, {d a_after_projection} ];
|
|
2015
|
+
In <<nc.omega>>_noninsulation_areas_TH; Integration Int_TH; Jacobian Jac_Vol_TH; }
|
|
2016
|
+
|
|
2017
|
+
Integral { [ - {a_before_projection}, {a_after_projection} ];
|
|
2018
|
+
In Region[{allLayers, outer_collar}]; Integration Int_line_TH; Jacobian Jac_Sur_TH; }
|
|
2019
|
+
|
|
2020
|
+
Integral { [ Dof{a_after_projection}, {a_after_projection} ];
|
|
2021
|
+
In Region[{allLayers, outer_collar}]; Integration Int_line_TH; Jacobian Jac_Sur_TH; }
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
{% if USE_THERMAL_PROJECTION %}
|
|
2025
|
+
{ Name Projection_TH_to_EM; Type FemEquation;
|
|
2026
|
+
Quantity {
|
|
2027
|
+
{ Name T; Type Local; NameOfSpace Hgrad_T; }
|
|
2028
|
+
{ Name T_artificial_dof; Type Local; NameOfSpace Hgrad_T_artificial_dof; }
|
|
2029
|
+
}
|
|
2030
|
+
Equation {
|
|
2031
|
+
Integral { [ - SetVariable[$T_a_col, ElementNum[], QuadraturePointIndex[]]{$T_a_collar}, {T_artificial_dof} ];
|
|
2032
|
+
In <<nc.omega>><<nc.collar>>_EM; Integration Int_EM; Jacobian Jac_Vol_EM; }
|
|
2033
|
+
Integral { [ Dof{T_artificial_dof}, {T_artificial_dof} ];
|
|
2034
|
+
In <<nc.omega>><<nc.collar>>_EM; Integration Int_EM; Jacobian Jac_Vol_EM; }
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
{% endif %}
|
|
2038
|
+
{% if dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D" %}
|
|
2039
|
+
{ Name Quench_Prop_TH; Type FemEquation;
|
|
2040
|
+
Quantity {
|
|
2041
|
+
{Name a_before_projection; Type Local; NameOfSpace Hcurl_a_Mag_2D; }
|
|
2042
|
+
{Name a_artificial_dof; Type Local; NameOfSpace H_curl_a_artificial_dof; }
|
|
2043
|
+
{Name T; Type Local; NameOfSpace Hgrad_T; }
|
|
2044
|
+
}
|
|
2045
|
+
Equation {
|
|
2046
|
+
|
|
2047
|
+
Integral { [ - SetVariable[GetVariable[ElementNum[], QuadraturePointIndex[]]{$Quench_ratio_TH} + NZ[{T},0,I2TH_fct[]] , ElementNum[], QuadraturePointIndex[]]{$Quench_ratio_TH}, {d a_artificial_dof} ];
|
|
2048
|
+
In <<nc.omega>><<nc.powered>>_TH; Integration Int_TH; Jacobian Jac_Vol_TH; }
|
|
2049
|
+
Integral { [ Dof{a_artificial_dof}, {a_artificial_dof} ];
|
|
2050
|
+
In <<nc.omega>><<nc.powered>>_TH; Integration Int_TH; Jacobian Jac_Vol_TH; }
|
|
2051
|
+
}
|
|
1245
2052
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
2053
|
+
{ Name Quench_Prop_EM; Type FemEquation;
|
|
2054
|
+
Quantity {
|
|
2055
|
+
{Name T_artificial_dof; Type Local; NameOfSpace Hgrad_T_artificial_dof; }
|
|
2056
|
+
{Name a; Type Local; NameOfSpace Hcurl_a_Mag_2D; }
|
|
2057
|
+
{ Name is; Type Local; NameOfSpace Hregion_j_Mag_2D; }
|
|
2058
|
+
}
|
|
2059
|
+
Equation {
|
|
2060
|
+
Integral { [ - SetVariable[ GetVariable[ElementNum[], QuadraturePointIndex[]]{$Quench_ratio_EM} + NZ[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]] , ElementNum[], QuadraturePointIndex[]]{$Quench_ratio_EM}, {d T_artificial_dof} ];
|
|
2061
|
+
In <<nc.omega>><<nc.powered>>_EM; Integration Int_EM; Jacobian Jac_Vol_EM; }
|
|
1249
2062
|
|
|
1250
|
-
Integral { [ Dof{
|
|
1251
|
-
|
|
2063
|
+
Integral { [ Dof{T_artificial_dof}, {T_artificial_dof} ];
|
|
2064
|
+
In <<nc.omega>><<nc.powered>>_EM; Integration Int_EM; Jacobian Jac_Vol_EM; }
|
|
2065
|
+
}
|
|
1252
2066
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
{% endif %}
|
|
2067
|
+
{% endif %}
|
|
2068
|
+
{% endif %}
|
|
1256
2069
|
|
|
1257
|
-
{% if dm.magnet.solve.thermal.solve_type %}
|
|
1258
|
-
|
|
1259
|
-
|
|
2070
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
2071
|
+
{ Name Thermal_T; Type FemEquation;
|
|
2072
|
+
Quantity {
|
|
1260
2073
|
// cont temperature
|
|
1261
2074
|
{ Name T; Type Local; NameOfSpace Hgrad_T; }
|
|
1262
|
-
|
|
2075
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
1263
2076
|
For j In {1:2} // "vertical" and "horizontal" separated
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
2077
|
+
For tsaGroup In {1:<<len(TSAinsulation_layers_number)>>}
|
|
2078
|
+
If (tsaGroup < <<len(rm_TH.thin_shells.insulation_types.layers_number + rm_TH.thin_shells.quench_heaters.layers_number)+1>>)
|
|
2079
|
+
// TSA + QH
|
|
2080
|
+
{ Name Ti~{0}~{j}~{tsaGroup}; Type Local;
|
|
2081
|
+
NameOfSpace Hgrad_T[Shell_Up~{j}]; } // outer temp up
|
|
2082
|
+
For i In {1:n_ele_per_tsa_group~{tsaGroup}-1}
|
|
2083
|
+
{ Name Ti~{i}~{j}~{tsaGroup} ; Type Local ;
|
|
2084
|
+
NameOfSpace Hgrad_T~{i}~{j}~{tsaGroup}; } // auxiliary shells in between
|
|
2085
|
+
EndFor
|
|
2086
|
+
{ Name Ti~{n_ele_per_tsa_group~{tsaGroup}}~{j}~{tsaGroup}; Type Local;
|
|
2087
|
+
NameOfSpace Hgrad_T[Shell_Down~{j}]; } //outer temp down
|
|
2088
|
+
ElseIf (tsaGroup < <<len(rm_TH.thin_shells.insulation_types.layers_number + rm_TH.thin_shells.quench_heaters.layers_number + rm_TH.thin_shells.collar.layers_number )+1>>)
|
|
2089
|
+
// collar
|
|
2090
|
+
{ Name Ti~{0}~{j}~{tsaGroup}; Type Local;
|
|
2091
|
+
NameOfSpace Hgrad_T[Shell_Up_collar~{j}]; }
|
|
2092
|
+
For i In {1:n_ele_per_tsa_group~{tsaGroup}-1}
|
|
2093
|
+
{ Name Ti~{i}~{j}~{tsaGroup} ; Type Local ;
|
|
2094
|
+
NameOfSpace Hgrad_T~{i}~{j}~{tsaGroup}; }
|
|
2095
|
+
EndFor
|
|
2096
|
+
{ Name Ti~{n_ele_per_tsa_group~{tsaGroup}}~{j}~{tsaGroup}; Type Local;
|
|
2097
|
+
NameOfSpace Hgrad_T[Shell_Down_collar~{j}]; }
|
|
2098
|
+
Else
|
|
2099
|
+
// pole thin shell lines
|
|
2100
|
+
{ Name Ti~{0}~{j}~{tsaGroup}; Type Local;
|
|
2101
|
+
NameOfSpace Hgrad_T[Shell_Up_pole~{j}]; }
|
|
2102
|
+
For i In {1:n_ele_per_tsa_group~{tsaGroup}-1}
|
|
2103
|
+
{ Name Ti~{i}~{j}~{tsaGroup} ; Type Local ;
|
|
2104
|
+
NameOfSpace Hgrad_T~{i}~{j}~{tsaGroup}; }
|
|
2105
|
+
EndFor
|
|
2106
|
+
{ Name Ti~{n_ele_per_tsa_group~{tsaGroup}}~{j}~{tsaGroup}; Type Local;
|
|
2107
|
+
NameOfSpace Hgrad_T[Shell_Down_pole~{j}]; }
|
|
2108
|
+
EndIf
|
|
2109
|
+
EndFor
|
|
1278
2110
|
EndFor
|
|
1279
|
-
{% endif %}
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
Equation {
|
|
1283
|
-
{% if dm.magnet.solve.electromagnetics.solve_type %}
|
|
1284
|
-
Integral { [ kappa[{T}, GetVariable[ElementNum[], QuadraturePointIndex[]]{$Bnorm}] * Dof{d T} , {d T} ] ;
|
|
1285
|
-
In Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_iron_yoke %}, <<nc.omega>><<nc.iron>>{% endif %}{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %} } ]; Integration Int_conducting_TH ; Jacobian Jac_Vol_TH ; }
|
|
1286
|
-
{% else %}
|
|
1287
|
-
Integral { [ kappa[{T}] * Dof{d T} , {d T} ] ;
|
|
1288
|
-
In Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_iron_yoke %}, <<nc.omega>><<nc.iron>>{% endif %}{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %} } ]; Integration Int_conducting_TH ; Jacobian Jac_Vol_TH ; }
|
|
1289
|
-
{% endif %}
|
|
1290
|
-
|
|
1291
|
-
{% if dm.magnet.solve.electromagnetics.solve_type %}
|
|
1292
|
-
Integral { DtDof[ heatCap[{T}, GetVariable[ElementNum[], QuadraturePointIndex[]]{$Bnorm}] * Dof{T}, {T} ];
|
|
1293
|
-
In Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_iron_yoke %}, <<nc.omega>><<nc.iron>>{% endif %}{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %} } ]; Integration Int_conducting_TH; Jacobian Jac_Vol_TH; }
|
|
1294
|
-
{% else %}
|
|
1295
|
-
Integral { DtDof[ heatCap[{T}] * Dof{T}, {T} ];
|
|
1296
|
-
In Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_iron_yoke %}, <<nc.omega>><<nc.iron>>{% endif %}{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %} } ]; Integration Int_conducting_TH; Jacobian Jac_Vol_TH; }
|
|
1297
|
-
{% endif %}
|
|
1298
|
-
|
|
1299
|
-
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
1300
|
-
{% if dm.magnet.solve.electromagnetics.solve_type %}
|
|
1301
|
-
Integral { [ kappa[{T}, GetVariable[ElementNum[], QuadraturePointIndex[]]{$Bnorm}] * Dof{d T} , {d T} ] ;
|
|
1302
|
-
In <<nc.omega>><<nc.insulator>>_TH; Integration Int_insulating_TH ; Jacobian Jac_Vol_TH ; }
|
|
1303
|
-
{% else %}
|
|
1304
|
-
Integral { [ kappa[{T}] * Dof{d T} , {d T} ] ;
|
|
1305
|
-
In <<nc.omega>><<nc.insulator>>_TH; Integration Int_insulating_TH ; Jacobian Jac_Vol_TH ; }
|
|
1306
2111
|
{% endif %}
|
|
2112
|
+
{ Name a_after_projection; Type Local; NameOfSpace H_curl_a_after_projection; }
|
|
2113
|
+
}
|
|
2114
|
+
Equation {
|
|
2115
|
+
Integral { [ kappa[{T}, Norm[{d a_after_projection}]] * Dof{d T} , {d T} ] ;
|
|
2116
|
+
In Region[ {<<nc.omega>>_TH } ]; Integration Int_TH ; Jacobian Jac_Vol_TH ; }
|
|
2117
|
+
|
|
2118
|
+
Integral { DtDof[ heatCap[{T}, Norm[{d a_after_projection}]] * Dof{T}, {T} ];
|
|
2119
|
+
In Region[ {<<nc.omega>>_TH } ]; Integration Int_TH; Jacobian Jac_Vol_TH; }
|
|
2120
|
+
|
|
2121
|
+
// power density
|
|
2122
|
+
Integral { [ - jouleLosses[{T}, Norm[{d a_after_projection}],I2TH_fct[]], {T}];
|
|
2123
|
+
In <<nc.omega>><<nc.powered>>_TH; Integration Int_TH; Jacobian Jac_Vol_TH; }
|
|
2124
|
+
{% if dm.magnet.solve.collar.transient_effects_enabled and 'collar' in areas_to_build['TH'] %}
|
|
2125
|
+
Integral { [pre_eddy[]* -1.0/rho[{T}] * SquNorm[Dt[CompZ[{a_after_projection}]]], {T} ]; // eddy current losses in collar
|
|
2126
|
+
In <<nc.omega>><<nc.collar>>_TH; Jacobian Jac_Vol_TH; Integration Int_TH; }
|
|
2127
|
+
{% endif %}
|
|
2128
|
+
{% if dm.magnet.solve.poles.transient_effects_enabled and 'poles' in areas_to_build['TH'] %}
|
|
2129
|
+
Integral { [pre_eddy[]* -1.0/rho[{T}] * SquNorm[Dt[CompZ[{a_after_projection}]]], {T} ]; // eddy current losses in the poles
|
|
2130
|
+
In <<nc.omega>><<nc.poles>>_TH; Jacobian Jac_Vol_TH; Integration Int_TH; }
|
|
2131
|
+
{% endif %}
|
|
1307
2132
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
In <<nc.omega>><<nc.insulator>>_TH; Integration Int_insulating_TH; Jacobian Jac_Vol_TH; }
|
|
1311
|
-
{% else %}
|
|
1312
|
-
Integral { DtDof[ heatCap[{T}] * Dof{T}, {T} ];
|
|
1313
|
-
In <<nc.omega>><<nc.insulator>>_TH; Integration Int_insulating_TH; Jacobian Jac_Vol_TH; }
|
|
1314
|
-
{% endif %}
|
|
1315
|
-
{% endif %}
|
|
2133
|
+
Integral { [ pre_eddy[]*-1.0/rho[{T}, Norm[{d a_after_projection}]] * SquNorm[Dt[CompZ[{a_after_projection}]]], {T} ]; // eddy current losses in the coils DEBUG ALWAYS ENABLED
|
|
2134
|
+
In <<nc.omega>><<nc.powered>>_TH; Jacobian Jac_Vol_TH; Integration Int_TH; }
|
|
1316
2135
|
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
2136
|
+
{% if dm.magnet.geometry.thermal.with_wedges and dm.magnet.solve.wedges.transient_effects_enabled %}
|
|
2137
|
+
Integral { [pre_eddy[]* -1.0/rho[{T}, Norm[{d a_after_projection}]] * SquNorm[Dt[CompZ[{a_after_projection}]]], {T} ]; // eddy current losses in wedges
|
|
2138
|
+
In <<nc.omega>><<nc.induced>>_TH; Jacobian Jac_Vol_TH; Integration Int_TH; }
|
|
2139
|
+
{% endif %}
|
|
1320
2140
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
{% endif %}
|
|
2141
|
+
{% if dm.magnet.solve.thermal.collar_cooling.enabled %}
|
|
2142
|
+
// cooling in the collar
|
|
2143
|
+
Integral { [col_heatExchCoeff[{T}, T_ref] * Dof{T}, {T} ] ;
|
|
2144
|
+
In bndCollarGaps; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
2145
|
+
Integral { [-col_heatExchCoeff[{T}, T_ref] * T_ref, {T} ] ;
|
|
2146
|
+
In bndCollarGaps; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
1328
2147
|
|
|
1329
|
-
|
|
1330
|
-
{%
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
{
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
2148
|
+
{% endif %}
|
|
2149
|
+
{% if dm.magnet.geometry.thermal.use_TSA %}
|
|
2150
|
+
{% if not dm.magnet.geometry.thermal.use_TSA_new %}
|
|
2151
|
+
For tsaGroup In {1:<<len(TSAinsulation_layers_number)>>}
|
|
2152
|
+
For i In {0:n_ele_per_tsa_group~{tsaGroup} - 1} // loop over 1D FE elements
|
|
2153
|
+
For j In {1:2} // separation between vertical and horizontal
|
|
2154
|
+
For k In {1:2}
|
|
2155
|
+
For l In {1:2}
|
|
2156
|
+
Integral { [ thermalConductivityMass~{i}[{Ti~{i}~{j}~{tsaGroup}}, {Ti~{i+1}~{j}~{tsaGroup}}, delta~{i}[], k, l] *
|
|
2157
|
+
Dof{d Ti~{i + k - 1}~{j}~{tsaGroup}} , {d Ti~{i + l - 1}~{j}~{tsaGroup}}];
|
|
2158
|
+
In intDomain~{j}~{tsaGroup}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
1339
2159
|
}
|
|
1340
2160
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
In intDomain~{j}~{<<nr + 1>>}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
2161
|
+
Integral { [thermalConductivityStiffness~{i}[{Ti~{i}~{j}~{tsaGroup}}, {Ti~{i+1}~{j}~{tsaGroup}}, delta~{i}[], k, l] *
|
|
2162
|
+
Dof{Ti~{i + k - 1}~{j}~{tsaGroup}} , {Ti~{i + l - 1}~{j}~{tsaGroup}} ];
|
|
2163
|
+
In intDomain~{j}~{tsaGroup}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
1345
2164
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
In intDomain~{j}~{<<nr + 1>>}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
2165
|
+
Integral {
|
|
2166
|
+
DtDof[ specificHeatCapacity~{i}[{Ti~{i}~{j}~{tsaGroup}}, {Ti~{i+1}~{j}~{tsaGroup}}, delta~{i}[], k, l] *
|
|
2167
|
+
Dof{Ti~{i + k - 1}~{j}~{tsaGroup}} , {Ti~{i + l - 1}~{j}~{tsaGroup}} ];
|
|
2168
|
+
In intDomain~{j}~{tsaGroup}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
1351
2169
|
}
|
|
2170
|
+
EndFor // l
|
|
2171
|
+
EndFor // k
|
|
2172
|
+
EndFor // j
|
|
2173
|
+
EndFor // i
|
|
2174
|
+
EndFor // tsaGroup
|
|
2175
|
+
{% else %}
|
|
2176
|
+
// USE TSA COLLAR
|
|
2177
|
+
For tsaGroup In {1:<<len(TSAinsulation_layers_number)>>}
|
|
2178
|
+
For i In {0:n_ele_per_tsa_group~{tsaGroup} - 1} // loop over 1D FE elements
|
|
2179
|
+
For j In {1:2} // separation between vertical and horizontal
|
|
2180
|
+
For k In {1:2}
|
|
2181
|
+
For l In {1:2}
|
|
2182
|
+
Integral { [ TSA_new_correction~{j}~{tsaGroup}*thermalConductivityMass~{i}[{Ti~{i}~{j}~{tsaGroup}}, {Ti~{i+1}~{j}~{tsaGroup}}, delta~{i}[], k, l] *
|
|
2183
|
+
Dof{d Ti~{i + k - 1}~{j}~{tsaGroup}} , {d Ti~{i + l - 1}~{j}~{tsaGroup}}];
|
|
2184
|
+
In intDomain~{j}~{tsaGroup}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
2185
|
+
}
|
|
2186
|
+
Integral { [ TSA_new_correction~{j}~{tsaGroup}*thermalConductivityStiffness~{i}[{Ti~{i}~{j}~{tsaGroup}}, {Ti~{i+1}~{j}~{tsaGroup}}, delta~{i}[], k, l] *
|
|
2187
|
+
Dof{Ti~{i + k - 1}~{j}~{tsaGroup}} , {Ti~{i + l - 1}~{j}~{tsaGroup}} ];
|
|
2188
|
+
In intDomain~{j}~{tsaGroup}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
2189
|
+
}
|
|
2190
|
+
Integral {
|
|
2191
|
+
DtDof[ TSA_new_correction~{j}~{tsaGroup}*specificHeatCapacity~{i}[{Ti~{i}~{j}~{tsaGroup}}, {Ti~{i+1}~{j}~{tsaGroup}}, delta~{i}[], k, l] *
|
|
2192
|
+
Dof{Ti~{i + k - 1}~{j}~{tsaGroup}} , {Ti~{i + l - 1}~{j}~{tsaGroup}} ];
|
|
2193
|
+
In intDomain~{j}~{tsaGroup}; Integration Int_line_TH; Jacobian Jac_Sur_TH;
|
|
2194
|
+
}
|
|
2195
|
+
EndFor // l
|
|
2196
|
+
EndFor // k
|
|
2197
|
+
EndFor // j
|
|
2198
|
+
EndFor // i
|
|
2199
|
+
EndFor // tsaGroup
|
|
2200
|
+
{% endif %}
|
|
2201
|
+
{% for nr, n_ele in enumerate(rm_TH.thin_shells.quench_heaters.layers_number) %}
|
|
2202
|
+
{% set qu_nr = nr + len(rm_TH.thin_shells.insulation_types.thin_shells) %}
|
|
1352
2203
|
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
{% endfor %}
|
|
1356
|
-
EndFor // j
|
|
1357
|
-
EndFor // i
|
|
1358
|
-
{% endfor %}
|
|
1359
|
-
|
|
1360
|
-
{% for nr, n_ele in enumerate(rm_TH.thin_shells.quench_heaters.layers_number) %}
|
|
1361
|
-
{% set qu_nr = nr + len(rm_TH.thin_shells.insulation_types.thin_shells) %}
|
|
1362
|
-
|
|
1363
|
-
For i In {0:<<n_ele-1>>} // loop over 1D FE elements
|
|
2204
|
+
For i In {0:<<n_ele-1>>} // loop over 1D FE elements
|
|
1364
2205
|
For j In {1:2} // separation between vertical and horizontal
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
Integral { [- powerDensity_<<k>>~{i}[{Ti~{i}~{j}~{<<qu_nr + 1>>}}, {Ti~{i+1}~{j}~{<<qu_nr + 1>>}}, delta~{i}[]], {Ti~{i + <<k>> - 1}~{j}~{<<qu_nr + 1>>}} ];
|
|
2206
|
+
For k In {1:2}
|
|
2207
|
+
Integral { [- powerDensity~{i}[{Ti~{i}~{j}~{<<qu_nr + 1>>}}, {Ti~{i+1}~{j}~{<<qu_nr + 1>>}}, delta~{i}[], k], {Ti~{i + k - 1}~{j}~{<<qu_nr + 1>>}} ];
|
|
1368
2208
|
In intDomain~{j}~{<<qu_nr + 1>>}; Integration Int_line_TH; Jacobian Jac_Sur_TH; }
|
|
1369
|
-
|
|
1370
|
-
{% endfor %}
|
|
2209
|
+
EndFor //k
|
|
1371
2210
|
EndFor // j
|
|
1372
|
-
|
|
1373
|
-
|
|
2211
|
+
EndFor // i
|
|
2212
|
+
{% endfor %}
|
|
1374
2213
|
|
|
1375
2214
|
// one fewer for loop cause no horVerLayers --> but one more bc of function for N_eleL
|
|
1376
2215
|
If (num_robin > 0)
|
|
1377
|
-
|
|
2216
|
+
For tsaGroup In {1:<<len(TSAinsulation_layers_number)>>}
|
|
1378
2217
|
// ----------------- ROBIN -----------------------------------------------
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
{Ti~{outerElem~{j}~{x}~{a}~{
|
|
1384
|
-
In bndRobinInt~{j}~{x}~{a}~{
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
In bndRobinInt~{j}~{x}~{a}~{
|
|
2218
|
+
For j In {1:2} // separation between vertical and horizontal
|
|
2219
|
+
For x In {1:2}
|
|
2220
|
+
For a In {1:2}
|
|
2221
|
+
Integral { [heatExchCoeff[{Ti~{outerElem~{j}~{x}~{a}~{tsaGroup}}~{j}~{tsaGroup}}, Tinf[]] * Dof{Ti~{outerElem~{j}~{x}~{a}~{tsaGroup}}~{j}~{tsaGroup}},
|
|
2222
|
+
{Ti~{outerElem~{j}~{x}~{a}~{tsaGroup}}~{j}~{tsaGroup}} ] ;
|
|
2223
|
+
In bndRobinInt~{j}~{x}~{a}~{tsaGroup}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
2224
|
+
|
|
2225
|
+
Integral { [-heatExchCoeff[{Ti~{outerElem~{j}~{x}~{a}~{tsaGroup}}~{j}~{tsaGroup}}, Tinf[]] * Tinf[], {Ti~{outerElem~{j}~{x}~{a}~{tsaGroup}}~{j}~{tsaGroup}} ] ;
|
|
2226
|
+
In bndRobinInt~{j}~{x}~{a}~{tsaGroup}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
2227
|
+
EndFor
|
|
2228
|
+
EndFor
|
|
1388
2229
|
EndFor
|
|
1389
|
-
EndFor
|
|
1390
2230
|
EndFor
|
|
1391
|
-
{% endfor %}
|
|
1392
2231
|
EndIf
|
|
1393
2232
|
|
|
1394
2233
|
// ----------------- NEUMANN -----------------------------------------------
|
|
1395
2234
|
// one fewer for loop cause no horVerLayers --> but one more bc of function for N_eleL
|
|
1396
2235
|
If (num_neumann > 0)
|
|
1397
|
-
|
|
2236
|
+
For tsaGroup In {1:<<len(TSAinsulation_layers_number)>>}
|
|
1398
2237
|
// ----------------- Neumann -----------------------------------------------
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
{Ti~{outerElem~{j}~{x}~{a}~{
|
|
1404
|
-
In bndNeuInt~{j}~{x}~{a}~{
|
|
2238
|
+
For j In {1:2} // separation between vertical and horizontal
|
|
2239
|
+
For x In {1:2}
|
|
2240
|
+
For a In {1:2}
|
|
2241
|
+
Integral { [-heatFlux[],
|
|
2242
|
+
{Ti~{outerElem~{j}~{x}~{a}~{tsaGroup}}~{j}~{tsaGroup}} ] ;
|
|
2243
|
+
In bndNeuInt~{j}~{x}~{a}~{tsaGroup}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
2244
|
+
EndFor
|
|
2245
|
+
EndFor
|
|
1405
2246
|
EndFor
|
|
1406
|
-
EndFor
|
|
1407
2247
|
EndFor
|
|
1408
|
-
{% endfor %}
|
|
1409
2248
|
EndIf
|
|
1410
2249
|
|
|
1411
|
-
|
|
2250
|
+
{% else %} {# not TSA #}
|
|
1412
2251
|
|
|
1413
2252
|
// Neumann
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
2253
|
+
{% for nr, value in enumerate(rm_TH.boundaries.thermal.heat_flux.bc.value) %}
|
|
2254
|
+
Integral { [- <<value>> , {T} ] ;
|
|
2255
|
+
In {% if dm.magnet.solve.thermal.He_cooling.sides != 'external' and nr == 0 %} general_adiabatic {% else %} <<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.heat_flux)[nr - 1 if dm.magnet.solve.thermal.He_cooling.sides != 'external' else nr]>> {% endif %}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
2256
|
+
{% endfor %}
|
|
1418
2257
|
|
|
1419
2258
|
// Robin
|
|
1420
2259
|
// n * kappa grad (T) = h (T - Tinf) becomes two terms since GetDP can only
|
|
1421
2260
|
// handle linear and not affine terms
|
|
1422
2261
|
// NOTE: signs might be switched
|
|
1423
|
-
|
|
1424
|
-
|
|
2262
|
+
{% for nr, values in enumerate(rm_TH.boundaries.thermal.cooling.bc.values) %}
|
|
2263
|
+
{% if isinstance(values[0], str) %}
|
|
1425
2264
|
Integral { [<<values[0]>>[{T}, <<values[1]>>] * Dof{T}, {T} ] ;
|
|
1426
|
-
|
|
2265
|
+
In {% if dm.magnet.solve.thermal.He_cooling.enabled and nr == 0 %} general_cooling {% else %} <<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.cooling)[nr - 1 if dm.magnet.solve.thermal.He_cooling.enabled else nr]>> {% endif %}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
1427
2266
|
Integral { [-<<values[0]>>[{T}, <<values[1]>>] * <<values[1]>> , {T} ] ;
|
|
1428
|
-
|
|
1429
|
-
|
|
2267
|
+
In {% if dm.magnet.solve.thermal.He_cooling.enabled and nr == 0 %} general_cooling {% else %} <<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.cooling)[nr - 1 if dm.magnet.solve.thermal.He_cooling.enabled else nr]>> {% endif %}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
2268
|
+
{% else %}
|
|
1430
2269
|
Integral { [<<values[0]>> * Dof{T}, {T} ] ;
|
|
1431
|
-
|
|
2270
|
+
In {% if dm.magnet.solve.thermal.He_cooling.enabled and nr == 0 %} general_cooling {% else %} <<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.cooling)[nr - 1 if dm.magnet.solve.thermal.He_cooling.enabled else nr]>> {% endif %}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
1432
2271
|
Integral { [-<<values[0]>> * <<values[1]>> , {T} ] ;
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
2272
|
+
In {% if dm.magnet.solve.thermal.He_cooling.enabled and nr == 0 %} general_cooling {% else %} <<list(dm.magnet.solve.thermal.overwrite_boundary_conditions.cooling)[nr - 1 if dm.magnet.solve.thermal.He_cooling.enabled else nr]>> {% endif %}; Integration Int_line_TH ; Jacobian Jac_Sur_TH ; }
|
|
2273
|
+
{% endif %}
|
|
2274
|
+
{% endfor %}
|
|
2275
|
+
{% endif %}
|
|
2276
|
+
}
|
|
1437
2277
|
}
|
|
1438
|
-
|
|
1439
|
-
{% endif %}
|
|
2278
|
+
{% endif %}
|
|
1440
2279
|
}
|
|
1441
2280
|
|
|
1442
2281
|
Resolution {
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
{%
|
|
1446
|
-
|
|
1447
|
-
{%
|
|
1448
|
-
|
|
1449
|
-
|
|
2282
|
+
{ Name resolution;
|
|
2283
|
+
System {
|
|
2284
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0'%}
|
|
2285
|
+
{ Name Sys_Mag_dyn; NameOfFormulation Magnetodynamics_a_2D; NameOfMesh "<<mf['EM']>>"; }
|
|
2286
|
+
{% else %}
|
|
2287
|
+
{ Name Sys_Mag_static; NameOfFormulation Magnetostatics_a_2D; NameOfMesh "<<mf['EM']>>"; }
|
|
2288
|
+
{% endif %}
|
|
2289
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2290
|
+
{ Name Sys_The; NameOfFormulation Thermal_T; NameOfMesh "<<mf['TH']>>"; }
|
|
2291
|
+
{ Name sys_Mag_projection; NameOfFormulation Projection_EM_to_TH; NameOfMesh "<<mf['TH']>>";}
|
|
2292
|
+
{%if dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D"%}
|
|
2293
|
+
{ Name sys_QR_EM; NameOfFormulation Quench_Prop_EM; NameOfMesh "<<mf['EM']>>";}
|
|
2294
|
+
{ Name sys_QR_TH; NameOfFormulation Quench_Prop_TH; NameOfMesh "<<mf['TH']>>";}
|
|
1450
2295
|
{% endif %}
|
|
1451
|
-
{% if
|
|
1452
|
-
|
|
2296
|
+
{% if USE_THERMAL_PROJECTION %}
|
|
2297
|
+
{ Name sys_The_projection; NameOfFormulation Projection_TH_to_EM; NameOfMesh "<<mf['EM']>>";}
|
|
1453
2298
|
{% endif %}
|
|
1454
|
-
}
|
|
1455
|
-
Operation {
|
|
1456
|
-
{% if dm.magnet.solve.electromagnetics.solve_type %}
|
|
1457
|
-
InitSolution[Sys_Mag];
|
|
1458
|
-
IterativeLoopN[<<dm.magnet.solve.electromagnetics.non_linear_solver.max_iterations>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.relaxation_factor>>,
|
|
1459
|
-
System { { Sys_Mag, <<dm.magnet.solve.electromagnetics.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.abs_tolerance>>, Solution <<dm.magnet.solve.electromagnetics.non_linear_solver.norm_type>> } }
|
|
1460
|
-
] { GenerateJac[Sys_Mag]; SolveJac[Sys_Mag]; }
|
|
1461
|
-
PostOperation[Map_a];
|
|
1462
2299
|
{% endif %}
|
|
2300
|
+
}
|
|
2301
|
+
Operation{
|
|
2302
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0'%}
|
|
2303
|
+
SetTime[{% if SIM_MODE == 'Th_Mag_sta'%} <<dm.magnet.solve.thermal.time_stepping.initial_time>>
|
|
2304
|
+
{% elif SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %} <<dm.magnet.solve.time_stepping.initial_time>>
|
|
2305
|
+
{% else %}<<dm.magnet.solve.electromagnetics.time_stepping.initial_time>>{% endif %}];
|
|
2306
|
+
{% endif %}
|
|
2307
|
+
// Initialize times to zero
|
|
2308
|
+
Evaluate[$tg_cumul_cpu = 0, $ts_cumul_cpu = 0, $tg_cumul_wall = 0, $ts_cumul_wall = 0,$tp_cumul_wall = 0, $tp_cumul_cpu = 0];
|
|
2309
|
+
Evaluate[$tg_wall = 0, $tg_cpu = 0, $ts_wall = 0, $ts_cpu = 0, $tpr_wall = 0, $tpr_cpu = 0, $tp_wall = 0, $tp_cpu = 0];
|
|
2310
|
+
Evaluate[$tg1_wall = 0, $tg2_wall = 0, $tg3_wall = 0, $tg4_wall = 0, $tg1_cpu = 0, $tg2_cpu = 0, $tg3_cpu = 0, $tg4_cpu = 0];
|
|
2311
|
+
Evaluate[$ts1_wall = 0, $ts2_wall = 0, $ts3_wall = 0, $ts4_wall = 0, $ts1_cpu = 0 , $ts2_cpu = 0, $ts3_cpu = 0, $ts4_cpu = 0];
|
|
2312
|
+
Evaluate[$tpr1_wall = 0, $tpr2_wall = 0, $tpr1_cpu = 0, $tpr2_cpu = 0];
|
|
2313
|
+
Print["timestep,gen_wall,gen_cpu,sol_wall,sol_cpu,pos_wall,pos_cpu,gen_wall_cumul,gen_cpu_cumul,sol_wall_cumul,sol_cpu_cumul,pos_wall_cumul,pos_cpu_cumul", File "computation_times.csv"];
|
|
2314
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0'%}
|
|
2315
|
+
Print["timestep,E_mag [J]", File "E_mag.csv"];
|
|
2316
|
+
{% endif %}
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
{% if USE_THERMAL_PROJECTION %}
|
|
2320
|
+
PostOperation[T_avg_collar_init]; // initialise
|
|
2321
|
+
Generate[sys_The_projection];
|
|
2322
|
+
{% endif %}
|
|
2323
|
+
|
|
2324
|
+
{% if SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag' %}
|
|
2325
|
+
CreateDirectory["T_avg"];
|
|
2326
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
2327
|
+
PostOperation[T_avg_init];
|
|
2328
|
+
{% endif %}
|
|
2329
|
+
{% endif %}
|
|
1463
2330
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
2331
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
2332
|
+
InitSolution[Sys_Mag_dyn];
|
|
2333
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %}
|
|
2334
|
+
InitSolution[Sys_The];
|
|
2335
|
+
{% if SIM_MODE != 'Th_Mag' %}
|
|
2336
|
+
//CreateDirectory["T_avg"];
|
|
2337
|
+
PostOperation[T_avg];
|
|
2338
|
+
{% endif %}
|
|
2339
|
+
{% endif %}
|
|
2340
|
+
{% if dm.circuit.field_circuit and (SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn') %}
|
|
2341
|
+
PostOperation[circuit_coupling];
|
|
2342
|
+
{% endif %}
|
|
2343
|
+
{% else %}
|
|
2344
|
+
InitSolution[Sys_Mag_static];
|
|
2345
|
+
{% if SIM_MODE == 'Th_Mag_sta' %}
|
|
2346
|
+
{% if dm.circuit.field_circuit %}
|
|
2347
|
+
<<cc_macros2.resolution_FCC(dm,rm_EM,flag_active,ESC_dict,ECLIQ_dict)>>
|
|
2348
|
+
{% endif %}
|
|
2349
|
+
InitSolution[Sys_The];
|
|
2350
|
+
//CreateDirectory["T_avg"];
|
|
2351
|
+
PostOperation[T_avg];
|
|
2352
|
+
{% endif %}
|
|
2353
|
+
IterativeLoopN[<<dm.magnet.solve.electromagnetics.non_linear_solver.max_iterations>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.relaxation_factor>>,
|
|
2354
|
+
{%- if dm.circuit.field_circuit%}
|
|
2355
|
+
PostOperation{ { conv2_sta, <<dm.magnet.solve.electromagnetics.time_stepping.rel_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.abs_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.norm_type>> }}{%endif -%}
|
|
2356
|
+
System { { Sys_Mag_static, <<dm.magnet.solve.electromagnetics.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.abs_tolerance>>, Solution <<dm.magnet.solve.electromagnetics.non_linear_solver.norm_type>> } }]
|
|
2357
|
+
{
|
|
2358
|
+
Evaluate[ $tg1_wall = GetWallClockTime[], $tg1_cpu = GetCpuTime[] ];
|
|
2359
|
+
GenerateJac[Sys_Mag_static];
|
|
2360
|
+
Evaluate[ $tg2_wall = GetWallClockTime[], $tg2_cpu = GetCpuTime[] ];
|
|
2361
|
+
|
|
2362
|
+
Evaluate[ $ts1_wall = GetWallClockTime[], $ts1_cpu = GetCpuTime[] ];
|
|
2363
|
+
SolveJac[Sys_Mag_static];
|
|
2364
|
+
Evaluate[ $ts2_wall = GetWallClockTime[], $ts2_cpu = GetCpuTime[] ];
|
|
2365
|
+
}
|
|
2366
|
+
Evaluate[ $tp1_wall = GetWallClockTime[], $tp1_cpu = GetCpuTime[] ];
|
|
2367
|
+
PostOperation[Map_a_sta];
|
|
2368
|
+
Evaluate[ $tp2_wall = GetWallClockTime[], $tp2_cpu = GetCpuTime[] ];
|
|
2369
|
+
{% if dm.circuit.field_circuit and SIM_MODE == 'Mag_sta' %}
|
|
2370
|
+
<<cc_macros2.resolution_FCC(dm,rm_EM,flag_active,ESC_dict,ECLIQ_dict)>>
|
|
2371
|
+
PostOperation[circuit_coupling_sta];
|
|
2372
|
+
{% endif %}
|
|
2373
|
+
Evaluate[$tg_wall = $tg_wall + $tg2_wall - $tg1_wall + $tg4_wall - $tg3_wall, $tg_cpu = $tg_cpu + $tg2_cpu - $tg1_cpu + $tg4_cpu - $tg3_cpu, $ts_wall = $ts_wall + $ts2_wall - $ts1_wall + $ts4_wall - $ts3_wall, $ts_cpu = $ts_cpu + $ts2_cpu - $ts1_cpu + $ts4_cpu - $ts3_cpu, $tpr_wall = $tpr_wall + $tpr2_wall - $tpr1_wall, $tpr_cpu = $tpr_cpu + $tpr2_cpu - $tpr1_cpu,$tp_wall = $tp_wall + $tp2_wall - $tp1_wall,$tp_cpu = $tp_cpu + $tp2_cpu - $tp1_cpu ];
|
|
2374
|
+
// cumulated times
|
|
2375
|
+
Evaluate[ $tg_cumul_wall = $tg_cumul_wall + $tg_wall, $tg_cumul_cpu = $tg_cumul_cpu + $tg_cpu, $ts_cumul_wall = $ts_cumul_wall + $ts_wall, $ts_cumul_cpu = $ts_cumul_cpu + $ts_cpu, $tp_cumul_wall = $tp_cumul_wall + $tp_wall, $tp_cumul_cpu = $tp_cumul_cpu + $tp_cpu];
|
|
2376
|
+
|
|
2377
|
+
// print to file
|
|
2378
|
+
Print[{$TimeStep, $tg_wall, $tg_cpu, $ts_wall, $ts_cpu, $tp_wall, $tp_cpu, $tg_cumul_wall, $tg_cumul_cpu, $ts_cumul_wall, $ts_cumul_cpu, $tp_cumul_wall, $tp_cumul_cpu}, Format "%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g", File "computation_times.csv"];
|
|
2379
|
+
|
|
2380
|
+
{% if SIM_MODE == 'Th_Mag_sta' %}
|
|
2381
|
+
Generate[sys_Mag_projection]; Solve[sys_Mag_projection];
|
|
2382
|
+
SaveSolution[sys_Mag_projection]; //PostOperation[b_after_projection_pos];
|
|
2383
|
+
{% endif %}
|
|
2384
|
+
{% endif %}
|
|
1468
2385
|
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
2386
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2387
|
+
SetExtrapolationOrder[0];
|
|
2388
|
+
{% if SIM_MODE != 'Th_Mag'%}
|
|
2389
|
+
CreateDirectory["I2TH"];
|
|
2390
|
+
{% endif %}
|
|
2391
|
+
PostOperation[GetI2TH];
|
|
2392
|
+
{% endif %}
|
|
2393
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
2394
|
+
{% if dm.circuit.field_circuit and (SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn_0')%}
|
|
2395
|
+
<<cc_macros2.resolution_FCC(dm,rm_EM,flag_active,ESC_dict,ECLIQ_dict)>>
|
|
2396
|
+
PostOperation[circuit_coupling];
|
|
2397
|
+
{% endif %}
|
|
2398
|
+
TimeLoopAdaptive[
|
|
2399
|
+
{% if dm.magnet.solve.thermal.solve_type and dm.magnet.solve.electromagnetics.solve_type == 'transient' %}
|
|
2400
|
+
<<dm.magnet.solve.time_stepping.initial_time>>, <<dm.magnet.solve.time_stepping.final_time>>, <<dm.magnet.solve.time_stepping.initial_time_step>>, <<dm.magnet.solve.time_stepping.min_time_step>>, <<dm.magnet.solve.time_stepping.max_time_step>>, "<<dm.magnet.solve.time_stepping.integration_method>>", List[Breakpoints],
|
|
2401
|
+
System { { Sys_The, <<dm.magnet.solve.time_stepping.rel_tol_time[-1]>>, <<dm.magnet.solve.time_stepping.abs_tol_time[-1]>>, <<dm.magnet.solve.time_stepping.norm_type[-1]>> } } PostOperation { { conv, <<dm.magnet.solve.time_stepping.rel_tol_time[0]>>, <<dm.magnet.solve.time_stepping.abs_tol_time[0]>>, <<dm.magnet.solve.time_stepping.norm_type[0]>> }{%if dm.circuit.field_circuit%}{ conv2, <<dm.magnet.solve.time_stepping.rel_tol_time[1]>>, <<dm.magnet.solve.time_stepping.abs_tol_time[1]>>, <<dm.magnet.solve.time_stepping.norm_type[1]>> }{%endif%}}
|
|
2402
|
+
{% elif dm.magnet.solve.thermal.solve_type %}
|
|
2403
|
+
<<dm.magnet.solve.thermal.time_stepping.initial_time>>, <<dm.magnet.solve.thermal.time_stepping.final_time>>, <<dm.magnet.solve.thermal.time_stepping.initial_time_step>>, <<dm.magnet.solve.thermal.time_stepping.min_time_step>>, <<dm.magnet.solve.thermal.time_stepping.max_time_step>>, "<<dm.magnet.solve.thermal.time_stepping.integration_method>>", List[Breakpoints],
|
|
2404
|
+
System { { Sys_The, <<dm.magnet.solve.thermal.time_stepping.rel_tol_time>>, <<dm.magnet.solve.thermal.time_stepping.abs_tol_time>>, <<dm.magnet.solve.thermal.time_stepping.norm_type>> } }
|
|
2405
|
+
{% else %}
|
|
2406
|
+
<<dm.magnet.solve.electromagnetics.time_stepping.initial_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.final_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.initial_time_step>>, <<dm.magnet.solve.electromagnetics.time_stepping.min_time_step>>, <<dm.magnet.solve.electromagnetics.time_stepping.max_time_step>>, "<<dm.magnet.solve.electromagnetics.time_stepping.integration_method>>", List[Breakpoints],
|
|
2407
|
+
PostOperation { { conv, <<dm.magnet.solve.electromagnetics.time_stepping.rel_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.abs_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.norm_type>> } {% if dm.circuit.field_circuit %} { conv2, <<dm.magnet.solve.electromagnetics.time_stepping.rel_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.abs_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.norm_type>> }{%endif%}}
|
|
2408
|
+
{% endif %}
|
|
2409
|
+
]{
|
|
2410
|
+
|
|
2411
|
+
IterativeLoopN[
|
|
2412
|
+
{% if SIM_MODE == 'Th_Mag_sta' %}
|
|
2413
|
+
<<dm.magnet.solve.thermal.non_linear_solver.max_iterations>>, <<dm.magnet.solve.thermal.non_linear_solver.relaxation_factor>>,
|
|
2414
|
+
System { { Sys_The, <<dm.magnet.solve.thermal.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.thermal.non_linear_solver.abs_tolerance>>, Solution <<dm.magnet.solve.thermal.non_linear_solver.norm_type>> } }
|
|
2415
|
+
{% elif SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %}
|
|
2416
|
+
<<dm.magnet.solve.electromagnetics.non_linear_solver.max_iterations>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.relaxation_factor>>,
|
|
2417
|
+
PostOperation { { conv, <<dm.magnet.solve.electromagnetics.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.abs_tolerance>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.norm_type>> }{%if dm.circuit.field_circuit%} { conv2, <<dm.magnet.solve.electromagnetics.time_stepping.rel_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.abs_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.norm_type>> }{%endif%}} System { { Sys_The, <<dm.magnet.solve.thermal.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.thermal.non_linear_solver.abs_tolerance>>, Solution <<dm.magnet.solve.thermal.non_linear_solver.norm_type>> } }
|
|
2418
|
+
{% else %}
|
|
2419
|
+
<<dm.magnet.solve.electromagnetics.non_linear_solver.max_iterations>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.relaxation_factor>>,
|
|
2420
|
+
PostOperation { { conv, <<dm.magnet.solve.electromagnetics.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.abs_tolerance>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.norm_type>> }{% if dm.circuit.field_circuit %} { conv2, <<dm.magnet.solve.electromagnetics.time_stepping.rel_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.abs_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.norm_type>> }{%endif%}}
|
|
2421
|
+
// System { { Sys_Mag, <<dm.magnet.solve.electromagnetics.time_stepping.rel_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.abs_tol_time>>, Solution <<dm.magnet.solve.electromagnetics.time_stepping.norm_type>> } }
|
|
2422
|
+
{% endif %}
|
|
2423
|
+
]{
|
|
2424
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
2425
|
+
Evaluate[ $tg1_wall = GetWallClockTime[], $tg1_cpu = GetCpuTime[] ];
|
|
2426
|
+
GenerateJac Sys_Mag_dyn ;
|
|
2427
|
+
Evaluate[ $tg2_wall = GetWallClockTime[], $tg2_cpu = GetCpuTime[] ];
|
|
2428
|
+
|
|
2429
|
+
Evaluate[ $ts1_wall = GetWallClockTime[], $ts1_cpu = GetCpuTime[] ];
|
|
2430
|
+
SolveJac Sys_Mag_dyn;
|
|
2431
|
+
Evaluate[ $ts2_wall = GetWallClockTime[], $ts2_cpu = GetCpuTime[] ];
|
|
2432
|
+
{% endif %}
|
|
2433
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %}
|
|
2434
|
+
Evaluate[ $tpr1_wall = GetWallClockTime[], $tpr1_cpu = GetCpuTime[] ];
|
|
2435
|
+
Generate[sys_Mag_projection]; Solve[sys_Mag_projection];
|
|
2436
|
+
Evaluate[ $tpr2_wall = GetWallClockTime[], $tpr2_cpu = GetCpuTime[] ];
|
|
2437
|
+
SaveSolution[sys_Mag_projection]; //PostOperation[b_after_projection_pos];
|
|
2438
|
+
{% endif %}
|
|
2439
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2440
|
+
Evaluate[ $tg3_wall = GetWallClockTime[], $tg3_cpu = GetCpuTime[] ];
|
|
2441
|
+
GenerateJac Sys_The ;
|
|
2442
|
+
Evaluate[ $tg4_wall = GetWallClockTime[], $tg4_cpu = GetCpuTime[] ];
|
|
2443
|
+
|
|
2444
|
+
Evaluate[ $ts3_wall = GetWallClockTime[], $ts3_cpu = GetCpuTime[] ];
|
|
2445
|
+
SolveJac Sys_The;
|
|
2446
|
+
Evaluate[ $ts4_wall = GetWallClockTime[], $ts4_cpu = GetCpuTime[] ];
|
|
2447
|
+
{% endif %}
|
|
2448
|
+
// add to solution times of previous rejected time steps
|
|
2449
|
+
Evaluate[$tg_wall = $tg_wall + $tg2_wall - $tg1_wall + $tg4_wall - $tg3_wall, $tg_cpu = $tg_cpu + $tg2_cpu - $tg1_cpu + $tg4_cpu - $tg3_cpu, $ts_wall = $ts_wall + $ts2_wall - $ts1_wall + $ts4_wall - $ts3_wall, $ts_cpu = $ts_cpu + $ts2_cpu - $ts1_cpu + $ts4_cpu - $ts3_cpu, $tpr_wall = $tpr_wall + $tpr2_wall - $tpr1_wall, $tpr_cpu = $tpr_cpu + $tpr2_cpu - $tpr1_cpu ];
|
|
2450
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2451
|
+
{% if dm.magnet.solve.thermal.enforce_init_temperature_as_minimum %}
|
|
2452
|
+
SolutionSetMin[Sys_The, <<dm.magnet.solve.thermal.init_temperature>>];
|
|
2453
|
+
{% endif %}
|
|
2454
|
+
{% endif %}
|
|
2455
|
+
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
// Check if the solution is NaN and remove it
|
|
2459
|
+
Test[$KSPResidual != $KSPResidual]{
|
|
2460
|
+
Print["Critical: Removing NaN solution from the solution vector."];
|
|
2461
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2462
|
+
RemoveLastSolution[Sys_The];
|
|
2463
|
+
{% endif %}
|
|
2464
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
2465
|
+
RemoveLastSolution[Sys_Mag_dyn];
|
|
2466
|
+
{% endif %}
|
|
2467
|
+
}
|
|
2468
|
+
}{
|
|
2469
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2470
|
+
|
|
2471
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %}
|
|
2472
|
+
PostOperation[GetI2TH];
|
|
2473
|
+
PostOperation[T_avg];
|
|
2474
|
+
|
|
2475
|
+
SaveSolution[Sys_Mag_dyn];
|
|
2476
|
+
{% endif %}
|
|
2477
|
+
SaveSolution[Sys_The];
|
|
2478
|
+
|
|
2479
|
+
|
|
2480
|
+
Evaluate[ $tp1_wall = GetWallClockTime[], $tp1_cpu = GetCpuTime[] ];
|
|
2481
|
+
{% if (not dm.magnet.postproc.thermal.save_txt_at_the_end and dm.magnet.postproc.thermal.output_time_steps_txt) %}
|
|
2482
|
+
// print average temperature
|
|
2483
|
+
{% if dm.magnet.postproc.thermal.output_time_steps_txt > 1%}
|
|
2484
|
+
Test[$TimeStep > 1] {
|
|
2485
|
+
PostOperation[T_avg];
|
|
2486
|
+
}
|
|
2487
|
+
{% else %}
|
|
2488
|
+
PostOperation[T_avg];
|
|
2489
|
+
{% endif %}
|
|
2490
|
+
{% endif %}
|
|
2491
|
+
|
|
2492
|
+
{% if (not dm.magnet.postproc.thermal.save_pos_at_the_end and dm.magnet.postproc.thermal.output_time_steps_pos) %}
|
|
2493
|
+
// print temperature map
|
|
2494
|
+
{% if dm.magnet.postproc.thermal.output_time_steps_pos > 1%}
|
|
2495
|
+
Test[$TimeStep > 1] {
|
|
2496
|
+
PostOperation[Map_T];
|
|
2497
|
+
}
|
|
2498
|
+
{% else %}
|
|
2499
|
+
PostOperation[Map_T];
|
|
2500
|
+
{% if dm.magnet.solve.electromagnetics.solve_type == 'transient' %}
|
|
2501
|
+
PostOperation[Map_a];
|
|
2502
|
+
{% endif %}
|
|
2503
|
+
{% endif %}
|
|
2504
|
+
{% endif %}
|
|
2505
|
+
{% if 'collar' in areas_to_build['TH'] %}
|
|
2506
|
+
PostOperation[PrintMaxTemp_col]; // save maximum temperature in register 1
|
|
2507
|
+
{% endif %}
|
|
2508
|
+
PostOperation[PrintMaxTemp]; // save maximum temperature in register 1
|
|
2509
|
+
Evaluate[ $tp2_wall = GetWallClockTime[], $tp2_cpu = GetCpuTime[] ];
|
|
2510
|
+
|
|
2511
|
+
Evaluate[ $tp_wall = $tp2_wall - $tp1_wall, $tp_cpu = $tp2_cpu - $tp1_cpu ];
|
|
2512
|
+
|
|
2513
|
+
// cumulated times
|
|
2514
|
+
Evaluate[ $tg_cumul_wall = $tg_cumul_wall + $tg_wall, $tg_cumul_cpu = $tg_cumul_cpu + $tg_cpu, $ts_cumul_wall = $ts_cumul_wall + $ts_wall, $ts_cumul_cpu = $ts_cumul_cpu + $ts_cpu, $tp_cumul_wall = $tp_cumul_wall + $tp_wall, $tp_cumul_cpu = $tp_cumul_cpu + $tp_cpu];
|
|
2515
|
+
|
|
2516
|
+
// print to file
|
|
2517
|
+
Print[{$TimeStep, $tg_wall, $tg_cpu, $ts_wall, $ts_cpu, $tp_wall, $tp_cpu, $tg_cumul_wall, $tg_cumul_cpu, $ts_cumul_wall, $ts_cumul_cpu, $tp_cumul_wall, $tp_cumul_cpu}, Format "%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g", File "computation_times.csv"];
|
|
2518
|
+
|
|
2519
|
+
// reset after accepted time step
|
|
2520
|
+
Evaluate[$tg_wall = 0, $tg_cpu = 0, $ts_wall = 0, $ts_cpu = 0];
|
|
2521
|
+
|
|
2522
|
+
// check if maximum temperature is reached
|
|
2523
|
+
{# raw block needed since use of # in following code #}
|
|
2524
|
+
{% raw %}
|
|
2525
|
+
Print[{#1}, Format "Maximum temperature: %g "];
|
|
2526
|
+
Test[#1 > stop_temperature] {
|
|
2527
|
+
Break[];
|
|
2528
|
+
}
|
|
2529
|
+
{% endraw %}
|
|
2530
|
+
{% else %}
|
|
2531
|
+
// save solution to .res file
|
|
2532
|
+
SaveSolution[Sys_Mag_dyn];
|
|
2533
|
+
|
|
2534
|
+
|
|
2535
|
+
// cumulated times
|
|
2536
|
+
Evaluate[ $tg_cumul_wall = $tg_cumul_wall + $tg_wall, $tg_cumul_cpu = $tg_cumul_cpu + $tg_cpu, $ts_cumul_wall = $ts_cumul_wall + $ts_wall, $ts_cumul_cpu = $ts_cumul_cpu + $ts_cpu, $tp_cumul_wall = $tp_cumul_wall + $tp_wall, $tp_cumul_cpu = $tp_cumul_cpu + $tp_cpu];
|
|
2537
|
+
|
|
2538
|
+
// print to file
|
|
2539
|
+
Print[{$TimeStep, $tg_wall, $tg_cpu, $ts_wall, $ts_cpu,$tp_wall,$tp_cpu,$tg_cumul_wall,$tg_cumul_cpu,$ts_cumul_wall,$ts_cumul_cpu,$tp_cumul_wall,$tp_cumul_cpu}, Format "%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g", File "computation_times.csv"];
|
|
2540
|
+
|
|
2541
|
+
// reset after accepted time step
|
|
2542
|
+
Evaluate[$tg_wall = 0, $tg_cpu = 0, $ts_wall = 0, $ts_cpu = 0];
|
|
2543
|
+
|
|
2544
|
+
{% endif %}
|
|
2545
|
+
{% if (dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D") and dm.magnet.solve.thermal.solve_type%}
|
|
2546
|
+
Generate[sys_QR_TH];
|
|
2547
|
+
PostOperation[Map_R_quench_TH];
|
|
2548
|
+
Generate[sys_QR_EM];
|
|
2549
|
+
PostOperation[Map_R_quench];
|
|
2550
|
+
{% endif %}
|
|
1472
2551
|
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
2552
|
+
}
|
|
2553
|
+
{% if (SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0') and dm.magnet.postproc.electromagnetics.output_time_steps_pos %}
|
|
2554
|
+
Evaluate[ $tp1_wall = GetWallClockTime[], $tp1_cpu = GetCpuTime[] ];
|
|
2555
|
+
PostOperation[Map_a];
|
|
2556
|
+
|
|
2557
|
+
{% endif %}
|
|
2558
|
+
{% if (SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta') and dm.magnet.postproc.thermal.output_time_steps_pos %}
|
|
2559
|
+
PostOperation[Map_T];
|
|
2560
|
+
{% endif %}
|
|
2561
|
+
{% if dm.circuit.field_circuit and dm.magnet.postproc.electromagnetics.output_time_steps_pos %}
|
|
2562
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
2563
|
+
PostOperation[circuit_coupling];
|
|
2564
|
+
{% endif %}
|
|
2565
|
+
{% if SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Mag_sta' %}
|
|
2566
|
+
PostOperation[circuit_coupling_sta];
|
|
2567
|
+
{% endif %}
|
|
2568
|
+
{% endif %}
|
|
2569
|
+
Evaluate[ $tp2_wall = GetWallClockTime[], $tp2_cpu = GetCpuTime[] ];
|
|
2570
|
+
|
|
2571
|
+
Evaluate[ $tp_wall = $tp2_wall - $tp1_wall, $tp_cpu = $tp2_cpu - $tp1_cpu ];
|
|
2572
|
+
// cumulated times
|
|
2573
|
+
Evaluate[ $tp_cumul_wall = $tp_cumul_wall + $tp_wall, $tp_cumul_cpu = $tp_cumul_cpu + $tp_cpu];
|
|
2574
|
+
|
|
2575
|
+
// print to file
|
|
2576
|
+
Print[{$TimeStep, $tg_wall, $tg_cpu, $ts_wall, $ts_cpu,$tp_wall,$tp_cpu,$tg_cumul_wall,$tg_cumul_cpu,$ts_cumul_wall,$ts_cumul_cpu,$tp_cumul_wall,$tp_cumul_cpu}, Format "%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g", File "computation_times.csv"];
|
|
2577
|
+
|
|
2578
|
+
// PostOperation[b_thermal];
|
|
2579
|
+
|
|
2580
|
+
{% endif %}
|
|
1476
2581
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
{% endif %}
|
|
1480
|
-
{% if dm.magnet.postproc.thermal.output_time_steps_txt == 1 %}
|
|
1481
|
-
PostOperation[T_avg];
|
|
1482
|
-
{% endif %}
|
|
2582
|
+
|
|
2583
|
+
}
|
|
1483
2584
|
|
|
1484
|
-
|
|
1485
|
-
|
|
2585
|
+
}
|
|
2586
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' %}
|
|
2587
|
+
{ Name Static_2_Dynamic;
|
|
2588
|
+
System {
|
|
2589
|
+
{ Name Sys_Mag_static; NameOfFormulation Magnetostatics_a_2D; NameOfMesh "<<mf['EM']>>"; DestinationSystem Sys_Mag_dyn;}
|
|
2590
|
+
{ Name Sys_Mag_dyn; NameOfFormulation Magnetodynamics_a_2D; NameOfMesh "<<mf['EM']>>"; }
|
|
2591
|
+
{% if SIM_MODE == 'Th_Mag' %}
|
|
2592
|
+
{ Name Sys_The; NameOfFormulation Thermal_T; NameOfMesh "<<mf['TH']>>"; }
|
|
2593
|
+
{% endif %}
|
|
2594
|
+
}
|
|
2595
|
+
Operation {
|
|
2596
|
+
SetTime[{% if dm.magnet.solve.thermal.solve_type %}<<dm.magnet.solve.time_stepping.initial_time>>{% else %}<<dm.magnet.solve.electromagnetics.time_stepping.initial_time>>{% endif %}];
|
|
2597
|
+
InitSolution[Sys_Mag_static];
|
|
2598
|
+
{% if SIM_MODE == 'Th_Mag' %}
|
|
2599
|
+
InitSolution[Sys_The];
|
|
2600
|
+
CreateDirectory["T_avg"];
|
|
2601
|
+
PostOperation[T_avg];
|
|
2602
|
+
{% endif %}
|
|
2603
|
+
SaveSolution[Sys_Mag_static];
|
|
2604
|
+
IterativeLoopN[<<dm.magnet.solve.electromagnetics.non_linear_solver.max_iterations>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.relaxation_factor>>,
|
|
2605
|
+
{%if dm.circuit.field_circuit%}PostOperation{ { conv2_sta, <<dm.magnet.solve.electromagnetics.time_stepping.rel_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.abs_tol_time>>, <<dm.magnet.solve.electromagnetics.time_stepping.norm_type>> }}{%endif%} System { { Sys_Mag_static, <<dm.magnet.solve.electromagnetics.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.electromagnetics.non_linear_solver.abs_tolerance>>, Solution <<dm.magnet.solve.electromagnetics.non_linear_solver.norm_type>> } }] {
|
|
2606
|
+
GenerateJac[Sys_Mag_static];
|
|
2607
|
+
SolveJac[Sys_Mag_static];
|
|
2608
|
+
}
|
|
2609
|
+
SaveSolution[Sys_Mag_static];
|
|
2610
|
+
PostOperation[Map_a_sta];
|
|
2611
|
+
{% if dm.circuit.field_circuit%}
|
|
2612
|
+
<<cc_macros2.resolution_FCC(dm,rm_EM,flag_active,ESC_dict,ECLIQ_dict)>>
|
|
2613
|
+
PostOperation[circuit_coupling_sta];
|
|
2614
|
+
{% endif %}
|
|
2615
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' %}
|
|
2616
|
+
CreateDirectory["I2TH"];
|
|
2617
|
+
PostOperation[GetI2TH_sta];
|
|
2618
|
+
{% endif %}
|
|
2619
|
+
TransferSolution[Sys_Mag_static];
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
1486
2622
|
{% endif %}
|
|
1487
2623
|
|
|
1488
|
-
|
|
1489
|
-
Evaluate[$tg_cumul_cpu = 0, $ts_cumul_cpu = 0, $tg_cumul_wall = 0, $ts_cumul_wall = 0];
|
|
1490
|
-
Print["timestep,gen_wall,gen_cpu,sol_wall,sol_cpu,pos_wall,pos_cpu,gen_wall_cumul,gen_cpu_cumul,sol_wall_cumul,sol_cpu_cumul,pos_wall_cumul,pos_cpu_cumul", File "computation_times.csv"];
|
|
1491
|
-
//PostOperation[b_after_projection_pos];
|
|
1492
|
-
|
|
1493
|
-
{% if dm.magnet.solve.thermal.solve_type == 'transient' %}
|
|
1494
|
-
|
|
1495
|
-
Evaluate[$tg_wall = 0, $tg_cpu = 0, $ts_wall = 0, $ts_cpu = 0];
|
|
1496
|
-
|
|
1497
|
-
TimeLoopAdaptive
|
|
1498
|
-
[ <<dm.magnet.solve.thermal.time_stepping.initial_time>>, <<dm.magnet.solve.thermal.time_stepping.final_time>>, <<dm.magnet.solve.thermal.time_stepping.initial_time_step>>, <<dm.magnet.solve.thermal.time_stepping.min_time_step>>, <<dm.magnet.solve.thermal.time_stepping.max_time_step>>, "<<dm.magnet.solve.thermal.time_stepping.integration_method>>", List[Breakpoints],
|
|
1499
|
-
System { { Sys_The, <<dm.magnet.solve.thermal.time_stepping.rel_tol_time>>, <<dm.magnet.solve.thermal.time_stepping.abs_tol_time>>, <<dm.magnet.solve.thermal.time_stepping.norm_type>> } } ]
|
|
1500
|
-
{
|
|
1501
|
-
IterativeLoopN[<<dm.magnet.solve.thermal.non_linear_solver.max_iterations>>, <<dm.magnet.solve.thermal.non_linear_solver.relaxation_factor>>,
|
|
1502
|
-
System { { Sys_The, <<dm.magnet.solve.thermal.non_linear_solver.rel_tolerance>>, <<dm.magnet.solve.thermal.non_linear_solver.abs_tolerance>>, Solution <<dm.magnet.solve.thermal.non_linear_solver.norm_type>> } }]
|
|
1503
|
-
{
|
|
1504
|
-
Evaluate[ $tg1_wall = GetWallClockTime[], $tg1_cpu = GetCpuTime[] ];
|
|
1505
|
-
GenerateJac Sys_The ;
|
|
1506
|
-
Evaluate[ $tg2_wall = GetWallClockTime[], $tg2_cpu = GetCpuTime[] ];
|
|
1507
|
-
|
|
1508
|
-
// add to generation times of previous rejected time steps
|
|
1509
|
-
Evaluate[ $tg_wall = $tg_wall + $tg2_wall - $tg1_wall, $tg_cpu = $tg_cpu + $tg2_cpu - $tg1_cpu ];
|
|
2624
|
+
}
|
|
1510
2625
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
2626
|
+
PostProcessing {
|
|
2627
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_sta'%}
|
|
2628
|
+
{ Name MagSta_a_2D; NameOfFormulation Magnetostatics_a_2D; NameOfSystem Sys_Mag_static;
|
|
2629
|
+
Quantity {
|
|
2630
|
+
{ Name a;
|
|
2631
|
+
Value {
|
|
2632
|
+
Term { [ {a} ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
{ Name az;
|
|
2636
|
+
Value {
|
|
2637
|
+
Term { [ CompZ[{a}] ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
{ Name b;
|
|
2641
|
+
Value {
|
|
2642
|
+
Term { [ {d a} ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
{ Name h;
|
|
2646
|
+
Value {
|
|
2647
|
+
Term { [ nu[{d a}] * {d a} ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
{% if dm.circuit.field_circuit%}
|
|
2651
|
+
<<cc_macros2.postPr_FCC(nc,dm,flag_active,init_ht,end_ht,aux)>>
|
|
2652
|
+
{% else %}
|
|
2653
|
+
{ Name js ;
|
|
2654
|
+
Value {
|
|
2655
|
+
Term { [ {is}*sign_fct[]/area_fct[] ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; }
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
{% endif %}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
{% endif %}
|
|
1514
2662
|
|
|
1515
|
-
// add to solution times of previous rejected time steps
|
|
1516
|
-
Evaluate[ $ts_wall = $ts_wall + $ts2_wall - $ts1_wall, $ts_cpu = $ts_cpu + $ts2_cpu - $ts1_cpu ];
|
|
1517
2663
|
|
|
1518
|
-
|
|
1519
|
-
|
|
2664
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
2665
|
+
{ Name MagDyn_a_2D; NameOfFormulation Magnetodynamics_a_2D; NameOfSystem Sys_Mag_dyn;
|
|
2666
|
+
Quantity {
|
|
2667
|
+
{ Name a;
|
|
2668
|
+
Value {
|
|
2669
|
+
Term { [ {a} ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
{ Name az;
|
|
2673
|
+
Value {
|
|
2674
|
+
Term { [ CompZ[{a}] ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
{ Name b;
|
|
2678
|
+
Value {
|
|
2679
|
+
Term { [ {d a} ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
{ Name h;
|
|
2683
|
+
Value {
|
|
2684
|
+
Term { [ nu[{d a}] * {d a} ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; }
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
{ Name E_mag;
|
|
2688
|
+
Value {
|
|
2689
|
+
Integral { Type Global; [{d a}* {d a} * (nu[{d a}] /2 ) ]; In <<nc.omega>>_EM; Jacobian Jac_Vol_EM; Integration Int_EM; }
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
{% if dm.magnet.solve.thermal.solve_type %}
|
|
2693
|
+
{ Name jOverJc ;
|
|
2694
|
+
Value {
|
|
2695
|
+
Term { [ {is}/area_fct[] * 1/(criticalCurrentDensity[T_EM_fct[], {d a}] + 1) ] ; In <<nc.omega>><<nc.conducting>>_EM ; Jacobian Jac_Vol_EM ; }
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
1520
2698
|
{% endif %}
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
{
|
|
1524
|
-
// save solution to .res file
|
|
1525
|
-
SaveSolution[Sys_The];
|
|
1526
|
-
|
|
1527
|
-
Evaluate[ $tp1_wall = GetWallClockTime[], $tp1_cpu = GetCpuTime[] ];
|
|
1528
|
-
// print average temperature
|
|
1529
|
-
{% if (not dm.magnet.postproc.thermal.save_txt_at_the_end and dm.magnet.postproc.thermal.output_time_steps_txt) %}
|
|
1530
|
-
{% if dm.magnet.postproc.thermal.output_time_steps_txt > 1%}
|
|
1531
|
-
Test[$TimeStep > 1] {
|
|
1532
|
-
PostOperation[T_avg];
|
|
1533
|
-
}
|
|
2699
|
+
{% if dm.circuit.field_circuit %}
|
|
2700
|
+
<<cc_macros2.postPr_FCC(nc,dm,flag_active,init_ht,end_ht,aux)>>
|
|
1534
2701
|
{% else %}
|
|
1535
|
-
|
|
2702
|
+
{ Name js ;
|
|
2703
|
+
Value {
|
|
2704
|
+
Term { [ {is}*sign_fct[]/area_fct[] ]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; }
|
|
2705
|
+
}
|
|
2706
|
+
}
|
|
1536
2707
|
{% endif %}
|
|
1537
|
-
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
{% if (dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D") and dm.magnet.solve.thermal.solve_type%}
|
|
2711
|
+
{ Name Post_R_Quench_EM; NameOfFormulation Magnetodynamics_a_2D; NameOfSystem Sys_Mag_dyn;
|
|
2712
|
+
Quantity {
|
|
2713
|
+
{ Name R_Quench_EM;
|
|
2714
|
+
Value {
|
|
2715
|
+
Term { [
|
|
2716
|
+
quench_ratio_EM[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]
|
|
2717
|
+
|
|
2718
|
+
]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; }
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
{ Name Quench_Test;
|
|
2722
|
+
Value {
|
|
2723
|
+
Term { [
|
|
2724
|
+
TestQuench[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]
|
|
2725
|
+
|
|
2726
|
+
]; In <<nc.omega>><<nc.powered>>_EM; Jacobian Jac_Vol_EM; }
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2729
|
+
{% if dm.quench_protection.quench_heaters.quench_prop_model == "Wilson" %}
|
|
2730
|
+
{% set post_cv_temp_EM = dm.magnet.solve.thermal.init_temperature %}
|
|
2731
|
+
{% else %}
|
|
2732
|
+
{% set post_cv_temp_EM = "Ts[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]" %}
|
|
2733
|
+
{% endif %}
|
|
2734
|
+
{ Name cv_EM;
|
|
2735
|
+
Value {
|
|
2736
|
+
{% for name, cond in dm.conductors.items() %}
|
|
2737
|
+
{% if loop.index not in ECLIQ_conductors %}
|
|
2738
|
+
Term { [
|
|
2739
|
+
{% if dm.quench_protection.quench_heaters.quench_prop_model == "Wilson" %}(Tc[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]^4-<<dm.magnet.solve.thermal.init_temperature>>^4)/(4*<<dm.magnet.solve.thermal.init_temperature>>^3*(Tc[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]-<<dm.magnet.solve.thermal.init_temperature>>))*{% endif %}
|
|
2740
|
+
RuleOfMixtures[
|
|
2741
|
+
CFUN_CvCu_T[<<post_cv_temp_EM>>],
|
|
2742
|
+
CFUN_CvNb3Sn_T_B[<<post_cv_temp_EM>>, Norm[{d a}]],
|
|
2743
|
+
CFUN_CvG10_T[<<post_cv_temp_EM>>],
|
|
2744
|
+
CFUN_CvG10_T[<<post_cv_temp_EM>>]
|
|
2745
|
+
]
|
|
2746
|
+
{
|
|
2747
|
+
f_stabilizer_<<name>>,
|
|
2748
|
+
f_sc_<<name>>,
|
|
2749
|
+
f_inner_voids_<<name>>,
|
|
2750
|
+
f_outer_voids_<<name>>
|
|
2751
|
+
}
|
|
2752
|
+
]; In Omega_p_EM; Jacobian Jac_Vol_EM; }{% endif %}
|
|
2753
|
+
{% endfor %}
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
{ Name v_quench_EM;
|
|
2757
|
+
Value {
|
|
2758
|
+
Term { [
|
|
2759
|
+
NZPV[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]
|
|
2760
|
+
|
|
2761
|
+
]; In Omega_p_EM; Jacobian Jac_Vol_EM; }
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
{ Name Ts_EM;
|
|
2765
|
+
Value {
|
|
2766
|
+
Term { [
|
|
2767
|
+
Ts[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]
|
|
2768
|
+
|
|
2769
|
+
]; In Omega_p_EM; Jacobian Jac_Vol_EM; }
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
{ Name Tc_EM;
|
|
2773
|
+
Value {
|
|
2774
|
+
Term { [
|
|
2775
|
+
Tc[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]
|
|
2776
|
+
|
|
2777
|
+
]; In Omega_p_EM; Jacobian Jac_Vol_EM; }
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
{ Name Tcs_EM;
|
|
2781
|
+
Value {
|
|
2782
|
+
Term { [
|
|
2783
|
+
Tcs[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]]
|
|
2784
|
+
|
|
2785
|
+
]; In Omega_p_EM; Jacobian Jac_Vol_EM; }
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
{ Name rho_EM ;
|
|
2789
|
+
Value {
|
|
2790
|
+
Term { [ resistivity[T_EM_fct[],Norm[{d a}],Abs[CompZ[{is}]]] ] ;
|
|
2791
|
+
In <<nc.omega>><<nc.powered>>_EM ; Jacobian Jac_Vol_EM ; }
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
}
|
|
1538
2796
|
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
2797
|
+
{ Name Post_R_Quench_TH; NameOfFormulation Thermal_T; NameOfSystem Sys_The;
|
|
2798
|
+
Quantity {
|
|
2799
|
+
{ Name R_Quench_TH;
|
|
2800
|
+
Value {
|
|
2801
|
+
Term { [
|
|
2802
|
+
quench_ratio_TH[{T},Norm[{d a_after_projection}],I2TH_fct[]]
|
|
2803
|
+
|
|
2804
|
+
]; In <<nc.omega>><<nc.powered>>_TH; Jacobian Jac_Vol_TH; }
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
{% if dm.quench_protection.quench_heaters.quench_prop_model == "Wilson" %}
|
|
2808
|
+
{% set post_cv_temp_TH = dm.magnet.solve.thermal.init_temperature %}
|
|
2809
|
+
{% else %}
|
|
2810
|
+
{% set post_cv_temp_TH = "Ts[{T},Norm[{d a_after_projection}],I2TH_fct[]]" %}
|
|
2811
|
+
{% endif %}
|
|
2812
|
+
{ Name cv_TH;
|
|
2813
|
+
Value {
|
|
2814
|
+
{% for name, cond in dm.conductors.items() %}
|
|
2815
|
+
{% if loop.index not in ECLIQ_conductors %}
|
|
2816
|
+
Term { [
|
|
2817
|
+
{% if dm.quench_protection.quench_heaters.quench_prop_model == "Wilson" %}(Tc[{T},Norm[{d a_after_projection}],I2TH_fct[]]^4-<<dm.magnet.solve.thermal.init_temperature>>^4)/(4*<<dm.magnet.solve.thermal.init_temperature>>^3*(Tc[{T},Norm[{d a_after_projection}],I2TH_fct[]]-<<dm.magnet.solve.thermal.init_temperature>>))*{% endif %}
|
|
2818
|
+
RuleOfMixtures[
|
|
2819
|
+
CFUN_CvCu_T[<<post_cv_temp_TH>>],
|
|
2820
|
+
CFUN_CvNb3Sn_T_B[<<post_cv_temp_TH>>,Norm[{d a_after_projection}] ],
|
|
2821
|
+
CFUN_CvG10_T[<<post_cv_temp_TH>>],
|
|
2822
|
+
CFUN_CvG10_T[<<post_cv_temp_TH>>]
|
|
2823
|
+
]
|
|
2824
|
+
{
|
|
2825
|
+
f_stabilizer_<<name>>,
|
|
2826
|
+
f_sc_<<name>>,
|
|
2827
|
+
f_inner_voids_<<name>>,
|
|
2828
|
+
f_outer_voids_<<name>>
|
|
2829
|
+
}
|
|
2830
|
+
]; In Omega_p_TH; Jacobian Jac_Vol_TH; }{% endif %}
|
|
2831
|
+
{% endfor %}
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
{ Name v_quench_TH;
|
|
2835
|
+
Value {
|
|
2836
|
+
Term { [
|
|
2837
|
+
NZPV[{T},Norm[{d a_after_projection}],I2TH_fct[]]
|
|
2838
|
+
|
|
2839
|
+
]; In Omega_p_TH; Jacobian Jac_Vol_TH; }
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
{ Name Ts_TH;
|
|
2843
|
+
Value {
|
|
2844
|
+
Term { [
|
|
2845
|
+
Ts[{T},Norm[{d a_after_projection}],I2TH_fct[]]
|
|
2846
|
+
|
|
2847
|
+
]; In Omega_p_TH; Jacobian Jac_Vol_TH; }
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
{ Name Tc_TH;
|
|
2851
|
+
Value {
|
|
2852
|
+
Term { [
|
|
2853
|
+
Tc[{T},Norm[{d a_after_projection}],I2TH_fct[]]
|
|
2854
|
+
|
|
2855
|
+
]; In Omega_p_TH; Jacobian Jac_Vol_EM; }
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
{ Name Tcs_TH;
|
|
2859
|
+
Value {
|
|
2860
|
+
Term { [
|
|
2861
|
+
Tcs[{T},Norm[{d a_after_projection}],I2TH_fct[]]
|
|
2862
|
+
|
|
2863
|
+
]; In Omega_p_TH; Jacobian Jac_Vol_EM; }
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
{ Name rho_TH ;
|
|
2867
|
+
Value {
|
|
2868
|
+
Term { [ resistivity[{T}, Norm[{d a_after_projection}],I2TH_fct[]] ] ;
|
|
2869
|
+
In <<nc.omega>><<nc.powered>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
1544
2873
|
}
|
|
1545
|
-
{% else %}
|
|
1546
|
-
PostOperation[Map_T];
|
|
1547
2874
|
{% endif %}
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
PostOperation[PrintMaxTemp]; // save maximum temperature in register 1
|
|
1551
|
-
Evaluate[ $tp2_wall = GetWallClockTime[], $tp2_cpu = GetCpuTime[] ];
|
|
1552
|
-
|
|
1553
|
-
Evaluate[ $tp_wall = $tp2_wall - $tp1_wall, $tp_cpu = $tp2_cpu - $tp1_cpu ];
|
|
1554
|
-
|
|
1555
|
-
// cumulated times
|
|
1556
|
-
Evaluate[ $tg_cumul_wall = $tg_cumul_wall + $tg_wall, $tg_cumul_cpu = $tg_cumul_cpu + $tg_cpu, $ts_cumul_wall = $ts_cumul_wall + $ts_wall, $ts_cumul_cpu = $ts_cumul_cpu + $ts_cpu, $tp_cumul_wall = $tp_cumul_wall + $tp2_wall - $tp1_wall, $tp_cumul_cpu = $tp_cumul_cpu + $tp2_cpu - $tp1_cpu];
|
|
1557
|
-
|
|
1558
|
-
// print to file
|
|
1559
|
-
Print[{$TimeStep, $tg_wall, $tg_cpu, $ts_wall, $ts_cpu, $tp_wall, $tp_cpu, $tg_cumul_wall, $tg_cumul_cpu, $ts_cumul_wall, $ts_cumul_cpu, $tp_cumul_wall, $tp_cumul_cpu}, Format "%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g", File "computation_times.csv"];
|
|
1560
|
-
|
|
1561
|
-
// reset after accepted time step
|
|
1562
|
-
Evaluate[$tg_wall = 0, $tg_cpu = 0, $ts_wall = 0, $ts_cpu = 0];
|
|
1563
|
-
|
|
1564
|
-
// check if maximum temperature is reached
|
|
2875
|
+
{% endif %}
|
|
1565
2876
|
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
2877
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2878
|
+
{Name GetI2TH; NameOfFormulation {% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %}Magnetodynamics_a_2D{% else %}Magnetostatics_a_2D{% endif %}; NameOfSystem {% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %}Sys_Mag_dyn{% else %}Sys_Mag_static{% endif %};
|
|
2879
|
+
PostQuantity{
|
|
2880
|
+
{ Name I2TH ;
|
|
2881
|
+
Value {
|
|
2882
|
+
Integral { [ {is}/area_fct[]] ;
|
|
2883
|
+
In <<nc.omega>><<nc.powered>>_EM ; Jacobian Jac_Vol_EM ; Integration Int_EM ; }
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
1571
2886
|
}
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
// add to generation times of previous rejected time steps
|
|
1587
|
-
Evaluate[ $tg_wall = $tg_wall + $tg2_wall - $tg1_wall, $tg_cpu = $tg_cpu + $tg2_cpu - $tg1_cpu ];
|
|
1588
|
-
|
|
1589
|
-
Evaluate[ $ts1_wall = GetWallClockTime[], $ts1_cpu = GetCpuTime[] ];
|
|
1590
|
-
SolveJac Sys_The;
|
|
1591
|
-
Evaluate[ $ts2_wall = GetWallClockTime[], $ts2_cpu = GetCpuTime[] ];
|
|
1592
|
-
|
|
1593
|
-
// add to solution times of previous rejected time steps
|
|
1594
|
-
Evaluate[ $ts_wall = $ts_wall + $ts2_wall - $ts1_wall, $ts_cpu = $ts_cpu + $ts2_cpu - $ts1_cpu ];
|
|
2887
|
+
}
|
|
2888
|
+
{% if SIM_MODE == 'Th_Mag' %}
|
|
2889
|
+
{Name GetI2TH_sta; NameOfFormulation Magnetostatics_a_2D; NameOfSystem Sys_Mag_static;
|
|
2890
|
+
PostQuantity{
|
|
2891
|
+
{ Name I2TH ;
|
|
2892
|
+
Value {
|
|
2893
|
+
Integral { [ {is}/area_fct[]] ;
|
|
2894
|
+
In <<nc.omega>><<nc.powered>>_EM ; Jacobian Jac_Vol_EM ; Integration Int_EM ; }
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
{% endif %}
|
|
2900
|
+
{% endif %}
|
|
1595
2901
|
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
2902
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2903
|
+
{ Name Thermal_T ; NameOfFormulation Thermal_T ; NameOfSystem Sys_The ;
|
|
2904
|
+
PostQuantity {
|
|
2905
|
+
// Maximum temperature in bare part from register 1 (saved in post-operation by StoreMaxInRegister)
|
|
2906
|
+
{% if 'collar' in areas_to_build['TH'] %}
|
|
2907
|
+
{ Name Tmax_col; Value{Term{ Type Global; [#1]; In <<nc.omega>><<nc.collar>>_TH;}}}
|
|
2908
|
+
{% endif %}
|
|
2909
|
+
|
|
2910
|
+
{ Name T_init_col; Value{Term{ Type Global; [<<dm.magnet.solve.thermal.init_temperature>>];}}}
|
|
2911
|
+
|
|
2912
|
+
{ Name Tmax; Value{Term{ Type Global; [#1]; In <<nc.omega>>_TH;}}}
|
|
2913
|
+
// Temperature
|
|
2914
|
+
{ Name T ;
|
|
2915
|
+
Value {
|
|
2916
|
+
Local { [ {T} ] ;
|
|
2917
|
+
In <<nc.omega>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
{% if SIM_MODE == 'Th_Mag_sta' %}
|
|
2921
|
+
{ Name jOverJc ;
|
|
2922
|
+
Value {
|
|
2923
|
+
Term { [ {% if dm.circuit.field_circuit %}I2TH_fct[]{% else %}i_fct[]{% endif %}/area_fct[] * 1/(criticalCurrentDensity[{T}, Norm[{d a_after_projection}]] + 1) ] ;
|
|
2924
|
+
In <<nc.omega>><<nc.conducting>>_TH ; Jacobian Jac_Vol_TH ; } // area_fct[] is used on the thermal domain
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
{% endif%}
|
|
2928
|
+
// Temperature average as integral quantity
|
|
2929
|
+
{ Name T_avg ;
|
|
2930
|
+
Value {
|
|
2931
|
+
Integral { [ {T} / area_fct[] ] ;
|
|
2932
|
+
In Region[ {<<nc.omega>><<nc.powered>>_TH{% for area in areas_to_build['TH'] %}, <<nc.omega>><<nc[area]>>_TH{% endfor %}{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %} } ] ; Jacobian Jac_Vol_TH ; Integration Int_TH; }
|
|
2933
|
+
|
|
2934
|
+
{% if not dm.magnet.geometry.thermal.use_TSA %}
|
|
2935
|
+
Integral { [ {T} / area_fct[] ] ;
|
|
2936
|
+
In <<nc.omega>><<nc.insulator>>_TH ; Jacobian Jac_Vol_TH ; Integration Int_TH; }
|
|
2937
|
+
{% endif %}
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
{ Name b_thermal ;
|
|
2941
|
+
Value {
|
|
2942
|
+
Local { [{d a_after_projection}] ;
|
|
2943
|
+
In <<nc.omega>>_noninsulation_areas_TH; Jacobian Jac_Vol_TH ; }
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
1600
2946
|
|
|
1601
|
-
|
|
1602
|
-
|
|
2947
|
+
{ Name b_thermal_Gaussian_points ;
|
|
2948
|
+
Value {
|
|
2949
|
+
Local { [GetVariable[ElementNum[], QuadraturePointIndex[]]{$b_before_projection}] ;
|
|
2950
|
+
In <<nc.omega>>_noninsulation_areas_TH; Jacobian Jac_Vol_TH ; }
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
1603
2953
|
|
|
1604
|
-
|
|
1605
|
-
|
|
2954
|
+
{ Name rho ;
|
|
2955
|
+
Value {
|
|
2956
|
+
Term { [ resistivity[{T}, Norm[{d a_after_projection}],I2TH_fct[]] ] ;
|
|
2957
|
+
In <<nc.omega>><<nc.powered>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
{ Name az_thermal ;
|
|
2961
|
+
Value {
|
|
2962
|
+
Term { [CompZ[{a_after_projection}] ]; In <<nc.omega>>_noninsulation_areas_TH; Jacobian Jac_Vol_TH; }
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
1606
2967
|
|
|
1607
|
-
|
|
2968
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2969
|
+
{ Name post_projection; NameOfFormulation Projection_EM_to_TH; NameOfSystem sys_Mag_projection;
|
|
2970
|
+
PostQuantity {
|
|
2971
|
+
{ Name b_before_projection ;
|
|
2972
|
+
Value {
|
|
2973
|
+
Term { [Norm[{d a_before_projection}]] ;
|
|
2974
|
+
In <<nc.omega>><<nc.powered>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
{ Name b_after_projection ;
|
|
2978
|
+
Value {
|
|
2979
|
+
Term { [{d a_after_projection}] ;
|
|
2980
|
+
In <<nc.omega>><<nc.powered>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
{% endif %}
|
|
1608
2986
|
{% endif %}
|
|
2987
|
+
}
|
|
1609
2988
|
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
2989
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
2990
|
+
PostOperation PrintMaxTemp UsingPost Thermal_T {
|
|
2991
|
+
// Get maximum in bare region and store in register 1
|
|
2992
|
+
Print[ T, OnElementsOf <<nc.omega>>_TH, StoreMaxInRegister 1, Format Table,
|
|
2993
|
+
LastTimeStepOnly 1, SendToServer "No"] ;
|
|
2994
|
+
Print[ Tmax, OnRegion Region[<<rm_TH.powered['r1_a1'].vol.numbers[0]>>], File "Tmax.txt", Format TimeTable, LastTimeStepOnly 1, AppendToExistingFile 1, SendToServer "No"]; // Pick a random Region
|
|
2995
|
+
}
|
|
2996
|
+
{% if 'collar' in areas_to_build['TH'] %}
|
|
2997
|
+
PostOperation PrintMaxTemp_col UsingPost Thermal_T {
|
|
2998
|
+
// Get maximum in collar region and store in register 1
|
|
2999
|
+
Print[ T, OnElementsOf <<nc.omega>><<nc.collar>>_TH , StoreMaxInRegister 1, Format TimeTable,
|
|
3000
|
+
LastTimeStepOnly 1, SendToServer "No"] ;
|
|
3001
|
+
Print[ Tmax_col, OnRegion <<nc.omega>><<nc.collar>>_TH ,
|
|
3002
|
+
File "Tmax_col.txt", Format Table, LastTimeStepOnly 1, AppendToExistingFile 1, SendToServer "No"];
|
|
3003
|
+
}
|
|
1613
3004
|
{% endif %}
|
|
3005
|
+
{% endif %}
|
|
1614
3006
|
|
|
1615
|
-
|
|
1616
|
-
|
|
3007
|
+
PostOperation {
|
|
3008
|
+
{ Name Dummy; NameOfPostProcessing {% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %} Thermal_T {% elif SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %} MagDyn_a_2D {% else %} MagSta_a_2D {% endif %};
|
|
3009
|
+
Operation { }
|
|
3010
|
+
}
|
|
3011
|
+
{% if dm.circuit.field_circuit %}
|
|
3012
|
+
<<cc_macros2.postOP_FCC(nc,rm_EM,dm,flag_active,regions_CC,init_ht,SIM_MODE,ESC_dict,ECLIQ_dict)>>
|
|
1617
3013
|
{% endif %}
|
|
1618
|
-
Evaluate[ $tp2_wall = GetWallClockTime[], $tp2_cpu = GetCpuTime[] ];
|
|
1619
|
-
|
|
1620
|
-
Evaluate[ $tp_wall = $tp2_wall - $tp1_wall, $tp_cpu = $tp2_cpu - $tp1_cpu ];
|
|
1621
3014
|
|
|
1622
|
-
|
|
1623
|
-
|
|
3015
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Mag_dyn_0' %}
|
|
3016
|
+
{ Name Map_a; NameOfPostProcessing MagDyn_a_2D;
|
|
3017
|
+
Operation {
|
|
3018
|
+
{% for var_name, vol_name in zip(dm.magnet.postproc.electromagnetics.variables, dm.magnet.postproc.electromagnetics.volumes) %}
|
|
3019
|
+
Print[ <<var_name>>, OnElementsOf <<vol_name>>_EM, File "<<var_name>>_<<vol_name>>.pos"] ;
|
|
3020
|
+
{% endfor %}
|
|
3021
|
+
//Print[ E_mag, OnGlobal , File "E_mag.csv", Format Table, Comma, SendToServer "No", AppendToExistingFile 1] ;
|
|
3022
|
+
//Print [ b, OnLine {{List[{0,0,0}]}{List[{<<rm_EM.air_far_field.vol.radius_out>>,0,0}]}} {1000}, Format SimpleTable, File "Center_line.csv"];
|
|
3023
|
+
}
|
|
1624
3024
|
}
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
3025
|
|
|
1628
|
-
|
|
1629
|
-
{% if dm.magnet.solve.
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
3026
|
+
|
|
3027
|
+
{% if (dm.quench_protection.quench_heaters.quench_propagation == "2Dx1D" or dm.quench_protection.e_cliq.quench_propagation == "2Dx1D") and dm.magnet.solve.thermal.solve_type%}
|
|
3028
|
+
{ Name Map_R_quench; NameOfPostProcessing Post_R_Quench_EM;
|
|
3029
|
+
Operation {
|
|
3030
|
+
// Print[ R_Quench_EM, OnElementsOf Omega_p_EM , File "QR_EM.csv", Format Table, Comma, SendToServer "No", AppendToExistingFile 1] ;
|
|
3031
|
+
Print[ Quench_Test, OnElementsOf Omega_p_EM , File "Test_Quench.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3032
|
+
Print[ R_Quench_EM, OnElementsOf Omega_p_EM , File "QR_EM.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3033
|
+
Print[ Ts_EM, OnElementsOf Omega_p_EM , File "Ts_EM.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3034
|
+
Print[ Tc_EM, OnElementsOf Omega_p_EM , File "Tc_EM.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3035
|
+
Print[ Tcs_EM, OnElementsOf Omega_p_EM , File "Tcs_EM.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3036
|
+
Print[ v_quench_EM, OnElementsOf Omega_p_EM , File "v_quench_EM.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3037
|
+
Print[ cv_EM, OnElementsOf Omega_p_EM , File "cv_EM.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3038
|
+
Print[ rho_EM, OnElementsOf Omega_p_EM , File "rho_EM.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3039
|
+
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
{ Name Map_R_quench_TH; NameOfPostProcessing Post_R_Quench_TH;
|
|
3044
|
+
Operation {
|
|
3045
|
+
Print[ R_Quench_TH, OnElementsOf Omega_p_TH , File "QR_TH.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3046
|
+
Print[ Ts_TH, OnElementsOf Omega_p_TH , File "Ts_TH.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3047
|
+
Print[ Tc_TH, OnElementsOf Omega_p_TH , File "Tc_TH.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3048
|
+
Print[ Tcs_TH, OnElementsOf Omega_p_TH , File "Tcs_TH.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3049
|
+
Print[ v_quench_TH, OnElementsOf Omega_p_TH , File "v_quench_TH.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3050
|
+
Print[ cv_TH, OnElementsOf Omega_p_TH , File "cv_TH.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3051
|
+
Print[ rho_TH, OnElementsOf Omega_p_TH , File "rho_TH.pos", SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1] ;
|
|
3052
|
+
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
{% endif %}
|
|
3056
|
+
{ Name conv; NameOfPostProcessing MagDyn_a_2D;
|
|
3057
|
+
Operation {
|
|
3058
|
+
Print[ E_mag, OnGlobal] ;
|
|
1655
3059
|
}
|
|
1656
|
-
}
|
|
1657
3060
|
}
|
|
1658
|
-
|
|
1659
|
-
{
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
3061
|
+
{% if dm.circuit.field_circuit %}
|
|
3062
|
+
{ Name conv2; NameOfPostProcessing MagDyn_a_2D;
|
|
3063
|
+
Operation {
|
|
3064
|
+
Print[ I_, OnRegion Omega_PS_R_c_r] ;
|
|
3065
|
+
{% if flag_active['ECLIQ'] %}
|
|
3066
|
+
Print[ I_, OnRegion Omega_ECLIQ_R_leads_1] ;
|
|
3067
|
+
Print[ I_, OnRegion Omega_ECLIQ_R_leads_2] ;
|
|
3068
|
+
Print[ I_, OnRegion Omega_ECLIQ_R_leads_3] ;
|
|
3069
|
+
Print[ I_, OnRegion Omega_ECLIQ_R_leads_4] ;
|
|
3070
|
+
{% endif %}
|
|
3071
|
+
// Print[ I_, OnRegion Omega_PS_R_3] ;
|
|
3072
|
+
// Print[ I_, OnRegion Omega_PS_R_1] ;
|
|
1669
3073
|
}
|
|
1670
3074
|
}
|
|
3075
|
+
{% endif %}
|
|
3076
|
+
{% endif %}
|
|
1671
3077
|
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
3078
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Mag_sta' or SIM_MODE == 'Mag_dyn' %}
|
|
3079
|
+
{ Name Map_a_sta; NameOfPostProcessing MagSta_a_2D;
|
|
3080
|
+
Operation {
|
|
3081
|
+
{% for var_name, vol_name in zip(dm.magnet.postproc.electromagnetics.variables, dm.magnet.postproc.electromagnetics.volumes) %}
|
|
3082
|
+
Print[ <<var_name>>, OnElementsOf <<vol_name>>_EM, File "<<var_name>>_<<vol_name>>.pos"] ;
|
|
3083
|
+
{% endfor %}
|
|
3084
|
+
//Print [ b, OnLine {{List[{0,0,0}]}{List[{<<rm_EM.air_far_field.vol.radius_out>>,0,0}]}} {1000}, Format SimpleTable, File "Center_line.csv"];
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
{% if dm.circuit.field_circuit and (SIM_MODE == 'Mag_sta' or SIM_MODE == 'Th_Mag_sta' or SIM_MODE == 'Th_Mag' or SIM_MODE == 'Mag_dyn' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Mag_dyn_0' ) %}
|
|
3088
|
+
{ Name conv2_sta; NameOfPostProcessing MagSta_a_2D;
|
|
3089
|
+
Operation {
|
|
3090
|
+
Print[ I_, OnRegion Omega_PS_R_c_r] ;
|
|
3091
|
+
// Print[ I_, OnRegion Omega_PS_R_3] ;
|
|
3092
|
+
// Print[ I_, OnRegion Omega_PS_R_1] ;
|
|
1681
3093
|
}
|
|
1682
3094
|
}
|
|
3095
|
+
{% endif %}
|
|
3096
|
+
{% endif %}
|
|
1683
3097
|
|
|
1684
|
-
// Temperature average as integral quantity
|
|
1685
|
-
{ Name T_avg ;
|
|
1686
|
-
Value {
|
|
1687
|
-
Integral { [ {T} / area_fct[] ] ;
|
|
1688
|
-
In Region[ {<<nc.omega>><<nc.powered>>_TH{% if dm.magnet.geometry.thermal.with_iron_yoke %}, <<nc.omega>><<nc.iron>>{% endif %}{% if dm.magnet.geometry.thermal.with_wedges %}, <<nc.omega>><<nc.induced>>_TH{% endif %} } ] ; Jacobian Jac_Vol_TH ; Integration Int_conducting_TH; }
|
|
1689
3098
|
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
3099
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' or SIM_MODE == 'Th_Mag_sta' %}
|
|
3100
|
+
{ Name b_thermal; NameOfPostProcessing Thermal_T;
|
|
3101
|
+
Operation {
|
|
3102
|
+
Print[ b_thermal, OnElementsOf <<nc.omega>>_noninsulation_areas_TH, File "b_thermal.pos"] ;
|
|
1694
3103
|
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
{
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
Local { [GetVariable[ElementNum[], QuadraturePointIndex[]]{$Bnorm}] ;
|
|
1701
|
-
In <<nc.omega>><<nc.powered>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
3104
|
+
}
|
|
3105
|
+
{% if SIM_MODE == 'Th_Mag' or SIM_MODE == 'Th_Mag_0' %}
|
|
3106
|
+
{ Name b_after_projection_pos; NameOfPostProcessing post_projection;
|
|
3107
|
+
Operation {
|
|
3108
|
+
Print[ b_after_projection, OnElementsOf <<nc.omega>><<nc.powered>>_TH, File "b_after_projection.pos"] ;
|
|
1702
3109
|
}
|
|
1703
|
-
|
|
1704
|
-
|
|
3110
|
+
}
|
|
3111
|
+
{% endif %}
|
|
1705
3112
|
|
|
1706
|
-
{ Name
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
3113
|
+
{ Name Map_T; NameOfPostProcessing Thermal_T;
|
|
3114
|
+
{% if dm.magnet.postproc.thermal.output_time_steps_pos > 1 %}
|
|
3115
|
+
{% if dm.magnet.solve.thermal.solve_type and dm.magnet.solve.electromagnetics.solve_type == 'transient' %}
|
|
3116
|
+
{% set resample_step = (dm.magnet.solve.time_stepping.final_time - dm.magnet.solve.time_stepping.initial_time)/dm.magnet.postproc.thermal.output_time_steps_pos %}
|
|
3117
|
+
{% set last_time_step_only = 0 %}
|
|
3118
|
+
ResampleTime[<<dm.magnet.solve.time_stepping.initial_time>>, <<dm.magnet.solve.time_stepping.final_time>>, <<resample_step>>];
|
|
3119
|
+
{% else %}
|
|
3120
|
+
{% set resample_step = (dm.magnet.solve.thermal.time_stepping.final_time - dm.magnet.solve.thermal.time_stepping.initial_time)/dm.magnet.postproc.thermal.output_time_steps_pos %}
|
|
3121
|
+
{% set last_time_step_only = 0 %}
|
|
3122
|
+
ResampleTime[<<dm.magnet.solve.thermal.time_stepping.initial_time>>, <<dm.magnet.solve.thermal.time_stepping.final_time>>, <<resample_step>>];
|
|
3123
|
+
{% endif %}
|
|
3124
|
+
{% elif (dm.magnet.postproc.thermal.output_time_steps_pos == 1 and not dm.magnet.postproc.thermal.save_pos_at_the_end) %}
|
|
3125
|
+
{% set last_time_step_only = 1 %}
|
|
1710
3126
|
{% else %}
|
|
1711
|
-
|
|
3127
|
+
{% set last_time_step_only = 0 %}
|
|
1712
3128
|
{% endif %}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
{ Name post_projection; NameOfFormulation Projection_EM_to_TH; NameOfSystem sys_Mag_projection;
|
|
1721
|
-
PostQuantity {
|
|
1722
|
-
{ Name b_before_projection ;
|
|
1723
|
-
Value {
|
|
1724
|
-
Term { [Norm[{d a_before_projection}]] ;
|
|
1725
|
-
In <<nc.omega>><<nc.powered>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
{ Name b_after_projection ;
|
|
1729
|
-
Value {
|
|
1730
|
-
Term { [GetVariable[ElementNum[], QuadraturePointIndex[]]{$Bnorm}] ;
|
|
1731
|
-
In <<nc.omega>><<nc.powered>>_TH ; Jacobian Jac_Vol_TH ; }
|
|
3129
|
+
Operation {
|
|
3130
|
+
{% for var_name, vol_name in zip(dm.magnet.postproc.thermal.variables, dm.magnet.postproc.thermal.volumes) %}
|
|
3131
|
+
Print[ <<var_name>>, OnElementsOf <<vol_name>>_TH, File "<<var_name>>_<<vol_name>>.pos", SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>> ] ;
|
|
3132
|
+
{% endfor %}
|
|
3133
|
+
//Print[ T, OnElementsOf <<nc.omega>>_TH, File "T_<<nc.omega>>.pos", SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>> ] ;
|
|
3134
|
+
//Print[ JoverJc, OnElementsOf <<nc.omega>><<nc.powered>>_TH, File "JoverJc_<<nc.omega>><<nc.powered>>.pos", SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>>, AtGaussPoints 4, Depth 0 ] ;
|
|
3135
|
+
//Print[ rho, OnElementsOf <<nc.omega>><<nc.powered>>_TH, File "rho_<<nc.omega>><<nc.powered>>.pos", SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>> ] ;
|
|
1732
3136
|
}
|
|
1733
|
-
}
|
|
1734
3137
|
}
|
|
1735
|
-
}
|
|
1736
|
-
{% endif %}
|
|
1737
|
-
{% endif %}
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
{% if dm.magnet.solve.thermal.solve_type %}
|
|
1741
|
-
PostOperation PrintMaxTemp UsingPost Thermal_T {
|
|
1742
|
-
// Get maximum in bare region and store in register 1
|
|
1743
|
-
Print[ T, OnElementsOf <<nc.omega>>_TH, StoreMaxInRegister 1, Format Table,
|
|
1744
|
-
LastTimeStepOnly 1, SendToServer "No"] ;
|
|
1745
|
-
}
|
|
1746
|
-
{% endif %}
|
|
1747
|
-
|
|
1748
|
-
PostOperation {
|
|
1749
|
-
{ Name Dummy; NameOfPostProcessing {% if dm.magnet.solve.thermal.solve_type %} Thermal_T {% else %} MagSta_a_2D {% endif %};
|
|
1750
|
-
Operation { }
|
|
1751
|
-
}
|
|
1752
3138
|
|
|
1753
|
-
{
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
3139
|
+
{ Name T_avg; NameOfPostProcessing Thermal_T;
|
|
3140
|
+
{% if dm.magnet.postproc.thermal.output_time_steps_txt > 1 %}
|
|
3141
|
+
{% if dm.magnet.solve.thermal.solve_type and dm.magnet.solve.electromagnetics.solve_type == 'transient' %}
|
|
3142
|
+
{% set resample_step = (dm.magnet.solve.time_stepping.final_time - dm.magnet.solve.time_stepping.initial_time)/dm.magnet.postproc.thermal.output_time_steps_pos %}
|
|
3143
|
+
{% set last_time_step_only = 0 %}
|
|
3144
|
+
ResampleTime[<<dm.magnet.solve.time_stepping.initial_time>>, <<dm.magnet.solve.time_stepping.final_time>>, <<resample_step>>];
|
|
3145
|
+
{% else %}
|
|
3146
|
+
{% set resample_step = (dm.magnet.solve.thermal.time_stepping.final_time - dm.magnet.solve.thermal.time_stepping.initial_time)/dm.magnet.postproc.thermal.output_time_steps_pos %}
|
|
3147
|
+
{% set last_time_step_only = 0 %}
|
|
3148
|
+
ResampleTime[<<dm.magnet.solve.thermal.time_stepping.initial_time>>, <<dm.magnet.solve.thermal.time_stepping.final_time>>, <<resample_step>>];
|
|
3149
|
+
{% endif %}
|
|
3150
|
+
{% elif (dm.magnet.postproc.thermal.output_time_steps_txt == 1 and not dm.magnet.postproc.thermal.save_txt_at_the_end) %}
|
|
3151
|
+
{% set last_time_step_only = 1 %}
|
|
3152
|
+
{% else %}
|
|
3153
|
+
{% set last_time_step_only = 0 %}
|
|
3154
|
+
{% endif %}
|
|
3155
|
+
Operation {
|
|
3156
|
+
// writes pairs of time step and average temperature to file, one line for each time step
|
|
3157
|
+
{% for idx, half_turn in enumerate(rm_TH.powered['r1_a1'].vol.numbers + rm_TH.powered['r2_a1'].vol.numbers + rm_TH.powered['r1_a2'].vol.numbers + rm_TH.powered['r2_a2'].vol.numbers ) %}
|
|
3158
|
+
Print[ T_avg[Region[<<half_turn>>]], OnGlobal, File "T_avg/T_avg_<<idx>>.txt", Format Table, SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>>, StoreInVariable $T_a_<<idx>>] ;
|
|
3159
|
+
{% endfor %}
|
|
3160
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
3161
|
+
{% set ht_max=len(rm_TH.powered['r1_a1'].vol.numbers + rm_TH.powered['r2_a1'].vol.numbers + rm_TH.powered['r1_a2'].vol.numbers + rm_TH.powered['r2_a2'].vol.numbers)%}
|
|
3162
|
+
{% for idx, phy_elem in enumerate( rm_TH.induced['r1_a1'].vol.numbers + rm_TH.induced['r2_a1'].vol.numbers + rm_TH.induced['r1_a2'].vol.numbers + rm_TH.induced['r2_a2'].vol.numbers) %}
|
|
3163
|
+
Print[ T_avg[Region[<<phy_elem>>]], OnGlobal, File "T_avg/T_avg_<<idx+ht_max>>.txt", Format Table, SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>>, StoreInVariable $T_a_<<idx+ht_max>>] ;
|
|
3164
|
+
{% endfor %}
|
|
3165
|
+
{% endif %}
|
|
3166
|
+
}
|
|
1760
3167
|
}
|
|
1761
|
-
|
|
1762
|
-
{
|
|
1763
|
-
|
|
1764
|
-
{%
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
3168
|
+
{% if dm.magnet.geometry.thermal.with_wedges %}
|
|
3169
|
+
{ Name T_avg_init; NameOfPostProcessing Thermal_T; // for the initial temperature
|
|
3170
|
+
{% set ht_max=len(rm_TH.powered['r1_a1'].vol.numbers + rm_TH.powered['r2_a1'].vol.numbers + rm_TH.powered['r1_a2'].vol.numbers + rm_TH.powered['r2_a2'].vol.numbers)%}
|
|
3171
|
+
{% for idx, phy_elem in enumerate( rm_TH.induced['r1_a1'].vol.numbers + rm_TH.induced['r2_a1'].vol.numbers + rm_TH.induced['r1_a2'].vol.numbers + rm_TH.induced['r2_a2'].vol.numbers) %}
|
|
3172
|
+
Operation{
|
|
3173
|
+
Print[ T_init_col, OnGlobal, File "T_avg/T_avg_<<idx+ht_max>>.txt", Format Table, SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1, StoreInVariable $T_a_<<idx+ht_max>>] ;
|
|
3174
|
+
}
|
|
3175
|
+
{% endfor %}
|
|
1769
3176
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
3177
|
+
{% endif %}
|
|
3178
|
+
{% if USE_THERMAL_PROJECTION %}
|
|
3179
|
+
{ Name T_avg_collar; NameOfPostProcessing Thermal_T;
|
|
3180
|
+
Operation {
|
|
3181
|
+
Print[ T_avg[<<nc.omega>><<nc.collar>>_TH], OnGlobal, File "T_av_col.txt", Format Table, SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1, StoreInVariable $T_a_col] ;
|
|
3182
|
+
}
|
|
1775
3183
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
{% if dm.magnet.postproc.thermal.output_time_steps_pos > 1 %}
|
|
1781
|
-
{% set resample_step = (dm.magnet.solve.thermal.time_stepping.final_time - dm.magnet.solve.thermal.time_stepping.initial_time)/dm.magnet.postproc.thermal.output_time_steps_pos %}
|
|
1782
|
-
{% set last_time_step_only = 0 %}
|
|
1783
|
-
ResampleTime[<<dm.magnet.solve.thermal.time_stepping.initial_time>>, <<dm.magnet.solve.thermal.time_stepping.final_time>>, <<resample_step>>];
|
|
1784
|
-
{% elif (dm.magnet.postproc.thermal.output_time_steps_pos == 1 and not dm.magnet.postproc.thermal.save_pos_at_the_end) %}
|
|
1785
|
-
{% set last_time_step_only = 1 %}
|
|
1786
|
-
{% else %}
|
|
1787
|
-
{% set last_time_step_only = 0 %}
|
|
1788
|
-
{% endif %}
|
|
1789
|
-
Operation {
|
|
1790
|
-
{% for var_name, vol_name in zip(dm.magnet.postproc.thermal.variables, dm.magnet.postproc.thermal.volumes) %}
|
|
1791
|
-
Print[ <<var_name>>, OnElementsOf <<vol_name>>_TH, File "<<var_name>>_<<vol_name>>.pos", SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>> ] ;
|
|
1792
|
-
{% endfor %}
|
|
1793
|
-
//Print[ JoverJc, OnElementsOf <<nc.omega>><<nc.powered>>_TH, File "JoverJc_<<nc.omega>><<nc.powered>>.pos", SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>>, AtGaussPoints 4, Depth 0 ] ;
|
|
1794
|
-
//Print[ rho, OnElementsOf <<nc.omega>><<nc.powered>>_TH, File "rho_<<nc.omega>><<nc.powered>>.pos", SendToServer "No", LastTimeStepOnly <<last_time_step_only>>, AppendToExistingFile <<last_time_step_only>> ] ;
|
|
3184
|
+
{ Name T_avg_collar_init; NameOfPostProcessing Thermal_T; // for the initial temperature
|
|
3185
|
+
Operation {
|
|
3186
|
+
Print[ T_init_col, OnGlobal, File "T_av_col.txt", Format Table, SendToServer "No", LastTimeStepOnly 1, AppendToExistingFile 1, StoreInVariable $T_a_col] ; //DEBUG why is this always 0 ?
|
|
3187
|
+
}
|
|
1795
3188
|
}
|
|
1796
|
-
|
|
3189
|
+
{% endif %}
|
|
1797
3190
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
}
|
|
3191
|
+
{ Name GetI2TH; NameOfPostProcessing GetI2TH;
|
|
3192
|
+
Operation {
|
|
3193
|
+
Print[ I2TH[Region[<<pol_['right']>>]], OnGlobal, File "I2TH/I2TH_Mag_r.txt", Format Table, SendToServer "No", LastTimeStepOnly 0, AppendToExistingFile 0, StoreInVariable $I2TH_1] ;
|
|
3194
|
+
Print[ I2TH[Region[<<pol_['left']>>]], OnGlobal, File "I2TH/I2TH_Mag_l.txt", Format Table, SendToServer "No", LastTimeStepOnly 0, AppendToExistingFile 0, StoreInVariable $I2TH_2] ;
|
|
3195
|
+
{% for i,ht in enumerate(aux.half_turns.ADD_COILS) %}
|
|
3196
|
+
Print[ I2TH[Region[<<'ht'~ht~'_EM'>>]], OnGlobal, File "I2TH/I2TH_.txt", Format Table, SendToServer "No", LastTimeStepOnly 0, AppendToExistingFile 0, StoreInVariable $I2TH_<<i+3>>] ;
|
|
3197
|
+
{% endfor %}
|
|
3198
|
+
|
|
3199
|
+
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
{% if SIM_MODE == 'Th_Mag' %}
|
|
3203
|
+
{ Name GetI2TH_sta; NameOfPostProcessing GetI2TH_sta;
|
|
3204
|
+
Operation {
|
|
3205
|
+
Print[ I2TH[Region[<<pol_['right']>>]], OnGlobal, File "I2TH/I2TH_r.txt", Format Table, SendToServer "No", LastTimeStepOnly 0, AppendToExistingFile 0, StoreInVariable $I2TH_1] ;
|
|
3206
|
+
Print[ I2TH[Region[<<pol_['left']>>]], OnGlobal, File "I2TH/I2TH_l.txt", Format Table, SendToServer "No", LastTimeStepOnly 0, AppendToExistingFile 0, StoreInVariable $I2TH_2] ;
|
|
3207
|
+
{% for i,ht in enumerate(aux.half_turns.ADD_COILS) %}
|
|
3208
|
+
Print[ I2TH[Region[<<'ht'~ht~'_EM'>>]], OnGlobal, File "I2TH/I2TH_.txt", Format Table, SendToServer "No", LastTimeStepOnly 0, AppendToExistingFile 0, StoreInVariable $I2TH_<<i+3>>] ;
|
|
3209
|
+
{% endfor %}
|
|
3210
|
+
|
|
3211
|
+
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
{% endif %}
|
|
3215
|
+
{% endif %}
|
|
3216
|
+
}
|