Coverage for fiqus/data/DataFiQuSMultipole.py: 100%

219 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2026-02-01 01:38 +0000

1from pydantic import BaseModel, Field 

2from typing import List, Dict, Literal, Union, Optional, Tuple 

3 

4 

5class MultipoleGeoElement(BaseModel): 

6 """ 

7 Level 5: Class for FiQuS Multipole 

8 """ 

9 lines: Optional[int] = Field( 

10 default=3, 

11 description="It specifies the number of Gaussian points for lines.", 

12 ) 

13 triangles: Optional[Literal[1, 3, 4, 6, 7, 12, 13, 16]] = Field( 

14 default=3, 

15 description="It specifies the number of Gaussian points for triangles.", 

16 ) 

17 quadrangles: Optional[Literal[1, 3, 4, 7]] = Field( 

18 default=4, 

19 description="It specifies the number of Gaussian points for quadrangles.", 

20 ) 

21 

22 

23class MultipoleSolveConvectionBoundaryCondition(BaseModel): 

24 """ 

25 Level 5: Class for FiQuS Multipole 

26 """ 

27 boundaries: Optional[List[str]] = Field( 

28 default=[], 

29 description="It specifies the list of boundaries where the condition is applied." 

30 "Each boundary is identified by a string of the form <half-turn/wedge reference number><side>," 

31 "where the accepted sides are i, o, l, h which correspond respectively to inner, outer, lower (angle), higher (angle): e.g., 1o", 

32 ) 

33 heat_transfer_coefficient: Optional[Union[float, str]] = Field( 

34 default=None, 

35 description="It specifies the value or function name of the heat transfer coefficient for this boundary condition.", 

36 ) 

37 

38 

39class MultipoleSolveHeatFluxBoundaryCondition(BaseModel): 

40 """ 

41 Level 5: Class for FiQuS Multipole 

42 """ 

43 boundaries: Optional[List[str]] = Field( 

44 default=[], 

45 description="It specifies the list of boundaries where the condition is applied." 

46 "Each boundary is identified by a string of the form <half-turn/wedge reference number><side>," 

47 "where the accepted sides are i, o, l, h which correspond respectively to inner, outer, lower (angle), higher (angle): e.g., 1o", 

48 ) 

49 const_heat_flux: Optional[float] = Field( 

50 default=None, 

51 description="It specifies the value of the heat flux for this boundary condition.", 

52 ) 

53 # function_heat_flux: Optional[str] = None 

54 

55 

56class MultipoleSolveTemperatureBoundaryCondition(BaseModel): 

57 """ 

58 Level 5: Class for FiQuS Multipole 

59 """ 

60 boundaries: Optional[List[str]] = Field( 

61 default=[], 

62 description="It specifies the list of boundaries where the condition is applied." 

63 "Each boundary is identified by a string of the form <half-turn/wedge reference number><side>," 

64 "where the accepted sides are i, o, l, h which correspond respectively to inner, outer, lower (angle), higher (angle): e.g., 1o", 

65 ) 

66 const_temperature: Optional[float] = Field( 

67 default=None, 

68 description="It specifies the value of the temperature for this boundary condition.", 

69 ) 

70 # function_temperature: Optional[str] = None 

71 

72 

73class MultipoleSolveQuenchInitiation(BaseModel): 

74 """ 

75 Level 4: Class for FiQuS Multipole 

76 """ 

77 turns: Optional[List[int]] = Field( 

78 default=[], 

79 description="It specifies the list of reference numbers of half-turns whose critical currents are set to zero.", 

80 ) 

81 t_trigger: Optional[List[float]] = Field( 

82 default=[], 

83 description="It specifies the list of time instants at which the critical current is set to zero.", 

84 ) 

85 

86 

87class MultipoleSolveBoundaryConditionsThermal(BaseModel): 

88 """ 

89 Level 4: Class for FiQuS Multipole 

90 """ 

91 temperature: Optional[Dict[str, MultipoleSolveTemperatureBoundaryCondition]] = Field( 

92 default={}, 

93 description="This dictionary contains the information about the Dirichlet boundary conditions." 

94 "The keys are chosen names for each boundary condition.", 

95 ) 

96 heat_flux: Optional[Dict[str, MultipoleSolveHeatFluxBoundaryCondition]] = Field( 

97 default={}, 

98 description="This dictionary contains the information about the Neumann boundary conditions." 

99 "The keys are chosen names for each boundary condition.", 

100 ) 

101 cooling: Optional[Dict[str, MultipoleSolveConvectionBoundaryCondition]] = Field( 

102 default={}, 

103 description="This dictionary contains the information about the Robin boundary conditions." 

104 "The keys are chosen names for each boundary condition.", 

105 ) 

106 

107class MultipoleSolveTransient_parent(BaseModel): 

108 """ 

109 Level 4: Class for FiQuS Multipole 

110 """ 

111 initial_time: Optional[float] = Field( 

112 default=0., 

113 description="It specifies the initial time of the simulation.", 

114 ) 

115 final_time: Optional[float] = Field( 

116 default=0.0, 

117 description="It specifies the final time of the simulation.", 

118 ) 

119 initial_time_step: Optional[float] = Field( 

120 default=1E-10, 

121 description="It specifies the initial time step used at the beginning of the transient simulation.", 

122 ) 

123 min_time_step: Optional[float] = Field( 

124 default=1E-12, 

125 description="It specifies the minimum possible value of the time step.", 

126 ) 

127 max_time_step: Optional[float] = Field( 

128 default=10, 

129 description="It specifies the maximum possible value of the time step.", 

130 ) 

131 breakpoints: Optional[List[float]] = Field( 

132 default=[], 

133 description="It forces the transient simulation to hit the time instants contained in this list.", 

134 ) 

135 integration_method: Optional[Union[None, Literal[ 

136 "Euler", "Gear_2", "Gear_3", "Gear_4", "Gear_5", "Gear_6" 

137 ]]] = Field( 

138 default="Euler", 

139 title="Integration Method", 

140 description="It specifies the type of integration method to be used.", 

141 ) 

142 rel_tol_time: Optional[float] = Field( 

143 default=1E-4, 

144 description="It specifies the relative tolerance.", 

145 ) 

146 abs_tol_time: Optional[float] = Field( 

147 default=1e-4, 

148 description="It specifies the absolute tolerance.", 

149 ) 

150 norm_type: Optional[Literal["L1Norm", "MeanL1Norm", "L2Norm", "MeanL2Norm", "LinfNorm"]] = Field( 

151 default='LinfNorm', 

152 description="It specifies the type of norm to be calculated for convergence assessment.", 

153 ) 

154 

155class MultipoleSolveTransientElectromagnetics(MultipoleSolveTransient_parent): 

156 """ 

157 Level 4: Class for FiQuS Multipole 

158 """ 

159 T_sim: Optional[float] = Field( 

160 default=1.9, 

161 description="It specifies the temperature used to calculate the resistivity of the superconductor during the transient sim.", 

162 ) 

163 

164class MultipleSolveCollarHeCooling(BaseModel): 

165 enabled: Optional[bool] = Field( 

166 default=False, 

167 description="It determines whether the helium cooling is enabled or not (adiabatic conditions).", 

168 ) 

169 which: Optional[Union[Literal['all'], List]] = Field( 

170 default='all', 

171 description="It specifies the boundaries where the collar cooling is applied. If 'all', it applies to all boundaries. If a list, it applies to the specified boundaries numbered counter-clockwise." 

172 ) 

173 heat_transfer_coefficient: Optional[Union[float, str]] = Field( 

174 default= 'CFUN_hHe_T_THe', 

175 description="It specifies the value or name of the function of the constant heat transfer coefficient.", 

176 ) 

177 ref_temperature: Optional[float] = Field( 

178 default = 0.0, 

179 description="It specifies the reference temperature for the collar cooling. If not specified, it takes the value of the initial temperature.", 

180 ) 

181 move_cooling_holes: Optional[Union[str, int, List[List[float]]]] = Field( 

182 default=None, 

183 description= "It specifies if and how cooling holes are to be moved. Either choose '1' or '2' for predefined positions or a list [[dx,dy], [dx2,dy2]].. to shift each hole manually" 

184 ) 

185 

186class MultipoleSolveHeCooling(BaseModel): 

187 """ 

188 Level 4: Class for FiQuS Multipole 

189 """ 

190 enabled: Optional[bool] = Field( 

191 default=False, 

192 description="It determines whether the helium cooling is enabled or not (adiabatic conditions).", 

193 ) 

194 sides: Optional[Literal["external", "inner", "outer", "inner_outer"]] = Field( 

195 default="outer", 

196 description="It specifies the general grouping of the boundaries where to apply cooling:" 

197 "'external': all external boundaries; 'inner': only inner boundaries; 'outer': only outer boundaries; 'inner_outer': inner and outer boundaries.", 

198 ) 

199 heat_transfer_coefficient: Optional[Union[float, str]] = Field( 

200 default=0.0, 

201 description="It specifies the value or name of the function of the constant heat transfer coefficient.", 

202 ) 

203 

204 

205class MultipoleSolveNonLinearSolver(BaseModel): 

206 """ 

207 Level 4: Class for FiQuS Multipole 

208 """ 

209 rel_tolerance: Optional[float] = Field( 

210 default=1E-4, 

211 description="It specifies the relative tolerance.", 

212 ) 

213 abs_tolerance: Optional[float] = Field( 

214 default=0.1, 

215 description="It specifies the absolute tolerance.", 

216 ) 

217 relaxation_factor: Optional[float] = Field( 

218 default=0.7, 

219 description="It specifies the relaxation factor.", 

220 ) 

221 max_iterations: Optional[int] = Field( 

222 default=20, 

223 description="It specifies the maximum number of iterations if no convergence is reached.", 

224 ) 

225 norm_type: Literal["L1Norm", "MeanL1Norm", "L2Norm", "MeanL2Norm", "LinfNorm"] = Field( 

226 default='LinfNorm', 

227 description="It specifies the type of norm to be calculated for convergence assessment.", 

228 ) 

229 

230class MultipoleSolveTransientThermal(MultipoleSolveTransient_parent): 

231 """ 

232 Level 4: Class for FiQuS Multipole 

233 """ 

234 stop_temperature: Optional[float] = Field( 

235 default=300, 

236 description="If one half turn reaches this temperature, the simulation is stopped.", 

237 ) 

238 

239class MultipoleSolveTransientCoupled(MultipoleSolveTransient_parent): 

240 """ 

241 Level 4: Class for FiQuS Multipole 

242 """ 

243 rel_tol_time: Optional[List[float]] = Field( 

244 default=[1E-4,1E-4], 

245 description="It specifies the relative tolerance.", 

246 ) 

247 abs_tol_time: Optional[List[float]] = Field( 

248 default=[1e-4,1e-4], 

249 description="It specifies the absolute tolerance.", 

250 ) 

251 norm_type: List[Literal["L1Norm", "MeanL1Norm", "L2Norm", "MeanL2Norm", "LinfNorm"]] = Field( 

252 default=['LinfNorm','LinfNorm'], 

253 description="It specifies the type of norm to be calculated for convergence assessment.", 

254 ) 

255 stop_temperature: Optional[float] = Field( 

256 default=300, 

257 description="If one half turn reaches this temperature, the simulation is stopped.", 

258 ) 

259 seq_NL: Optional[bool] = Field( 

260 default=True, 

261 description="The non-linear solver is sequential Mag->Thermal, or its fully coupled.", 

262 ) 

263 

264class MultipoleSolveInsulationBlockToBlock(BaseModel): 

265 """ 

266 Level 4: Class for FiQuS Multipole 

267 It contains the information about the materials and thicknesses of the inner insulation regions (between blocks) modeled via thin-shell approximation. 

268 """ 

269 material: Optional[str] = Field( 

270 default=None, 

271 description="It specifies the default material of the insulation regions between the blocks insulation regions.", 

272 ) 

273 # the order of blocks should be: [inner, outer] for mid-layer couples or [lower, higher] for mid-pole and mid-winding couples 

274 blocks_connection_overwrite: List[Tuple[str, str]] = Field( 

275 default=[], 

276 description="It specifies the blocks couples adjacent to the insulation region." 

277 "The blocks must be ordered from inner to outer block for mid-layer insulation regions and from lower to higher angle block for mid-pole and mid-winding insulation regions.", 

278 ) 

279 materials_overwrite: Optional[List[List[str]]] = Field( 

280 default=[], 

281 description="It specifies the list of materials making up the layered insulation region to be placed between the specified blocks." 

282 "The materials must be ordered from inner to outer layers and lower to higher angle layers.", 

283 ) 

284 thicknesses_overwrite: Optional[List[List[Optional[float]]]] = Field( 

285 default=[], 

286 description="It specifies the list of thicknesses of the specified insulation layers. The order must match the one of the materials list.", 

287 ) 

288 

289 

290class MultipoleSolveInsulationExterior(BaseModel): 

291 """ 

292 Level 4: Class for FiQuS Multipole 

293 It contains the information about the materials and thicknesses of the outer insulation regions (exterior boundaries) modeled via thin-shell approximation. 

294 """ 

295 blocks: Optional[List[str]] = Field( 

296 default=[], 

297 description="It specifies the reference numbers of the blocks adjacent to the exterior insulation regions to modify.", 

298 ) 

299 materials_append: Optional[List[List[str]]] = Field( 

300 default=[], 

301 description="It specifies the list of materials making up the layered insulation region to be appended to the block insulation." 

302 "The materials must be ordered from the block outward.", 

303 ) 

304 thicknesses_append: Optional[List[List[float]]] = Field( 

305 default=[], 

306 description="It specifies the list of thicknesses of the specified insulation layers. The order must match the one of the materials list.", 

307 ) 

308 

309class MultipoleSolveSpecificMaterial(BaseModel): 

310 """ 

311 Level 3: Class for FiQuS Multipole 

312 """ 

313 material: Optional[str] = Field( 

314 default=None, 

315 description="It specifies the material of the region.", 

316 ) 

317 RRR: Optional[float] = Field( 

318 default=None, 

319 description="It specifies the RRR of the region.", 

320 ) 

321 T_ref_RRR_high: Optional[float] = Field( 

322 default=None, 

323 description="It specifies the reference temperature associated with the RRR.", 

324 ) 

325 transient_effects_enabled: Optional[bool] = Field( 

326 default=False, 

327 description="It determines whether the transient effects are enabled or not.", 

328 ) 

329 # rel_magnetic_permeability: Optional[float] = Field( 

330 # default = 1.0, 

331 # description = 'It specifies the material relative magnetic permeability against vacuum for EM calculations' 

332 # ) 

333 

334 

335class MultipoleSolveInsulationCollar(BaseModel): 

336 material: Optional[str] = Field( 

337 default=None, 

338 description="It specifies the default material of the insulation regions between collar and outer insulation.", 

339 ) 

340 

341class MultipoleSolveInsulationTSA(BaseModel): 

342 """ 

343 Level 3: Class for FiQuS Multipole 

344 """ 

345 block_to_block: MultipoleSolveInsulationBlockToBlock = Field( 

346 default=MultipoleSolveInsulationBlockToBlock(), 

347 description="This dictionary contains the information about the materials and thicknesses of the inner insulation regions (between blocks) modeled via thin-shell approximation.", 

348 ) 

349 exterior: Optional[MultipoleSolveInsulationExterior] = Field( 

350 default=MultipoleSolveInsulationExterior(), 

351 description="This dictionary contains the information about the materials and thicknesses of the outer insulation regions (exterior boundaries) modeled via thin-shell approximation.", 

352 ) 

353 between_collar: Optional[MultipoleSolveInsulationBlockToBlock] = Field( 

354 default=MultipoleSolveInsulationCollar(), 

355 description="This dictionary contains the information about the materials and thicknesses of the insulation regions between the collar and the outer insulation regions for thin-shell approximation.", 

356 ) 

357 

358class MultipoleSolve_parent(BaseModel): 

359 """ 

360 Level 3: Class for FiQuS Multipole 

361 """ 

362 non_linear_solver: MultipoleSolveNonLinearSolver = Field( 

363 default=MultipoleSolveNonLinearSolver(), 

364 description="This dictionary contains the information about the parameters for the non-linear solver.", 

365 ) 

366 

367 

368class MultipoleSolveThermal(MultipoleSolve_parent): 

369 """ 

370 Level 3: Class for FiQuS Multipole 

371 """ 

372 solve_type: Optional[Literal[None, "transient"]] = Field( 

373 default=None, 

374 description="It determines whether the thermal transient problem is solved ('transient') or not ('null').", 

375 ) 

376 insulation_TSA: Optional[MultipoleSolveInsulationTSA] = Field( 

377 default=MultipoleSolveInsulationTSA(), 

378 description="This dictionary contains the information about the materials and thicknesses of the insulation regions modeled via thin-shell approximation.", 

379 ) 

380 He_cooling: MultipoleSolveHeCooling = Field( 

381 default=MultipoleSolveHeCooling(), 

382 description="This dictionary contains the information about the Robin boundary condition for generic groups of boundaries.", 

383 ) 

384 collar_cooling: MultipleSolveCollarHeCooling = Field( 

385 default=MultipleSolveCollarHeCooling(), 

386 description="This dictionary contains the information about the cooling for the collar region.", 

387 ) 

388 overwrite_boundary_conditions: Optional[MultipoleSolveBoundaryConditionsThermal] = Field( 

389 default=MultipoleSolveBoundaryConditionsThermal(), 

390 description="This dictionary contains the information about boundary conditions for explicitly specified boundaries.", 

391 ) 

392 time_stepping: MultipoleSolveTransientThermal = Field( 

393 default=MultipoleSolveTransientThermal(), 

394 description="This dictionary contains the information about the parameters for the transient solver.", 

395 ) 

396 jc_degradation_to_zero: Optional[MultipoleSolveQuenchInitiation] = Field( 

397 default=MultipoleSolveQuenchInitiation(), 

398 description="This dictionary contains the information about half turns with zero critical current.", 

399 ) 

400 init_temperature: Optional[float] = Field( 

401 default=1.9, 

402 description="It specifies the initial temperature of the simulation.", 

403 ) 

404 enforce_init_temperature_as_minimum: Optional[bool] = Field( 

405 default=False, 

406 description="It determines whether the initial temperature is enforced as the minimum temperature of the simulation.", 

407 ) 

408 

409class MultipoleSolveElectromagnetics(MultipoleSolve_parent): 

410 """ 

411 Level 3: Class for FiQuS Multipole 

412 """ 

413 solve_type: Optional[Literal[None, "stationary","transient"]] = Field( 

414 default=None, 

415 description="It determines whether the magneto-static problem is solved ('stationary') or not ('null').", 

416 ) 

417 time_stepping: Optional[MultipoleSolveTransientElectromagnetics] = Field( 

418 default=MultipoleSolveTransientElectromagnetics(), 

419 description="This dictionary contains the information about the parameters for the transient solver.", 

420 ) 

421 

422 

423class MultipoleMeshThinShellApproximationParameters(BaseModel): 

424 """ 

425 Level 4: Class for FiQuS Multipole 

426 """ 

427 minimum_discretizations: Optional[int] = Field( 

428 default=1, 

429 description="It specifies the number of minimum spacial discretizations across a thin-shell.", 

430 ) 

431 global_size_QH: Optional[float] = Field( 

432 default=1e-4, 

433 description="The thickness of the quench heater region is divided by this parameter to determine the number of spacial discretizations across the thin-shell.", 

434 ) 

435 minimum_discretizations_QH: Optional[int] = Field( 

436 default=1, 

437 description="It specifies the number of minimum spacial discretizations across a thin-shell.", 

438 ) 

439 global_size_COL: Optional[float] = Field( 

440 default=1e-4, 

441 description="The thickness of the region between ht and collar is divided by this parameter to determine the number of spacial discretizations across the thin-shell.", 

442 ) 

443 minimum_discretizations_COL: Optional[int] = Field( 

444 default=1, 

445 description="It specifies the number of minimum spacial discretizations across a thin-shell.", 

446 ) 

447 scale_factor_radial: Optional[float] = Field( 

448 default=-1.0, 

449 description="Scaling factor for radially directed thin-shells (e.g. halfturns to collar). Set to -1.0 to use default scaling. Wedge scalings are always ignored.", 

450 ) 

451 scale_factor_azimuthal: Optional[float] = Field( 

452 default=-1.0, 

453 description="Scaling factor for azimuthally directed thin-shells (e.g. halfturns to pole). Set to -1.0 to use default scaling. Wedge scalings are always ignored.", 

454 ) 

455 

456class MultipoleMeshThreshold(BaseModel): 

457 """ 

458 Level 3: Class for FiQuS Multipole 

459 """ 

460 enabled: Optional[bool] = Field( 

461 default=False, 

462 description="It determines whether the gmsh Field is enabled or not.", 

463 ) 

464 SizeMin: Optional[float] = Field( 

465 default=None, 

466 description="It sets gmsh Mesh.MeshSizeMin.", 

467 ) 

468 SizeMax: Optional[float] = Field( 

469 default=None, 

470 description="It sets gmsh Mesh.MeshSizeMax.", 

471 ) 

472 DistMin: Optional[float] = Field( 

473 default=None, 

474 description="It sets gmsh Mesh.MeshDistMin.", 

475 ) 

476 DistMax: Optional[float] = Field( 

477 default=None, 

478 description="It sets gmsh Mesh.MeshDistMax.", 

479 ) 

480 

481class MultipoleMeshThresholdCollar(MultipoleMeshThreshold): 

482 """ 

483 Level 3: Class for FiQuS Multipole 

484 """ 

485 Enforce_TSA_mapping: Optional[bool] = Field( 

486 default=False, 

487 description="Enfocres matching nodes for the TSA layer. Uses SizeMin to determine the size of the nodes.", # only for the collar layer 

488 ) 

489 

490class MultipoleMeshTransfinite(BaseModel): 

491 """ 

492 Level 3: Class for FiQuS Multipole 

493 """ 

494 enabled_for: Literal[None, "curves", "curves_and_surfaces"] = Field( 

495 default=None, 

496 description="It determines on what entities the transfinite algorithm is applied.", 

497 ) 

498 curve_target_size_height: Optional[float] = Field( 

499 default=1.0, 

500 description="The height of the region (short side) is divided by this parameter to determine the number of elements to apply via transfinite curves.", 

501 ) 

502 curve_target_size_width: Optional[float] = Field( 

503 default=1.0, 

504 description="The width of the region (long side) is divided by this parameter to determine the number of elements to apply via transfinite curves.", 

505 ) 

506class MultipoleMeshTransfiniteOrField(BaseModel): 

507 """ 

508 Level 3: Class for FiQuS Multipole 

509 """ 

510 transfinite: MultipoleMeshTransfinite = Field( 

511 default=MultipoleMeshTransfinite(), 

512 description="This dictionary contains the mesh information for transfinite curves.", 

513 ) 

514 field: MultipoleMeshThreshold = Field( 

515 default=MultipoleMeshThreshold(), 

516 description="This dictionary contains the gmsh Field information.", 

517 ) 

518 

519class MultipolePostProc_parent(BaseModel): 

520 """ 

521 Level 2: Class for FiQuS Multipole 

522 """ 

523 output_time_steps_pos: Optional[Union[bool, int]] = Field( 

524 default=True, 

525 description="It determines whether the solution for the .pos file is saved for all time steps (True), none (False), or equidistant time steps (int).", 

526 ) 

527 output_time_steps_txt: Optional[Union[bool, int]] = Field( 

528 default=True, 

529 description="It determines whether the solution for the .txt file is saved for all time steps (True), none (False), or equidistant time steps (int).", 

530 ) 

531 save_pos_at_the_end: Optional[bool] = Field( 

532 default=True, 

533 description="It determines whether the solution for the .pos file is saved at the end of the simulation or during run time.", 

534 ) 

535 save_txt_at_the_end: Optional[bool] = Field( 

536 default=False, 

537 description="It determines whether the solution for the .txt file is saved at the end of the simulation or during run time.", 

538 ) 

539 

540 plot_all: Optional[Union[bool, None]] = Field( 

541 default=False, 

542 description="It determines whether the figures are generated and shown (true), generated only (null), or not generated (false). Useful for tests.", 

543 ) 

544 

545class MultipolePostProcThermal(MultipolePostProc_parent): 

546 """ 

547 Level 2: Class for FiQuS Multipole 

548 """ 

549 take_average_conductor_temperature: Optional[bool] = Field( 

550 default=True, 

551 description="It determines whether the output files are based on the average conductor temperature or not (map2d).", 

552 ) 

553 variables: Optional[List[Literal["T", "jOverJc", "rho", "az_thermal", "ac_loss"]]] = Field( 

554 default=["T"], 

555 description="It specifies the physical quantity to be output.", 

556 ) 

557 volumes: Optional[List[ 

558 Literal["omega", "powered", "induced", "iron", "conducting", "insulator"]]] = Field( 

559 default=["powered"], 

560 description="It specifies the regions associated with the physical quantity to be output.", 

561 ) 

562 

563 

564class MultipolePostProcElectromagnetics(MultipolePostProc_parent): 

565 """ 

566 Level 2: Class for FiQuS Multipole 

567 """ 

568 compare_to_ROXIE: Optional[str] = Field( 

569 default=None, 

570 description="It contains the absolute path to a reference ROXIE map2d file. If provided, comparative plots with respect to the reference are generated.", 

571 ) 

572 variables: Optional[List[Literal["a", "az", "b", "h", "js","jOverJc", "sigma_collar","is"]]] = Field( 

573 default=[], 

574 description="It specifies the physical quantity to be output.", 

575 ) 

576 volumes: Optional[List[ 

577 Literal["omega", "powered", "induced", "air", "air_far_field", "iron", "conducting", "insulator"]]] = Field( 

578 default=[], 

579 description="It specifies the regions associated with the physical quantity to be output.", 

580 ) 

581 

582class CCPostProc(BaseModel): 

583 variables_I: Optional[List[Literal["I_PC","I_1","I_2","I_cpc","I_crowbar","I_3","I_c_r","I_EE","I_c","I_s","I_C", 

584 "I_EE_n","I_c_n","I_s_n","I_QH","I_EQ","I_ESC", 

585 "I_A","I_B","I_C", 

586 "I_EQ", 

587 "I_ESC","I_ESC_Diode","I_ESC_C"]]] = Field( 

588 default=[], 

589 description="Currents from the circuit that will be exported as csv", 

590 ) 

591 variables_U: Optional[List[Literal["PS_currentsource","PS_R_1","PS_L_1","PS_C","PS_R_3","PS_L_3","PS_R_2","PS_L_2","PS_R_crowbar","PS_Ud_crowbar","PS_L_crowbar","PS_R_c_r","PS_Ud_c_r","PS_L_c_r", 

592 "circ_R_circuit", 

593 "EE_L","EE_V_EE","EE_Ud_snubber","EE_C","EE_R_c","EE_L_c","EE_Ud_switch","EE_R_s","EE_L_s","EE_L_n","EE_V_EE_n","EE_Ud_snubber_n","EE_C_n","EE_R_c_n","EE_L_c_n","EE_Ud_switch_n","EE_R_s_n","EE_L_s_n","EE_R_switch","EE_R_switch_n", 

594 "CLIQ_R","CLIQ_L","CLIQ_C", 

595 "ECLIQ_currentsource","ECLIQ_L_leads","ECLIQ_R_leads", 

596 "ESC_C1","ESC_C2","ESC_R_leads","ESC_R_unit","ESC_L","ESC_L_Diode","ESC_Ud_Diode"]]] = Field( 

597 default=[], 

598 description="Voltages from the circuit that will be exported as csv", 

599 ) 

600 assemble_veusz: Optional[bool] = Field( 

601 default=False, 

602 description="It determines whether the post-processing data is assembled in a veusz file.", 

603 ) 

604 

605class MultipolePostProc(BaseModel): 

606 """ 

607 Level 2: Class for FiQuS Multipole 

608 """ 

609 electromagnetics: MultipolePostProcElectromagnetics = Field( 

610 default=MultipolePostProcElectromagnetics(), 

611 description="This dictionary contains the post-processing information for the electromagnetic solution.", 

612 ) 

613 thermal: MultipolePostProcThermal = Field( 

614 default=MultipolePostProcThermal(), 

615 description="This dictionary contains the post-processing information for the thermal solution.", 

616 ) 

617 circuit_coupling: CCPostProc = Field( 

618 default= CCPostProc(), 

619 description="This dictionary contains the post-processing information for the circuit variables calculated in the solution.", 

620 ) 

621 

622class MultipoleSolveCoilWindingsElectricalOrder(BaseModel): 

623 """ 

624 Level 2: Class for the order of the electrical pairs 

625 """ 

626 group_together: Optional[List[List[int]]] = [] # elPairs_GroupTogether 

627 reversed: Optional[List[int]] = [] # elPairs_RevElOrder 

628 overwrite_electrical_order: Optional[List[int]] = [] 

629 

630class MultipoleSolveCoilWindings(BaseModel): 

631 """ 

632 Level 1: Class for winding information 

633 """ 

634 conductor_to_group: Optional[List[int]] = [] # This key assigns to each group a conductor of one of the types defined with Conductor.name 

635 group_to_coil_section: Optional[List[int]] = [] # This key assigns groups of half-turns to coil sections 

636 polarities_in_group: Optional[List[int]] = [] # This key assigns the polarity of the current in each group # 

637 half_turn_length: Optional[List[float]] = [] 

638 electrical_pairs: Optional[MultipoleSolveCoilWindingsElectricalOrder] = MultipoleSolveCoilWindingsElectricalOrder() # Variables used to calculate half-turn electrical order 

639 # Homogenized Multipole 

640class HomogenizedConductorFormulationparametersROHM(BaseModel): 

641 """ 

642 Level 4: Class for finite element formulation parameters 

643 """ 

644 enabled: Optional[bool] = Field( 

645 default=False, 

646 description='Use ROHM to homogenize the magnetization hysteresis in the cables.' 

647 ) 

648 parameter_csv_file: Optional[str] = Field( 

649 default=None, 

650 description='Name of the csv file containing the ROHM parameters within the inputs folder with expected row structure: [alpha,kappa,chi,gamma,lambda].' 

651 ) 

652 gather_cell_systems: Optional[bool] = Field( 

653 default = False, 

654 description = 'when true, it generates a single system to solve the ROHM cells instead of one system per cell to decrease generation time.' 

655 ) 

656 weight_scaling: Optional[float] = Field( 

657 default=1.0, 

658 description='Downscaling factor (s<1.0) which is applied to all weights except the first, which is scaled up to compensate.' 

659 ) 

660 tau_scaling: Optional[float] = Field( 

661 default=1.0, 

662 description='Scaling factor which is applied uniformly to all coupling time constants.' 

663 ) 

664 

665class HomogenizedConductorFormulationparametersROHF(BaseModel): 

666 """ 

667 Level 4: Class for finite element formulation parameters 

668 """ 

669 enabled: Optional[bool] = Field( 

670 default=False, 

671 description='Use ROHF to homogenize the internal flux hysteresis in the cables.' 

672 ) 

673 parameter_csv_file: Optional[str] = Field( 

674 default=None, 

675 description='Name of the csv file containing the ROHF parameters within the inputs folder with expected row structure: [alpha,kappa,tau].' 

676 ) 

677 gather_cell_systems: Optional[bool] = Field( 

678 default = False, 

679 description = 'when true, it generates a single system to solve the ROHF cells instead of one system per cell to decrease generation time.' 

680 ) 

681class HomogenizedConductorRunType(BaseModel): 

682 """ 

683 Level 4: Class for runtype parameters 

684 """ 

685 mode: Optional[Literal["ramp","isothermal_ramp","quench"]] = Field( 

686 default="ramp", 

687 description= "Type of simulation to run with homogenized conductors (ramp - real cooling conditions, isothermal_ramp - unlimited cooling, quench - non-zero initial conditions)" 

688 ) 

689 ramp_file: Optional[str] = Field( 

690 default=None, 

691 description='Name of the ramp model from which to start the simulation' 

692 ) 

693class HomogenizedConductor(BaseModel): 

694 """ 

695 Level 3: Class for FiQuS Multipole 

696 """ 

697 enabled: Optional[bool] = Field( 

698 default=False, 

699 description="It determines whether the homogenized conductor model is enabled or not." 

700 ) 

701 run_type: HomogenizedConductorRunType = Field( 

702 default=HomogenizedConductorRunType(), 

703 description= "Type of simulation to run with homogenized conductors (ramp - real cooling conditions, isothermal_ramp - unlimited cooling, quench - non-zero initial conditions)" 

704 ) 

705 rohm: HomogenizedConductorFormulationparametersROHM = Field( 

706 default=HomogenizedConductorFormulationparametersROHM(), 

707 description="This dictionary contains the information about the parameters for the ROHM model.", 

708 ) 

709 rohf: HomogenizedConductorFormulationparametersROHF = Field( 

710 default=HomogenizedConductorFormulationparametersROHF(), 

711 description="This dictionary contains the information about the parameters for the ROHF model.", 

712 ) 

713 

714class MultipoleSolve(BaseModel): 

715 """ 

716 Level 2: Class for FiQuS Multipole 

717 """ 

718 coil_windings: Optional[MultipoleSolveCoilWindings] = Field( 

719 default=MultipoleSolveCoilWindings(), 

720 description="This dictionary contains the information pertaining the number of coils and electrical order necessary to generate the associated electrical circuit" 

721 ) 

722 electromagnetics: MultipoleSolveElectromagnetics = Field( 

723 default=MultipoleSolveElectromagnetics(), 

724 description="This dictionary contains the solver information for the electromagnetic solution.", 

725 ) 

726 thermal: MultipoleSolveThermal = Field( 

727 default=MultipoleSolveThermal(), 

728 description="This dictionary contains the solver information for the thermal solution.", 

729 ) 

730 wedges: MultipoleSolveSpecificMaterial = Field( 

731 default=MultipoleSolveSpecificMaterial(), 

732 description="This dictionary contains the material information of wedges.", 

733 ) 

734 collar: MultipoleSolveSpecificMaterial = Field( 

735 default=MultipoleSolveSpecificMaterial(), 

736 description="This dictionary contains the material information of the collar region.", 

737 ) 

738 iron_yoke: MultipoleSolveSpecificMaterial = Field( 

739 default=MultipoleSolveSpecificMaterial(), 

740 description="This dictionary contains the material information of the iron yoke region.", 

741 ) 

742 poles: MultipoleSolveSpecificMaterial = Field( 

743 default=MultipoleSolveSpecificMaterial(), 

744 description="This dictionary contains the material information of the pole region.", 

745 ) 

746 noOfMPITasks: Optional[Union[bool, int]] = Field( 

747 default=False, 

748 title="No. of tasks for MPI parallel run of GetDP", 

749 description=( 

750 "If integer, GetDP will be run in parallel using MPI. This is only valid" 

751 " if MPI is installed on the system and an MPI-enabled GetDP is used." 

752 " If False, GetDP will be run in serial without invoking mpiexec." 

753 ), 

754 ) 

755 time_stepping: Optional[MultipoleSolveTransientCoupled] = Field( 

756 default=MultipoleSolveTransientCoupled(), 

757 description="This dictionary contains the information about the parameters for the transient solver.", 

758 ) 

759 cable_homogenization: Optional[HomogenizedConductor]= Field( 

760 default=HomogenizedConductor(), 

761 description="This dictionary contains the information about the homogenized conductor properties.", 

762 ) 

763 

764class MultipoleThermalInsulationMesh(BaseModel): 

765 """ 

766 Level 3: Class for FiQuS Multipole 

767 """ 

768 global_size: float = Field( 

769 default=1e-4, 

770 description="It specifies the global size of the mesh for the insulation regions. It is enforced as a constant mesh field for surface insulation and by fixing the number of TSA layers for thin-shell approximation.", 

771 ) 

772 TSA: Optional[MultipoleMeshThinShellApproximationParameters] = Field( 

773 default=MultipoleMeshThinShellApproximationParameters(), 

774 description="This dictionary contains the mesh information for thin-shells.", 

775 ) 

776 

777class MultipoleMesh_parent(BaseModel): 

778 """ 

779 Level 2: Class for FiQuS Multipole 

780 """ 

781 create: bool = Field( 

782 default=True, 

783 description="It determines whether the mesh is built or not.", 

784 ) 

785 conductors: Optional[MultipoleMeshTransfiniteOrField] = Field( 

786 default=MultipoleMeshTransfiniteOrField(), 

787 description="This dictionary contains the mesh information for the conductor regions.", 

788 ) 

789 wedges: Optional[MultipoleMeshTransfiniteOrField] = Field( 

790 default=MultipoleMeshTransfiniteOrField(), 

791 description="This dictionary contains the mesh information for the wedge regions.", 

792 ) 

793 iron_field: Optional[MultipoleMeshThreshold] = Field( 

794 default=MultipoleMeshThreshold(), 

795 description="This dictionary contains the gmsh Field information for the iron yoke region.", 

796 ) 

797 collar: Optional[MultipoleMeshThresholdCollar] = Field( 

798 default=MultipoleMeshThresholdCollar(), 

799 description="This dictionary contains the gmsh Field information for the collar region.", 

800 ) 

801 poles: Optional[MultipoleMeshThreshold] = Field( 

802 default=MultipoleMeshThreshold(), 

803 description="This dictionary contains the mesh information for the poles region.", 

804 ) 

805 

806class MultipoleMeshThermal(MultipoleMesh_parent): 

807 """ 

808 Level 2: Class for FiQuS Multipole 

809 """ 

810 reference: Optional[MultipoleMeshThreshold] = Field( 

811 default=MultipoleMeshThreshold(), 

812 description="It determines whether the reference mesh is built or not. If True, an additional layer between the insulation and collar is meshed", 

813 ) 

814 insulation: Optional[MultipoleThermalInsulationMesh] = Field( 

815 default=MultipoleThermalInsulationMesh(), 

816 description="This dictionary contains the mesh information for the insulation regions.", 

817 ) 

818 isothermal_conductors: Optional[bool] = Field( 

819 default=False, 

820 description="It determines whether the conductors are considered isothermal or not using getDP constraints.", 

821 ) 

822 isothermal_wedges: Optional[bool] = Field( 

823 default=False, 

824 description="It determines whether the wedges are considered isothermal or not using getDP Link constraints.", 

825 ) 

826 

827class MultipoleMeshElectromagnetics(MultipoleMesh_parent): 

828 """ 

829 Level 2: Class for FiQuS Multipole 

830 """ 

831 bore_field: Optional[MultipoleMeshThreshold] = Field( 

832 default=MultipoleMeshThreshold(), 

833 description="This dictionary contains the gmsh Field information for the bore region.", 

834 ) 

835 

836class MultipoleMesh(BaseModel): 

837 """ 

838 Level 2: Class for FiQuS Multipole 

839 """ 

840 electromagnetics: MultipoleMeshElectromagnetics = Field( 

841 default=MultipoleMeshElectromagnetics(), 

842 description="This dictionary contains the mesh information for the electromagnetic solution.", 

843 ) 

844 thermal: MultipoleMeshThermal = Field( 

845 default=MultipoleMeshThermal(), 

846 description="This dictionary contains the mesh information for the thermal solution.", 

847 ) 

848 

849class MultipoleGeometry_parent(BaseModel): 

850 create: bool = Field( 

851 default=True, 

852 description="It determines whether the geometry is built or not.", 

853 ) 

854 with_wedges: Optional[bool] = Field( 

855 default=True, 

856 description="It determines whether the wedge regions are built or not.", 

857 ) 

858 areas: Optional[List[Literal["iron_yoke", "collar", "poles"]]] = Field( 

859 default= [], 

860 description="List with areas to build." 

861 ) 

862 

863class MultipoleGeometryThermal(MultipoleGeometry_parent): 

864 """ 

865 Level 2: Class for FiQuS Multipole 

866 """ 

867 use_TSA: Optional[bool] = Field( 

868 default=False, 

869 description="It determines whether the insulation regions are explicitly built or modeled via thin-shell approximation.", 

870 ) 

871 correct_block_coil_tsa_checkered_scheme: Optional[bool] = Field( 

872 default=False, 

873 description="There is a bug in the TSA naming scheme for block coils, this flag activates a simple (not clean) bug fix that will be replaced in a future version.", 

874 ) 

875 use_TSA_new: Optional[bool] = Field( 

876 default=False, 

877 description="It determines whether the regions between collar and coils are modeled via thin-shell approximation.", 

878 ) 

879 

880class MultipoleGeometryElectromagnetics(MultipoleGeometry_parent): 

881 """ 

882 Level 2: Class for FiQuS Multipole 

883 """ 

884 symmetry: Optional[Literal["none", "xy", "x", "y"]] = Field( 

885 default='none', 

886 description="It determines the model regions to build according to the specified axis/axes.", 

887 ) 

888 

889class MultipoleGeometry(BaseModel): 

890 """ 

891 Level 2: Class for FiQuS Multipole 

892 """ 

893 geom_file_path: Optional[str] = Field( 

894 default=None, 

895 description="It contains the path to a .geom file. If null, the default .geom file produced by steam-sdk BuilderFiQuS will be used.", 

896 ) 

897 plot_preview: Optional[bool] = Field( 

898 default=False, 

899 description="If true, it displays matplotlib figures of the magnet geometry with relevant information (e.g., conductor and block numbers).", 

900 ) 

901 electromagnetics: MultipoleGeometryElectromagnetics = Field( 

902 default=MultipoleGeometryElectromagnetics(), 

903 description="This dictionary contains the geometry information for the electromagnetic solution.", 

904 ) 

905 thermal: MultipoleGeometryThermal = Field( 

906 default=MultipoleGeometryThermal(), 

907 description="This dictionary contains the geometry information for the thermal solution.", 

908 ) 

909 

910 

911class Multipole(BaseModel): 

912 """ 

913 Level 1: Class for FiQuS Multipole 

914 """ 

915 type: Literal["multipole"] = "multipole" 

916 geometry: MultipoleGeometry = Field( 

917 default=MultipoleGeometry(), 

918 description="This dictionary contains the geometry information.", 

919 ) 

920 mesh: MultipoleMesh = Field( 

921 default=MultipoleMesh(), 

922 description="This dictionary contains the mesh information.", 

923 ) 

924 solve: MultipoleSolve = Field( 

925 default=MultipoleSolve(), 

926 description="This dictionary contains the solution information.", 

927 ) 

928 postproc: MultipolePostProc = Field( 

929 default=MultipolePostProc(), 

930 description="This dictionary contains the post-process information.", 

931 )