21 mfem_error(
"NonlinearFormIntegrator::AssembleElementGrad"
22 " is not overloaded!");
28 mfem_error(
"NonlinearFormIntegrator::GetElementEnergy"
29 " is not overloaded!");
38 return 0.5*(
Z*
Z)/J.
Det();
51 for (
int i = 0; i <
dim; i++)
84 for (
int i = 0; i < dof; i++)
85 for (
int j = 0; j <= i; j++)
88 for (
int d = 0; d <
dim; d++)
93 for (
int k = 0; k <
dim; k++)
94 for (
int l = 0; l <= k; l++)
97 A(i+k*dof,j+l*dof) += b;
100 A(j+k*dof,i+l*dof) += b;
104 A(i+l*dof,j+k*dof) += b;
107 A(j+l*dof,i+k*dof) += b;
114 for (
int i = 0; i < dof; i++)
115 for (
int j = 0; j < i; j++)
117 for (
int k = 0; k <
dim; k++)
118 for (
int l = 0; l < k; l++)
121 weight*(
C(i,l)*
G(j,k) -
C(i,k)*
G(j,l) +
122 C(j,k)*
G(i,l) -
C(j,l)*
G(i,k) +
123 t*(
G(i,k)*
G(j,l) -
G(i,l)*
G(j,k)));
125 A(i+k*dof,j+l*dof) += a;
126 A(j+l*dof,i+k*dof) += a;
128 A(i+l*dof,j+k*dof) -= a;
129 A(j+k*dof,i+l*dof) -= a;
156 double bI1 = pow(dJ, -2.0/dim)*(J*J);
158 return 0.5*(
mu*(bI1 -
dim) +
K*(sJ - 1.0)*(sJ - 1.0));
174 double a =
mu*pow(dJ, -2.0/dim);
175 double b =
K*(dJ/
g - 1.0)/
g - a*(J*J)/(dim*dJ);
198 double a =
mu*pow(dJ, -2.0/
dim);
199 double bc = a*(J*J)/
dim;
200 double b = bc -
K*sJ*(sJ - 1.0);
201 double c = 2.0*bc/
dim +
K*sJ*(2.0*sJ - 1.0);
214 for (
int i = 0; i < dof; i++)
215 for (
int k = 0; k <= i; k++)
218 for (
int d = 0; d <
dim; d++)
220 s += DS(i,d)*DS(k,d);
224 for (
int d = 0; d <
dim; d++)
226 A(i+d*dof,k+d*dof) += s;
230 for (
int d = 0; d <
dim; d++)
232 A(k+d*dof,i+d*dof) += s;
239 for (
int i = 0; i < dof; i++)
240 for (
int j = 0; j <
dim; j++)
241 for (
int k = 0; k < dof; k++)
242 for (
int l = 0; l <
dim; l++)
244 A(i+j*dof,k+l*dof) +=
245 a*(
C(i,j)*
G(k,l) +
G(i,j)*
C(k,l)) +
246 b*
G(i,l)*
G(k,j) + c*
G(i,j)*
G(k,l);
int GetNPoints() const
Returns the number of the points in the integration rule.
Abstract class for Finite Elements.
virtual double GetElementEnergy(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun)
Compute the local energy.
void MultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
Multiply a matrix A with the transpose of a matrix B: A*Bt.
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).
int GetDim() const
Returns the reference space dimension for the finite element.
Class for an integration rule - an Array of IntegrationPoint.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
void SetSize(int s)
Resize the vector to size s.
virtual void AssembleH(const DenseMatrix &J, const DenseMatrix &DS, const double weight, DenseMatrix &A) const
double Det() const
Calculates the determinant of the matrix (for 2x2 or 3x3 matrices)
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
int GetOrder() const
Returns the order of the finite element.
Data type dense matrix using column-major storage.
virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const
Evaluate the 1st Piola-Kirchhoff stress tensor, P=P(J).
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
void CalcAdjugateTranspose(const DenseMatrix &a, DenseMatrix &adjat)
Calculate the transposed adjugate of a matrix (for NxN matrices, N=1,2,3)
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void Add(const double c, const DenseMatrix &A)
Adds the matrix A multiplied by the number c to the matrix.
void SetTransformation(ElementTransformation &_T)
An element transformation that can be used to evaluate coefficients.
virtual ~HyperelasticNLFIntegrator()
void CalcInverse(const DenseMatrix &a, DenseMatrix &inva)
int GetGeomType() const
Returns the Geometry::Type of the reference element.
virtual void AssembleElementVector(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, Vector &elvect)
Perform the local action of the NonlinearFormIntegrator.
double Trace() const
Trace of a square matrix.
void AddMultABt(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &ABt)
ABt += A * B^t.
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void mfem_error(const char *msg)
void MultAAt(const DenseMatrix &a, DenseMatrix &aat)
Calculate the matrix A.At.
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
Class for integration point with weight.
virtual double EvalW(const DenseMatrix &J) const
Evaluate the strain energy density function, W=W(J).
virtual void EvalP(const DenseMatrix &J, DenseMatrix &P) const =0
Evaluate the 1st Piola-Kirchhoff stress tensor, P=P(J).
virtual double Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
void MultAtB(const DenseMatrix &A, const DenseMatrix &B, DenseMatrix &AtB)
Multiply the transpose of a matrix A with a matrix B: At*B.
virtual void AssembleElementGrad(const FiniteElement &el, ElementTransformation &Tr, const Vector &elfun, DenseMatrix &elmat)
Assemble the local gradient matrix.
void UseExternalData(double *d, int h, int w)
Change the data array and the size of the DenseMatrix.
void SetSize(int s)
Change the size of the DenseMatrix to s x s.
virtual void CalcDShape(const IntegrationPoint &ip, DenseMatrix &dshape) const =0
Evaluate the gradients of all shape functions of a scalar finite element in reference space at the gi...
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
virtual double EvalW(const DenseMatrix &J) const =0
Evaluate the strain energy density function, W=W(J).
ElementTransformation * T