Coverage for fiqus/data/DataFiQuS.py: 100%
43 statements
« prev ^ index » next coverage.py v7.4.4, created at 2025-11-13 01:34 +0000
« prev ^ index » next coverage.py v7.4.4, created at 2025-11-13 01:34 +0000
1from pydantic import BaseModel, Field
2from typing import Dict, List, Union, Literal, Optional, Any
4from fiqus.data.DataModelCommon import EnergyExtraction, CLIQ_Class, ESC_Class, E_CLIQ_Class, QuenchDetection, Circuit_Class, PowerSupplyClass, QuenchHeater
5from fiqus.data.DataConductor import Conductor
6from fiqus.data.DataFiQuSCCT import CCT
7from fiqus.data.DataFiQuSMultipole import Multipole
8from fiqus.data.DataFiQuSPancake3D import Pancake3D
9from fiqus.data.DataFiQuSConductorAC_Strand import CACStrand
13class RunFiQuS(BaseModel):
14 """
15 Class for FiQuS run
16 """
18 type: Literal[
19 "start_from_yaml",
20 "mesh_only",
21 "geometry_only",
22 "geometry_and_mesh",
23 "pre_process_only",
24 "mesh_and_solve_with_post_process_python",
25 "solve_with_post_process_python",
26 "solve_only",
27 "post_process_getdp_only",
28 "post_process_python_only",
29 "post_process",
30 "plot_python",
31 "batch_post_process_python",
32 "only_create_pro_file_from_mesh",
33 "postprocess_veusz"
34 ] = Field(
35 default="start_from_yaml",
36 title="Run Type of FiQuS",
37 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.",
38 )
39 geometry: Optional[Union[str, int]] = Field(
40 default=None,
41 title="Geometry Folder Key",
42 description="This key will be appended to the geometry folder.",
43 )
44 mesh: Optional[Union[str, int]] = Field(
45 default=None,
46 title="Mesh Folder Key",
47 description="This key will be appended to the mesh folder.",
48 )
49 solution: Optional[Union[str, int]] = Field(
50 default=None,
51 title="Solution Folder Key",
52 description="This key will be appended to the solution folder.",
53 )
54 launch_gui: bool = Field(
55 default=False,
56 title="Launch GUI",
57 description="If True, the GUI will be launched after the run.",
58 )
59 overwrite: bool = Field(
60 default=False,
61 title="Overwrite",
62 description="If True, the existing folders will be overwritten, otherwise new folders will be created. NOTE: This setting has no effect for HTCondor runs.",
63 )
64 comments: str = Field(
65 default="",
66 title="Comments",
67 description="Comments for the run. These comments will be saved in the run_log.csv file.",
68 )
69 verbosity_Gmsh: int = Field(
70 default=5,
71 title="verbosity_Gmsh",
72 description="Level of information printed on the terminal and the message console (0: silent except for fatal errors, 1: +errors, 2: +warnings, 3: +direct, 4: +information, 5: +status, 99: +debug)",
73 )
74 verbosity_GetDP: int = Field(
75 default=5,
76 title="verbosity_GetDP",
77 description="Level of information printed on the terminal and the message console. Higher number prints more, good options are 5 or 6.",
78 )
79 verbosity_FiQuS: bool = Field(
80 default=True,
81 title="verbosity_FiQuS",
82 description="Level of information printed on the terminal and the message console by FiQuS. Only True of False for now.",
83 )
86class GeneralFiQuS(BaseModel):
87 """
88 Class for FiQuS general
89 """
91 magnet_name: Optional[str] = None
94# class QuenchHeaters(BaseModel):
95# """
96# Level 3: Class for FiQuS
97# """
99# N_strips: Optional[int] = None # set to 0 to avoid building quench heater thin shells
100# t_trigger: Optional[List[float]] = None
101# U0: Optional[List[float]] = None
102# C: Optional[List[float]] = None
103# R_warm: Optional[List[float]] = None
104# w: Optional[List[float]] = None
105# h: Optional[List[float]] = None
106# h_ins: List[List[float]] = []
107# type_ins: List[List[str]] = []
108# h_ground_ins: List[List[float]] = []
109# type_ground_ins: List[List[str]] = []
110# l: Optional[List[float]] = None
111# l_copper: Optional[List[float]] = None
112# l_stainless_steel: Optional[List[float]] = None
113# ids: Optional[List[int]] = None
114# turns: Optional[List[int]] = None
115# turns_sides: Optional[List[str]] = None
119class QuenchProtection(BaseModel):
120 """
121 Level 2: Class for FiQuS
122 """
124 energy_extraction: EnergyExtraction = EnergyExtraction()
125 quench_heaters: QuenchHeater = QuenchHeater()
126 cliq: CLIQ_Class = CLIQ_Class()
127 esc: ESC_Class = ESC_Class()
128 e_cliq: E_CLIQ_Class = E_CLIQ_Class()
131class SolveDumpDataModel(BaseModel):
132 solve: Any # this is populated with magnet.solve section in MainFiQuS when dumping the yaml file for reference. The is no information on type in the solve section, so going for "Any" here
133 circuit: Circuit_Class = Circuit_Class()
134 power_supply: PowerSupplyClass = PowerSupplyClass()
135 quench_protection: QuenchProtection = QuenchProtection()
136 quench_detection: QuenchDetection = QuenchDetection()
137 conductors: Dict[Optional[str], Conductor] = {}
140class FDM(BaseModel):
141 """
142 Class for FiQuS
143 """
145 general: GeneralFiQuS = GeneralFiQuS()
146 run: RunFiQuS = RunFiQuS()
147 magnet: Union[Multipole, CCT, Pancake3D, CACStrand] = Field(
148 default=Multipole(), discriminator="type"
149 )
150 circuit: Circuit_Class = Circuit_Class()
151 power_supply: PowerSupplyClass = PowerSupplyClass()
152 quench_protection: QuenchProtection = QuenchProtection()
153 quench_detection: QuenchDetection = QuenchDetection()
154 conductors: Dict[Optional[str], Conductor] = {}