v0.14.0
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
 
boost::function< MoFEMErrorCode(TS ts, PetscReal t, Vec u, Vec u_t, Vec u_tt, Vec F, void *ctx)> tsDebugHook
 
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
level_set.cpp, nonlinear_dynamics.cpp, and Remodeling.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 }

◆ ~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();
44  postProcessIJacobian.clear();
45  preProcessIFunction.clear();
46  postProcessIFunction.clear();
47  preProcessMonitor.clear();
48  postProcessMonitor.clear();
49  preProcessRHSJacobian.clear();
50  preProcessRHSFunction.clear();
51  postProcessRHSJacobian.clear();
52  postProcessRHSFunction.clear();
54 }

◆ 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 63 of file TsCtx.hpp.

63 { 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 83 of file TsCtx.hpp.

83 { 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 102 of file TsCtx.hpp.

102 { 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 73 of file TsCtx.hpp.

73 { 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 93 of file TsCtx.hpp.

93 { return loopsRHSJacobian; }

◆ getPostProcessIFunction()

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

Get the postProcess to do IFunction object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 116 of file TsCtx.hpp.

116  {
117  return postProcessIFunction;
118  }

◆ getPostProcessIJacobian()

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

Get the postProcess to do IJacobian object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 132 of file TsCtx.hpp.

132  {
133  return postProcessIJacobian;
134  }

◆ getPostProcessMonitor()

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

Get the postProcess to do Monitor object.

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

Definition at line 148 of file TsCtx.hpp.

148 { return postProcessMonitor; }

◆ getPostProcessRHSFunction()

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

Get the postProcess to do RHSFunction object.

Returns
BasicMethodsSequence&

Definition at line 182 of file TsCtx.hpp.

182  {
183  return postProcessRHSFunction;
184  }

◆ getPostProcessRHSJacobian()

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

Get the postProcess to do RHSJacobian object.

Returns
BasicMethodsSequence&

Definition at line 164 of file TsCtx.hpp.

164  {
165  return postProcessRHSJacobian;
166  }

◆ getPreProcessIFunction()

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

Get the preProcess to do IFunction object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 109 of file TsCtx.hpp.

109 { return preProcessIFunction; }

◆ getPreProcessIJacobian()

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

Get the preProcess to do IJacobian object.

Returns
BasicMethodsSequence&
Examples
nonlinear_dynamics.cpp.

Definition at line 125 of file TsCtx.hpp.

125 { return preProcessIJacobian; }

◆ getPreProcessMonitor()

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

Get the preProcess to do Monitor object.

Returns
BasicMethodsSequence&

Definition at line 141 of file TsCtx.hpp.

141 { return preProcessMonitor; }

◆ getPreProcessRHSFunction()

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

Get the preProcess to do RHSFunction object.

Returns
BasicMethodsSequence&

Definition at line 173 of file TsCtx.hpp.

173  {
174  return preProcessRHSFunction;
175  }

◆ getPreProcessRHSJacobian()

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

Get the preProcess to do RHSJacobian object.

Returns
BasicMethodsSequence&

Definition at line 155 of file TsCtx.hpp.

155  {
156  return preProcessRHSJacobian;
157  }

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 263 of file TsCtx.cpp.

264  {
266  TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
267  PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxMonitor, 0, 0, 0, 0);
268  CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
269  CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
270  CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
271  ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
272 
273  auto cache_ptr = boost::make_shared<CacheTuple>();
275 
276  auto set = [&](auto &fe) {
277  fe.ts = ts;
278  fe.ts_u = u;
279  fe.ts_t = t;
280  fe.ts_step = step;
281  fe.ts_F = PETSC_NULL;
282  fe.ts_ctx = TSMethod::CTX_TSTSMONITORSET;
283  fe.snes_ctx = SnesMethod::CTX_SNESNONE;
284  fe.ksp_ctx = KspMethod::CTX_KSPNONE;
286 
287  CHKERR TSGetSNES(ts, &fe.snes);
288  CHKERR SNESGetKSP(fe.snes, &fe.ksp);
289 
290  fe.cacheWeakPtr = cache_ptr;
291  CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
292  };
293 
294  auto unset = [&](auto &fe) {
295  fe.ts_ctx = TSMethod::CTX_TSNONE;
296  fe.data_ctx = PetscData::CtxSetNone;
297  };
298 
299  // preprocess
300  for (auto &bit : ts_ctx->preProcessMonitor) {
301  set(*bit);
303  *bit);
304  unset(*bit);
305  }
306 
307  for (auto &lit : ts_ctx->loopsMonitor) {
308  set(*lit.second);
310  *(lit.second), nullptr,
311  ts_ctx->bH, cache_ptr);
312  unset(*lit.second);
313  }
314 
315  // post process
316  for (auto &bit : ts_ctx->postProcessMonitor) {
317  set(*bit);
319  *bit);
320  unset(*bit);
321  }
322 
323  PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxMonitor, 0, 0, 0, 0);
325 }

◆ 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 620 of file TsCtx.cpp.

621  {
623  TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
624  PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
625  CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
626  CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
627  CHKERR VecGhostUpdateBegin(u_t, INSERT_VALUES, SCATTER_FORWARD);
628  CHKERR VecGhostUpdateEnd(u_t, INSERT_VALUES, SCATTER_FORWARD);
629  CHKERR VecGhostUpdateBegin(u_tt, INSERT_VALUES, SCATTER_FORWARD);
630  CHKERR VecGhostUpdateEnd(u_tt, INSERT_VALUES, SCATTER_FORWARD);
631  CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
632  ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
633 
634  auto zero_ghost_vec = [](Vec g) {
636  Vec l;
637  CHKERR VecGhostGetLocalForm(g, &l);
638  double *a;
639  CHKERR VecGetArray(l, &a);
640  int s;
641  CHKERR VecGetLocalSize(l, &s);
642  for (int i = 0; i != s; ++i)
643  a[i] = 0;
644  CHKERR VecRestoreArray(l, &a);
645  CHKERR VecGhostRestoreLocalForm(g, &l);
647  };
648  CHKERR zero_ghost_vec(F);
649 
650  ts_ctx->vecAssembleSwitch = boost::movelib::make_unique<bool>(true);
651  auto cache_ptr = boost::make_shared<CacheTuple>();
653 
654  int step;
655 #if PETSC_VERSION_GE(3, 8, 0)
656  CHKERR TSGetStepNumber(ts, &step);
657 #else
658  CHKERR TSGetTimeStepNumber(ts, &step);
659 #endif
660 
661  auto set = [&](auto &fe) {
662  fe.ts_u = u;
663  fe.ts_u_t = u_t;
664  fe.ts_u_tt = u_tt;
665  fe.ts_F = F;
666  fe.ts_t = t;
667  fe.ts_step = step;
668  fe.ts_ctx = TSMethod::CTX_TSSETIFUNCTION;
669  fe.snes_ctx = SnesMethod::CTX_SNESSETFUNCTION;
670  fe.ksp_ctx = KspMethod::CTX_SETFUNCTION;
671  fe.data_ctx = PetscData::CtxSetF | PetscData::CtxSetX |
674 
675  CHKERR TSGetSNES(ts, &fe.snes);
676  CHKERR SNESGetKSP(fe.snes, &fe.ksp);
677 
678  fe.ts = ts;
679  fe.cacheWeakPtr = cache_ptr;
680  CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
681  };
682 
683  auto unset = [&](auto &fe) {
684  fe.ts_ctx = TSMethod::CTX_TSNONE;
685  fe.snes_ctx = SnesMethod::CTX_SNESNONE;
686  fe.ksp_ctx = KspMethod::CTX_KSPNONE;
687  fe.data_ctx = PetscData::CtxSetNone;
688  };
689 
690  // preprocess
691  for (auto &bit : ts_ctx->preProcessIFunction) {
692  bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
693  set(*bit);
695  *bit);
696  unset(*bit);
697  ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
698  }
699 
700  // fe loops
701  for (auto &lit : ts_ctx->loopsIFunction) {
702  lit.second->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
703  set(*lit.second);
705  *(lit.second), nullptr,
706  ts_ctx->bH, cache_ptr);
707  unset(*lit.second);
708  ts_ctx->vecAssembleSwitch = boost::move(lit.second->vecAssembleSwitch);
709  }
710 
711  // post process
712  for (auto &bit : ts_ctx->postProcessIFunction) {
713  bit->vecAssembleSwitch = boost::move(ts_ctx->vecAssembleSwitch);
714  set(*bit);
716  *bit);
717  unset(*bit);
718  ts_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
719  }
720 
721  if (*ts_ctx->vecAssembleSwitch) {
722  CHKERR VecGhostUpdateBegin(F, ADD_VALUES, SCATTER_REVERSE);
723  CHKERR VecGhostUpdateEnd(F, ADD_VALUES, SCATTER_REVERSE);
724  CHKERR VecAssemblyBegin(F);
725  CHKERR VecAssemblyEnd(F);
726  }
727 
728  if (ts_ctx->tsDebugHook) {
729  CHKERR ts_ctx->tsDebugHook(ts, t, u, u_t, u_tt, F, ctx);
730  }
731 
732  PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
734 }

◆ 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 519 of file TsCtx.cpp.

521  {
523 
524  TsCtx *ts_ctx = static_cast<TsCtx *>(ctx);
525  PetscLogEventBegin(ts_ctx->MOFEM_EVENT_TsCtxI2Function, 0, 0, 0, 0);
526  CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
527  CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
528  CHKERR VecGhostUpdateBegin(u_t, INSERT_VALUES, SCATTER_FORWARD);
529  CHKERR VecGhostUpdateEnd(u_t, INSERT_VALUES, SCATTER_FORWARD);
530  CHKERR VecGhostUpdateBegin(u_tt, INSERT_VALUES, SCATTER_FORWARD);
531  CHKERR VecGhostUpdateEnd(u_tt, INSERT_VALUES, SCATTER_FORWARD);
532  CHKERR ts_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
533  ts_ctx->problemName, COL, u, INSERT_VALUES, SCATTER_REVERSE);
534  if (ts_ctx->zeroMatrix) {
535  CHKERR MatZeroEntries(B);
536  }
537  int step;
538 #if PETSC_VERSION_GE(3, 8, 0)
539  CHKERR TSGetStepNumber(ts, &step);
540 #else
541  CHKERR TSGetTimeStepNumber(ts, &step);
542 #endif
543 
545  boost::movelib::make_unique<bool>(ts_ctx->zeroMatrix);
546  auto cache_ptr = boost::make_shared<CacheTuple>();
548 
549  auto set = [&](auto &fe) {
550  fe.ts_u = u;
551  fe.ts_u_t = u_t;
552  fe.ts_u_tt = u_tt;
553  fe.ts_A = A;
554  fe.ts_B = B;
555  fe.ts_t = t;
556  fe.ts_a = a;
557  fe.ts_aa = aa;
558  fe.ts_step = step;
559 
560  fe.ts_ctx = TSMethod::CTX_TSSETIJACOBIAN;
561  fe.snes_ctx = SnesMethod::CTX_SNESSETJACOBIAN;
562  fe.ksp_ctx = KspMethod::CTX_OPERATORS;
566 
567  CHKERR TSGetSNES(ts, &fe.snes);
568  CHKERR SNESGetKSP(fe.snes, &fe.ksp);
569 
570  fe.ts = ts;
571  fe.cacheWeakPtr = cache_ptr;
572  CHK_THROW_MESSAGE(TSGetTimeStep(ts, &fe.ts_dt), "get time step failed");
573  };
574 
575  auto unset = [&](auto &fe) {
576  fe.ts_ctx = TSMethod::CTX_TSNONE;
577  fe.snes_ctx = SnesMethod::CTX_SNESNONE;
578  fe.ksp_ctx = KspMethod::CTX_KSPNONE;
579  fe.data_ctx = PetscData::CtxSetNone;
580  };
581 
582  // preprocess
583  for (auto &bit : ts_ctx->preProcessIJacobian) {
584  bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
585  set(*bit);
587  *bit);
588  unset(*bit);
589  ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
590  }
591 
592  for (auto &lit : ts_ctx->loopsIJacobian) {
593  lit.second->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
594  set(*lit.second);
596  *(lit.second), nullptr,
597  ts_ctx->bH, cache_ptr);
598  unset(*lit.second);
599  ts_ctx->matAssembleSwitch = boost::move(lit.second->matAssembleSwitch);
600  }
601 
602  // post process
603  for (auto &bit : ts_ctx->postProcessIJacobian) {
604  bit->matAssembleSwitch = boost::move(ts_ctx->matAssembleSwitch);
605  set(*bit);
607  *bit);
608  unset(*bit);
609  ts_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
610  }
611 
612  if (*(ts_ctx->matAssembleSwitch)) {
613  CHKERR MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY);
614  CHKERR MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
615  }
616  PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxI2Function, 0, 0, 0, 0);
618 }

◆ 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;
103  fe.ts_ctx = TSMethod::CTX_TSSETIFUNCTION;
104  fe.snes_ctx = SnesMethod::CTX_SNESSETFUNCTION;
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 
154  if (*ts_ctx->vecAssembleSwitch) {
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  if(ts_ctx->tsDebugHook) {
162  CHKERR ts_ctx->tsDebugHook(ts, t, u, u_t, PETSC_NULL, F, ctx);
163  }
164 
165  PetscLogEventEnd(ts_ctx->MOFEM_EVENT_TsCtxIFunction, 0, 0, 0, 0);
167 }

◆ 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 169 of file TsCtx.cpp.

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

◆ 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 327 of file TsCtx.cpp.

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

◆ 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 430 of file TsCtx.cpp.

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

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 221 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 217 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxI2Jacobian

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxI2Jacobian
private

Definition at line 218 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxIFunction

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxIFunction
private

Definition at line 214 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxIJacobian

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxIJacobian
private

Definition at line 215 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxMonitor

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxMonitor
private

Definition at line 216 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxRHSFunction

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSFunction
private

Definition at line 212 of file TsCtx.hpp.

◆ MOFEM_EVENT_TsCtxRHSJacobian

PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSJacobian
private

Definition at line 213 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.

◆ tsDebugHook

boost::function<MoFEMErrorCode(TS ts, PetscReal t, Vec u, Vec u_t, Vec u_tt, Vec F, void *ctx)> MoFEM::TsCtx::tsDebugHook

Definition at line 47 of file TsCtx.hpp.

◆ vecAssembleSwitch

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

Definition at line 220 of file TsCtx.hpp.

◆ zeroMatrix

bool MoFEM::TsCtx::zeroMatrix

Definition at line 49 of file TsCtx.hpp.


The documentation for this struct was generated from the following files:
MoFEM::TsCtx::preProcessRHSJacobian
BasicMethodsSequence preProcessRHSJacobian
Definition: TsCtx.hpp:40
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::KspMethod::CTX_KSPNONE
@ CTX_KSPNONE
Definition: LoopMethods.hpp:76
g
constexpr double g
Definition: shallow_wave.cpp:63
MoFEM::LogManager::checkIfChannelExist
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:404
MoFEM::CoreInterface::problem_basic_method_postProcess
virtual MoFEMErrorCode problem_basic_method_postProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
MoFEM::CoreInterface::loop_finite_elements
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.
MoFEM::PetscData::CtxSetB
static constexpr Switches CtxSetB
Definition: LoopMethods.hpp:39
MoFEM::PetscData::CtxSetA
static constexpr Switches CtxSetA
Definition: LoopMethods.hpp:38
MoFEM::TsCtx::MOFEM_EVENT_TsCtxIJacobian
PetscLogEvent MOFEM_EVENT_TsCtxIJacobian
Definition: TsCtx.hpp:215
CHK_THROW_MESSAGE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
Definition: definitions.h:609
MoFEM::TsCtx::moab
moab::Interface & moab
Definition: TsCtx.hpp:20
MoFEM::TsCtx::MOFEM_EVENT_TsCtxI2Function
PetscLogEvent MOFEM_EVENT_TsCtxI2Function
Definition: TsCtx.hpp:217
MoFEM::TsCtx::MOFEM_EVENT_TsCtxIFunction
PetscLogEvent MOFEM_EVENT_TsCtxIFunction
Definition: TsCtx.hpp:214
MoFEM::TsCtx::MOFEM_EVENT_TsCtxMonitor
PetscLogEvent MOFEM_EVENT_TsCtxMonitor
Definition: TsCtx.hpp:216
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
MoFEM::TSMethod::CTX_TSTSMONITORSET
@ CTX_TSTSMONITORSET
Definition: LoopMethods.hpp:148
MoFEM::TsCtx::vecAssembleSwitch
boost::movelib::unique_ptr< bool > vecAssembleSwitch
Definition: TsCtx.hpp:220
MoFEM::TSMethod::CTX_TSSETRHSJACOBIAN
@ CTX_TSSETRHSJACOBIAN
Definition: LoopMethods.hpp:145
MoFEM::LogManager::createSink
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
ts_ctx
MoFEM::TsCtx * ts_ctx
Definition: level_set.cpp:1932
MoFEM::TsCtx::loopsIJacobian
FEMethodsSequence loopsIJacobian
Definition: TsCtx.hpp:29
MoFEM::KspMethod::CTX_SETFUNCTION
@ CTX_SETFUNCTION
Definition: LoopMethods.hpp:76
MoFEM::SnesMethod::CTX_SNESSETJACOBIAN
@ CTX_SNESSETJACOBIAN
Definition: LoopMethods.hpp:110
MoFEM::TsCtx::bH
MoFEMTypes bH
If set to MF_EXIST check if element exist.
Definition: TsCtx.hpp:23
MoFEM::SnesMethod::CTX_SNESSETFUNCTION
@ CTX_SNESSETFUNCTION
Definition: LoopMethods.hpp:110
MoFEM::TsCtx::problemName
std::string problemName
Definition: TsCtx.hpp:22
MoFEM::TsCtx::loopsRHSJacobian
FEMethodsSequence loopsRHSJacobian
Definition: TsCtx.hpp:32
MoFEM::CoreInterface::problem_basic_method_preProcess
virtual MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
MoFEM::TsCtx::postProcessIJacobian
BasicMethodsSequence postProcessIJacobian
Definition: TsCtx.hpp:35
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::TsCtx::mField
MoFEM::Interface & mField
Definition: TsCtx.hpp:19
MoFEM::SnesMethod::CTX_SNESNONE
@ CTX_SNESNONE
Definition: LoopMethods.hpp:110
MoFEM::TsCtx::postProcessMonitor
BasicMethodsSequence postProcessMonitor
Definition: TsCtx.hpp:39
bit
auto bit
set bit
Definition: hanging_node_approx.cpp:75
MoFEM::TSMethod::CTX_TSSETIJACOBIAN
@ CTX_TSSETIJACOBIAN
Definition: LoopMethods.hpp:147
MoFEM::TsCtx::loopsMonitor
FEMethodsSequence loopsMonitor
Definition: TsCtx.hpp:31
MoFEM::LogManager::getStrmSync
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Definition: LogManager.cpp:348
MoFEM::PetscData::CtxSetX_T
static constexpr Switches CtxSetX_T
Definition: LoopMethods.hpp:42
COL
@ COL
Definition: definitions.h:136
MoFEM::LogManager::getStrmWorld
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:344
MoFEM::TsCtx::zeroMatrix
bool zeroMatrix
Definition: TsCtx.hpp:49
MoFEM::TSMethod::CTX_TSNONE
@ CTX_TSNONE
Definition: LoopMethods.hpp:149
MoFEM::CoreInterface::cache_problem_entities
virtual MoFEMErrorCode cache_problem_entities(const std::string prb_name, CacheTupleWeakPtr cache_ptr)=0
Cache variables.
MoFEM::TsCtx::matAssembleSwitch
boost::movelib::unique_ptr< bool > matAssembleSwitch
Definition: TsCtx.hpp:221
MoFEM::TsCtx::preProcessMonitor
BasicMethodsSequence preProcessMonitor
Definition: TsCtx.hpp:38
MoFEM::TsCtx::postProcessIFunction
BasicMethodsSequence postProcessIFunction
Definition: TsCtx.hpp:37
MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSFunction
PetscLogEvent MOFEM_EVENT_TsCtxRHSFunction
Definition: TsCtx.hpp:212
MoFEM::TsCtx::preProcessIFunction
BasicMethodsSequence preProcessIFunction
Definition: TsCtx.hpp:36
MoFEM::TsCtx::loopsIFunction
FEMethodsSequence loopsIFunction
Definition: TsCtx.hpp:30
MoFEM::TsCtx::preProcessIJacobian
BasicMethodsSequence preProcessIJacobian
Definition: TsCtx.hpp:34
MoFEM::LogManager::getStrmSelf
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
Definition: LogManager.cpp:340
MoFEM::PetscData::CtxSetTime
static constexpr Switches CtxSetTime
Definition: LoopMethods.hpp:44
MoFEM::PetscData::CtxSetNone
static constexpr Switches CtxSetNone
Definition: LoopMethods.hpp:36
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
MoFEM::TsCtx::loopsRHSFunction
FEMethodsSequence loopsRHSFunction
Definition: TsCtx.hpp:33
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSJacobian
PetscLogEvent MOFEM_EVENT_TsCtxRHSJacobian
Definition: TsCtx.hpp:213
MoFEM::PetscData::CtxSetX_TT
static constexpr Switches CtxSetX_TT
Definition: LoopMethods.hpp:43
MoFEM::TsCtx::postProcessRHSFunction
BasicMethodsSequence postProcessRHSFunction
Definition: TsCtx.hpp:43
MoFEM::PetscData::CtxSetX
static constexpr Switches CtxSetX
Definition: LoopMethods.hpp:40
MoFEM::TsCtx::MOFEM_EVENT_TsCtxI2Jacobian
PetscLogEvent MOFEM_EVENT_TsCtxI2Jacobian
Definition: TsCtx.hpp:218
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:64
MoFEM::TsCtx::postProcessRHSJacobian
BasicMethodsSequence postProcessRHSJacobian
Definition: TsCtx.hpp:42
MoFEM::TSMethod::CTX_TSSETIFUNCTION
@ CTX_TSSETIFUNCTION
Definition: LoopMethods.hpp:146
MoFEM::KspMethod::CTX_OPERATORS
@ CTX_OPERATORS
Definition: LoopMethods.hpp:76
MoFEM::PetscData::CtxSetF
static constexpr Switches CtxSetF
Definition: LoopMethods.hpp:37
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::LogManager::setLog
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:389
MoFEM::TsCtx::TsCtx
TsCtx(MoFEM::Interface &m_field, const std::string &problem_name)
Definition: TsCtx.cpp:5
MF_EXIST
@ MF_EXIST
Definition: definitions.h:113
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEM::TsCtx::preProcessRHSFunction
BasicMethodsSequence preProcessRHSFunction
Definition: TsCtx.hpp:41
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
MoFEM::TsCtx::tsDebugHook
boost::function< MoFEMErrorCode(TS ts, PetscReal t, Vec u, Vec u_t, Vec u_tt, Vec F, void *ctx)> tsDebugHook
Definition: TsCtx.hpp:47
MoFEM::TSMethod::CTX_TSSETRHSFUNCTION
@ CTX_TSSETRHSFUNCTION
Definition: LoopMethods.hpp:144
F
@ F
Definition: free_surface.cpp:396