v0.16.0
Loading...
Searching...
No Matches
elastic_adaptive.cpp
Go to the documentation of this file.
1/**
2 * @file elastic_adaptive.cpp
3 * @brief elastic adaptive example
4 * @version 0.15.0
5 * @date 2025-10-08
6 *
7 * @copyright Anonymous authors (c) 2025 under the MIT license (see LICENSE for
8 * details)
9 */
10
11#include <MoFEM.hpp>
12
13using namespace MoFEM;
14
15[[maybe_unused]] constexpr int BASE_DIM = 1; //< Dimension of the base functions
16
17//! [Define dimension]
18constexpr int SPACE_DIM = 3; //< Space dimension of problem, mesh
19//! [Define dimension]
20constexpr AssemblyType A = AssemblyType::PETSC; //< selected assembly type
21
22constexpr IntegrationType I = IntegrationType::GAUSS; //< selected integration type
23
24//! [Define entities]
29using DomainEleOp = DomainEle::UserDataOperator;
30using BoundaryEleOp = BoundaryEle::UserDataOperator;
32using SideEleOp = EleOnSide::UserDataOperator;
33//! [Define entities]
34
35struct DomainBCs {};
36struct BoundaryBCs {};
37
44
47
49using SideEleOp = SideEle::UserDataOperator;
50
51
53
54static char help[] = "...\n\n";
55
56int main(int argc, char *argv[]) {
57
58 // Initialisation of MoFEM/PETSc and MOAB data structures
59 const char param_file[] = "param_file.petsc";
60 MoFEM::Core::Initialize(&argc, &argv, param_file, help);
61
62 auto core_log = logging::core::get();
63 core_log->add_sink(
65
66 core_log->add_sink(
68 LogManager::setLog("FieldEvaluator");
69 MOFEM_LOG_TAG("FieldEvaluator", "field_eval");
70
71 try {
72
73 //! [Register MoFEM discrete manager in PETSc]
74 DMType dm_name = "DMMOFEM";
75 CHKERR DMRegister_MoFEM(dm_name);
76 DMType dm_name_mg = "DMMOFEM_MG";
78 //! [Register MoFEM discrete manager in PETSc
79
80 //! [Create MoAB]
81 moab::Core mb_instance; ///< mesh database
82 moab::Interface &moab = mb_instance; ///< mesh database interface
83 //! [Create MoAB]
84
85 //! [Create MoFEM]
86 MoFEM::Core core(moab); ///< finite element database
87 MoFEM::Interface &m_field = core; ///< finite element database interface
88 //! [Create MoFEM]
89
90 //! [Example]
91 ElasticAdaptiveExample ex(m_field);
92 CHKERR ex.runProblem();
93 //! [Example]
94 }
96
98}
elastic example with adaptive order refinement
int main()
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
PostProcEleByDim< SPACE_DIM >::PostProcEleDomain PostProcEleDomain
PostProcEleByDim< SPACE_DIM >::PostProcEleBdy PostProcEleBdy
static char help[]
constexpr int SPACE_DIM
[Define dimension]
constexpr int BASE_DIM
constexpr IntegrationType I
constexpr AssemblyType A
[Define dimension]
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
MoFEMErrorCode DMRegister_MGViaApproxOrders(const char sname[])
Register DM for Multi-Grid via approximation orders.
IntegrationType
Form integrator integration types.
AssemblyType
[Storage and set boundary conditions]
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
PipelineManager::ElementsAndOpsByDim< SPACE_DIM >::FaceSideEle EleOnSide
Boundary conditions marker.
Definition elastic.cpp:39
[Define entities]
Definition elastic.cpp:38
MoFEMErrorCode runProblem()
[Run problem]
Core (interface) class.
Definition Core.hpp:83
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:68
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:123
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
static boost::shared_ptr< std::ostream > getStrmSync()
Get the strm sync object.
Assembly methods.
Definition Natural.hpp:65
Template struct for dimension-specific finite element types.
ElementsAndOps< SPACE_DIM >::SideEle SideEle
Definition plastic.cpp:62