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 140 of file plate.cpp.

Constructor & Destructor Documentation

◆ Plate()

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

Definition at line 142 of file plate.cpp.

142 : 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 234 of file plate.cpp.

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

◆ boundaryCondition()

MoFEMErrorCode Plate::boundaryCondition ( )
private

[Set up problem]

[Boundary condition]

Examples
plate.cpp.

Definition at line 199 of file plate.cpp.

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

◆ outputResults()

MoFEMErrorCode Plate::outputResults ( )
private

[Solve system]

[Output results]

Examples
plate.cpp.

Definition at line 335 of file plate.cpp.

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

◆ readMesh()

MoFEMErrorCode Plate::readMesh ( )
private

[Read mesh]

Examples
plate.cpp.

Definition at line 158 of file plate.cpp.

158  {
160 
161  auto simple = mField.getInterface<Simple>();
162  CHKERR simple->getOptions();
163  CHKERR simple->loadFile();
164 
166 }

◆ runProblem()

MoFEMErrorCode Plate::runProblem ( )

[Output results]

[Run program]

Examples
plate.cpp.

Definition at line 375 of file plate.cpp.

375  {
377 
378  CHKERR readMesh();
383  // CHKERR checkResults();
385 
387 }

◆ setupProblem()

MoFEMErrorCode Plate::setupProblem ( )
private

[Read mesh]

[Set up problem]

Examples
plate.cpp.

Definition at line 170 of file plate.cpp.

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

◆ solveSystem()

MoFEMErrorCode Plate::solveSystem ( )
private

[Push operators to pipeline]

[Solve system]

Examples
plate.cpp.

Definition at line 308 of file plate.cpp.

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

Member Data Documentation

◆ mField

MoFEM::Interface& Plate::mField
private

Definition at line 154 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 reference to pointer of interface.
Definition: UnknownInterface.hpp:93
OpCalculateSideData
Operator tp collect data from elements on the side of Edge/Face.
Definition: plate.cpp:109
H1
@ H1
continuous field
Definition: definitions.h:85
plate_stiffness
auto plate_stiffness
get fourth-order constitutive tensor
Definition: plate.cpp:79
OpDomainPlateLoad
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< BASE_DIM, FIELD_DIM > OpDomainPlateLoad
Definition: plate.cpp:50
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:17
FIELD_DIM
constexpr int FIELD_DIM
dimension of approx. field
Definition: plate.cpp:18
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
nitsche
static double nitsche
Definition: plate.cpp:68
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:523
MOAB_THROW
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:554
MoFEM::OpBaseDerivativesNext
Definition: BaseDerivativesDataOperators.hpp:67
Plate::readMesh
MoFEMErrorCode readMesh()
[Read mesh]
Definition: plate.cpp:158
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:548
MoFEM::OpBaseDerivativesMass
Definition: BaseDerivativesDataOperators.hpp:35
MoFEM::createDMVector
auto createDMVector(DM dm)
Get smart vector from DM.
Definition: DMMoFEM.hpp:1099
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
source
auto source
Definition: plate.cpp:71
order
static int order
Definition: plate.cpp:69
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:154
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:48
MoFEM::OpSetInvJacH1ForFace
Definition: UserDataOperators.hpp:2918
Range
Plate::setupProblem
MoFEMErrorCode setupProblem()
[Read mesh]
Definition: plate.cpp:170
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:221
Plate::solveSystem
MoFEMErrorCode solveSystem()
[Push operators to pipeline]
Definition: plate.cpp:308
penalty
static double penalty
Definition: plate.cpp:65
Plate::assembleSystem
MoFEMErrorCode assembleSystem()
[Boundary condition]
Definition: plate.cpp:234
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::OpInvertMatrix
Definition: UserDataOperators.hpp:3249
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:199
OpH1LhsSkeleton
Operator the left hand side matrix.
Definition: plate.cpp:120
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:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
Plate::outputResults
MoFEMErrorCode outputResults()
[Solve system]
Definition: plate.cpp:335
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:66