v0.13.2
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 = 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 22 of file hanging_node_approx.cpp.

◆ BoundaryEleOp

Definition at line 27 of file hanging_node_approx.cpp.

◆ BoundaryParentEle

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

◆ EntData

Definition at line 29 of file hanging_node_approx.cpp.

◆ OpDomainMass

evaluate mass matrix

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

735 {
736
737 // Initialisation of MoFEM/PETSc and MOAB data structures
738 MoFEM::Core::Initialize(&argc, &argv, NULL, help);
739
740 try {
741
742 //! [Register MoFEM discrete manager in PETSc]
743 DMType dm_name = "DMMOFEM";
744 CHKERR DMRegister_MoFEM(dm_name);
745 //! [Register MoFEM discrete manager in PETSc
746
747 //! [Create MoAB]
748 moab::Core mb_instance; ///< mesh database
749 moab::Interface &moab = mb_instance; ///< mesh database interface
750 //! [Create MoAB]
751
752 //! [Create MoFEM]
753 MoFEM::Core core(moab); ///< finite element database
754 MoFEM::Interface &m_field = core; ///< finite element database insterface
755 //! [Create MoFEM]
756
757 //! [AtomTest]
758 AtomTest ex(m_field);
759 CHKERR ex.runProblem();
760 //! [AtomTest]
761 }
763
765}
#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: 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 auto jac_ptr = boost::make_shared<MatrixDouble>();
98 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
99 auto det_ptr = boost::make_shared<VectorDouble>();
100
101 BitRefLevel bit_marker;
102 for (auto l = 1; l <= nb_ref_levels; ++l)
103 bit_marker |= marker(l);
104
105 /**
106 * @brief Collect data from parent elements to child
107 */
108 boost::function<void(boost::shared_ptr<ForcesAndSourcesCore>, int)>
109 add_parent_level =
110 [&](boost::shared_ptr<ForcesAndSourcesCore> parent_fe_pt, int level) {
111
112 // Evaluate if not last parent element
113 if (level > 0) {
114
115 // Create domain parent FE
116 auto fe_ptr_current = boost::shared_ptr<ForcesAndSourcesCore>(
117 new PARENT_FE(m_field));
118 if (op == DomainEleOp::OPSPACE) {
119 // Push base function
120 if (typeid(PARENT_FE) == typeid(DomainParentEle))
122 fe_ptr_current->getOpPtrVector(), {H1});
123 }
124
125 // Call next level
126 add_parent_level(
127 boost::dynamic_pointer_cast<ForcesAndSourcesCore>(
128 fe_ptr_current),
129 level - 1);
130
131 // Add data to curent fe level
132 if (op == DomainEleOp::OPSPACE) {
133
134 // Only base
135 parent_fe_pt->getOpPtrVector().push_back(
136
138
139 H1, op, fe_ptr_current,
140
141 BitRefLevel().set(), bit(0).flip(),
142
143 bit_marker, BitRefLevel().set(),
144
145 verbosity, sev));
146
147 } else {
148
149 // Filed data
150 parent_fe_pt->getOpPtrVector().push_back(
151
153
154 FIELD_NAME, op, fe_ptr_current,
155
156 BitRefLevel().set(), bit(0).flip(),
157
158 bit_marker, BitRefLevel().set(),
159
160 verbosity, sev));
161 }
162 }
163 };
164
165 add_parent_level(boost::dynamic_pointer_cast<ForcesAndSourcesCore>(fe_top),
167};
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
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 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

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

Definition at line 177 of file hanging_node_approx.cpp.