v0.15.5
Loading...
Searching...
No Matches
AdolCEP.hpp
Go to the documentation of this file.
1/**
2 * @file AdolCStreach.hpp
3 * @author your name (you@domain.com)
4 * @brief Tested by stretch of Log of streach
5 * @date 2026-04-04
6 *
7 * @copyright Copyright (c) 2026
8 *
9 */
10
11#ifndef ADOLC_OPS_STRETCH_HPP
12#define ADOLC_OPS_STRETCH_HPP
13
14using namespace MoFEM;
15using namespace AdolCOps;
16
18namespace AdolCOps {
19
20struct EP {
21 EP() = delete;
22 // Behaviors
23 struct META {};
24 struct NEOHOOKEAN {};
27};
28
30 typename OpBase>
31struct OpRhsU;
32
34 typename OpBase>
35struct OpLhsUU;
36
38 typename OpBase>
39struct OpLhsUR;
40
42 typename OpBase>
43struct OpLhsUP;
44
45template <int MODEL_TYPE> struct OpMaterialFactory<HUHU, MODEL_TYPE> {
47
48 template <AssemblyType A, IntegrationType I, typename DomainEleOp>
49 static MoFEMErrorCode
51 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
52 std::string fe_name, std::string field_name,
53 boost::shared_ptr<PhysicalEquations> physical_equations_ptr,
54 Sev sev = Sev::noisy) {
56 constexpr int DIM = (MODEL_TYPE == MODEL_3D) ? 3 : 2;
57 auto op_this = getPipThis<DomainEleOp>(m_field, pip, fe_name, field_name,
58 physical_equations_ptr, sev);
59 auto m_grad_grad = boost::make_shared<MatrixDouble>();
60 op_this->getOpPtrVector().push_back(
62 op_this->getOpPtrVector().push_back(
63 physical_equations_ptr->createOp(physical_equations_ptr, true, false));
64 auto m_k = physical_equations_ptr->adolcDataPtr->getCommonDataPtr("k");
65 op_this->getOpPtrVector().push_back(
68 }
69
70 template <AssemblyType A, IntegrationType I, typename DomainEleOp>
71 static MoFEMErrorCode
73 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
74 std::string fe_name, std::string field_name,
75 boost::shared_ptr<PhysicalEquations> physical_equations_ptr,
76 Sev sev = Sev::noisy) {
78 constexpr int DIM = (MODEL_TYPE == MODEL_3D) ? 3 : 2;
79 auto op_this = getPipThis<DomainEleOp>(m_field, pip, fe_name, field_name,
80 physical_equations_ptr, sev);
81 auto m_grad_grad = boost::make_shared<MatrixDouble>();
82 op_this->getOpPtrVector().push_back(
84 op_this->getOpPtrVector().push_back(
85 physical_equations_ptr->createOp(physical_equations_ptr, true, true));
86 auto m_k = physical_equations_ptr->adolcDataPtr->getCommonDataPtr("k");
87 auto m_diff_k =
88 physical_equations_ptr->adolcDataPtr->getCommonDataPtr("k_dF");
89 op_this->getOpPtrVector().push_back(
91 op_this->getOpPtrVector().push_back(
93 m_diff_k));
95 }
96
97private:
98 template <typename DomainEleOp>
99 static auto
101 boost::ptr_deque<ForcesAndSourcesCore::UserDataOperator> &pip,
102 std::string fe_name, std::string field_name,
103 boost::shared_ptr<PhysicalEquations> physical_equations_ptr,
104 Sev sev) {
105
106 auto &param_vec_by_range = physical_equations_ptr->paramVecByRange;
107 // range only if parameters are set via blockset
108 auto r = boost::make_shared<Range>();
109 for (auto &p : param_vec_by_range) {
110 r->merge(p.first);
111 }
112 MOFEM_LOG("WORLD", Sev::inform) << "HuHu number of entities " << r->size();
113
114 constexpr int DIM = (MODEL_TYPE == MODEL_3D) ? 3 : 2;
115
116 auto field_structure = m_field.get_field_structure(field_name);
117 auto base = field_structure->getApproxBase();
118 auto space = field_structure->getSpace();
119
121 auto op_this = new OpLoopThis<DomainEle>(m_field, fe_name, r, sev);
122 pip.push_back(op_this);
123 auto this_fe_ptr = op_this->getThisFEPtr();
124 auto &this_pip = op_this->getOpPtrVector();
125 this_fe_ptr->getRuleHook = [](int order_row, int order_col,
126 int order_data) {
127 return 2 * (order_data - 1);
128 };
129
130 auto base_mass = boost::make_shared<MatrixDouble>();
131 auto data_l2 = boost::make_shared<EntitiesFieldData>(MBENTITYSET);
132 auto jac_ptr = boost::make_shared<MatrixDouble>();
133 auto det_ptr = boost::make_shared<VectorDouble>();
134 auto inv_jac_ptr = boost::make_shared<MatrixDouble>();
135
136 // calculate jacobian at integration points
137 this_pip.push_back(new OpCalculateHOJac<DIM>(jac_ptr));
138 // calculate jacobian at integration points
139 this_pip.push_back(new OpInvertMatrix<DIM>(jac_ptr, det_ptr, inv_jac_ptr));
140 // calculate mass matrix to project derivatives
141 this_pip.push_back(
142 new OpBaseDerivativesMass<1>(base_mass, data_l2, base, L2));
143 // calculate second derivative of base functions, i.e. hessian
144 this_pip.push_back(new OpBaseDerivativesNext<1>(
145 BaseDerivatives::SecondDerivative, base_mass, data_l2, base, space));
146
147 switch (space) {
148 case H1:
149 // push first base derivatives tp physical element shape
150 this_pip.push_back(
151 new OpSetHOInvJacToScalarBases<DIM, 1>(space, inv_jac_ptr));
152 // push second base derivatives tp physical element shape
153 this_pip.push_back(
154 new OpSetHOInvJacToScalarBases<DIM, 2>(space, inv_jac_ptr));
155 break;
156 default:
157 MOFEM_LOG("WORLD", Sev::error)
158 << "Unsupported space: " << space << " for field: " << field_name;
160 }
161
162 auto m_grad =
163 physical_equations_ptr->adolcDataPtr->getCommonDataPtr("grad");
164 this_pip.push_back(
166
167 return op_this;
168 }
169};
170
171
172
173} // namespace AdolCOps
174} // namespace EshelbianPlasticity
175
176#endif // ADOLC_OPS_STRETCH_HPP
constexpr int SPACE_DIM
constexpr int FIELD_DIM
ElementsAndOps< SPACE_DIM >::DomainEle DomainEle
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
@ L2
field with C-1 continuity
Definition definitions.h:88
@ H1
continuous field
Definition definitions.h:85
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition definitions.h:34
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
IntegrationType
Form integrator integration types.
AssemblyType
[Storage and set boundary conditions]
#define MOFEM_LOG(channel, severity)
Log.
SeverityLevel
Severity levels.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
Definition Common.hpp:10
constexpr IntegrationType I
constexpr AssemblyType A
constexpr auto field_name
static auto getPipThis(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string fe_name, std::string field_name, boost::shared_ptr< PhysicalEquations > physical_equations_ptr, Sev sev)
Definition AdolCEP.hpp:100
static MoFEMErrorCode opRhsFactory(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string fe_name, std::string field_name, boost::shared_ptr< PhysicalEquations > physical_equations_ptr, Sev sev=Sev::noisy)
Definition AdolCEP.hpp:50
static MoFEMErrorCode opLhsFactory(MoFEM::Interface &m_field, boost::ptr_deque< ForcesAndSourcesCore::UserDataOperator > &pip, std::string fe_name, std::string field_name, boost::shared_ptr< PhysicalEquations > physical_equations_ptr, Sev sev=Sev::noisy)
Definition AdolCEP.hpp:72
Deprecated interface functions.
FieldApproximationBase getApproxBase() const
Get approximation basis type.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Operator for inverting matrices at integration points.
Execute "this" element in the operator.
Set inverse jacobian to base functions.