Coverage for fiqus/data/DataFiQuS.py: 100%
93 statements
« prev ^ index » next coverage.py v6.4.4, created at 2024-05-20 03:24 +0200
« prev ^ index » next coverage.py v6.4.4, created at 2024-05-20 03:24 +0200
1from pydantic import BaseModel, Field
2from typing import (Dict, List, Union, Literal, Optional)
3from fiqus.data.DataRoxieParser import RoxieData
4from fiqus.data.DataFiQuSMultipole import MPDM
5from fiqus.data.DataFiQuSCCT import CCTDM
6from fiqus.data.DataFiQuSPancake3D import Pancake3D
9class MonoFiQuS(BaseModel):
10 """
11 Rutherford cable type
12 """
13 type: Literal['Mono']
14 bare_cable_width: Optional[float] = None
15 bare_cable_height_mean: Optional[float] = None
18class RibbonFiQuS(BaseModel):
19 """
20 Rutherford cable type
21 """
22 type: Literal['Ribbon']
23 bare_cable_width: Optional[float] = None
24 bare_cable_height_mean: Optional[float] = None
27class RutherfordFiQuS(BaseModel):
28 """
29 Rutherford cable type
30 """
31 type: Literal['Rutherford']
32 bare_cable_width: Optional[float] = None
33 bare_cable_height_mean: Optional[float] = None
36class ConductorFiQuS(BaseModel):
37 """
38 Class for conductor type
39 """
40 cable: Union[RutherfordFiQuS, RibbonFiQuS, MonoFiQuS] = {'type': 'Rutherford'}
43class GeneralSetting(BaseModel):
44 """
45 Class for general information on the case study
46 """
47 I_ref: Optional[List[float]] = None
50class ModelDataSetting(BaseModel):
51 """
52 Class for model data
53 """
54 general_parameters: GeneralSetting = GeneralSetting()
55 conductors: Dict[str, ConductorFiQuS] = {}
57#######################################################################################################################
60class FiQuSGeometry(BaseModel):
61 """
62 Class for Roxie data
63 """
64 Roxie_Data: RoxieData = RoxieData()
67class FiQuSSettings(BaseModel):
68 """
69 Class for FiQuS model
70 """
71 Model_Data_GS: ModelDataSetting = ModelDataSetting()
74class RunFiQuS(BaseModel):
75 """
76 Class for FiQuS run
77 """
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.")
79 geometry: Optional[Union[str, int]] = Field(default=None, title="Geometry Folder Key", description="This key will be appended to the geometry folder.")
80 mesh: Optional[Union[str, int]] = Field(default=None, title="Mesh Folder Key", description="This key will be appended to the mesh folder.")
81 solution: Optional[Union[str, int]] = Field(default=None, title="Solution Folder Key", description="This key will be appended to the solution folder.")
82 launch_gui: bool = Field(default=True, title="Launch GUI", description="If True, the GUI will be launched after the run.")
83 overwrite: bool = Field(default=False, title="Overwrite", description="If True, the existing folders will be overwritten, otherwise new folders will be created.")
84 comments: str = Field(default="", title="Comments", description="Comments for the run. These comments will be saved in the run_log.csv file.")
87class GeneralFiQuS(BaseModel):
88 """
89 Class for FiQuS general
90 """
91 magnet_name: Optional[str] = None
94class EnergyExtraction(BaseModel):
95 """
96 Level 3: Class for FiQuS
97 """
98 t_trigger: Optional[float] = None
99 R_EE: Optional[float] = None
100 power_R_EE: Optional[float] = None
101 L: Optional[float] = None
102 C: Optional[float] = None
105class QuenchHeaters(BaseModel):
106 """
107 Level 3: Class for FiQuS
108 """
109 N_strips: Optional[int] = None
110 t_trigger: Optional[List[float]] = None
111 U0: Optional[List[float]] = None
112 C: Optional[List[float]] = None
113 R_warm: Optional[List[float]] = None
114 w: Optional[List[float]] = None
115 h: Optional[List[float]] = None
116 h_ins: List[List[float]] = []
117 type_ins: List[List[str]] = []
118 h_ground_ins: List[List[float]] = []
119 type_ground_ins: List[List[str]] = []
120 l: Optional[List[float]] = None
121 l_copper: Optional[List[float]] = None
122 l_stainless_steel: Optional[List[float]] = None
123 ids: Optional[List[int]] = None
124 turns: Optional[List[int]] = None
125 turns_sides: Optional[List[str]] = None
128class Cliq(BaseModel):
129 """
130 Level 3: Class for FiQuS
131 """
132 t_trigger: Optional[float] = None
133 current_direction: Optional[List[int]] = None
134 sym_factor: Optional[int] = None
135 N_units: Optional[int] = None
136 U0: Optional[float] = None
137 C: Optional[float] = None
138 R: Optional[float] = None
139 L: Optional[float] = None
140 I0: Optional[float] = None
143class Circuit(BaseModel):
144 """
145 Level 2: Class for FiQuS
146 """
147 R_circuit: Optional[float] = None
148 L_circuit: Optional[float] = None
149 R_parallel: Optional[float] = None
152class PowerSupply(BaseModel):
153 """
154 Level 2: Class for FiQuS
155 """
156 I_initial: Optional[float] = None
157 t_off: Optional[float] = None
158 t_control_LUT: List[float] = Field(None, title="Time Values for Current Source", description="This list of time values will be matched with the current values in I_control_LUT, and then these (t, I) points will be connected with straight lines.")
159 I_control_LUT: List[float] = Field(None, title="Current Values for Current Source" ,description="This list of current values will be matched with the time values in t_control_LUT, and then these (t, I) points will be connected with straight lines.")
160 R_crowbar: Optional[float] = None
161 Ud_crowbar: Optional[float] = None
164class QuenchProtection(BaseModel):
165 """
166 Level 2: Class for FiQuS
167 """
168 energy_extraction: EnergyExtraction = EnergyExtraction()
169 quench_heaters: QuenchHeaters = QuenchHeaters()
170 cliq: Cliq = Cliq()
173class FDM(BaseModel):
174 """
175 Class for FiQuS
176 """
177 general: GeneralFiQuS = GeneralFiQuS()
178 run: RunFiQuS = RunFiQuS()
179 magnet: Union[MPDM, CCTDM, Pancake3D] = Field(default=MPDM(), discriminator='type')
180 power_supply: PowerSupply = PowerSupply()