v0.16.3
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MixedPoisson Struct Reference
Collaboration diagram for MixedPoisson:
[legend]

Classes

struct  CommonData
 
struct  OpError
 

Public Member Functions

 MixedPoisson (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 [Run programme]
 

Private Member Functions

MoFEMErrorCode readMesh ()
 [Run programme]
 
MoFEMErrorCode setupProblem ()
 [Read mesh]
 
MoFEMErrorCode setIntegrationRules ()
 [Set up problem]
 
MoFEMErrorCode createCommonData ()
 [Set integration rule]
 
MoFEMErrorCode assembleSystem ()
 [Create common data]
 
MoFEMErrorCode solveSystem ()
 [Assemble system]
 
MoFEMErrorCode checkError (int iter_num=0)
 [Solve and refine loop]
 
MoFEMErrorCode refineOrder (int iter_num=0)
 [Solve]
 
MoFEMErrorCode solveRefineLoop ()
 [Refine]
 
MoFEMErrorCode outputResults (int iter_num=0)
 [Check error]
 

Static Private Member Functions

static double analyticalFunction (const double x, const double y, const double z)
 [Analytical function]
 
static VectorDouble analyticalFunctionGrad (const double x, const double y, const double z)
 [Analytical function]
 
static double sourceFunction (const double x, const double y, const double z)
 [Analytical function gradient]
 
static MoFEMErrorCode getTagHandle (MoFEM::Interface &m_field, const char *name, DataType type, Tag &tag_handle)
 [Source function]
 

Private Attributes

MoFEM::Interface & mField
 
Simple * simpleInterface
 
Range domainEntities
 
double totErrorIndicator
 
double maxErrorIndicator
 
double thetaParam
 
double indicTolerance
 
int initOrder
 
boost::shared_ptr< CommonData > commonDataPtr
 

Detailed Description

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 31 of file mixed_poisson.cpp.

Constructor & Destructor Documentation

◆ MixedPoisson()

MixedPoisson::MixedPoisson ( MoFEM::Interface &  m_field)
inline

Definition at line 33 of file mixed_poisson.cpp.

33: mField(m_field) {}
MoFEM::Interface & mField

Member Function Documentation

◆ analyticalFunction()

static double MixedPoisson::analyticalFunction ( const double  x,
const double  y,
const double  z 
)
inlinestaticprivate

[Analytical function]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 49 of file mixed_poisson.cpp.

50 {
51 return exp(-100. * (sqr(x) + sqr(y))) * cos(M_PI * x) * cos(M_PI * y);
52 }
double sqr(double x)

◆ analyticalFunctionGrad()

static VectorDouble MixedPoisson::analyticalFunctionGrad ( const double  x,
const double  y,
const double  z 
)
inlinestaticprivate

[Analytical function]

[Analytical function gradient]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 56 of file mixed_poisson.cpp.

57 {
58 VectorDouble res;
59 res.resize(2);
60 res[0] = -exp(-100. * (sqr(x) + sqr(y))) *
61 (200. * x * cos(M_PI * x) + M_PI * sin(M_PI * x)) * cos(M_PI * y);
62 res[1] = -exp(-100. * (sqr(x) + sqr(y))) *
63 (200. * y * cos(M_PI * y) + M_PI * sin(M_PI * y)) * cos(M_PI * x);
64 return res;
65 }

◆ assembleSystem()

MoFEMErrorCode MixedPoisson::assembleSystem ( )
private

[Create common data]

[Assemble system]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 239 of file mixed_poisson.cpp.

239 {
242 pipeline_mng->getDomainLhsFE().reset();
243 pipeline_mng->getDomainRhsFE().reset();
244 pipeline_mng->getOpDomainRhsPipeline().clear();
245 pipeline_mng->getOpDomainLhsPipeline().clear();
246
248
249 auto beta = [](const double, const double, const double) { return 1; };
250 pipeline_mng->getOpDomainLhsPipeline().push_back(
251 new OpHdivHdiv("Q", "Q", beta));
252 auto unity = []() { return 1; };
253 pipeline_mng->getOpDomainLhsPipeline().push_back(
254 new OpHdivU("Q", "U", unity, true));
255 auto source = [&](const double x, const double y, const double z) {
256 return -sourceFunction(x, y, z);
257 };
258 pipeline_mng->getOpDomainRhsPipeline().push_back(
259 new OpDomainSource("U", source));
261}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
boost::ptr_deque< UserDataOperator > & getOpDomainLhsPipeline()
Get the Op Domain Lhs Pipeline object.
boost::ptr_deque< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 3, 2 > OpHdivHdiv
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMixDivTimesScalar< 2 > OpHdivU
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, 1 > OpDomainSource
static double sourceFunction(const double x, const double y, const double z)
[Analytical function gradient]
Add operators pushing bases from local to physical configuration.
PipelineManager interface.
boost::shared_ptr< FEMethod > & getDomainRhsFE()
Get domain right-hand side finite element.
boost::shared_ptr< FEMethod > & getDomainLhsFE()
Get domain left-hand side finite element.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ checkError()

MoFEMErrorCode MixedPoisson::checkError ( int  iter_num = 0)
private

[Solve and refine loop]

[Check error]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 373 of file mixed_poisson.cpp.

373 {
376 pipeline_mng->getOpDomainPostProcPipeline().clear();
377
379 {HDIV, L2});
380
381 pipeline_mng->getOpDomainPostProcPipeline().push_back(
382 new OpCalculateScalarFieldValues("U", commonDataPtr->approxVals));
383 pipeline_mng->getOpDomainPostProcPipeline().push_back(
385 commonDataPtr->approxValsGrad));
386 pipeline_mng->getOpDomainPostProcPipeline().push_back(
387 new OpCalculateHVecVectorField<3>("Q", commonDataPtr->approxFlux));
388 pipeline_mng->getOpDomainPostProcPipeline().push_back(
390
391 commonDataPtr->maxErrorIndicator = 0;
392 CHKERR VecZeroEntries(commonDataPtr->petscVec);
393 CHKERR pipeline_mng->loopFiniteElementsPostProc();
394 CHKERR VecAssemblyBegin(commonDataPtr->petscVec);
395 CHKERR VecAssemblyEnd(commonDataPtr->petscVec);
396 CHKERR VecGhostUpdateBegin(commonDataPtr->petscVec, INSERT_VALUES,
397 SCATTER_FORWARD);
398 CHKERR VecGhostUpdateEnd(commonDataPtr->petscVec, INSERT_VALUES,
399 SCATTER_FORWARD);
400
401 MPI_Allreduce(&commonDataPtr->maxErrorIndicator, &maxErrorIndicator, 1,
402 MPI_DOUBLE, MPI_MAX, mField.get_comm());
403
404 const double *array;
405 CHKERR VecGetArrayRead(commonDataPtr->petscVec, &array);
406 MOFEM_LOG("EXAMPLE", Sev::inform)
407 << "Global error indicator (max): " << commonDataPtr->maxErrorIndicator;
408 MOFEM_LOG("EXAMPLE", Sev::inform)
409 << "Global error indicator (total): "
410 << std::sqrt(array[CommonData::ERROR_INDICATOR_TOTAL]);
411 MOFEM_LOG("EXAMPLE", Sev::inform)
412 << "Global error L2 norm: "
413 << std::sqrt(array[CommonData::ERROR_L2_NORM]);
414 MOFEM_LOG("EXAMPLE", Sev::inform)
415 << "Global error H1 seminorm: "
416 << std::sqrt(array[CommonData::ERROR_H1_SEMINORM]);
417
419 CHKERR VecRestoreArrayRead(commonDataPtr->petscVec, &array);
420
421 std::vector<Tag> tag_handles;
422 tag_handles.resize(4);
423 CHKERR getTagHandle(mField, "ERROR_L2_NORM", MB_TYPE_DOUBLE, tag_handles[0]);
424 CHKERR getTagHandle(mField, "ERROR_H1_SEMINORM", MB_TYPE_DOUBLE,
425 tag_handles[1]);
426 CHKERR getTagHandle(mField, "ERROR_INDICATOR", MB_TYPE_DOUBLE,
427 tag_handles[2]);
428 CHKERR getTagHandle(mField, "ORDER", MB_TYPE_INTEGER, tag_handles[3]);
429
430 ParallelComm *pcomm =
431 ParallelComm::get_pcomm(&mField.get_moab(), MYPCOMM_INDEX);
432 if (pcomm == NULL)
433 SETERRQ(PETSC_COMM_WORLD, MOFEM_DATA_INCONSISTENCY, "Communicator not set");
434
435 tag_handles.push_back(pcomm->part_tag());
436 std::ostringstream strm;
437 strm << "error_" << iter_num << ".h5m";
438 CHKERR mField.get_moab().write_file(strm.str().c_str(), "MOAB",
439 "PARALLEL=WRITE_PART", 0, 0,
440 tag_handles.data(), tag_handles.size());
442}
#define MYPCOMM_INDEX
default communicator number PCOMM
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
boost::ptr_deque< UserDataOperator > & getOpDomainPostProcPipeline()
Get the Op Domain PostProc Pipeline object.
MoFEMErrorCode loopFiniteElementsPostProc(SmartPetscObj< DM > dm=nullptr)
Iterate postprocessing finite elements.
#define MOFEM_LOG(channel, severity)
Log.
double totErrorIndicator
double maxErrorIndicator
boost::shared_ptr< CommonData > commonDataPtr
static MoFEMErrorCode getTagHandle(MoFEM::Interface &m_field, const char *name, DataType type, Tag &tag_handle)
[Source function]
virtual moab::Interface & get_moab()=0
virtual MPI_Comm & get_comm() const =0
Get vector field for H-div approximation.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Specialization for double precision scalar field values calculation.

◆ createCommonData()

MoFEMErrorCode MixedPoisson::createCommonData ( )
private

[Set integration rule]

[Create common data]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 221 of file mixed_poisson.cpp.

221 {
223 commonDataPtr = boost::make_shared<CommonData>();
224 PetscInt ghosts[3] = {0, 1, 2};
225 if (!mField.get_comm_rank())
226 commonDataPtr->petscVec =
227 createGhostVector(mField.get_comm(), 3, 3, 0, ghosts);
228 else
229 commonDataPtr->petscVec =
230 createGhostVector(mField.get_comm(), 0, 3, 3, ghosts);
231 commonDataPtr->approxVals = boost::make_shared<VectorDouble>();
232 commonDataPtr->approxValsGrad = boost::make_shared<MatrixDouble>();
233 commonDataPtr->approxFlux = boost::make_shared<MatrixDouble>();
235}
auto createGhostVector(MPI_Comm comm, PetscInt n, PetscInt N, PetscInt nghost, const PetscInt ghosts[])
Create smart ghost vector.
virtual int get_comm_rank() const =0

◆ getTagHandle()

static MoFEMErrorCode MixedPoisson::getTagHandle ( MoFEM::Interface &  m_field,
const char *  name,
DataType  type,
Tag &  tag_handle 
)
inlinestaticprivate

[Source function]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 79 of file mixed_poisson.cpp.

81 {
83 int int_val = 0;
84 double double_val = 0;
85 switch (type) {
86 case MB_TYPE_INTEGER:
87 CHKERR m_field.get_moab().tag_get_handle(
88 name, 1, type, tag_handle, MB_TAG_CREAT | MB_TAG_SPARSE, &int_val);
89 break;
90 case MB_TYPE_DOUBLE:
91 CHKERR m_field.get_moab().tag_get_handle(
92 name, 1, type, tag_handle, MB_TAG_CREAT | MB_TAG_SPARSE, &double_val);
93 break;
94 default:
95 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
96 "Wrong data type %d for tag", type);
97 }
99 }
std::string type
std::string name

◆ outputResults()

MoFEMErrorCode MixedPoisson::outputResults ( int  iter_num = 0)
private

[Check error]

[Output results]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 446 of file mixed_poisson.cpp.

446 {
449
451
452 auto post_proc_fe = boost::make_shared<PostProcEle>(mField);
453
454 CHKERR AddHOOps<2, 2, 2>::add(post_proc_fe->getOpPtrVector(), {HDIV});
455
456 auto u_ptr = boost::make_shared<VectorDouble>();
457 auto flux_ptr = boost::make_shared<MatrixDouble>();
458 post_proc_fe->getOpPtrVector().push_back(
459 new OpCalculateScalarFieldValues("U", u_ptr));
460 post_proc_fe->getOpPtrVector().push_back(
461 new OpCalculateHVecVectorField<3>("Q", flux_ptr));
462
464
465 post_proc_fe->getOpPtrVector().push_back(
466
467 new OpPPMap(post_proc_fe->getPostProcMesh(),
468 post_proc_fe->getMapGaussPts(),
469
470 OpPPMap::DataMapVec{{"U", u_ptr}},
471
472 OpPPMap::DataMapMat{{"Q", flux_ptr}},
473
475
477
478 )
479
480 );
481
482 pipeline_mng->getDomainPostProcFE() = post_proc_fe;
483 CHKERR pipeline_mng->loopFiniteElementsPostProc();
484
485 std::ostringstream strm;
486 strm << "out_" << iter_num << ".h5m";
487 CHKERR post_proc_fe->writeFile(strm.str().c_str());
489}
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Post post-proc data at points from hash maps.
std::map< std::string, ScalarDataPtr > DataMapVec
std::map< std::string, boost::shared_ptr< MatrixDouble > > DataMapMat
boost::shared_ptr< FEMethod > & getDomainPostProcFE()
Get domain postprocessing finite element.

◆ readMesh()

MoFEMErrorCode MixedPoisson::readMesh ( )
private

[Run programme]

[Read mesh]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 155 of file mixed_poisson.cpp.

155 {
161}
Simple * simpleInterface
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition Simple.cpp:191
MoFEMErrorCode getOptions()
get options
Definition Simple.cpp:180

◆ refineOrder()

MoFEMErrorCode MixedPoisson::refineOrder ( int  iter_num = 0)
private

[Solve]

[Refine]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 288 of file mixed_poisson.cpp.

288 {
290 Tag th_error_ind, th_order;
291 CHKERR getTagHandle(mField, "ERROR_INDICATOR", MB_TYPE_DOUBLE, th_error_ind);
292 CHKERR getTagHandle(mField, "ORDER", MB_TYPE_INTEGER, th_order);
293
294 std::vector<Range> refinement_levels;
295 refinement_levels.resize(iter_num + 1);
296 for (auto ent : domainEntities) {
297 double err_indic = 0;
298 CHKERR mField.get_moab().tag_get_data(th_error_ind, &ent, 1, &err_indic);
299
300 int order, new_order;
301 CHKERR mField.get_moab().tag_get_data(th_order, &ent, 1, &order);
302 new_order = order + 1;
303 Range refined_ents;
304 if (err_indic > thetaParam * maxErrorIndicator) {
305 refined_ents.insert(ent);
306 Range adj;
307 CHKERR mField.get_moab().get_adjacencies(&ent, 1, 1, false, adj,
308 moab::Interface::UNION);
309 refined_ents.merge(adj);
310 refinement_levels[new_order - initOrder].merge(refined_ents);
311 CHKERR mField.get_moab().tag_set_data(th_order, &ent, 1, &new_order);
312 }
313 }
314
315 for (int ll = 1; ll < refinement_levels.size(); ll++) {
316 CHKERR mField.getInterface<CommInterface>()->synchroniseEntities(
317 refinement_levels[ll]);
318
319 if (initOrder + ll > 8) {
320 MOFEM_LOG("EXAMPLE", Sev::warning)
321 << "setting approximation order higher than 8 is not currently "
322 "supported"
323 << endl;
324 } else {
325 CHKERR mField.set_field_order(refinement_levels[ll], "U", initOrder + ll);
326 CHKERR mField.set_field_order(refinement_levels[ll], "Q",
327 initOrder + ll + 1);
328 }
329 }
330
331 CHKERR mField.getInterface<CommInterface>()->synchroniseFieldEntities("Q");
332 CHKERR mField.getInterface<CommInterface>()->synchroniseFieldEntities("U");
336 mField.getInterface<ProblemsManager>()->buildProblemFromFields = PETSC_TRUE;
339}
constexpr int order
PetscErrorCode DMSetUp_MoFEM(DM dm)
Definition DMMoFEM.cpp:1327
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
Managing BitRefLevels.
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
Problem manager is used to build and partition problems.
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition Simple.cpp:799
BitRefLevel & getBitRefLevel()
Get the BitRefLevel.
Definition Simple.hpp:415

◆ runProblem()

MoFEMErrorCode MixedPoisson::runProblem ( )

[Run programme]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 144 of file mixed_poisson.cpp.

144 {
151}
MoFEMErrorCode solveRefineLoop()
[Refine]
MoFEMErrorCode createCommonData()
[Set integration rule]
MoFEMErrorCode setupProblem()
[Read mesh]
MoFEMErrorCode readMesh()
[Run programme]

◆ setIntegrationRules()

MoFEMErrorCode MixedPoisson::setIntegrationRules ( )
private

[Set up problem]

[Set integration rule]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 207 of file mixed_poisson.cpp.

207 {
209
210 auto rule = [](int, int, int p) -> int { return 2 * p; };
211
213 CHKERR pipeline_mng->setDomainLhsIntegrationRule(rule);
214 CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule);
215
217}
MoFEMErrorCode setDomainRhsIntegrationRule(RuleHookFun rule)
Set integration rule for domain right-hand side finite element.
MoFEMErrorCode setDomainLhsIntegrationRule(RuleHookFun rule)
Set integration rule for domain left-hand side finite element.

◆ setupProblem()

MoFEMErrorCode MixedPoisson::setupProblem ( )
private

[Read mesh]

[Set up problem]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 165 of file mixed_poisson.cpp.

165 {
167
169
170 int nb_quads = 0;
171 CHKERR mField.get_moab().get_number_entities_by_type(0, MBQUAD, nb_quads);
172 auto base = AINSWORTH_LEGENDRE_BASE;
173 if (nb_quads) {
174 // AINSWORTH_LEGENDRE_BASE is not implemented for HDIV/HCURL space on quads
176 }
177
178 // Note that in 2D case HDIV and HCURL spaces are isomorphic, and therefore
179 // only base for HCURL has been implemented in 2D. Base vectors for HDIV space
180 // are be obtained after rotation of HCURL base vectors by a right angle
182
183 thetaParam = 0.5;
184 CHKERR PetscOptionsGetReal(PETSC_NULLPTR, "", "-theta", &thetaParam, PETSC_NULLPTR);
185
186 indicTolerance = 1e-3;
187 CHKERR PetscOptionsGetReal(PETSC_NULLPTR, "", "-indic_tol", &indicTolerance,
188 PETSC_NULLPTR);
189
190 initOrder = 2;
191 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-order", &initOrder, PETSC_NULLPTR);
195
196 CHKERR mField.get_moab().get_entities_by_dimension(0, 2, domainEntities);
197 Tag th_order;
198 CHKERR getTagHandle(mField, "ORDER", MB_TYPE_INTEGER, th_order);
199 for (auto ent : domainEntities) {
200 CHKERR mField.get_moab().tag_set_data(th_order, &ent, 1, &initOrder);
201 }
203}
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ DEMKOWICZ_JACOBI_BASE
Definition definitions.h:66
@ L2
field with C-1 continuity
Definition definitions.h:88
@ HCURL
field with continuous tangents
Definition definitions.h:86
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetReal(PetscOptions *, const char pre[], const char name[], PetscReal *dval, PetscBool *set)
double indicTolerance
MoFEMErrorCode addDomainField(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_ZERO, int verb=-1)
Add field on domain.
Definition Simple.cpp:261
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition Simple.cpp:575
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition Simple.cpp:735

◆ solveRefineLoop()

MoFEMErrorCode MixedPoisson::solveRefineLoop ( )
private

[Refine]

[Solve and refine loop]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 343 of file mixed_poisson.cpp.

343 {
350
351 int iter_num = 1;
352 while (fabs(indicTolerance) > DBL_EPSILON &&
354 MOFEM_LOG("EXAMPLE", Sev::inform) << "Refinement iteration " << iter_num;
355
356 CHKERR refineOrder(iter_num);
360 CHKERR checkError(iter_num);
361 CHKERR outputResults(iter_num);
362
363 iter_num++;
364 if (iter_num > 100)
365 SETERRQ(PETSC_COMM_SELF, MOFEM_OPERATION_UNSUCCESSFUL,
366 "Too many refinement iterations");
367 }
369}
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
MoFEMErrorCode assembleSystem()
[Create common data]
MoFEMErrorCode outputResults(int iter_num=0)
[Check error]
MoFEMErrorCode checkError(int iter_num=0)
[Solve and refine loop]
MoFEMErrorCode solveSystem()
[Assemble system]
MoFEMErrorCode setIntegrationRules()
[Set up problem]
MoFEMErrorCode refineOrder(int iter_num=0)
[Solve]

◆ solveSystem()

MoFEMErrorCode MixedPoisson::solveSystem ( )
private

[Assemble system]

[Solve]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 265 of file mixed_poisson.cpp.

265 {
268 auto solver = pipeline_mng->createKSP();
269 CHKERR KSPSetFromOptions(solver);
270 CHKERR KSPSetUp(solver);
271
272 auto dm = simpleInterface->getDM();
273 auto D = createDMVector(dm);
274 auto F = vectorDuplicate(D);
275 CHKERR VecZeroEntries(D);
276
277 CHKERR KSPSolve(solver, F, D);
278 CHKERR mField.getInterface<TestingInterface>()->checkSolver(solver,
279 "mixed poisson");
280 CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
281 CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
282 CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
284}
@ F
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode, RowColData rc=RowColData::COL)
set local (or ghosted) vector values on mesh for partition only
Definition DMMoFEM.cpp:543
auto createDMVector(DM dm, RowColData rc=RowColData::COL)
Get smart vector from DM.
Definition DMMoFEM.hpp:1250
SmartPetscObj< KSP > createKSP(SmartPetscObj< DM > dm=nullptr)
Create KSP (linear) solver.
double D
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.

◆ sourceFunction()

static double MixedPoisson::sourceFunction ( const double  x,
const double  y,
const double  z 
)
inlinestaticprivate

[Analytical function gradient]

[Source function]

Examples
mofem/tutorials/mix-0_mixed_poisson/mixed_poisson.cpp.

Definition at line 69 of file mixed_poisson.cpp.

69 {
70 return -exp(-100. * (sqr(x) + sqr(y))) *
71 (400. * M_PI *
72 (x * cos(M_PI * y) * sin(M_PI * x) +
73 y * cos(M_PI * x) * sin(M_PI * y)) +
74 2. * (20000. * (sqr(x) + sqr(y)) - 200. - sqr(M_PI)) *
75 cos(M_PI * x) * cos(M_PI * y));
76 }

Member Data Documentation

◆ commonDataPtr

boost::shared_ptr<CommonData> MixedPoisson::commonDataPtr
private

◆ domainEntities

Range MixedPoisson::domainEntities
private

◆ indicTolerance

double MixedPoisson::indicTolerance
private

◆ initOrder

int MixedPoisson::initOrder
private

◆ maxErrorIndicator

double MixedPoisson::maxErrorIndicator
private

◆ mField

MoFEM::Interface& MixedPoisson::mField
private

◆ simpleInterface

Simple* MixedPoisson::simpleInterface
private

◆ thetaParam

double MixedPoisson::thetaParam
private

◆ totErrorIndicator

double MixedPoisson::totErrorIndicator
private

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