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

179 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2024-09-01 03:24 +0200

1from pydantic import BaseModel, Field 

2from typing import List, Literal, Optional 

3 

4 

5# ============= GEOMETRY ============= # 

6# -- Input/Output settings -- # 

7class CACStrandIOsettingsLoad(BaseModel): 

8 """ 

9 Level 3: Class for Input/Output settings for the cable geometry 

10 """ 

11 

12 load_from_yaml: Optional[bool] = Field( 

13 default=False, 

14 description="True to load the geometry from a YAML file, false to generate the geometry.", 

15 ) 

16 filename: Optional[str] = Field( 

17 default=None, 

18 description="Name of the YAML file from which to load the geometry.", 

19 ) 

20 

21class CACStrandIOsettingsSave(BaseModel): 

22 """ 

23 Level 3: Class for Input/Output settings for the cable geometry 

24 """ 

25 

26 save_to_yaml: Optional[bool] = Field( 

27 default=False, 

28 description="True to save the geometry to a YAML-file, false to not save the geometry.", 

29 ) 

30 filename: Optional[str] = Field( 

31 default=None, 

32 description="Name of the output geometry YAML file.", 

33 ) 

34 

35class CACStrandGeometryIOsettings(BaseModel): 

36 """ 

37 Level 2: Class for Input/Output settings for the cable geometry 

38 """ 

39 

40 load: CACStrandIOsettingsLoad = ( 

41 CACStrandIOsettingsLoad() 

42 ) 

43 save: CACStrandIOsettingsSave = ( 

44 CACStrandIOsettingsSave() 

45 ) 

46 

47# -- Strand geometry parameters -- # 

48class CACStrandGeometry(BaseModel): 

49 """ 

50 Level 2: Class for strand geometry parameters 

51 """ 

52 io_settings: CACStrandGeometryIOsettings = CACStrandGeometryIOsettings() 

53 hexagonal_filaments: Optional[bool] = Field( 

54 default=None, 

55 description="Field for specifying the shape of the filaments. True for hexagonal, False for circular.", 

56 ) 

57 filament_circular_distribution: Optional[bool] = Field( 

58 default=None, 

59 description="Field for specifying the geometrical distribution of the filaments. Set True to distribute the filaments in a circular pattern and False to distribute them in a hexagonal pattern." 

60 ) 

61 air_radius: Optional[float] = Field( 

62 default=None, description="Radius of the circular numerical air region (m)." 

63 ) 

64 

65 

66# ============= MESH ============= # 

67# -- Filament mesh settings -- # 

68class CACStrandMeshFilaments(BaseModel): 

69 """ 

70 Level 3: Class for FiQuS ConductorAC 

71 """ 

72 

73 boundary_mesh_size_ratio: Optional[float] = Field( 

74 default=None, 

75 description="Mesh size at filament boundaries, relative to the radius of the filaments. E.g. 0.1 means that the mesh size is 0.1 times the filament radius.", 

76 ) 

77 center_mesh_size_ratio: Optional[float] = Field( 

78 default=None, 

79 description="Mesh size at filament center, relative to the radius of the filaments. E.g. 0.1 means that the mesh size is 0.1 times the filament radius.", 

80 ) 

81 amplitude_dependent_scaling: Optional[bool] = Field( 

82 default=False, 

83 description="Amplitude dependent scaling uses the field amplitude to approximate the field penetration distance in the filaments to alter the filament mesh. If the field penetration distance is low (i.e. for low field amplitudes) this feature increases mesh density in the region where the field is expected to penetrate, and decreases the mesh resolution in the region where the field does not penetrate.", 

84 ) 

85 field_penetration_depth_scaling_factor: Optional[float] = Field( 

86 default=None, 

87 description="Scaling factor for the estimate of the field penetration depth, used for amplitude dependent scaling. ", 

88 ) 

89 desired_elements_in_field_penetration_region: Optional[float] = Field( 

90 default=None, 

91 description="Desired number of elements in the field penetration region. This parameter is used for amplitude dependent scaling, and determines the number of elements in the region where the field is expected to penetrate.", 

92 ) 

93 

94# -- Matrix mesh settings -- # 

95class CACStrandMeshMatrix(BaseModel): 

96 """ 

97 Level 3: Class for FiQuS ConductorAC 

98 """ 

99 

100 mesh_size_matrix_ratio_inner: Optional[float] = Field( 

101 default=None, 

102 description="Mesh size at the matrix center, relative to the filament radius.", 

103 ) 

104 mesh_size_matrix_ratio_middle: Optional[float] = Field( 

105 default=None, 

106 description="Mesh size at the matrix middle partition, relative to the filament radius.", 

107 ) 

108 mesh_size_matrix_ratio_outer: Optional[float] = Field( 

109 default=None, 

110 description="Mesh size at the matrix outer boundary, relative to the filament radius.", 

111 ) 

112 interpolation_distance_from_filaments_ratio: Optional[float] = Field( 

113 default=None, 

114 description="The mesh size is interpolated from the filament boundaries into the matrix, over a given distance. This parameter determines the distance over which the mesh size is interpolated.", 

115 ) 

116 rate_dependent_scaling_matrix: Optional[bool] = Field( 

117 default=False, 

118 description="Rate dependent scaling uses the expected skin depth in the matrix to determine the matrix mesh. If the skin depth is low (i.e. for high frequencies) this feature increases mesh density in the region where the current is expected to flow, while decreasing the mesh resolution in the region where the current is not expected to flow.", 

119 ) 

120 skindepth_scaling_factor: Optional[float] = Field( 

121 default=None, 

122 description="Scaling factor for the estimate of the skin depth, used for rate dependent scaling.", 

123 ) 

124 desired_elements_in_skindepth: Optional[float] = Field( 

125 default=None, description="Desired number of elements in the skin depth region. This parameter is used for rate dependent scaling, and determines the number of elements in the region where the current is expected to flow." 

126 ) 

127 

128# -- Air mesh settings -- # 

129class CACStrandMeshAir(BaseModel): 

130 """ 

131 Level 3: Class for FiQuS ConductorAC 

132 """ 

133 

134 max_mesh_size_ratio: Optional[float] = Field( 

135 default=None, 

136 description="Mesh size at the outer boundary of the air region, relative to the filament radius. E.g. 10 means that the mesh size is 10 times the filament radius.", 

137 ) 

138 

139# -- Strand mesh settings -- # 

140class CACStrandMesh(BaseModel): 

141 """ 

142 Level 2: Class for FiQuS ConductorAC 

143 """ 

144 

145 scaling_global: Optional[float] = Field( 

146 default=1, description="Global scaling factor for mesh size." 

147 ) 

148 filaments: CACStrandMeshFilaments = CACStrandMeshFilaments() 

149 matrix: CACStrandMeshMatrix = CACStrandMeshMatrix() 

150 air: CACStrandMeshAir = CACStrandMeshAir() 

151 

152 

153# ============= SOLVE ============= # 

154# -- General parameters -- # 

155class CACStrandSolveGeneralparameters(BaseModel): 

156 """ 

157 Level 3: Class for general parameters 

158 """ 

159 temperature: float = Field(default=1.9, description="Temperature (K) of the strand.") 

160 superconductor_linear: Optional[bool] = Field(default=False, description="For debugging: replace LTS by normal conductor.") 

161 

162 

163# -- Initial conditions -- # 

164class CACStrandSolveInitialconditions(BaseModel): 

165 """ 

166 Level 3: Class for initial conditions 

167 """ 

168 

169 init_from_pos_file: bool = Field( 

170 default=False, description="This field is used to initialize the solution from a non-zero field solution stored in a .pos file." 

171 ) 

172 pos_file_to_init_from: Optional[str] = Field( 

173 default=None, 

174 description="Name of .pos file for magnetic field (A/m) from which the solution should be initialized." 

175 " Should be in the Geometry_xxx/Mesh_xxx/ folder in which the Solution_xxx will be saved.", 

176 ) 

177 

178 

179# -- Source parameters -- # 

180class CACStrandSolveSourceparametersSineSuperimposedDC(BaseModel): 

181 """ 

182 Level 5: Class for superimposed DC field or current parameters for the sine source 

183 """ 

184 field_magnitude: Optional[float] = Field(default=0.0, description="DC field magnitude (T) (direction along y-axis). Solution must be initialized with a non-zero field solution stored in a .pos file if non-zero DC field is used.") 

185 current_magnitude: Optional[float] = Field(default=0.0, description="DC current magnitude (A). Solution must be initialized with a non-zero field solution stored in a .pos file if non-zero DC current is used.") 

186 

187class CACStrandSolveSourceparametersSine(BaseModel): 

188 """ 

189 Level 4: Class for Sine source parameters 

190 """ 

191 frequency: Optional[float] = Field(default=None, description="Frequency of the sine source (Hz).") 

192 field_amplitude: Optional[float] = Field(default=None, description="Amplitude of the sine field (T).") 

193 current_amplitude: Optional[float] = Field(default=None, description="Amplitude of the sine current (A).") 

194 field_angle: Optional[float] = Field(default=90, description="Angle of the sine field direction, with respect to the x-axis (degrees).") 

195 superimposed_DC: CACStrandSolveSourceparametersSineSuperimposedDC = CACStrandSolveSourceparametersSineSuperimposedDC() 

196 

197class CACStrandSolveSourceparametersPiecewise(BaseModel): 

198 """ 

199 Level 4: Class for piecewise (linear) source parameters 

200 """ 

201 source_csv_file: Optional[str] = Field(default=None, description="File name for the from_file source type defining the time evolution of current and field (in-phase). Multipliers are used for each of them. The file should contain two columns: 'time' (s) and 'value' (field/current (T/A)), with these headers. If this field is set, times, applied_fields_relative and transport_currents_relative are ignored.") 

202 times: Optional[List[float]] = Field(default=None, description="Time instants (s) defining the piecewise linear sources. Used only if source_csv_file is not set. Can be scaled by time_multiplier.") 

203 applied_fields_relative: Optional[List[float]] = Field(default=None, description="Applied fields relative to multiplier applied_field_multiplier at the time instants 'times'. Used only if source_csv_file is not set.") 

204 transport_currents_relative: Optional[List[float]] = Field(default=None, description="Transport currents relative to multiplier transport_current_multiplier at the time instants 'times'. Used only if source_csv_file is not set.") 

205 time_multiplier: Optional[float] = Field(default=None, description="Multiplier for the time values in times (scales the time values). Also used for the time values in the source_csv_file.") 

206 applied_field_multiplier: Optional[float] = Field(default=None, description="Multiplier for the applied fields in applied_fields_relative. Also used for the values in the source_csv_file.") 

207 transport_current_multiplier: Optional[float] = Field(default=None, description="Multiplier for the transport currents in transport_currents_relative. Also used for the values in the source_csv_file.") 

208 

209class CACStrandSolveSourceparameters(BaseModel): 

210 """ 

211 Level 3: Class for material properties 

212 """ 

213 

214 source_type: Literal['sine', 'piecewise'] = Field( 

215 default='sine', 

216 description="Time evolution of applied current and magnetic field. Supported options are: sine, sine_with_DC, piecewise_linear, from_list.", 

217 ) 

218 boundary_condition_type: str = Field( 

219 default="Natural", 

220 description="Boundary condition type. Supported options are: Natural, Essential. Do not use essential boundary condition with induced currents.", 

221 ) 

222 sine: CACStrandSolveSourceparametersSine = CACStrandSolveSourceparametersSine() 

223 piecewise: CACStrandSolveSourceparametersPiecewise = CACStrandSolveSourceparametersPiecewise() 

224 

225 

226# -- Numerical parameters -- # 

227class CACStrandSolveNumericalparametersSine(BaseModel): 

228 """  

229 Level 4: Numerical parameters corresponding to the sine source 

230 """ 

231 timesteps_per_period: Optional[float] = Field(default=None, description="Initial value for number of time steps (-) per period for the sine source. Determines the initial time step size.") 

232 number_of_periods_to_simulate: Optional[float] = Field(default=None, description="Number of periods (-) to simulate for the sine source.") 

233 

234class CACStrandSolveNumericalparametersPiecewise(BaseModel): 

235 """ 

236 Level 4: Numerical parameters corresponding to the piecewise source 

237 """ 

238 time_to_simulate: Optional[float] = Field(default=None, description="Total time to simulate (s). Used for the piecewise source.") 

239 timesteps_per_time_to_simulate: Optional[float] = Field(default=None, description="If variable_max_timestep is False. Number of time steps (-) per period for the piecewise source.") 

240 force_stepping_at_times_piecewise_linear: bool = Field(default=False, description="If True, time-stepping will contain exactly the time instants that are in the times_source_piecewise_linear list (to avoid truncation maximum applied field/current values).") 

241 

242 variable_max_timestep: bool = Field(default=False, description="If False, the maximum time step is kept constant through the simulation. If True, it varies according to the piecewise definition.") 

243 times_max_timestep_piecewise_linear: Optional[List[float]] = Field(default=None, description="Time instants (s) defining the piecewise linear maximum time step.") 

244 max_timestep_piecewise_linear: Optional[List[float]] = Field(default=None, description="Maximum time steps (s) at the times_max_timestep_piecewise_linear. Above the limits, linear extrapolation of the last two values.") 

245 

246class CACStrandSolveNumericalparameters(BaseModel): 

247 """ 

248 Level 3: Class for numerical parameters 

249 """ 

250 

251 sine: CACStrandSolveNumericalparametersSine = CACStrandSolveNumericalparametersSine() 

252 piecewise: CACStrandSolveNumericalparametersPiecewise = CACStrandSolveNumericalparametersPiecewise() 

253 

254 

255# -- Formulation parameters -- # 

256class CACStrandSolveFormulationparameters(BaseModel): 

257 """ 

258 Level 3: Class for finite element formulation parameters 

259 """ 

260 

261 formulation: Literal['voltage_based'] = Field( 

262 default='voltage_based', 

263 description="Currently, only possible option is voltage_based." 

264 ) 

265 dynamic_correction: Optional[bool] = Field( 

266 default=True, 

267 description="In the voltage_based case, do we activate the dynamic correction?", 

268 ) 

269 compute_temperature: Optional[bool] = Field( 

270 default=False, description="Do we compute the temperature?" 

271 ) 

272 

273 two_ell_periodicity : Optional[bool] = Field( 

274 default=True, description="True to integrate over twice the shortest periodicity length, False to integrate over the shortest periodicity length. " 

275 ) 

276 

277 

278class CACStrandSolve(BaseModel): 

279 """ 

280 Level 2: Class for FiQuS ConductorAC Strand solver settings 

281 """ 

282 pro_template: Optional[Literal['ConductorAC_template.pro']] = Field( 

283 default='ConductorAC_template.pro', 

284 description="Name of the .pro template file." 

285 ) 

286 conductor_name: Optional[str] = Field( 

287 default=None, description="Name of the conductor. Must match a conductor name in the conductors section of the input YAML-file." 

288 ) 

289 formulation_parameters: CACStrandSolveFormulationparameters = ( 

290 CACStrandSolveFormulationparameters() 

291 ) 

292 general_parameters: CACStrandSolveGeneralparameters = ( 

293 CACStrandSolveGeneralparameters() 

294 ) 

295 # material_properties: CACStrandSolveMaterialproperties = ( 

296 # CACStrandSolveMaterialproperties() 

297 # ) 

298 initial_conditions: CACStrandSolveInitialconditions = ( 

299 CACStrandSolveInitialconditions() 

300 ) 

301 source_parameters: CACStrandSolveSourceparameters = ( 

302 CACStrandSolveSourceparameters() 

303 ) 

304 numerical_parameters: CACStrandSolveNumericalparameters = ( 

305 CACStrandSolveNumericalparameters() 

306 ) 

307 

308 

309# ============= POSTPROC ============= # 

310class CACStrandPostprocBatchpostprocLossMapCrossSection(BaseModel): 

311 """ 

312 Level 5: Class with settings for plotting a cross-section of the loss map. 

313 """ 

314 plot_cross_section: bool = Field( 

315 default=False, description="Set True to plot a cross-section of the loss map." 

316 ) 

317 save_plot: bool = Field(default=False, description="Set True to save the plot.") 

318 filename: str = Field(default="cross_section", description="Name of the plot file.") 

319 axis_to_cut: str = Field( 

320 default="x", description="Axis to cut for the cross-section." 

321 ) 

322 cut_value: float = Field( 

323 default=0, description="Value of the axis to cut for the cross-section." 

324 ) 

325 

326 ylabel: str = Field(default="Loss", description="Label of the y-axis.") 

327 title: Optional[str] = Field( 

328 default=None, 

329 description="Title of the plot. The placeholder <<cut_value>> can be used to indicate the value of the cut axis.", 

330 ) 

331 

332 

333class CACStrandPostprocBatchpostprocLossMapCrossSectionSweep(BaseModel): 

334 """ 

335 Level 5: Class with settings for animating a cross-section sweep of the loss map along one axis. 

336 """ 

337 animate_cross_section_sweep: bool = Field( 

338 default=False, 

339 description="Set True to animate a cross-section sweep of the loss map along one axis.", 

340 ) 

341 save_plot: bool = Field( 

342 default=False, description="Set True to save the animation." 

343 ) 

344 filename: str = Field( 

345 default="crossSectionSweep", description="Name of the animation file." 

346 ) 

347 axis_to_sweep: str = Field( 

348 default="x", description="Axis to sweep for the animation." 

349 ) 

350 ylabel: str = Field(default="Loss", description="Label of the y-axis.") 

351 title: Optional[str] = Field( 

352 default=None, 

353 description="Title of the plot. Use <<sweep_value>> to indicate the value of the sweep axis.", 

354 ) 

355 

356 

357class CACStrandPostprocBatchpostprocLossMap(BaseModel): 

358 """ 

359 Level 4: Class with settings for generating loss maps 

360 """ 

361 produce_loss_map: bool = Field( 

362 default=False, description="Set True to produce a loss map." 

363 ) 

364 save_plot: bool = Field(default=False, description="Set True to save the plot.") 

365 filename: str = Field(default="loss_map", description="Name of the plot file.") 

366 x_val: Optional[str] = Field( 

367 default=None, description="Parameter to be plotted on the x-axis. This field corresponds to a parameter in the input YAML-file. E.g. 'solve.source_parameters.sine.frequency' will plot the loss map for different frequencies." 

368 ) 

369 y_val: Optional[str] = Field( 

370 default=None, description="Parameter to be plotted on the y-axis. This field corresponds to a parameter in the input YAML-file. E.g. 'solve.source_parameters.sine.field_amplitude' will plot the loss map for different applied field amplitudes." 

371 ) 

372 x_steps: int = Field(default=20, description="Number of steps on the x-axis.") 

373 y_steps: int = Field(default=20, description="Number of steps on the y-axis.") 

374 loss_type: Literal['TotalLoss', 'FilamentLoss', 'CouplingLoss', 'EddyLoss'] = Field( 

375 default='TotalLoss', 

376 description="Type of loss to be plotted. Supported options are: TotalLoss, FilamentLoss, CouplingLoss, EddyLoss." 

377 ) 

378 x_log: bool = Field( 

379 default=True, description="Set True to plot x-axis in log-scale." 

380 ) 

381 y_log: bool = Field( 

382 default=True, description="Set True to plot y-axis in log-scale." 

383 ) 

384 loss_log: bool = Field( 

385 default=True, description="Set True to plot loss in log-scale." 

386 ) 

387 x_norm: float = Field(default=1, description="Normalization factor for x-axis.") 

388 y_norm: float = Field(default=1, description="Normalization factor for y-axis.") 

389 loss_norm: float = Field(default=1, description="Normalization factor for the AC-loss.") 

390 show_datapoints: bool = Field( 

391 default=True, description="Set True to show markers for all the datapoints in the loss map." 

392 ) 

393 

394 title: Optional[str] = Field(default=None, description="Title for the plot.") 

395 xlabel: Optional[str] = Field(default=None, description="Label for the x-axis.") 

396 ylabel: Optional[str] = Field(default=None, description="Label for the y-axis.") 

397 

398 # lossType_dominance_contour: CACStrandPostprocBatchpostprocLossMapDominanceCountour = ( 

399 # CACStrandPostprocBatchpostprocLossMapDominanceCountour() 

400 # ) 

401 

402 show_loss_type_dominance_contour: bool = Field( 

403 default=False, 

404 description="Set True to plot a contour curve separating regions where different loss types dominate. ", 

405 ) 

406 

407 cross_section: CACStrandPostprocBatchpostprocLossMapCrossSection = ( 

408 CACStrandPostprocBatchpostprocLossMapCrossSection() 

409 ) 

410 cross_section_sweep: CACStrandPostprocBatchpostprocLossMapCrossSectionSweep = ( 

411 CACStrandPostprocBatchpostprocLossMapCrossSectionSweep() 

412 ) 

413 

414 

415class CACStrandPostprocBatchpostprocPlot2d(BaseModel): 

416 """ 

417 Level 4: Class for 2D plot settings 

418 """ 

419 produce_plot2d: bool = Field( 

420 default=False, description="Set True to produce a 2D plot." 

421 ) 

422 combined_plot: bool = Field( 

423 default=False, 

424 description="Set True to produce a combined plot for all simulations. If False, a separate plot is produced for each simulation.", 

425 ) 

426 save_plot: bool = Field(default=False, description="Set True to save the plot.") 

427 filename: str = Field(default="plot2d", description="Name of the plot file.") 

428 x_val: Optional[str] = Field( 

429 default=None, description="Value to be plotted on the x-axis. Parameters in the input YAML-file and class-variables from the plotter 'SimulationData' class can be accessed trough the notation << . >>. E.g. '<<solve.source_parameters.sine.frequency>>' will create a 2D plot with frequency on the x-axis. '<<time>>' will create a plot with time on the x-axis." 

430 ) 

431 y_vals: Optional[List[str]] = Field( 

432 default=None, description=" List of values to be plotted on the y-axis. Parameters in the input YAML-file and class-variables from the plotter 'SimulationData' class can be accessed trough the notation << . >>. E.g. total AC-loss per cycle can be accessed as ['<<total_power_per_cycle['TotalLoss_dyn']>>']." 

433 ) 

434 labels: Optional[List[str]] = Field( 

435 default=None, 

436 description="List of labels for the plot. Each label corresponding to a value in y_val.", 

437 ) 

438 linestyle: Optional[str] = Field( 

439 default=None, description="Linestyle for the plot." 

440 ) 

441 

442 title: Optional[str] = Field(default=None, description="Title for the plot.") 

443 xlabel: Optional[str] = Field(default=None, description="Label for the x-axis.") 

444 ylabel: Optional[str] = Field(default=None, description="Label for the y-axis.") 

445 x_log: bool = Field(default=False, description="Set True to plot x-axis in log-scale.") 

446 y_log: bool = Field(default=False, description="Set True to plot y-axis in log-scale.") 

447 legend: bool = Field(default=True, description="Set True to show legend.") 

448 

449 

450class CACStrandPostprocBatchpostprocFilter(BaseModel): 

451 """ 

452 Level 4: Field for filtering simulations based on simulation parameters for batch post-processing 

453 """ 

454 apply_filter: bool = Field( 

455 default=False, 

456 description="Set True to filter simulations by parameters from the input YAML-file.", 

457 ) 

458 filter_criterion: Optional[str] = Field( 

459 default=None, 

460 description="Criterion used to filter simulations based on simulation parameters. For example will '<<solve.source_parameters.sine.frequency>> > 100' disregard simulations done with frequencies lower than 100Hz.", 

461 ) 

462 

463 

464class CACStrandPostprocBatchpostprocSort(BaseModel): 

465 """ 

466 Level 4: Field for sorting simulations based on simulation parameters for batch post-processing 

467 """ 

468 apply_sort: bool = Field(default=False, description="Set True to sort simulations.") 

469 sort_key: Optional[str] = Field( 

470 default=None, 

471 description="Criterion used to sort simulations based on simulation parameters. For example will 'sd.total_power_per_cycle['TotalLoss'] sort simulations based on the total loss.", 

472 ) 

473 

474 

475class CACStrandPostprocBatchpostproc(BaseModel): 

476 """ 

477 Level 3: Class for batch post-processing settings 

478 """ 

479 postProc_csv: Optional[str] = Field( 

480 default=None, 

481 description="Name of the .csv file for post-processing (without file extension). This file specifies the simulations to be post-processed. The file is structured into three columns, specifying the folder names to access the simulation results: 'input.run.geometry', 'input.run.mesh' and 'input.run.solve'. Each row corresponds to a simulation to be post-processed.", 

482 ) 

483 output_folder: Optional[str] = Field( 

484 default=None, 

485 description="Batch post-processing creates a folder with the given name in the output directory, where all the plots are saved.", 

486 ) 

487 filter: CACStrandPostprocBatchpostprocFilter = CACStrandPostprocBatchpostprocFilter() 

488 sort: CACStrandPostprocBatchpostprocSort = CACStrandPostprocBatchpostprocSort() 

489 loss_map: CACStrandPostprocBatchpostprocLossMap = CACStrandPostprocBatchpostprocLossMap() 

490 plot2d: CACStrandPostprocBatchpostprocPlot2d = CACStrandPostprocBatchpostprocPlot2d() 

491 

492 

493class CACStrandPostprocPlotInstPower(BaseModel): 

494 """ 

495 Level 3: Class with settings for generating plots of instantaneous power 

496 """ 

497 show: bool = Field(default=False, description="Creates a plot for the calculated instantaneous AC loss (W/m) as a function of time (s).") 

498 title: str = Field(default="Instantaneous Power", description="Title for the plot.") 

499 save: bool = Field(default=False, description="Set True to save the plot.") 

500 save_file_name: str = Field( 

501 default="instantaneous_power", description="Name of the plot file." 

502 ) 

503 

504 

505class CACStrandPostprocCleanup(BaseModel): 

506 """ 

507 Level 3: Class for cleanup settings 

508 """ 

509 remove_pre_file: bool = Field( 

510 default=False, 

511 description="Set True to remove the .pre-file after post-processing, to save disk space.", 

512 ) 

513 remove_res_file: bool = Field( 

514 default=False, 

515 description="Set True to remove the .res-file after post-processing, to save disk space.", 

516 ) 

517 remove_msh_file: bool = Field( 

518 default=False, 

519 description="Set True to remove the .msh-file after post-processing, to save disk space.", 

520 ) 

521 

522 

523class CACStrandPostproc(BaseModel): 

524 """ 

525 Level 2: Class for FiQuS ConductorAC 

526 """ 

527 

528 generate_pos_files: bool = Field( 

529 default=True, 

530 description="Set True to generate .pos-files during post-processing", 

531 ) 

532 plot_instantaneous_power: CACStrandPostprocPlotInstPower = ( 

533 CACStrandPostprocPlotInstPower() 

534 ) 

535 compute_current_per_filament: bool = Field( 

536 default=False, 

537 description="Computes current in every filament, with decomposition into magnetization and transport current.", 

538 ) 

539 save_last_current_density: Optional[str] = Field( 

540 default=None, 

541 description="Saves the last current density field solution (out-of-plane) in the file given as a string." 

542 " The '.pos' extension will be appended to it. Nothing is done if None." 

543 " This can be for using the current density as an initial condition (but not implemented yet).", 

544 ) 

545 save_last_magnetic_field: Optional[str] = Field( 

546 default=None, 

547 description="Saves the last magnetic field solution (in-plane) in the file given as a string." 

548 " The '.pos' extension will be appended to it. Nothing is done if None." 

549 " This is for using the magnetic field as an initial condition for another resolution.", 

550 ) 

551 cleanup: CACStrandPostprocCleanup = CACStrandPostprocCleanup() 

552 batch_postproc: CACStrandPostprocBatchpostproc = CACStrandPostprocBatchpostproc() 

553 

554# ============= BASE ============= # 

555class CACStrand(BaseModel): 

556 """ 

557 Level 1: Class for FiQuS ConductorAC 

558 """ 

559 

560 type: Literal["CACStrand"] 

561 geometry: CACStrandGeometry = CACStrandGeometry() 

562 mesh: CACStrandMesh = CACStrandMesh() 

563 solve: CACStrandSolve = CACStrandSolve() 

564 postproc: CACStrandPostproc = CACStrandPostproc() 

565