v0.16.0
Loading...
Searching...
No Matches
Files | Classes | Functions
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::getOpDomainPostProcPipeline ()
 Get the Op Domain PostProc Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpBoundaryPostProcPipeline ()
 Get the Op Boundary PostProc Pipeline object.
 
template<int DIM = -1>
boost::ptr_deque< UserDataOperator > & MoFEM::PipelineManager::getOpEvaluationPipeline ()
 Get the Op Domain Evaluation 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 Boundary 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.
 
MoFEMErrorCode MoFEM::PipelineManager::loopFiniteElementsPostProc (SmartPetscObj< DM > dm=nullptr)
 Iterate postprocessing finite elements.
 
MoFEMErrorCode MoFEM::PipelineManager::loopDomainPostProc (SmartPetscObj< DM > dm=nullptr)
 Iterate domain postprocessing finite elements only.
 
MoFEMErrorCode MoFEM::PipelineManager::loopBoundaryPostProc (SmartPetscObj< DM > dm=nullptr)
 Iterate boundary postprocessing finite elements only.
 
MoFEMErrorCode MoFEM::PipelineManager::loopFiniteElementsEvaluation (SmartPetscObj< DM > dm=nullptr)
 Iterate evaluation 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) explicit 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)

#include <src/interfaces/PipelineManager.hpp>

Create KSP (linear) solver.

Parameters
dmOptional DM object (default: nullptr)
Returns
SmartPetscObj<KSP> Smart pointer to PETSc KSP linear solver
Examples
mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/dg_projection.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/higher_derivatives.cpp, mofem/tutorials/adv-6_dg_projection/between_meshes_dg_projection.cpp, mofem/tutorials/clx-0_acoustics/helmholtz.cpp, mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, mofem/tutorials/mix-1_light_intensity_equation/phase.cpp, mofem/tutorials/scl-0_least_squares/approximation.cpp, and mofem/tutorials/scl-1_poisson_2d_homogeneous/poisson_2d_homogeneous.cpp.

Definition at line 187 of file PipelineManager.cpp.

187 {
188 Interface &m_field = cOre;
189 Simple *simple = m_field.getInterface<Simple>();
190
191 auto copy_dm_struture = [&](auto simple_dm) {
192 MPI_Comm comm;
193 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
194 DMType type;
195 CHKERR DMGetType(simple_dm, &type);
196 dm = createDM(comm, type);
197 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
198 return dm;
199 };
200
201 if (!dm)
202 dm = copy_dm_struture(simple->getDM());
203
204 const MoFEM::Problem *prb_ptr;
205 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
206
207 auto set_dm_section = [&](auto dm) {
209 auto section =
210 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
211 CHKERR DMSetSection(dm, section);
213 };
214 CHKERR set_dm_section(dm);
215
216 boost::shared_ptr<FEMethod> null;
217
218 getDMKspCtx(dm)->clearLoops();
219
220 // Add element to calculate lhs of stiff part
221 if (feDomainLhs)
222 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getDomainFEName(),
223 feDomainLhs, null, null);
224 if (feBoundaryLhs)
225 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getBoundaryFEName(),
226 feBoundaryLhs, null, null);
227 if (feSkeletonLhs)
228 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getSkeletonFEName(),
229 feSkeletonLhs, null, null);
230 if (feMeshsetLhs)
231 CHKERR DMMoFEMKSPSetComputeOperators(dm, simple->getMeshsetFEName(),
232 feMeshsetLhs, null, null);
233
234 // Add element to calculate rhs of stiff part
235 if (feDomainRhs)
236 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getDomainFEName(), feDomainRhs,
237 null, null);
238 if (feBoundaryRhs)
239 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getBoundaryFEName(),
240 feBoundaryRhs, null, null);
241 if (feSkeletonRhs)
242 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getSkeletonFEName(),
243 feSkeletonRhs, null, null);
244 if (feMeshsetRhs)
245 CHKERR DMMoFEMKSPSetComputeRHS(dm, simple->getMeshsetFEName(), feMeshsetRhs,
246 null, null);
247
248 auto ksp = MoFEM::createKSP(m_field.get_comm());
249 CHKERR KSPSetDM(ksp, dm);
250 return ksp;
251}
std::string type
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:422
PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set KSP right hand side evaluation function
Definition DMMoFEM.cpp:627
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:668
auto createKSP(MPI_Comm comm)
auto getDMKspCtx(DM dm)
Get KSP context data structure used by DM.
Definition DMMoFEM.hpp:1251
PetscObject getPetscObject(T obj)
DeprecatedCoreInterface Interface
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 structure.
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.
MoFEM::Core & cOre
Reference to MoFEM core instance.
keeps basic data about problem
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ createSNES()

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

#include <src/interfaces/PipelineManager.hpp>

Create SNES (nonlinear) solver.

Parameters
dmOptional DM object (default: nullptr)
Returns
SmartPetscObj<SNES> Smart pointer to PETSc SNES nonlinear solver

Definition at line 253 of file PipelineManager.cpp.

253 {
254 Interface &m_field = cOre;
255 Simple *simple = m_field.getInterface<Simple>();
256
257 auto copy_dm_struture = [&](auto simple_dm) {
258 MPI_Comm comm;
259 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
260 DMType type;
261 CHKERR DMGetType(simple_dm, &type);
262 dm = createDM(comm, type);
263 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
264 return dm;
265 };
266
267 if (!dm)
268 dm = copy_dm_struture(simple->getDM());
269
270 const MoFEM::Problem *prb_ptr;
271 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
272
273 auto set_dm_section = [&](auto dm) {
275 auto section =
276 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
277 CHKERR DMSetSection(dm, section);
279 };
280 CHKERR set_dm_section(dm);
281
282 getDMSnesCtx(dm)->clearLoops();
283
284 boost::shared_ptr<FEMethod> null;
285
286 // Add element to calculate lhs of stiff part
287 if (feDomainLhs)
288 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getDomainFEName(), feDomainLhs,
289 null, null);
290 if (feBoundaryLhs)
291 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getBoundaryFEName(),
292 feBoundaryLhs, null, null);
293 if (feSkeletonLhs)
294 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getSkeletonFEName(),
295 feSkeletonLhs, null, null);
296 if (feMeshsetLhs)
297 CHKERR DMMoFEMSNESSetJacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
298 null, null);
299
300 // Add element to calculate rhs of stiff part
301 if (feDomainRhs)
302 CHKERR DMMoFEMSNESSetFunction(dm, simple->getDomainFEName(), feDomainRhs,
303 null, null);
304 if (feBoundaryRhs)
305 CHKERR DMMoFEMSNESSetFunction(dm, simple->getBoundaryFEName(),
306 feBoundaryRhs, null, null);
307 if (feSkeletonRhs)
308 CHKERR DMMoFEMSNESSetFunction(dm, simple->getSkeletonFEName(),
309 feSkeletonRhs, null, null);
310 if (feMeshsetRhs)
311 CHKERR DMMoFEMSNESSetFunction(dm, simple->getMeshsetFEName(), feMeshsetRhs,
312 null, null);
313
314 auto snes = MoFEM::createSNES(m_field.get_comm());
315 CHKERR SNESSetDM(snes, dm);
316 return snes;
317}
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:708
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:749
auto createSNES(MPI_Comm comm)
auto getDMSnesCtx(DM dm)
Get SNES context data structure used by DM.
Definition DMMoFEM.hpp:1265

◆ createTSEX()

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

#include <src/interfaces/PipelineManager.hpp>

Create TS (time) explicit solver.

Parameters
dmOptional DM object (default: nullptr)
Returns
SmartPetscObj<TS> Smart pointer to PETSc TS explicit time solver

Definition at line 342 of file PipelineManager.cpp.

342 {
343 Interface &m_field = cOre;
344 Simple *simple = m_field.getInterface<Simple>();
345
346 auto copy_dm_struture = [&](auto simple_dm) {
347 MPI_Comm comm;
348 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
349 DMType type;
350 CHKERR DMGetType(simple_dm, &type);
351 dm = createDM(comm, type);
352 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
353 return dm;
354 };
355
356 if (!dm)
357 dm = copy_dm_struture(simple->getDM());
358
359 const MoFEM::Problem *prb_ptr;
360 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
361
362 auto set_dm_section = [&](auto dm) {
364 auto section =
365 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
366 CHKERR DMSetSection(dm, section);
368 };
369 CHKERR set_dm_section(dm);
370
371 boost::shared_ptr<FEMethod> null;
372
373 getDMTsCtx(dm)->clearLoops();
374
375 // Add element to calculate rhs of slow part
377 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getDomainFEName(),
378 feDomainExplicitRhs, null, null);
380 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getBoundaryFEName(),
381 feBoundaryExplicitRhs, null, null);
383 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getSkeletonFEName(),
384 feSkeletonExplicitRhs, null, null);
385 if (feMeshsetRhs)
386 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getMeshsetFEName(),
387 feMeshsetExplicitRhs, null, null);
388
389 // Note: More cases for explict, and implicit time interation cases can be
390 // implemented here.
391
392 auto ts = MoFEM::createTS(m_field.get_comm());
393 CHKERR TSSetDM(ts, dm);
394 return ts;
395}
auto getDMTsCtx(DM dm)
Get TS context data structure used by DM.
Definition DMMoFEM.hpp:1279
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:872
auto createTS(MPI_Comm comm)
boost::shared_ptr< FEMethod > feDomainExplicitRhs
Element to assemble explicit 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)

#include <src/interfaces/PipelineManager.hpp>

Create TS (time) implicit solver.

Parameters
dmOptional DM object (default: nullptr)
Returns
SmartPetscObj<TS> Smart pointer to PETSc TS implicit time solver
Examples
mofem/tutorials/adv-5_poroelasticity/seepage.cpp, and mofem/tutorials/scl-8_heat_radiation/radiation.cpp.

Definition at line 397 of file PipelineManager.cpp.

397 {
398 Interface &m_field = cOre;
399 Simple *simple = m_field.getInterface<Simple>();
400
401 auto copy_dm_struture = [&](auto simple_dm) {
402 MPI_Comm comm;
403 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
404 DMType type;
405 CHKERR DMGetType(simple_dm, &type);
406 dm = createDM(comm, type);
407 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
408 return dm;
409 };
410
411 if (!dm)
412 dm = copy_dm_struture(simple->getDM());
413
414 const MoFEM::Problem *prb_ptr;
415 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
416
417 auto set_dm_section = [&](auto dm) {
419 auto section =
420 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
421 CHKERR DMSetSection(dm, section);
423 };
424 CHKERR set_dm_section(dm);
425
426 boost::shared_ptr<FEMethod> null;
427
428 // Add element to calculate lhs of stiff part
429 if (feDomainLhs)
430 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getDomainFEName(), feDomainLhs,
431 null, null);
432 if (feBoundaryLhs)
433 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getBoundaryFEName(), feBoundaryLhs,
434 null, null);
435 if (feSkeletonLhs)
436 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getSkeletonFEName(), feSkeletonLhs,
437 null, null);
438 if (feMeshsetLhs)
439 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
440 null, null);
441
442 // Add element to calculate rhs of stiff part
443 if (feDomainRhs)
444 CHKERR DMMoFEMTSSetIFunction(dm, simple->getDomainFEName(), feDomainRhs,
445 null, null);
446 if (feBoundaryRhs)
447 CHKERR DMMoFEMTSSetIFunction(dm, simple->getBoundaryFEName(), feBoundaryRhs,
448 null, null);
449 if (feSkeletonRhs)
450 CHKERR DMMoFEMTSSetIFunction(dm, simple->getSkeletonFEName(), feSkeletonRhs,
451 null, null);
452 if (feMeshsetRhs)
453 CHKERR DMMoFEMTSSetIFunction(dm, simple->getMeshsetFEName(), feMeshsetRhs,
454 null, null);
455
456 // Note: More cases for explict, and implicit time interation cases can be
457 // implemented here.
458
459 auto ts = MoFEM::createTS(m_field.get_comm());
460 CHKERR TSSetDM(ts, dm);
461 return ts;
462}
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:790
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:843

◆ createTSIM2()

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

#include <src/interfaces/PipelineManager.hpp>

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

Parameters
dmOptional DM object (default: nullptr)
Returns
SmartPetscObj<TS> Smart pointer to PETSc TS second-order time solver

Definition at line 464 of file PipelineManager.cpp.

464 {
465 Interface &m_field = cOre;
466 Simple *simple = m_field.getInterface<Simple>();
467
468 auto copy_dm_struture = [&](auto simple_dm) {
469 MPI_Comm comm;
470 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
471 DMType type;
472 CHKERR DMGetType(simple_dm, &type);
473 dm = createDM(comm, type);
474 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
475 return dm;
476 };
477
478 if (!dm)
479 dm = copy_dm_struture(simple->getDM());
480
481 const MoFEM::Problem *prb_ptr;
482 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
483
484 auto set_dm_section = [&](auto dm) {
486 auto section =
487 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
488 CHKERR DMSetSection(dm, section);
490 };
491 CHKERR set_dm_section(dm);
492
493 boost::shared_ptr<FEMethod> null;
494
495 // Add element to calculate lhs of stiff part
496 if (feDomainLhs)
497 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getDomainFEName(), feDomainLhs,
498 null, null);
499 if (feBoundaryLhs)
500 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getBoundaryFEName(),
501 feBoundaryLhs, null, null);
502 if (feSkeletonLhs)
503 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getSkeletonFEName(),
504 feSkeletonLhs, null, null);
505 if (feMeshsetLhs)
506 CHKERR DMMoFEMTSSetI2Jacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
507 null, null);
508
509 // Add element to calculate rhs of stiff part
510 if (feDomainRhs)
511 CHKERR DMMoFEMTSSetI2Function(dm, simple->getDomainFEName(), feDomainRhs,
512 null, null);
513 if (feBoundaryRhs)
514 CHKERR DMMoFEMTSSetI2Function(dm, simple->getBoundaryFEName(),
515 feBoundaryRhs, null, null);
516 if (feSkeletonRhs)
517 CHKERR DMMoFEMTSSetI2Function(dm, simple->getSkeletonFEName(),
518 feSkeletonRhs, null, null);
519 if (feMeshsetRhs)
520 CHKERR DMMoFEMTSSetI2Function(dm, simple->getMeshsetFEName(), feMeshsetRhs,
521 null, null);
522
523 // Note: More cases for explict, and implicit time interation cases can be
524 // implemented here.
525
526 auto ts = MoFEM::createTS(m_field.get_comm());
527 CHKERR TSSetDM(ts, dm);
528 return ts;
529}
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:1007
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:965

◆ createTSIMEX()

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

#include <src/interfaces/PipelineManager.hpp>

Create TS (time) implicit-explicit solver.

Parameters
dmOptional DM object (default: nullptr)
Returns
SmartPetscObj<TS> Smart pointer to PETSc TS implicit-explicit time solver

Definition at line 531 of file PipelineManager.cpp.

531 {
532 Interface &m_field = cOre;
533 Simple *simple = m_field.getInterface<Simple>();
534
535 auto copy_dm_struture = [&](auto simple_dm) {
536 MPI_Comm comm;
537 CHKERR PetscObjectGetComm(getPetscObject(simple_dm.get()), &comm);
538 DMType type;
539 CHKERR DMGetType(simple_dm, &type);
540 dm = createDM(comm, type);
541 CHKERR DMMoFEMDuplicateDMCtx(simple_dm, dm);
542 return dm;
543 };
544
545 if (!dm)
546 dm = copy_dm_struture(simple->getDM());
547
548 const MoFEM::Problem *prb_ptr;
549 CHKERR DMMoFEMGetProblemPtr(dm, &prb_ptr);
550
551 auto set_dm_section = [&](auto dm) {
553 auto section =
554 m_field.getInterface<ISManager>()->sectionCreate(prb_ptr->getName());
555 CHKERR DMSetSection(dm, section);
557 };
558 CHKERR set_dm_section(dm);
559
560 boost::shared_ptr<FEMethod> null;
561
562 // Add element to calculate lhs of stiff part
563 if (feDomainLhs)
564 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getDomainFEName(), feDomainLhs,
565 null, null);
566 if (feBoundaryLhs)
567 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getBoundaryFEName(), feBoundaryLhs,
568 null, null);
569 if (feSkeletonLhs)
570 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getSkeletonFEName(), feSkeletonLhs,
571 null, null);
572 if (feMeshsetLhs)
573 CHKERR DMMoFEMTSSetIJacobian(dm, simple->getMeshsetFEName(), feMeshsetLhs,
574 null, null);
575
576 // Add element to calculate rhs of stiff part
577 if (feDomainRhs)
578 CHKERR DMMoFEMTSSetIFunction(dm, simple->getDomainFEName(), feDomainRhs,
579 null, null);
580 if (feBoundaryRhs)
581 CHKERR DMMoFEMTSSetIFunction(dm, simple->getBoundaryFEName(), feBoundaryRhs,
582 null, null);
583 if (feSkeletonRhs)
584 CHKERR DMMoFEMTSSetIFunction(dm, simple->getSkeletonFEName(), feSkeletonRhs,
585 null, null);
586 if (feMeshsetRhs)
587 CHKERR DMMoFEMTSSetIFunction(dm, simple->getMeshsetFEName(), feMeshsetRhs,
588 null, null);
589
590 // Add element to calculate rhs of stiff part
592 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getDomainFEName(),
593 feDomainExplicitRhs, null, null);
595 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getBoundaryFEName(),
596 feBoundaryExplicitRhs, null, null);
598 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getSkeletonFEName(),
599 feSkeletonExplicitRhs, null, null);
601 CHKERR DMMoFEMTSSetRHSFunction(dm, simple->getMeshsetFEName(),
602 feMeshsetExplicitRhs, null, null);
603
604 // Note: More cases for explict, and implicit time interation cases can be
605 // implemented here.
606
607 auto ts = MoFEM::createTS(m_field.get_comm());
608 CHKERR TSSetDM(ts, dm);
609 return ts;
610}

◆ getOpBoundaryExplicitRhsPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

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

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

Definition at line 1505 of file PipelineManager.hpp.

1505 {
1506 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1507 createBoundaryFEPipeline<DIM>(feBoundaryExplicitRhs))
1508 ->getOpPtrVector();
1509}

◆ getOpBoundaryLhsPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

Get the Op Boundary Lhs Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
mofem/tutorials/clx-0_acoustics/helmholtz.cpp, and mofem/tutorials/scl-8_heat_radiation/radiation.cpp.

Definition at line 1313 of file PipelineManager.hpp.

1313 {
1314 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1315 createBoundaryFEPipeline<DIM>(feBoundaryLhs))
1316 ->getOpPtrVector();
1317}

◆ getOpBoundaryPostProcPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

Get the Op Boundary PostProc Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
mofem/tutorials/scl-8_heat_radiation/radiation.cpp.

Definition at line 1385 of file PipelineManager.hpp.

1385 {
1386 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1387 createBoundaryFEPipeline<DIM>(feBoundaryPostProc))
1388 ->getOpPtrVector();
1389}
boost::shared_ptr< FEMethod > feBoundaryPostProc
Element for postprocessing by integrating boundary.

◆ getOpBoundaryRhsPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

Get the Op Boundary Rhs Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/simple_l2_only.cpp, mofem/tutorials/clx-0_acoustics/helmholtz.cpp, and mofem/tutorials/scl-8_heat_radiation/radiation.cpp.

Definition at line 1337 of file PipelineManager.hpp.

1337 {
1338 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1339 createBoundaryFEPipeline<DIM>(feBoundaryRhs))
1340 ->getOpPtrVector();
1341}

◆ getOpDomainExplicitRhsPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

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

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

Definition at line 1481 of file PipelineManager.hpp.

1481 {
1482 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1483 createDomainFEPipeline<DIM>(feDomainExplicitRhs))
1484 ->getOpPtrVector();
1485}

◆ getOpDomainLhsPipeline()

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

◆ getOpDomainPostProcPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

Get the Op Domain PostProc Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, and mofem/tutorials/scl-0_least_squares/approximation.cpp.

Definition at line 1361 of file PipelineManager.hpp.

1361 {
1362 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1363 createDomainFEPipeline<DIM>(feDomainPostProc))
1364 ->getOpPtrVector();
1365}
boost::shared_ptr< FEMethod > feDomainPostProc
Element for postprocessing by integrating domain.

◆ getOpDomainRhsPipeline()

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

◆ getOpEvaluationPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

Get the Op Domain Evaluation Pipeline object.

Template Parameters
-1
Returns
boost::ptr_deque<UserDataOperator>&
Examples
mofem/atom_tests/higher_derivatives.cpp.

Definition at line 1409 of file PipelineManager.hpp.

1409 {
1410 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1411 createDomainFEPipeline<DIM>(feEvaluation))
1412 ->getOpPtrVector();
1413}
boost::shared_ptr< FEMethod > feEvaluation
Element for evaluation by integrating domain.

◆ getOpSkeletonExplicitRhsPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

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

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

Definition at line 1529 of file PipelineManager.hpp.

1529 {
1530 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1531 createBoundaryFEPipeline<DIM>(feSkeletonExplicitRhs))
1532 ->getOpPtrVector();
1533}

◆ getOpSkeletonLhsPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

Get the Op Skeleton Lhs Pipeline object.

Returns
boost::ptr_deque<UserDataOperator>&
Examples
mofem/tutorials/adv-3_level_set/level_set.cpp.

Definition at line 1433 of file PipelineManager.hpp.

1433 {
1434 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1435 createBoundaryFEPipeline<DIM>(feSkeletonLhs))
1436 ->getOpPtrVector();
1437}

◆ getOpSkeletonRhsPipeline()

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

#include <src/interfaces/PipelineManager.hpp>

Get the Op Skeleton Rhs Pipeline object.

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

Definition at line 1457 of file PipelineManager.hpp.

1457 {
1458 return boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
1459 createBoundaryFEPipeline<DIM>(feSkeletonRhs))
1460 ->getOpPtrVector();
1461}

◆ loopBoundaryPostProc()

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

#include <src/interfaces/PipelineManager.hpp>

Iterate boundary postprocessing finite elements only.

Parameters
dmOptional DM object (default: nullptr)
Returns
MoFEMErrorCode Error code (0 on success)

Definition at line 147 of file PipelineManager.cpp.

147 {
149 Interface &m_field = cOre;
150 Simple *simple = m_field.getInterface<Simple>();
151 if (!dm)
152 dm = simple->getDM();
153 if (!feBoundaryPostProc) {
154 MOFEM_LOG("WORLD", Sev::warning)
155 << "PipelineManager::loopBoundaryPostProc called with no active finite "
156 "element pipeline (boundary postprocessing is null)";
157 }
158
160 CHKERR DMoFEMLoopFiniteElements(dm, simple->getBoundaryFEName(),
162
164}
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:576
#define MOFEM_LOG(channel, severity)
Log.

◆ loopDomainPostProc()

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

#include <src/interfaces/PipelineManager.hpp>

Iterate domain postprocessing finite elements only.

Parameters
dmOptional DM object (default: nullptr)
Returns
MoFEMErrorCode Error code (0 on success)

Definition at line 128 of file PipelineManager.cpp.

128 {
130 Interface &m_field = cOre;
131 Simple *simple = m_field.getInterface<Simple>();
132 if (!dm)
133 dm = simple->getDM();
134 if (!feDomainPostProc) {
135 MOFEM_LOG("WORLD", Sev::warning)
136 << "PipelineManager::loopDomainPostProc called with no active finite "
137 "element pipeline (domain postprocessing is null)";
138 }
139
141 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(),
143
145}

◆ loopFiniteElements()

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

#include <src/interfaces/PipelineManager.hpp>

Iterate finite elements.

Parameters
dmOptional DM object (default: nullptr)
Returns
MoFEMErrorCode Error code (0 on success)
Examples
mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/simple_l2_only.cpp, and mofem/tutorials/fun-1_integration/integration.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();
71 MOFEM_LOG("WORLD", Sev::warning)
72 << "PipelineManager::loopFiniteElements called with no active finite "
73 "element pipelines (all are null)";
74 }
75
76 // Add element to calculate lhs of stiff part
77 if (feDomainLhs)
78 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(), feDomainLhs);
79 if (feBoundaryLhs)
80 CHKERR DMoFEMLoopFiniteElements(dm, simple->getBoundaryFEName(),
82 if (feSkeletonLhs)
83 CHKERR DMoFEMLoopFiniteElements(dm, simple->getSkeletonFEName(),
85 if (feMeshsetLhs)
86 CHKERR DMoFEMLoopFiniteElements(dm, simple->getMeshsetFEName(),
88
89 // Add element to calculate rhs of stiff part
90 if (feDomainRhs)
91 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(), feDomainRhs);
92 if (feBoundaryRhs)
93 CHKERR DMoFEMLoopFiniteElements(dm, simple->getBoundaryFEName(),
95 if (feSkeletonRhs)
96 CHKERR DMoFEMLoopFiniteElements(dm, simple->getSkeletonFEName(),
98 if (feMeshsetRhs)
99 CHKERR DMoFEMLoopFiniteElements(dm, simple->getMeshsetFEName(),
101
103}

◆ loopFiniteElementsEvaluation()

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

#include <src/interfaces/PipelineManager.hpp>

Iterate evaluation finite elements.

Parameters
dmOptional DM object (default: nullptr)
Returns
MoFEMErrorCode Error code (0 on success)
Examples
mofem/atom_tests/higher_derivatives.cpp.

Definition at line 167 of file PipelineManager.cpp.

167 {
169 Interface &m_field = cOre;
170 Simple *simple = m_field.getInterface<Simple>();
171 if (!dm)
172 dm = simple->getDM();
173 if (!feEvaluation) {
174 MOFEM_LOG("WORLD", Sev::warning)
175 << "PipelineManager::loopFiniteElementsEvaluation called with no "
176 "active "
177 "finite element pipelines (all are null)";
178 }
179
180 if (feEvaluation)
181 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(),
183
185}

◆ loopFiniteElementsPostProc()

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

#include <src/interfaces/PipelineManager.hpp>

Iterate postprocessing finite elements.

Parameters
dmOptional DM object (default: nullptr)
Returns
MoFEMErrorCode Error code (0 on success)
Examples
mofem/tutorials/clx-0_acoustics/helmholtz.cpp, mofem/tutorials/fun-2_plot_base/plot_base.cpp, mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp, mofem/tutorials/mix-1_light_intensity_equation/phase.cpp, mofem/tutorials/scl-0_least_squares/approximation.cpp, mofem/tutorials/scl-1_poisson_2d_homogeneous/poisson_2d_homogeneous.cpp, mofem/tutorials/scl-8_heat_radiation/radiation.cpp, mofem/tutorials/scl-9_heat_method/heat_method.cpp, and mofem/tutorials/vec-6_dg_kirchhoff_plate/plate.cpp.

Definition at line 106 of file PipelineManager.cpp.

106 {
108 Interface &m_field = cOre;
109 Simple *simple = m_field.getInterface<Simple>();
110 if (!dm)
111 dm = simple->getDM();
113 MOFEM_LOG("WORLD", Sev::warning)
114 << "PipelineManager::loopFiniteElementsPostProc called with no active "
115 "finite element pipelines (all are null)";
116 }
117
119 CHKERR DMoFEMLoopFiniteElements(dm, simple->getDomainFEName(),
122 CHKERR DMoFEMLoopFiniteElements(dm, simple->getBoundaryFEName(),
124
126}