v0.10.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Poisson Struct Reference
Collaboration diagram for Poisson:
[legend]

Public Member Functions

 Poisson (moab::Core &mb_instance, MoFEM::Core &core, int order)
 
MoFEMErrorCode runAnalysis ()
 

Private Member Functions

MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupSystem ()
 
MoFEMErrorCode setIntegrationRule ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode applyBc ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode setOutput ()
 

Private Attributes

boost::shared_ptr< VolElevolPipelineLhs
 
boost::shared_ptr< VolElevolPipelineRhs
 
boost::shared_ptr< VolElepostFaceVolume
 
MoFEM::InterfacemField
 
moab::Interface & moab
 
SimplesimpleInterface
 
DM dm
 
KSP ksp
 
MatrixDouble invJac
 
MPI_Comm mpiComm
 
const int mpiRank
 
int order
 
std::string domainField
 

Detailed Description

Definition at line 10 of file poisson_prob.cpp.

Constructor & Destructor Documentation

◆ Poisson()

Poisson::Poisson ( moab::Core &  mb_instance,
MoFEM::Core core,
int  order 
)

Definition at line 46 of file poisson_prob.cpp.

47  : domainField("U"), moab(mb_instance), mField(core),
49  order(order) {
50  volPipelineLhs = boost::shared_ptr<VolEle>(new VolEle(mField));
51  volPipelineRhs = boost::shared_ptr<VolEle>(new VolEle(mField));
52 }

Member Function Documentation

◆ applyBc()

MoFEMErrorCode Poisson::applyBc ( )
private

Definition at line 168 of file poisson_prob.cpp.

168  {
170  Range bdry_entities;
172  string name = it->getName();
173  if (name.compare(0, 14, "ESSENTIAL") == 0) {
174  CHKERR it->getMeshsetIdEntitiesByDimension(mField.get_moab(), 1,
175  bdry_entities, true);
176  }
177  }
178 
179  cerr << bdry_entities;
180  Range bdr_verts;
181  CHKERR mField.get_moab().get_connectivity(bdry_entities, bdr_verts, true);
182  bdry_entities.merge(bdr_verts);
183 
184  CHKERR mField.getInterface<ProblemsManager>()->removeDofsOnEntities(
185  simpleInterface->getProblemName(), domainField, bdry_entities);
186 
187 
189 }

◆ assembleSystem()

MoFEMErrorCode Poisson::assembleSystem ( )
private

Definition at line 84 of file poisson_prob.cpp.

84  {
86 
87  volPipelineLhs->getOpPtrVector().push_back(new OpCalculateInvJacForFace(invJac));
88  volPipelineLhs->getOpPtrVector().push_back(new OpSetInvJacH1ForFace(invJac));
89 
90  volPipelineLhs->getOpPtrVector().push_back(
92  volPipelineRhs->getOpPtrVector().push_back(new OpRhsU(domainField));
93 
94  // dm = simpleInterface->getDM();
96  boost::shared_ptr<VolEle> null;
97 
99 
103 }

◆ readMesh()

MoFEMErrorCode Poisson::readMesh ( )
private

Definition at line 54 of file poisson_prob.cpp.

◆ runAnalysis()

MoFEMErrorCode Poisson::runAnalysis ( )

Definition at line 191 of file poisson_prob.cpp.

191  {
193 
194  CHKERR readMesh();
196  CHKERR applyBc();
197 
199 
200  CHKERR setOutput();
201 
203 
205 }

◆ setIntegrationRule()

MoFEMErrorCode Poisson::setIntegrationRule ( )
private

Definition at line 75 of file poisson_prob.cpp.

75  {
77  auto vol_ruleLhs = [](int, int, int p) -> int { return 2 * (p - 1); };
78  auto vol_ruleRhs = [](int, int, int p) -> int { return 2 * (p - 1); };
79  volPipelineLhs->getRuleHook = vol_ruleLhs;
80  volPipelineRhs->getRuleHook = vol_ruleRhs;
82 }

◆ setOutput()

MoFEMErrorCode Poisson::setOutput ( )
private

Definition at line 149 of file poisson_prob.cpp.

149  {
151 
153  boost::shared_ptr<VolEle>(new PostProcFaceOnRefinedMesh(mField));
154 
155  CHKERR
156  boost::static_pointer_cast<PostProcFaceOnRefinedMesh>(postFaceVolume)
157  ->generateReferenceElementMesh();
158  CHKERR
159  boost::static_pointer_cast<PostProcFaceOnRefinedMesh>(postFaceVolume)
160  ->addFieldValuesPostProc(domainField);
161  // CHKERR
162  // boost::static_pointer_cast<PostProcFaceOnRefinedMesh>(postFaceVolume)
163  // ->addFieldValuesGradientPostProc(domainField);
164 
166 }

◆ setupSystem()

MoFEMErrorCode Poisson::setupSystem ( )
private

◆ solveSystem()

MoFEMErrorCode Poisson::solveSystem ( )
private

Definition at line 105 of file poisson_prob.cpp.

105  {
107 
108  Vec global_rhs, global_solution;
109  CHKERR DMCreateGlobalVector(dm, &global_rhs);
110  CHKERR VecDuplicate(global_rhs, &global_solution);
111 
112 
113  // ksp = createKSP(mField.get_comm());
114 
115  CHKERR KSPCreate(PETSC_COMM_WORLD, &ksp);
116 
117  // CHKERR KSPSetOperators(ksp, volPipelineLhs->getFEMethod()->ksp_B,
118  // volPipelineLhs->getFEMethod()->ksp_B);
119 
120  CHKERR KSPSetFromOptions(ksp);
121 
122  CHKERR KSPSetDM(ksp, dm);
123 
124  CHKERR KSPSetUp(ksp);
125 
126  CHKERR KSPSolve(ksp, global_rhs, global_solution);
127 
128  CHKERR DMoFEMMeshToGlobalVector(dm, global_solution, INSERT_VALUES,
129  SCATTER_REVERSE);
130 
131 
132 
133  CHKERR KSPDestroy(&ksp);
134  CHKERR VecDestroy(&global_solution);
135  CHKERR VecDestroy(&global_rhs);
136 
139 
140  CHKERR
141  boost::static_pointer_cast<PostProcFaceOnRefinedMesh>(postFaceVolume)
142  ->writeFile("out_vol.h5m");
143 
144  CHKERR DMDestroy(&dm);
145 
147 }

Member Data Documentation

◆ dm

DM Poisson::dm
private

Definition at line 33 of file poisson_prob.cpp.

◆ domainField

std::string Poisson::domainField
private

Definition at line 43 of file poisson_prob.cpp.

◆ invJac

MatrixDouble Poisson::invJac
private

Definition at line 36 of file poisson_prob.cpp.

◆ ksp

KSP Poisson::ksp
private

Definition at line 34 of file poisson_prob.cpp.

◆ mField

MoFEM::Interface& Poisson::mField
private

Definition at line 29 of file poisson_prob.cpp.

◆ moab

moab::Interface& Poisson::moab
private

Definition at line 30 of file poisson_prob.cpp.

◆ mpiComm

MPI_Comm Poisson::mpiComm
private

Definition at line 38 of file poisson_prob.cpp.

◆ mpiRank

const int Poisson::mpiRank
private

Definition at line 39 of file poisson_prob.cpp.

◆ order

int Poisson::order
private

Definition at line 41 of file poisson_prob.cpp.

◆ postFaceVolume

boost::shared_ptr<VolEle> Poisson::postFaceVolume
private

Definition at line 27 of file poisson_prob.cpp.

◆ simpleInterface

Simple* Poisson::simpleInterface
private

Definition at line 31 of file poisson_prob.cpp.

◆ volPipelineLhs

boost::shared_ptr<VolEle> Poisson::volPipelineLhs
private

Definition at line 25 of file poisson_prob.cpp.

◆ volPipelineRhs

boost::shared_ptr<VolEle> Poisson::volPipelineRhs
private

Definition at line 26 of file poisson_prob.cpp.


The documentation for this struct was generated from the following file:
MoFEM::Simple::setFieldOrder
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition: Simple.cpp:482
H1
@ H1
continuous field
Definition: definitions.h:177
MoFEM::DMMoFEMKSPSetComputeRHS
PetscErrorCode DMMoFEMKSPSetComputeRHS(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
set KSP right hand side evaluation function
Definition: DMMMoFEM.cpp:556
Poisson::mpiRank
const int mpiRank
Definition: poisson_prob.cpp:39
MoFEM::Simple::loadFile
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name)
Load mesh file.
Definition: Simple.cpp:212
MoFEM::OpCalculateInvJacForFace
Calculate inverse of jacobian for face element.
Definition: UserDataOperators.hpp:1889
Poisson::assembleSystem
MoFEMErrorCode assembleSystem()
Definition: poisson_prob.cpp:84
VolEle
VolumeElementForcesAndSourcesCore VolEle
Definition: test_cache_on_entities.cpp:34
Poisson::volPipelineLhs
boost::shared_ptr< VolEle > volPipelineLhs
Definition: poisson_prob.cpp:25
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:70
MoFEM::DMMoFEMKSPSetComputeOperators
PetscErrorCode DMMoFEMKSPSetComputeOperators(DM dm, const char fe_name[], MoFEM::FEMethod *method, MoFEM::BasicMethod *pre_only, MoFEM::BasicMethod *post_only)
Set KSP operators and push mofem finite element methods.
Definition: DMMMoFEM.cpp:597
PoissonOps::OpLhsUU
Definition: PoissonOperators.hpp:23
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
Poisson::volPipelineRhs
boost::shared_ptr< VolEle > volPipelineRhs
Definition: poisson_prob.cpp:26
PoissonOps::OpRhsU
Definition: PoissonOperators.hpp:76
MoFEM::Simple::getDM
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition: Simple.cpp:706
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:604
Poisson::ksp
KSP ksp
Definition: poisson_prob.cpp:34
MoFEM::DMoFEMLoopFiniteElements
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method)
Executes FEMethod for finite elements in DM.
Definition: DMMMoFEM.cpp:507
Poisson::domainField
std::string domainField
Definition: poisson_prob.cpp:43
Poisson::order
int order
Definition: poisson_prob.cpp:41
MoFEM::Simple::getOptions
MoFEMErrorCode getOptions()
get options
Definition: Simple.cpp:198
MoFEM::Simple::addDomainField
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:269
Poisson::setOutput
MoFEMErrorCode setOutput()
Definition: poisson_prob.cpp:149
MoFEM::DMoFEMMeshToGlobalVector
PetscErrorCode DMoFEMMeshToGlobalVector(DM dm, Vec g, InsertMode mode, ScatterMode scatter_mode)
set ghosted vector values on all existing mesh entities
Definition: DMMMoFEM.cpp:457
Poisson::setIntegrationRule
MoFEMErrorCode setIntegrationRule()
Definition: poisson_prob.cpp:75
MoFEM::ProblemsManager
Problem manager is used to build and partition problems.
Definition: ProblemsManager.hpp:34
Poisson::readMesh
MoFEMErrorCode readMesh()
Definition: poisson_prob.cpp:54
MoFEM::OpSetInvJacH1ForFace
Definition: UserDataOperators.hpp:1922
MoFEM::Simple::setUp
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition: Simple.cpp:672
MoFEM::Simple::getProblemName
const std::string getProblemName() const
Get the Problem Name.
Definition: Simple.hpp:302
MoFEM::Simple::getDomainFEName
const std::string getDomainFEName() const
Get the Domain FE Name.
Definition: Simple.hpp:281
Poisson::dm
DM dm
Definition: poisson_prob.cpp:33
MoFEM::CoreInterface::get_comm_rank
virtual int get_comm_rank() const =0
Poisson::moab
moab::Interface & moab
Definition: poisson_prob.cpp:30
Poisson::solveSystem
MoFEMErrorCode solveSystem()
Definition: poisson_prob.cpp:105
Poisson::setupSystem
MoFEMErrorCode setupSystem()
Definition: poisson_prob.cpp:64
_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
Definition: MeshsetsManager.hpp:91
p
static Index< 'p', 3 > p
Definition: BasicFeTools.hpp:80
Poisson::mField
MoFEM::Interface & mField
Definition: poisson_prob.cpp:29
BLOCKSET
@ BLOCKSET
Definition: definitions.h:217
Poisson::applyBc
MoFEMErrorCode applyBc()
Definition: poisson_prob.cpp:168
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:152
PostProcFaceOnRefinedMesh
Postprocess on face.
Definition: PostProcOnRefMesh.hpp:717
Poisson::invJac
MatrixDouble invJac
Definition: poisson_prob.cpp:36
Poisson::simpleInterface
Simple * simpleInterface
Definition: poisson_prob.cpp:31
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
convert.int
int
Definition: convert.py:66
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
Poisson::mpiComm
MPI_Comm mpiComm
Definition: poisson_prob.cpp:38
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(const MOFEMuuid &uuid, IFACE *&iface) const
Get interface by uuid and return reference to pointer of interface.
Definition: UnknownInterface.hpp:130
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415
Poisson::postFaceVolume
boost::shared_ptr< VolEle > postFaceVolume
Definition: poisson_prob.cpp:27