v0.16.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
MatOps::MatMooneyRivlinWriggersEq63< DIM > Struct Template Reference
Inheritance diagram for MatOps::MatMooneyRivlinWriggersEq63< DIM >:
[legend]
Collaboration diagram for MatOps::MatMooneyRivlinWriggersEq63< DIM >:
[legend]

Public Types

using A = MatElasticImpl< DIM >
 
- Public Types inherited from MatOps::PhysicalEquations
using HookFunction = std::function< MoFEMErrorCode(boost::shared_ptr< MatOpsData >, int, EntityHandle, int)>
 

Public Member Functions

MoFEMErrorCode getOptions (MoFEM::Interface *m_field_ptr=nullptr) override
 
MoFEMErrorCode addBlockParameters (MoFEM::Interface &, const std::string &block_name, int, const Range &block_entities, const std::vector< double > &block_data) override
 
MoFEMErrorCode setParams (FEMethod *fe_ptr, int gg) override
 
MoFEMErrorCode recordTape () override
 
- Public Member Functions inherited from MatOps::MatElasticImpl< DIM >
ForcesAndSourcesCore::UserDataOperatorcreateOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
 
ForcesAndSourcesCore::UserDataOperatorcreateOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update)
 
ForcesAndSourcesCore::UserDataOperatorcreateOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update)
 
- Public Member Functions inherited from MatOps::MatElastic
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
- Public Member Functions inherited from MatOps::PhysicalEquations
 PhysicalEquations ()=delete
 
 PhysicalEquations (boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag, boost::shared_ptr< std::map< int, Range > > tag_vs_range_ptr=nullptr)
 
virtual ~PhysicalEquations ()=default
 
virtual MoFEMErrorCode evaluateVariable (int tag, EntityHandle entity, int gg)
 
virtual MoFEMErrorCode evaluateDerivatives (int tag, EntityHandle entity, int gg)
 
virtual MoFEMErrorCode updateState (int tag, EntityHandle entity, int gg)
 

Protected Attributes

double alpha = 1
 
double beta = 1
 
double lambda = 1
 
double epsilon = 0
 
std::vector< doubledefaultMaterialParameters
 

Additional Inherited Members

- Public Attributes inherited from MatOps::PhysicalEquations
HookFunction hookEvaluateVariable = AdolCEvaluation::evaluateVariable
 
HookFunction hookEvaluateDerivatives = AdolCEvaluation::evaluateDerivatives
 
HookFunction hookUpdateState = AdolCEvaluation::evaluateVariable
 
int tAg
 
boost::shared_ptr< std::map< int, Range > > tagVsRangePtr
 
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
 
boost::shared_ptr< MatOpsDatamatOpsDataPtr
 
- Static Public Attributes inherited from MatOps::MatElastic
static bool useDeformationGradient
 

Detailed Description

template<int DIM>
struct MatOps::MatMooneyRivlinWriggersEq63< DIM >

Definition at line 15 of file MatMooneyRivlinWriggersEq63.cpp.

Member Typedef Documentation

◆ A

template<int DIM>
using MatOps::MatMooneyRivlinWriggersEq63< DIM >::A = MatElasticImpl<DIM>

Definition at line 18 of file MatMooneyRivlinWriggersEq63.cpp.

Member Function Documentation

◆ addBlockParameters()

template<int DIM>
MoFEMErrorCode MatOps::MatMooneyRivlinWriggersEq63< DIM >::addBlockParameters ( MoFEM::Interface ,
const std::string &  block_name,
int  ,
const Range block_entities,
const std::vector< double > &  block_data 
)
inlineoverridevirtual

Reimplemented from MatOps::PhysicalEquations.

Definition at line 72 of file MatMooneyRivlinWriggersEq63.cpp.

74 {
76
77 if (block_data.size() < 4) {
79 "Expected that block has four attributes (alpha, "
80 "beta, lambda, epsilon), but given " +
81 std::to_string(block_data.size()));
82 }
83 std::vector<double> params = {block_data[0], block_data[1], block_data[2],
84 block_data[3]};
85
86 A::paramVecByRange.push_back({block_entities, params});
87
88 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock for Mooney-Rivlin")
89 << block_name << " alpha = " << params[0] << " beta = " << params[1]
90 << " lambda = " << params[2] << " epsilon = " << params[3];
91
93 }
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
Definition MatOps.hpp:162

◆ getOptions()

template<int DIM>
MoFEMErrorCode MatOps::MatMooneyRivlinWriggersEq63< DIM >::getOptions ( MoFEM::Interface m_field_ptr = nullptr)
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 20 of file MatMooneyRivlinWriggersEq63.cpp.

20 {
22
23 MOFEM_LOG_CHANNEL("WORLD");
24
25 PetscOptionsBegin(PETSC_COMM_WORLD, "mooneyrivlin_", "", "none");
26 CHKERR PetscOptionsScalar("-alpha", "Alpha", "", alpha, &alpha,
27 PETSC_NULLPTR);
28 CHKERR PetscOptionsScalar("-beta", "Beta", "", beta, &beta, PETSC_NULLPTR);
29
30 CHKERR PetscOptionsScalar("-lambda", "Lambda", "", lambda, &lambda,
31 PETSC_NULLPTR);
32
33 CHKERR PetscOptionsScalar("-epsilon", "Epsilon", "", epsilon, &epsilon,
34 PETSC_NULLPTR);
35 PetscOptionsEnd();
36
37 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "Default Mooney-Rivlin parameters:")
38 << " alpha = " << alpha << " beta = " << beta << " lambda = " << lambda
39 << " epsilon = " << epsilon;
41
42 std::string block_name = "MAT_MOONEY_RIVLIN";
43
44 for (auto &m :
45
46 m_field_ptr->getInterface<MeshsetsManager>()->
47
48 getCubitMeshsetPtr(
49 std::regex((boost::format("%s(.*)") % block_name).str()))
50
51 ) {
52
53 std::vector<double> block_data;
54 CHKERR m->getAttributes(block_data);
55 auto get_block_ents = [&]() {
56 Range ents;
57 CHK_MOAB_THROW(m_field_ptr->get_moab().get_entities_by_handle(
58 m->meshset, ents, true),
59 "can not get block entities");
60 return ents;
61 };
62
63 CHKERR addBlockParameters(*m_field_ptr, m->getName(),
64 m->getMeshsetId(), get_block_ents(),
65 block_data);
66 }
67
69 };
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#define CHKERR
Inline error check.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'm', 3 > m
MoFEMErrorCode addBlockParameters(MoFEM::Interface &, const std::string &block_name, int, const Range &block_entities, const std::vector< double > &block_data) override
virtual moab::Interface & get_moab()=0

◆ recordTape()

template<int DIM>
MoFEMErrorCode MatOps::MatMooneyRivlinWriggersEq63< DIM >::recordTape ( )
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 109 of file MatMooneyRivlinWriggersEq63.cpp.

109 {
111
112 A::matOpsDataPtr->insertCommonData("grad", MatrixDouble());
113 A::matOpsDataPtr->insertCommonData("P", MatrixDouble());
114 A::matOpsDataPtr->insertCommonData("P_dF", MatrixDouble());
115
116 A::matOpsDataPtr->insertActiveData("F", MatrixDouble());
117 A::matOpsDataPtr->insertDependentData("P", MatrixDouble());
118 A::matOpsDataPtr->insertDependentDerivativesData("P_dF", MatrixDouble());
119
120 A::matOpsDataPtr->getActiveDataPtr("F")->resize(DIM, DIM, false);
121 A::matOpsDataPtr->getDependentDataPtr("P")->resize(DIM, DIM, false);
122
123 auto t_F = getFTensor2FromPtr<DIM, DIM>(
124 A::matOpsDataPtr->getActiveDataPtr("F")->data().data());
125 auto t_P = getFTensor2FromPtr<DIM, DIM>(
126 A::matOpsDataPtr->getDependentDataPtr("P")->data().data());
127
129
130 FTENSOR_INDEX(DIM, i);
131 FTENSOR_INDEX(DIM, j);
132 FTENSOR_INDEX(DIM, I);
133 FTENSOR_INDEX(DIM, J);
134 FTENSOR_INDEX(DIM, k);
135 FTENSOR_INDEX(DIM, K);
136
137 t_F(i, J) = 0;
138
144 adouble ta_Bj, A, B;
145
146 adouble det_aF;
148
149 trace_on(A::tAg);
150 auto p_alpha = mkparam(alpha);
151 auto p_beta = mkparam(beta);
152 auto p_lambda = mkparam(lambda);
153 auto p_epsilon = mkparam(epsilon);
154
155 ta_F(i, J) <<= t_F(i, J);
156 // assume that gradient from approximated displacement, that why we add diagonal
158 ta_F(i, J) += t_kd(i, J);
159 }
160
161 det_aF = determinantTensor(ta_F);
162 CHKERR invertTensor(ta_F, det_aF, ta_invF);
163
164 ta_Cof(i, I) = det_aF * ta_invF(I, i);
165
166 A = ta_F(k, K) * ta_F(k, K);
167 B = ta_Cof(k, K) * ta_Cof(k, K);
168
169 ta_BF(i, I) = 4 * alpha * (A * ta_F(i, I));
170 ta_BCof(i, I) = 4 * beta * (B * ta_Cof(i, I));
171 ta_Bj = (-12 * alpha - 24 * beta) / det_aF +
172 0.5 * (lambda / epsilon) *
173 (pow(det_aF, epsilon - 1) - pow(det_aF, -epsilon - 1));
174
175 ta_P(i, I) = ta_BF(i, I);
176 ta_P(i, I) += (levi_civita(i, j, k) * ta_BCof(j, J)) *
177 (levi_civita(I, J, K) * ta_F(k, K));
178 ta_P(i, I) += ta_Cof(i, I) * ta_Bj;
179
180 // Set dependent variables to ADOL-C
181 ta_P(i, I) >>= t_P(i, I);
182
183 trace_off();
184
186 }
#define FTENSOR_INDEX(DIM, I)
Kronecker Delta class.
constexpr auto t_kd
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
Definition level_set.cpp:30
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
constexpr std::enable_if<(Dim0<=2 &&Dim1<=2), Tensor2_Expr< Levi_Civita< T >, T, Dim0, Dim1, i, j > >::type levi_civita(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
levi_civita functions to make for easy adhoc use
UBlasMatrix< double > MatrixDouble
Definition Types.hpp:77
static MoFEMErrorCode invertTensor(FTensor::Tensor2< T1, DIM, DIM > &t, T2 &det, FTensor::Tensor2< T3, DIM, DIM > &inv_t)
static auto determinantTensor(FTensor::Tensor2< T, DIM, DIM > &t)
Calculate the determinant of a tensor of rank DIM.
constexpr IntegrationType I
static bool useDeformationGradient
boost::shared_ptr< MatOpsData > matOpsDataPtr
Definition MatOps.hpp:164

◆ setParams()

template<int DIM>
MoFEMErrorCode MatOps::MatMooneyRivlinWriggersEq63< DIM >::setParams ( FEMethod fe_ptr,
int  gg 
)
inlineoverridevirtual

Implements MatOps::PhysicalEquations.

Definition at line 95 of file MatMooneyRivlinWriggersEq63.cpp.

95 {
96 (void)gg;
97 const auto ent = fe_ptr->getFEEntityHandle();
98 for (auto &[range, param_vec] : A::paramVecByRange) {
99 if (std::find(range.begin(), range.end(), ent) != range.end()) {
100 set_param_vec(A::tAg, param_vec.size(), param_vec.data());
101 return 0;
102 }
103 }
104 set_param_vec(A::tAg, defaultMaterialParameters.size(),
106 return 0;
107 }

Member Data Documentation

◆ alpha

template<int DIM>
double MatOps::MatMooneyRivlinWriggersEq63< DIM >::alpha = 1
protected

Definition at line 189 of file MatMooneyRivlinWriggersEq63.cpp.

◆ beta

template<int DIM>
double MatOps::MatMooneyRivlinWriggersEq63< DIM >::beta = 1
protected

Definition at line 190 of file MatMooneyRivlinWriggersEq63.cpp.

◆ defaultMaterialParameters

template<int DIM>
std::vector<double> MatOps::MatMooneyRivlinWriggersEq63< DIM >::defaultMaterialParameters
protected
Initial value:

Definition at line 193 of file MatMooneyRivlinWriggersEq63.cpp.

193 {alpha, beta, lambda,
194 epsilon};

◆ epsilon

template<int DIM>
double MatOps::MatMooneyRivlinWriggersEq63< DIM >::epsilon = 0
protected

Definition at line 192 of file MatMooneyRivlinWriggersEq63.cpp.

◆ lambda

template<int DIM>
double MatOps::MatMooneyRivlinWriggersEq63< DIM >::lambda = 1
protected

Definition at line 191 of file MatMooneyRivlinWriggersEq63.cpp.


The documentation for this struct was generated from the following file: