v0.14.0
plate.cpp
Go to the documentation of this file.
1 /**
2  * \file plate.cpp
3  * \example plate.cpp
4  *
5  * Implementation Kirchhoff-Love plate using Discointinous Galerkin (DG-Nitsche
6  * method)
7  */
8 
9 #include <MoFEM.hpp>
10 
11 using namespace MoFEM;
12 
13 static char help[] = "...\n\n";
14 
15 
16 constexpr int BASE_DIM = 1; ///< dimension of base
17 constexpr int SPACE_DIM = 2; ///< dimension of space
18 constexpr int FIELD_DIM = 1; ///< dimension of approx. field
19 
20 template <int DIM> struct ElementsAndOps {};
21 
22 template <> struct ElementsAndOps<2> {
27 };
28 
33 
35 
38 
39 using DomainEleOp =
40  DomainEle::UserDataOperator; ///< Finire element operator type
41 using EntData = EntitiesFieldData::EntData; ///< Data on entities
42 
45 
48  GAUSS>::OpGradGradSymTensorGradGrad<1, 1, SPACE_DIM, 0>;
50  PETSC>::LinearForm<GAUSS>::OpSource<BASE_DIM, FIELD_DIM>;
51 
52 // Kronecker delta
54 
55 // material parameters
56 constexpr double lambda = 1;
57 constexpr double mu = 1; ///< lame parameter
58 constexpr double t = 1; ///< plate stiffness
59 
64 
65 static double penalty = 1e6;
66 static double phi =
67  -1; // 1 - symmetric Nitsche, 0 - nonsymmetric, -1 antisymmetrica
68 static double nitsche = 1;
69 static int order = 4; // approximation order
70 
71 auto source = [](const double x, const double y, const double) {
72  return cos(2 * x * M_PI) * sin(2 * y * M_PI);
73 };
74 
75 /**
76  * @brief get fourth-order constitutive tensor
77  *
78  */
79 auto plate_stiffness = []() {
80  constexpr auto a = (SPACE_DIM * (SPACE_DIM + 1)) / 2;
81  auto mat_D_ptr = boost::make_shared<MatrixDouble>(a * a, 1);
82  auto t_D = getFTensor4DdgFromMat<2, 2, 0>(*(mat_D_ptr));
83  constexpr double t3 = t * t * t;
84  constexpr double A = mu * t3 / 12;
85  constexpr double B = lambda * t3 / 12;
86  t_D(i, j, k, l) =
87  2 * B * ((t_kd(i, k) ^ t_kd(j, l)) / 4.) + A * t_kd(i, j) * t_kd(k, l);
88  // t_D(i, j, k, l) = (t_kd(i, k) ^ t_kd(j, l)) / 4.;
89  return mat_D_ptr;
90 };
91 
93 
94 // data for skeleton computation
95 std::array<std::vector<VectorInt>, 2>
96  indicesSideMap; ///< indices on rows for left hand-side
97 std::array<std::vector<MatrixDouble>, 2>
98  diffBaseSideMap; // first derivative of base functions
99 std::array<std::vector<MatrixDouble>, 2>
100  diff2BaseSideMap; // second derivative of base functions
101 std::array<double, 2> areaMap; // area/volume of elements on the side
102 std::array<int, 2> senseMap; // orientaton of local element edge/face in respect
103  // to global orientation of edge/face
104 
105 /**
106  * @brief Operator tp collect data from elements on the side of Edge/Face
107  *
108  */
110 
111  OpCalculateSideData(std::string field_name, std::string col_field_name);
112 
113  MoFEMErrorCode doWork(int side, EntityType type, EntData &data);
114 };
115 
116 /**
117  * @brief Operator the left hand side matrix
118  *
119  */
121 public:
122  /**
123  * @brief Construct a new OpH1LhsSkeleton
124  *
125  * @param side_fe_ptr pointer to FE to evaluate side elements
126  */
127  OpH1LhsSkeleton(boost::shared_ptr<FaceSideEle> side_fe_ptr,
128  boost::shared_ptr<MatrixDouble> d_mat_ptr);
129 
130  MoFEMErrorCode doWork(int side, EntityType type,
132 
133 private:
134  boost::shared_ptr<FaceSideEle>
135  sideFEPtr; ///< pointer to element to get data on edge/face sides
136  MatrixDouble locMat; ///< local operator matrix
137  boost::shared_ptr<MatrixDouble> dMatPtr;
138 };
139 
140 struct Plate {
141 
142  Plate(MoFEM::Interface &m_field) : mField(m_field) {}
143 
144  MoFEMErrorCode runProblem();
145 
146 private:
147  MoFEMErrorCode readMesh();
148  MoFEMErrorCode setupProblem();
149  MoFEMErrorCode boundaryCondition();
150  MoFEMErrorCode assembleSystem();
151  MoFEMErrorCode solveSystem();
152  MoFEMErrorCode outputResults();
153 
155 };
156 
157 //! [Read mesh]
160 
161  auto simple = mField.getInterface<Simple>();
162  CHKERR simple->getOptions();
163  CHKERR simple->loadFile();
164 
166 }
167 //! [Read mesh]
168 
169 //! [Set up problem]
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 }
196 //! [Set up problem]
197 
198 //! [Boundary condition]
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 }
231 //! [Boundary condition]
232 
233 //! [Push operators to pipeline]
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 }
305 //! [Push operators to pipeline]
306 
307 //! [Solve system]
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 }
332 //! [Solve system]
333 
334 //! [Output results]
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 }
372 //! [Output results]
373 
374 //! [Run program]
377 
378  CHKERR readMesh();
383  // CHKERR checkResults();
385 
387 }
388 //! [Run program]
389 
390 int main(int argc, char *argv[]) {
391 
392  // Initialisation of MoFEM/PETSc and MOAB data structures
393  const char param_file[] = "param_file.petsc";
394  MoFEM::Core::Initialize(&argc, &argv, param_file, help);
395 
396  // Add logging channel for example
397  auto core_log = logging::core::get();
398  core_log->add_sink(LogManager::createSink(LogManager::getStrmWorld(), "PL"));
399  LogManager::setLog("PL");
400  MOFEM_LOG_TAG("PL", "plate");
401 
402  try {
403 
404  //! [Register MoFEM discrete manager in PETSc]
405  DMType dm_name = "DMMOFEM";
406  CHKERR DMRegister_MoFEM(dm_name);
407  //! [Register MoFEM discrete manager in PETSc
408 
409  //! [Create MoAB]
410  moab::Core mb_instance; ///< mesh database
411  moab::Interface &moab = mb_instance; ///< mesh database interface
412  //! [Create MoAB]
413 
414  //! [Create MoFEM]
415  MoFEM::Core core(moab); ///< finite element database
416  MoFEM::Interface &m_field = core; ///< finite element database insterface
417  //! [Create MoFEM]
418 
419  //! [Plate]
420  Plate ex(m_field);
421  CHKERR ex.runProblem();
422  //! [Plate]
423  }
424  CATCH_ERRORS;
425 
427 }
428 
429 OpCalculateSideData::OpCalculateSideData(std::string row_field_name,
430  std::string col_field_name)
431  : FaceSideOp(row_field_name, col_field_name, FaceSideOp::OPROW) {}
432 
434  EntData &data) {
436 
437  const auto nb_in_loop = getFEMethod()->nInTheLoop;
438 
439  auto clear = [](auto nb) {
440  indicesSideMap[nb].clear();
441  diffBaseSideMap[nb].clear();
442  diff2BaseSideMap[nb].clear();
443  };
444 
445  if (type == MBVERTEX) {
446  areaMap[nb_in_loop] = getMeasure();
447  senseMap[nb_in_loop] = getEdgeSense();
448  if (!nb_in_loop) {
449  clear(0);
450  clear(1);
451  areaMap[1] = 0;
452  senseMap[1] = 0;
453  }
454  }
455 
456  const auto nb_dofs = data.getIndices().size();
457  if (nb_dofs) {
458  indicesSideMap[nb_in_loop].push_back(data.getIndices());
459  diffBaseSideMap[nb_in_loop].push_back(
460  data.getN(BaseDerivatives::FirstDerivative));
461  diff2BaseSideMap[nb_in_loop].push_back(
462  data.getN(BaseDerivatives::SecondDerivative));
463  }
464 
466 }
467 
468 template <typename T> inline auto get_ntensor(T &base_mat) {
470  &*base_mat.data().begin());
471 };
472 
473 template <typename T> inline auto get_ntensor(T &base_mat, int gg, int bb) {
474  double *ptr = &base_mat(gg, bb);
476 };
477 
478 template <typename T> inline auto get_diff_ntensor(T &base_mat) {
479  double *ptr = &*base_mat.data().begin();
480  return getFTensor1FromPtr<2>(ptr);
481 };
482 
483 template <typename T>
484 inline auto get_diff_ntensor(T &base_mat, int gg, int bb) {
485  double *ptr = &base_mat(gg, 2 * bb);
486  return getFTensor1FromPtr<2>(ptr);
487 };
488 
489 template <typename T> inline auto get_diff2_ntensor(T &base_mat) {
490  double *ptr = &*base_mat.data().begin();
492 };
493 
494 template <typename T>
495 inline auto get_diff2_ntensor(T &base_mat, int gg, int bb) {
496  double *ptr = &base_mat(gg, 4 * bb);
498 };
499 
500 /**
501  * @brief Construct a new OpH1LhsSkeleton
502  *
503  * @param side_fe_ptr pointer to FE to evaluate side elements
504  */
505 OpH1LhsSkeleton::OpH1LhsSkeleton(boost::shared_ptr<FaceSideEle> side_fe_ptr,
506  boost::shared_ptr<MatrixDouble> mat_d_ptr)
507  : BoundaryEleOp(NOSPACE, BoundaryEleOp::OPSPACE), sideFEPtr(side_fe_ptr),
508  dMatPtr(mat_d_ptr) {}
509 
513 
514  // Collect data from side domian elements
515  CHKERR loopSideFaces("dFE", *sideFEPtr);
516  const auto in_the_loop =
517  sideFEPtr->nInTheLoop; // return number of elements on the side
518 
519  // calculate penalty
520  const double s = getMeasure() / (areaMap[0] + areaMap[1]);
521  const double p = penalty * s;
522 
523  // get normal of the face or edge
524  auto t_normal = getFTensor1Normal();
525  t_normal.normalize();
526 
527  // Elastic stiffness tensor (4th rank tensor with minor and major
528  // symmetry)
529  auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, 0>(*dMatPtr);
530 
531  // get number of integration points on face
532  const size_t nb_integration_pts = getGaussPts().size2();
533 
534  // beta paramter is zero, when penalty method is used, also, takes value 1,
535  // when boundary edge/face is evaluated, and 2 when is skeleton edge/face.
536  const double beta = static_cast<double>(nitsche) / (in_the_loop + 1);
537 
538  auto integrate = [&](auto sense_row, auto &row_ind, auto &row_diff,
539  auto &row_diff2, auto sense_col, auto &col_ind,
540  auto &col_diff, auto &col_diff2) {
542 
543  // number of dofs, for homogenous approximation this value is
544  // constant.
545  const auto nb_rows = row_ind.size();
546  const auto nb_cols = col_ind.size();
547 
548  const auto nb_row_base_functions = row_diff.size2() / SPACE_DIM;
549 
550  if (nb_cols) {
551 
552  // resize local element matrix
553  locMat.resize(nb_rows, nb_cols, false);
554  locMat.clear();
555 
556  // get base functions, and integration weights
557  auto t_diff_row_base = get_diff_ntensor(row_diff);
558  auto t_diff2_row_base = get_diff2_ntensor(row_diff2);
559 
560  auto t_w = getFTensor0IntegrationWeight();
561 
562  // iterate integration points on face/edge
563  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
564 
565  // t_w is integration weight, and measure is element area, or
566  // volume, depending if problem is in 2d/3d.
567  const double alpha = getMeasure() * t_w;
568  auto t_mat = locMat.data().begin();
569 
570  // iterate rows
571  size_t rr = 0;
572  for (; rr != nb_rows; ++rr) {
573 
575  t_mv(i, j) = t_D(i, j, k, l) * t_diff2_row_base(k, l);
576 
577  // calculate tetting function
579  t_vn_plus(i, j) = beta * (phi * t_mv(i, j) / p);
581  t_vn(i, j) = (t_diff_row_base(j) * (t_normal(i) * sense_row)) -
582  t_vn_plus(i, j);
583 
584  // get base functions on columns
585  auto t_diff_col_base = get_diff_ntensor(col_diff, gg, 0);
586  auto t_diff2_col_base = get_diff2_ntensor(col_diff2, gg, 0);
587 
588  // iterate columns
589  for (size_t cc = 0; cc != nb_cols; ++cc) {
590 
592  t_mu(i, j) = t_D(i, j, k, l) * t_diff2_col_base(k, l);
593 
594  // // calculate variance of tested function
596  t_un(i, j) = -p * ((t_diff_col_base(j) * (t_normal(i) * sense_col) -
597  beta * t_mu(i, j) / p));
598 
599  // assemble matrix
600  *t_mat -= alpha * (t_vn(i, j) * t_un(i, j));
601  *t_mat -= alpha * (t_vn_plus(i, j) * (beta * t_mu(i, j)));
602 
603  // move to next column base and element of matrix
604  ++t_diff_col_base;
605  ++t_diff2_col_base;
606  ++t_mat;
607  }
608 
609  // move to next row base
610  ++t_diff_row_base;
611  ++t_diff2_row_base;
612  }
613 
614  // this is obsolete for this particular example, we keep it for
615  // generality. in case of multi-physcis problems diffrent fields
616  // can chare hierarchical base but use diffrent approx. order,
617  // so is possible to have more base functions than DOFs on
618  // element.
619  for (; rr < nb_row_base_functions; ++rr) {
620  ++t_diff_row_base;
621  ++t_diff2_row_base;
622  }
623 
624  ++t_w;
625  }
626 
627  // assemble system
628  CHKERR ::MatSetValues(getKSPB(), nb_rows, &*row_ind.begin(),
629  col_ind.size(), &*col_ind.begin(),
630  &*locMat.data().begin(), ADD_VALUES);
631  }
632 
634  };
635 
636  // iterate the sides rows
637  for (auto s0 : {LEFT_SIDE, RIGHT_SIDE}) {
638 
639  const auto sense_row = senseMap[s0];
640 
641  for (auto x0 = 0; x0 != indicesSideMap[s0].size(); ++x0) {
642 
643  for (auto s1 : {LEFT_SIDE, RIGHT_SIDE}) {
644  const auto sense_col = senseMap[s1];
645 
646  for (auto x1 = 0; x1 != indicesSideMap[s1].size(); ++x1) {
647 
648  CHKERR integrate(sense_row, indicesSideMap[s0][x0],
649  diffBaseSideMap[s0][x0], diff2BaseSideMap[s0][x0],
650 
651  sense_col, indicesSideMap[s1][x1],
652  diffBaseSideMap[s1][x1], diff2BaseSideMap[s1][x1]
653 
654  );
655  }
656  }
657  }
658  }
659 
661 }
NOSPACE
@ NOSPACE
Definition: definitions.h:83
t_kd
constexpr auto t_kd
Definition: plate.cpp:53
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
OpCalculateSideData
Operator tp collect data from elements on the side of Edge/Face.
Definition: plate.cpp:109
MoFEM::EdgeElementForcesAndSourcesCore
Edge finite element.
Definition: EdgeElementForcesAndSourcesCore.hpp:30
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
senseMap
std::array< int, 2 > senseMap
Definition: plate.cpp:102
BoundaryEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
Definition: child_and_parent.cpp:39
get_ntensor
auto get_ntensor(T &base_mat)
Definition: plate.cpp:468
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
MoFEM::MatSetValues
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
Definition: EntitiesFieldData.hpp:1644
OpH1LhsSkeleton::sideFEPtr
boost::shared_ptr< FaceSideEle > sideFEPtr
pointer to element to get data on edge/face sides
Definition: plate.cpp:135
plate_stiffness
auto plate_stiffness
get fourth-order constitutive tensor
Definition: plate.cpp:79
OpH1LhsSkeleton::OpH1LhsSkeleton
OpH1LhsSkeleton(boost::shared_ptr< FaceSideEle > side_fe_ptr, boost::shared_ptr< MatrixDouble > d_mat_ptr)
Construct a new OpH1LhsSkeleton.
Definition: plate.cpp:505
Plate::Plate
Plate(MoFEM::Interface &m_field)
Definition: plate.cpp:142
k
FTensor::Index< 'k', SPACE_DIM > k
Definition: plate.cpp:62
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
Plate
Definition: plate.cpp:140
OpCalculateSideData::OpCalculateSideData
OpCalculateSideData(std::string field_name, std::string col_field_name)
Definition: plate.cpp:429
BASE_DIM
constexpr int BASE_DIM
dimension of base
Definition: plate.cpp:16
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
main
int main(int argc, char *argv[])
[Run program]
Definition: plate.cpp:390
FaceSideEle
PipelineManager::ElementsAndOpsByDim< FE_DIM >::FaceSideEle FaceSideEle
Definition: level_set.cpp:41
l
FTensor::Index< 'l', SPACE_DIM > l
Definition: plate.cpp:63
nitsche
static double nitsche
Definition: plate.cpp:68
MoFEM::PETSC
@ PETSC
Definition: FormsIntegrators.hpp:105
MoFEM::PipelineManager
PipelineManager interface.
Definition: PipelineManager.hpp:24
MoFEM.hpp
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
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
EntData
EntitiesFieldData::EntData EntData
Data on entities.
Definition: plate.cpp:41
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
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
Plate::readMesh
MoFEMErrorCode readMesh()
[Read mesh]
Definition: plate.cpp:158
diff2BaseSideMap
std::array< std::vector< MatrixDouble >, 2 > diff2BaseSideMap
Definition: plate.cpp:100
RIGHT_SIDE
@ RIGHT_SIDE
Definition: plate.cpp:92
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
lambda
constexpr double lambda
Definition: plate.cpp:56
get_diff_ntensor
auto get_diff_ntensor(T &base_mat)
Definition: plate.cpp:478
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::OpCalculateHOJac
Definition: HODataOperators.hpp:267
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
MoFEM::PipelineManager::EdgeEle
MoFEM::EdgeElementForcesAndSourcesCore EdgeEle
Definition: PipelineManager.hpp:36
MoFEM::PostProcBrokenMeshInMoab
Definition: PostProcBrokenMeshInMoabBase.hpp:667
indicesSideMap
std::array< std::vector< VectorInt >, 2 > indicesSideMap
indices on rows for left hand-side
Definition: plate.cpp:96
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
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
FaceSideOp
a
constexpr double a
Definition: approx_sphere.cpp:30
source
auto source
Definition: plate.cpp:71
OpCalculateSideData::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Definition: plate.cpp:433
OpH1LhsSkeleton::locMat
MatrixDouble locMat
local operator matrix
Definition: plate.cpp:136
BoundaryEleOp
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
double
convert.type
type
Definition: convert.py:64
MoFEM::PipelineManager::FaceEle
MoFEM::FaceElementForcesAndSourcesCore FaceEle
Definition: PipelineManager.hpp:35
MoFEM::FormsIntegrators::Assembly
Assembly methods.
Definition: FormsIntegrators.hpp:317
OpPPMap
OpPostProcMapInMoab< SPACE_DIM, SPACE_DIM > OpPPMap
Definition: photon_diffusion.cpp:29
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: plate.cpp:60
Plate::mField
MoFEM::Interface & mField
Definition: plate.cpp:154
MoFEM::OpCalculateScalarFieldValues
Get value at integration points for scalar field.
Definition: UserDataOperators.hpp:82
MoFEM::EntitiesFieldData::EntData::getIndices
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Definition: EntitiesFieldData.hpp:1214
areaMap
std::array< double, 2 > areaMap
Definition: plate.cpp:101
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
MoFEM::GAUSS
@ GAUSS
Definition: FormsIntegrators.hpp:136
MoFEM::OpSetHOWeightsOnFace
Modify integration weights on face to take in account higher-order geometry.
Definition: HODataOperators.hpp:122
MoFEM::FaceElementForcesAndSourcesCore
Face finite element.
Definition: FaceElementForcesAndSourcesCore.hpp:23
OpH1LhsSkeleton::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Definition: plate.cpp:510
OpH1LhsSkeleton::dMatPtr
boost::shared_ptr< MatrixDouble > dMatPtr
Definition: plate.cpp:137
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
Plate::runProblem
MoFEMErrorCode runProblem()
[Output results]
Definition: plate.cpp:375
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
BiLinearForm
OpDomainPlateStiffness
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGradSymTensorGradGrad< 1, 1, SPACE_DIM, 0 > OpDomainPlateStiffness
Definition: plate.cpp:48
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
FTensor::Index< 'i', SPACE_DIM >
help
static char help[]
Definition: plate.cpp:13
MoFEM::OpSetInvJacH1ForFace
Definition: UserDataOperators.hpp:2918
ElementsAndOps
Definition: child_and_parent.cpp:18
Range
Plate::setupProblem
MoFEMErrorCode setupProblem()
[Read mesh]
Definition: plate.cpp:170
MoFEM::PipelineManager::getDomainLhsFE
boost::shared_ptr< FEMethod > & getDomainLhsFE()
Definition: PipelineManager.hpp:401
DomainEleOp
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
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
OpDomainGradGrad
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpGradGrad< 1, 1, SPACE_DIM > OpDomainGradGrad
Definition: helmholtz.cpp:25
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
FTensor::Tensor0
Definition: Tensor0.hpp:16
Plate::solveSystem
MoFEMErrorCode solveSystem()
[Push operators to pipeline]
Definition: plate.cpp:308
MoFEM::EntitiesFieldData::EntData::getN
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
Definition: EntitiesFieldData.hpp:1318
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
penalty
static double penalty
Definition: plate.cpp:65
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
diffBaseSideMap
std::array< std::vector< MatrixDouble >, 2 > diffBaseSideMap
Definition: plate.cpp:98
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
get_diff2_ntensor
auto get_diff2_ntensor(T &base_mat)
Definition: plate.cpp:489
MoFEM::OpInvertMatrix
Definition: UserDataOperators.hpp:3249
LEFT_SIDE
@ LEFT_SIDE
Definition: plate.cpp:92
MoFEM::FaceElementForcesAndSourcesCoreOnSide::UserDataOperator
default operator for Face element
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:92
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
j
FTensor::Index< 'j', SPACE_DIM > j
Definition: plate.cpp:61
FTensor::Kronecker_Delta_symmetric
Kronecker Delta class symmetric.
Definition: Kronecker_Delta.hpp:49
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::getFTensor2SymmetricLowerFromPtr< 2 >
FTensor::Tensor2_symmetric< FTensor::PackPtr< double *, 4 >, 2 > getFTensor2SymmetricLowerFromPtr< 2 >(double *ptr)
Definition: Templates.hpp:1106
MoFEM::PetscOptionsGetScalar
PetscErrorCode PetscOptionsGetScalar(PetscOptions *, const char pre[], const char name[], PetscScalar *dval, PetscBool *set)
Definition: DeprecatedPetsc.hpp:162
DomainEle
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
Definition: child_and_parent.cpp:34
Plate::boundaryCondition
MoFEMErrorCode boundaryCondition()
[Set up problem]
Definition: plate.cpp:199
OpH1LhsSkeleton
Operator the left hand side matrix.
Definition: plate.cpp:120
ElementSide
ElementSide
Definition: plate.cpp:92
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
MoFEM::FaceElementForcesAndSourcesCoreOnSide
Base face element used to integrate on skeleton.
Definition: FaceElementForcesAndSourcesCoreOnSide.hpp:19
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
mu
constexpr double mu
lame parameter
Definition: plate.cpp:57
MoFEM::OpPostProcMapInMoab
Post post-proc data at points from hash maps.
Definition: PostProcBrokenMeshInMoabBase.hpp:698
phi
static double phi
Definition: plate.cpp:66