fiqus 2025.2.0__py3-none-any.whl → 2025.11.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.
- fiqus/MainFiQuS.py +24 -28
- fiqus/data/DataConductor.py +350 -301
- fiqus/data/DataFiQuS.py +42 -115
- fiqus/data/DataFiQuSCCT.py +150 -150
- fiqus/data/DataFiQuSConductor.py +97 -84
- fiqus/data/DataFiQuSConductorAC_Strand.py +701 -565
- fiqus/data/DataModelCommon.py +439 -0
- fiqus/data/DataMultipole.py +0 -13
- fiqus/data/DataRoxieParser.py +7 -0
- fiqus/data/DataWindingsCCT.py +37 -37
- fiqus/data/RegionsModelFiQuS.py +61 -104
- fiqus/geom_generators/GeometryCCT.py +904 -905
- fiqus/geom_generators/GeometryConductorAC_Strand.py +1863 -1391
- fiqus/geom_generators/GeometryMultipole.py +5 -4
- fiqus/geom_generators/GeometryPancake3D.py +1 -1
- fiqus/getdp_runners/RunGetdpCCT.py +13 -4
- fiqus/getdp_runners/RunGetdpConductorAC_Strand.py +341 -201
- fiqus/getdp_runners/RunGetdpPancake3D.py +2 -2
- fiqus/mains/MainConductorAC_Strand.py +141 -133
- fiqus/mains/MainMultipole.py +6 -5
- fiqus/mains/MainPancake3D.py +3 -4
- fiqus/mesh_generators/MeshCCT.py +209 -209
- fiqus/mesh_generators/MeshConductorAC_Strand.py +709 -656
- fiqus/mesh_generators/MeshMultipole.py +43 -46
- fiqus/parsers/ParserDAT.py +16 -16
- fiqus/parsers/ParserGetDPOnSection.py +212 -212
- fiqus/parsers/ParserGetDPTimeTable.py +134 -134
- fiqus/parsers/ParserMSH.py +53 -53
- fiqus/parsers/ParserPOS.py +214 -214
- fiqus/parsers/ParserRES.py +142 -142
- fiqus/plotters/PlotPythonCCT.py +133 -133
- fiqus/plotters/PlotPythonConductorAC.py +1079 -855
- fiqus/plotters/PlotPythonMultipole.py +18 -18
- fiqus/post_processors/PostProcessCCT.py +444 -440
- fiqus/post_processors/PostProcessConductorAC.py +997 -49
- fiqus/post_processors/PostProcessMultipole.py +19 -19
- fiqus/pre_processors/PreProcessCCT.py +175 -175
- fiqus/pro_material_functions/ironBHcurves.pro +246 -246
- fiqus/pro_templates/combined/CCT_template.pro +275 -274
- fiqus/pro_templates/combined/ConductorAC_template.pro +1474 -1025
- fiqus/pro_templates/combined/Multipole_template.pro +5 -5
- fiqus/utils/Utils.py +12 -7
- {fiqus-2025.2.0.dist-info → fiqus-2025.11.0.dist-info}/METADATA +65 -63
- fiqus-2025.11.0.dist-info/RECORD +86 -0
- {fiqus-2025.2.0.dist-info → fiqus-2025.11.0.dist-info}/WHEEL +1 -1
- tests/test_geometry_generators.py +4 -0
- tests/test_mesh_generators.py +5 -0
- tests/test_solvers.py +41 -4
- tests/utils/fiqus_test_classes.py +15 -6
- tests/utils/generate_reference_files_ConductorAC.py +57 -57
- tests/utils/helpers.py +97 -97
- fiqus-2025.2.0.dist-info/RECORD +0 -85
- {fiqus-2025.2.0.dist-info → fiqus-2025.11.0.dist-info}/LICENSE.txt +0 -0
- {fiqus-2025.2.0.dist-info → fiqus-2025.11.0.dist-info}/top_level.txt +0 -0
|
@@ -1,133 +1,141 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from fiqus.geom_generators.GeometryConductorAC_Strand import Geometry
|
|
4
|
-
from fiqus.mesh_generators.MeshConductorAC_Strand import Mesh, StrandMesh
|
|
5
|
-
from fiqus.getdp_runners.RunGetdpConductorAC_Strand import Solve
|
|
6
|
-
from fiqus.post_processors.PostProcessConductorAC import PostProcess
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class MainConductorAC_Strand:
|
|
10
|
-
def __init__(self, fdm, inputs_folder_path='', outputs_folder_path='', verbose=True):
|
|
11
|
-
"""
|
|
12
|
-
Main class for working with simulations for the Conductor AC model.
|
|
13
|
-
:param fdm: FiQuS data model
|
|
14
|
-
:param inputs_folder_path: full path to folder with input files
|
|
15
|
-
:param verbose: if True, more info is printed in the console
|
|
16
|
-
"""
|
|
17
|
-
self.verbose = verbose
|
|
18
|
-
self.fdm = fdm
|
|
19
|
-
self.inputs_folder_path = inputs_folder_path
|
|
20
|
-
self.outputs_folder_path = outputs_folder_path
|
|
21
|
-
self.GetDP_path = None
|
|
22
|
-
self.geom_folder = None
|
|
23
|
-
self.mesh_folder = None
|
|
24
|
-
self.solution_folder = None
|
|
25
|
-
self.model_file = None
|
|
26
|
-
self.model_folder = None
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
g
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
m
|
|
57
|
-
m.
|
|
58
|
-
m.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
m.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"""
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
s
|
|
81
|
-
s.
|
|
82
|
-
s.
|
|
83
|
-
s.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"""
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
s
|
|
99
|
-
s.
|
|
100
|
-
s.
|
|
101
|
-
|
|
102
|
-
#
|
|
103
|
-
def post_process_python(self, gui: bool = False):
|
|
104
|
-
# os.chdir(self.solution_folder)
|
|
105
|
-
postProc = PostProcess(self.fdm, self.outputs_folder_path)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
plotter.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
1
|
+
import os, cProfile
|
|
2
|
+
|
|
3
|
+
from fiqus.geom_generators.GeometryConductorAC_Strand import Geometry
|
|
4
|
+
from fiqus.mesh_generators.MeshConductorAC_Strand import Mesh, StrandMesh
|
|
5
|
+
from fiqus.getdp_runners.RunGetdpConductorAC_Strand import Solve
|
|
6
|
+
from fiqus.post_processors.PostProcessConductorAC import PostProcess, BatchPostProcess
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MainConductorAC_Strand:
|
|
10
|
+
def __init__(self, fdm, inputs_folder_path='', outputs_folder_path='', verbose=True):
|
|
11
|
+
"""
|
|
12
|
+
Main class for working with simulations for the Conductor AC model.
|
|
13
|
+
:param fdm: FiQuS data model
|
|
14
|
+
:param inputs_folder_path: full path to folder with input files
|
|
15
|
+
:param verbose: if True, more info is printed in the console
|
|
16
|
+
"""
|
|
17
|
+
self.verbose = verbose
|
|
18
|
+
self.fdm = fdm
|
|
19
|
+
self.inputs_folder_path = inputs_folder_path
|
|
20
|
+
self.outputs_folder_path = outputs_folder_path
|
|
21
|
+
self.GetDP_path = None
|
|
22
|
+
self.geom_folder = None
|
|
23
|
+
self.mesh_folder = None
|
|
24
|
+
self.solution_folder = None
|
|
25
|
+
self.model_file = None
|
|
26
|
+
self.model_folder = None
|
|
27
|
+
|
|
28
|
+
def generate_geometry(self, gui=False):
|
|
29
|
+
"""
|
|
30
|
+
Generates the strand geometry.
|
|
31
|
+
"""
|
|
32
|
+
os.chdir(self.geom_folder)
|
|
33
|
+
g = Geometry(fdm=self.fdm, inputs_folder_path=self.inputs_folder_path, verbose=self.verbose)
|
|
34
|
+
g.generate_strand_geometry(gui)
|
|
35
|
+
|
|
36
|
+
def load_geometry(self, gui: bool = False):
|
|
37
|
+
"""
|
|
38
|
+
Loads the previously generated geometry from the .brep file.
|
|
39
|
+
"""
|
|
40
|
+
os.chdir(self.geom_folder)
|
|
41
|
+
g = Geometry(fdm=self.fdm, inputs_folder_path=self.inputs_folder_path, verbose=self.verbose)
|
|
42
|
+
g.load_conductor_geometry(gui)
|
|
43
|
+
# self.model_file = g.model_file
|
|
44
|
+
|
|
45
|
+
def pre_process(self, gui=False):
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
def mesh(self, gui: bool = False):
|
|
49
|
+
"""
|
|
50
|
+
Generates the mesh for the strand geometry.
|
|
51
|
+
"""
|
|
52
|
+
os.chdir(self.mesh_folder)
|
|
53
|
+
|
|
54
|
+
m = StrandMesh(fdm=self.fdm, verbose=self.verbose)
|
|
55
|
+
m.generate_mesh(self.geom_folder)
|
|
56
|
+
m.generate_cuts()
|
|
57
|
+
m.generate_regions_file()
|
|
58
|
+
m.save_mesh(gui)
|
|
59
|
+
|
|
60
|
+
return {"test": 0}
|
|
61
|
+
|
|
62
|
+
def load_mesh(self, gui=False):
|
|
63
|
+
"""
|
|
64
|
+
Loads the previously generated mesh from the MSH file.
|
|
65
|
+
"""
|
|
66
|
+
os.chdir(self.mesh_folder)
|
|
67
|
+
m = Mesh(fdm=self.fdm, verbose=self.verbose)
|
|
68
|
+
m.load_mesh(gui)
|
|
69
|
+
|
|
70
|
+
# self.model_file = m.mesh_file
|
|
71
|
+
|
|
72
|
+
def solve_and_postprocess_getdp(self, gui: bool = False):
|
|
73
|
+
"""
|
|
74
|
+
Assembles the .pro-file from the template, then runs the simulation and the post-processing steps using GetDP.
|
|
75
|
+
"""
|
|
76
|
+
os.chdir(self.solution_folder)
|
|
77
|
+
|
|
78
|
+
s = Solve(self.fdm, self.GetDP_path, self.geom_folder, self.mesh_folder, self.verbose)
|
|
79
|
+
s.read_excitation(inputs_folder_path=self.inputs_folder_path)
|
|
80
|
+
s.get_solution_parameters_from_yaml(inputs_folder_path=self.inputs_folder_path)
|
|
81
|
+
s.assemble_pro()
|
|
82
|
+
s.run_getdp(solve=True, postOperation=True, gui=gui)
|
|
83
|
+
s.cleanup()
|
|
84
|
+
|
|
85
|
+
# def pre_process(self):
|
|
86
|
+
# os.chdir(self.solution_folder)
|
|
87
|
+
|
|
88
|
+
# s = Solve(self.fdm, self.GetDP_path, self.mesh_folder, self.verbose)
|
|
89
|
+
|
|
90
|
+
def post_process_getdp(self, gui: bool = False):
|
|
91
|
+
"""
|
|
92
|
+
Runs the post-processing steps trough GetDP.
|
|
93
|
+
"""
|
|
94
|
+
os.chdir(self.solution_folder)
|
|
95
|
+
|
|
96
|
+
s = Solve(self.fdm, self.GetDP_path, self.geom_folder, self.mesh_folder, self.verbose)
|
|
97
|
+
s.read_excitation(inputs_folder_path=self.inputs_folder_path)
|
|
98
|
+
s.get_solution_parameters_from_yaml(inputs_folder_path=self.inputs_folder_path)
|
|
99
|
+
s.assemble_pro()
|
|
100
|
+
s.run_getdp(solve=False, postOperation=True, gui=gui)
|
|
101
|
+
|
|
102
|
+
#
|
|
103
|
+
def post_process_python(self, gui: bool = False):
|
|
104
|
+
# os.chdir(self.solution_folder)
|
|
105
|
+
postProc = PostProcess(self.fdm, self.outputs_folder_path)
|
|
106
|
+
|
|
107
|
+
if self.fdm.magnet.postproc.plot_instantaneous_power:
|
|
108
|
+
postProc.instantaneous_loss()
|
|
109
|
+
|
|
110
|
+
if self.fdm.magnet.postproc.plot_flux.show:
|
|
111
|
+
postProc.internal_flux()
|
|
112
|
+
|
|
113
|
+
postProc.plotter.show()
|
|
114
|
+
|
|
115
|
+
return {'test': 0}
|
|
116
|
+
|
|
117
|
+
def batch_post_process_python(self, gui: bool = False):
|
|
118
|
+
"""
|
|
119
|
+
Runs batch post-processing steps using Python.
|
|
120
|
+
Used for gathering, analysing, comparing and plotting data from multiple simulations.
|
|
121
|
+
"""
|
|
122
|
+
BatchPostProc = BatchPostProcess(self.fdm, lossMap_gridData_folder=None, inputs_folder_path=self.inputs_folder_path, outputs_folder_path=self.outputs_folder_path)
|
|
123
|
+
|
|
124
|
+
if self.fdm.magnet.postproc.batch_postproc.loss_map.produce_loss_map:
|
|
125
|
+
# plotter.save_lossMap_gridData()
|
|
126
|
+
# plotter.save_magnetization()
|
|
127
|
+
BatchPostProc.plotter.create_lossMap()
|
|
128
|
+
|
|
129
|
+
if self.fdm.magnet.postproc.batch_postproc.loss_map.cross_section.plot_cross_section:
|
|
130
|
+
BatchPostProc.plotter.plot_lossMap_crossSection()
|
|
131
|
+
|
|
132
|
+
if self.fdm.magnet.postproc.batch_postproc.loss_map.cross_section_sweep.animate_cross_section_sweep:
|
|
133
|
+
BatchPostProc.plotter.animate_lossMap_crossSection()
|
|
134
|
+
|
|
135
|
+
if self.fdm.magnet.postproc.batch_postproc.plot2d.produce_plot2d:
|
|
136
|
+
BatchPostProc.plotter.plot2d()
|
|
137
|
+
|
|
138
|
+
if self.fdm.magnet.postproc.batch_postproc.rohf_on_grid.fit_rohf or self.fdm.magnet.postproc.batch_postproc.rohf_on_grid.produce_error_map:
|
|
139
|
+
BatchPostProc.rohf_on_grid()
|
|
140
|
+
|
|
141
|
+
|
fiqus/mains/MainMultipole.py
CHANGED
|
@@ -5,6 +5,7 @@ import time
|
|
|
5
5
|
from fiqus.utils.Utils import GmshUtils
|
|
6
6
|
from fiqus.utils.Utils import FilesAndFolders as Util
|
|
7
7
|
from fiqus.data import DataFiQuS as dF
|
|
8
|
+
from fiqus.data.DataRoxieParser import FiQuSGeometry
|
|
8
9
|
from fiqus.geom_generators.GeometryMultipole import Geometry
|
|
9
10
|
from fiqus.mesh_generators.MeshMultipole import Mesh
|
|
10
11
|
from fiqus.getdp_runners.RunGetdpMultipole import RunGetdpMultipole
|
|
@@ -35,7 +36,7 @@ class MainMultipole:
|
|
|
35
36
|
fdm.magnet.geometry.electromagnetics.symmetry = 'x'
|
|
36
37
|
return fdm
|
|
37
38
|
def generate_geometry(self, gui: bool = False):
|
|
38
|
-
geom = Util.read_data_from_yaml(self.rgd,
|
|
39
|
+
geom = Util.read_data_from_yaml(self.rgd, FiQuSGeometry)
|
|
39
40
|
fdm = self.force_symmetry() if 'solenoid' in geom.Roxie_Data.coil.coils[1].type else self.fdm # todo: this should be handled by pydantic
|
|
40
41
|
if self.fdm.magnet.geometry.plot_preview:
|
|
41
42
|
plotter = PlotPythonMultipole(geom, self.fdm)
|
|
@@ -91,7 +92,7 @@ class MainMultipole:
|
|
|
91
92
|
|
|
92
93
|
def mesh(self, gui: bool = False):
|
|
93
94
|
mm = Mesh(data=self.fdm, mesh_folder=self.mesh_folder, verbose=self.verbose)
|
|
94
|
-
geom = Util.read_data_from_yaml(self.rgd,
|
|
95
|
+
geom = Util.read_data_from_yaml(self.rgd, FiQuSGeometry)
|
|
95
96
|
fdm = self.force_symmetry() if 'solenoid' in geom.Roxie_Data.coil.coils[1].type else self.fdm
|
|
96
97
|
geometry_settings = {'EM': fdm.magnet.geometry.electromagnetics, 'TH': self.fdm.magnet.geometry.thermal}
|
|
97
98
|
mesh_settings = {'EM': fdm.magnet.mesh.electromagnetics, 'TH': fdm.magnet.mesh.thermal}
|
|
@@ -108,7 +109,7 @@ class MainMultipole:
|
|
|
108
109
|
mm.defineMesh(geometry_settings[physics_solved], mesh_settings[physics_solved], physics_solved)
|
|
109
110
|
mm.createPhysicalGroups(geometry_settings[physics_solved])
|
|
110
111
|
mm.updateAuxiliaryFile(physics_solved)
|
|
111
|
-
if geometry_settings[physics_solved].
|
|
112
|
+
if geometry_settings[physics_solved].model_dump().get('use_TSA', False):
|
|
112
113
|
mm.rearrangeThinShellsData()
|
|
113
114
|
mm.assignRegionsTags(geometry_settings[physics_solved], mesh_settings[physics_solved])
|
|
114
115
|
mm.saveRegionFile(physics_solved)
|
|
@@ -116,7 +117,7 @@ class MainMultipole:
|
|
|
116
117
|
mm.generateMesh()
|
|
117
118
|
mm.checkMeshQuality()
|
|
118
119
|
mm.saveMeshFile(physics_solved)
|
|
119
|
-
if geometry_settings[physics_solved].
|
|
120
|
+
if geometry_settings[physics_solved].model_dump().get('use_TSA', False):
|
|
120
121
|
mm.saveClosestNeighboursList()
|
|
121
122
|
if self.fdm.magnet.mesh.thermal.isothermal_conductors: mm.selectMeshNodes(elements='conductors')
|
|
122
123
|
if self.fdm.magnet.geometry.thermal.with_wedges and self.fdm.magnet.mesh.thermal.isothermal_wedges: mm.selectMeshNodes(elements='wedges')
|
|
@@ -169,7 +170,7 @@ class MainMultipole:
|
|
|
169
170
|
pp.loadStrandPositions(run_type)
|
|
170
171
|
pp.loadAuxiliaryFile(run_type)
|
|
171
172
|
if pp_settings[run_type].plot_all != 'False': pp.loadHalfTurnCornerPositions()
|
|
172
|
-
if pp_settings[run_type].
|
|
173
|
+
if pp_settings[run_type].model_dump().get('take_average_conductor_temperature', False): pp.loadRegionFile()
|
|
173
174
|
pp.postProcess(pp_settings[run_type])
|
|
174
175
|
if run_type == 'EM' and self.fdm.magnet.geometry.electromagnetics.symmetry != 'none': pp.completeMap2d()
|
|
175
176
|
pp.clear()
|
fiqus/mains/MainPancake3D.py
CHANGED
|
@@ -111,7 +111,6 @@ from fiqus.mesh_generators.MeshPancake3D import Mesh
|
|
|
111
111
|
from fiqus.getdp_runners.RunGetdpPancake3D import Solve
|
|
112
112
|
from fiqus.post_processors.PostProcessPancake3D import Postprocess
|
|
113
113
|
from fiqus.data.DataFiQuS import FDM
|
|
114
|
-
from fiqus.data.DataFiQuS import PowerSupply
|
|
115
114
|
|
|
116
115
|
|
|
117
116
|
class MainPancake3D:
|
|
@@ -409,13 +408,13 @@ class MainPancake3D:
|
|
|
409
408
|
0.1 + estimated_time_constant * 8 + 0.001
|
|
410
409
|
)
|
|
411
410
|
new_solve_object_for_inductance_and_time_constant["winding"] = (
|
|
412
|
-
copy_fdm.magnet.solve.winding.
|
|
411
|
+
copy_fdm.magnet.solve.winding.model_dump()
|
|
413
412
|
)
|
|
414
413
|
new_solve_object_for_inductance_and_time_constant["contactLayer"] = (
|
|
415
|
-
copy_fdm.magnet.solve.contactLayer.
|
|
414
|
+
copy_fdm.magnet.solve.contactLayer.model_dump()
|
|
416
415
|
)
|
|
417
416
|
new_solve_object_for_inductance_and_time_constant["terminals"] = (
|
|
418
|
-
copy_fdm.magnet.solve.terminals.
|
|
417
|
+
copy_fdm.magnet.solve.terminals.model_dump()
|
|
419
418
|
)
|
|
420
419
|
solve_object = Pancake3DSolve(
|
|
421
420
|
**new_solve_object_for_inductance_and_time_constant
|