v0.15.0
Loading...
Searching...
No Matches
Plate Struct Reference
Collaboration diagram for Plate:
[legend]

Public Member Functions

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

Private Member Functions

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

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
Examples
plate.cpp.

Definition at line 142 of file plate.cpp.

142: mField(m_field) {}
MoFEM::Interface & mField
Definition plate.cpp:154

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}
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
Definition definitions.h:60
@ L2
field with C-1 continuity
Definition definitions.h:88
@ H1
continuous field
Definition definitions.h:85
#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.
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< BASE_DIM, FIELD_DIM > OpDomainPlateLoad
Definition plate.cpp:49
auto source
Definition plate.cpp:71
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGradSymTensorGradGrad< 1, 1, SPACE_DIM, 0 > OpDomainPlateStiffness
Definition plate.cpp:46
auto plate_stiffness
get fourth-order constitutive tensor
Definition plate.cpp:79
static int order
Definition plate.cpp:69
Modify integration weights on face to take in account higher-order geometry.
PipelineManager interface.
MoFEMErrorCode setDomainLhsIntegrationRule(RuleHookFun rule)
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Operator tp collect data from elements on the side of Edge/Face.
Definition plate.cpp:109
Operator the left hand side matrix.
Definition plate.cpp:120

◆ 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;
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>();
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}
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition acoustic.cpp:69
#define MOAB_THROW(err)
Check error code of MoAB function and throw MoFEM exception.
constexpr int SPACE_DIM
dimension of space
Definition plate.cpp:17
virtual moab::Interface & get_moab()=0
Problem manager is used to build and partition problems.
Simple interface for fast problem set-up.
Definition Simple.hpp:27

◆ 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}
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Get value at integration points for scalar field.
Post post-proc data at points from hash maps.
boost::shared_ptr< FEMethod > & getDomainLhsFE()

◆ readMesh()

MoFEMErrorCode Plate::readMesh ( )
private

[Read mesh]

Examples
plate.cpp.

Definition at line 158 of file plate.cpp.

158 {
160
163 CHKERR simple->loadFile();
164
166}
MoFEMErrorCode getOptions()
get options
Definition Simple.cpp:180

◆ runProblem()

MoFEMErrorCode Plate::runProblem ( )

[Output results]

[Run program]

Examples
plate.cpp.

Definition at line 375 of file plate.cpp.

375 {
377
383 // CHKERR checkResults();
385
387}
MoFEMErrorCode setupProblem()
[Read mesh]
Definition plate.cpp:170
MoFEMErrorCode boundaryCondition()
[Set up problem]
Definition plate.cpp:199
MoFEMErrorCode outputResults()
[Solve system]
Definition plate.cpp:335
MoFEMErrorCode solveSystem()
[Push operators to pipeline]
Definition plate.cpp:308
MoFEMErrorCode assembleSystem()
[Boundary condition]
Definition plate.cpp:234
MoFEMErrorCode readMesh()
[Read mesh]
Definition plate.cpp:158

◆ setupProblem()

MoFEMErrorCode Plate::setupProblem ( )
private

[Read mesh]

[Set up problem]

Examples
plate.cpp.

Definition at line 170 of file plate.cpp.

170 {
172
174
175 CHKERR PetscOptionsGetInt(PETSC_NULLPTR, "", "-order", &order, PETSC_NULLPTR);
176 CHKERR PetscOptionsGetScalar(PETSC_NULLPTR, "", "-penalty", &penalty,
177 PETSC_NULLPTR);
178 CHKERR PetscOptionsGetScalar(PETSC_NULLPTR, "", "-phi", &phi, PETSC_NULLPTR);
179 CHKERR PetscOptionsGetScalar(PETSC_NULLPTR, "", "-nitsche", &nitsche,
180 PETSC_NULLPTR);
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}
#define MOFEM_LOG(channel, severity)
Log.
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
static double nitsche
Definition plate.cpp:68
constexpr int FIELD_DIM
dimension of approx. field
Definition plate.cpp:18
static double penalty
Definition plate.cpp:65
static double phi
Definition plate.cpp:66

◆ 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>();
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}
@ F
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:514
auto createDMVector(DM dm)
Get smart vector from DM.
Definition DMMoFEM.hpp:1102
double D
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.

Member Data Documentation

◆ mField

MoFEM::Interface& Plate::mField
private
Examples
plate.cpp.

Definition at line 154 of file plate.cpp.


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