PolyFEM
Loading...
Searching...
No Matches
IsochoricNeoHookean.cpp
Go to the documentation of this file.
2
3namespace polyfem::assembler
4{
8
9 void IsochoricNeoHookean::add_multimaterial(const int index, const json &params, const Units &units)
10 {
11 assert(size() == 2 || size() == 3);
12
13 params_.add_multimaterial(index, params, false, units.stress());
14 }
15
16 std::map<std::string, Assembler::ParamFunc> IsochoricNeoHookean::parameters() const
17 {
18 std::map<std::string, ParamFunc> res;
19 const auto &params = params_;
20 const int size = this->size();
21
22 res["lambda"] = [&params](const RowVectorNd &uv, const RowVectorNd &p, double t, int e) {
23 double lambda, mu;
24
25 params.lambda_mu(uv, p, t, e, lambda, mu);
26 return lambda;
27 };
28
29 res["mu"] = [&params](const RowVectorNd &uv, const RowVectorNd &p, double t, int e) {
30 double lambda, mu;
31
32 params.lambda_mu(uv, p, t, e, lambda, mu);
33 return mu;
34 };
35
36 res["E"] = [&params, size](const RowVectorNd &uv, const RowVectorNd &p, double t, int e) {
37 double lambda, mu;
38 params.lambda_mu(uv, p, t, e, lambda, mu);
39
40 if (size == 3)
41 return mu * (3.0 * lambda + 2.0 * mu) / (lambda + mu);
42 else
43 return 2 * mu * (2.0 * lambda + 2.0 * mu) / (lambda + 2.0 * mu);
44 };
45
46 res["nu"] = [&params, size](const RowVectorNd &uv, const RowVectorNd &p, double t, int e) {
47 double lambda, mu;
48
49 params.lambda_mu(uv, p, t, e, lambda, mu);
50
51 if (size == 3)
52 return lambda / (2.0 * (lambda + mu));
53 else
54 return lambda / (lambda + 2.0 * mu);
55 };
56
57 return res;
58 }
59} // namespace polyfem::assembler
std::string stress() const
Definition Units.hpp:27
void add_multimaterial(const int index, const json &params, const Units &units) override
std::map< std::string, ParamFunc > parameters() const override
void add_multimaterial(const int index, const json &params, const bool is_volume, const std::string &stress_unit)
Used for test only.
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13