PolyFEM
Loading...
Searching...
No Matches
GrowthElasticity.cpp
Go to the documentation of this file.
2
7
11
12#include <Eigen/Eigenvalues>
13
14#include <cmath>
15#include <fstream>
16#include <sstream>
17
18namespace polyfem::assembler
19{
20 namespace
21 {
22 // ------------------------------------------------------------------
23 // Local-state helpers: identical to ThermoElasticity's (same
24 // MixedNonLinearAssemblerData layout: phi = displacement,
25 // psi = scalar field; here the scalar field is the growth theta).
26 // ------------------------------------------------------------------
27 template <typename T>
28 void get_local_state(
29 const MixedNonLinearAssemblerData &data,
30 const int dim,
31 Eigen::Matrix<T, Eigen::Dynamic, 1> &local_state)
32 {
33 const int n_phi_bases = int(data.phi_vals.basis_values.size());
34 const int n_psi_bases = int(data.psi_vals.basis_values.size());
35 const int phi_local_size = n_phi_bases * dim;
36 const int local_size = phi_local_size + n_psi_bases;
37
38 Eigen::VectorXd values = Eigen::VectorXd::Zero(local_size);
39 for (int i = 0; i < n_phi_bases; ++i)
40 {
41 const auto &bs = data.phi_vals.basis_values[i];
42 for (const auto &global : bs.global)
43 {
44 for (int d = 0; d < dim; ++d)
45 values(i * dim + d) += global.val * data.x_phi(global.index * dim + d);
46 }
47 }
48
49 for (int i = 0; i < n_psi_bases; ++i)
50 {
51 const auto &bs = data.psi_vals.basis_values[i];
52 for (const auto &global : bs.global)
53 values(phi_local_size + i) += global.val * data.x_psi(global.index);
54 }
55
57 local_state.resize(local_size);
58
59 const AutoDiffAllocator<T> allocate_auto_diff_scalar;
60 for (int i = 0; i < local_size; ++i)
61 local_state(i) = allocate_auto_diff_scalar(i, values(i));
62 }
63
64 template <typename T>
65 void displacement_gradient_at_quad(
66 const MixedNonLinearAssemblerData &data,
67 const Eigen::Matrix<T, Eigen::Dynamic, 1> &local_state,
68 const int p,
69 const int dim,
70 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> &grad_u)
71 {
72 grad_u.resize(dim, dim);
73 for (int k = 0; k < grad_u.size(); ++k)
74 grad_u(k) = T(0);
75
76 for (int i = 0; i < data.phi_vals.basis_values.size(); ++i)
77 {
78 const auto &bs = data.phi_vals.basis_values[i];
79 const Eigen::Matrix<double, Eigen::Dynamic, 1, 0, 3, 1> grad = bs.grad.row(p);
80 assert(grad.size() == dim);
81
82 for (int d = 0; d < dim; ++d)
83 {
84 for (int c = 0; c < dim; ++c)
85 grad_u(d, c) += grad(c) * local_state(i * dim + d);
86 }
87 }
88
89 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> jac_it(dim, dim);
90 for (int k = 0; k < jac_it.size(); ++k)
91 jac_it(k) = T(data.phi_vals.jac_it[p](k));
92 grad_u = grad_u * jac_it;
93 }
94
95 template <typename T>
96 T growth_at_quad(
97 const MixedNonLinearAssemblerData &data,
98 const Eigen::Matrix<T, Eigen::Dynamic, 1> &local_state,
99 const int p,
100 const int dim)
101 {
102 const int phi_local_size = int(data.phi_vals.basis_values.size()) * dim;
103 T theta = T(0);
104 for (int i = 0; i < data.psi_vals.basis_values.size(); ++i)
105 theta += data.psi_vals.basis_values[i].val(p) * local_state(phi_local_size + i);
106 return theta;
107 }
108
109 inline double value_of(const double x) { return x; }
110 template <typename T>
111 double value_of(const T &x) { return x.getValue(); }
112
113 // ------------------------------------------------------------------
114 // Per-element vector/scalar cell data.
115 //
116 // Minimal reader for legacy ASCII VTK cell data: CELL_DATA section,
117 // arrays as "VECTORS <name> ...", "SCALARS <name> ..." or inside
118 // "FIELD FieldData" as "<name> <ncomp> <ntuples> <dtype>". (The fiber
119 // reader in MatParams.cpp handles VECTORS only.)
120 // ------------------------------------------------------------------
121 Eigen::MatrixXd read_vtk_cell_array(
122 std::istream &in, const std::string &path, const std::string &field, const int ncomp_expected)
123 {
124 if (!in)
125 log_and_throw_error("GrowthElasticity: cannot open '{}'", path);
126
127 std::string line;
128 bool in_cell_data = false;
129 long n_cells = -1;
130
131 while (std::getline(in, line))
132 {
133 std::istringstream ls(line);
134 std::string tok;
135 ls >> tok;
136
137 if (tok == "CELL_DATA")
138 {
139 in_cell_data = true;
140 ls >> n_cells;
141 continue;
142 }
143 if (tok == "POINT_DATA")
144 {
145 in_cell_data = false;
146 continue;
147 }
148 if (!in_cell_data)
149 continue;
150
151 long ntuples = n_cells;
152 int ncomp = -1;
153 std::string name;
154
155 if (tok == "VECTORS")
156 {
157 ls >> name;
158 ncomp = 3;
159 }
160 else if (tok == "FIELD")
161 {
162 continue; // array headers follow on their own lines
163 }
164 else if (tok == "SCALARS")
165 {
166 ls >> name;
167 ncomp = 1;
168 std::getline(in, line); // LOOKUP_TABLE line
169 }
170 else
171 {
172 // possible FIELD array header: <name> <ncomp> <ntuples> <dtype>
173 name = tok;
174 if (!(ls >> ncomp >> ntuples))
175 continue;
176 }
177
178 if (name != field)
179 {
180 // skip this array's payload
181 long remaining = ntuples * std::max(ncomp, 1);
182 double dummy;
183 while (remaining > 0 && in >> dummy)
184 --remaining;
185 continue;
186 }
187
188 if (ncomp != ncomp_expected)
190 "GrowthElasticity: field '{}' in '{}' has {} components, expected {}",
191 field, path, ncomp, ncomp_expected);
192
193 Eigen::MatrixXd values(ntuples, ncomp);
194 for (long i = 0; i < ntuples; ++i)
195 for (int c = 0; c < ncomp; ++c)
196 if (!(in >> values(i, c)))
198 "GrowthElasticity: truncated field '{}' in '{}'", field, path);
199 return values;
200 }
201
203 "GrowthElasticity: cell field '{}' not found in '{}'", field, path);
204 return Eigen::MatrixXd(); // unreachable
205 }
206 } // namespace
207
208 namespace detail
209 {
211 {
212 public:
213 void set_size(const int size)
214 {
215 size_ = size;
216 for (auto &m : iso_)
217 m->set_size(size);
218 for (auto &m : fiber_)
219 m->set_size(size);
220 for (auto &m : vol_)
221 m->set_size(size);
222 }
223
224 void add_multimaterial(const int index, const json &params, const Units &units, const io::ResourceIO &resources)
225 {
226 // ---- elastic material: the fitted MaterialSum composition
227 if (!params.contains("elastic_material") || !params["elastic_material"].is_object())
228 log_and_throw_error("GrowthElasticity requires elastic_material to be an elastic material object.");
229
230 const json &em = params["elastic_material"];
231 if (em.value("type", "") != "MaterialSum")
233 "GrowthElasticity requires elastic_material of type 'MaterialSum', got '{}'.",
234 em.value("type", ""));
235
236 for (const json &child_in : em.at("models"))
237 {
238 json child = child_in;
239 // forward parent identifiers, exactly as ThermoElasticity does
240 if (params.contains("id"))
241 child["id"] = params["id"];
242 if (params.contains(MATERIAL_ELEMENT_INDEX))
244
245 const std::string type = child.value("type", "");
246 if (type == "IsochoricNeoHookean")
247 add_child(iso_, index, child, units, resources);
248 else if (type == "HGODispersion")
249 add_child(fiber_, index, child, units, resources);
250 else if (type == "VolumePenalty")
251 add_child(vol_, index, child, units, resources);
252 else
254 "GrowthElasticity elastic_material supports IsochoricNeoHookean, "
255 "HGODispersion, VolumePenalty; got '{}'.",
256 type);
257 }
258
259 // ---- reference wall normal n0 (required): per-element data or constant
260 if (!params.contains("normal_direction"))
261 log_and_throw_error("GrowthElasticity requires normal_direction.");
262 const json &nd = params["normal_direction"];
263 if (nd.is_array())
264 {
265 constant_n0_ = Eigen::Vector3d(
266 nd[0].get<double>(), nd[1].get<double>(), nd[2].get<double>())
267 .normalized();
268 }
269 else if (nd.is_object() && nd.value("type", "") == "per_element_file")
270 {
272 resources, nd.at("path").get<std::string>(), nd.value("field", "N0"), 3);
273 normals_.rowwise().normalize();
274 }
275 else
276 {
278 "GrowthElasticity normal_direction must be a constant [x,y,z] "
279 "or {type: per_element_file, path, field}.");
280 }
281
282 // ---- prescribed normal growth vn (optional; default 1 = pure
283 // in-plane row; the candidate amended map supplies it per element)
284 if (params.contains("normal_growth"))
285 {
286 const json &ng = params["normal_growth"];
287 if (ng.is_number())
288 constant_vn_ = ng.get<double>();
289 else if (ng.is_object() && ng.value("type", "") == "per_element_file")
291 resources, ng.at("path").get<std::string>(), ng.value("field", "VN"), 1);
292 else
294 "GrowthElasticity normal_growth must be a number "
295 "or {type: per_element_file, path, field}.");
296 }
297 }
298
299 std::map<std::string, Assembler::ParamFunc> parameters() const
300 {
301 std::map<std::string, Assembler::ParamFunc> res;
302 res["normal_growth"] = [this](const RowVectorNd &, const RowVectorNd &, double, int e) {
303 return vn(e);
304 };
305 return res;
306 }
307
308 template <typename T>
310 {
311 if (size_ != 3)
312 log_and_throw_error("GrowthElasticity supports 3D only (in-plane growth needs a wall normal).");
313 assert(data.phi_vals.basis_values.size() > 0);
314 assert(data.psi_vals.basis_values.size() > 0);
315 assert(data.phi_vals.quadrature.weights.size() == data.psi_vals.quadrature.weights.size());
316
317 const int dim = size_;
318 const int el_id = data.phi_vals.element_id;
319
320 Eigen::Matrix<T, Eigen::Dynamic, 1> local_state;
321 get_local_state(data, dim, local_state);
322
323 const Eigen::Vector3d n0v = n0(el_id);
324 const double vn_e = vn(el_id);
325 if (!(vn_e > 0))
326 log_and_throw_error("GrowthElasticity: normal_growth must be positive, got {} on element {}.", vn_e, el_id);
327
328 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> grad_u(dim, dim);
329 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> F(dim, dim), Fgi(dim, dim), Fe(dim, dim);
330
331 T energy = T(0);
332 for (int p = 0; p < data.da.size(); ++p)
333 {
334 displacement_gradient_at_quad(data, local_state, p, dim, grad_u);
335
336 F = grad_u;
337 for (int d = 0; d < dim; ++d)
338 F(d, d) += T(1);
339
340 const T theta = growth_at_quad(data, local_state, p, dim);
341 if (!(value_of(theta) > 0))
343 "GrowthElasticity: growth theta must stay positive; got {} on element {} "
344 "(the growth-block feasibility filter is responsible for keeping iterates admissible).",
345 value_of(theta), el_id);
346
347 // Fg^-1 = I + (theta^{-1/2} - 1)(I - n0 x n0) + (vn^{-1} - 1) n0 x n0.
348 // Identity-anchored form: at theta == 1, vn == 1 both coefficients
349 // are exactly zero, so Fgi is the BITWISE identity for any normal
350 // and the correction vanishes exactly.
351 using std::sqrt;
352 const T c_ip = T(1) / sqrt(theta) - T(1);
353 const double c_n = 1.0 / vn_e - 1.0;
354 for (int a = 0; a < dim; ++a)
355 for (int b = 0; b < dim; ++b)
356 {
357 const double id = (a == b) ? 1.0 : 0.0;
358 const double nn = n0v(a) * n0v(b);
359 Fgi(a, b) = T(id) + c_ip * T(id - nn) + T(c_n * nn);
360 }
361
362 Fe = F * Fgi;
363 const T Jg = theta * T(vn_e);
364
365 // energy per intermediate volume: J^g * psi_e(Fe),
366 // minus psi_e(F) so this form is the additive correction and
367 // vanishes identically at theta = 1, vn = 1.
368 const RowVectorNd pos = data.phi_vals.val.row(p);
369 energy += (Jg * sum_energy<T>(pos, data.t, el_id, Fe)
370 - sum_energy<T>(pos, data.t, el_id, F))
371 * data.da(p);
372 }
373
374 return energy;
375 }
376
377 double driving_force(const int el_id, const RowVectorNd &pos, const double t, const Eigen::Matrix3d &Ce) const
378 {
379 if (size_ != 3)
380 log_and_throw_error("GrowthElasticity supports 3D only.");
381 const Eigen::SelfAdjointEigenSolver<Eigen::Matrix3d> es(0.5 * (Ce + Ce.transpose()));
382 if (es.info() != Eigen::Success || !(es.eigenvalues().minCoeff() > 0))
383 log_and_throw_error("GrowthElasticity::driving_force: Ce is not positive definite on element {}.", el_id);
384 // f_I depends on Ce only (objectivity), so any Fe with Fe^T Fe = Ce
385 // will do; the symmetric root is the canonical choice.
386 const Eigen::Matrix3d Fe = es.eigenvectors() * es.eigenvalues().cwiseSqrt().asDiagonal() * es.eigenvectors().transpose();
387 const Eigen::Vector3d n0v = n0(el_id);
388
391 const AD theta(0, 1.0);
392 using std::sqrt;
393 const AD c_ip = AD(1) / sqrt(theta) - AD(1);
394 Eigen::Matrix<AD, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> Fs(3, 3);
395 for (int a = 0; a < 3; ++a)
396 for (int b = 0; b < 3; ++b)
397 {
398 // Fe * Fgi(theta), Fgi = I + c_ip (I - n0 n0), vn = 1
399 AD v = AD(Fe(a, b));
400 for (int k = 0; k < 3; ++k)
401 {
402 const double ip = (k == b ? 1.0 : 0.0) - n0v(k) * n0v(b);
403 v += AD(Fe(a, k) * ip) * c_ip;
404 }
405 Fs(a, b) = v;
406 }
407 const AD g = theta * sum_energy<AD>(pos, t, el_id, Fs);
408 return -g.getGradient()(0);
409 }
410
411 Eigen::Vector3d wall_normal(const int el_id) const { return n0(el_id); }
412
414 const int el_id, const RowVectorNd &pos, const double t,
415 const Eigen::Matrix3d &F, const double theta,
416 Eigen::Matrix3d &cauchy, Eigen::Matrix3d &pk1, Eigen::Matrix3d &pk2,
417 double &energy) const
418 {
419 if (size_ != 3)
420 log_and_throw_error("GrowthElasticity supports 3D only.");
421 if (!(theta > 0))
422 log_and_throw_error("GrowthElasticity::grown_stresses: growth theta must be positive; got {} on element {}.", theta, el_id);
423 const double J = F.determinant();
424 if (!(J > 0))
425 log_and_throw_error("GrowthElasticity::grown_stresses: det F = {} on element {}.", J, el_id);
426
427 // Fg^-1 in the identity-anchored form of the energy, so theta == 1,
428 // vn == 1 gives Fe == F exactly.
429 const Eigen::Vector3d n0v = n0(el_id);
430 const double vn_e = vn(el_id);
431 const Eigen::Matrix3d nn = n0v * n0v.transpose();
432 const Eigen::Matrix3d I = Eigen::Matrix3d::Identity();
433 const Eigen::Matrix3d Fgi = I + (1.0 / std::sqrt(theta) - 1.0) * (I - nn) + (1.0 / vn_e - 1.0) * nn;
434 const Eigen::Matrix3d Fe = F * Fgi;
435 const double Jg = theta * vn_e;
436
437 // Pe = d psi_e / d Fe through the same templated child energies
440 Eigen::Matrix<AD, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> Fe_ad(3, 3);
441 for (int a = 0; a < 3; ++a)
442 for (int b = 0; b < 3; ++b)
443 Fe_ad(a, b) = AD(a * 3 + b, Fe(a, b));
444 const AD psi = sum_energy<AD>(pos, t, el_id, Fe_ad);
445 Eigen::Matrix3d Pe;
446 for (int a = 0; a < 3; ++a)
447 for (int b = 0; b < 3; ++b)
448 Pe(a, b) = psi.getGradient()(a * 3 + b);
449
450 pk1 = Jg * Pe * Fgi.transpose();
451 cauchy = pk1 * F.transpose() / J;
452 pk2 = F.inverse() * pk1;
453 energy = Jg * psi.getValue();
454 }
455
456 private:
457 template <typename Child>
459 std::vector<std::unique_ptr<Child>> &list,
460 const int index, const json &child, const Units &units, const io::ResourceIO &resources)
461 {
462 if (list.empty())
463 {
464 list.emplace_back(std::make_unique<Child>());
465 if (size_ > 0) // robust to set_size/add_multimaterial call order
466 list.front()->set_size(size_);
467 }
468 // multimaterial entries accumulate on the same child instances,
469 // mirroring how SumModel forwards add_multimaterial per index
470 list.front()->add_multimaterial(index, child, units, resources);
471 }
472
473 template <typename T>
474 T sum_energy(const RowVectorNd &p, const double t, const int el_id,
475 const Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3> &F) const
476 {
477 T e = T(0);
478 for (const auto &m : iso_)
479 e += m->elastic_energy(p, t, el_id, F);
480 for (const auto &m : fiber_)
481 e += m->elastic_energy(p, t, el_id, F);
482 for (const auto &m : vol_)
483 e += m->elastic_energy(p, t, el_id, F);
484 return e;
485 }
486
487 Eigen::Vector3d n0(const int el_id) const
488 {
489 if (normals_.rows() > 0)
490 {
491 if (el_id < 0 || el_id >= normals_.rows())
493 "GrowthElasticity: element {} out of range of normal_direction data ({} rows).",
494 el_id, normals_.rows());
495 return normals_.row(el_id).transpose();
496 }
497 return constant_n0_;
498 }
499
500 double vn(const int el_id) const
501 {
502 if (vn_.rows() > 0)
503 {
504 if (el_id < 0 || el_id >= vn_.rows())
506 "GrowthElasticity: element {} out of range of normal_growth data ({} rows).",
507 el_id, vn_.rows());
508 return vn_(el_id, 0);
509 }
510 return constant_vn_;
511 }
512
513 int size_ = -1;
514
515 // concrete children (the fitted MaterialSum re-composed with the
516 // SAME templated elastic_energy bodies the plain elastic path runs)
517 std::vector<std::unique_ptr<IsochoricNeoHookean>> iso_;
518 std::vector<std::unique_ptr<HGODispersion>> fiber_;
519 std::vector<std::unique_ptr<VolumePenalty>> vol_;
520
521 Eigen::MatrixXd normals_; // per-element n0, or:
522 Eigen::Vector3d constant_n0_{0.0, 0.0, 1.0}; // constant fallback (tests)
523 Eigen::MatrixXd vn_; // per-element vn, or:
524 double constant_vn_ = 1.0; // default: pure in-plane row
525 };
526 } // namespace detail
527
528 Eigen::MatrixXd read_growth_cell_array(
529 const io::ResourceIO &resources, const std::string &path, const std::string &field, const int ncomp_expected)
530 {
531 auto in = resources.open(path, false);
532 return read_vtk_cell_array(*in, resources.describe(path), field, ncomp_expected);
533 }
534
536 : model_(std::make_unique<detail::GrowthElasticityModel>())
537 {
538 }
539
541
542 std::map<std::string, Assembler::ParamFunc> GrowthElasticity::parameters() const
543 {
544 return model().parameters();
545 }
546
547 void GrowthElasticity::set_size(const int size)
548 {
551 }
552
553 void GrowthElasticity::add_multimaterial(const int index, const json &params, const Units &units, const io::ResourceIO &resources)
554 {
555 model().add_multimaterial(index, params, units, resources);
556 }
557
559 {
560 return model().compute_energy_aux<double>(data);
561 }
562
564 {
566 return energy.getGradient();
567 }
568
570 {
572 hessian.assign(energy.getHessian());
573 }
574
575 double GrowthElasticity::driving_force(const int el_id, const RowVectorNd &pos, const double t, const Eigen::Matrix3d &Ce) const
576 {
577 return model().driving_force(el_id, pos, t, Ce);
578 }
579
580 Eigen::Vector3d GrowthElasticity::wall_normal(const int el_id) const
581 {
582 return model().wall_normal(el_id);
583 }
584
586 const int el_id, const RowVectorNd &pos, const double t,
587 const Eigen::Matrix3d &F, const double theta,
588 Eigen::Matrix3d &cauchy, Eigen::Matrix3d &pk1, Eigen::Matrix3d &pk2,
589 double &energy) const
590 {
591 model().grown_stresses(el_id, pos, t, F, theta, cauchy, pk1, pk2, energy);
592 }
593
595 {
596 if (!model_)
597 log_and_throw_error("GrowthElasticity used before initialization.");
598 return *model_;
599 }
600
602 {
603 if (!model_)
604 log_and_throw_error("GrowthElasticity used before initialization.");
605 return *model_;
606 }
607} // namespace polyfem::assembler
LocalHessian hessian
double val
double J
int x
virtual void set_size(const int size)
Definition Assembler.hpp:68
Eigen::Vector3d wall_normal(const int el_id) const
Reference wall normal n0 of element el_id (unit).
void grown_stresses(const int el_id, const RowVectorNd &pos, const double t, const Eigen::Matrix3d &F, const double theta, Eigen::Matrix3d &cauchy, Eigen::Matrix3d &pk1, Eigen::Matrix3d &pk2, double &energy) const
Stresses and energy density of the grown material, total energy density J^g psi_e(F Fg^{-1}),...
double driving_force(const int el_id, const RowVectorNd &pos, const double t, const Eigen::Matrix3d &Ce) const
Growth driving force f_I = -(1/vn) d(J^g psi_e)/d theta as a function of the elastic right Cauchy-Gre...
double compute_energy(const MixedNonLinearAssemblerData &data) const override
void set_size(const int size) override
void add_multimaterial(const int index, const json &params, const Units &units, const io::ResourceIO &resources) override
std::map< std::string, ParamFunc > parameters() const override
detail::GrowthElasticityModel & model()
Eigen::VectorXd compute_gradient(const MixedNonLinearAssemblerData &data) const override
void compute_hessian(const MixedNonLinearAssemblerData &data, LocalHessian &hessian) const override
std::unique_ptr< detail::GrowthElasticityModel > model_
Reusable element matrix with inline storage for small blocks and a dynamic fallback for high-order el...
const QuadratureVector & da
Contains both the quadrature weight and the change of metric in the integral.
const ElementAssemblyValues & phi_vals
Values for the first block, historically tensor velocity/displacement-like bases.
const ElementAssemblyValues & psi_vals
Values for the second block, historically scalar pressure-like bases.
double driving_force(const int el_id, const RowVectorNd &pos, const double t, const Eigen::Matrix3d &Ce) const
void add_multimaterial(const int index, const json &params, const Units &units, const io::ResourceIO &resources)
std::map< std::string, Assembler::ParamFunc > parameters() const
T compute_energy_aux(const MixedNonLinearAssemblerData &data) const
Eigen::Vector3d wall_normal(const int el_id) const
void add_child(std::vector< std::unique_ptr< Child > > &list, const int index, const json &child, const Units &units, const io::ResourceIO &resources)
void grown_stresses(const int el_id, const RowVectorNd &pos, const double t, const Eigen::Matrix3d &F, const double theta, Eigen::Matrix3d &cauchy, Eigen::Matrix3d &pk1, Eigen::Matrix3d &pk2, double &energy) const
std::vector< std::unique_ptr< HGODispersion > > fiber_
std::vector< std::unique_ptr< IsochoricNeoHookean > > iso_
T sum_energy(const RowVectorNd &p, const double t, const int el_id, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > &F) const
Eigen::Vector3d n0(const int el_id) const
std::vector< std::unique_ptr< VolumePenalty > > vol_
Read-only interface to a hierarchical collection of simulation resources.
virtual std::string describe(const std::string &path) const =0
virtual std::unique_ptr< std::istream > open(const std::string &path, bool binary) const =0
Used for test only.
Eigen::MatrixXd read_growth_cell_array(const io::ResourceIO &resources, const std::string &path, const std::string &field, const int ncomp_expected)
Mixed (displacement, growth) assembler implementing the correction energy of finite areal growth of a...
constexpr const char * MATERIAL_ELEMENT_INDEX
Definition MatParams.hpp:10
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13
void log_and_throw_error(const std::string &msg)
Definition Logger.cpp:73
Automatic differentiation scalar with first-order derivatives.
Definition autodiff.h:112
Automatic differentiation scalar with first- and second-order derivatives.
Definition autodiff.h:493
static void setVariableCount(size_t value)
Set the independent variable count used by the automatic differentiation layer.
Definition autodiff.h:54