11#ifndef PBAT_FEM_DEFORMATIONGRADIENT_H
12#define PBAT_FEM_DEFORMATIONGRADIENT_H
16#include "pbat/math/linalg/mini/BinaryOperations.h"
17#include "pbat/math/linalg/mini/Concepts.h"
18#include "pbat/math/linalg/mini/Matrix.h"
37template <CElement TElement,
class TDerivedx,
class TDerivedX>
39 Eigen::MatrixBase<TDerivedx>
const& x,
67 class ScalarType =
typename TMatrixGF::ScalarType>
69 -> math::linalg::mini::SVector<ScalarType, Dims>
72 SVector<ScalarType, Dims> dPsidx = Zeros<ScalarType, Dims, 1>{};
73 for (
auto k = 0; k < Dims; ++k)
75 dPsidx += GP(i, k) * GF.template Slice<Dims, 1>(k * Dims, 0);
125 class ScalarType =
typename TMatrixGF::ScalarType>
127 -> math::linalg::mini::SVector<ScalarType, TElement::kNodes * Dims>
129 auto constexpr kRows = TElement::kNodes * Dims;
131 SVector<ScalarType, kRows> dPsidx = Zeros<ScalarType, kRows, 1>{};
132 for (
auto k = 0; k < Dims; ++k)
134 for (
auto i = 0; i < TElement::kNodes; ++i)
136 dPsidx.template Slice<Dims, 1>(i * Dims, 0) +=
137 GP(i, k) * GF.template Slice<Dims, 1>(k * Dims, 0);
168 class ScalarType =
typename TMatrixHF::ScalarType>
173 SMatrix<ScalarType, Dims, Dims> d2Psidx2 = Zeros<ScalarType, Dims, Dims>{};
174 for (
auto kj = 0; kj < Dims; ++kj)
176 for (
auto ki = 0; ki < Dims; ++ki)
178 d2Psidx2 += GP(i, ki) * GP(j, kj) * HF.template Slice<Dims, Dims>(ki * Dims, kj * Dims);
230 class ScalarType =
typename TMatrixHF::ScalarType>
234 auto constexpr kRows = TElement::kNodes * Dims;
235 auto constexpr kCols = TElement::kNodes * Dims;
237 SMatrix<ScalarType, kRows, kCols> d2Psidx2 = Zeros<ScalarType, kRows, kCols>{};
238 for (
auto kj = 0; kj < Dims; ++kj)
240 for (
auto ki = 0; ki < Dims; ++ki)
242 for (
auto j = 0; j < TElement::kNodes; ++j)
244 for (
auto i = 0; i < TElement::kNodes; ++i)
246 d2Psidx2.template Slice<Dims, Dims>(i * Dims, j * Dims) +=
247 GP(i, ki) * GP(j, kj) * HF.template Slice<Dims, Dims>(ki * Dims, kj * Dims);
Finite Element Method (FEM)
Definition Concepts.h:19
auto GradientSegmentWrtDofs(TMatrixGF const &GF, TMatrixGP const &GP, auto i) -> math::linalg::mini::SVector< ScalarType, Dims >
Computes , i.e. the gradient of a scalar function w.r.t. the node's degrees of freedom.
Definition DeformationGradient.h:68
auto HessianWrtDofs(TMatrixHF const &HF, TMatrixGP const &GP) -> math::linalg::mini::SMatrix< ScalarType, TElement::kNodes *Dims, TElement::kNodes *Dims >
Computes hessian w.r.t. FEM degrees of freedom of scalar function , where is the jacobian of ,...
Definition DeformationGradient.h:231
auto DeformationGradient(Eigen::MatrixBase< TDerivedx > const &x, Eigen::MatrixBase< TDerivedX > const &GP) -> Matrix< TDerivedx::RowsAtCompileTime, TElement::kDims >
Computes the deformation gradient of the deformation map .
Definition DeformationGradient.h:38
auto GradientWrtDofs(TMatrixGF const &GF, TMatrixGP const &GP) -> math::linalg::mini::SVector< ScalarType, TElement::kNodes *Dims >
Computes gradient w.r.t. FEM degrees of freedom of scalar function , where is the jacobian of ,...
Definition DeformationGradient.h:126
auto HessianBlockWrtDofs(TMatrixHF const &HF, TMatrixGP const &GP, auto i, auto j) -> math::linalg::mini::SMatrix< ScalarType, Dims, Dims >
Computes , i.e. the hessian of a scalar function w.r.t. the and node's degrees of freedom.
Definition DeformationGradient.h:169
Mini linear algebra related functionality.
Definition Assign.h:12
Eigen::Matrix< Scalar, Rows, Cols > Matrix
Fixed-size matrix type.
Definition Aliases.h:31