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

Go to the source code of this file.

Classes

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< 1 >
 
struct  AtomTest::OpErrorSkel< 1 >
 

Typedefs

using DomainEle = PipelineManager::ElementsAndOpsByDim<SPACE_DIM>::DomainEle
 
using DomainParentEle
 
using BoundaryEle
 
using BoundaryParentEle
 
using DomainEleOp = DomainEle::UserDataOperator
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using EntData = EntitiesFieldData::EntData
 
using OpDomainMass
 evaluate mass matrix
 
using OpDomainSource
 evaluate source, i.e. rhs vector
 

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.
 
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.
 
auto bit = [](auto l) { return BitRefLevel().set(l); }
 set bit
 
auto marker
 set bit to marker
 
auto test_bit_child
 lambda function used to select elements on which finite element pipelines are executed.
 

Typedef Documentation

◆ BoundaryEle

using BoundaryEle

◆ BoundaryEleOp

Definition at line 27 of file hanging_node_approx.cpp.

◆ BoundaryParentEle

◆ DomainEle

Definition at line 19 of file hanging_node_approx.cpp.

◆ DomainEleOp

Definition at line 26 of file hanging_node_approx.cpp.

◆ DomainParentEle

◆ EntData

Definition at line 29 of file hanging_node_approx.cpp.

◆ OpDomainMass

using OpDomainMass
Initial value:

evaluate mass matrix

Definition at line 61 of file hanging_node_approx.cpp.

◆ OpDomainSource

Initial value:

evaluate source, i.e. rhs vector

Definition at line 68 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]

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 }
758
760}
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:47
static char help[]
Core (interface) class.
Definition Core.hpp:82
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
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:112
Deprecated interface functions.

◆ 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
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
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),
163};
ElementsAndOps< SPACE_DIM >::DomianParentEle DomainParentEle
@ H1
continuous field
Definition definitions.h:85
auto marker
set bit to marker
constexpr int nb_ref_levels
Three levels of refinement.
constexpr char FIELD_NAME[]
auto bit
set bit
FTensor::Index< 'l', 3 > l
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
Add operators pushing bases from local to physical configuration.
@ OPSPACE
operator do Work is execute on space data
Operator to project base functions from parent entity to child.

Variable Documentation

◆ bit

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

◆ FIELD_DIM

constexpr int FIELD_DIM = 1
constexpr

Definition at line 15 of file hanging_node_approx.cpp.

◆ FIELD_NAME

constexpr char FIELD_NAME[] = "U"
constexpr

Definition at line 14 of file hanging_node_approx.cpp.

◆ help

char help[] = "...\n\n"
static

Definition at line 12 of file hanging_node_approx.cpp.

◆ marker

auto marker
Initial value:
= [](auto l) {
return BitRefLevel().set(BITREFLEVEL_SIZE - 1 - l);
}
#define BITREFLEVEL_SIZE
max number of refinements

set bit to marker

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

Examples
boundary_marker.cpp, free_surface.cpp, and hanging_node_approx.cpp.

Definition at line 82 of file hanging_node_approx.cpp.

82 {
83 return BitRefLevel().set(BITREFLEVEL_SIZE - 1 - l);
84};

◆ 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

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(
}
structure for User Loop Methods on finite elements

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.

173 {
174 return fe_ptr->numeredEntFiniteElementPtr->getBitRefLevel().test(
176};