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

Classes

struct  CommonData
 Collected data use d by operator to evaluate errors for the test. More...
 
struct  OpError
 Operator to evaluate errors. More...
 
struct  OpError< 1 >
 
struct  OpErrorSkel
 
struct  OpErrorSkel< 1 >
 

Public Member Functions

 AtomTest (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 [Run programme] More...
 
 AtomTest (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 AtomTest (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 
 AtomTest (MoFEM::Interface &m_field)
 
MoFEMErrorCode runProblem ()
 

Private Member Functions

MoFEMErrorCode readMesh ()
 [Run programme] More...
 
MoFEMErrorCode setupProblem ()
 [Read mesh] More...
 
MoFEMErrorCode assembleSystem ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode solveSystem ()
 [Push operators to pipeline] More...
 
MoFEMErrorCode checkResults (boost::function< bool(FEMethod *fe_method_ptr)> test_bit)
 [Postprocess results] More...
 
MoFEMErrorCode refineResults ()
 [Solve] More...
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode checkResults ()
 [Check results] More...
 
MoFEMErrorCode readMesh ()
 red mesh and randomly refine three times More...
 
MoFEMErrorCode setupProblem ()
 add field, and set up problem More...
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode checkResults ()
 
MoFEMErrorCode printResults ()
 [Check results] More...
 
MoFEMErrorCode readMesh ()
 
MoFEMErrorCode setupProblem ()
 
MoFEMErrorCode assembleSystem ()
 
MoFEMErrorCode solveSystem ()
 
MoFEMErrorCode checkResults ()
 

Private Attributes

MoFEM::InterfacemField
 
SimplesimpleInterface
 

Static Private Attributes

static ApproxFieldFunction< FIELD_DIMapproxFunction
 
static ApproxFieldFunctionDerivative< FIELD_DIMdivApproxFunction
 

Detailed Description

Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.

Definition at line 57 of file child_and_parent.cpp.

Constructor & Destructor Documentation

◆ AtomTest() [1/4]

AtomTest::AtomTest ( MoFEM::Interface m_field)
inline

Definition at line 59 of file child_and_parent.cpp.

59 : mField(m_field) {}

◆ AtomTest() [2/4]

AtomTest::AtomTest ( MoFEM::Interface m_field)
inline

Definition at line 56 of file dg_projection.cpp.

56 : mField(m_field) {}

◆ AtomTest() [3/4]

AtomTest::AtomTest ( MoFEM::Interface m_field)
inline

Definition at line 180 of file hanging_node_approx.cpp.

180 : mField(m_field) {}

◆ AtomTest() [4/4]

AtomTest::AtomTest ( MoFEM::Interface m_field)
inline

Definition at line 78 of file higher_derivatives.cpp.

78 : mField(m_field) {}

Member Function Documentation

◆ assembleSystem() [1/4]

MoFEMErrorCode AtomTest::assembleSystem ( )
private

◆ assembleSystem() [2/4]

MoFEMErrorCode AtomTest::assembleSystem ( )
private

[Push operators to pipeline]

[Set up problem]

[Push operators to pipeline]

Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.

Definition at line 290 of file child_and_parent.cpp.

290  {
293 
294  auto rule = [](int, int, int p) -> int { return 2 * p; };
295 
296  CHKERR pipeline_mng->setDomainLhsIntegrationRule(rule);
297  CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule);
298 
299  auto test_bit_parent = [](FEMethod *fe_ptr) {
300  const auto &bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
301  MOFEM_LOG("SELF", Sev::noisy) << bit << " " << bit.test(0);
302  return bit.test(0);
303  };
304 
305  pipeline_mng->getDomainLhsFE()->exeTestHook = test_bit_parent;
306  pipeline_mng->getDomainRhsFE()->exeTestHook = test_bit_parent;
307 
308  auto beta = [](const double, const double, const double) { return 1; };
309 
310  // Make aliased shared pointer, and create child element
311  domainChildLhs = boost::make_shared<DomainEle>(mField);
312  domainChildLhs->getRuleHook = rule;
313  domainChildLhs->getOpPtrVector().push_back(
314  new OpDomainMass(FIELD_NAME, FIELD_NAME, beta));
315 
316  domainChildRhs = boost::make_shared<DomainEle>(mField);
317  domainChildLhs->getRuleHook = rule;
318  domainChildRhs->getOpPtrVector().push_back(
320 
321  auto parent_op_lhs = new DomainEleOp(NOSPACE, DomainEleOp::OPSPACE);
322  parent_op_lhs->doWorkRhsHook = [&](DataOperator *op_ptr, int side,
323  EntityType type,
325  auto domain_op = static_cast<DomainEleOp *>(op_ptr);
327 
328  MOFEM_LOG("SELF", Sev::noisy) << "LHS Pipeline FE";
329 
330  if (!domainChildLhs)
331  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID, "FE not allocated");
332 
333  auto &bit =
334  domain_op->getFEMethod()->numeredEntFiniteElementPtr->getBitRefLevel();
335  if (bit == BitRefLevel().set(0)) {
336  CHKERR domain_op->loopChildren(domain_op->getFEName(),
337  domainChildLhs.get(), VERBOSE, Sev::noisy);
338  } else {
339  CHKERR domain_op->loopThis(domain_op->getFEName(), domainChildLhs.get(),
340  VERBOSE, Sev::noisy);
341  }
343  };
344 
345  auto parent_op_rhs = new DomainEleOp(NOSPACE, DomainEleOp::OPSPACE);
346  parent_op_rhs->doWorkRhsHook = [&](DataOperator *op_ptr, int side,
347  EntityType type,
349  auto domain_op = static_cast<DomainEleOp *>(op_ptr);
351 
352  MOFEM_LOG("SELF", Sev::noisy) << "RHS Pipeline FE";
353 
354  if (!domainChildRhs)
355  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID, "FE not allocated");
356 
357  auto &bit =
358  domain_op->getFEMethod()->numeredEntFiniteElementPtr->getBitRefLevel();
359  if (bit == BitRefLevel().set(0)) {
360  CHKERR domain_op->loopChildren(domain_op->getFEName(),
361  domainChildRhs.get(), VERBOSE, Sev::noisy);
362  } else if ((bit & BitRefLevel().set(0)).any()) {
363  CHKERR domain_op->loopThis(domain_op->getFEName(), domainChildRhs.get(),
364  VERBOSE, Sev::noisy);
365  }
367  };
368 
369  pipeline_mng->getOpDomainLhsPipeline().push_back(parent_op_lhs);
370  pipeline_mng->getOpDomainRhsPipeline().push_back(parent_op_rhs);
371 
373 }

◆ assembleSystem() [3/4]

MoFEMErrorCode AtomTest::assembleSystem ( )
private

◆ assembleSystem() [4/4]

MoFEMErrorCode AtomTest::assembleSystem ( )
private

◆ checkResults() [1/4]

MoFEMErrorCode AtomTest::checkResults ( )
private

[Check results]

Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.

Definition at line 213 of file dg_projection.cpp.

213  {
215  auto simple = mField.getInterface<Simple>();
216  auto pipeline_mng = mField.getInterface<PipelineManager>();
217  pipeline_mng->getDomainLhsFE().reset();
218  pipeline_mng->getDomainRhsFE().reset();
219  pipeline_mng->getOpDomainRhsPipeline().clear();
220 
221  auto rule = [](int, int, int p) -> int { return 2 * p + 1; };
222  CHKERR pipeline_mng->setDomainRhsIntegrationRule(
223  rule); // set integration rule
224 
225  auto entity_data_l2 = boost::make_shared<EntitiesFieldData>(
226  MBENTITYSET); // entity data shared between
227  // physical and post proc
228  // elements
229  auto mass_ptr = boost::make_shared<MatrixDouble>(); // integrated mass matrix
230  // of post proc element
231  auto coeffs_ptr =
232  boost::make_shared<MatrixDouble>(); // vector of coeffs shared between
233  // physical and post proc elements
234  auto data_ptr =
235  boost::make_shared<MatrixDouble>(); // data stored at integration points
236  // of the physical element and
237  // evaluated at integration points of
238  // the post proc element
239 
240  auto op_this =
241  new OpLoopThis<DomainEle>(mField, simple->getDomainFEName(), Sev::noisy);
242  pipeline_mng->getOpDomainRhsPipeline().push_back(op_this); // 1
243  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpDGProjectionEvaluation(
244  data_ptr, coeffs_ptr, entity_data_l2, AINSWORTH_LEGENDRE_BASE,
245  L2)); // 5
246  pipeline_mng->getOpDomainRhsPipeline().push_back(
247  new OpError(data_ptr)); // 6
248 
249  auto fe_physics_ptr = op_this->getThisFEPtr();
250  fe_physics_ptr->getRuleHook = [](int, int, int p) { return 2 * p; };
251 
252  fe_physics_ptr->getOpPtrVector().push_back(new OpDGProjectionMassMatrix(
253  order, mass_ptr, entity_data_l2, AINSWORTH_LEGENDRE_BASE, L2)); // 2
254  fe_physics_ptr->getOpPtrVector().push_back(
256  data_ptr)); // 3
257  fe_physics_ptr->getOpPtrVector().push_back(
258  new OpDGProjectionCoefficients(data_ptr, coeffs_ptr, mass_ptr,
259  entity_data_l2, AINSWORTH_LEGENDRE_BASE,
260  L2)); // 4
261 
262  CHKERR pipeline_mng->loopFiniteElements();
263 
265 }

◆ checkResults() [2/4]

MoFEMErrorCode AtomTest::checkResults ( )
private

◆ checkResults() [3/4]

MoFEMErrorCode AtomTest::checkResults ( )
private

◆ checkResults() [4/4]

MoFEMErrorCode AtomTest::checkResults ( boost::function< bool(FEMethod *fe_method_ptr)>  test_bit)
private

[Postprocess results]

[Check results]

Definition at line 523 of file child_and_parent.cpp.

524  {
527  pipeline_mng->getDomainLhsFE().reset();
528  pipeline_mng->getDomainRhsFE().reset();
529  pipeline_mng->getBoundaryRhsFE().reset();
530 
531  auto rule = [](int, int, int p) -> int { return 2 * p + 1; };
532  CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule);
533  pipeline_mng->getDomainRhsFE()->exeTestHook = test_bit;
534 
535  auto common_data_ptr = boost::make_shared<CommonData>();
536  common_data_ptr->resVec = createDMVector(simpleInterface->getDM());
537  common_data_ptr->L2Vec = createVectorMPI(
538  mField.get_comm(), (!mField.get_comm_rank()) ? 1 : 0, 1);
539  common_data_ptr->approxVals = boost::make_shared<VectorDouble>();
540 
541  pipeline_mng->getOpDomainRhsPipeline().push_back(
543  common_data_ptr->approxVals));
544  pipeline_mng->getOpDomainRhsPipeline().push_back(
545  new OpError<FIELD_DIM>(common_data_ptr));
546 
547  CHKERR VecZeroEntries(common_data_ptr->L2Vec);
548  CHKERR VecZeroEntries(common_data_ptr->resVec);
549 
550  CHKERR pipeline_mng->loopFiniteElements();
551 
552  CHKERR VecAssemblyBegin(common_data_ptr->L2Vec);
553  CHKERR VecAssemblyEnd(common_data_ptr->L2Vec);
554  CHKERR VecAssemblyBegin(common_data_ptr->resVec);
555  CHKERR VecAssemblyEnd(common_data_ptr->resVec);
556  double nrm2;
557  CHKERR VecNorm(common_data_ptr->resVec, NORM_2, &nrm2);
558  const double *array;
559  CHKERR VecGetArrayRead(common_data_ptr->L2Vec, &array);
560  MOFEM_LOG_C("WORLD", Sev::inform, "Error %6.4e Vec norm %6.4e\n",
561  std::sqrt(array[0]), nrm2);
562  CHKERR VecRestoreArrayRead(common_data_ptr->L2Vec, &array);
563 
564  constexpr double eps = 1e-8;
565  if (nrm2 > eps)
566  SETERRQ1(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
567  "Not converged solution err = %6.4e", nrm2);
569 }

◆ printResults()

MoFEMErrorCode AtomTest::printResults ( )
private

[Check results]

Examples
hanging_node_approx.cpp.

Definition at line 655 of file hanging_node_approx.cpp.

655  {
658  pipeline_mng->getDomainLhsFE().reset();
659  pipeline_mng->getDomainRhsFE().reset();
660 
661  auto rule = [](int, int, int p) -> int { return -1; };
662  CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule);
663 
664  static_cast<ForcesAndSourcesCore *>(pipeline_mng->getDomainRhsFE().get())
665  ->setRuleHook = [](ForcesAndSourcesCore *fe_raw_ptr, int order_row,
666  int order_col, int order_data) -> MoFEMErrorCode {
668  fe_raw_ptr->gaussPts.resize(3, 3);
669  fe_raw_ptr->gaussPts(0, 0) = 0;
670  fe_raw_ptr->gaussPts(1, 0) = 0;
671  fe_raw_ptr->gaussPts(2, 0) = 0;
672  fe_raw_ptr->gaussPts(0, 1) = 1;
673  fe_raw_ptr->gaussPts(1, 1) = 0;
674  fe_raw_ptr->gaussPts(2, 1) = 0;
675  fe_raw_ptr->gaussPts(0, 2) = 0;
676  fe_raw_ptr->gaussPts(1, 2) = 1;
677  fe_raw_ptr->gaussPts(2, 2) = 0;
679  };
680 
681  auto field_op_row = new ForcesAndSourcesCore::UserDataOperator(
682  FIELD_NAME, DomainEleOp::OPROW);
683 
684  auto approx_vals = boost::make_shared<VectorDouble>();
685 
686  auto &moab = mField.get_moab();
687  Tag th;
688  double def_val[] = {0};
689  CHKERR moab.tag_get_handle("FIELD", 1, MB_TYPE_DOUBLE, th,
690  MB_TAG_CREAT | MB_TAG_SPARSE, &def_val);
691 
692  field_op_row->doWorkRhsHook = [&](DataOperator *base_op_ptr, int side,
693  EntityType type,
696  if (type == MBVERTEX) {
697  auto op_ptr =
699  base_op_ptr);
700  auto t_field = getFTensor0FromVec(*approx_vals);
701  auto nb_gauss_pts = op_ptr->getGaussPts().size2();
702  if (nb_gauss_pts != 3)
703  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
704  "Should be three guass pts.");
705  auto conn = op_ptr->getConn();
706  for (auto gg = 0; gg != nb_gauss_pts; ++gg) {
707  const double v = t_field;
708  CHKERR moab.tag_set_data(th, &conn[gg], 1, &v);
709  ++t_field;
710  }
711  }
713  };
714 
715  set_parent_dofs<DomainParentEle>(mField, pipeline_mng->getDomainRhsFE(),
716  DomainEleOp::OPSPACE, VERBOSE, Sev::noisy);
717  set_parent_dofs<DomainParentEle>(mField, pipeline_mng->getDomainRhsFE(),
718  DomainEleOp::OPROW, VERBOSE, Sev::noisy);
719  pipeline_mng->getOpDomainRhsPipeline().push_back(
720  new OpCalculateScalarFieldValues(FIELD_NAME, approx_vals));
721  pipeline_mng->getOpDomainRhsPipeline().push_back(field_op_row);
722  CHKERR pipeline_mng->loopFiniteElements();
723 
724  CHKERR mField.getInterface<BitRefManager>()->writeBitLevelByType(
725  bit(nb_ref_levels), BitRefLevel().set(), MBTRI, "out.vtk", "VTK", "");
726 
728 }

◆ readMesh() [1/4]

MoFEMErrorCode AtomTest::readMesh ( )
private

◆ readMesh() [2/4]

MoFEMErrorCode AtomTest::readMesh ( )
private

[Run programme]

[Read mesh]

Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.

Definition at line 208 of file child_and_parent.cpp.

208  {
210 
214 
215  MOFEM_LOG("WORLD", Sev::verbose) << "Dim " << simpleInterface->getDim();
216 
217  auto bit_level0 = simpleInterface->getBitRefLevel();
218 
219  auto &moab = mField.get_moab();
220 
221  auto refine_mesh = [&](auto bit_level1) {
223 
224  auto refine = mField.getInterface<MeshRefinement>();
225 
226  auto meshset_level0_ptr = get_temp_meshset_ptr(moab);
227  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByRefLevel(
228  bit_level0, BitRefLevel().set(), *meshset_level0_ptr);
229 
230  // random mesh refinement
231  auto meshset_ref_edges_ptr = get_temp_meshset_ptr(moab);
232  Range edges_to_refine;
233  CHKERR moab.get_entities_by_type(*meshset_level0_ptr, MBEDGE,
234  edges_to_refine);
235  int ii = 0;
236  for (Range::iterator eit = edges_to_refine.begin();
237  eit != edges_to_refine.end(); eit++, ii++) {
238  int numb = ii % 2;
239  if (numb == 0) {
240  CHKERR moab.add_entities(*meshset_ref_edges_ptr, &*eit, 1);
241  }
242  }
243  CHKERR refine->addVerticesInTheMiddleOfEdges(*meshset_ref_edges_ptr,
244  bit_level1, false, VERBOSE);
245  if (simpleInterface->getDim() == 3) {
246  CHKERR refine->refineTets(*meshset_level0_ptr, bit_level1, VERBOSE);
247  } else if (simpleInterface->getDim() == 2) {
248  CHKERR refine->refineTris(*meshset_level0_ptr, bit_level1, VERBOSE);
249  } else {
250  SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
251  "Dimension not handled by test");
252  }
253 
255  };
256 
257  BitRefLevel bit_level1;
258  bit_level1.set(1);
259  CHKERR refine_mesh(bit_level1);
262 
264 }

◆ readMesh() [3/4]

MoFEMErrorCode AtomTest::readMesh ( )
private

◆ readMesh() [4/4]

MoFEMErrorCode AtomTest::readMesh ( )
private

red mesh and randomly refine three times

Returns
MoFEMErrorCode

◆ refineResults()

MoFEMErrorCode AtomTest::refineResults ( )
private

[Solve]

Examples
child_and_parent.cpp.

Definition at line 399 of file child_and_parent.cpp.

399  {
401 
402  auto &moab = mField.get_moab();
403 
404  auto bit_level0 = BitRefLevel().set(0);
405  auto bit_level1 = BitRefLevel().set(1);
406  auto bit_level2 = BitRefLevel().set(2);
407 
408  auto refine_mesh = [&]() {
410 
411  auto refine = mField.getInterface<MeshRefinement>();
412 
413  auto meshset_level1_ptr = get_temp_meshset_ptr(moab);
414  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByDimAndRefLevel(
415  bit_level1, BitRefLevel().set(), simpleInterface->getDim(),
416  *meshset_level1_ptr);
417 
418  // random mesh refinement
419  auto meshset_ref_edges_ptr = get_temp_meshset_ptr(moab);
420  Range edges_to_refine;
421  CHKERR mField.getInterface<BitRefManager>()->getEntitiesByTypeAndRefLevel(
422  bit_level1, BitRefLevel().set(), MBEDGE, edges_to_refine);
423 
424  CHKERR refine->addVerticesInTheMiddleOfEdges(edges_to_refine, bit_level2,
425  VERBOSE);
426  if (simpleInterface->getDim() == 3) {
427  CHKERR refine->refineTets(*meshset_level1_ptr, bit_level2, VERBOSE);
428  } else if (simpleInterface->getDim() == 2) {
429  CHKERR refine->refineTris(*meshset_level1_ptr, bit_level2, VERBOSE);
430  } else {
431  SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
432  "Dimension not handled by test");
433  }
434 
435  Range meshsets;
436  CHKERR moab.get_entities_by_type(0, MBENTITYSET, meshsets, true);
437  for (auto m : meshsets) {
439  ->updateMeshsetByEntitiesChildren(m, bit_level2, m, MBMAXTYPE, false);
440  }
441 
443  };
444 
445  CHKERR refine_mesh();
446 
447  simpleInterface->getBitRefLevel() = bit_level1 | bit_level2;
449 
451 
452  CHKERR mField.getInterface<ProblemsManager>()->removeDofsOnEntities(
454  bit_level0 | bit_level1);
455 
456  auto project_data = [&]() {
458 
460 
461  pipeline_mng->getDomainLhsFE().reset();
462  pipeline_mng->getDomainRhsFE().reset();
463  pipeline_mng->getBoundaryRhsFE().reset();
464 
465  auto rule = [](int, int, int p) -> int { return 2 * p; };
466 
467  CHKERR pipeline_mng->setDomainLhsIntegrationRule(rule);
468  CHKERR pipeline_mng->setDomainRhsIntegrationRule(rule);
469  CHKERR pipeline_mng->setBoundaryRhsIntegrationRule(rule);
470 
471  auto test_bit_ref = [](FEMethod *fe_ptr) {
472  const auto &bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
473  MOFEM_LOG("SELF", Sev::noisy) << "ref : " << bit << " " << bit.test(2);
474  return bit.test(2);
475  };
476 
477  pipeline_mng->getDomainLhsFE()->exeTestHook = test_bit_ref;
478  pipeline_mng->getDomainRhsFE()->exeTestHook = test_bit_ref;
479  pipeline_mng->getBoundaryRhsFE()->exeTestHook = test_bit_ref;
480 
481  auto beta = [](const double, const double, const double) { return 1; };
482  auto field_vals_ptr = boost::make_shared<VectorDouble>();
483 
484  auto domainParentRhs = boost::make_shared<DomainParentEle>(mField);
485  domainParentRhs->getOpPtrVector().push_back(
486  new OpCalculateScalarFieldValues(FIELD_NAME, field_vals_ptr));
487 
488  pipeline_mng->getOpDomainLhsPipeline().push_back(
489  new OpDomainMass(FIELD_NAME, FIELD_NAME, beta));
490  pipeline_mng->getOpDomainRhsPipeline().push_back(
491  new OpRunParent(domainParentRhs, bit_level2, bit_level2,
492  domainParentRhs, bit_level2, BitRefLevel().set()));
493 
495  PETSC>::LinearForm<GAUSS>::OpBaseTimesScalar<1>;
496  pipeline_mng->getOpDomainRhsPipeline().push_back(
497  new OpDomainTimesScalarField(FIELD_NAME, field_vals_ptr, beta));
498 
499  pipeline_mng->getOpDomainRhsPipeline().push_back(
501 
502  pipeline_mng->getOpBoundaryRhsPipeline().push_back(
504 
506 
507  simpleInterface->getBitRefLevel() = bit_level2;
510 
511  CHKERR checkResults([](FEMethod *fe_ptr) { return true; });
512 
514  };
515 
516  CHKERR project_data();
517 
519 }

◆ runProblem() [1/4]

MoFEMErrorCode AtomTest::runProblem ( )

◆ runProblem() [2/4]

MoFEMErrorCode AtomTest::runProblem ( )

[Run programme]

Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.

Definition at line 188 of file child_and_parent.cpp.

188  {
190  CHKERR readMesh();
194 
195  auto test_bit_child = [](FEMethod *fe_ptr) {
196  const auto &bit = fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel();
197  MOFEM_LOG("SELF", Sev::noisy) << bit << " " << bit.test(0);
198  return bit.test(1);
199  };
200 
204 }

◆ runProblem() [3/4]

MoFEMErrorCode AtomTest::runProblem ( )

◆ runProblem() [4/4]

MoFEMErrorCode AtomTest::runProblem ( )

◆ setupProblem() [1/4]

MoFEMErrorCode AtomTest::setupProblem ( )
private

◆ setupProblem() [2/4]

MoFEMErrorCode AtomTest::setupProblem ( )
private

[Read mesh]

[Set up problem]

Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.

Definition at line 268 of file child_and_parent.cpp.

◆ setupProblem() [3/4]

MoFEMErrorCode AtomTest::setupProblem ( )
private

◆ setupProblem() [4/4]

MoFEMErrorCode AtomTest::setupProblem ( )
private

add field, and set up problem

Returns
MoFEMErrorCode

◆ solveSystem() [1/4]

MoFEMErrorCode AtomTest::solveSystem ( )
private

◆ solveSystem() [2/4]

MoFEMErrorCode AtomTest::solveSystem ( )
private

[Push operators to pipeline]

[Solve]

Examples
child_and_parent.cpp, dg_projection.cpp, hanging_node_approx.cpp, and higher_derivatives.cpp.

Definition at line 377 of file child_and_parent.cpp.

377  {
380 
381  MOFEM_LOG("WORLD", Sev::inform) << "Solve problem";
382 
383  auto solver = pipeline_mng->createKSP();
384  CHKERR KSPSetFromOptions(solver);
385  CHKERR KSPSetUp(solver);
386 
387  auto dm = simpleInterface->getDM();
388  auto D = createDMVector(dm);
389  auto F = vectorDuplicate(D);
390 
391  CHKERR KSPSolve(solver, F, D);
392  CHKERR VecGhostUpdateBegin(D, INSERT_VALUES, SCATTER_FORWARD);
393  CHKERR VecGhostUpdateEnd(D, INSERT_VALUES, SCATTER_FORWARD);
394  CHKERR DMoFEMMeshToLocalVector(dm, D, INSERT_VALUES, SCATTER_REVERSE);
396 }

◆ solveSystem() [3/4]

MoFEMErrorCode AtomTest::solveSystem ( )
private

◆ solveSystem() [4/4]

MoFEMErrorCode AtomTest::solveSystem ( )
private

Member Data Documentation

◆ approxFunction

ApproxFieldFunction< FIELD_DIM > AtomTest::approxFunction
staticprivate
Initial value:
Examples
child_and_parent.cpp, and hanging_node_approx.cpp.

Definition at line 67 of file child_and_parent.cpp.

◆ divApproxFunction

ApproxFieldFunctionDerivative< FIELD_DIM > AtomTest::divApproxFunction
staticprivate
Initial value:
Examples
hanging_node_approx.cpp.

Definition at line 189 of file hanging_node_approx.cpp.

◆ mField

MoFEM::Interface & AtomTest::mField
private

Definition at line 64 of file child_and_parent.cpp.

◆ simpleInterface

Simple * AtomTest::simpleInterface
private

Definition at line 65 of file child_and_parent.cpp.


The documentation for this struct was generated from the following files:
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
MoFEM::PipelineManager::getDomainRhsFE
boost::shared_ptr< FEMethod > & getDomainRhsFE()
Definition: PipelineManager.hpp:405
H1
@ H1
continuous field
Definition: definitions.h:85
OpError
Definition: initial_diffusion.cpp:61
MoFEM::DataOperator
base operator to do operations at Gauss Pt. level
Definition: DataOperators.hpp:24
MoFEM::OpLoopThis
Execute "this" element in the operator.
Definition: DGProjection.hpp:68
MoFEM::ProblemsManager
Problem manager is used to build and partition problems.
Definition: ProblemsManager.hpp:21
MoFEM::FEMethod
structure for User Loop Methods on finite elements
Definition: LoopMethods.hpp:369
MoFEM::OpRunParent
Operator to execute finite element instance on parent element. This operator is typically used to pro...
Definition: MeshProjectionDataOperators.hpp:17
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
FIELD_NAME
constexpr char FIELD_NAME[]
Definition: child_and_parent.cpp:14
AtomTest::mField
MoFEM::Interface & mField
Definition: child_and_parent.cpp:64
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
MoFEM::PipelineManager::loopFiniteElements
MoFEMErrorCode loopFiniteElements(SmartPetscObj< DM > dm=nullptr)
Iterate finite elements.
Definition: PipelineManager.cpp:19
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::OpCalculateVectorFieldValues
Get values at integration pts for tensor filed rank 1, i.e. vector field.
Definition: UserDataOperators.hpp:466
MoFEM::PipelineManager::getOpDomainRhsPipeline
boost::ptr_deque< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
Definition: PipelineManager.hpp:773
MoFEM::CoreInterface::get_comm_rank
virtual int get_comm_rank() const =0
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
AtomTest::simpleInterface
Simple * simpleInterface
Definition: child_and_parent.cpp:65
MoFEM::Simple::loadFile
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition: Simple.cpp:194
MoFEM::PETSC
@ PETSC
Definition: FormsIntegrators.hpp:105
MoFEM::PipelineManager
PipelineManager interface.
Definition: PipelineManager.hpp:24
MoFEM::OpDGProjectionCoefficients
Definition: DGProjection.hpp:119
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
MoFEM::PipelineManager::getBoundaryRhsFE
boost::shared_ptr< FEMethod > & getBoundaryRhsFE()
Definition: PipelineManager.hpp:413
OpCheckGaussCoords
Definition: child_and_parent.cpp:137
AtomTest::assembleSystem
MoFEMErrorCode assembleSystem()
[Push operators to pipeline]
Definition: child_and_parent.cpp:290
nb_ref_levels
constexpr int nb_ref_levels
Three levels of refinement.
Definition: hanging_node_approx.cpp:17
MoFEM::Simple::getBitRefLevelMask
BitRefLevel & getBitRefLevelMask()
Get the BitRefLevel.
Definition: Simple.hpp:361
test_bit_child
auto test_bit_child
lambda function used to select elements on which finite element pipelines are executed.
Definition: hanging_node_approx.cpp:173
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
OpDomainMass
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM > OpDomainMass
Definition: child_and_parent.cpp:53
order
constexpr int order
Definition: dg_projection.cpp:18
FIELD_DIM
constexpr int FIELD_DIM
Definition: child_and_parent.cpp:15
MoFEM::Simple::getOptions
MoFEMErrorCode getOptions()
get options
Definition: Simple.cpp:180
MoFEM::Simple::getDM
MoFEMErrorCode getDM(DM *dm)
Get DM.
Definition: Simple.cpp:747
VERBOSE
@ VERBOSE
Definition: definitions.h:222
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::createDMVector
auto createDMVector(DM dm)
Get smart vector from DM.
Definition: DMMoFEM.hpp:1099
domainChildLhs
boost::shared_ptr< DomainEle > domainChildLhs
[Set up problem]
Definition: child_and_parent.cpp:287
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
DomainEleOp
DomainEle::UserDataOperator DomainEleOp
Finire element operator type.
Definition: child_and_parent.cpp:36
OpDomainTimesScalarField
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpBaseTimesScalar< 1 > OpDomainTimesScalarField
Definition: initial_diffusion.cpp:32
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
default operator for TRI element
Definition: FaceElementForcesAndSourcesCore.hpp:94
MoFEM::MeshRefinement
Mesh refinement interface.
Definition: MeshRefinement.hpp:26
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
MoFEM::get_temp_meshset_ptr
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
Definition: Templates.hpp:1886
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
double
bit
auto bit
set bit
Definition: hanging_node_approx.cpp:75
convert.type
type
Definition: convert.py:64
MoFEM::FormsIntegrators::Assembly
Assembly methods.
Definition: FormsIntegrators.hpp:317
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
MoFEM::OpCalculateScalarFieldValues
Get value at integration points for scalar field.
Definition: UserDataOperators.hpp:82
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:264
MoFEM::PipelineManager::createKSP
SmartPetscObj< KSP > createKSP(SmartPetscObj< DM > dm=nullptr)
Create KSP (linear) solver.
Definition: PipelineManager.cpp:49
MoFEM::PipelineManager::setDomainRhsIntegrationRule
MoFEMErrorCode setDomainRhsIntegrationRule(RuleHookFun rule)
Definition: PipelineManager.hpp:530
AtomTest::refineResults
MoFEMErrorCode refineResults()
[Solve]
Definition: child_and_parent.cpp:399
AtomTest::approxFunction
static ApproxFieldFunction< FIELD_DIM > approxFunction
Definition: child_and_parent.cpp:67
MoFEM::PipelineManager::getOpDomainLhsPipeline
boost::ptr_deque< UserDataOperator > & getOpDomainLhsPipeline()
Get the Op Domain Lhs Pipeline object.
Definition: PipelineManager.hpp:749
MoFEM::Simple::setFieldOrder
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition: Simple.cpp:545
AtomTest::solveSystem
MoFEMErrorCode solveSystem()
[Push operators to pipeline]
Definition: child_and_parent.cpp:377
MoFEM::PipelineManager::setDomainLhsIntegrationRule
MoFEMErrorCode setDomainLhsIntegrationRule(RuleHookFun rule)
Definition: PipelineManager.hpp:503
MoFEM::ForcesAndSourcesCore
structure to get information form mofem into EntitiesFieldData
Definition: ForcesAndSourcesCore.hpp:22
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
Range
MoFEM::PipelineManager::getDomainLhsFE
boost::shared_ptr< FEMethod > & getDomainLhsFE()
Definition: PipelineManager.hpp:401
DomainEleOp
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
FIELD_NAME
constexpr char FIELD_NAME[]
Definition: dg_projection.cpp:14
MoFEM::vectorDuplicate
SmartPetscObj< Vec > vectorDuplicate(Vec vec)
Create duplicate vector of smart vector.
Definition: PetscSmartObj.hpp:221
MoFEM::OpDGProjectionEvaluation
Definition: DGProjection.hpp:136
ApproxFieldFunctionDerivative
Definition: hanging_node_approx.cpp:32
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
eps
static const double eps
Definition: check_base_functions_derivatives_on_tet.cpp:11
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::ForcesAndSourcesCore::gaussPts
MatrixDouble gaussPts
Matrix of integration points.
Definition: ForcesAndSourcesCore.hpp:109
AtomTest::checkResults
MoFEMErrorCode checkResults()
[Check results]
Definition: dg_projection.cpp:213
MoFEM::Simple::getBitRefLevel
BitRefLevel & getBitRefLevel()
Get the BitRefLevel.
Definition: Simple.hpp:354
MoFEM::createVectorMPI
auto createVectorMPI(MPI_Comm comm, PetscInt n, PetscInt N)
Create MPI Vector.
Definition: PetscSmartObj.hpp:202
MoFEM::Simple::getDim
int getDim() const
Get the problem dimension.
Definition: Simple.hpp:312
MoFEM::PipelineManager::getOpBoundaryRhsPipeline
boost::ptr_deque< UserDataOperator > & getOpBoundaryRhsPipeline()
Get the Op Boundary Rhs Pipeline object.
Definition: PipelineManager.hpp:821
AtomTest::readMesh
MoFEMErrorCode readMesh()
[Run programme]
Definition: child_and_parent.cpp:208
MoFEM::Simple::addBoundaryField
MoFEMErrorCode addBoundaryField(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 boundary.
Definition: Simple.cpp:354
MoFEM::Simple::reSetUp
MoFEMErrorCode reSetUp(bool only_dm=false)
Rebuild internal MoFEM data structures.
Definition: Simple.cpp:709
ReactionDiffusionEquation::D
const double D
diffusivity
Definition: reaction_diffusion.cpp:20
domainChildRhs
boost::shared_ptr< DomainEle > domainChildRhs
Definition: child_and_parent.cpp:287
MoFEM::PipelineManager::setBoundaryRhsIntegrationRule
MoFEMErrorCode setBoundaryRhsIntegrationRule(RuleHookFun rule)
Definition: PipelineManager.hpp:584
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
MoFEM::BitRefManager
Managing BitRefLevels.
Definition: BitRefManager.hpp:21
MoFEM::Types::BitRefLevel
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
MOFEM_ATOM_TEST_INVALID
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:40
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
OpDomainSource
FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, FIELD_DIM > OpDomainSource
Definition: child_and_parent.cpp:55
MoFEM::Simple::setUp
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition: Simple.cpp:683
MoFEM::Simple::getProblemName
const std::string getProblemName() const
Get the Problem Name.
Definition: Simple.hpp:389
convert.int
int
Definition: convert.py:64
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
AtomTest::setupProblem
MoFEMErrorCode setupProblem()
[Read mesh]
Definition: child_and_parent.cpp:268
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
FIELD_NAME
constexpr char FIELD_NAME[]
Definition: hanging_node_approx.cpp:14
ApproxFieldFunction
Definition: child_and_parent.cpp:43
F
@ F
Definition: free_surface.cpp:394
MoFEM::OpDGProjectionMassMatrix
Definition: DGProjection.hpp:106