 |
| v0.14.0
|
Interface for Time Stepping (TS) solver.
More...
#include <src/petsc/TsCtx.hpp>
|
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...
|
|
Interface for Time Stepping (TS) solver.
- Examples
- level_set.cpp, nonlinear_dynamics.cpp, and Remodeling.cpp.
Definition at line 17 of file TsCtx.hpp.
◆ BasicMethodsSequence
◆ FEMethodsSequence
◆ PairNameFEMethodPtr
◆ TsCtx()
MoFEM::TsCtx::TsCtx |
( |
MoFEM::Interface & |
m_field, |
|
|
const std::string & |
problem_name |
|
) |
| |
Definition at line 5 of file TsCtx.cpp.
17 auto core_log = logging::core::get();
◆ ~TsCtx()
virtual MoFEM::TsCtx::~TsCtx |
( |
| ) |
|
|
virtualdefault |
◆ clearLoops()
Clear loops.
- Returns
- MoFEMErrorCode
Definition at line 36 of file TsCtx.cpp.
◆ getLoopsIFunction()
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.
◆ getLoopsIJacobian()
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.
◆ getLoopsMonitor()
◆ getLoopsRHSFunction()
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.
◆ getLoopsRHSJacobian()
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.
◆ getPostProcessIFunction()
◆ getPostProcessIJacobian()
◆ getPostProcessMonitor()
◆ getPostProcessRHSFunction()
Get the postProcess to do RHSFunction object.
- Returns
- BasicMethodsSequence&
Definition at line 182 of file TsCtx.hpp.
◆ getPostProcessRHSJacobian()
Get the postProcess to do RHSJacobian object.
- Returns
- BasicMethodsSequence&
Definition at line 164 of file TsCtx.hpp.
◆ getPreProcessIFunction()
◆ getPreProcessIJacobian()
◆ getPreProcessMonitor()
Get the preProcess to do Monitor object.
- Returns
- BasicMethodsSequence&
Definition at line 141 of file TsCtx.hpp.
◆ getPreProcessRHSFunction()
Get the preProcess to do RHSFunction object.
- Returns
- BasicMethodsSequence&
Definition at line 173 of file TsCtx.hpp.
◆ getPreProcessRHSJacobian()
Get the preProcess to do RHSJacobian object.
- Returns
- BasicMethodsSequence&
Definition at line 155 of file TsCtx.hpp.
◆ TsMonitorSet
PetscErrorCode TsMonitorSet |
( |
TS |
ts, |
|
|
PetscInt |
step, |
|
|
PetscReal |
t, |
|
|
Vec |
u, |
|
|
void * |
ctx |
|
) |
| |
|
friend |
Set monitor for TS solver.
See PETSc for details
- Parameters
-
- Returns
- PetscErrorCode
Definition at line 263 of file TsCtx.cpp.
268 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
269 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
273 auto cache_ptr = boost::make_shared<CacheTuple>();
276 auto set = [&](
auto &fe) {
281 fe.ts_F = PETSC_NULL;
287 CHKERR TSGetSNES(ts, &fe.snes);
288 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
290 fe.cacheWeakPtr = cache_ptr;
294 auto unset = [&](
auto &fe) {
310 *(lit.second),
nullptr,
◆ 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
-
- Returns
- PetscErrorCode
Definition at line 620 of file TsCtx.cpp.
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);
634 auto zero_ghost_vec = [](
Vec g) {
642 for (
int i = 0;
i != s; ++
i)
645 CHKERR VecGhostRestoreLocalForm(
g, &
l);
651 auto cache_ptr = boost::make_shared<CacheTuple>();
655 #if PETSC_VERSION_GE(3, 8, 0)
656 CHKERR TSGetStepNumber(ts, &step);
658 CHKERR TSGetTimeStepNumber(ts, &step);
661 auto set = [&](
auto &fe) {
675 CHKERR TSGetSNES(ts, &fe.snes);
676 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
679 fe.cacheWeakPtr = cache_ptr;
683 auto unset = [&](
auto &fe) {
705 *(lit.second),
nullptr,
722 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
723 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
◆ 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 | |
t | time at step/stage being solved |
u | state vectora |
u_t | time derivative of state vector |
u_tt | second time derivative of state vector |
a | shift for u_t |
aa | shift for u_tt |
A | Jacobian of G(U) = F(t,U,W+v*U,W'+a*U), equivalent to dF/dU + v*dF/dU_t + a*dF/dU_tt |
B | preconditioning matrix for J, may be same as J |
ctx | TsCtx context for matrix evaluation routine |
- Returns
- PetscErrorCode
Definition at line 519 of file TsCtx.cpp.
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);
538 #if PETSC_VERSION_GE(3, 8, 0)
539 CHKERR TSGetStepNumber(ts, &step);
541 CHKERR TSGetTimeStepNumber(ts, &step);
546 auto cache_ptr = boost::make_shared<CacheTuple>();
549 auto set = [&](
auto &fe) {
567 CHKERR TSGetSNES(ts, &fe.snes);
568 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
571 fe.cacheWeakPtr = cache_ptr;
575 auto unset = [&](
auto &fe) {
596 *(lit.second),
nullptr,
613 CHKERR MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY);
614 CHKERR MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
◆ 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
-
- Returns
- PetscErrorCode
Definition at line 56 of file TsCtx.cpp.
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);
68 auto zero_ghost_vec = [](
Vec g) {
76 for (
int i = 0;
i != s; ++
i)
79 CHKERR VecGhostRestoreLocalForm(
g, &
l);
87 #if PETSC_VERSION_GE(3, 8, 0)
88 CHKERR TSGetStepNumber(ts, &step);
90 CHKERR TSGetTimeStepNumber(ts, &step);
93 auto cache_ptr = boost::make_shared<CacheTuple>();
96 auto set = [&](
auto &fe) {
109 CHKERR TSGetSNES(ts, &fe.snes);
110 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
112 fe.cacheWeakPtr = cache_ptr;
116 auto unset = [&](
auto &fe) {
138 *(lit.second),
nullptr,
155 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
156 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
◆ 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
-
- Returns
- PetscErrorCode
Definition at line 169 of file TsCtx.cpp.
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);
185 #if PETSC_VERSION_GE(3, 8, 0)
186 CHKERR TSGetStepNumber(ts, &step);
188 CHKERR TSGetTimeStepNumber(ts, &step);
193 auto cache_ptr = boost::make_shared<CacheTuple>();
196 auto set = [&](
auto &fe) {
211 CHKERR TSGetSNES(ts, &fe.snes);
212 CHKERR SNESGetKSP(fe.snes, &fe.ksp);
214 fe.cacheWeakPtr = cache_ptr;
218 auto unset = [&](
auto &fe) {
239 *(lit.second),
nullptr,
256 CHKERR MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY);
257 CHKERR MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
◆ TsSetRHSFunction
PetscErrorCode TsSetRHSFunction |
( |
TS |
ts, |
|
|
PetscReal |
t, |
|
|
Vec |
u, |
|
|
Vec |
F, |
|
|
void * |
ctx |
|
) |
| |
|
friend |
TS solver function.
See PETSc for details
- Parameters
-
- Returns
- PetscErrorCode
Definition at line 327 of file TsCtx.cpp.
331 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
332 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
336 auto zero_ghost_vec = [](
Vec g) {
344 for (
int i = 0;
i != s; ++
i)
347 CHKERR VecGhostRestoreLocalForm(
g, &
l);
353 auto cache_ptr = boost::make_shared<CacheTuple>();
357 #if PETSC_VERSION_GE(3, 8, 0)
358 CHKERR TSGetStepNumber(ts, &step);
360 CHKERR TSGetTimeStepNumber(ts, &step);
363 auto set = [&](
auto &fe) {
374 fe.cacheWeakPtr = cache_ptr;
378 auto unset = [&](
auto &fe) {
399 *(lit.second),
nullptr,
416 CHKERR VecGhostUpdateBegin(
F, ADD_VALUES, SCATTER_REVERSE);
417 CHKERR VecGhostUpdateEnd(
F, ADD_VALUES, SCATTER_REVERSE);
◆ TsSetRHSJacobian
PetscErrorCode TsSetRHSJacobian |
( |
TS |
ts, |
|
|
PetscReal |
t, |
|
|
Vec |
u, |
|
|
Mat |
A, |
|
|
Mat |
B, |
|
|
void * |
ctx |
|
) |
| |
|
friend |
TS solver function.
See PETSc for details
- Parameters
-
- Returns
- PetscErrorCode
Definition at line 430 of file TsCtx.cpp.
435 CHKERR VecGhostUpdateBegin(u, INSERT_VALUES, SCATTER_FORWARD);
436 CHKERR VecGhostUpdateEnd(u, INSERT_VALUES, SCATTER_FORWARD);
446 auto cache_ptr = boost::make_shared<CacheTuple>();
450 #if PETSC_VERSION_GE(3, 8, 0)
451 CHKERR TSGetStepNumber(ts, &step);
453 CHKERR TSGetTimeStepNumber(ts, &step);
456 auto set = [&](
auto &fe) {
468 fe.cacheWeakPtr = cache_ptr;
472 auto unset = [&](
auto &fe) {
494 *(lit.second),
nullptr,
511 CHKERR MatAssemblyBegin(B, MAT_FINAL_ASSEMBLY);
512 CHKERR MatAssemblyEnd(B, MAT_FINAL_ASSEMBLY);
◆ bH
If set to MF_EXIST check if element exist.
Definition at line 23 of file TsCtx.hpp.
◆ loopsIFunction
◆ loopsIJacobian
◆ loopsMonitor
◆ loopsRHSFunction
◆ loopsRHSJacobian
◆ matAssembleSwitch
boost::movelib::unique_ptr<bool> MoFEM::TsCtx::matAssembleSwitch |
|
private |
◆ mField
◆ moab
moab::Interface& MoFEM::TsCtx::moab |
◆ MOFEM_EVENT_TsCtxI2Function
PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxI2Function |
|
private |
◆ MOFEM_EVENT_TsCtxI2Jacobian
PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxI2Jacobian |
|
private |
◆ MOFEM_EVENT_TsCtxIFunction
PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxIFunction |
|
private |
◆ MOFEM_EVENT_TsCtxIJacobian
PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxIJacobian |
|
private |
◆ MOFEM_EVENT_TsCtxMonitor
PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxMonitor |
|
private |
◆ MOFEM_EVENT_TsCtxRHSFunction
PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSFunction |
|
private |
◆ MOFEM_EVENT_TsCtxRHSJacobian
PetscLogEvent MoFEM::TsCtx::MOFEM_EVENT_TsCtxRHSJacobian |
|
private |
◆ postProcessIFunction
◆ postProcessIJacobian
◆ postProcessMonitor
◆ postProcessRHSFunction
◆ postProcessRHSJacobian
◆ preProcessIFunction
◆ preProcessIJacobian
◆ preProcessMonitor
◆ preProcessRHSFunction
◆ preProcessRHSJacobian
◆ problemName
std::string MoFEM::TsCtx::problemName |
◆ tsDebugHook
boost::function<MoFEMErrorCode(TS ts, PetscReal t, Vec u, Vec u_t, Vec u_tt, Vec F, void *ctx)> MoFEM::TsCtx::tsDebugHook |
◆ vecAssembleSwitch
boost::movelib::unique_ptr<bool> MoFEM::TsCtx::vecAssembleSwitch |
|
private |
◆ zeroMatrix
bool MoFEM::TsCtx::zeroMatrix |
The documentation for this struct was generated from the following files:
BasicMethodsSequence preProcessRHSJacobian
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
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.
static constexpr Switches CtxSetB
static constexpr Switches CtxSetA
PetscLogEvent MOFEM_EVENT_TsCtxIJacobian
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
PetscLogEvent MOFEM_EVENT_TsCtxI2Function
PetscLogEvent MOFEM_EVENT_TsCtxIFunction
PetscLogEvent MOFEM_EVENT_TsCtxMonitor
boost::movelib::unique_ptr< bool > vecAssembleSwitch
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
FEMethodsSequence loopsIJacobian
MoFEMTypes bH
If set to MF_EXIST check if element exist.
FEMethodsSequence loopsRHSJacobian
virtual MoFEMErrorCode problem_basic_method_preProcess(const Problem *problem_ptr, BasicMethod &method, int verb=DEFAULT_VERBOSITY)=0
Set data for BasicMethod.
BasicMethodsSequence postProcessIJacobian
#define CHKERR
Inline error check.
virtual moab::Interface & get_moab()=0
MoFEM::Interface & mField
BasicMethodsSequence postProcessMonitor
FEMethodsSequence loopsMonitor
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
static constexpr Switches CtxSetX_T
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
virtual MoFEMErrorCode cache_problem_entities(const std::string prb_name, CacheTupleWeakPtr cache_ptr)=0
Cache variables.
boost::movelib::unique_ptr< bool > matAssembleSwitch
BasicMethodsSequence preProcessMonitor
BasicMethodsSequence postProcessIFunction
PetscLogEvent MOFEM_EVENT_TsCtxRHSFunction
BasicMethodsSequence preProcessIFunction
FEMethodsSequence loopsIFunction
BasicMethodsSequence preProcessIJacobian
static boost::shared_ptr< std::ostream > getStrmSelf()
Get the strm self object.
static constexpr Switches CtxSetTime
static constexpr Switches CtxSetNone
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
constexpr double t
plate stiffness
FEMethodsSequence loopsRHSFunction
FTensor::Index< 'i', SPACE_DIM > i
PetscLogEvent MOFEM_EVENT_TsCtxRHSJacobian
static constexpr Switches CtxSetX_TT
BasicMethodsSequence postProcessRHSFunction
static constexpr Switches CtxSetX
PetscLogEvent MOFEM_EVENT_TsCtxI2Jacobian
const FTensor::Tensor2< T, Dim, Dim > Vec
BasicMethodsSequence postProcessRHSJacobian
static constexpr Switches CtxSetF
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
TsCtx(MoFEM::Interface &m_field, const std::string &problem_name)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
BasicMethodsSequence preProcessRHSFunction
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
FTensor::Index< 'l', 3 > l
boost::function< MoFEMErrorCode(TS ts, PetscReal t, Vec u, Vec u_t, Vec u_tt, Vec F, void *ctx)> tsDebugHook