PolyFEM
Loading...
Searching...
No Matches
MooneyRivlinElasticity.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 MooneyRivlinElasticity : public GenericElastic<MooneyRivlinElasticity>
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 &k() const { return k_; }
20
21 std::string name() const override { return "MooneyRivlin"; }
22 std::map<std::string, ParamFunc> parameters() const override;
23
24 template <typename T>
26 const RowVectorNd &p,
27 const double t,
28 const int el_id,
29 const DefGradMatrix<T> &def_grad) const
30 {
31 const double c1 = c1_(p, t, el_id);
32 const double c2 = c2_(p, t, el_id);
33 const double k = k_(p, t, el_id);
34
35 const T J = polyfem::utils::determinant(def_grad);
36 const T log_J = log(J);
37
38 const auto F_tilde = def_grad / pow(J, 1.0 / size());
39 const auto C_tilde = F_tilde * F_tilde.transpose();
40 const auto I1_tilde = first_invariant(C_tilde);
41 const auto I2_tilde = second_invariant(C_tilde);
42
43 const T val = c1 * (I1_tilde - size()) + c2 * (I2_tilde - size()) + k / 2 * (log_J * log_J);
44
45 return val;
46 }
47
48 private:
52 };
53} // 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
void add_multimaterial(const int index, const json &params, const Units &units) override
std::map< std::string, ParamFunc > parameters() const 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
AutoDiffGradMat::Scalar second_invariant(const AutoDiffGradMat &B)
AutoDiffGradMat::Scalar first_invariant(const AutoDiffGradMat &B)
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13