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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. fiqus/MainFiQuS.py +15 -5
  2. fiqus/data/DataConductor.py +301 -0
  3. fiqus/data/DataFiQuS.py +5 -2
  4. fiqus/data/DataFiQuSConductor.py +84 -0
  5. fiqus/data/DataFiQuSConductorAC_Strand.py +565 -0
  6. fiqus/data/DataFiQuSPancake3D.py +149 -39
  7. fiqus/data/RegionsModelFiQuS.py +4 -2
  8. fiqus/geom_generators/GeometryCCT.py +19 -17
  9. fiqus/geom_generators/GeometryConductorAC_Strand.py +1391 -0
  10. fiqus/getdp_runners/RunGetdpConductorAC_Strand.py +202 -0
  11. fiqus/getdp_runners/RunGetdpMultipole.py +4 -4
  12. fiqus/mains/MainConductorAC_Strand.py +133 -0
  13. fiqus/mesh_generators/MeshCCT.py +8 -8
  14. fiqus/mesh_generators/MeshConductorAC_Strand.py +657 -0
  15. fiqus/mesh_generators/MeshMultipole.py +11 -8
  16. fiqus/mesh_generators/MeshPancake3D.py +20 -18
  17. fiqus/plotters/PlotPythonConductorAC.py +855 -0
  18. fiqus/post_processors/PostProcessConductorAC.py +49 -0
  19. fiqus/pro_assemblers/ProAssembler.py +4 -3
  20. fiqus/pro_templates/combined/CCT_template.pro +25 -25
  21. fiqus/pro_templates/combined/ConductorAC_template.pro +1025 -0
  22. fiqus/pro_templates/combined/Multipole_template.pro +5 -5
  23. fiqus/pro_templates/combined/Pancake3D_template.pro +131 -46
  24. fiqus/pro_templates/combined/materials.pro +13 -9
  25. {fiqus-2024.5.2.dist-info → fiqus-2024.7.0.dist-info}/METADATA +2 -1
  26. {fiqus-2024.5.2.dist-info → fiqus-2024.7.0.dist-info}/RECORD +34 -22
  27. {fiqus-2024.5.2.dist-info → fiqus-2024.7.0.dist-info}/WHEEL +1 -1
  28. tests/test_geometry_generators.py +41 -0
  29. tests/test_mesh_generators.py +45 -0
  30. tests/test_solvers.py +52 -0
  31. tests/utils/fiqus_test_classes.py +42 -6
  32. tests/utils/generate_reference_files_ConductorAC.py +57 -0
  33. tests/utils/generate_reference_files_Pancake3D.py +92 -0
  34. {fiqus-2024.5.2.dist-info → fiqus-2024.7.0.dist-info}/top_level.txt +0 -0
fiqus/MainFiQuS.py CHANGED
@@ -2,6 +2,11 @@ import os
2
2
  import getpass
3
3
  import time
4
4
  import argparse
5
+ import pathlib
6
+ import sys
7
+
8
+ FiQuS_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
9
+ sys.path.insert(0, FiQuS_path)
5
10
 
6
11
  from fiqus.utils.Utils import initialize_logger
7
12
  from fiqus.utils.Utils import FilesAndFolders as Util
@@ -10,6 +15,7 @@ from fiqus.data import DataFiQuS as dF
10
15
  from fiqus.mains.MainMultipole import MainMultipole
11
16
  from fiqus.mains.MainCCT import MainCCT
12
17
  from fiqus.mains.MainPancake3D import MainPancake3D
18
+ from fiqus.mains.MainConductorAC_Strand import MainConductorAC_Strand
13
19
 
14
20
 
15
21
  class MainFiQuS:
@@ -68,6 +74,8 @@ class MainFiQuS:
68
74
 
69
75
  elif self.fdm.magnet.type == "Pancake3D":
70
76
  self.main_magnet = MainPancake3D(fdm=self.fdm, verbose=verbose)
77
+ elif self.fdm.magnet.type == "CACStrand":
78
+ self.main_magnet = MainConductorAC_Strand(fdm=self.fdm, inputs_folder_path=pathlib.Path(input_file_path).parent, outputs_folder_path=model_folder, verbose=verbose)
71
79
  else:
72
80
  raise ValueError(
73
81
  f"FiQuS does not support magnet type: {self.fdm.magnet.type}!"
@@ -251,7 +259,7 @@ class MainFiQuS:
251
259
  self.main_magnet.generate_geometry()
252
260
  self.main_magnet.pre_process()
253
261
  self.main_magnet.load_geometry()
254
- for key, value in self.main_magnet.mesh().items():
262
+ for key, value in self.main_magnet.mesh(gui=self.main_magnet.fdm.run.launch_gui).items():
255
263
  self.summary[key] = value
256
264
  elif (
257
265
  self.fdm.run.type == "mesh_and_solve_with_post_process_python"
@@ -310,6 +318,8 @@ class MainFiQuS:
310
318
  self.summary[key] = value
311
319
  elif self.fdm.run.type == "plot_python":
312
320
  self.main_magnet.plot_python()
321
+ elif self.fdm.run.type == "batch_post_process_python":
322
+ self.main_magnet.batch_post_process_python()
313
323
  os.chdir(self.start_folder)
314
324
 
315
325
 
@@ -320,18 +330,18 @@ if __name__ == "__main__":
320
330
  epilog="steam-team@cern.ch",
321
331
  )
322
332
  parser.add_argument(
323
- "--in",
324
333
  dest="full_path_input",
325
334
  type=str,
326
335
  help="Full path to FiQuS input yaml file",
327
336
  )
328
337
  parser.add_argument(
329
- "--out", dest="output_path", type=str, help="Full path to FiQuS output folder"
338
+ "--output", '-o', dest="output_path", type=str, help="Full path to FiQuS output folder"
330
339
  )
331
340
  parser.add_argument(
332
- "--getdp", dest="GetDP_path", type=str, help="Full path to GetDP executable"
341
+ "--getdp", '-g', dest="GetDP_path", type=str, help="Full path to GetDP executable"
333
342
  )
334
- args = parser.parse_args()
343
+ args, unknown = parser.parse_known_args()
344
+ # args = parser.parse_args()
335
345
  # print(args.full_path_input)
336
346
  # print(args.output_path)
337
347
  # print(args.GetDP_path)
@@ -0,0 +1,301 @@
1
+ from pydantic import BaseModel, Field
2
+ from typing import Union, Literal, Optional
3
+
4
+ # ------------------- Jc fits ---------------------------#
5
+ class ConstantJc(BaseModel):
6
+ """
7
+ Level 3: Class for setting constant Jc
8
+ """
9
+
10
+ type: Literal["Constant Jc"]
11
+ Jc_constant: Optional[float] = None # [A/m^2]
12
+
13
+
14
+ class Ic_A_NbTi(BaseModel):
15
+ """
16
+ Level 3: Class for setting IcNbTi fit
17
+ """
18
+
19
+ type: Literal["Ic_A_NbTi"]
20
+ Jc_5T_4_2K: Optional[float] = None # [A/m^2]
21
+
22
+
23
+ class Bottura(BaseModel):
24
+ """
25
+ Level 3: Class for setting Bottura fit
26
+ """
27
+
28
+ type: Literal["Bottura"]
29
+ Tc0_Bottura: Optional[float] = None # [K]
30
+ Bc20_Bottura: Optional[float] = None # [T]
31
+ Jc_ref_Bottura: Optional[float] = None # [A/m^2]
32
+ C0_Bottura: Optional[float] = None # [-]
33
+ alpha_Bottura: Optional[float] = None # [-]
34
+ beta_Bottura: Optional[float] = None # [-]
35
+ gamma_Bottura: Optional[float] = None # [-]
36
+
37
+
38
+ class CUDI1(BaseModel):
39
+ """
40
+ Level 3: Class for Nb-Ti fit based on "Fit 1" in CUDI manual
41
+ """
42
+
43
+ type: Literal["CUDI1"]
44
+ Tc0_CUDI1: Optional[float] = None # [K]
45
+ Bc20_CUDI1: Optional[float] = None # [T]
46
+ C1_CUDI1: Optional[float] = None # [A]
47
+ C2_CUDI1: Optional[float] = None # [A/T]
48
+
49
+
50
+ class CUDI3(BaseModel):
51
+ """
52
+ Level 3: Class for Nb-Ti fit based on "Fit 3" in CUDI manual
53
+ """
54
+
55
+ type: Literal["CUDI3"]
56
+ Tc0_CUDI3: Optional[float] = None # [K]
57
+ Bc20_CUDI3: Optional[float] = None # [T]
58
+ c1_CUDI3: Optional[float] = None # [-]
59
+ c2_CUDI3: Optional[float] = None # [-]
60
+ c3_CUDI3: Optional[float] = None # [-]
61
+ c4_CUDI3: Optional[float] = None # [-]
62
+ c5_CUDI3: Optional[float] = None # [-]
63
+ c6_CUDI3: Optional[float] = None # [-]
64
+
65
+
66
+ class Summers(BaseModel):
67
+ """
68
+ Level 3: Class for cable Summer's Nb3Sn fit
69
+ """
70
+
71
+ type: Literal["Summers"]
72
+ Tc0_Summers: Optional[float] = None # [K]
73
+ Bc20_Summers: Optional[float] = None # [T]
74
+ Jc0_Summers: Optional[float] = None # [A*T^0.5/m^2]
75
+
76
+
77
+ class Bordini(BaseModel):
78
+ """
79
+ Level 3: Class for cable Bordini's Nb3Sn fit
80
+ """
81
+
82
+ type: Literal["Bordini"]
83
+ Tc0_Bordini: Optional[float] = None # [K]
84
+ Bc20_Bordini: Optional[float] = None # [T]
85
+ C0_Bordini: Optional[float] = None # [A*T/m^2]
86
+ alpha_Bordini: Optional[float] = None # [-]
87
+
88
+
89
+ class BSCCO_2212_LBNL(BaseModel):
90
+ """
91
+ Level 3: Class for cable Bi-2212 fit developed in LBNL
92
+ """
93
+
94
+ # only ad-hoc fit [T. Shen, D. Davis, E. Ravaioli with LBNL, Berkeley, CA]
95
+ type: Literal["BSCCO_2212_LBNL"]
96
+ f_scaling_Jc_BSCCO2212: Optional[float] = None # [-] used for the ad-hoc fit
97
+
98
+
99
+ # ------------------- Cable types ---------------------------#
100
+ class Mono(BaseModel):
101
+ """
102
+ Mono cable type: This is basically type of cable consisting of one strand - not really a cable
103
+ """
104
+
105
+ type: Literal["Mono"]
106
+ bare_cable_width: Optional[float] = None
107
+ bare_cable_height_low: Optional[float] = None
108
+ bare_cable_height_high: Optional[float] = None
109
+ bare_cable_height_mean: Optional[float] = None
110
+ th_insulation_along_width: Optional[float] = None
111
+ th_insulation_along_height: Optional[float] = None
112
+ # Fractions given with respect to the insulated conductor
113
+ f_superconductor: Optional[float] = None
114
+ f_stabilizer: Optional[float] = None # (related to CuFraction in ProteCCT)
115
+ f_insulation: Optional[float] = None
116
+ f_inner_voids: Optional[float] = None
117
+ f_outer_voids: Optional[float] = None
118
+ # Available materials depend on the component and on the selected program
119
+ material_insulation: Optional[str] = None
120
+ material_inner_voids: Optional[str] = None
121
+ material_outer_voids: Optional[str] = None
122
+
123
+
124
+ class Rutherford(BaseModel):
125
+ """
126
+ Rutherford cable type: for example LHC MB magnet cable
127
+ """
128
+
129
+ type: Literal["Rutherford"]
130
+ n_strands: Optional[int] = None
131
+ n_strand_layers: Optional[int] = None
132
+ n_strands_per_layers: Optional[int] = None
133
+ bare_cable_width: Optional[float] = None
134
+ bare_cable_height_low: Optional[float] = None
135
+ bare_cable_height_high: Optional[float] = None
136
+ bare_cable_height_mean: Optional[float] = None
137
+ th_insulation_along_width: Optional[float] = None
138
+ th_insulation_along_height: Optional[float] = None
139
+ width_core: Optional[float] = None
140
+ height_core: Optional[float] = None
141
+ strand_twist_pitch: Optional[float] = None
142
+ strand_twist_pitch_angle: Optional[float] = None
143
+ Rc: Optional[float] = None
144
+ Ra: Optional[float] = None
145
+ # Fractions given with respect to the insulated conductor
146
+ f_superconductor: Optional[float] = None
147
+ f_stabilizer: Optional[float] = None # (related to CuFraction in ProteCCT)
148
+ f_insulation: Optional[float] = None
149
+ f_inner_voids: Optional[float] = None
150
+ f_outer_voids: Optional[float] = None
151
+ f_core: Optional[float] = None
152
+ # Available materials depend on the component and on the selected program
153
+ material_insulation: Optional[str] = None
154
+ material_inner_voids: Optional[str] = None
155
+ material_outer_voids: Optional[str] = None
156
+ material_core: Optional[str] = None
157
+
158
+
159
+ class Ribbon(BaseModel):
160
+ """
161
+ Mono cable type: This is basically type of cable consisting of one strand - not really a cable
162
+ """
163
+
164
+ type: Literal["Ribbon"]
165
+ n_strands: Optional[int] = (
166
+ None # This defines the number of "strands" in the ribbon cable, which are physically glued but electrically in series
167
+ )
168
+ bare_cable_width: Optional[float] = None
169
+ bare_cable_height_low: Optional[float] = None
170
+ bare_cable_height_high: Optional[float] = None
171
+ bare_cable_height_mean: Optional[float] = None
172
+ th_insulation_along_width: Optional[float] = (
173
+ None # This defines the thickness of the insulation around each strand (DIFFERENT FROM ROXIE CADATA FILE)
174
+ )
175
+ th_insulation_along_height: Optional[float] = (
176
+ None # This defines the thickness of the insulation around each strand (DIFFERENT FROM ROXIE CADATA FILE)
177
+ )
178
+ # Fractions given with respect to the insulated conductor
179
+ f_superconductor: Optional[float] = None
180
+ f_stabilizer: Optional[float] = None # (related to CuFraction in ProteCCT)
181
+ f_insulation: Optional[float] = None
182
+ f_inner_voids: Optional[float] = None
183
+ f_outer_voids: Optional[float] = None
184
+ f_core: Optional[float] = None
185
+ # Available materials depend on the component and on the selected program
186
+ material_insulation: Optional[str] = None
187
+ material_inner_voids: Optional[str] = None
188
+ material_outer_voids: Optional[str] = None
189
+ material_core: Optional[str] = None
190
+
191
+
192
+ # ------------------- Conductors ---------------------------#
193
+
194
+ # class MaterialSuperconductor(BaseModel):
195
+ # """
196
+ # Level 3: Class for strand superconductor material parameters
197
+ # """
198
+ # material: Optional[str] = Field(default=None, description="Material of the superconductor. E.g. NbTi, Nb3Sn, etc.")
199
+ # n_value: Optional[float] = Field(default=None, description="n value of the superconductor (for power law fit).")
200
+ # ec: Optional[float] = Field(default=None, description="Critical electric field of the superconductor.")
201
+ # Cv_material: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the superconductor.")
202
+
203
+ # class MaterialStabilizer(BaseModel):
204
+ # """
205
+ # Level 3: Class for strand stabilizer material parameters
206
+ # """
207
+
208
+ # rho_material: Optional[Union[str, float]] = Field(default=None, description="Material function for resistivity of the stabilizer. Constant resistivity can be given as float.")
209
+ # RRR: Optional[float] = Field(default=None, description="Residual resistivity ratio of the stabilizer.")
210
+ # T_ref_RRR_high: Optional[float] = Field(default=None, description="Upper reference temperature for RRR measurements.")
211
+ # T_ref_RRR_low: Optional[float] = Field(default=None, description="Lower reference temperature for RRR measurements.")
212
+ # k_material: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the stabilizer.")
213
+ # Cv_material: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the stabilizer.")
214
+
215
+
216
+ class Round(BaseModel):
217
+ """
218
+ Level 2: Class for strand parameters
219
+ """
220
+
221
+ type: Literal["Round"]
222
+ fil_twist_pitch: Optional[float] = None # Strand twist pitch
223
+ diameter: Optional[float] = None # ds_inGroup (LEDET), DConductor (BBQ), DStrand (ProteCCT)
224
+ diameter_core: Optional[float] = None # dcore_inGroup (LEDET)
225
+ diameter_filamentary: Optional[float] = None # dfilamentary_inGroup (LEDET)
226
+ filament_diameter: Optional[float] = None # df_inGroup (LEDET)
227
+ number_of_filaments: Optional[int] = None # nf_inGroup (LEDET)
228
+ f_Rho_effective: Optional[float] = None
229
+ Cu_noCu_in_strand: Optional[float] = None
230
+
231
+ # -- Superconductor parameters -- #
232
+ material_superconductor: Optional[str] = Field(default=None, description="Material of the superconductor. E.g. Nb-Ti, Nb3Sn, etc.")
233
+ n_value_superconductor: Optional[float] = Field(default=None, description="n value of the superconductor (for power law fit).")
234
+ ec_superconductor: Optional[float] = Field(default=None, description="Critical electric field of the superconductor.")
235
+ k_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the superconductor.")
236
+ Cv_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the superconductor.")
237
+ # -- Stabilizer parameters -- #
238
+ material_stabilizer: Optional[str] = Field(default=None, description="Material of the stabilizer.")
239
+ rho_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for resistivity of the stabilizer. Constant resistivity can be given as float.")
240
+ RRR: Optional[float] = Field(default=None, description="Residual resistivity ratio of the stabilizer.")
241
+ T_ref_RRR_high: Optional[float] = Field(default=None, description="Upper reference temperature for RRR measurements.")
242
+ T_ref_RRR_low: Optional[float] = Field(default=None, description="Lower reference temperature for RRR measurements.")
243
+ k_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the stabilizer.")
244
+ Cv_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the stabilizer.")
245
+
246
+ # superconductor: MaterialSuperconductor = MaterialSuperconductor()
247
+ # stabilizer: MaterialStabilizer = MaterialStabilizer()
248
+
249
+
250
+ class Rectangular(BaseModel):
251
+ """
252
+ Level 2: Class for strand parameters
253
+ """
254
+
255
+ type: Literal["Rectangular"]
256
+ bare_width: Optional[float] = None
257
+ bare_height: Optional[float] = None
258
+ Cu_noCu_in_strand: Optional[float] = None
259
+ filament_diameter: Optional[float] = None # df_inGroup (LEDET)
260
+ f_Rho_effective: Optional[float] = None
261
+ fil_twist_pitch: Optional[float] = None
262
+ bare_corner_radius: Optional[float] = None
263
+
264
+ # -- Superconductor parameters -- #
265
+ material_superconductor: Optional[str] = Field(default=None, description="Material of the superconductor. E.g. NbTi, Nb3Sn, etc.")
266
+ n_value_superconductor: Optional[float] = Field(default=None, description="n value of the superconductor (for power law fit).")
267
+ ec_superconductor: Optional[float] = Field(default=None, description="Critical electric field of the superconductor.")
268
+ k_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the superconductor.")
269
+ Cv_material_superconductor: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the superconductor.")
270
+ # -- Stabilizer parameters -- #
271
+ material_stabilizer: Optional[str] = Field(default=None, description="Material of the stabilizer.")
272
+ rho_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for resistivity of the stabilizer. Constant resistivity can be given as float.")
273
+ RRR: Optional[float] = Field(default=None, description="Residual resistivity ratio of the stabilizer.")
274
+ T_ref_RRR_high: Optional[float] = Field(default=None, description="Upper reference temperature for RRR measurements.")
275
+ T_ref_RRR_low: Optional[float] = Field(default=None, description="Lower reference temperature for RRR measurements.")
276
+ k_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Thermal conductivity of the stabilizer.")
277
+ Cv_material_stabilizer: Optional[Union[str, float]] = Field(default=None, description="Material function for specific heat of the stabilizer.")
278
+
279
+ # superconductor: MaterialSuperconductor = MaterialSuperconductor()
280
+ # stabilizer: MaterialStabilizer = MaterialStabilizer()
281
+
282
+
283
+
284
+ # ------------------- Conductors ---------------------------#
285
+
286
+
287
+ class Conductor(BaseModel):
288
+ """
289
+ Level 1: Class for conductor parameters
290
+ """
291
+
292
+ version: Optional[str] = None
293
+ case: Optional[str] = None
294
+ state: Optional[str] = None
295
+ cable: Union[Rutherford, Mono, Ribbon] = {
296
+ "type": "Rutherford"
297
+ } # TODO: Busbar, Rope, Roebel, CORC, TSTC, CICC
298
+ strand: Union[Round, Rectangular] = {"type": "Round"} # TODO: Tape, WIC
299
+ Jc_fit: Union[ConstantJc, Bottura, CUDI1, CUDI3, Summers, Bordini, BSCCO_2212_LBNL, Ic_A_NbTi] = {
300
+ "type": "CUDI1"
301
+ } # TODO: CUDI other numbers? , Roxie?
fiqus/data/DataFiQuS.py CHANGED
@@ -1,9 +1,11 @@
1
1
  from pydantic import BaseModel, Field
2
2
  from typing import (Dict, List, Union, Literal, Optional)
3
+ from fiqus.data.DataConductor import Conductor
3
4
  from fiqus.data.DataRoxieParser import RoxieData
4
5
  from fiqus.data.DataFiQuSMultipole import MPDM
5
6
  from fiqus.data.DataFiQuSCCT import CCTDM
6
7
  from fiqus.data.DataFiQuSPancake3D import Pancake3D
8
+ from fiqus.data.DataFiQuSConductorAC_Strand import CACStrand
7
9
 
8
10
 
9
11
  class MonoFiQuS(BaseModel):
@@ -75,7 +77,7 @@ class RunFiQuS(BaseModel):
75
77
  """
76
78
  Class for FiQuS run
77
79
  """
78
- type: Literal["start_from_yaml", "mesh_only", "geometry_only", "geometry_and_mesh", "pre_process_only", "mesh_and_solve_with_post_process_python", "solve_with_post_process_python", "solve_only", "post_process_getdp_only", "post_process_python_only", "post_process"] = Field(default="start_from_yaml", title="Run Type of FiQuS", description="FiQuS allows you to run the model in different ways. The run type can be specified here. For example, you can just create the geometry and mesh or just solve the model with previous mesh, etc.")
80
+ type: Literal["start_from_yaml", "mesh_only", "geometry_only", "geometry_and_mesh", "pre_process_only", "mesh_and_solve_with_post_process_python", "solve_with_post_process_python", "solve_only", "post_process_getdp_only", "post_process_python_only", "post_process", "batch_post_process_python"] = Field(default="start_from_yaml", title="Run Type of FiQuS", description="FiQuS allows you to run the model in different ways. The run type can be specified here. For example, you can just create the geometry and mesh or just solve the model with previous mesh, etc.")
79
81
  geometry: Optional[Union[str, int]] = Field(default=None, title="Geometry Folder Key", description="This key will be appended to the geometry folder.")
80
82
  mesh: Optional[Union[str, int]] = Field(default=None, title="Mesh Folder Key", description="This key will be appended to the mesh folder.")
81
83
  solution: Optional[Union[str, int]] = Field(default=None, title="Solution Folder Key", description="This key will be appended to the solution folder.")
@@ -176,5 +178,6 @@ class FDM(BaseModel):
176
178
  """
177
179
  general: GeneralFiQuS = GeneralFiQuS()
178
180
  run: RunFiQuS = RunFiQuS()
179
- magnet: Union[MPDM, CCTDM, Pancake3D] = Field(default=MPDM(), discriminator='type')
181
+ magnet: Union[MPDM, CCTDM, Pancake3D, CACStrand] = Field(default=MPDM(), discriminator='type')
180
182
  power_supply: PowerSupply = PowerSupply()
183
+ conductors: Dict[Optional[str], Conductor] = {}
@@ -0,0 +1,84 @@
1
+ from pydantic import BaseModel, Field, ConfigDict
2
+ from typing import Dict, List, Optional
3
+
4
+
5
+ class Area(BaseModel):
6
+ Material: Optional[str] = Field(
7
+ None, description="Material of the area", examples=["Cu", "NbTi", "Nb3Sn"]
8
+ )
9
+ Boundary: List[int] = (
10
+ []
11
+ ) # List of curves that define the closed boundary of the area
12
+ InnerBoundaries: List[List[int]] = (
13
+ []
14
+ ) # List of lists of curves that define the closed boundaries of the holes in the area
15
+ BoundaryThickness: Optional[Optional[float]] = None # Thickness of the boundary
16
+ BoundaryMaterial: Optional[str] = Field(
17
+ None,
18
+ description="Material of the boundary",
19
+ examples=["steel", "Cu", "direct", "etc."],
20
+ )
21
+ Layer: Optional[int] = Field(
22
+ None,
23
+ description="Filaments in the strand-model must be assigned to a layer. A layer is a collection of all filaments with the same radius from the center.",
24
+ )
25
+ LayerIndex: Optional[int] = Field(
26
+ None, description="Index of the filament in the layer."
27
+ )
28
+
29
+ # ========== GEOMETRY YAML CLASSES ========== #
30
+ class Material(BaseModel):
31
+ Type: Optional[str] = Field(
32
+ None, description="Type of material", examples=["NbTi", "Nb3Sn", "Cu"]
33
+ )
34
+ RRR: Optional[float] = Field(None, description="Residual resistivity ratio")
35
+ T_ref_RRR_high: Optional[float] = Field(
36
+ None, description="High reference temperature for RRR"
37
+ )
38
+ T_ref_RRR_low: Optional[float] = Field(
39
+ None, description="Low reference temperature for RRR"
40
+ )
41
+ model_config = ConfigDict(frozen=True)
42
+
43
+
44
+ class Point(BaseModel):
45
+ Coordinates: List[float] = []
46
+
47
+
48
+ class Curve(BaseModel):
49
+ Type: str
50
+ Points: List[int] = []
51
+
52
+ Contact: Optional[str] = Field(
53
+ None,
54
+ description="If the curve is a contact layer between two surfaces this represents the contact type of strands",
55
+ examples=["crossing", "parallel"],
56
+ )
57
+ Thickness: Optional[float] = Field(
58
+ None, description="Thickness of the contact layer"
59
+ )
60
+ Material: Optional[str] = Field(
61
+ None,
62
+ description="Material of the contact layer",
63
+ examples=["steel", "direct", "Cu"],
64
+ )
65
+
66
+
67
+
68
+
69
+ class GeometryParameters(BaseModel):
70
+ Points: Dict[int, Point] = {}
71
+ Curves: Dict[int, Curve] = {}
72
+ Areas: Dict[int, Area] = {}
73
+
74
+
75
+ class SolutionParameters(BaseModel):
76
+ Materials: Dict[str, Material] = {}
77
+ Surfaces_excluded_from_TI: List[int] = []
78
+
79
+
80
+ class Conductor(BaseModel):
81
+ Geometry: GeometryParameters = GeometryParameters()
82
+ Solution: SolutionParameters = SolutionParameters()
83
+
84
+