MFEM  v3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
nonlininteg.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.googlecode.com.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #ifndef MFEM_NONLININTEG
13 #define MFEM_NONLININTEG
14 
15 #include "../config/config.hpp"
16 #include "fe.hpp"
17 #include "coefficient.hpp"
18 
19 namespace mfem
20 {
21 
27 {
28 public:
30  virtual void AssembleElementVector(const FiniteElement &el,
32  const Vector &elfun, Vector &elvect) = 0;
33 
35  virtual void AssembleElementGrad(const FiniteElement &el,
37  const Vector &elfun, DenseMatrix &elmat);
38 
40  virtual double GetElementEnergy(const FiniteElement &el,
42  const Vector &elfun);
43 
45 };
46 
47 
50 {
51 protected:
53 
54 public:
55  HyperelasticModel() { T = NULL; }
56 
59 
61  virtual double EvalW(const DenseMatrix &J) const = 0;
62 
64  virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const = 0;
65 
70  virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
71  const double weight, DenseMatrix &A) const = 0;
72 
73  virtual ~HyperelasticModel() { }
74 };
75 
76 
81 {
82 protected:
83  mutable DenseMatrix Z, S; // dim x dim
84  mutable DenseMatrix G, C; // dof x dim
85 
86 public:
87  virtual double EvalW(const DenseMatrix &J) const;
88 
89  virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const;
90 
91  virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
92  const double weight, DenseMatrix &A) const;
93 };
94 
95 
102 {
103 protected:
104  mutable double mu, K, g;
107 
108  mutable DenseMatrix Z; // dim x dim
109  mutable DenseMatrix G, C; // dof x dim
110 
111  inline void EvalCoeffs() const;
112 
113 public:
114  NeoHookeanModel(double _mu, double _K, double _g = 1.0)
115  : mu(_mu), K(_K), g(_g), have_coeffs(false) { c_mu = c_K = c_g = NULL; }
116 
118  : mu(0.0), K(0.0), g(1.0), c_mu(&_mu), c_K(&_K), c_g(_g),
119  have_coeffs(true) { }
120 
121  virtual double EvalW(const DenseMatrix &J) const;
122 
123  virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const;
124 
125  virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS,
126  const double weight, DenseMatrix &A) const;
127 };
128 
129 
132 {
133 private:
134  HyperelasticModel *model;
135 
136  DenseMatrix DSh, DS, J0i, J1, J, P, PMatI, PMatO;
137 
138 public:
140 
141  virtual double GetElementEnergy(const FiniteElement &el,
143  const Vector &elfun);
144 
145  virtual void AssembleElementVector(const FiniteElement &el,
147  const Vector &elfun, Vector &elvect);
148 
149  virtual void AssembleElementGrad(const FiniteElement &el,
151  const Vector &elfun, DenseMatrix &elmat);
152 
153  virtual ~HyperelasticNLFIntegrator();
154 };
155 
156 }
157 
158 #endif
Abstract class for Finite Elements.
Definition: fe.hpp:42
virtual double GetElementEnergy(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun)
Compute the local energy.
virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P=P(J).
virtual double EvalW(const DenseMatrix &J) const
Evaluate the strain energy density function, W=W(J).
NeoHookeanModel(Coefficient &_mu, Coefficient &_K, Coefficient *_g=NULL)
virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
Definition: nonlininteg.cpp:58
Data type dense matrix.
Definition: densemat.hpp:22
virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P=P(J).
Definition: nonlininteg.cpp:41
Hyperelastic integrator for any given HyperelasticModel.
void EvalCoeffs() const
void SetTransformation(ElementTransformation &_T)
An element transformation that can be used to evaluate coefficients.
Definition: nonlininteg.hpp:58
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
Definition: nonlininteg.cpp:17
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
NeoHookeanModel(double _mu, double _K, double _g=1.0)
Base class Coefficient that may optionally depend on time.
Definition: coefficient.hpp:31
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)=0
Perform the local action of the NonlinearFormIntegrator.
virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS, const double weight, DenseMatrix &A) const =0
virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
HyperelasticNLFIntegrator(HyperelasticModel *m)
virtual double EvalW(const DenseMatrix &J) const
Evaluate the strain energy density function, W=W(J).
Definition: nonlininteg.cpp:34
virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const =0
Evaluate the 1st Piola-Kirchhoff stress tensor, P=P(J).
Abstract class for hyperelastic models.
Definition: nonlininteg.hpp:49
Vector data type.
Definition: vector.hpp:29
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
virtual double GetElementEnergy(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun)
Compute the local energy.
Definition: nonlininteg.cpp:25
virtual double EvalW(const DenseMatrix &J) const =0
Evaluate the strain energy density function, W=W(J).
ElementTransformation * T
Definition: nonlininteg.hpp:52