v0.14.0
Classes | Typedefs | Functions | Variables
hanging_node_approx.cpp File Reference
#include <MoFEM.hpp>

Go to the source code of this file.

Classes

struct  ApproxFieldFunction< FIELD_DIM >
 
struct  ApproxFieldFunctionDerivative< FIELD_DIM >
 
struct  ApproxFieldFunction< 1 >
 third order polynomial used for testing More...
 
struct  ApproxFieldFunctionDerivative< 1 >
 third order polynomial used for testing More...
 
struct  AtomTest
 
struct  AtomTest::CommonData
 Collected data use d by operator to evaluate errors for the test. More...
 
struct  AtomTest::OpError
 Operator to evaluate errors. More...
 
struct  AtomTest::OpErrorSkel< FIELD_DIM >
 
struct  AtomTest::OpError< 1 >
 
struct  AtomTest::OpErrorSkel< 1 >
 

Typedefs

using DomainEle = PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::DomainEle
 
using DomainParentEle = PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::DomianParentEle
 
using BoundaryEle = PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::BoundaryEle
 
using BoundaryParentEle = PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::BoundaryParentEle
 
using DomainEleOp = DomainEle::UserDataOperator
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using EntData = EntitiesFieldData::EntData
 
using OpDomainMass = FormsIntegrators< DomainEleOp >::Assembly< PETSC >::BiLinearForm< GAUSS >::OpMass< 1, FIELD_DIM >
 evaluate mass matrix More...
 
using OpDomainSource = FormsIntegrators< DomainEleOp >::Assembly< PETSC >::LinearForm< GAUSS >::OpSource< 1, FIELD_DIM >
 evaluate source, i.e. rhs vector More...
 

Functions

template<typename PARENT_FE >
auto set_parent_dofs (MoFEM::Interface &m_field, boost::shared_ptr< FEMethod > &fe_top, ForcesAndSourcesCore::UserDataOperator::OpType op, int verbosity, LogManager::SeverityLevel sev)
 set levels of projection operators, which project field data from parent entities, to child, up to to level, i.e. last mesh refinement. More...
 
int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 
constexpr char FIELD_NAME [] = "U"
 
constexpr int FIELD_DIM = 1
 
constexpr int SPACE_DIM = 2
 
constexpr int nb_ref_levels = 3
 Three levels of refinement. More...
 
auto bit = [](auto l) { return BitRefLevel().set(l); }
 set bit More...
 
auto marker
 set bit to marker More...
 
auto test_bit_child
 lambda function used to select elements on which finite element pipelines are executed. More...
 

Typedef Documentation

◆ BoundaryEle

Definition at line 23 of file hanging_node_approx.cpp.

◆ BoundaryEleOp

Definition at line 27 of file hanging_node_approx.cpp.

◆ BoundaryParentEle

Definition at line 25 of file hanging_node_approx.cpp.

◆ DomainEle

Definition at line 19 of file hanging_node_approx.cpp.

◆ DomainEleOp

Definition at line 26 of file hanging_node_approx.cpp.

◆ DomainParentEle

Definition at line 21 of file hanging_node_approx.cpp.

◆ EntData

Examples
hanging_node_approx.cpp.

Definition at line 29 of file hanging_node_approx.cpp.

◆ OpDomainMass

using OpDomainMass = FormsIntegrators<DomainEleOp>::Assembly< PETSC>::BiLinearForm<GAUSS>::OpMass<1, FIELD_DIM>

evaluate mass matrix

Examples
hanging_node_approx.cpp.

Definition at line 62 of file hanging_node_approx.cpp.

◆ OpDomainSource

using OpDomainSource = FormsIntegrators<DomainEleOp>::Assembly< PETSC>::LinearForm<GAUSS>::OpSource<1, FIELD_DIM>

evaluate source, i.e. rhs vector

Examples
hanging_node_approx.cpp.

Definition at line 69 of file hanging_node_approx.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

[Register MoFEM discrete manager in PETSc]

[Register MoFEM discrete manager in PETSc

[Create MoAB]

< mesh database

< mesh database interface

[Create MoAB]

[Create MoFEM]

< finite element database

< finite element database insterface

[Create MoFEM]

[AtomTest]

[AtomTest]

Examples
hanging_node_approx.cpp.

Definition at line 730 of file hanging_node_approx.cpp.

730  {
731 
732  // Initialisation of MoFEM/PETSc and MOAB data structures
733  MoFEM::Core::Initialize(&argc, &argv, NULL, help);
734 
735  try {
736 
737  //! [Register MoFEM discrete manager in PETSc]
738  DMType dm_name = "DMMOFEM";
739  CHKERR DMRegister_MoFEM(dm_name);
740  //! [Register MoFEM discrete manager in PETSc
741 
742  //! [Create MoAB]
743  moab::Core mb_instance; ///< mesh database
744  moab::Interface &moab = mb_instance; ///< mesh database interface
745  //! [Create MoAB]
746 
747  //! [Create MoFEM]
748  MoFEM::Core core(moab); ///< finite element database
749  MoFEM::Interface &m_field = core; ///< finite element database insterface
750  //! [Create MoFEM]
751 
752  //! [AtomTest]
753  AtomTest ex(m_field);
754  CHKERR ex.runProblem();
755  //! [AtomTest]
756  }
757  CATCH_ERRORS;
758 
760 }

◆ set_parent_dofs()

template<typename PARENT_FE >
auto set_parent_dofs ( MoFEM::Interface m_field,
boost::shared_ptr< FEMethod > &  fe_top,
ForcesAndSourcesCore::UserDataOperator::OpType  op,
int  verbosity,
LogManager::SeverityLevel  sev 
)

set levels of projection operators, which project field data from parent entities, to child, up to to level, i.e. last mesh refinement.

Collect data from parent elements to child

Examples
hanging_node_approx.cpp.

Definition at line 92 of file hanging_node_approx.cpp.

95  {
96 
97  BitRefLevel bit_marker;
98  for (auto l = 1; l <= nb_ref_levels; ++l)
99  bit_marker |= marker(l);
100 
101  /**
102  * @brief Collect data from parent elements to child
103  */
104  boost::function<void(boost::shared_ptr<ForcesAndSourcesCore>, int)>
105  add_parent_level =
106  [&](boost::shared_ptr<ForcesAndSourcesCore> parent_fe_pt, int level) {
107 
108  // Evaluate if not last parent element
109  if (level > 0) {
110 
111  // Create domain parent FE
112  auto fe_ptr_current = boost::shared_ptr<ForcesAndSourcesCore>(
113  new PARENT_FE(m_field));
114  if (op == DomainEleOp::OPSPACE) {
115  // Push base function
116  if (typeid(PARENT_FE) == typeid(DomainParentEle))
118  fe_ptr_current->getOpPtrVector(), {H1});
119  }
120 
121  // Call next level
122  add_parent_level(
123  boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
124  fe_ptr_current),
125  level - 1);
126 
127  // Add data to curent fe level
128  if (op == DomainEleOp::OPSPACE) {
129 
130  // Only base
131  parent_fe_pt->getOpPtrVector().push_back(
132 
133  new OpAddParentEntData(
134 
135  H1, op, fe_ptr_current,
136 
137  BitRefLevel().set(), bit(0).flip(),
138 
139  bit_marker, BitRefLevel().set(),
140 
141  verbosity, sev));
142 
143  } else {
144 
145  // Filed data
146  parent_fe_pt->getOpPtrVector().push_back(
147 
148  new OpAddParentEntData(
149 
150  FIELD_NAME, op, fe_ptr_current,
151 
152  BitRefLevel().set(), bit(0).flip(),
153 
154  bit_marker, BitRefLevel().set(),
155 
156  verbosity, sev));
157  }
158  }
159  };
160 
161  add_parent_level(boost::dynamic_pointer_cast<ForcesAndSourcesCore>(fe_top),
162  nb_ref_levels);
163 };

Variable Documentation

◆ bit

auto bit = [](auto l) { return BitRefLevel().set(l); }

◆ FIELD_DIM

constexpr int FIELD_DIM = 1
constexpr
Examples
hanging_node_approx.cpp.

Definition at line 15 of file hanging_node_approx.cpp.

◆ FIELD_NAME

constexpr char FIELD_NAME[] = "U"
constexpr
Examples
hanging_node_approx.cpp.

Definition at line 14 of file hanging_node_approx.cpp.

◆ help

char help[] = "...\n\n"
static
Examples
hanging_node_approx.cpp.

Definition at line 12 of file hanging_node_approx.cpp.

◆ marker

auto marker
Initial value:
= [](auto l) {
return BitRefLevel().set(BITREFLEVEL_SIZE - 1 - l);
}

set bit to marker

Marker is used to mark field entities on skin on which we have hanging nodes

Examples
boundary_marker.cpp, and hanging_node_approx.cpp.

Definition at line 82 of file hanging_node_approx.cpp.

◆ nb_ref_levels

constexpr int nb_ref_levels = 3
constexpr

Three levels of refinement.

Examples
hanging_node_approx.cpp.

Definition at line 17 of file hanging_node_approx.cpp.

◆ SPACE_DIM

constexpr int SPACE_DIM = 2
constexpr
Examples
hanging_node_approx.cpp.

Definition at line 16 of file hanging_node_approx.cpp.

◆ test_bit_child

auto test_bit_child
Initial value:
= [](FEMethod *fe_ptr) {
return fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel().test(
}

lambda function used to select elements on which finite element pipelines are executed.

Note
childs elements on pipeline, retrieve data from parents using operators pushed by set_parent_dofs
Examples
child_and_parent.cpp, free_surface.cpp, and hanging_node_approx.cpp.

Definition at line 173 of file hanging_node_approx.cpp.

AtomTest
Definition: child_and_parent.cpp:57
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
MoFEM::FEMethod
structure for User Loop Methods on finite elements
Definition: LoopMethods.hpp:369
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
nb_ref_levels
constexpr int nb_ref_levels
Three levels of refinement.
Definition: hanging_node_approx.cpp:17
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
help
static char help[]
Definition: hanging_node_approx.cpp:12
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
bit
auto bit
set bit
Definition: hanging_node_approx.cpp:75
DomainParentEle
ElementsAndOps< SPACE_DIM >::DomianParentEle DomainParentEle
Definition: child_and_parent.cpp:35
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:47
MoFEM::AddHOOps
Add operators pushing bases from local to physical configuration.
Definition: HODataOperators.hpp:503
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
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1094
BITREFLEVEL_SIZE
#define BITREFLEVEL_SIZE
max number of refinements
Definition: definitions.h:219
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
marker
auto marker
set bit to marker
Definition: hanging_node_approx.cpp:82
MoFEM::OpAddParentEntData
Operator to project base functions from parent entity to child.
Definition: MeshProjectionDataOperators.hpp:66
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
FIELD_NAME
constexpr char FIELD_NAME[]
Definition: hanging_node_approx.cpp:14