v0.15.0
Loading...
Searching...
No Matches
arc_length.cpp
Go to the documentation of this file.
1/**
2 * @file nonlinear_elastic.cpp
3 * @example nonlinear_elastic.cpp
4 * @date 2025-10-5
5 *
6 * @copyright Anonymous authors (c) 2025 under the MIT license (see LICENSE for
7 * details)
8 */
9
10#include <MoFEM.hpp>
11#include <MatrixFunction.hpp>
12
13using namespace MoFEM;
14
15constexpr int SPACE_DIM =
16 EXECUTABLE_DIMENSION; //< Space dimension of problem, mesh
17
22using DomainEleOp = DomainEle::UserDataOperator;
23using BoundaryEleOp = BoundaryEle::UserDataOperator;
24
29
33
34template <int DIM> struct PostProcEleByDim;
35
36template <> struct PostProcEleByDim<2> {
40};
41
42template <> struct PostProcEleByDim<3> {
46};
47
53
54#include <HenckyOps.hpp>
55using namespace HenckyOps;
56#include <Monitor.hpp>
57
58struct ArcTimeScale : public TimeScale {
59 double getScale(const double time) override {
60 if (snesPtr) {
61 double lambda;
62 CHK_THROW_MESSAGE(SNESNewtonALGetLoadParameter(snesPtr, &lambda),
63 "Cannot get load parameter from SNES");
64 return lambda;
65 } else {
66 return time;
67 }
68 }
69 static inline SmartPetscObj<SNES> snesPtr = nullptr;
70};
71
73#include <ExampleArcLength.hpp>
74
75static char help[] = "...\n\n";
76
77int main(int argc, char *argv[]) {
78
79 // Initialisation of MoFEM/PETSc and MOAB data structures
80 const char param_file[] = "param_file.petsc";
81 MoFEM::Core::Initialize(&argc, &argv, param_file, help);
82
83 // Add logging channel for example
84 auto core_log = logging::core::get();
85 core_log->add_sink(
87 LogManager::setLog("EXAMPLE");
88 MOFEM_LOG_TAG("EXAMPLE", "example");
89
90 try {
91
92 //! [Register MoFEM discrete manager in PETSc]
93 DMType dm_name = "DMMOFEM";
94 CHKERR DMRegister_MoFEM(dm_name);
95 //! [Register MoFEM discrete manager in PETSc
96
97 //! [Create MoAB]
98 moab::Core mb_instance; ///< mesh database
99 moab::Interface &moab = mb_instance; ///< mesh database interface
100 //! [Create MoAB]
101
102 //! [Create MoFEM]
103 MoFEM::Core core(moab); ///< finite element database
104 MoFEM::Interface &m_field = core; ///< finite element database interface
105 //! [Create MoFEM]
106
107 //! [Example]
108 ExampleArcLength ex(m_field);
109 CHKERR ex.runProblem();
110 //! [Example]
111 }
113
115}
int main()
static char help[]
constexpr int SPACE_DIM
ElementsAndOps< SPACE_DIM >::BoundaryEle BoundaryEle
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
[Define dimension]
#define CATCH_ERRORS
Catch errors.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define CHKERR
Inline error check.
PostProcEleByDim< SPACE_DIM >::PostProcEleDomain PostProcEleDomain
PostProcEleByDim< SPACE_DIM >::PostProcEleBdy PostProcEleBdy
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition DMMoFEM.cpp:43
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
static double lambda
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
#define EXECUTABLE_DIMENSION
Definition plastic.cpp:13
ElementsAndOps< SPACE_DIM >::SideEle SideEle
Definition plastic.cpp:61
double getScale(const double time) override
Get scaling at given time.
static SmartPetscObj< SNES > snesPtr
MoFEMErrorCode runProblem()
[Run problem]
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:118
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.
Assembly methods.
Definition Natural.hpp:65
intrusive_ptr for managing petsc objects
Force scale operator for reading two columns.