BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_MaxwellFactory.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef CL_MAXWELLFACTORY_HPP
13#define CL_MAXWELLFACTORY_HPP
14#include <en_CutAlgorithm.hpp>
15
16#include "typedefs.hpp"
17#include "cl_Map.hpp"
18#include "cl_Mesh.hpp"
19#include "en_DomainType.hpp"
20#include "cl_Vector.hpp"
21#include "cl_FEM_Kernel.hpp"
22#include "cl_IWG_Maxwell.hpp"
24#include "cl_InputFile.hpp"
25#include "cl_FEM_Domain.hpp"
26#include "cl_Topology.hpp"
27#include "cl_Protoshell.hpp"
28
29namespace belfem
30{
31 namespace fem
32 {
40 {
41
42 const proc_t mCommRank ;
43
44 const InputFile * mInputFile ;
45
46 // -- user settings
47
49
50 bool mSaveElementConnectivitiesToBfm = false ;
51 // --- end user settings
52 // deleted by kernel
53 bool mOwnKernelParameters = true ;
54 KernelParameters * mKernelParameters = nullptr ;
55
56 Mesh * mMesh = nullptr ;
57 string mMeshPath ;
58
59 bool mComputeCohomologies = true ;
60
62
64 bool mUseEnrichment = false ;
65
66 Vector< proc_t > mCommTable ;
67
68 uint mMeshDimension = 0 ;
69 uint mElementOrder = 0 ;
70
71 std::shared_ptr< Kernel > mMagneticKernel ;
72
73 IWG_Maxwell * mMagneticEquation = nullptr ;
74 bool mOwnMagneticEquation = true ;
75
76 DofManager * mMagneticField = nullptr ;
77 mesh::Topology * mTopology = nullptr ;
78
79 Cell< Domain * > mDomains ;
80
81 Cell< mesh::Curve * > mCurves ;
82
83 MaxwellBoundaryConditionFactory * mBoundaryConditionFactory = nullptr ;
84 mesh::PeriodicityFactory * mPeriodicFactory = nullptr ;
85
86 //Terminal information to send to the cut factory
87 Cell< Cell<id_t> > mTerminals;
88 Cell<id_t> mThinShellTerminalIndices ;
89
90 Map< id_t, string > mMaterialBlockAssignment ;
91
92 Vector< index_t > mHangingFacetIndices ;
93 Matrix< real > mHangingFacetTMatrices ;
94
95 Cell< Protoshell * > mProtoshells ;
96
97 Map< string, id_t > mMaterialIDs ;
98 Map<string, Material *> mMaterialMap ;
99
100 // these sidesets are the templates from which we create
101 // the thin shells
103 Map< id_t, mesh::ThinShell * > mThinShellMap ;
104
105 Cell< Cell< index_t > > mThinShellNodeIndices ;
106 Cell< mesh::Node * > mThinShellMasterNodes ;
107 Cell< mesh::Node * > mThinShellSlaveNodes ;
108
109 struct EdgeWorkData
110 {
111 Cell< mesh::Node * > NodesOnThinShell ;
112 Cell< mesh::Node * > NodesOnVolume ;
113
114 Cell< mesh::Edge * > EdgesOnThinShell ;
115 Cell< mesh::Edge * > EdgesOnVolume ;
116 };
117
118 string mLabel ;
119
120//------------------------------------------------------------------------------
121 public:
122//------------------------------------------------------------------------------
123
124 MaxwellFactory( const string & aInputFile );
125
127
128 const string &
129 mesh_path() const ;
130
131//------------------------------------------------------------------------------
132
133 std::shared_ptr< Kernel >
135
136//------------------------------------------------------------------------------
137
138 std::shared_ptr< Controller >
140
141//------------------------------------------------------------------------------
142
143 Cell <PhysicalBoundaryCondition *> &
145
146//------------------------------------------------------------------------------
147
148 Cell <PhysicalBoundaryCondition *>
149 current_BCs() ;
150
151//------------------------------------------------------------------------------
152
153 Mesh *
154 mesh();
155
156//------------------------------------------------------------------------------
157
158 string
159 label() const ;
160
161//------------------------------------------------------------------------------
162 private:
163//------------------------------------------------------------------------------
164
165 Mesh *
166 read_mesh();
167
168//------------------------------------------------------------------------------
169
170 void
171 read_domain_types();
172
173//------------------------------------------------------------------------------
174
179 void
180 report_config_difference(
181 const string & aStored,
182 const string & aCurrent );
183
184//------------------------------------------------------------------------------
185
186 void
187 create_curves( const input::Section * aSection );
188
189//------------------------------------------------------------------------------
190
191 void
192 create_periodic( const input::Section * aSection );
193
194//------------------------------------------------------------------------------
195
197 create_equation( const maxwell::Formulation aFormulation );
198
199//------------------------------------------------------------------------------
200
201 void
202 set_block_types_in_magnetic_equation();
203
204//------------------------------------------------------------------------------
207 void
208 fix_facet_masters();
209
210//------------------------------------------------------------------------------
211
215 void
216 read_signed_sidesets(
217 const input::Section * aSection,
218 const string & aKey,
219 Protoshell * aShell );
220
221//------------------------------------------------------------------------------
222
227 void
228 flip_thin_shell_sidesets();
229
230//------------------------------------------------------------------------------
231
232 void
233 create_cuts();
234
235//------------------------------------------------------------------------------
236
237 void
238 create_cuts_sub_master();
239
240//------------------------------------------------------------------------------
241
242 void
243 set_block_and_sideset_names();
244
245//------------------------------------------------------------------------------
246
247 void
248 create_cuts_sub_slave();
249
250//------------------------------------------------------------------------------
251
252 void
253 create_thinshells();
254
255//------------------------------------------------------------------------------
256
257 void
258 create_terminal_list();
259
260//------------------------------------------------------------------------------
261
262 void
263 create_edges_and_faces_on_mesh();
264
265//------------------------------------------------------------------------------
266
267 void
268 create_hanging_edges_and_facets();
269
270//------------------------------------------------------------------------------
271
272 void
273 create_postprocessors();
274
275//------------------------------------------------------------------------------
276
277 void
278 init_fields();
279
280//------------------------------------------------------------------------------
281
282 void
283 configure_solver( const input::Section * aSection, DofManager * aField );
284
285//------------------------------------------------------------------------------
286
287 void
288 create_block_to_material_map();
289
290//------------------------------------------------------------------------------
291
292 void
293 collect_material_labels_from_domains( Vector< id_t > & aBlockIDs, Cell< string > & aMaterialLabels );
294
295//------------------------------------------------------------------------------
296
297 void
298 set_physical_tags_for_elements();
299
300//------------------------------------------------------------------------------
301
302 void
303 synch_material_map();
304
305//------------------------------------------------------------------------------
306
307 void
308 create_materials();
309
310 void
311 assign_materials();
312
313 void
314 delete_unused_materials();
315
316//------------------------------------------------------------------------------
317
318 void
319 read_thin_shell_data();
320
321//------------------------------------------------------------------------------
322
323 void
324 find_autopins( Cell< mesh::Node * > & aPins );
325
326//------------------------------------------------------------------------------
327
328 void
329 hang_thinshell_edges_on_nodes_bottom(
330 EdgeWorkData & aWork,
331 mesh::Facet * aFacets,
332 mesh::Element * aElement );
333
334 void
335 hang_thinshell_edges_on_nodes_top(
336 EdgeWorkData & aWork,
337 mesh::Facet * aFacets,
338 mesh::Element * aElement );
339
340 void
341 hang_thinshell_edges_on_edges_bottom(
342 EdgeWorkData & aWork,
343 mesh::Facet * aFacets,
344 mesh::Element * aElement );
345
346 void
347 hang_thinshell_edges_on_edges_top(
348 EdgeWorkData & aWork,
349 mesh::Facet * aFacets,
350 mesh::Element * aElement );
351
352//------------------------------------------------------------------------------
353 };
354
355 }
356}
357
358#endif //CL_MAXWELLFACTORY_HPP
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
Parser for the input.conf configuration format.
Definition cl_InputFile.hpp:30
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
Thin shell configuration object for electromagnetic simulations.
Definition cl_Protoshell.hpp:41
this class creates the DOFs based on the passed equation object.
Definition cl_FEM_DofManager.hpp:55
Main electromagnetic integral weak form (h-phi formulation).
Definition cl_IWG_Maxwell.hpp:31
Definition cl_FEM_KernelParameters.hpp:29
Builds the physical boundary conditions of a Maxwell problem.
Definition cl_MaxwellBoundaryConditionFactory.hpp:36
std::shared_ptr< Controller > create_controller()
Definition cl_MaxwellFactory.cpp:1097
std::shared_ptr< Kernel > create_magnetic_kernel()
Definition cl_MaxwellFactory.cpp:691
const string & mesh_path() const
Definition cl_MaxwellFactory.cpp:265
Cell< PhysicalBoundaryCondition * > & boundary_conditions()
Definition cl_MaxwellFactory.cpp:1121
string label() const
Definition cl_MaxwellFactory.cpp:1144
MaxwellFactory(const string &aInputFile)
Definition cl_MaxwellFactory.cpp:66
Cell< PhysicalBoundaryCondition * > current_BCs()
Definition cl_MaxwellFactory.cpp:1129
One hierarchical section of a configuration file.
Definition cl_Input_Section.hpp:34
Definition cl_Facet.hpp:24
Creates a Periodicity object by matching nodes on two periodic boundary planes.
Definition cl_Mesh_PeriodicityFactory.hpp:34
Analyzes and classifies mesh topology for finite element simulations.
Definition cl_Topology.hpp:44
Formulation
Definition en_Maxwell_Formulations.hpp:23
@ HPhi
Definition en_Maxwell_Formulations.hpp:24
Definition cl_IFB_LINE3.hpp:21
CutAlgorithm
Definition en_CutAlgorithm.hpp:22
@ PellikkaGeneralized
Definition en_CutAlgorithm.hpp:26
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
ModelDimensionality
Definition en_IWGs.hpp:20
@ UNDEFINED
Definition en_IWGs.hpp:25
int proc_t
Definition commtypes.hpp:29
Definition Element.py:1
Definition __init__.py:1