NuTo
Numerics Tool
MomentumBalance.h
Go to the documentation of this file.
1 #pragma once
2 
10 
11 namespace NuTo
12 {
13 namespace Integrands
14 {
15 
16 template <int TDim>
18 {
19 public:
21  : mDofType(dofType)
22  , mLaw(law)
23  {
24  }
25 
26  DofVector<double> Gradient(const CellIpData& cellIpData, double deltaT)
27  {
29 
30  Eigen::MatrixXd B = cellIpData.B(mDofType, Nabla::Strain());
31  gradient[mDofType] =
32  B.transpose() * mLaw.Stress(cellIpData.Apply(mDofType, Nabla::Strain()), deltaT, cellIpData.Ids());
33 
34  return gradient;
35  }
36 
37  DofMatrix<double> Hessian0(const CellIpData& cellIpData, double deltaT)
38  {
39  DofMatrix<double> hessian0;
40 
41  Eigen::MatrixXd B = cellIpData.B(mDofType, Nabla::Strain());
42  hessian0(mDofType, mDofType) =
43  B.transpose() * mLaw.Tangent(cellIpData.Apply(mDofType, Nabla::Strain()), deltaT, cellIpData.Ids()) * B;
44 
45  return hessian0;
46  }
47 
48 protected:
50 
51 private:
53 };
54 } /* Integrand */
55 } /* NuTo */
const Eigen::MatrixXd & B(DofType dofType, const Nabla::Interface &b) const
Returns a memoized copy of the B matrix for a given dof type.
Definition: CellIpData.h:89
Definition: MomentumBalance.h:17
DofVector< double > Gradient(const CellIpData &cellIpData, double deltaT)
Definition: MomentumBalance.h:26
Similar to NuTo::CellData.
Definition: CellIpData.h:14
MomentumBalance(DofType dofType, const Laws::MechanicsInterface< TDim > &law)
Definition: MomentumBalance.h:20
CellIds Ids() const
Access to the cellId and ipId, compressed in CellIds.
Definition: CellIpData.h:39
Definition: DofType.h:8
DofType mDofType
Definition: MomentumBalance.h:49
Eigen::VectorXd Apply(DofType dofType, const Nabla::Interface &b, int instance=0) const
Calculates the gradient (derivative of the value with respect to x) for a given dof type at the integ...
Definition: CellIpData.h:70
dof container that is also capable of performing calculations.
Definition: DofMatrixContainer.h:13
Definition: Exception.h:6
Definition: DifferentialOperators.h:24
DofMatrix< double > Hessian0(const CellIpData &cellIpData, double deltaT)
Definition: MomentumBalance.h:37
gradient
Definition: NeuralNetwork.py:98
Definition: MechanicsInterface.h:13