6#include <dune/localfefunctions/derivativetransformators.hh>
7#include <dune/localfefunctions/meta.hh>
15template <
typename PreFE,
typename FE>
28 template <
typename PreFE,
typename FE>
44template <
typename PreFE,
typename FE>
60 : volumeLoad_{pre.volumeLoad} {}
63 template <
template <
typename,
int,
int>
class RT>
64 requires Dune::AlwaysFalse<RT<double, 1, 1>>::value
66 Dune::PriorityTag<0>)
const {}
68 template <
typename ST>
71 const std::optional<std::reference_wrapper<
const Eigen::VectorX<ST>>>& dx = std::nullopt)
const -> ST {
75 const auto uFunction = underlying().displacementFunction(par, dx);
76 const auto geo = underlying().geometry();
77 const auto& lambda = par.parameter();
79 for (
const auto& [gpIndex, gp] : uFunction.viewOverIntegrationPoints()) {
80 const auto uVal = uFunction.evaluate(gpIndex);
81 Eigen::Vector<double, worldDim> fext = volumeLoad_(geo.global(gp.position()), lambda);
82 energy -= uVal.dot(fext) * geo.integrationElement(gp.position()) * gp.weight();
87 template <
typename ST>
90 const std::optional<std::reference_wrapper<
const Eigen::VectorX<ST>>>& dx = std::nullopt)
const {
93 using namespace Dune::DerivativeDirections;
95 const auto uFunction = underlying().displacementFunction(par, dx);
96 const auto geo = underlying().geometry();
99 for (
const auto& [gpIndex, gp] : uFunction.viewOverIntegrationPoints()) {
100 const Eigen::Vector<double, worldDim> fext = volumeLoad_(geo.global(gp.position()), lambda);
101 const double intElement = geo.integrationElement(gp.position()) * gp.weight();
102 for (
size_t i = 0; i < underlying().numberOfNodes(); ++i) {
103 const auto udCi = uFunction.evaluateDerivative(gpIndex, wrt(coeff(i)));
104 force.template segment<worldDim>(
worldDim * i) -= udCi * fext * intElement;
109 template <
typename ST>
112 const std::optional<std::reference_wrapper<
const Eigen::VectorX<ST>>>& dx = std::nullopt)
const {}
117 const auto& underlying()
const {
return static_cast<const FE&
>(*this); }
118 auto& underlying() {
return static_cast<FE&
>(*this); }
127template <
int worldDim>
129 const double&)>& f) {
Contains stl-like type traits.
Definition of the LinearElastic class for finite element mechanics computations.
Definition: assemblermanipulatorbuildingblocks.hh:22
auto volumeLoad(const std::function< Eigen::Vector< double, worldDim >(const Dune::FieldVector< double, worldDim > &, const double &)> &f)
A helper function to create a volume load skill.
Definition: volume.hh:128
MatrixAffordance
A strongly typed enum class representing the matrix affordance.
Definition: ferequirements.hh:63
VolumeLoadPre(F f) -> VolumeLoadPre< traits::FunctionTraits< F >::return_type::RowsAtCompileTime >
VectorAffordance
A strongly typed enum class representing the vector affordance.
Definition: ferequirements.hh:48
ScalarAffordance
A strongly typed enum class representing the scalar affordance.
Definition: ferequirements.hh:37
Definition: utils/dirichletvalues.hh:30
FE class is a base class for all finite elements.
Definition: febase.hh:79
FETraits< BH, useEigenRef, useFlat > Traits
Definition: febase.hh:38
Class representing the requirements for finite element calculations.
Definition: ferequirements.hh:252
PMHelper::ConstReturnType parameter() const
Get the parameter value.
Definition: ferequirements.hh:325
Traits for handling finite elements.
Definition: fetraits.hh:25
static constexpr int worlddim
Dimension of the world space.
Definition: fetraits.hh:60
VolumeLoad class represents distributed volume load that can be applied.
Definition: volume.hh:46
VolumeLoad(const Pre &pre={})
Constructor for the Loads class.
Definition: volume.hh:59
static constexpr int worldDim
Definition: volume.hh:51
auto calculateScalarImpl(const Requirement &par, ScalarAffordance affordance, const std::optional< std::reference_wrapper< const Eigen::VectorX< ST > > > &dx=std::nullopt) const -> ST
Definition: volume.hh:69
::value auto calculateAtImpl(const Requirement &req, const Dune::FieldVector< double, Traits::mydim > &local, Dune::PriorityTag< 0 >) const
Definition: volume.hh:65
void calculateVectorImpl(const Requirement &par, VectorAffordance affordance, typename Traits::template VectorType< ST > force, const std::optional< std::reference_wrapper< const Eigen::VectorX< ST > > > &dx=std::nullopt) const
Definition: volume.hh:88
void calculateMatrixImpl(const Requirement &par, MatrixAffordance, typename Traits::template MatrixType<> K, const std::optional< std::reference_wrapper< const Eigen::VectorX< ST > > > &dx=std::nullopt) const
Definition: volume.hh:110
A PreFE struct for volume load skill.
Definition: volume.hh:24
std::function< Eigen::Vector< double, worldDim >(const Dune::FieldVector< double, worldDim > &, const double &)> volumeLoad
Definition: volume.hh:26
static constexpr int worldDim
Definition: volume.hh:25
Definition: utils/dirichletvalues.hh:32