RFFGen
 All Classes Namespaces Files Functions Typedefs Enumerations Groups
neoHooke.hh
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the C++-library RFFGen. */
4 /* Copyright 2015 Lars Lubkoll */
5 /* */
6 /* RFFGen is free software: you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation, either version 3 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /* RFFGen is distributed in the hope that it will be useful, */
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14 /* GNU General Public License for more details. */
15 /* */
16 /* You should have received a copy of the GNU General Public License */
17 /* along with RFFGen. If not, see <http://www.gnu.org/licenses/>. */
18 /* */
19 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
20 
21 #ifndef RFFGEN_NEO_HOOKE_HH
22 #define RFFGEN_NEO_HOOKE_HH
23 
24 #include "../../LinearAlgebra/invariants.hh"
25 #include "../../LinearAlgebra/strainTensor.hh"
26 #include "../../LinearAlgebra/unitMatrix.hh"
27 #include "../../finalize.hh"
28 #include "../volumetricPenaltyFunctions.hh"
29 #include "../../generate.hh"
30 
37 namespace RFFGen
38 {
43  template < class Matrix , int offset = LinearAlgebra::dimension<Matrix>() >
44  auto incompressibleNeoHooke(double c, const Matrix& F)
45  {
46  using namespace LinearAlgebra;
47  using Inv = typename InvariantTraits<Invariant::PRINCIPAL>::template ShiftedFirstInvariant<Matrix,offset>;
48  auto S = LeftCauchyGreenStrainTensor<Matrix>(F);
49  auto f = c*Inv(S()) << S;
50  return Finalize<decltype(f)>(f);
51  }
52 
57  template < class Matrix , int offset = LinearAlgebra::dimension<Matrix>() >
58  auto modifiedIncompressibleNeoHooke(double c, const Matrix& F)
59  {
60  using namespace LinearAlgebra;
61  using Inv = typename InvariantTraits<Invariant::MODIFIED>::template ShiftedFirstInvariant<Matrix,offset>;
62  auto S = LeftCauchyGreenStrainTensor<Matrix>(F);
63  return c * Inv(S()) << S;
64  }
65 
69  namespace NeoHookeDetail
70  {
71  template <class InflationPenalty, class CompressionPenalty, class Matrix, LinearAlgebra::Invariant I = LinearAlgebra::Invariant::PRINCIPAL , int offset = LinearAlgebra::dimension<Matrix>() >
72  auto compressibleNeoHookeImpl(double c, double d0, double d1, const Matrix& F)
73  {
74  using namespace LinearAlgebra;
75  using Inv = typename InvariantTraits<I>::template ShiftedFirstInvariant<Matrix,offset>;
76  auto S = LeftCauchyGreenStrainTensor<Matrix>(F);
77  return ( c*Inv(F) << S ) + volumetricPenalty<InflationPenalty,CompressionPenalty>(d0,d1,F);
78  //return Finalize<decltype(f)>(f);
79  }
80  }
90  template <class InflationPenalty, class CompressionPenalty, class Matrix , int offset = LinearAlgebra::dimension<Matrix>() >
91  auto compressibleNeoHooke(double c, double d0, double d1, const Matrix& F)
92  {
93  return NeoHookeDetail::compressibleNeoHookeImpl<InflationPenalty,CompressionPenalty,Matrix,LinearAlgebra::Invariant::PRINCIPAL,offset>(c,d0,d1,F);
94  }
95 
101  template <class InflationPenalty, class CompressionPenalty, class Matrix , int offset = LinearAlgebra::dimension<Matrix>() >
102  auto modifiedCompressibleNeoHooke(double c, double d0, double d1, const Matrix& F)
103  {
104  return NeoHookeDetail::compressibleNeoHookeImpl<InflationPenalty,CompressionPenalty,Matrix,LinearAlgebra::Invariant::MODIFIED,offset>(c,d0,d1,F);
105  }
106 }
107 
108 #endif // RFFGEN_NEO_HOOKE_HH
auto compressibleNeoHooke(double c, double d0, double d1, const Matrix &F)
Generate a compressible neo-Hookean material law , where is the first principal matrix invariant...
Definition: neoHooke.hh:91
auto modifiedIncompressibleNeoHooke(double c, const Matrix &F)
Generate an "incompressible" neo-Hookean material law , where is the modified first principal matrix...
Definition: neoHooke.hh:58
Detail::FinalizeImpl< F, arithmeticArgument, Checks::hasVariable< F >() > Finalize
Finish function definition.
Definition: finalize.hh:297
auto incompressibleNeoHooke(double c, const Matrix &F)
Generate an "incompressible" neo-Hookean material law , where is the first principal matrix invarian...
Definition: neoHooke.hh:44
auto modifiedCompressibleNeoHooke(double c, double d0, double d1, const Matrix &F)
Generate a compressible neo-Hookean material law , where is the modified first principal matrix inva...
Definition: neoHooke.hh:102