v0.14.0
Loading...
Searching...
No Matches
PipelineManager interface

Implementation of basic interface for rapid problem implementation. More...

Collaboration diagram for PipelineManager interface:

Files

file  PipelineManager.cpp
 Implementation of basic interface.
 
file  PipelineManager.hpp
 Header file for basic interface.
 

Classes

struct  MoFEM::PipelineManager
 PipelineManager interface. More...
 

Functions

template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpDomainLhsPipeline ()
 Get the Op Domain Lhs Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpDomainRhsPipeline ()
 Get the Op Domain Rhs Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpBoundaryLhsPipeline ()
 Get the Op Boundary Lhs Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpBoundaryRhsPipeline ()
 Get the Op Boundary Rhs Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpSkeletonLhsPipeline ()
 Get the Op Skeleton Lhs Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpSkeletonRhsPipeline ()
 Get the Op Skeleton Rhs Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpDomainExplicitRhsPipeline ()
 Get the Op Domain Rhs Pipeline object for implicit-explicit G term.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpBoundaryExplicitRhsPipeline ()
 Get the Op Bondary Rhs Pipeline object for implicit-explicit G term.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpSkeletonExplicitRhsPipeline ()
 Get the Op Skeleton Rhs Pipeline object for implicit-explicit G term.
 
MoFEMErrorCode MoFEM::PipelineManager::loopFiniteElements (SmartPetscObj< DM > dm=nullptr)
 Iterate finite elements.
 
SmartPetscObj< KSP > MoFEM::PipelineManager::createKSP (SmartPetscObj< DM > dm=nullptr)
 Create KSP (linear) solver.
 
SmartPetscObj< SNES > MoFEM::PipelineManager::createSNES (SmartPetscObj< DM > dm=nullptr)
 Create SNES (nonlinear) solver.
 
SmartPetscObj< TS > MoFEM::PipelineManager::createTSEX (SmartPetscObj< DM > dm=nullptr)
 Create TS (time) explit solver.
 
SmartPetscObj< TS > MoFEM::PipelineManager::createTSIM (SmartPetscObj< DM > dm=nullptr)
 Create TS (time) implicit solver.
 
SmartPetscObj< TS > MoFEM::PipelineManager::createTSIM2 (SmartPetscObj< DM > dm=nullptr)
 Create TS (time) solver for second order equation in time.
 
SmartPetscObj< TS > MoFEM::PipelineManager::createTSIMEX (SmartPetscObj< DM > dm=nullptr)
 Create TS (time) implicit-explicit solver.
 

Detailed Description

Implementation of basic interface for rapid problem implementation.

Function Documentation

◆ createKSP()

SmartPetscObj< KSP > MoFEM::PipelineManager::createKSP ( SmartPetscObj< DM > dm = nullptr)

Create KSP (linear) solver.

Parameters
dm
Returns
SmartPetscObj<KSP>
Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, helmholtz.cpp, higher_derivatives.cpp, mixed_poisson.cpp, phase.cpp, poisson_2d_dis_galerkin.cpp, and poisson_2d_homogeneous.cpp.

Definition at line 99 of file PipelineManager.cpp.

99 {
100 Interface &m_field = cOre;
101 Simple *simple = m_field.getInterface<Simple>();
102
103 auto copy_dm_struture = [&](auto simple_dm) {
104 MPI_Comm comm;
105 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
106 DMType type;
107 CHKERR DMGetType(simple_dm, &type);
108 dm = createDM(comm, type);
109 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
110 return dm;
111 };
112
113 if (!dm)
114 dm = copy_dm_struture(simple->getDM());
115
116 const MoFEM::Problem *prb_ptr;
117 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
118
119 auto set_dm_section = [&](auto dm) {
121 auto section =
122 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
123 CHKERR DMSetSection(dm, section);
125 };
126 CHKERR set_dm_section(dm);
127
128 boost::shared_ptr<FEMethod> null;
129
130 getDMKspCtx(dm)->clearLoops();
131
132 // Add element to calculate lhs of stiff part
133 if (feDomainLhs)
134 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getDomainFEName(),
135 feDomainLhs, null, null);
136 if (feBoundaryLhs)
137 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getBoundaryFEName(),
138 feBoundaryLhs, null, null);
139 if (feSkeletonLhs)
140 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getSkeletonFEName(),
141 feSkeletonLhs, null, null);
142 if (feMeshsetLhs)
143 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getMeshsetFEName(),
144 feMeshsetLhs, null, null);
145
146 // Add element to calculate rhs of stiff part
147 if (feDomainRhs)
148 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getDomainFEName(), feDomainRhs,
149 null, null);
150 if (feBoundaryRhs)
151 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getBoundaryFEName(),
152 feBoundaryRhs, null, null);
153 if (feSkeletonRhs)
154 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getSkeletonFEName(),
155 feSkeletonRhs, null, null);
156 if (feMeshsetRhs)
157 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getMeshsetFEName(), feMeshsetRhs,
158 null, null);
159
160 auto ksp = MoFEM::createKSP(m_field.get_comm());
161 CHKERR KSPSetDM(ksp, dm);
162 return ksp;
163}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
Definition DMMoFEM.cpp:426
PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
Set compute operator for KSP solver via sub-matrix and IS.
Definition DMMoFEM.cpp:637
PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
Set KSP operators and push mofem finite element methods.
Definition DMMoFEM.cpp:678
auto createKSP(MPI_Comm comm)
auto getDMKspCtx(DM dm)
Get KSP context data structure used by DM.
Definition DMMoFEM.hpp:1113
DeprecatedCoreInterface Interface
PetscObject getPetscObject(T obj)
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
PetscErrorCode DMMoFEMDuplicateDMCtx(DM dm, DM dm_duplicate)
Duplicate internal data struture.
Definition DMMoFEM.cpp:180
boost::shared_ptr< FEMethod > feBoundaryRhs
Element to assemble RHS side by integrating boundary.
boost::shared_ptr< FEMethod > feMeshsetLhs
boost::shared_ptr< FEMethod > feBoundaryLhs
Element to assemble LHS side by integrating boundary.
boost::shared_ptr< FEMethod > feSkeletonLhs
Element to assemble LHS side by integrating skeleton.
boost::shared_ptr< FEMethod > feDomainLhs
Element to assemble LHS side by integrating domain.
boost::shared_ptr< FEMethod > feSkeletonRhs
Element to assemble RHS side by integrating skeleton.
boost::shared_ptr< FEMethod > feMeshsetRhs
boost::shared_ptr< FEMethod > feDomainRhs
Element to assemble RHS side by integrating domain.
keeps basic data about problem

◆ createSNES()

SmartPetscObj< SNES > MoFEM::PipelineManager::createSNES ( SmartPetscObj< DM > dm = nullptr)

Create SNES (nonlinear) solver.

Parameters
dm
Returns
SmartPetscObj<SNES>

Definition at line 165 of file PipelineManager.cpp.

165 {
166 Interface &m_field = cOre;
167 Simple *simple = m_field.getInterface<Simple>();
168
169 auto copy_dm_struture = [&](auto simple_dm) {
170 MPI_Comm comm;
171 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
172 DMType type;
173 CHKERR DMGetType(simple_dm, &type);
174 dm = createDM(comm, type);
175 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
176 return dm;
177 };
178
179 if (!dm)
180 dm = copy_dm_struture(simple->getDM());
181
182 const MoFEM::Problem *prb_ptr;
183 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
184
185 auto set_dm_section = [&](auto dm) {
187 auto section =
188 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
189 CHKERR DMSetSection(dm, section);
191 };
192 CHKERR set_dm_section(dm);
193
194 getDMSnesCtx(dm)->clearLoops();
195
196 boost::shared_ptr<FEMethod> null;
197
198 // Add element to calculate lhs of stiff part
199 if (feDomainLhs)
200 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getDomainFEName(), feDomainLhs,
201 null, null);
202 if (feBoundaryLhs)
203 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getBoundaryFEName(),
204 feBoundaryLhs, null, null);
205 if (feSkeletonLhs)
206 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getSkeletonFEName(),
207 feSkeletonLhs, null, null);
208 if (feMeshsetLhs)
209 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
210 null, null);
211
212 // Add element to calculate rhs of stiff part
213 if (feDomainRhs)
214 CHKERR DMMoFEMSNESSetFunction(dm, simple->getDomainFEName(), feDomainRhs,
215 null, null);
216 if (feBoundaryRhs)
217 CHKERR DMMoFEMSNESSetFunction(dm, simple->getBoundaryFEName(),
218 feBoundaryRhs, null, null);
219 if (feSkeletonRhs)
220 CHKERR DMMoFEMSNESSetFunction(dm, simple->getSkeletonFEName(),
221 feSkeletonRhs, null, null);
222 if (feMeshsetRhs)
223 CHKERR DMMoFEMSNESSetFunction(dm, simple->getMeshsetFEName(), feMeshsetRhs,
224 null, null);
225
226 auto snes = MoFEM::createSNES(m_field.get_comm());
227 CHKERR SNESSetDM(snes, dm);
228 return snes;
229}
PetscErrorCode DMMoFEMSNESSetFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES residual evaluation function
Definition DMMoFEM.cpp:718
PetscErrorCode DMMoFEMSNESSetJacobian(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set SNES Jacobian evaluation function
Definition DMMoFEM.cpp:759
auto createSNES(MPI_Comm comm)
auto getDMSnesCtx(DM dm)
Get SNES context data structure used by DM.
Definition DMMoFEM.hpp:1127

◆ createTSEX()

SmartPetscObj< TS > MoFEM::PipelineManager::createTSEX ( SmartPetscObj< DM > dm = nullptr)

Create TS (time) explit solver.

Parameters
dm
Returns
SmartPetscObj<TS>

Definition at line 254 of file PipelineManager.cpp.

254 {
255 Interface &m_field = cOre;
256 Simple *simple = m_field.getInterface<Simple>();
257
258 auto copy_dm_struture = [&](auto simple_dm) {
259 MPI_Comm comm;
260 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
261 DMType type;
262 CHKERR DMGetType(simple_dm, &type);
263 dm = createDM(comm, type);
264 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
265 return dm;
266 };
267
268 if (!dm)
269 dm = copy_dm_struture(simple->getDM());
270
271 const MoFEM::Problem *prb_ptr;
272 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
273
274 auto set_dm_section = [&](auto dm) {
276 auto section =
277 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
278 CHKERR DMSetSection(dm, section);
280 };
281 CHKERR set_dm_section(dm);
282
283 boost::shared_ptr<FEMethod> null;
284
285 getDMTsCtx(dm)->clearLoops();
286
287 // Add element to calculate rhs of slow part
289 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getDomainFEName(),
290 feDomainExplicitRhs, null, null);
292 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getBoundaryFEName(),
293 feBoundaryExplicitRhs, null, null);
295 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getSkeletonFEName(),
296 feSkeletonExplicitRhs, null, null);
297 if (feMeshsetRhs)
298 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getMeshsetFEName(),
299 feMeshsetExplicitRhs, null, null);
300
301 // Note: More cases for explict, and implicit time interation cases can be
302 // implemented here.
303
304 auto ts = MoFEM::createTS(m_field.get_comm());
305 CHKERR TSSetDM(ts, dm);
306 return ts;
307}
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
Definition DMMoFEM.hpp:1141
PetscErrorCode DMMoFEMTSSetRHSFunction(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS the right hand side function
Definition DMMoFEM.cpp:882
auto createTS(MPI_Comm comm)
boost::shared_ptr< FEMethod > feDomainExplicitRhs
Element to assemble explict Rhs for IMEX solver.
boost::shared_ptr< FEMethod > feSkeletonExplicitRhs
boost::shared_ptr< FEMethod > feMeshsetExplicitRhs
boost::shared_ptr< FEMethod > feBoundaryExplicitRhs

◆ createTSIM()

SmartPetscObj< TS > MoFEM::PipelineManager::createTSIM ( SmartPetscObj< DM > dm = nullptr)

Create TS (time) implicit solver.

Parameters
dm
Returns
SmartPetscObj<TS>

Definition at line 309 of file PipelineManager.cpp.

309 {
310 Interface &m_field = cOre;
311 Simple *simple = m_field.getInterface<Simple>();
312
313 auto copy_dm_struture = [&](auto simple_dm) {
314 MPI_Comm comm;
315 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
316 DMType type;
317 CHKERR DMGetType(simple_dm, &type);
318 dm = createDM(comm, type);
319 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
320 return dm;
321 };
322
323 if (!dm)
324 dm = copy_dm_struture(simple->getDM());
325
326 const MoFEM::Problem *prb_ptr;
327 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
328
329 auto set_dm_section = [&](auto dm) {
331 auto section =
332 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
333 CHKERR DMSetSection(dm, section);
335 };
336 CHKERR set_dm_section(dm);
337
338 boost::shared_ptr<FEMethod> null;
339
340 // Add element to calculate lhs of stiff part
341 if (feDomainLhs)
342 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getDomainFEName(), feDomainLhs,
343 null, null);
344 if (feBoundaryLhs)
345 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getBoundaryFEName(), feBoundaryLhs,
346 null, null);
347 if (feSkeletonLhs)
348 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getSkeletonFEName(), feSkeletonLhs,
349 null, null);
350 if (feMeshsetLhs)
351 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
352 null, null);
353
354 // Add element to calculate rhs of stiff part
355 if (feDomainRhs)
356 CHKERR DMMoFEMTSSetIFunction(dm, simple->getDomainFEName(), feDomainRhs,
357 null, null);
358 if (feBoundaryRhs)
359 CHKERR DMMoFEMTSSetIFunction(dm, simple->getBoundaryFEName(), feBoundaryRhs,
360 null, null);
361 if (feSkeletonRhs)
362 CHKERR DMMoFEMTSSetIFunction(dm, simple->getSkeletonFEName(), feSkeletonRhs,
363 null, null);
364 if (feMeshsetRhs)
365 CHKERR DMMoFEMTSSetIFunction(dm, simple->getMeshsetFEName(), feMeshsetRhs,
366 null, null);
367
368 // Note: More cases for explict, and implicit time interation cases can be
369 // implemented here.
370
371 auto ts = MoFEM::createTS(m_field.get_comm());
372 CHKERR TSSetDM(ts, dm);
373 return ts;
374}
PetscErrorCode DMMoFEMTSSetIFunction(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set TS implicit function evaluation function
Definition DMMoFEM.cpp:800
PetscErrorCode DMMoFEMTSSetIJacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
Definition DMMoFEM.cpp:853

◆ createTSIM2()

SmartPetscObj< TS > MoFEM::PipelineManager::createTSIM2 ( SmartPetscObj< DM > dm = nullptr)

Create TS (time) solver for second order equation in time.

Parameters
dm
Returns
SmartPetscObj<TS>

Definition at line 376 of file PipelineManager.cpp.

376 {
377 Interface &m_field = cOre;
378 Simple *simple = m_field.getInterface<Simple>();
379
380 auto copy_dm_struture = [&](auto simple_dm) {
381 MPI_Comm comm;
382 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
383 DMType type;
384 CHKERR DMGetType(simple_dm, &type);
385 dm = createDM(comm, type);
386 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
387 return dm;
388 };
389
390 if (!dm)
391 dm = copy_dm_struture(simple->getDM());
392
393 const MoFEM::Problem *prb_ptr;
394 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
395
396 auto set_dm_section = [&](auto dm) {
398 auto section =
399 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
400 CHKERR DMSetSection(dm, section);
402 };
403 CHKERR set_dm_section(dm);
404
405 boost::shared_ptr<FEMethod> null;
406
407 // Add element to calculate lhs of stiff part
408 if (feDomainLhs)
409 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getDomainFEName(), feDomainLhs,
410 null, null);
411 if (feBoundaryLhs)
412 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getBoundaryFEName(),
413 feBoundaryLhs, null, null);
414 if (feSkeletonLhs)
415 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getSkeletonFEName(),
416 feSkeletonLhs, null, null);
417 if (feMeshsetLhs)
418 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
419 null, null);
420
421 // Add element to calculate rhs of stiff part
422 if (feDomainRhs)
423 CHKERR DMMoFEMTSSetI2Function(dm, simple->getDomainFEName(), feDomainRhs,
424 null, null);
425 if (feBoundaryRhs)
426 CHKERR DMMoFEMTSSetI2Function(dm, simple->getBoundaryFEName(),
427 feBoundaryRhs, null, null);
428 if (feSkeletonRhs)
429 CHKERR DMMoFEMTSSetI2Function(dm, simple->getSkeletonFEName(),
430 feSkeletonRhs, null, null);
431 if (feMeshsetRhs)
432 CHKERR DMMoFEMTSSetI2Function(dm, simple->getMeshsetFEName(), feMeshsetRhs,
433 null, null);
434
435 // Note: More cases for explict, and implicit time interation cases can be
436 // implemented here.
437
438 auto ts = MoFEM::createTS(m_field.get_comm());
439 CHKERR TSSetDM(ts, dm);
440 return ts;
441}
PetscErrorCode DMMoFEMTSSetI2Jacobian(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS Jacobian evaluation function
Definition DMMoFEM.cpp:1017
PetscErrorCode DMMoFEMTSSetI2Function(DM dm, const std::string fe_name, boost::shared_ptr< MoFEM::FEMethod > method, boost::shared_ptr< MoFEM::BasicMethod > pre_only, boost::shared_ptr< MoFEM::BasicMethod > post_only)
set TS implicit function evaluation function
Definition DMMoFEM.cpp:975

◆ createTSIMEX()

SmartPetscObj< TS > MoFEM::PipelineManager::createTSIMEX ( SmartPetscObj< DM > dm = nullptr)

Create TS (time) implicit-explicit solver.

Parameters
dm
Returns
SmartPetscObj<TS>

Definition at line 443 of file PipelineManager.cpp.

443 {
444 Interface &m_field = cOre;
445 Simple *simple = m_field.getInterface<Simple>();
446
447 auto copy_dm_struture = [&](auto simple_dm) {
448 MPI_Comm comm;
449 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
450 DMType type;
451 CHKERR DMGetType(simple_dm, &type);
452 dm = createDM(comm, type);
453 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
454 return dm;
455 };
456
457 if (!dm)
458 dm = copy_dm_struture(simple->getDM());
459
460 const MoFEM::Problem *prb_ptr;
461 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
462
463 auto set_dm_section = [&](auto dm) {
465 auto section =
466 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
467 CHKERR DMSetSection(dm, section);
469 };
470 CHKERR set_dm_section(dm);
471
472 boost::shared_ptr<FEMethod> null;
473
474 // Add element to calculate lhs of stiff part
475 if (feDomainLhs)
476 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getDomainFEName(), feDomainLhs,
477 null, null);
478 if (feBoundaryLhs)
479 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getBoundaryFEName(), feBoundaryLhs,
480 null, null);
481 if (feSkeletonLhs)
482 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getSkeletonFEName(), feSkeletonLhs,
483 null, null);
484 if (feMeshsetLhs)
485 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
486 null, null);
487
488 // Add element to calculate rhs of stiff part
489 if (feDomainRhs)
490 CHKERR DMMoFEMTSSetIFunction(dm, simple->getDomainFEName(), feDomainRhs,
491 null, null);
492 if (feBoundaryRhs)
493 CHKERR DMMoFEMTSSetIFunction(dm, simple->getBoundaryFEName(), feBoundaryRhs,
494 null, null);
495 if (feSkeletonRhs)
496 CHKERR DMMoFEMTSSetIFunction(dm, simple->getSkeletonFEName(), feSkeletonRhs,
497 null, null);
498 if (feMeshsetRhs)
499 CHKERR DMMoFEMTSSetIFunction(dm, simple->getMeshsetFEName(), feMeshsetRhs,
500 null, null);
501
502 // Add element to calculate rhs of stiff part
504 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getDomainFEName(),
505 feDomainExplicitRhs, null, null);
507 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getBoundaryFEName(),
508 feBoundaryExplicitRhs, null, null);
510 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getSkeletonFEName(),
511 feSkeletonExplicitRhs, null, null);
513 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getMeshsetFEName(),
514 feMeshsetExplicitRhs, null, null);
515
516 // Note: More cases for explict, and implicit time interation cases can be
517 // implemented here.
518
519 auto ts = MoFEM::createTS(m_field.get_comm());
520 CHKERR TSSetDM(ts, dm);
521 return ts;
522}

◆ getOpBoundaryExplicitRhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpBoundaryExplicitRhsPipeline ( )
inline

Get the Op Bondary Rhs Pipeline object for implicit-explicit G term.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&

Definition at line 992 of file PipelineManager.hpp.

992 {
993 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
995 ->getOpPtrVector();
996}
boost::shared_ptr< FEMethod > & createBoundaryFEPipeline(boost::shared_ptr< FEMethod > &fe)

◆ getOpBoundaryLhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpBoundaryLhsPipeline ( )
inline

Get the Op Boundary Lhs Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
helmholtz.cpp.

Definition at line 872 of file PipelineManager.hpp.

872 {
873 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
875 ->getOpPtrVector();
876}

◆ getOpBoundaryRhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpBoundaryRhsPipeline ( )
inline

Get the Op Boundary Rhs Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
child_and_parent.cpp, hanging_node_approx.cpp, helmholtz.cpp, and simple_l2_only.cpp.

Definition at line 896 of file PipelineManager.hpp.

896 {
897 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
899 ->getOpPtrVector();
900}

◆ getOpDomainExplicitRhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpDomainExplicitRhsPipeline ( )
inline

Get the Op Domain Rhs Pipeline object for implicit-explicit G term.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&

Definition at line 968 of file PipelineManager.hpp.

968 {
969 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
971 ->getOpPtrVector();
972}
boost::shared_ptr< FEMethod > & createDomainFEPipeline(boost::shared_ptr< FEMethod > &fe)

◆ getOpDomainLhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpDomainLhsPipeline ( )
inline

Get the Op Domain Lhs Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
approx_sphere.cpp, child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, heat_method.cpp, helmholtz.cpp, higher_derivatives.cpp, level_set.cpp, and mixed_poisson.cpp.

Definition at line 824 of file PipelineManager.hpp.

824 {
825 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
827 ->getOpPtrVector();
828}

◆ getOpDomainRhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpDomainRhsPipeline ( )
inline

Get the Op Domain Rhs Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
approx_sphere.cpp, child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, heat_method.cpp, hello_world.cpp, higher_derivatives.cpp, and mixed_poisson.cpp.

Definition at line 848 of file PipelineManager.hpp.

848 {
849 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
851 ->getOpPtrVector();
852}

◆ getOpSkeletonExplicitRhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpSkeletonExplicitRhsPipeline ( )
inline

Get the Op Skeleton Rhs Pipeline object for implicit-explicit G term.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&

Definition at line 1016 of file PipelineManager.hpp.

1016 {
1017 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1019 ->getOpPtrVector();
1020}

◆ getOpSkeletonLhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpSkeletonLhsPipeline ( )
inline

Get the Op Skeleton Lhs Pipeline object.

Returns
boost::ptr_deque<UserDataOperator>&
Examples
level_set.cpp.

Definition at line 920 of file PipelineManager.hpp.

920 {
921 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
923 ->getOpPtrVector();
924}

◆ getOpSkeletonRhsPipeline()

template<int DIM>
boost::ptr_deque< PipelineManager::UserDataOperator > & MoFEM::PipelineManager::getOpSkeletonRhsPipeline ( )
inline

Get the Op Skeleton Rhs Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
simple_l2_only.cpp.

Definition at line 944 of file PipelineManager.hpp.

944 {
945 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
947 ->getOpPtrVector();
948}

◆ loopFiniteElements()

MoFEMErrorCode MoFEM::PipelineManager::loopFiniteElements ( SmartPetscObj< DM > dm = nullptr)

Iterate finite elements.

Returns
MoFEMErrorCode
Examples
child_and_parent.cpp, hanging_node_approx.cpp, heat_method.cpp, helmholtz.cpp, higher_derivatives.cpp, mixed_poisson.cpp, phase.cpp, plot_base.cpp, and simple_l2_only.cpp.

Definition at line 63 of file PipelineManager.cpp.

63 {
65 Interface &m_field = cOre;
66 Simple *simple = m_field.getInterface<Simple>();
67 if (!dm)
68 dm = simple->getDM();
69
70 // Add element to calculate lhs of stiff part
71 if (feDomainLhs)
72 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(), feDomainLhs);
73 if (feBoundaryLhs)
74 CHKERR DMoFEMLoopFiniteElements(dm, simple->getBoundaryFEName(),
76 if (feSkeletonLhs)
77 CHKERR DMoFEMLoopFiniteElements(dm, simple->getSkeletonFEName(),
79 if (feMeshsetLhs)
80 CHKERR DMoFEMLoopFiniteElements(dm, simple->getMeshsetFEName(),
82
83 // Add element to calculate rhs of stiff part
84 if (feDomainRhs)
85 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(), feDomainRhs);
86 if (feBoundaryRhs)
87 CHKERR DMoFEMLoopFiniteElements(dm, simple->getBoundaryFEName(),
89 if (feSkeletonRhs)
90 CHKERR DMoFEMLoopFiniteElements(dm, simple->getSkeletonFEName(),
92 if (feMeshsetRhs)
93 CHKERR DMoFEMLoopFiniteElements(dm, simple->getMeshsetFEName(),
95
97}
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
Definition DMMoFEM.cpp:586