Alamo
Isotropic.H
Go to the documentation of this file.
1 //
2 // This model implements an isotropic linear elastic material.
3 // See `this link <https://en.wikipedia.org/wiki/Linear_elasticity#(An)isotropic_(in)homogeneous_media>`_
4 // for more information about the theory.
5 //
6 // Free energy for a linear material is defined as
7 //
8 // .. math::
9 //
10 // W(\nabla\mathbf{u}) =
11 // \frac{1}{2}\nabla\mathbf{u}\cdot\mathbb{C}\,\nabla\mathbf{u}
12 //
13 // For an isotropic material, stress and strain are related through
14 //
15 // .. math::
16 //
17 // \mathbb{C}_{ijkl} = \lambda \delta_{ij}\varepsilon_{kk} + 2\mu\varepsilon_{ij}
18 //
19 // where :math:`\lambda` and :math:`\mu` are the Lame constant and shear modulus, respectively.
20 // Users can specify these either through (:code:`lame` and :code:`shear`)
21 // OR (:code:`lambda` and :code:`mu`) OR (:code:`E` and :code:`nu`).
22 //
23 // Class methods:
24 //
25 // #. :code:`Isotropic()`:
26 // Basic constructor. Does nothing, and leaves all values initiated as NAN.
27 // #. :code:`Isotropic(Solid<Set::Sym::Isotropic> base)`
28 // Basic constructor. Does nothing gut allows for inheritance.
29 // #. :code:`Isotropic(Set::Scalar a_mu, Set::Scalar a_lambda)`
30 // BAD old-fashioned constructor. Do not use!
31 // #. :code:`~Isotropic()`
32 // Simple destructor. Don't need to change it.
33 // #. :code:`void Define(Set::Scalar a_mu, Set::Scalar a_lambda)`
34 // BAD old-fashioned way of doing things. Use :code:`Parse` instead.
35 // #. :code:`Set::Scalar W(const Set::Matrix & gradu) const override`
36 // Returns elastic free energy density
37 // #. :code:`Set::Matrix DW(const Set::Matrix & gradu) const override`
38 // Returns first derivative of free energy, the stress tensor
39 // #. :code:`Set::Matrix4<...> DDW(const Set::Matrix & ) const override`
40 // Returns second derivative of free energy, the modulus tensor
41 // #. :code:`virtual void Print(std::ostream &out) const override`
42 // Prints the modulus tensor object to output stream (usually the terminal)
43 // #. :code:`static Isotropic Random()`
44 // Static method that generates a random yet acceptable model.
45 // #. :code:`static Isotropic Zero()`
46 // Static method that generates a "zero" element (so that there is no effect under addition)
47 // #. :code:`static void Parse(Isotropic & value, IO::ParmParse & pp)`
48 // Parser where all the IO occurs
49 //
50 //
51 
52 #ifndef MODEL_SOLID_LINEAR_ISOTROPIC_H_
53 #define MODEL_SOLID_LINEAR_ISOTROPIC_H_
54 
55 #include "Model/Solid/Solid.H"
56 #include "IO/ParmParse.H"
57 
58 namespace Model
59 {
60 namespace Solid
61 {
62 namespace Linear
63 {
64 class Isotropic : public Solid<Set::Sym::Isotropic>
65 {
66 public:
67 
68  Isotropic() {};
71  {
72  Define(a_mu,a_lambda);
73  };
74  virtual ~Isotropic() {};
75 
76  void Define(Set::Scalar a_mu, Set::Scalar a_lambda)
77  {
79  }
80 
81  Set::Scalar W(const Set::Matrix & gradu) const override
82  {
83  return ( 0.5 * gradu.transpose() * (ddw*gradu) ).trace();
84  }
85  Set::Matrix DW(const Set::Matrix & gradu) const override
86  {
87  return ddw*gradu;
88  }
90  {
91  return ddw;
92  }
93  virtual void Print(std::ostream &out) const override
94  {
95  out << ddw;
96  }
97 
98 public:
101 
102 public:
103  static Isotropic Random()
104  {
105  Isotropic ret;
107  return ret;
108  }
109  static Isotropic Zero()
110  {
111  Isotropic ret;
112  ret.Define(0.,0.);
113  return ret;
114  }
115  static void Parse(Isotropic & value, IO::ParmParse & pp)
116  {
117  Set::Scalar mu, lambda;
118  bool planestress = false;
119 
120  // Whether or not to use the
121  // `plane stress <https://en.wikipedia.org/wiki/Plane_stress>`_
122  // approximation.
123  pp_query("planestress",planestress);
124  if (pp.contains("lame") && pp.contains("shear"))
125  {
126  pp_query("lame",lambda); // Lame parameter
127  pp_query("shear",mu); // Shear modulus (redundant with "mu")
128  }
129  if (pp.contains("lambda") && pp.contains("mu"))
130  {
131  pp_query("lambda",lambda); // Lame parameter
132  pp_query("mu",mu); // Shear modulus (redundant with "shear")
133  }
134  else if (pp.contains("E") && pp.contains("nu"))
135  {
136  Set::Scalar E, nu;
137  pp_query("E",E); // Elastic modulus
138  pp_query("nu",nu); // Poisson's ratio
139  lambda = E * nu / (1.0 + nu) / (1.0 - 2.0*nu);
140  mu = E / 2.0 / (1.0 + nu);
141  }
142  else Util::Abort(INFO,"Invalid elastic constants specified");
143 
144  if (AMREX_SPACEDIM==2 && planestress)
145  value.Define(mu,lambda*(1.0 - lambda/(2.*mu + lambda)));
146  else
147  value.Define(mu,lambda);
148  Util::Message(INFO,value);
149  }
150 
151  #define OP_CLASS Isotropic
152  #define OP_VARS X(ddw)
154 };
156 
157 
158 
159 }
160 }
161 }
162 
163 #endif
Model::Solid::gradu
@ gradu
Definition: Solid.H:26
Set::Sym
Sym
Definition: Base.H:197
Model::Solid::Linear::Isotropic::DW
Set::Matrix DW(const Set::Matrix &gradu) const override
Definition: Isotropic.H:85
Model::Solid::Linear::Isotropic::Isotropic
Isotropic()
Definition: Isotropic.H:68
ParmParse.H
Model::Solid::Linear::Isotropic::DDW
Set::Matrix4< AMREX_SPACEDIM, Set::Sym::Isotropic > DDW(const Set::Matrix &) const override
Definition: Isotropic.H:89
pp_query
#define pp_query(...)
Definition: ParmParse.H:104
Model::Solid::Linear::Isotropic::Parse
static void Parse(Isotropic &value, IO::ParmParse &pp)
Definition: Isotropic.H:115
Model::Solid::Linear::Isotropic::ddw
Set::Matrix4< AMREX_SPACEDIM, Set::Sym::Isotropic > ddw
Definition: Isotropic.H:99
Util::Random
Set::Scalar Random()
Definition: Set.cpp:9
Set::Scalar
amrex::Real Scalar
Definition: Base.H:19
Set
A collection of data types and symmetry-reduced data structures.
Definition: Base.H:17
Solid.H
InClassOperators.H
Set::Matrix
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, AMREX_SPACEDIM > Matrix
Definition: Base.H:23
ExtClassOperators.H
Model::Solid::Linear::Isotropic
Definition: Isotropic.H:64
Model::Solid::Linear::Isotropic::Define
void Define(Set::Scalar a_mu, Set::Scalar a_lambda)
Definition: Isotropic.H:76
Model::Solid::Linear::Isotropic::Random
static Isotropic Random()
Definition: Isotropic.H:103
IO::ParmParse::contains
bool contains(std::string name)
Definition: ParmParse.H:151
Model::Solid::Linear::Isotropic::Isotropic
Isotropic(Solid< Set::Sym::Isotropic > base)
Definition: Isotropic.H:69
Util::Abort
void Abort(const char *msg)
Definition: Util.cpp:165
Model::Solid::Solid
Definition: Solid.H:29
Set::Matrix4< AMREX_SPACEDIM, Set::Sym::Isotropic >
Model::Solid::KinematicVariable
KinematicVariable
Definition: Solid.H:26
IO::ParmParse
Definition: ParmParse.H:110
Model::Solid::Linear::Isotropic::W
Set::Scalar W(const Set::Matrix &gradu) const override
Definition: Isotropic.H:81
Model::Solid::Linear::Isotropic::Print
virtual void Print(std::ostream &out) const override
Definition: Isotropic.H:93
Model::Solid::Linear::Isotropic::~Isotropic
virtual ~Isotropic()
Definition: Isotropic.H:74
Model::Solid::Linear::Isotropic::kinvar
static const KinematicVariable kinvar
Definition: Isotropic.H:100
Model::Solid::Linear::Isotropic::Zero
static Isotropic Zero()
Definition: Isotropic.H:109
Model::Solid::Linear::Isotropic::Isotropic
Isotropic(Set::Scalar a_mu, Set::Scalar a_lambda)
Definition: Isotropic.H:70
INFO
#define INFO
Definition: Util.H:20
Model
Definition: Constant.H:12
Util::Message
void Message(std::string file, std::string func, int line, Args const &... args)
Definition: Util.H:133