3 #include <Caribou/Algebra/Tensor.h>
4 #include <SofaCaribou/Material/HyperelasticMaterial.h>
6 namespace SofaCaribou::material {
8 template<
class DataTypes>
10 static constexpr
auto Dimension = DataTypes::spatial_dimensions;
11 using Coord =
typename DataTypes::Coord;
12 using Real =
typename Coord::value_type;
17 : d_young_modulus(initData(&d_young_modulus,
18 Real(1000),
"young_modulus",
19 "Young's modulus of the material",
21 , d_poisson_ratio(initData(&d_poisson_ratio,
22 Real(0.3),
"poisson_ratio",
23 "Poisson's ratio of the material",
34 const Real young_modulus = d_young_modulus.getValue();
35 const Real poisson_ratio = d_poisson_ratio.getValue();
36 mu = young_modulus / (2.0 * (1.0 + poisson_ratio));
37 l = young_modulus * poisson_ratio / ((1.0 + poisson_ratio) * (1.0 - 2.0 * poisson_ratio));
48 const auto lnJ = log(J);
49 return mu/2.*(C.trace()-3) - mu*lnJ + l/2 *lnJ*lnJ;
53 virtual Eigen::Matrix<Real, Dimension, Dimension>
54 PK2_stress(
const Real & J,
const Eigen::Matrix<Real, Dimension, Dimension> & C)
const override {
56 static const auto Id = Eigen::Matrix<Real, Dimension, Dimension, Eigen::RowMajor>::Identity();
57 const auto Ci = C.inverse();
59 return (Id - Ci)*mu + Ci*(l*log(J));
63 virtual Eigen::Matrix<Real, 6, 6>
64 PK2_stress_jacobian(
const Real & J,
const Eigen::Matrix<Real, Dimension, Dimension> & C)
const override {
65 using caribou::algebra::symmetric_dyad_1;
66 using caribou::algebra::symmetric_dyad_2;
68 const auto Ci = C.inverse().eval();
70 Eigen::Matrix<Real, 6, 6> D = l*symmetric_dyad_1(Ci) + 2*(mu - l*log(J))*symmetric_dyad_2(Ci);
80 sofa::core::objectmodel::Data<Real> d_young_modulus;
81 sofa::core::objectmodel::Data<Real> d_poisson_ratio;