1#ifndef MODEL_SOLID_FINITE_NEOHOOKEAN_H_
2#define MODEL_SOLID_FINITE_NEOHOOKEAN_H_
26 Eigen::Matrix3d
F = Eigen::Matrix3d::Identity();
31#elif AMREX_SPACEDIM==3
32 Eigen::Matrix3d
F = a_F;
38 w += 0.5 *
mu * ((
F *
F.transpose()).trace() / J23 - 3.);
39 w += 0.5 *
kappa * (J - 1.0) * (J - 1.0);
46 Eigen::Matrix3d
F = Eigen::Matrix3d::Identity();
51#elif AMREX_SPACEDIM==3
52 Eigen::Matrix3d
F = a_F;
57 Eigen::Matrix3d FinvT =
F.inverse().transpose();
59 Eigen::Matrix3d dw = Eigen::Matrix3d::Zero();
61 dw +=
mu * (
F / J23 - (
F *
F.transpose()).trace() * FinvT / (3. * J23));
62 dw +=
kappa * (J - 1) * J * FinvT;
66 r_dw(0, 0) = dw(0, 0);
67 r_dw(0, 1) = dw(0, 1);
68 r_dw(1, 0) = dw(1, 0);
69 r_dw(1, 1) = dw(1, 1);
71#elif AMREX_SPACEDIM==3
79 Eigen::Matrix3d
F = Eigen::Matrix3d::Identity();
84#elif AMREX_SPACEDIM==3
85 Eigen::Matrix3d
F = a_F;
91 Eigen::Matrix3d FinvT =
F.inverse().transpose();
92 for (
int i = 0; i < 3; i++)
93 for (
int j = 0; j < 3; j++)
94 for (
int k = 0; k < 3; k++)
95 for (
int l = 0; l < 3; l++)
97 ddw(i, j, k, l) = 0.0;
101 if (i == k && j == l) t1 += 1.0;
102 t1 -= (2. / 3.) *
F(i, j) * FinvT(k, l);
103 t1 -= (2. / 3.) * FinvT(i, j) *
F(k, l);
104 t1 += (2. / 9.) * (
F *
F.transpose()).trace() * FinvT(i, j) * FinvT(k, l);
105 t1 += (1. / 3.) * (
F *
F.transpose()).trace() * FinvT(i, l) * FinvT(k, j);
107 t2 += (2. * J - 1.) * FinvT(i, j) * FinvT(k, l);
108 t2 += (1. - J) * FinvT(i, l) * FinvT(k, j);
110 ddw(i, j, k, l) = (
mu / J23) * t1 +
kappa * J * t2;
114 for (
int i = 0; i < 2; i++)
115 for (
int j = 0; j < 2; j++)
116 for (
int k = 0; k < 2; k++)
117 for (
int l = 0; l < 2; l++)
118 r_ddw(i, j, k, l) = ddw(i, j, k, l);
120#elif AMREX_SPACEDIM==3
126 out <<
"mu = " <<
mu <<
" kappa = " <<
kappa;
151 std::pair<std::string, Set::Scalar> moduli[2];
153 pp.
forbid(
"lame",
"Use 'lambda' instead for lame constant");
154 pp.
forbid(
"shear",
"Use 'mu' instead for shear modulus");
155 pp.
forbid(
"bulk",
"Use 'K' instead for bulk modulus");
162 pp.
query_exactly<2>({
"lambda",
"mu",
"E",
"nu",
"kappa"}, moduli, std::vector<Unit>{
Unit::Pressure(),
Unit::Pressure(),
Unit::Pressure(),
Unit::Less(),
Unit::Pressure()});
165 if (moduli[0].first ==
"mu" && moduli[1].first ==
"kappa")
167 value.
mu = moduli[0].second;
168 value.
kappa = moduli[1].second;
170 else if (moduli[0].first ==
"lambda" && moduli[1].first ==
"mu")
173 value.
mu = moduli[1].second;
174 value.
kappa = lambda + (2.0 * value.
mu) / 3.0;
179 value.
kappa = E / (3.0 - 6.0 * nu);
180 value.
mu = E / (2.0 + 2.0 * nu);
184 Util::Exception(
INFO,
"Haven't implemented",moduli[0].first,
" and ",moduli[1].first,
" yet (sorry!)");
188#define OP_CLASS NeoHookean
189#define OP_VARS X(kappa) X(mu)
void forbid(std::string name, std::string explanation, const std::source_location &location=std::source_location::current())
void query_exactly(std::vector< std::string > names, std::pair< std::string, Set::Scalar > values[N], std::vector< Unit > units=std::vector< Unit >(), const std::source_location &location=std::source_location::current())
bool contains(std::string name, const std::source_location &location=std::source_location::current())
AMREX_GPU_HOST_DEVICE Set::Scalar W(const Set::Matrix &a_F) const
static NeoHookean Random()
static void Parse(NeoHookean &value, IO::ParmParse &pp)
static constexpr KinematicVariable kinvar
AMREX_GPU_HOST_DEVICE NeoHookean(Solid< Set::Sym::Major > base)
AMREX_GPU_HOST_DEVICE Set::Matrix DW(const Set::Matrix &a_F) const
void Print(std::ostream &out) const
AMREX_GPU_HOST_DEVICE Set::Matrix4< AMREX_SPACEDIM, Set::Sym::Major > DDW(const Set::Matrix &a_F) const
AMREX_GPU_HOST_DEVICE NeoHookean()=default
A collection of data types and symmetry-reduced data structures.
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, 1 > Vector
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, AMREX_SPACEDIM > Matrix
void Exception(std::string file, std::string func, int line, Args const &... args)