PolyFEM
Loading...
Searching...
No Matches
MooneyRivlin3ParamElasticity.hpp
Go to the documentation of this file.
1#pragma once
2
5
6// non linear MooneyRivlin material model
7namespace polyfem::assembler
8{
9 class MooneyRivlin3ParamElasticity : public GenericElastic<MooneyRivlin3ParamElasticity>
10 {
11 public:
13
14 // sets material params
15 void add_multimaterial(const int index, const json &params, const Units &units) override;
16
17 const GenericMatParam &c1() const { return c1_; }
18 const GenericMatParam &c2() const { return c2_; }
19 const GenericMatParam &c3() const { return c3_; }
20 const GenericMatParam &d1() const { return d1_; }
21
22 std::string name() const override { return "MooneyRivlin3Param"; }
23 std::map<std::string, ParamFunc> parameters() const override;
24
25 template <typename T>
27 const RowVectorNd &p,
28 const double t,
29 const int el_id,
30 const DefGradMatrix<T> &def_grad) const
31 {
32 const double c1 = c1_(p, t, el_id);
33 const double c2 = c2_(p, t, el_id);
34 const double c3 = c3_(p, t, el_id);
35 const double d1 = d1_(p, t, el_id);
36
37 const T J = polyfem::utils::determinant(def_grad);
38 const auto right_cauchy_green = def_grad * def_grad.transpose();
39
40 const auto powJ = pow(J, -2. / 3);
41 const auto TrB = right_cauchy_green.trace();
42 const auto I1_tilde = powJ * (TrB + (3 - size())) - 3;
43 const auto second_invariant_val = (size() == 3) ? 0.5 * (TrB * TrB - (right_cauchy_green * right_cauchy_green).trace()) : TrB + J * J;
44 const auto I2_tilde = (powJ * powJ) * second_invariant_val - 3;
45
46 const T val = c1 * I1_tilde + (c2 + c3 * I1_tilde) * I2_tilde + d1 * (J - 1) * (J - 1);
47
48 return val;
49 }
50
51 private:
56 };
57} // namespace polyfem::assembler
double val
Definition Assembler.cpp:86
T elastic_energy(const RowVectorNd &p, const double t, const int el_id, const DefGradMatrix< T > &def_grad) const
std::map< std::string, ParamFunc > parameters() const override
void add_multimaterial(const int index, const json &params, const Units &units) override
Used for test only.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > DefGradMatrix
T determinant(const Eigen::Matrix< T, rows, cols, option, maxRow, maxCol > &mat)
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13