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

Public Member Functions

 Plate (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 [Output results] More...
 

Private Member Functions

MoFEMErrorCode readMesh ()
 [Read mesh] More...
 
MoFEMErrorCode setupProblem ()
 [Read mesh] More...
 
MoFEMErrorCode boundaryCondition ()
 [Set up problem] More...
 
MoFEMErrorCode assembleSystem ()
 [Boundary condition] More...
 
MoFEMErrorCode solveSystem ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode outputResults ()
 [Solve system] More...
 

Private Attributes

MoFEM::InterfacemField
 

Detailed Description

Examples
plate.cpp.

Definition at line 141 of file plate.cpp.

Constructor & Destructor Documentation

◆ Plate()

Plate::Plate ( MoFEM::Interface m_field)
inline

Definition at line 143 of file plate.cpp.

143 : mField(m_field) {}

Member Function Documentation

◆ assembleSystem()

MoFEMErrorCode Plate::assembleSystem ( )
private

[Boundary condition]

[Push operators to pipeline]

calculate jacobian

Examples
plate.cpp.

Definition at line 235 of file plate.cpp.

235  {
237 
238  auto pipeline_mng = mField.getInterface<PipelineManager>();
239 
240  auto rule_lhs = [](int, int, int p) -> int { return 2 * p; };
241  auto rule_rhs = [](int, int, int p) -> int { return 2 * p; };
242  auto rule_2 = [this](int, int, int) { return 2 * order; };
243 
244  CHKERR pipeline_mng->setDomainLhsIntegrationRule(rule_lhs);
245  CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule_rhs);
246 
247  CHKERR pipeline_mng->setSkeletonLhsIntegrationRule(rule_2);
248  CHKERR pipeline_mng->setSkeletonRhsIntegrationRule(rule_2);
249  CHKERR pipeline_mng->setBoundaryLhsIntegrationRule(rule_2);
250  CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(rule_2);
251 
252  auto det_ptr = boost::make_shared<VectorDouble>();
253  auto jac_ptr = boost::make_shared<MatrixDouble>();
254  auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
255  auto base_mass_ptr = boost::make_shared<MatrixDouble>();
256  auto data_l2_ptr = boost::make_shared<EntitiesFieldData>(MBENTITYSET);
257 
258  auto mat_D_ptr = plate_stiffness();
259 
260  auto push_ho_direcatives = [&](auto &pipeline) {
261  pipeline.push_back(new OpBaseDerivativesMass<BASE_DIM>(
262  base_mass_ptr, data_l2_ptr, AINSWORTH_LEGENDRE_BASE, L2));
263  pipeline.push_back(new OpBaseDerivativesNext<BASE_DIM>(
264  BaseDerivatives::SecondDerivative, base_mass_ptr, data_l2_ptr,
266  };
267 
268  /**
269  * @brief calculate jacobian
270  *
271  */
272  auto push_jacobian = [&](auto &pipeline) {
273  pipeline.push_back(new OpSetHOWeightsOnFace());
274  pipeline.push_back(new OpCalculateHOJac<SPACE_DIM>(jac_ptr));
275  pipeline.push_back(
276  new OpInvertMatrix<SPACE_DIM>(jac_ptr, det_ptr, inv_jac_ptr));
277  // push first base derivatives tp physical element shape
278  pipeline.push_back(new OpSetInvJacH1ForFace<1>(inv_jac_ptr));
279  // push second base directives tp physical element shape
280  pipeline.push_back(new OpSetInvJacH1ForFace<2>(inv_jac_ptr));
281  };
282 
283  push_ho_direcatives(pipeline_mng->getOpDomainLhsPipeline());
284  push_jacobian(pipeline_mng->getOpDomainLhsPipeline());
285 
286  pipeline_mng->getOpDomainLhsPipeline().push_back(
287  new OpDomainPlateStiffness("U", "U", mat_D_ptr));
288  // pipeline_mng->getOpDomainLhsPipeline().push_back(new OpDomainGradGrad(
289  // "U", "U", [](const double, const double, const double) { return 1; }));
290 
291  pipeline_mng->getOpDomainRhsPipeline().push_back(
292  new OpDomainPlateLoad("U", source));
293 
294  // Push operators to the Pipeline for Skeleton
295  auto side_fe_ptr = boost::make_shared<FaceSideEle>(mField);
296  push_ho_direcatives(side_fe_ptr->getOpPtrVector());
297  push_jacobian(side_fe_ptr->getOpPtrVector());
298  side_fe_ptr->getOpPtrVector().push_back(new OpCalculateSideData("U", "U"));
299 
300  // Push operators to the Pipeline for Skeleton
301  pipeline_mng->getOpSkeletonLhsPipeline().push_back(
302  new OpH1LhsSkeleton(side_fe_ptr, mat_D_ptr));
303 
305 }

◆ boundaryCondition()

MoFEMErrorCode Plate::boundaryCondition ( )
private

[Set up problem]

[Boundary condition]

Examples
plate.cpp.

Definition at line 200 of file plate.cpp.

200  {
202 
203  // get edges and vertices on body skin
204  auto get_skin = [&]() {
205  Range body_ents;
206  MOAB_THROW(
207  mField.get_moab().get_entities_by_dimension(0, SPACE_DIM, body_ents));
208  Skinner skin(&mField.get_moab());
209  Range skin_ents;
210  MOAB_THROW(skin.find_skin(0, body_ents, false, skin_ents));
211  Range verts;
212  MOAB_THROW(mField.get_moab().get_connectivity(skin_ents, verts, true));
213  skin_ents.merge(verts);
214  return skin_ents;
215  };
216 
217  // remove dofs on skin edges from priblem
218  auto remove_dofs_from_problem = [&](Range &&skin) {
220  auto problem_mng = mField.getInterface<ProblemsManager>();
221  auto simple = mField.getInterface<Simple>();
222  CHKERR problem_mng->removeDofsOnEntities(simple->getProblemName(), "U",
223  skin, 0, 1);
225  };
226 
227  // it make plate simply supported
228  CHKERR remove_dofs_from_problem(get_skin());
229 
231 }

◆ outputResults()

MoFEMErrorCode Plate::outputResults ( )
private

[Solve system]

[Output results]

Examples
plate.cpp.

Definition at line 336 of file plate.cpp.

336  {
338 
339  auto pipeline_mng = mField.getInterface<PipelineManager>();
340  pipeline_mng->getDomainLhsFE().reset();
341  pipeline_mng->getSkeletonRhsFE().reset();
342  pipeline_mng->getSkeletonLhsFE().reset();
343  pipeline_mng->getBoundaryRhsFE().reset();
344  pipeline_mng->getBoundaryLhsFE().reset();
345 
346  auto post_proc_fe = boost::make_shared<PostProcEle>(mField);
347 
348  auto u_ptr = boost::make_shared<VectorDouble>();
349  post_proc_fe->getOpPtrVector().push_back(
350  new OpCalculateScalarFieldValues("U", u_ptr));
351 
353 
354  post_proc_fe->getOpPtrVector().push_back(
355 
356  new OpPPMap(post_proc_fe->getPostProcMesh(),
357  post_proc_fe->getMapGaussPts(),
358 
359  {{"U", u_ptr}},
360 
361  {}, {}, {}
362 
363  )
364 
365  );
366 
367  pipeline_mng->getDomainRhsFE() = post_proc_fe;
368  CHKERR pipeline_mng->loopFiniteElements();
369  CHKERR post_proc_fe->writeFile("out_result.h5m");
370 
372 }

◆ readMesh()

MoFEMErrorCode Plate::readMesh ( )
private

[Read mesh]

Examples
plate.cpp.

Definition at line 159 of file plate.cpp.

159  {
161 
162  auto simple = mField.getInterface<Simple>();
163  CHKERR simple->getOptions();
164  CHKERR simple->loadFile();
165 
167 }

◆ runProblem()

MoFEMErrorCode Plate::runProblem ( )

[Output results]

[Run program]

Examples
plate.cpp.

Definition at line 376 of file plate.cpp.

376  {
378 
379  CHKERR readMesh();
384  // CHKERR checkResults();
386 
388 }

◆ setupProblem()

MoFEMErrorCode Plate::setupProblem ( )
private

[Read mesh]

[Set up problem]

Examples
plate.cpp.

Definition at line 171 of file plate.cpp.

171  {
173 
174  auto simple = mField.getInterface<Simple>();
175 
176  CHKERR PetscOptionsGetInt(PETSC_NULL, "", "-order", &order, PETSC_NULL);
177  CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-penalty", &penalty,
178  PETSC_NULL);
179  CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-phi", &phi, PETSC_NULL);
180  CHKERR PetscOptionsGetScalar(PETSC_NULL, "", "-nitsche", &nitsche,
181  PETSC_NULL);
182 
183  MOFEM_LOG("WORLD", Sev::inform) << "Set order: " << order;
184  MOFEM_LOG("WORLD", Sev::inform) << "Set penalty: " << penalty;
185  MOFEM_LOG("WORLD", Sev::inform) << "Set phi: " << phi;
186  MOFEM_LOG("WORLD", Sev::inform) << "Set nitche: " << nitsche;
187 
188  CHKERR simple->addDomainField("U", H1, AINSWORTH_LEGENDRE_BASE, FIELD_DIM);
189  CHKERR simple->addSkeletonField("U", H1, AINSWORTH_LEGENDRE_BASE, FIELD_DIM);
190  CHKERR simple->addBoundaryField("U", H1, AINSWORTH_LEGENDRE_BASE, FIELD_DIM);
191 
192  CHKERR simple->setFieldOrder("U", order);
193  CHKERR simple->setUp();
194 
196 }

◆ solveSystem()

MoFEMErrorCode Plate::solveSystem ( )
private

[Push operators to pipeline]

[Solve system]

Examples
plate.cpp.

Definition at line 309 of file plate.cpp.

309  {
311 
312  auto pipeline_mng = mField.getInterface<PipelineManager>();
313  auto simple = mField.getInterface<Simple>();
314 
315  auto ksp_solver = pipeline_mng->createKSP();
316  CHKERR KSPSetFromOptions(ksp_solver);
317  CHKERR KSPSetUp(ksp_solver);
318 
319  // Create RHS and solution vectors
320  auto dm = simple->getDM();
321  auto F = createDMVector(dm);
322  auto D = vectorDuplicate(F);
323 
324  CHKERR KSPSolve(ksp_solver, F, D);
325 
326  // Scatter result data on the mesh
327  CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
328  CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
329  CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
330 
332 }

Member Data Documentation

◆ mField

MoFEM::Interface& Plate::mField
private

Definition at line 155 of file plate.cpp.


The documentation for this struct was generated from the following file:
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Definition: UnknownInterface.hpp:93
OpCalculateSideData
Operator tp collect data from elements on the side of Edge/Face.
Definition: plate.cpp:110
H1
@ H1
continuous field
Definition: definitions.h:85
plate_stiffness
auto plate_stiffness
get fourth-order constitutive tensor
Definition: plate.cpp:80
OpDomainPlateLoad
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< BASE_DIM, FIELD_DIM > OpDomainPlateLoad
Definition: plate.cpp:51
MoFEM::ProblemsManager
Problem manager is used to build and partition problems.
Definition: ProblemsManager.hpp:21
SPACE_DIM
constexpr int SPACE_DIM
dimension of space
Definition: plate.cpp:18
FIELD_DIM
constexpr int FIELD_DIM
dimension of approx. field
Definition: plate.cpp:19
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
nitsche
static double nitsche
Definition: plate.cpp:69
MoFEM::PipelineManager
PipelineManager interface.
Definition: PipelineManager.hpp:24
MoFEM::DMoFEMMeshToLocalVector
PetscErrorCode DMoFEMMeshToLocalVector(DM dm, Vec l, InsertMode mode, ScatterMode scatter_mode)
set local (or ghosted) vector values on mesh for partition only
Definition: DMMoFEM.cpp:527
MOAB_THROW
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:541
MoFEM::OpBaseDerivativesNext
Definition: BaseDerivativesDataOperators.hpp:67
Plate::readMesh
MoFEMErrorCode readMesh()
[Read mesh]
Definition: plate.cpp:159
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
MoFEM::OpCalculateHOJac
Definition: HODataOperators.hpp:267
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::OpBaseDerivativesMass
Definition: BaseDerivativesDataOperators.hpp:35
MoFEM::createDMVector
auto createDMVector(DM dm)
Get smart vector from DM.
Definition: DMMoFEM.hpp:1018
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
source
auto source
Definition: plate.cpp:72
order
static int order
Definition: plate.cpp:70
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
OpPPMap
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Definition: photon_diffusion.cpp:29
Plate::mField
MoFEM::Interface & mField
Definition: plate.cpp:155
MoFEM::OpCalculateScalarFieldValues
Get value at integration points for scalar field.
Definition: UserDataOperators.hpp:82
MoFEM::OpSetHOWeightsOnFace
Modify integration weights on face to take in account higher-order geometry.
Definition: HODataOperators.hpp:122
OpDomainPlateStiffness
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGradSymTensorGradGrad< 1, 1, SPACE_DIM, 0 > OpDomainPlateStiffness
Definition: plate.cpp:49
MoFEM::OpSetInvJacH1ForFace
Definition: UserDataOperators.hpp:2922
Range
Plate::setupProblem
MoFEMErrorCode setupProblem()
[Read mesh]
Definition: plate.cpp:171
MoFEM::PipelineManager::getDomainLhsFE
boost::shared_ptr< FEMethod > & getDomainLhsFE()
Definition: PipelineManager.hpp:401
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MoFEM::vectorDuplicate
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
Definition: PetscSmartObj.hpp:217
Plate::solveSystem
MoFEMErrorCode solveSystem()
[Push operators to pipeline]
Definition: plate.cpp:309
penalty
static double penalty
Definition: plate.cpp:66
Plate::assembleSystem
MoFEMErrorCode assembleSystem()
[Boundary condition]
Definition: plate.cpp:235
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::OpInvertMatrix
Definition: UserDataOperators.hpp:3254
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
MoFEM::PetscOptionsGetScalar
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:162
Plate::boundaryCondition
MoFEMErrorCode boundaryCondition()
[Set up problem]
Definition: plate.cpp:200
OpH1LhsSkeleton
Operator the left hand side matrix.
Definition: plate.cpp:121
convert.int
int
Definition: convert.py:64
MoFEM::PetscOptionsGetInt
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
Definition: DeprecatedPetsc.hpp:142
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
Plate::outputResults
MoFEMErrorCode outputResults()
[Solve system]
Definition: plate.cpp:336
F
@ F
Definition: free_surface.cpp:394
MoFEM::OpPostProcMapInMoab
Post post-proc data at points from hash maps.
Definition: PostProcBrokenMeshInMoabBase.hpp:698
phi
static double phi
Definition: plate.cpp:67