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 setParams (FEMethod *fe_ptr, int gg) override
 
MoFEMErrorCode recordTape () override
 
- Public Member Functions inherited from MatOps::MatElasticImpl< DIM >
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update) override
 
ForcesAndSourcesCore::UserDataOperator * createOp (boost::shared_ptr< PhysicalEquations > physical_ptr, bool eval_stress, bool eval_tangent, bool update)
 
ForcesAndSourcesCore::UserDataOperator * createOp (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

◆ 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 if (block_data.size() < 4) {
57 "Expected that block has four attributes (alpha, "
58 "beta, lambda, epsilon), but given " +
59 std::to_string(block_data.size()));
60 }
61 auto get_block_ents = [&]() {
62 Range ents;
63 CHK_MOAB_THROW(m_field_ptr->get_moab().get_entities_by_handle(
64 m->meshset, ents, true),
65 "can not get block entities");
66 return ents;
67 };
68
69 A::paramVecByRange.push_back(
70 {get_block_ents(),
71 {block_data[0], block_data[1], block_data[2], block_data[3]}});
72
73 MOFEM_TAG_AND_LOG("WORLD", Sev::inform, "MatBlock for Mooney-Rivlin")
74 << *m << " alpha = " << block_data[0] << " beta = " << block_data[1]
75 << " lambda = " << block_data[2] << " epsilon = " << block_data[3];
76 }
77
79 };
#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 ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'm', 3 > m
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
Definition MatOps.hpp:152
virtual moab::Interface & get_moab()=0

◆ recordTape()

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

Implements MatOps::PhysicalEquations.

Definition at line 95 of file MatMooneyRivlinWriggersEq63.cpp.

95 {
97
98 A::matOpsDataPtr->insertCommonData("grad", MatrixDouble());
99 A::matOpsDataPtr->insertCommonData("P", MatrixDouble());
100 A::matOpsDataPtr->insertCommonData("P_dF", MatrixDouble());
101
102 A::matOpsDataPtr->insertActiveData("F", MatrixDouble());
103 A::matOpsDataPtr->insertDependentData("P", MatrixDouble());
104 A::matOpsDataPtr->insertDependentDerivativesData("P_dF", MatrixDouble());
105
106 A::matOpsDataPtr->getActiveDataPtr("F")->resize(DIM, DIM, false);
107 A::matOpsDataPtr->getDependentDataPtr("P")->resize(DIM, DIM, false);
108
109 auto t_F = getFTensor2FromPtr<DIM, DIM>(
110 A::matOpsDataPtr->getActiveDataPtr("F")->data().data());
111 auto t_P = getFTensor2FromPtr<DIM, DIM>(
112 A::matOpsDataPtr->getDependentDataPtr("P")->data().data());
113
115
116 FTENSOR_INDEX(DIM, i);
117 FTENSOR_INDEX(DIM, j);
118 FTENSOR_INDEX(DIM, I);
119 FTENSOR_INDEX(DIM, J);
120 FTENSOR_INDEX(DIM, k);
121 FTENSOR_INDEX(DIM, K);
122
123 t_F(i, J) = 0;
124
130 adouble ta_Bj, A, B;
131
132 adouble det_aF;
134
135 trace_on(A::tAg);
136 auto p_alpha = mkparam(alpha);
137 auto p_beta = mkparam(beta);
138 auto p_lambda = mkparam(lambda);
139 auto p_epsilon = mkparam(epsilon);
140
141 ta_F(i, J) <<= t_F(i, J);
142 // assume that gradient from approximated displacement, that why we add diagonal
144 ta_F(i, J) += t_kd(i, J);
145 }
146
147 det_aF = determinantTensor(ta_F);
148 CHKERR invertTensor(ta_F, det_aF, ta_invF);
149
150 ta_Cof(i, I) = det_aF * ta_invF(I, i);
151
152 A = ta_F(k, K) * ta_F(k, K);
153 B = ta_Cof(k, K) * ta_Cof(k, K);
154
155 ta_BF(i, I) = 4 * alpha * (A * ta_F(i, I));
156 ta_BCof(i, I) = 4 * beta * (B * ta_Cof(i, I));
157 ta_Bj = (-12 * alpha - 24 * beta) / det_aF +
158 0.5 * (lambda / epsilon) *
159 (pow(det_aF, epsilon - 1) - pow(det_aF, -epsilon - 1));
160
161 ta_P(i, I) = ta_BF(i, I);
162 ta_P(i, I) += (levi_civita(i, j, k) * ta_BCof(j, J)) *
163 (levi_civita(I, J, K) * ta_F(k, K));
164 ta_P(i, I) += ta_Cof(i, I) * ta_Bj;
165
166 // Set dependent variables to ADOL-C
167 ta_P(i, I) >>= t_P(i, I);
168
169 trace_off();
170
172 }
#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
constexpr IntegrationType I
static bool useDeformationGradient
boost::shared_ptr< MatOpsData > matOpsDataPtr
Definition MatOps.hpp:154

◆ setParams()

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

Implements MatOps::PhysicalEquations.

Definition at line 81 of file MatMooneyRivlinWriggersEq63.cpp.

81 {
82 (void)gg;
83 const auto ent = fe_ptr->getFEEntityHandle();
84 for (auto &[range, param_vec] : A::paramVecByRange) {
85 if (std::find(range.begin(), range.end(), ent) != range.end()) {
86 set_param_vec(A::tAg, param_vec.size(), param_vec.data());
87 return 0;
88 }
89 }
90 set_param_vec(A::tAg, defaultMaterialParameters.size(),
92 return 0;
93 }

Member Data Documentation

◆ alpha

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

Definition at line 175 of file MatMooneyRivlinWriggersEq63.cpp.

◆ beta

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

Definition at line 176 of file MatMooneyRivlinWriggersEq63.cpp.

◆ defaultMaterialParameters

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

Definition at line 179 of file MatMooneyRivlinWriggersEq63.cpp.

179 {alpha, beta, lambda,
180 epsilon};

◆ epsilon

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

Definition at line 178 of file MatMooneyRivlinWriggersEq63.cpp.

◆ lambda

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

Definition at line 177 of file MatMooneyRivlinWriggersEq63.cpp.


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