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

Interface for nonlinear (SNES) solver. More...

#include <src/petsc/SnesCtx.hpp>

Collaboration diagram for MoFEM::SnesCtx:
[legend]

Public Types

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

Public Member Functions

 SnesCtx (Interface &m_field, const std::string &problem_name)
 
virtual ~SnesCtx ()=default
 
FEMethodsSequencegetSetOperators ()
 
FEMethodsSequencegetComputeRhs ()
 
BasicMethodsSequencegetPreProcComputeRhs ()
 
BasicMethodsSequencegetPostProcComputeRhs ()
 
BasicMethodsSequencegetPreProcSetOperators ()
 
BasicMethodsSequencegetPostProcSetOperators ()
 
MoFEMErrorCode copyLoops (const SnesCtx &snes_ctx)
 Copy sequences from other SNES contex. More...
 
MoFEMErrorCode clearLoops ()
 Clear loops. More...
 
DEPRECATED FEMethodsSequenceget_loops_to_do_Mat ()
 
DEPRECATED FEMethodsSequenceget_loops_to_do_Rhs ()
 
DEPRECATED BasicMethodsSequenceget_preProcess_to_do_Rhs ()
 
DEPRECATED BasicMethodsSequenceget_postProcess_to_do_Rhs ()
 
DEPRECATED BasicMethodsSequenceget_preProcess_to_do_Mat ()
 
DEPRECATED BasicMethodsSequenceget_postProcess_to_do_Mat ()
 

Public Attributes

MoFEM::InterfacemField
 database Interface More...
 
moab::Interface & moab
 moab Interface More...
 
std::string problemName
 problem name More...
 
MoFEMTypes bH
 If set to MF_EXIST check if element exist, default MF_EXIST. More...
 
bool zeroPreCondMatrixB
 
MatAssemblyType typeOfAssembly
 type of assembly at the end More...
 
bool vErify
 If true verify vector. More...
 
FEMethodsSequence loops_to_do_Mat
 
FEMethodsSequence loops_to_do_Rhs
 
BasicMethodsSequence preProcess_Mat
 
BasicMethodsSequence postProcess_Mat
 
BasicMethodsSequence preProcess_Rhs
 Sequence of methods run before residual is assembled. More...
 
BasicMethodsSequence postProcess_Rhs
 Sequence of methods run after residual is assembled. More...
 

Private Attributes

boost::movelib::unique_ptr< boolvecAssembleSwitch
 
boost::movelib::unique_ptr< boolmatAssembleSwitch
 
PetscLogEvent MOFEM_EVENT_SnesRhs
 Log events to assemble residual. More...
 
PetscLogEvent MOFEM_EVENT_SnesMat
 Log events to assemble tangent matrix. More...
 

Friends

PetscErrorCode SnesRhs (SNES snes, Vec x, Vec f, void *ctx)
 This is MoFEM implementation for the right hand side (residual vector) evaluation in SNES solver. More...
 
PetscErrorCode SnesMat (SNES snes, Vec x, Mat A, Mat B, void *ctx)
 This is MoFEM implementation for the left hand side (tangent matrix) evaluation in SNES solver. More...
 
MoFEMErrorCode SNESMoFEMSetAssmblyType (SNES snes, MatAssemblyType type)
 
MoFEMErrorCode SnesMoFEMSetBehavior (SNES snes, MoFEMTypes bh)
 Set behavior if finite element in sequence does not exist. More...
 

Detailed Description

Interface for nonlinear (SNES) solver.

Examples
testing_jacobian_of_hook_element.cpp, and testing_jacobian_of_hook_scaled_with_density_element.cpp.

Definition at line 13 of file SnesCtx.hpp.

Member Typedef Documentation

◆ BasicMethodsSequence

Definition at line 28 of file SnesCtx.hpp.

◆ FEMethodsSequence

Definition at line 27 of file SnesCtx.hpp.

◆ PairNameFEMethodPtr

Definition at line 26 of file SnesCtx.hpp.

Constructor & Destructor Documentation

◆ SnesCtx()

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

Definition at line 43 of file SnesCtx.hpp.

44 : mField(m_field), moab(m_field.get_moab()), problemName(problem_name),
46 typeOfAssembly(MAT_FINAL_ASSEMBLY), vErify(false) {
47 PetscLogEventRegister("LoopSNESRhs", 0, &MOFEM_EVENT_SnesRhs);
48 PetscLogEventRegister("LoopSNESMat", 0, &MOFEM_EVENT_SnesMat);
49 if (!LogManager::checkIfChannelExist("SNES_WORLD")) {
50 auto core_log = logging::core::get();
51 core_log->add_sink(
53 LogManager::setLog("SNES_WORLD");
54 MOFEM_LOG_TAG("SNES_WORLD", "SNES");
55 }
56 }
@ 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
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 bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:404
PetscLogEvent MOFEM_EVENT_SnesMat
Log events to assemble tangent matrix.
Definition: SnesCtx.hpp:158
MoFEMTypes bH
If set to MF_EXIST check if element exist, default MF_EXIST.
Definition: SnesCtx.hpp:20
moab::Interface & moab
moab Interface
Definition: SnesCtx.hpp:16
MatAssemblyType typeOfAssembly
type of assembly at the end
Definition: SnesCtx.hpp:23
bool zeroPreCondMatrixB
Definition: SnesCtx.hpp:21
bool vErify
If true verify vector.
Definition: SnesCtx.hpp:24
std::string problemName
problem name
Definition: SnesCtx.hpp:18
MoFEM::Interface & mField
database Interface
Definition: SnesCtx.hpp:15
PetscLogEvent MOFEM_EVENT_SnesRhs
Log events to assemble residual.
Definition: SnesCtx.hpp:157

◆ ~SnesCtx()

virtual MoFEM::SnesCtx::~SnesCtx ( )
virtualdefault

Member Function Documentation

◆ clearLoops()

MoFEMErrorCode SnesCtx::clearLoops ( )

Clear loops.

Returns
MoFEMErrorCode

Definition at line 16 of file SnesCtx.cpp.

16 {
18 loops_to_do_Mat.clear();
19 loops_to_do_Rhs.clear();
20 preProcess_Mat.clear();
21 postProcess_Mat.clear();
22 preProcess_Rhs.clear();
23 postProcess_Rhs.clear();
25}
#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
BasicMethodsSequence preProcess_Rhs
Sequence of methods run before residual is assembled.
Definition: SnesCtx.hpp:39
BasicMethodsSequence postProcess_Mat
Definition: SnesCtx.hpp:36
BasicMethodsSequence postProcess_Rhs
Sequence of methods run after residual is assembled.
Definition: SnesCtx.hpp:41
BasicMethodsSequence preProcess_Mat
Definition: SnesCtx.hpp:34
FEMethodsSequence loops_to_do_Mat
Definition: SnesCtx.hpp:30
FEMethodsSequence loops_to_do_Rhs
Definition: SnesCtx.hpp:32

◆ copyLoops()

MoFEMErrorCode SnesCtx::copyLoops ( const SnesCtx snes_ctx)

Copy sequences from other SNES contex.

Parameters
snes_ctxSNES contex from which Sequence is copied from
Returns
error code

Definition at line 5 of file SnesCtx.cpp.

5 {
7 loops_to_do_Mat = snes_ctx.loops_to_do_Mat;
8 loops_to_do_Rhs = snes_ctx.loops_to_do_Rhs;
9 preProcess_Mat = snes_ctx.preProcess_Mat;
10 postProcess_Mat = snes_ctx.postProcess_Mat;
11 preProcess_Rhs = snes_ctx.preProcess_Rhs;
12 postProcess_Rhs = snes_ctx.postProcess_Rhs;
14}

◆ get_loops_to_do_Mat()

DEPRECATED FEMethodsSequence & MoFEM::SnesCtx::get_loops_to_do_Mat ( )
inline
Deprecated:
use getSetOperators

Definition at line 125 of file SnesCtx.hpp.

125 {
126 return getSetOperators();
127 }
FEMethodsSequence & getSetOperators()
Definition: SnesCtx.hpp:64

◆ get_loops_to_do_Rhs()

DEPRECATED FEMethodsSequence & MoFEM::SnesCtx::get_loops_to_do_Rhs ( )
inline
Deprecated:
use getComputeRhs

Definition at line 130 of file SnesCtx.hpp.

130 {
131 return getComputeRhs();
132 }
FEMethodsSequence & getComputeRhs()
Definition: SnesCtx.hpp:69

◆ get_postProcess_to_do_Mat()

DEPRECATED BasicMethodsSequence & MoFEM::SnesCtx::get_postProcess_to_do_Mat ( )
inline
Deprecated:
use getPostProcSetOperators

Definition at line 150 of file SnesCtx.hpp.

150 {
152 }
BasicMethodsSequence & getPostProcSetOperators()
Definition: SnesCtx.hpp:101

◆ get_postProcess_to_do_Rhs()

DEPRECATED BasicMethodsSequence & MoFEM::SnesCtx::get_postProcess_to_do_Rhs ( )
inline
Deprecated:
use getPostProcComputeRhs

Definition at line 140 of file SnesCtx.hpp.

140 {
141 return getPostProcComputeRhs();
142 }
BasicMethodsSequence & getPostProcComputeRhs()
Definition: SnesCtx.hpp:87

◆ get_preProcess_to_do_Mat()

DEPRECATED BasicMethodsSequence & MoFEM::SnesCtx::get_preProcess_to_do_Mat ( )
inline
Deprecated:
use getPreProcSetOperators

Definition at line 145 of file SnesCtx.hpp.

145 {
146 return getPreProcSetOperators();
147 }
BasicMethodsSequence & getPreProcSetOperators()
Definition: SnesCtx.hpp:92

◆ get_preProcess_to_do_Rhs()

DEPRECATED BasicMethodsSequence & MoFEM::SnesCtx::get_preProcess_to_do_Rhs ( )
inline
Deprecated:
use getPreProcComputeRhs

Definition at line 135 of file SnesCtx.hpp.

135 {
136 return getPreProcComputeRhs();
137 }
BasicMethodsSequence & getPreProcComputeRhs()
Definition: SnesCtx.hpp:78

◆ getComputeRhs()

FEMethodsSequence & MoFEM::SnesCtx::getComputeRhs ( )
inline
Returns
return vector to vector with FEMethod to calculate residual

Definition at line 69 of file SnesCtx.hpp.

69{ return loops_to_do_Rhs; }

◆ getPostProcComputeRhs()

BasicMethodsSequence & MoFEM::SnesCtx::getPostProcComputeRhs ( )
inline

The sequence of BasicMethod is executed after residual is calculated. It can be used to setup data structures, e.g. aggregate data from processors or to apply essential boundary conditions.

Returns
reference to BasicMethod for postprocessing

Definition at line 87 of file SnesCtx.hpp.

87{ return postProcess_Rhs; }

◆ getPostProcSetOperators()

BasicMethodsSequence & MoFEM::SnesCtx::getPostProcSetOperators ( )
inline

The sequence of BasicMethod is executed after tangent matrix is calculated. It can be used to setup data structures, e.g. aggregate data from processors or to apply essential boundary conditions.

Returns
reference to BasicMethod for postprocessing

Definition at line 101 of file SnesCtx.hpp.

101{ return postProcess_Mat; }

◆ getPreProcComputeRhs()

BasicMethodsSequence & MoFEM::SnesCtx::getPreProcComputeRhs ( )
inline

The sequence of BasicMethod is executed before residual is calculated. It can be used to setup data structures, e.g. zero global variable which is integrated in domain, e.g. for calculation of strain energy.

Returns
reference to BasicMethod for preprocessing

Definition at line 78 of file SnesCtx.hpp.

78{ return preProcess_Rhs; }

◆ getPreProcSetOperators()

BasicMethodsSequence & MoFEM::SnesCtx::getPreProcSetOperators ( )
inline
Returns
reference to BasicMethod for preprocessing

Definition at line 92 of file SnesCtx.hpp.

92{ return preProcess_Mat; }

◆ getSetOperators()

FEMethodsSequence & MoFEM::SnesCtx::getSetOperators ( )
inline
Returns
return reference to vector with FEMethod to calculate tangent matrix

Definition at line 64 of file SnesCtx.hpp.

64{ return loops_to_do_Mat; }

Friends And Related Function Documentation

◆ SnesMat

PetscErrorCode SnesMat ( SNES  snes,
Vec  x,
Mat  A,
Mat  B,
void *  ctx 
)
friend

This is MoFEM implementation for the left hand side (tangent matrix) evaluation in SNES solver.

For more information pleas look to PETSc manual, i.e. SNESSetJacobian http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetJacobian.html#SNESSetJacobian

Parameters
snesSNES solver
xSolution vector at current iteration
ATangent matrix
BPreconditioner tangent matrix
ctxPointer to context i.e. SnesCtx
Returns
Error code

Definition at line 139 of file SnesCtx.cpp.

139 {
140 SnesCtx *snes_ctx = (SnesCtx *)ctx;
141 // PetscValidHeaderSpecific(snes,SNES_CLASSID,1);
143 PetscLogEventBegin(snes_ctx->MOFEM_EVENT_SnesMat, 0, 0, 0, 0);
144 if (snes_ctx->zeroPreCondMatrixB)
145 CHKERR MatZeroEntries(B);
146
147 snes_ctx->matAssembleSwitch = boost::movelib::make_unique<bool>(true);
148 auto cache_ptr = boost::make_shared<CacheTuple>();
149 CHKERR snes_ctx->mField.cache_problem_entities(snes_ctx->problemName,
150 cache_ptr);
151
152 auto set = [&](auto &fe) {
153 fe.snes = snes;
154 fe.snes_x = x;
155 fe.snes_A = A;
156 fe.snes_B = B;
158 fe.ksp_ctx = KspMethod::CTX_OPERATORS;
160
161 CHKERR SNESGetKSP(snes, &fe.ksp);
162
163 fe.cacheWeakPtr = cache_ptr;
164 };
165
166 auto unset = [&](auto &fe) {
167 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
168 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
169 fe.data_ctx = PetscData::CtxSetNone;
170 };
171
172
173 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
174 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
175 CHKERR snes_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
176 snes_ctx->problemName, COL, x, INSERT_VALUES, SCATTER_REVERSE);
177 for (auto &bit : snes_ctx->preProcess_Mat) {
178 bit->matAssembleSwitch = boost::move(snes_ctx->matAssembleSwitch);
179 set(*bit);
180 CHKERR snes_ctx->mField.problem_basic_method_preProcess(
181 snes_ctx->problemName, *bit);
182 unset(*bit);
183 snes_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
184 }
185
186
187
188 for (auto &lit : snes_ctx->loops_to_do_Mat) {
189 lit.second->matAssembleSwitch = boost::move(snes_ctx->matAssembleSwitch);
190 set(*lit.second);
191 CHKERR snes_ctx->mField.loop_finite_elements(
192 snes_ctx->problemName, lit.first, *(lit.second), nullptr, snes_ctx->bH,
193 cache_ptr);
194 unset(*lit.second);
195 snes_ctx->matAssembleSwitch = boost::move(lit.second->matAssembleSwitch);
196 }
197
198 for (auto &bit : snes_ctx->postProcess_Mat) {
199 bit->matAssembleSwitch = boost::move(snes_ctx->matAssembleSwitch);
200 set(*bit);
201 CHKERR snes_ctx->mField.problem_basic_method_postProcess(
202 snes_ctx->problemName, *bit);
203 unset(*bit);
204 snes_ctx->matAssembleSwitch = boost::move(bit->matAssembleSwitch);
205 }
206
207 if (*snes_ctx->matAssembleSwitch) {
208 CHKERR MatAssemblyBegin(B, snes_ctx->typeOfAssembly);
209 CHKERR MatAssemblyEnd(B, snes_ctx->typeOfAssembly);
210 }
211 PetscLogEventEnd(snes_ctx->MOFEM_EVENT_SnesMat, 0, 0, 0, 0);
213}
@ COL
Definition: definitions.h:123
#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
auto bit
set bit
constexpr AssemblyType A
static constexpr Switches CtxSetA
Definition: LoopMethods.hpp:37
static constexpr Switches CtxSetX
Definition: LoopMethods.hpp:39
static constexpr Switches CtxSetNone
Definition: LoopMethods.hpp:35
static constexpr Switches CtxSetB
Definition: LoopMethods.hpp:38

◆ SNESMoFEMSetAssmblyType

MoFEMErrorCode SNESMoFEMSetAssmblyType ( SNES  snes,
MatAssemblyType  type 
)
friend

◆ SnesMoFEMSetBehavior

MoFEMErrorCode SnesMoFEMSetBehavior ( SNES  snes,
MoFEMTypes  bh 
)
friend

Set behavior if finite element in sequence does not exist.

Parameters
snes
bhIf set to MF_EXIST check if element exist, default MF_EXIST. Otherwise set MF_ZERO
Returns
error code

Definition at line 224 of file SnesCtx.cpp.

224 {
225 SnesCtx *snes_ctx;
227 CHKERR SNESGetApplicationContext(snes, &snes_ctx);
228 snes_ctx->bH = bh;
230}

◆ SnesRhs

PetscErrorCode SnesRhs ( SNES  snes,
Vec  x,
Vec  f,
void *  ctx 
)
friend

This is MoFEM implementation for the right hand side (residual vector) evaluation in SNES solver.

For more information pleas look to PETSc manual, i.e. SNESSetFunction http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESSetFunction.html

Parameters
snesSNES solver
xSolution vector at current iteration
fThe right hand side vector
ctxPointer to context i.e. SnesCtx
Returns
Error code

Definition at line 27 of file SnesCtx.cpp.

27 {
28 SnesCtx *snes_ctx = (SnesCtx *)ctx;
29 // PetscValidHeaderSpecific(snes,SNES_CLASSID,1);
31 PetscLogEventBegin(snes_ctx->MOFEM_EVENT_SnesRhs, 0, 0, 0, 0);
32 CHKERR VecGhostUpdateBegin(x, INSERT_VALUES, SCATTER_FORWARD);
33 CHKERR VecGhostUpdateEnd(x, INSERT_VALUES, SCATTER_FORWARD);
34 if (snes_ctx->vErify) {
35 // Verify finite elements, check for not a number
36 CHKERR VecAssemblyBegin(f);
37 CHKERR VecAssemblyEnd(f);
38 MPI_Comm comm = PetscObjectComm((PetscObject)f);
39 PetscSynchronizedPrintf(comm, "SNES Verify x\n");
40 const Problem *prb_ptr;
41 CHKERR snes_ctx->mField.get_problem(snes_ctx->problemName, &prb_ptr);
42 CHKERR snes_ctx->mField.getInterface<Tools>()->checkVectorForNotANumber(
43 prb_ptr, COL, x);
44 }
45 CHKERR snes_ctx->mField.getInterface<VecManager>()->setLocalGhostVector(
46 snes_ctx->problemName, COL, x, INSERT_VALUES, SCATTER_REVERSE);
47
48 auto zero_ghost_vec = [](Vec g) {
50 Vec l;
51 CHKERR VecGhostGetLocalForm(g, &l);
52 double *a;
53 CHKERR VecGetArray(l, &a);
54 int s;
55 CHKERR VecGetLocalSize(l, &s);
56 for (int i = 0; i != s; ++i)
57 a[i] = 0;
58 CHKERR VecRestoreArray(l, &a);
59 CHKERR VecGhostRestoreLocalForm(g, &l);
61 };
62 CHKERR zero_ghost_vec(f);
63
64 snes_ctx->vecAssembleSwitch = boost::movelib::make_unique<bool>(true);
65 auto cache_ptr = boost::make_shared<CacheTuple>();
66 CHKERR snes_ctx->mField.cache_problem_entities(snes_ctx->problemName,
67 cache_ptr);
68
69 auto set = [&](auto &fe) {
70 fe.snes = snes;
71 fe.snes_x = x;
72 fe.snes_f = f;
74 fe.ksp_ctx = KspMethod::CTX_SETFUNCTION;
76
77 CHKERR SNESGetKSP(snes, &fe.ksp);
78
79 fe.cacheWeakPtr = cache_ptr;
80 };
81
82 auto unset = [&](auto &fe) {
83 fe.snes_ctx = SnesMethod::CTX_SNESNONE;
84 fe.ksp_ctx = KspMethod::CTX_KSPNONE;
85 fe.data_ctx = PetscData::CtxSetNone;
86 };
87
88 for (auto &bit : snes_ctx->preProcess_Rhs) {
89 bit->vecAssembleSwitch = boost::move(snes_ctx->vecAssembleSwitch);
90 set(*bit);
91 CHKERR snes_ctx->mField.problem_basic_method_preProcess(
92 snes_ctx->problemName, *bit);
93 unset(*bit);
94 snes_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
95 }
96
97 for (auto &lit : snes_ctx->loops_to_do_Rhs) {
98 lit.second->vecAssembleSwitch = boost::move(snes_ctx->vecAssembleSwitch);
99 set(*lit.second);
100 CHKERR snes_ctx->mField.loop_finite_elements(
101 snes_ctx->problemName, lit.first, *lit.second, nullptr, snes_ctx->bH,
102 cache_ptr);
103 unset(*lit.second);
104 if (snes_ctx->vErify) {
105 // Verify finite elements, check for not a number
106 CHKERR VecAssemblyBegin(f);
107 CHKERR VecAssemblyEnd(f);
108 MPI_Comm comm = PetscObjectComm((PetscObject)f);
109 PetscSynchronizedPrintf(comm, "SNES Verify f FE < %s >\n",
110 lit.first.c_str());
111 const Problem *prb_ptr;
112 CHKERR snes_ctx->mField.get_problem(snes_ctx->problemName, &prb_ptr);
113 CHKERR snes_ctx->mField.getInterface<Tools>()->checkVectorForNotANumber(
114 prb_ptr, ROW, f);
115 }
116
117 snes_ctx->vecAssembleSwitch = boost::move(lit.second->vecAssembleSwitch);
118 }
119
120 for (auto &bit : snes_ctx->postProcess_Rhs) {
121 bit->vecAssembleSwitch = boost::move(snes_ctx->vecAssembleSwitch);
122 set(*bit);
123 CHKERR snes_ctx->mField.problem_basic_method_postProcess(
124 snes_ctx->problemName, *bit);
125 unset(*bit);
126 snes_ctx->vecAssembleSwitch = boost::move(bit->vecAssembleSwitch);
127 }
128
129 if (*(snes_ctx->vecAssembleSwitch)) {
130 CHKERR VecGhostUpdateBegin(f, ADD_VALUES, SCATTER_REVERSE);
131 CHKERR VecGhostUpdateEnd(f, ADD_VALUES, SCATTER_REVERSE);
132 CHKERR VecAssemblyBegin(f);
133 CHKERR VecAssemblyEnd(f);
134 }
135 PetscLogEventEnd(snes_ctx->MOFEM_EVENT_SnesRhs, 0, 0, 0, 0);
137}
constexpr double a
@ ROW
Definition: definitions.h:123
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
const FTensor::Tensor2< T, Dim, Dim > Vec
constexpr double g
static constexpr Switches CtxSetF
Definition: LoopMethods.hpp:36

Member Data Documentation

◆ bH

MoFEMTypes MoFEM::SnesCtx::bH

If set to MF_EXIST check if element exist, default MF_EXIST.

Definition at line 20 of file SnesCtx.hpp.

◆ loops_to_do_Mat

FEMethodsSequence MoFEM::SnesCtx::loops_to_do_Mat

Sequence of finite elements instances assembling tangent matrix

Definition at line 30 of file SnesCtx.hpp.

◆ loops_to_do_Rhs

FEMethodsSequence MoFEM::SnesCtx::loops_to_do_Rhs

Sequence of finite elements instances assembling residual vector

Definition at line 32 of file SnesCtx.hpp.

◆ matAssembleSwitch

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

Definition at line 156 of file SnesCtx.hpp.

◆ mField

MoFEM::Interface& MoFEM::SnesCtx::mField

database Interface

Definition at line 15 of file SnesCtx.hpp.

◆ moab

moab::Interface& MoFEM::SnesCtx::moab

moab Interface

Definition at line 16 of file SnesCtx.hpp.

◆ MOFEM_EVENT_SnesMat

PetscLogEvent MoFEM::SnesCtx::MOFEM_EVENT_SnesMat
private

Log events to assemble tangent matrix.

Definition at line 158 of file SnesCtx.hpp.

◆ MOFEM_EVENT_SnesRhs

PetscLogEvent MoFEM::SnesCtx::MOFEM_EVENT_SnesRhs
private

Log events to assemble residual.

Definition at line 157 of file SnesCtx.hpp.

◆ postProcess_Mat

BasicMethodsSequence MoFEM::SnesCtx::postProcess_Mat

Sequence of methods run after tangent matrix is assembled

Definition at line 36 of file SnesCtx.hpp.

◆ postProcess_Rhs

BasicMethodsSequence MoFEM::SnesCtx::postProcess_Rhs

Sequence of methods run after residual is assembled.

Definition at line 41 of file SnesCtx.hpp.

◆ preProcess_Mat

BasicMethodsSequence MoFEM::SnesCtx::preProcess_Mat

Sequence of methods run before tangent matrix is assembled

Definition at line 34 of file SnesCtx.hpp.

◆ preProcess_Rhs

BasicMethodsSequence MoFEM::SnesCtx::preProcess_Rhs

Sequence of methods run before residual is assembled.

Definition at line 39 of file SnesCtx.hpp.

◆ problemName

std::string MoFEM::SnesCtx::problemName

problem name

Definition at line 18 of file SnesCtx.hpp.

◆ typeOfAssembly

MatAssemblyType MoFEM::SnesCtx::typeOfAssembly

type of assembly at the end

Definition at line 23 of file SnesCtx.hpp.

◆ vecAssembleSwitch

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

Definition at line 155 of file SnesCtx.hpp.

◆ vErify

bool MoFEM::SnesCtx::vErify

If true verify vector.

Definition at line 24 of file SnesCtx.hpp.

◆ zeroPreCondMatrixB

bool MoFEM::SnesCtx::zeroPreCondMatrixB

If true zero matrix, otherwise user need to do it, default true

Definition at line 21 of file SnesCtx.hpp.


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