25 PetscOptionsBegin(PETSC_COMM_WORLD,
"mooneyrivlin_",
"",
"none");
28 CHKERR PetscOptionsScalar(
"-beta",
"Beta",
"",
beta, &
beta, PETSC_NULLPTR);
38 std::abs(
epsilon) <= std::sqrt(std::numeric_limits<double>::epsilon()))
40 "Mooney-Rivlin epsilon must be finite and nonzero");
47 std::string block_name =
"MAT_MOONEY_RIVLIN";
54 std::regex((boost::format(
"%s(.*)") % block_name).str()))
58 std::vector<double> block_data;
59 CHKERR m->getAttributes(block_data);
60 auto get_block_ents = [&]() {
63 m->meshset, ents,
true),
64 "can not get block entities");
69 get_block_ents(), block_data);
77 const Range &block_entities,
78 const std::vector<double> &block_data)
override {
81 if (block_data.size() < 4) {
83 "Expected that block has four attributes (alpha, "
84 "beta, lambda, epsilon), but given " +
85 std::to_string(block_data.size()));
87 if (!std::isfinite(block_data[3]) ||
88 std::abs(block_data[3]) <=
89 std::sqrt(std::numeric_limits<double>::epsilon()))
91 "MAT_MOONEY_RIVLIN epsilon must be finite and nonzero");
92 std::vector<double> params = {block_data[0], block_data[1], block_data[2],
98 << block_name <<
" alpha = " << params[0] <<
" beta = " << params[1]
99 <<
" lambda = " << params[2] <<
" epsilon = " << params[3];
108 if (std::find(range.begin(), range.end(), ent) != range.end()) {
109 set_param_vec(
A::tAg, param_vec.size(), param_vec.data());
136 ->resize(1, DIM * DIM,
false);
138 auto t_F = getFTensor2FromPtr<DIM, DIM>(
140 auto t_P = getFTensor2FromPtr<DIM, DIM>(
166 auto p_alpha = mkparam(
alpha);
167 auto p_beta = mkparam(
beta);
168 auto p_lambda = mkparam(
lambda);
169 auto p_epsilon = mkparam(
epsilon);
170 const auto ta_alpha = 1 * p_alpha;
171 const auto ta_beta = 1 * p_beta;
172 const auto ta_lambda = 1 * p_lambda;
173 const auto ta_epsilon = 1 * p_epsilon;
175 ta_F(
i,
J) <<= t_F(
i,
J);
184 ta_Cof(
i,
I) = det_aF * ta_invF(
I,
i);
186 A = ta_F(
k,
K) * ta_F(
k,
K);
187 B = ta_Cof(
k,
K) * ta_Cof(
k,
K);
189 ta_BF(
i,
I) = 4 * ta_alpha * (
A * ta_F(
i,
I));
190 ta_BCof(
i,
I) = 4 * ta_beta * (
B * ta_Cof(
i,
I));
191 ta_Bj = (-12 * ta_alpha - 24 * ta_beta) / det_aF +
192 0.5 * (ta_lambda / ta_epsilon) *
193 (pow(det_aF, ta_epsilon - 1) - pow(det_aF, -ta_epsilon - 1));
195 ta_P(
i,
I) = ta_BF(
i,
I);
196 ta_P(
i,
I) += (levi_civita(
i,
j,
k) * ta_BCof(
j,
J)) *
197 (levi_civita(
I,
J,
K) * ta_F(
k,
K));
198 ta_P(
i,
I) += ta_Cof(
i,
I) * ta_Bj;
200 ta_energy = ta_alpha *
A *
A + ta_beta *
B *
B +
201 (-12 * ta_alpha - 24 * ta_beta) * log(det_aF) +
202 0.5 * (ta_lambda / (ta_epsilon * ta_epsilon)) *
203 (pow(det_aF, ta_epsilon) + pow(det_aF, -ta_epsilon) - 2.) -
204 (DIM * DIM) * (ta_alpha + ta_beta);
207 ta_P(
i,
I) >>= t_P(
i,
I);
208 ta_energy >>= (*energy_ptr)(0, 0);
225boost::shared_ptr<PhysicalEquations>
228 boost::shared_ptr<MatOpsData> mat_ops_data_ptr,
int tag) {
229 return boost::make_shared<MatMooneyRivlinWriggersEq63<3>>(mat_ops_data_ptr,
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
#define FTENSOR_INDEX(DIM, I)
#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
#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< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
boost::shared_ptr< PhysicalEquations > createMatOpsPhysicalEquationsPtr(boost::shared_ptr< MatOpsData > mat_ops_data_ptr, int tag)
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
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
FTensor::Index< 'm', 3 > m
MoFEMErrorCode getOptions(MoFEM::Interface *m_field_ptr=nullptr) override
MoFEMErrorCode recordTape() override
MoFEMErrorCode setParams(FEMethod *fe_ptr, int gg) override
std::vector< double > defaultMaterialParameters
MoFEMErrorCode addBlockParameters(MoFEM::Interface &, const std::string &block_name, int, const Range &block_entities, const std::vector< double > &block_data) override
static bool useDeformationGradient
Otherwise the displacement gradient is supplied and I is added.
std::vector< std::pair< Range, std::vector< double > > > paramVecByRange
boost::shared_ptr< MatOpsData > matOpsDataPtr
Deprecated interface functions.
Structure for user loop methods on finite elements.
EntityHandle getFEEntityHandle() const
Get the entity handle of the current finite element.
Interface for managing meshsets containing materials and boundary conditions.