v0.13.1
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  ElementsAndOps< DIM >
 
struct  ElementsAndOps< 2 >
 
struct  ElementsAndOps< 3 >
 
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 = ElementsAndOps< SPACE_DIM >::DomainEle
 
using DomainParentEle = ElementsAndOps< SPACE_DIM >::DomianParentEle
 
using DomainEleOp = DomainEle::UserDataOperator
 
using BoundaryEle = ElementsAndOps< SPACE_DIM >::BoundaryEle
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using BoundaryParentEle = ElementsAndOps< SPACE_DIM >::BoundaryParentEle
 
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 40 of file hanging_node_approx.cpp.

◆ BoundaryEleOp

Definition at line 41 of file hanging_node_approx.cpp.

◆ BoundaryParentEle

Definition at line 42 of file hanging_node_approx.cpp.

◆ DomainEle

Definition at line 37 of file hanging_node_approx.cpp.

◆ DomainEleOp

Definition at line 39 of file hanging_node_approx.cpp.

◆ DomainParentEle

Definition at line 38 of file hanging_node_approx.cpp.

◆ EntData

Definition at line 44 of file hanging_node_approx.cpp.

◆ OpDomainMass

evaluate mass matrix

Definition at line 76 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

Definition at line 83 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 763 of file hanging_node_approx.cpp.

763 {
764
765 // Initialisation of MoFEM/PETSc and MOAB data structures
766 MoFEM::Core::Initialize(&argc, &argv, NULL, help);
767
768 try {
769
770 //! [Register MoFEM discrete manager in PETSc]
771 DMType dm_name = "DMMOFEM";
772 CHKERR DMRegister_MoFEM(dm_name);
773 //! [Register MoFEM discrete manager in PETSc
774
775 //! [Create MoAB]
776 moab::Core mb_instance; ///< mesh database
777 moab::Interface &moab = mb_instance; ///< mesh database interface
778 //! [Create MoAB]
779
780 //! [Create MoFEM]
781 MoFEM::Core core(moab); ///< finite element database
782 MoFEM::Interface &m_field = core; ///< finite element database insterface
783 //! [Create MoFEM]
784
785 //! [AtomTest]
786 AtomTest ex(m_field);
787 CHKERR ex.runProblem();
788 //! [AtomTest]
789 }
791
793}
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
#define CHKERR
Inline error check.
Definition: definitions.h:535
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMMoFEM.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.

Examples
hanging_node_approx.cpp, and poisson_2d_homogeneous.cpp.

Definition at line 107 of file hanging_node_approx.cpp.

110 {
111
112 auto jac_ptr = boost::make_shared<MatrixDouble>();
113 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
114 auto det_ptr = boost::make_shared<VectorDouble>();
115
116 BitRefLevel bit_marker;
117 for (auto l = 1; l <= nb_ref_levels; ++l)
118 bit_marker |= marker(l);
119
120 boost::function<void(boost::shared_ptr<ForcesAndSourcesCore>, int)>
121 add_parent_level =
122 [&](boost::shared_ptr<ForcesAndSourcesCore> parent_fe_pt, int level) {
123 if (level > 0) {
124
125 auto fe_ptr_current = boost::shared_ptr<ForcesAndSourcesCore>(
126 new PARENT_FE(m_field));
127 if (op == DomainEleOp::OPSPACE) {
128 if (typeid(PARENT_FE) == typeid(DomainParentEle)) {
129 fe_ptr_current->getOpPtrVector().push_back(
130 new OpCalculateHOJac<2>(jac_ptr));
131 fe_ptr_current->getOpPtrVector().push_back(
132 new OpInvertMatrix<2>(jac_ptr, det_ptr, inv_jac_ptr));
133 fe_ptr_current->getOpPtrVector().push_back(
134 new OpSetHOInvJacToScalarBases<2>(H1, inv_jac_ptr));
135 }
136 }
137
138 add_parent_level(
139 boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
140 fe_ptr_current),
141 level - 1);
142
143 if (op == DomainEleOp::OPSPACE) {
144
145 parent_fe_pt->getOpPtrVector().push_back(
146
148
149 H1, op, fe_ptr_current,
150
151 BitRefLevel().set(), bit(0).flip(),
152
153 bit_marker, BitRefLevel().set(),
154
155 verbosity, sev));
156
157 } else {
158
159 parent_fe_pt->getOpPtrVector().push_back(
160
162
163 FIELD_NAME, op, fe_ptr_current,
164
165 BitRefLevel().set(), bit(0).flip(),
166
167 bit_marker, BitRefLevel().set(),
168
169 verbosity, sev));
170 }
171 }
172 };
173
174 add_parent_level(boost::dynamic_pointer_cast<ForcesAndSourcesCore>(fe_top),
176};
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
@ OPSPACE
operator do Work is execute on space data
Operator to project base functions from parent entity.
Set inverse jacobian to base functions.

Variable Documentation

◆ bit

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

◆ FIELD_DIM

constexpr int FIELD_DIM = 1
constexpr

Definition at line 17 of file hanging_node_approx.cpp.

◆ FIELD_NAME

constexpr char FIELD_NAME[] = "U"
constexpr

Definition at line 16 of file hanging_node_approx.cpp.

◆ help

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

Definition at line 14 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
Definition: definitions.h:219

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 97 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, and poisson_2d_homogeneous.cpp.

Definition at line 19 of file hanging_node_approx.cpp.

◆ SPACE_DIM

constexpr int SPACE_DIM = 2
constexpr

Definition at line 18 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, retrive data from parents using operators pushed by set_parent_dofs
Examples
child_and_parent.cpp, hanging_node_approx.cpp, and poisson_2d_homogeneous.cpp.

Definition at line 186 of file hanging_node_approx.cpp.