PolyFEM
Loading...
Searching...
No Matches
ActiveFiber.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <map>
7#include <string>
8
9namespace polyfem::assembler
10{
11 class ActiveFiber : public GenericFiber<ActiveFiber>
12 {
13 public:
15
16 // JSON params:
17 // - "Tmax": scalar / field / param expression (GenericMatParam)
18 // - "activation": scalar / field / param expression in [0,1] (GenericMatParam)
19 void add_multimaterial(const int index, const json &params, const Units &units) override;
20
21 std::string name() const override { return "ActiveFiber"; }
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 // activation scalar (your C(t) equivalent)
32 const double Tmax = Tmax_(p, t, el_id);
33 const double Cact = activation_(p, t, el_id); // should be in [0,1]
34
35 // // FEBio constants
36 // const double Ca0 = 4.35;
37 // const double Ca0max = 4.35;
38 // const double B = 4.75;
39 // const double l0 = 1.58;
40 // const double lr = 2.04;
41
42 // // invariant (isochoric like HGO)
43 // const T I4bar = I4Bar(p, t, el_id, def_grad);
44 const T I4bar = I4Bar_with_norm(p, t, el_id, def_grad);
45 // const T lambda = sqrt(I4bar); // if you can compute non-isochoric I4, use that here instead
46 // const T l = lambda * T(lr);
47
48 // // No active tension if l <= l0
49 // if (l <= T(l0))
50 // return T(0);
51
52 // // ECa50 and Ca-sensitivity factor
53 // const T denom = exp(T(B) * (l - T(l0))) - T(1);
54 // const T ECa50 = T(Ca0max) / sqrt(denom);
55 // const T cst = T(Ca0 * Ca0) / (T(Ca0 * Ca0) + ECa50 * ECa50);
56
57 // // Total scalar active tension multiplier
58 // const T Ta = T(Tmax) * T(Cact) * cst;
59
60 const double a = std::min(1.0, std::max(0.0, Cact));
61 const T Ta = T(Tmax * a);
62
63 // Energy
64 return T(-0.5) * Ta * (I4bar - T(1));
65 }
66
67 private:
70 };
71} // namespace polyfem::assembler
std::map< std::string, ParamFunc > parameters() const override
std::string name() const override
void add_multimaterial(const int index, const json &params, const Units &units) override
T elastic_energy(const RowVectorNd &p, const double t, const int el_id, const DefGradMatrix< T > &def_grad) const
T I4Bar_with_norm(const RowVectorNd &p, const double t, const int el_id, const DefGradMatrix< T > &def_grad) const
Used for test only.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > DefGradMatrix
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< double, 1, Eigen::Dynamic, Eigen::RowMajor, 1, 3 > RowVectorNd
Definition Types.hpp:13