1#ifndef PBAT_SIM_VBD_MULTIGRID_KERNELS_H
2#define PBAT_SIM_VBD_MULTIGRID_KERNELS_H
5#include "pbat/HostDevice.h"
9#include "pbat/sim/vbd/Mesh.h"
17namespace mini = math::linalg::mini;
20 physics::CHyperElasticEnergy TPsi,
21 mini::CMatrix TMatrixIL,
22 mini::CMatrix TMatrixX,
23 mini::CMatrix TMatrixGN,
24 mini::CMatrix TMatrixN,
25 mini::CMatrix TMatrixGU,
26 mini::CMatrix TMatrixHU,
27 class ScalarType =
typename TMatrixX::ScalarType>
28PBAT_HOST_DEVICE
void AccumulateElasticEnergy(
30 TMatrixIL
const& ilocal,
41 SMatrix<ScalarType, 3, 3> F = xe * GNe;
42 SVector<Scalar, 9> gF = Zeros<Scalar, 9>();
43 SMatrix<Scalar, 9, 9> HF = Zeros<Scalar, 9, 9>();
44 Psi.gradAndHessian(F, mug, lambdag, gF, HF);
46 SMatrix<Scalar, 3, 3> dHu = Zeros<Scalar, 3, 3>();
47 SVector<Scalar, 3> dgu = Zeros<Scalar, 3>();
48 for (
auto i = 0; i < 4; ++i)
50 for (
auto j = 0; j < 4; ++j)
52 if (ilocal(i) >= 0 and ilocal(j) >= 0)
55 dHu += N(ilocal(i), i) * N(ilocal(j), j) * Hij;
59 for (
auto i = 0; i < 4; ++i)
64 dgu += N(ilocal(i), i) * gi;
This file includes all the mini linear algebra headers.
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 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
PBAT's Vertex Block Descent (VBD) anka2024vbd API.
Definition AndersonIntegrator.cpp:10
PBAT simulation algorithms.
The main namespace of the library.
Definition Aliases.h:15
TElement ElementType
Definition Mesh.h:46