v0.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Private Attributes | Friends | List of all members
MoFEM::TsCtx Struct Reference

Interface for Time Stepping (TS) solver. More...

#include <src/petsc/TsCtx.hpp>

Collaboration diagram for MoFEM::TsCtx:
[legend]

Public Types

typedef MoFEM::PairNameFEMethodPtr PairNameFEMethodPtr
 
typedef MoFEM::FEMethodsSequence FEMethodsSequence
 
typedef MoFEM::BasicMethodsSequence BasicMethodsSequence
 

Public Member Functions

 TsCtx (MoFEM::Interface &m_field, const std::string &problem_name)
 
virtual ~TsCtx ()=default
 
FEMethodsSequencegetLoopsIFunction ()
 Get the loops to do IFunction object. More...
 
FEMethodsSequencegetLoopsRHSFunction ()
 Get the loops to do RHSFunction object. More...
 
FEMethodsSequencegetLoopsIJacobian ()
 Get the loops to do IJacobian object. More...
 
FEMethodsSequencegetLoopsRHSJacobian ()
 Get the loops to do RHSJacobian object. More...
 
FEMethodsSequencegetLoopsMonitor ()
 Get the loops to do Monitor object. More...
 
BasicMethodsSequencegetPreProcessIFunction ()
 Get the preProcess to do IFunction object. More...
 
BasicMethodsSequencegetPostProcessIFunction ()
 Get the postProcess to do IFunction object. More...
 
BasicMethodsSequencegetPreProcessIJacobian ()
 Get the preProcess to do IJacobian object. More...
 
BasicMethodsSequencegetPostProcessIJacobian ()
 Get the postProcess to do IJacobian object. More...
 
BasicMethodsSequencegetPreProcessMonitor ()
 Get the preProcess to do Monitor object. More...
 
BasicMethodsSequencegetPostProcessMonitor ()
 Get the postProcess to do Monitor object. More...
 
BasicMethodsSequencegetPreProcessRHSJacobian ()
 Get the preProcess to do RHSJacobian object. More...
 
BasicMethodsSequencegetPostProcessRHSJacobian ()
 Get the postProcess to do RHSJacobian object. More...
 
BasicMethodsSequencegetPreProcessRHSFunction ()
 Get the preProcess to do RHSFunction object. More...
 
BasicMethodsSequencegetPostProcessRHSFunction ()
 Get the postProcess to do RHSFunction object. More...
 
MoFEMErrorCode clearLoops ()
 Clear loops. More...
 

Public Attributes

MoFEM::InterfacemField
 
moab::Interface & moab
 
std::string problemName
 
MoFEMTypes bH
 If set to MF_EXIST check if element exist. More...
 
FEMethodsSequence loopsIJacobian
 
FEMethodsSequence loopsIFunction
 
FEMethodsSequence loopsMonitor
 
FEMethodsSequence loopsRHSJacobian
 
FEMethodsSequence loopsRHSFunction
 
BasicMethodsSequence preProcessIJacobian
 
BasicMethodsSequence postProcessIJacobian
 
BasicMethodsSequence preProcessIFunction
 
BasicMethodsSequence postProcessIFunction
 
BasicMethodsSequence preProcessMonitor
 
BasicMethodsSequence postProcessMonitor
 
BasicMethodsSequence preProcessRHSJacobian
 
BasicMethodsSequence preProcessRHSFunction
 
BasicMethodsSequence postProcessRHSJacobian
 
BasicMethodsSequence postProcessRHSFunction
 
bool zeroMatrix
 

Private Attributes

PetscLogEvent MOFEM_EVENT_TsCtxRHSFunction
 
PetscLogEvent MOFEM_EVENT_TsCtxRHSJacobian
 
PetscLogEvent MOFEM_EVENT_TsCtxIFunction
 
PetscLogEvent MOFEM_EVENT_TsCtxIJacobian
 
PetscLogEvent MOFEM_EVENT_TsCtxMonitor
 
PetscLogEvent MOFEM_EVENT_TsCtxI2Function
 
PetscLogEvent MOFEM_EVENT_TsCtxI2Jacobian
 
boost::movelib::unique_ptr< boolvecAssembleSwitch
 
boost::movelib::unique_ptr< boolmatAssembleSwitch
 

Friends

PetscErrorCode TsSetIFunction (TS ts, PetscReal t, Vec u, Vec u_t, Vec F, void *ctx)
 Set IFunction for TS solver. More...
 
PetscErrorCode TsSetIJacobian (TS ts, PetscReal t, Vec u, Vec U_t, PetscReal a, Mat A, Mat B, void *ctx)
 Set function evaluating jacobian in TS solver. More...
 
PetscErrorCode TsMonitorSet (TS ts, PetscInt step, PetscReal t, Vec u, void *ctx)
 Set monitor for TS solver. More...
 
PetscErrorCode TsSetRHSFunction (TS ts, PetscReal t, Vec u, Vec F, void *ctx)
 TS solver function. More...
 
PetscErrorCode TsSetRHSJacobian (TS ts, PetscReal t, Vec u, Mat A, Mat B, void *ctx)
 TS solver function. More...
 
PetscErrorCode TsSetI2Function (TS ts, PetscReal t, Vec U, Vec U_t, Vec U_tt, Vec F, void *ctx)
 Calculation the right hand side for second order PDE in time. More...
 
PetscErrorCode TsSetI2Jacobian (TS ts, PetscReal t, Vec U, Vec U_t, Vec U_tt, PetscReal v, PetscReal a, Mat J, Mat P, void *ctx)
 Calculation Jacobian for second order PDE in time. More...
 

Detailed Description

Interface for Time Stepping (TS) solver.

Examples
Remodeling.cpp, level_set.cpp, and nonlinear_dynamics.cpp.

Definition at line 17 of file TsCtx.hpp.

Member Typedef Documentation

◆ BasicMethodsSequence

Definition at line 27 of file TsCtx.hpp.

◆ FEMethodsSequence

Definition at line 26 of file TsCtx.hpp.

◆ PairNameFEMethodPtr

Definition at line 25 of file TsCtx.hpp.

Constructor & Destructor Documentation

◆ TsCtx()

MoFEM::TsCtx::TsCtx ( MoFEM::Interface m_field,
const std::string &  problem_name 
)

Definition at line 5 of file TsCtx.cpp.

6 : mField(m_field), moab(m_field.get_moab()), problemName(problem_name),
7 bH(MF_EXIST), zeroMatrix(true) {
8 PetscLogEventRegister("LoopTsIFunction", 0, &MOFEM_EVENT_TsCtxIFunction);
9 PetscLogEventRegister("LoopTsIJacobian", 0, &MOFEM_EVENT_TsCtxIJacobian);
10 PetscLogEventRegister("LoopTsRHSFunction", 0, &MOFEM_EVENT_TsCtxRHSFunction);
11 PetscLogEventRegister("LoopTsRHSJacobian", 0, &MOFEM_EVENT_TsCtxRHSJacobian);
12 PetscLogEventRegister("LoopTsMonitor", 0, &MOFEM_EVENT_TsCtxMonitor);
13 PetscLogEventRegister("LoopTsI2Function", 0, &MOFEM_EVENT_TsCtxI2Function);
14 PetscLogEventRegister("LoopTsI2Jacobian", 0, &MOFEM_EVENT_TsCtxI2Jacobian);
15
16 if (!LogManager::checkIfChannelExist("TSWORLD")) {
17 auto core_log = logging::core::get();
18
19 core_log->add_sink(
21 core_log->add_sink(
23 core_log->add_sink(
25
26 LogManager::setLog("TSWORLD");
27 LogManager::setLog("TSSYNC");
28 LogManager::setLog("TSSELF");
29
30 MOFEM_LOG_TAG("TSWORLD", "TS");
31 MOFEM_LOG_TAG("TSSYNC", "TS");
32 MOFEM_LOG_TAG("TSSELF", "TS");
33 }
34}
@ MF_EXIST
Definition: definitions.h:100
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:389
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
virtual moab::Interface & get_moab()=0
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:298
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:344
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:348
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:404
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:340
PetscLogEvent MOFEM_EVENT_TsCtxI2Jacobian
Definition: TsCtx.hpp:214
bool zeroMatrix
Definition: TsCtx.hpp:45
MoFEMTypes bH
If set to MF_EXIST check if element exist.
Definition: TsCtx.hpp:23
moab::Interface & moab
Definition: TsCtx.hpp:20
PetscLogEvent MOFEM_EVENT_TsCtxRHSJacobian
Definition: TsCtx.hpp:209
PetscLogEvent MOFEM_EVENT_TsCtxMonitor
Definition: TsCtx.hpp:212
PetscLogEvent MOFEM_EVENT_TsCtxRHSFunction
Definition: TsCtx.hpp:208
PetscLogEvent MOFEM_EVENT_TsCtxIJacobian
Definition: TsCtx.hpp:211
std::string problemName
Definition: TsCtx.hpp:22
MoFEM::Interface & mField
Definition: TsCtx.hpp:19
PetscLogEvent MOFEM_EVENT_TsCtxIFunction
Definition: TsCtx.hpp:210
PetscLogEvent MOFEM_EVENT_TsCtxI2Function
Definition: TsCtx.hpp:213

◆ ~TsCtx()

virtual MoFEM::TsCtx::~TsCtx ( )
virtualdefault

Member Function Documentation

◆ clearLoops()

MoFEMErrorCode MoFEM::TsCtx::clearLoops ( )

Clear loops.

Returns
MoFEMErrorCode

Definition at line 36 of file TsCtx.cpp.

36 {
38 loopsIJacobian.clear();
39 loopsIFunction.clear();
40 loopsMonitor.clear();
41 loopsRHSJacobian.clear();
42 loopsRHSFunction.clear();
43 preProcessIJacobian.clear();
45 preProcessIFunction.clear();
47 preProcessMonitor.clear();
48 postProcessMonitor.clear();
54}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
FEMethodsSequence loopsIJacobian
Definition: TsCtx.hpp:29
FEMethodsSequence loopsRHSFunction
Definition: TsCtx.hpp:33
BasicMethodsSequence postProcessRHSFunction
Definition: TsCtx.hpp:43
BasicMethodsSequence preProcessMonitor
Definition: TsCtx.hpp:38
BasicMethodsSequence preProcessIJacobian
Definition: TsCtx.hpp:34
BasicMethodsSequence postProcessIFunction
Definition: TsCtx.hpp:37
FEMethodsSequence loopsIFunction
Definition: TsCtx.hpp:30
FEMethodsSequence loopsRHSJacobian
Definition: TsCtx.hpp:32
BasicMethodsSequence preProcessIFunction
Definition: TsCtx.hpp:36
FEMethodsSequence loopsMonitor
Definition: TsCtx.hpp:31
BasicMethodsSequence postProcessMonitor
Definition: TsCtx.hpp:39
BasicMethodsSequence preProcessRHSJacobian
Definition: TsCtx.hpp:40
BasicMethodsSequence preProcessRHSFunction
Definition: TsCtx.hpp:41
BasicMethodsSequence postProcessIJacobian
Definition: TsCtx.hpp:35
BasicMethodsSequence postProcessRHSJacobian
Definition: TsCtx.hpp:42

◆ getLoopsIFunction()

FEMethodsSequence & MoFEM::TsCtx::getLoopsIFunction ( )
inline

Get the loops to do IFunction object.

It is sequence of finite elements used to evaluate the right hand side of implicit time solver.

Returns
FEMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 59 of file TsCtx.hpp.

59{ return loopsIFunction; }

◆ getLoopsIJacobian()

FEMethodsSequence & MoFEM::TsCtx::getLoopsIJacobian ( )
inline

Get the loops to do IJacobian object.

It is sequence of finite elements used to evalite the left hand sie of implicit time solver.

Returns
FEMethodsSequence&

Definition at line 79 of file TsCtx.hpp.

79{ return loopsIJacobian; }

◆ getLoopsMonitor()

FEMethodsSequence & MoFEM::TsCtx::getLoopsMonitor ( )
inline

Get the loops to do Monitor object.

It is sequence used to monitor solution of time solver.

Returns
FEMethodsSequence&
Examples
EshelbianPlasticity.cpp, and nonlinear_dynamics.cpp.

Definition at line 98 of file TsCtx.hpp.

98{ return loopsMonitor; }

◆ getLoopsRHSFunction()

FEMethodsSequence & MoFEM::TsCtx::getLoopsRHSFunction ( )
inline

Get the loops to do RHSFunction object.

It is sequence of finite elements used to evaluate the right hand side of implicit time solver.

Returns
FEMethodsSequence&

Definition at line 69 of file TsCtx.hpp.

69{ return loopsRHSFunction; }

◆ getLoopsRHSJacobian()

FEMethodsSequence & MoFEM::TsCtx::getLoopsRHSJacobian ( )
inline

Get the loops to do RHSJacobian object.

It is sequence of finite elements used to evalite the left hand sie of implicit time solver.

Returns
FEMethodsSequence&

Definition at line 89 of file TsCtx.hpp.

89{ return loopsRHSJacobian; }

◆ getPostProcessIFunction()

BasicMethodsSequence & MoFEM::TsCtx::getPostProcessIFunction ( )
inline

Get the postProcess to do IFunction object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 112 of file TsCtx.hpp.

112 {
114 }

◆ getPostProcessIJacobian()

BasicMethodsSequence & MoFEM::TsCtx::getPostProcessIJacobian ( )
inline

Get the postProcess to do IJacobian object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 128 of file TsCtx.hpp.

128 {
130 }

◆ getPostProcessMonitor()

BasicMethodsSequence & MoFEM::TsCtx::getPostProcessMonitor ( )
inline

Get the postProcess to do Monitor object.

Returns
BasicMethodsSequence&
Examples
Remodeling.cpp, and UnsaturatedFlow.hpp.

Definition at line 144 of file TsCtx.hpp.

144{ return postProcessMonitor; }

◆ getPostProcessRHSFunction()

BasicMethodsSequence & MoFEM::TsCtx::getPostProcessRHSFunction ( )
inline

Get the postProcess to do RHSFunction object.

Returns
BasicMethodsSequence&

Definition at line 178 of file TsCtx.hpp.

178 {
180 }

◆ getPostProcessRHSJacobian()

BasicMethodsSequence & MoFEM::TsCtx::getPostProcessRHSJacobian ( )
inline

Get the postProcess to do RHSJacobian object.

Returns
BasicMethodsSequence&

Definition at line 160 of file TsCtx.hpp.

160 {
162 }

◆ getPreProcessIFunction()

BasicMethodsSequence & MoFEM::TsCtx::getPreProcessIFunction ( )
inline

Get the preProcess to do IFunction object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 105 of file TsCtx.hpp.

105{ return preProcessIFunction; }

◆ getPreProcessIJacobian()

BasicMethodsSequence & MoFEM::TsCtx::getPreProcessIJacobian ( )
inline

Get the preProcess to do IJacobian object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 121 of file TsCtx.hpp.

121{ return preProcessIJacobian; }

◆ getPreProcessMonitor()

BasicMethodsSequence & MoFEM::TsCtx::getPreProcessMonitor ( )
inline

Get the preProcess to do Monitor object.

Returns
BasicMethodsSequence&

Definition at line 137 of file TsCtx.hpp.

137{ return preProcessMonitor; }

◆ getPreProcessRHSFunction()

BasicMethodsSequence & MoFEM::TsCtx::getPreProcessRHSFunction ( )
inline

Get the preProcess to do RHSFunction object.

Returns
BasicMethodsSequence&

Definition at line 169 of file TsCtx.hpp.

169 {
171 }

◆ getPreProcessRHSJacobian()

BasicMethodsSequence & MoFEM::TsCtx::getPreProcessRHSJacobian ( )
inline

Get the preProcess to do RHSJacobian object.

Returns
BasicMethodsSequence&

Definition at line 151 of file TsCtx.hpp.

151 {
153 }

Friends And Related Function Documentation

◆ TsMonitorSet

PetscErrorCode TsMonitorSet ( TS  ts,
PetscInt  step,
PetscReal  t,
Vec  u,
void *  ctx 
)
friend

Set monitor for TS solver.

See PETSc for details

Parameters
ts
step
t
u
ctx
Returns
PetscErrorCode

Definition at line 259 of file TsCtx.cpp.

260 {
262 TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
263 PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxMonitor, 0, 0, 0, 0);
264 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
265 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
266 CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
267 ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
268
269 auto cache_ptr = boost::make_shared<CacheTuple>();
271
272 auto set = [&](auto &fe) {
273 fe.ts = ts;
274 fe.ts_u = u;
275 fe.ts_t = t;
276 fe.ts_step = step;
277 fe.ts_F = PETSC_NULL;
279 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
280 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
282
283 CHKERR TSGetSNES(ts, &fe.snes);
284 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
285
286 fe.cacheWeakPtr = cache_ptr;
287 CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
288 };
289
290 auto unset = [&](auto &fe) {
291 fe.ts_ctx = TSMethod::CTX_TSNONE;
292 fe.data_ctx = PetscData::CtxSetNone;
293 };
294
295 // preprocess
296 for (auto &bit : ts_ctx->preProcessMonitor) {
297 set(*bit);
299 *bit);
300 unset(*bit);
301 }
302
303 for (auto &lit : ts_ctx->loopsMonitor) {
304 set(*lit.second);
306 *(lit.second), nullptr,
307 ts_ctx->bH, cache_ptr);
308 unset(*lit.second);
309 }
310
311 // post process
312 for (auto &bit : ts_ctx->postProcessMonitor) {
313 set(*bit);
315 *bit);
316 unset(*bit);
317 }
318
319 PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxMonitor, 0, 0, 0, 0);
321}
@ COL
Definition: definitions.h:123
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:595
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
virtual MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
virtual MoFEMErrorCode loop_finite_elements(const std::string problem_name, const std::string &fe_name, FEMethod &method, boost::shared_ptr< NumeredEntFiniteElement_multiIndex > fe_ptr=nullptr, MoFEMTypes bh=MF_EXIST, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr(), int verb=DEFAULT_VERBOSITY)=0
Make a loop over finite elements.
auto bit
set bit
MoFEM::TsCtx * ts_ctx
Definition: level_set.cpp:1932
constexpr double t
plate stiffness
Definition: plate.cpp:59
virtual MoFEMErrorCode cache_problem_entities(const std::string prb_name, CacheTupleWeakPtr cache_ptr)=0
Cache variables.
virtual MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
static constexpr Switches CtxSetX
Definition: LoopMethods.hpp:39
static constexpr Switches CtxSetNone
Definition: LoopMethods.hpp:35
static constexpr Switches CtxSetTime
Definition: LoopMethods.hpp:42
TsCtx(MoFEM::Interface &m_field, const std::string &problem_name)
Definition: TsCtx.cpp:5
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

◆ TsSetI2Function

PetscErrorCode TsSetI2Function ( TS  ts,
PetscReal  t,
Vec  U,
Vec  U_t,
Vec  U_tt,
Vec  F,
void *  ctx 
)
friend

Calculation the right hand side for second order PDE in time.

PETSc for details

Parameters
ts
t
u
u_t
u_tt
F
ctx
Returns
PetscErrorCode

Definition at line 612 of file TsCtx.cpp.

613 {
615 TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
616 PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
617 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
618 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
619 CHKERR VecGhostUpdateBegin(u_t, INSERT_VALUES, SCATTER_FORWARD);
620 CHKERR VecGhostUpdateEnd(u_t, INSERT_VALUES, SCATTER_FORWARD);
621 CHKERR VecGhostUpdateBegin(u_tt, INSERT_VALUES, SCATTER_FORWARD);
622 CHKERR VecGhostUpdateEnd(u_tt, INSERT_VALUES, SCATTER_FORWARD);
623 CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
624 ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
625
626 auto zero_ghost_vec = [](Vec g) {
628 Vec l;
629 CHKERR VecGhostGetLocalForm(g, &l);
630 double *a;
631 CHKERR VecGetArray(l, &a);
632 int s;
633 CHKERR VecGetLocalSize(l, &s);
634 for (int i = 0; i != s; ++i)
635 a[i] = 0;
636 CHKERR VecRestoreArray(l, &a);
637 CHKERR VecGhostRestoreLocalForm(g, &l);
639 };
640 CHKERR zero_ghost_vec(F);
641
642 ts_ctx->vecAssembleSwitch = boost::movelib::make_unique<bool>(true);
643 auto cache_ptr = boost::make_shared<CacheTuple>();
645
646 int step;
647#if PETSC_VERSION_GE(3, 8, 0)
648 CHKERR TSGetStepNumber(ts, &step);
649#else
650 CHKERR TSGetTimeStepNumber(ts, &step);
651#endif
652
653 auto set = [&](auto &fe) {
654 fe.ts_u = u;
655 fe.ts_u_t = u_t;
656 fe.ts_u_tt = u_tt;
657 fe.ts_F = F;
658 fe.ts_t = t;
659 fe.ts_step = step;
662 fe.ksp_ctx = KspMethod::CTX_SETFUNCTION;
663 fe.data_ctx = PetscData::CtxSetF | PetscData::CtxSetX |
666
667 CHKERR TSGetSNES(ts, &fe.snes);
668 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
669
670 fe.ts = ts;
671 fe.cacheWeakPtr = cache_ptr;
672 CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
673 };
674
675 auto unset = [&](auto &fe) {
676 fe.ts_ctx = TSMethod::CTX_TSNONE;
677 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
678 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
679 fe.data_ctx = PetscData::CtxSetNone;
680 };
681
682 // preprocess
683 for (auto &bit : ts_ctx->preProcessIFunction) {
684 bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
685 set(*bit);
687 *bit);
688 unset(*bit);
689 ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
690 }
691
692 // fe loops
693 for (auto &lit : ts_ctx->loopsIFunction) {
694 lit.second->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
695 set(*lit.second);
697 *(lit.second), nullptr,
698 ts_ctx->bH, cache_ptr);
699 unset(*lit.second);
700 ts_ctx->vecAssembleSwitch = boost::move(lit.second->vecAssembleSwitch);
701 }
702
703 // post process
704 for (auto &bit : ts_ctx->postProcessIFunction) {
705 bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
706 set(*bit);
708 *bit);
709 unset(*bit);
710 ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
711 }
712
714 CHKERR VecGhostUpdateBegin(F, ADD_VALUES, SCATTER_REVERSE);
715 CHKERR VecGhostUpdateEnd(F, ADD_VALUES, SCATTER_REVERSE);
716 CHKERR VecAssemblyBegin(F);
717 CHKERR VecAssemblyEnd(F);
718 }
719
720 PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
722}
constexpr double a
@ F
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
const FTensor::Tensor2< T, Dim, Dim > Vec
constexpr double g
static constexpr Switches CtxSetX_TT
Definition: LoopMethods.hpp:41
static constexpr Switches CtxSetF
Definition: LoopMethods.hpp:36
static constexpr Switches CtxSetX_T
Definition: LoopMethods.hpp:40
boost::movelib::unique_ptr< bool > vecAssembleSwitch
Definition: TsCtx.hpp:216

◆ TsSetI2Jacobian

PetscErrorCode TsSetI2Jacobian ( TS  ts,
PetscReal  t,
Vec  U,
Vec  U_t,
Vec  U_tt,
PetscReal  v,
PetscReal  a,
Mat  J,
Mat  P,
void *  ctx 
)
friend

Calculation Jacobian for second order PDE in time.

See PETSc for details

Parameters
ts
ttime at step/stage being solved
ustate vectora
u_ttime derivative of state vector
u_ttsecond time derivative of state vector
ashift for u_t
aashift for u_tt
AJacobian of G(U) = F(t,U,W+v*U,W'+a*U), equivalent to dF/dU + v*dF/dU_t + a*dF/dU_tt
Bpreconditioning matrix for J, may be same as J
ctxTsCtx context for matrix evaluation routine
Returns
PetscErrorCode

Definition at line 511 of file TsCtx.cpp.

513 {
515
516 TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
517 PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxI2Function, 0, 0, 0, 0);
518 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
519 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
520 CHKERR VecGhostUpdateBegin(u_t, INSERT_VALUES, SCATTER_FORWARD);
521 CHKERR VecGhostUpdateEnd(u_t, INSERT_VALUES, SCATTER_FORWARD);
522 CHKERR VecGhostUpdateBegin(u_tt, INSERT_VALUES, SCATTER_FORWARD);
523 CHKERR VecGhostUpdateEnd(u_tt, INSERT_VALUES, SCATTER_FORWARD);
524 CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
525 ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
526 if (ts_ctx->zeroMatrix) {
527 CHKERR MatZeroEntries(B);
528 }
529 int step;
530#if PETSC_VERSION_GE(3, 8, 0)
531 CHKERR TSGetStepNumber(ts, &step);
532#else
533 CHKERR TSGetTimeStepNumber(ts, &step);
534#endif
535
537 boost::movelib::make_unique<bool>(ts_ctx->zeroMatrix);
538 auto cache_ptr = boost::make_shared<CacheTuple>();
540
541 auto set = [&](auto &fe) {
542 fe.ts_u = u;
543 fe.ts_u_t = u_t;
544 fe.ts_u_tt = u_tt;
545 fe.ts_A = A;
546 fe.ts_B = B;
547 fe.ts_t = t;
548 fe.ts_a = a;
549 fe.ts_aa = aa;
550 fe.ts_step = step;
551
554 fe.ksp_ctx = KspMethod::CTX_OPERATORS;
558
559 CHKERR TSGetSNES(ts, &fe.snes);
560 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
561
562 fe.ts = ts;
563 fe.cacheWeakPtr = cache_ptr;
564 CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
565 };
566
567 auto unset = [&](auto &fe) {
568 fe.ts_ctx = TSMethod::CTX_TSNONE;
569 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
570 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
571 fe.data_ctx = PetscData::CtxSetNone;
572 };
573
574 // preprocess
575 for (auto &bit : ts_ctx->preProcessIJacobian) {
576 bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
577 set(*bit);
579 *bit);
580 unset(*bit);
581 ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
582 }
583
584 for (auto &lit : ts_ctx->loopsIJacobian) {
585 lit.second->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
586 set(*lit.second);
588 *(lit.second), nullptr,
589 ts_ctx->bH, cache_ptr);
590 unset(*lit.second);
591 ts_ctx->matAssembleSwitch = boost::move(lit.second->matAssembleSwitch);
592 }
593
594 // post process
595 for (auto &bit : ts_ctx->postProcessIJacobian) {
596 bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
597 set(*bit);
599 *bit);
600 unset(*bit);
601 ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
602 }
603
604 if (*(ts_ctx->matAssembleSwitch)) {
605 CHKERR MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY);
606 CHKERR MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
607 }
608 PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxI2Function, 0, 0, 0, 0);
610}
constexpr AssemblyType A
static constexpr Switches CtxSetA
Definition: LoopMethods.hpp:37
static constexpr Switches CtxSetB
Definition: LoopMethods.hpp:38
boost::movelib::unique_ptr< bool > matAssembleSwitch
Definition: TsCtx.hpp:217

◆ TsSetIFunction

PetscErrorCode TsSetIFunction ( TS  ts,
PetscReal  t,
Vec  u,
Vec  u_t,
Vec  F,
void *  ctx 
)
friend

Set IFunction for TS solver.

See petsc for details

Parameters
ts
t
u
u_t
F
ctx
Returns
PetscErrorCode

Definition at line 56 of file TsCtx.cpp.

57 {
59 TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
60 PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
61 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
62 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
63 CHKERR VecGhostUpdateBegin(u_t, INSERT_VALUES, SCATTER_FORWARD);
64 CHKERR VecGhostUpdateEnd(u_t, INSERT_VALUES, SCATTER_FORWARD);
65 CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
66 ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
67
68 auto zero_ghost_vec = [](Vec g) {
70 Vec l;
71 CHKERR VecGhostGetLocalForm(g, &l);
72 double *a;
73 CHKERR VecGetArray(l, &a);
74 int s;
75 CHKERR VecGetLocalSize(l, &s);
76 for (int i = 0; i != s; ++i)
77 a[i] = 0;
78 CHKERR VecRestoreArray(l, &a);
79 CHKERR VecGhostRestoreLocalForm(g, &l);
81 };
82 CHKERR zero_ghost_vec(F);
83
84 ts_ctx->vecAssembleSwitch = boost::movelib::make_unique<bool>(true);
85
86 int step;
87#if PETSC_VERSION_GE(3, 8, 0)
88 CHKERR TSGetStepNumber(ts, &step);
89#else
90 CHKERR TSGetTimeStepNumber(ts, &step);
91#endif
92
93 auto cache_ptr = boost::make_shared<CacheTuple>();
95
96 auto set = [&](auto &fe) {
97 fe.ts = ts;
98 fe.ts_u = u;
99 fe.ts_u_t = u_t;
100 fe.ts_F = F;
101 fe.ts_t = t;
102 fe.ts_step = step;
105 fe.ksp_ctx = KspMethod::CTX_SETFUNCTION;
106 fe.data_ctx = PetscData::CtxSetF | PetscData::CtxSetX |
108
109 CHKERR TSGetSNES(ts, &fe.snes);
110 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
111
112 fe.cacheWeakPtr = cache_ptr;
113 CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
114 };
115
116 auto unset = [&](auto &fe) {
117 fe.ts_ctx = TSMethod::CTX_TSNONE;
118 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
119 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
120 fe.data_ctx = PetscData::CtxSetNone;
121 };
122
123 // preprocess
124 for (auto &bit : ts_ctx->preProcessIFunction) {
125 bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
126 set(*bit);
128 *bit);
129 unset(*bit);
130 ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
131 }
132
133 // fe loops
134 for (auto &lit : ts_ctx->loopsIFunction) {
135 lit.second->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
136 set(*lit.second);
138 *(lit.second), nullptr,
139 ts_ctx->bH, cache_ptr);
140 unset(*lit.second);
141 ts_ctx->vecAssembleSwitch = boost::move(lit.second->vecAssembleSwitch);
142 }
143
144 // post process
145 for (auto &bit : ts_ctx->postProcessIFunction) {
146 bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
147 set(*bit);
149 *bit);
150 unset(*bit);
151 ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
152 }
153
155 CHKERR VecGhostUpdateBegin(F, ADD_VALUES, SCATTER_REVERSE);
156 CHKERR VecGhostUpdateEnd(F, ADD_VALUES, SCATTER_REVERSE);
157 CHKERR VecAssemblyBegin(F);
158 CHKERR VecAssemblyEnd(F);
159 }
160
161 PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
163}

◆ TsSetIJacobian

PetscErrorCode TsSetIJacobian ( TS  ts,
PetscReal  t,
Vec  u,
Vec  U_t,
PetscReal  a,
Mat  A,
Mat  B,
void *  ctx 
)
friend

Set function evaluating jacobian in TS solver.

See PETSc for details

Parameters
ts
t
u
u_t
a
A
B
ctx
Returns
PetscErrorCode

Definition at line 165 of file TsCtx.cpp.

166 {
168
169 TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
170 PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
171 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
172 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
173 CHKERR VecGhostUpdateBegin(u_t, INSERT_VALUES, SCATTER_FORWARD);
174 CHKERR VecGhostUpdateEnd(u_t, INSERT_VALUES, SCATTER_FORWARD);
175 CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
176 ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
177 if (ts_ctx->zeroMatrix) {
178 CHKERR MatZeroEntries(B);
179 }
180 int step;
181#if PETSC_VERSION_GE(3, 8, 0)
182 CHKERR TSGetStepNumber(ts, &step);
183#else
184 CHKERR TSGetTimeStepNumber(ts, &step);
185#endif
186
188 boost::movelib::make_unique<bool>(ts_ctx->zeroMatrix);
189 auto cache_ptr = boost::make_shared<CacheTuple>();
191
192 auto set = [&](auto &fe) {
193 fe.ts = ts;
194 fe.ts_u = u;
195 fe.ts_u_t = u_t;
196 fe.ts_A = A;
197 fe.ts_B = B;
198 fe.ts_t = t;
199 fe.ts_a = a;
200 fe.ts_step = step;
203 fe.ksp_ctx = KspMethod::CTX_OPERATORS;
206
207 CHKERR TSGetSNES(ts, &fe.snes);
208 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
209
210 fe.cacheWeakPtr = cache_ptr;
211 CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
212 };
213
214 auto unset = [&](auto &fe) {
215 fe.ts_ctx = TSMethod::CTX_TSNONE;
216 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
217 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
218 fe.data_ctx = PetscData::CtxSetNone;
219 };
220
221 // preproces
222 for (auto &bit : ts_ctx->preProcessIJacobian) {
223 bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
224 set(*bit);
226 *bit);
227 unset(*bit);
228 ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
229 }
230
231 for (auto &lit : ts_ctx->loopsIJacobian) {
232 lit.second->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
233 set(*lit.second);
235 *(lit.second), nullptr,
236 ts_ctx->bH, cache_ptr);
237 unset(*lit.second);
238 ts_ctx->matAssembleSwitch = boost::move(lit.second->matAssembleSwitch);
239 }
240
241 // post process
242 for (auto &bit : ts_ctx->postProcessIJacobian) {
243 bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
244 set(*bit);
246 *bit);
247 unset(*bit);
248 ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
249 }
250
251 if (*(ts_ctx->matAssembleSwitch)) {
252 CHKERR MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY);
253 CHKERR MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
254 }
255 PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
257}

◆ TsSetRHSFunction

PetscErrorCode TsSetRHSFunction ( TS  ts,
PetscReal  t,
Vec  u,
Vec  F,
void *  ctx 
)
friend

TS solver function.

See PETSc for details

Parameters
ts
t
u
F
ctx
Returns
PetscErrorCode

Definition at line 323 of file TsCtx.cpp.

323 {
325 TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
326 PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxRHSFunction, 0, 0, 0, 0);
327 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
328 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
329 CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
330 ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
331
332 auto zero_ghost_vec = [](Vec g) {
334 Vec l;
335 CHKERR VecGhostGetLocalForm(g, &l);
336 double *a;
337 CHKERR VecGetArray(l, &a);
338 int s;
339 CHKERR VecGetLocalSize(l, &s);
340 for (int i = 0; i != s; ++i)
341 a[i] = 0;
342 CHKERR VecRestoreArray(l, &a);
343 CHKERR VecGhostRestoreLocalForm(g, &l);
345 };
346 CHKERR zero_ghost_vec(F);
347
348 ts_ctx->vecAssembleSwitch = boost::movelib::make_unique<bool>(true);
349 auto cache_ptr = boost::make_shared<CacheTuple>();
351
352 int step;
353#if PETSC_VERSION_GE(3, 8, 0)
354 CHKERR TSGetStepNumber(ts, &step);
355#else
356 CHKERR TSGetTimeStepNumber(ts, &step);
357#endif
358
359 auto set = [&](auto &fe) {
360 fe.ts_u = u;
361 fe.ts_F = F;
362 fe.ts_t = t;
363 fe.ts = ts;
364 fe.ts_step = step;
367 fe.ksp_ctx = KspMethod::CTX_SETFUNCTION;
368 fe.data_ctx =
370 fe.cacheWeakPtr = cache_ptr;
371 CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
372 };
373
374 auto unset = [&](auto &fe) {
375 fe.ts_ctx = TSMethod::CTX_TSNONE;
376 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
377 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
378 fe.data_ctx = PetscData::CtxSetNone;
379 };
380
381 for (auto &bit : ts_ctx->preProcessRHSFunction) {
382 bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
383 set(*bit);
385 *bit);
386 unset(*bit);
387 ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
388 }
389
390 // fe loops
391 for (auto &lit : ts_ctx->loopsRHSFunction) {
392 lit.second->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
393 set(*lit.second);
395 *(lit.second), nullptr,
396 ts_ctx->bH, cache_ptr);
397 unset(*lit.second);
398 ts_ctx->vecAssembleSwitch = boost::move(lit.second->vecAssembleSwitch);
399 }
400
401 // post process
402 for (auto &bit : ts_ctx->postProcessRHSFunction) {
403 bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
404 set(*bit);
406 *bit);
407 unset(*bit);
408 ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
409 }
410
412 CHKERR VecGhostUpdateBegin(F, ADD_VALUES, SCATTER_REVERSE);
413 CHKERR VecGhostUpdateEnd(F, ADD_VALUES, SCATTER_REVERSE);
414 CHKERR VecAssemblyBegin(F);
415 CHKERR VecAssemblyEnd(F);
416 }
417
418 PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxRHSFunction, 0, 0, 0, 0);
420}

◆ TsSetRHSJacobian

PetscErrorCode TsSetRHSJacobian ( TS  ts,
PetscReal  t,
Vec  u,
Mat  A,
Mat  B,
void *  ctx 
)
friend

TS solver function.

See PETSc for details

Parameters
ts
t
u
A
B
ctx
Returns
PetscErrorCode

Definition at line 422 of file TsCtx.cpp.

423 {
425 TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
426 PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxRHSJacobian, 0, 0, 0, 0);
427 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
428 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
429 CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
430 ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
431
432 if (ts_ctx->zeroMatrix) {
433 CHKERR MatZeroEntries(B);
434 }
435
437 boost::movelib::make_unique<bool>(ts_ctx->zeroMatrix);
438 auto cache_ptr = boost::make_shared<CacheTuple>();
440
441 int step;
442#if PETSC_VERSION_GE(3, 8, 0)
443 CHKERR TSGetStepNumber(ts, &step);
444#else
445 CHKERR TSGetTimeStepNumber(ts, &step);
446#endif
447
448 auto set = [&](auto &fe) {
449 fe.ts_u = u;
450 fe.ts_A = A;
451 fe.ts_B = B;
452 fe.ts_t = t;
453 fe.ts_step = step;
456 fe.ksp_ctx = KspMethod::CTX_OPERATORS;
459 fe.ts = ts;
460 fe.cacheWeakPtr = cache_ptr;
461 CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
462 };
463
464 auto unset = [&](auto &fe) {
465 fe.ts_ctx = TSMethod::CTX_TSNONE;
466 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
467 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
468 fe.data_ctx = PetscData::CtxSetNone;
469 };
470
471 // preprocess
472 for (auto &bit : ts_ctx->preProcessRHSJacobian) {
473 bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
474 set(*bit);
476 *bit);
477 unset(*bit);
478 ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
479 }
480
481 // fe loops
482 for (auto &lit : ts_ctx->loopsRHSJacobian) {
483 lit.second->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
484 set(*lit.second);
486 *(lit.second), nullptr,
487 ts_ctx->bH, cache_ptr);
488 unset(*lit.second);
489 ts_ctx->matAssembleSwitch = boost::move(lit.second->matAssembleSwitch);
490 }
491
492 // post process
493 for (auto &bit : ts_ctx->postProcessRHSJacobian) {
494 bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
495 set(*bit);
497 *bit);
498 unset(*bit);
499 ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
500 }
501
502 if (*(ts_ctx->matAssembleSwitch)) {
503 CHKERR MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY);
504 CHKERR MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
505 }
506
507 PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxRHSJacobian, 0, 0, 0, 0);
509}

Member Data Documentation

◆ bH

MoFEMTypes MoFEM::TsCtx::bH

If set to MF_EXIST check if element exist.

Definition at line 23 of file TsCtx.hpp.

◆ loopsIFunction

FEMethodsSequence MoFEM::TsCtx::loopsIFunction

Definition at line 30 of file TsCtx.hpp.

◆ loopsIJacobian

FEMethodsSequence MoFEM::TsCtx::loopsIJacobian

Definition at line 29 of file TsCtx.hpp.

◆ loopsMonitor

FEMethodsSequence MoFEM::TsCtx::loopsMonitor

Definition at line 31 of file TsCtx.hpp.

◆ loopsRHSFunction

FEMethodsSequence MoFEM::TsCtx::loopsRHSFunction

Definition at line 33 of file TsCtx.hpp.

◆ loopsRHSJacobian

FEMethodsSequence MoFEM::TsCtx::loopsRHSJacobian

Definition at line 32 of file TsCtx.hpp.

◆ matAssembleSwitch

boost::movelib::unique_ptr<bool> MoFEM::TsCtx::matAssembleSwitch
private

Definition at line 217 of file TsCtx.hpp.

◆ mField

MoFEM::Interface& MoFEM::TsCtx::mField

Definition at line 19 of file TsCtx.hpp.

◆ moab

moab::Interface& MoFEM::TsCtx::moab

Definition at line 20 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxI2Function

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxI2Function
private

Definition at line 213 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxI2Jacobian

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxI2Jacobian
private

Definition at line 214 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxIFunction

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxIFunction
private

Definition at line 210 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxIJacobian

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxIJacobian
private

Definition at line 211 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxMonitor

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxMonitor
private

Definition at line 212 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxRHSFunction

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSFunction
private

Definition at line 208 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxRHSJacobian

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSJacobian
private

Definition at line 209 of file TsCtx.hpp.

◆ postProcessIFunction

BasicMethodsSequence MoFEM::TsCtx::postProcessIFunction

Definition at line 37 of file TsCtx.hpp.

◆ postProcessIJacobian

BasicMethodsSequence MoFEM::TsCtx::postProcessIJacobian

Definition at line 35 of file TsCtx.hpp.

◆ postProcessMonitor

BasicMethodsSequence MoFEM::TsCtx::postProcessMonitor

Definition at line 39 of file TsCtx.hpp.

◆ postProcessRHSFunction

BasicMethodsSequence MoFEM::TsCtx::postProcessRHSFunction

Definition at line 43 of file TsCtx.hpp.

◆ postProcessRHSJacobian

BasicMethodsSequence MoFEM::TsCtx::postProcessRHSJacobian

Definition at line 42 of file TsCtx.hpp.

◆ preProcessIFunction

BasicMethodsSequence MoFEM::TsCtx::preProcessIFunction

Definition at line 36 of file TsCtx.hpp.

◆ preProcessIJacobian

BasicMethodsSequence MoFEM::TsCtx::preProcessIJacobian

Definition at line 34 of file TsCtx.hpp.

◆ preProcessMonitor

BasicMethodsSequence MoFEM::TsCtx::preProcessMonitor

Definition at line 38 of file TsCtx.hpp.

◆ preProcessRHSFunction

BasicMethodsSequence MoFEM::TsCtx::preProcessRHSFunction

Definition at line 41 of file TsCtx.hpp.

◆ preProcessRHSJacobian

BasicMethodsSequence MoFEM::TsCtx::preProcessRHSJacobian

Definition at line 40 of file TsCtx.hpp.

◆ problemName

std::string MoFEM::TsCtx::problemName

Definition at line 22 of file TsCtx.hpp.

◆ vecAssembleSwitch

boost::movelib::unique_ptr<bool> MoFEM::TsCtx::vecAssembleSwitch
private

Definition at line 216 of file TsCtx.hpp.

◆ zeroMatrix

bool MoFEM::TsCtx::zeroMatrix

Definition at line 45 of file TsCtx.hpp.


The documentation for this struct was generated from the following files: