From 9a48bac0acf176a402bd30911d7781164f491165 Mon Sep 17 00:00:00 2001 From: Tarun Mitruka Date: Mon, 8 Jan 2024 21:48:34 +0100 Subject: [PATCH] refactor and fix --- docs/website/01_framework/finiteElements.md | 2 +- ikarus/finiteelements/fehelper.hh | 47 ++++++++----- .../mechanics/enhancedassumedstrains.hh | 14 ++-- .../mechanics/kirchhoffloveshell.hh | 26 +++----- .../finiteelements/mechanics/linearelastic.hh | 66 ++++++++----------- .../mechanics/nonlinearelastic.hh | 64 ++++++++---------- .../python/finiteelements/registerelement.hh | 4 +- 7 files changed, 107 insertions(+), 116 deletions(-) diff --git a/docs/website/01_framework/finiteElements.md b/docs/website/01_framework/finiteElements.md index fa5ddb5eb..059c4af30 100644 --- a/docs/website/01_framework/finiteElements.md +++ b/docs/website/01_framework/finiteElements.md @@ -110,7 +110,7 @@ calculateScalarImpl(const FERequirementType& par, const Eigen::VectorX& dx, Eigen::VectorX& force) ``` -Inside `getStrainFunction(const FERequirementType& par, const Eigen::VectorX& dx)` is used to get the desired strain measure. +Inside `strainFunction(const FERequirementType& par, const Eigen::VectorX& dx)` is used to get the desired strain measure. It can be used to toggle between the geometrically linear and non-linear cases. `LinearStrains` are used for the geometrically linear case, while `GreenLagrangianStrains` are used for the non-linear case. These strain measures are defined as expressions in `dune-localfefunctions`. Refer to [Expressions](localFunctions.md#expressions) for more details. diff --git a/ikarus/finiteelements/fehelper.hh b/ikarus/finiteelements/fehelper.hh index 5bba120f3..dc9d72e92 100644 --- a/ikarus/finiteelements/fehelper.hh +++ b/ikarus/finiteelements/fehelper.hh @@ -3,22 +3,29 @@ #pragma once -#include -#include #include #include #include #include -#include namespace Ikarus::FEHelper { /** - * \brief Views a dune fieldvector as an Eigen::Vector as Map, no copies take place! + * @brief Gets the local displacement Dune block vector + * + * @tparam LocalView Type of the local view. + * @tparam FERequirementType Type of the FE requirements. + * @tparam ScalarType Scalar type for the local displacement vector. + * + * @param localView Local view of the element. + * @param par The FERequirementType object. + * @param dx Optional displacement vector. + * + * @return A Dune block vector representing the displacement quantities at each node. * */ template - auto getLocalDisplacementBlockVector(const LocalView& localView, const FERequirementType& par, - const std::optional>& dx = std::nullopt) { + auto localDisplacementBlockVector(const LocalView& localView, const FERequirementType& par, + const std::optional>& dx = std::nullopt) { using Traits = TraitsFromLocalView; constexpr int worldDim = Traits::worlddim; const auto& d = par.getGlobalSolution(Ikarus::FESolutions::displacement); @@ -36,18 +43,22 @@ namespace Ikarus::FEHelper { return disp; } + /** + * @brief Gets the local displacement flat Eigen vector + * + * @tparam LocalView Type of the local view. + * @tparam FERequirementType Type of the FE requirements. + * @tparam ScalarType Scalar type for the local displacement vector. + * + * @param localView Local view of the element. + * @param par The FERequirementType object. + * @param dx Optional displacement vector. + * + * @return The local displacement vector viewed as flat Eigen vector. + * */ template - auto getLocalDisplacementVector(const LocalView& localView, const FERequirementType& par, - const std::optional>& dx = std::nullopt) { - return Dune::viewAsFlatEigenVector(getLocalDisplacementBlockVector(localView, par, dx)); - } - - template - void updateDisplacementCoEffs(const DispFunctionType& uFunction, const LocalView& localView, - const FERequirementType& par, - const std::optional>& dx = std::nullopt) { - auto disp = getLocalDisplacementBlockVector(localView, par, dx); - auto coEffs = uFunction.coefficientsRef(); - coEffs = disp; + inline auto localDisplacementFlatVector(const LocalView& localView, const FERequirementType& par, + const std::optional>& dx = std::nullopt) { + return Dune::viewAsFlatEigenVector(localDisplacementBlockVector(localView, par, dx)); } } // namespace Ikarus::FEHelper diff --git a/ikarus/finiteelements/mechanics/enhancedassumedstrains.hh b/ikarus/finiteelements/mechanics/enhancedassumedstrains.hh index b882f87e7..21e9beae5 100644 --- a/ikarus/finiteelements/mechanics/enhancedassumedstrains.hh +++ b/ikarus/finiteelements/mechanics/enhancedassumedstrains.hh @@ -469,9 +469,9 @@ namespace Ikarus { if (isDisplacementBased()) return; const auto& par = req.getFERequirements(); - const auto C = DisplacementBasedElement::getMaterialTangentFunction(req.getFERequirements()); + const auto C = DisplacementBasedElement::materialTangentFunction(req.getFERequirements()); const auto& numberOfNodes = DisplacementBasedElement::numberOfNodes; - const auto disp = Ikarus::FEHelper::getLocalDisplacementVector(this->localView(), par); + const auto disp = Ikarus::FEHelper::localDisplacementFlatVector(this->localView(), par); std::visit( [&](const EAST& easFunction) { @@ -558,13 +558,13 @@ namespace Ikarus { DisplacementBasedElement::calculateVectorImpl(par, force, dx); if (isDisplacementBased()) return; using namespace Dune; - auto strainFunction = DisplacementBasedElement::getStrainFunction(par, dx); + auto strainFunction = DisplacementBasedElement::strainFunction(par, dx); const auto& numberOfNodes = DisplacementBasedElement::numberOfNodes; - const auto disp = Ikarus::FEHelper::getLocalDisplacementVector(this->localView(), par, dx); + const auto disp = Ikarus::FEHelper::localDisplacementFlatVector(this->localView(), par, dx); using namespace Dune::DerivativeDirections; - auto C = DisplacementBasedElement::getMaterialTangentFunction(par); + auto C = DisplacementBasedElement::materialTangentFunction(par); const auto geo = localView().element().geometry(); // Internal forces from enhanced strains @@ -605,8 +605,8 @@ namespace Ikarus { using namespace Dune; using namespace Dune::DerivativeDirections; - auto strainFunction = DisplacementBasedElement::getStrainFunction(par); - const auto C = DisplacementBasedElement::getMaterialTangentFunction(par); + auto strainFunction = DisplacementBasedElement::strainFunction(par); + const auto C = DisplacementBasedElement::materialTangentFunction(par); const auto geo = localView().element().geometry(); const auto numberOfNodes = DisplacementBasedElement::numberOfNodes; DMat.setZero(); diff --git a/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh b/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh index b32299d2e..d2788db81 100644 --- a/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh +++ b/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh @@ -103,16 +103,14 @@ namespace Ikarus { neumannBoundary{p_neumannBoundary}, emod_{emod}, nu_{nu}, - thickness_{thickness}, - uFunction(localBasis, dispAtNodes, geo_) { + thickness_{thickness} { this->localView().bind(element); auto& first_child = this->localView().tree().child(0); const auto& fe = first_child.finiteElement(); geo_ = std::make_shared(this->localView().element().geometry()); numberOfNodes = fe.size(); - dispAtNodes.resize(numberOfNodes); - order = 2 * (fe.localBasis().order()); - localBasis = Dune::CachedLocalBasis(fe.localBasis()); + order = 2 * (fe.localBasis().order()); + localBasis = Dune::CachedLocalBasis(fe.localBasis()); if constexpr (requires { this->localView().element().impl().getQuadratureRule(order); }) if (this->localView().element().impl().isTrimmed()) localBasis.bind(this->localView().element().impl().getQuadratureRule(order), Dune::bindDerivatives(0, 1, 2)); @@ -143,10 +141,11 @@ namespace Ikarus { * @return A pair containing the displacement function and nodal displacements. */ template - inline void getDisplacementFunction(const FERequirementType& par, - const std::optional>& dx - = std::nullopt) const { - Ikarus::FEHelper::updateDisplacementCoEffs(uFunction, this->localView(), par, dx); + auto displacementFunction(const FERequirementType& par, + const std::optional>& dx = std::nullopt) const { + auto disp = Ikarus::FEHelper::localDisplacementBlockVector(this->localView(), par, dx); + Dune::StandardLocalFunction uFunction(localBasis, disp, geo_); + return uFunction; } /** @@ -180,16 +179,12 @@ namespace Ikarus { std::function(const Eigen::Vector&, const double&)> neumannBoundaryLoad; const BoundaryPatch* neumannBoundary; - mutable Dune::BlockVector> dispAtNodes; double emod_; double nu_; double thickness_; size_t numberOfNodes{0}; int order{}; std::shared_ptr geo_; - Dune::StandardLocalFunction, - Dune::BlockVector>, Geometry> - uFunction; protected: /** @@ -208,11 +203,10 @@ namespace Ikarus { = std::nullopt) const -> ScalarType { using namespace Dune::DerivativeDirections; using namespace Dune; - getDisplacementFunction(par, dx); - const auto uNodes = Ikarus::FEHelper::getLocalDisplacementBlockVector(this->localView(), par, dx); + const auto uFunction = displacementFunction(par, dx); const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); ScalarType energy = 0.0; - const auto uasMatrix = Dune::viewAsEigenMatrixAsDynFixed(uNodes); + const auto uasMatrix = Dune::viewAsEigenMatrixAsDynFixed(uFunction.coefficientsRef()); for (const auto& [gpIndex, gp] : uFunction.viewOverIntegrationPoints()) { const auto [X, Jd, Hd] = geo_->impl().zeroFirstAndSecondDerivativeOfPosition(gp.position()); diff --git a/ikarus/finiteelements/mechanics/linearelastic.hh b/ikarus/finiteelements/mechanics/linearelastic.hh index 943229ead..ca0beb86e 100644 --- a/ikarus/finiteelements/mechanics/linearelastic.hh +++ b/ikarus/finiteelements/mechanics/linearelastic.hh @@ -74,19 +74,14 @@ namespace Ikarus { LinearElastic(const Basis& globalBasis, const typename LocalView::Element& element, double emod, double nu, VolumeLoad p_volumeLoad = {}, const BoundaryPatch* p_neumannBoundary = nullptr, NeumannBoundaryLoad p_neumannBoundaryLoad = {}) - : BaseDisp(globalBasis.flat(), element), - neumannBoundary{p_neumannBoundary}, - emod_{emod}, - nu_{nu}, - uFunction(localBasis, dispAtNodes, geo_) { + : BaseDisp(globalBasis.flat(), element), neumannBoundary{p_neumannBoundary}, emod_{emod}, nu_{nu} { this->localView().bind(element); auto& first_child = this->localView().tree().child(0); const auto& fe = first_child.finiteElement(); geo_ = std::make_shared(this->localView().element().geometry()); numberOfNodes = fe.size(); - dispAtNodes.resize(numberOfNodes); - order = 2 * (this->localView().tree().child(0).finiteElement().localBasis().order()); - localBasis = Dune::CachedLocalBasis(this->localView().tree().child(0).finiteElement().localBasis()); + order = 2 * (this->localView().tree().child(0).finiteElement().localBasis().order()); + localBasis = Dune::CachedLocalBasis(this->localView().tree().child(0).finiteElement().localBasis()); if constexpr (requires { this->localView().element().impl().getQuadratureRule(order); }) if (this->localView().element().impl().isTrimmed()) localBasis.bind(this->localView().element().impl().getQuadratureRule(order), Dune::bindDerivatives(0, 1)); @@ -102,7 +97,7 @@ namespace Ikarus { neumannBoundaryLoad = p_neumannBoundaryLoad; assert(((not p_neumannBoundary and not neumannBoundaryLoad) or (p_neumannBoundary and neumannBoundaryLoad)) - & &"If you pass a Neumann boundary you should also pass the function for the Neumann load!"); + && "If you pass a Neumann boundary you should also pass the function for the Neumann load!"); } /** * @brief Gets the displacement function for the given FERequirementType and optional displacement vector. @@ -113,10 +108,11 @@ namespace Ikarus { * @return The displacement function. */ template - inline void getDisplacementFunction(const FERequirementType& par, - const std::optional>& dx - = std::nullopt) const { - Ikarus::FEHelper::updateDisplacementCoEffs(uFunction, this->localView(), par, dx); + auto displacementFunction(const FERequirementType& par, + const std::optional>& dx = std::nullopt) const { + auto disp = Ikarus::FEHelper::localDisplacementBlockVector(this->localView(), par, dx); + Dune::StandardLocalFunction uFunction(localBasis, disp, geo_); + return uFunction; } /** * @brief Gets the strain function for the given FERequirementType and optional displacement vector. @@ -127,10 +123,9 @@ namespace Ikarus { * @return The strain function. */ template - auto getStrainFunction(const FERequirementType& par, - const std::optional>& dx = std::nullopt) const { - getDisplacementFunction(par, dx); - return Dune::linearStrains(uFunction); + auto strainFunction(const FERequirementType& par, + const std::optional>& dx = std::nullopt) const { + return Dune::linearStrains(displacementFunction(par, dx)); } /** @@ -138,7 +133,7 @@ namespace Ikarus { * * @return The material tangent matrix. */ - auto getMaterialTangent() const { + auto materialTangent() const { if constexpr (myDim == 2) return planeStressLinearElasticMaterialTangent(emod_, nu_); else if constexpr (myDim == 3) @@ -151,8 +146,8 @@ namespace Ikarus { * @param par The FERequirementType object. * @return The material tangent function. */ - auto getMaterialTangentFunction([[maybe_unused]] const FERequirementType& par) const { - return [&]([[maybe_unused]] auto gp) { return getMaterialTangent(); }; + auto materialTangentFunction([[maybe_unused]] const FERequirementType& par) const { + return [&]([[maybe_unused]] auto gp) { return materialTangent(); }; } /** @@ -180,11 +175,11 @@ namespace Ikarus { * @param K Matrix to store the calculated stiffness. */ void calculateMatrix(const FERequirementType& par, typename Traits::template MatrixType<> K) const { - const auto eps = getStrainFunction(par); + const auto eps = strainFunction(par); using namespace Dune::DerivativeDirections; using namespace Dune; - const auto C = getMaterialTangent(); + const auto C = materialTangent(); for (const auto& [gpIndex, gp] : eps.viewOverIntegrationPoints()) { const double intElement = geo_->integrationElement(gp.position()) * gp.weight(); for (size_t i = 0; i < numberOfNodes; ++i) { @@ -210,8 +205,8 @@ namespace Ikarus { using namespace Dune::DerivativeDirections; using namespace Dune; - const auto eps = getStrainFunction(req.getFERequirements()); - const auto C = getMaterialTangent(); + const auto eps = strainFunction(req.getFERequirements()); + const auto C = materialTangent(); auto epsVoigt = eps.evaluate(local, on(gridElement)); auto linearStress = (C * epsVoigt).eval(); @@ -227,27 +222,23 @@ namespace Ikarus { std::function(const Eigen::Vector&, const double&)> neumannBoundaryLoad; const BoundaryPatch* neumannBoundary; - mutable Dune::BlockVector> dispAtNodes; double emod_; double nu_; size_t numberOfNodes{0}; int order{}; std::shared_ptr geo_; - Dune::StandardLocalFunction, - Dune::BlockVector>, Geometry> - uFunction; protected: template auto calculateScalarImpl(const FERequirementType& par, const std::optional>& dx = std::nullopt) const -> ScalarType { - getDisplacementFunction(par, dx); - const auto eps = getStrainFunction(par, dx); - const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); + const auto uFunction = displacementFunction(par, dx); + const auto eps = strainFunction(par, dx); + const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); using namespace Dune::DerivativeDirections; using namespace Dune; - const auto C = getMaterialTangent(); + const auto C = materialTangent(); ScalarType energy = 0.0; for (const auto& [gpIndex, gp] : eps.viewOverIntegrationPoints()) { @@ -295,12 +286,13 @@ namespace Ikarus { template void calculateVectorImpl(const FERequirementType& par, typename Traits::template VectorType force, const std::optional>& dx = std::nullopt) const { - const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); - const auto eps = getStrainFunction(par, dx); + const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); + const auto uFunction = displacementFunction(par, dx); + const auto eps = strainFunction(par, dx); using namespace Dune::DerivativeDirections; using namespace Dune; - const auto C = getMaterialTangent(); + const auto C = materialTangent(); // Internal forces for (const auto& [gpIndex, gp] : eps.viewOverIntegrationPoints()) { @@ -314,7 +306,7 @@ namespace Ikarus { // External forces volume forces over the domain if (volumeLoad) { - getDisplacementFunction(par, dx); + displacementFunction(par, dx); for (const auto& [gpIndex, gp] : uFunction.viewOverIntegrationPoints()) { Eigen::Vector fext = volumeLoad(toEigen(geo_->global(gp.position())), lambda); for (size_t i = 0; i < numberOfNodes; ++i) { @@ -327,7 +319,7 @@ namespace Ikarus { // External forces, boundary forces, i.e., at the Neumann boundary if (not neumannBoundary) return; - getDisplacementFunction(par, dx); + displacementFunction(par, dx); auto element = this->localView().element(); for (auto&& intersection : intersections(neumannBoundary->gridView(), element)) { if (not neumannBoundary->contains(intersection)) continue; diff --git a/ikarus/finiteelements/mechanics/nonlinearelastic.hh b/ikarus/finiteelements/mechanics/nonlinearelastic.hh index be97c07c9..a4a72762e 100644 --- a/ikarus/finiteelements/mechanics/nonlinearelastic.hh +++ b/ikarus/finiteelements/mechanics/nonlinearelastic.hh @@ -75,18 +75,14 @@ namespace Ikarus { NonLinearElastic(const Basis& globalBasis, const typename LocalView::Element& element, const Material& p_mat, VolumeLoad p_volumeLoad = {}, const BoundaryPatch* p_neumannBoundary = nullptr, NeumannBoundaryLoad p_neumannBoundaryLoad = {}) - : BasePowerFE(globalBasis.flat(), element), - neumannBoundary{p_neumannBoundary}, - mat{p_mat}, - uFunction(localBasis, dispAtNodes, geo_) { + : BasePowerFE(globalBasis.flat(), element), neumannBoundary{p_neumannBoundary}, mat{p_mat} { this->localView().bind(element); auto& first_child = this->localView().tree().child(0); const auto& fe = first_child.finiteElement(); geo_ = std::make_shared(this->localView().element().geometry()); numberOfNodes = fe.size(); - dispAtNodes.resize(numberOfNodes); - order = 2 * (this->localView().tree().child(0).finiteElement().localBasis().order()); - localBasis = Dune::CachedLocalBasis(this->localView().tree().child(0).finiteElement().localBasis()); + order = 2 * (this->localView().tree().child(0).finiteElement().localBasis().order()); + localBasis = Dune::CachedLocalBasis(this->localView().tree().child(0).finiteElement().localBasis()); if constexpr (requires { this->localView().element().impl().getQuadratureRule(order); }) if (this->localView().element().impl().isTrimmed()) localBasis.bind(this->localView().element().impl().getQuadratureRule(order), Dune::bindDerivatives(0, 1)); @@ -114,10 +110,11 @@ namespace Ikarus { * @return A StandardLocalFunction representing the displacement function. */ template - inline void getDisplacementFunction(const FERequirementType& par, - const std::optional>& dx - = std::nullopt) const { - Ikarus::FEHelper::updateDisplacementCoEffs(uFunction, this->localView(), par, dx); + auto displacementFunction(const FERequirementType& par, + const std::optional>& dx = std::nullopt) const { + auto disp = Ikarus::FEHelper::localDisplacementBlockVector(this->localView(), par, dx); + Dune::StandardLocalFunction uFunction(localBasis, disp, geo_); + return uFunction; } /** @@ -129,10 +126,10 @@ namespace Ikarus { * @return The strain function calculated using greenLagrangeStrains. */ template - inline auto getStrainFunction(const FERequirementType& par, - const std::optional>& dx = std::nullopt) const { - getDisplacementFunction(par, dx); - return Dune::greenLagrangeStrains(uFunction); + inline auto strainFunction(const FERequirementType& par, + const std::optional>& dx = std::nullopt) const { + displacementFunction(par, dx); + return Dune::greenLagrangeStrains(displacementFunction(par, dx)); } /** @@ -145,7 +142,7 @@ namespace Ikarus { * @return The material tangent calculated using the material's tangentModuli function. */ template - auto getMaterialTangent(const Eigen::Vector& strain) const { + auto materialTangent(const Eigen::Vector& strain) const { if constexpr (std::is_same_v) return mat.template tangentModuli(strain); else { @@ -221,11 +218,11 @@ namespace Ikarus { void calculateMatrix(const FERequirementType& par, typename Traits::template MatrixType<> K) const { using namespace Dune::DerivativeDirections; using namespace Dune; - const auto eps = getStrainFunction(par); + const auto eps = strainFunction(par); for (const auto& [gpIndex, gp] : eps.viewOverIntegrationPoints()) { const double intElement = geo_->integrationElement(gp.position()) * gp.weight(); const auto EVoigt = (eps.evaluate(gpIndex, on(gridElement))).eval(); - const auto C = getMaterialTangent(EVoigt); + const auto C = materialTangent(EVoigt); const auto stresses = getStress(EVoigt); for (size_t i = 0; i < numberOfNodes; ++i) { const auto bopI = eps.evaluateDerivative(gpIndex, wrt(coeff(i)), on(gridElement)); @@ -250,11 +247,11 @@ namespace Ikarus { using namespace Dune::DerivativeDirections; using namespace Dune; - getDisplacementFunction(req.getFERequirements()); - const auto H = uFunction.evaluateDerivative(local, Dune::wrt(spatialAll), Dune::on(gridElement)); - const auto E = (0.5 * (H.transpose() + H + H.transpose() * H)).eval(); - const auto EVoigt = toVoigt(E); - auto PK2 = mat.template stresses(EVoigt); + const auto uFunction = displacementFunction(req.getFERequirements()); + const auto H = uFunction.evaluateDerivative(local, Dune::wrt(spatialAll), Dune::on(gridElement)); + const auto E = (0.5 * (H.transpose() + H + H.transpose() * H)).eval(); + const auto EVoigt = toVoigt(E); + auto PK2 = mat.template stresses(EVoigt); if (req.isResultRequested(ResultType::PK2Stress)) result.insertOrAssignResult(ResultType::PK2Stress, PK2); @@ -268,13 +265,9 @@ namespace Ikarus { neumannBoundaryLoad; const BoundaryPatch* neumannBoundary; Material mat; - mutable Dune::BlockVector> dispAtNodes; size_t numberOfNodes{0}; int order{}; std::shared_ptr geo_; - Dune::StandardLocalFunction, - Dune::BlockVector>, Geometry> - uFunction; protected: template @@ -282,10 +275,10 @@ namespace Ikarus { = std::nullopt) const -> ScalarType { using namespace Dune::DerivativeDirections; using namespace Dune; - getDisplacementFunction(par, dx); - const auto eps = getStrainFunction(par, dx); - const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); - ScalarType energy = 0.0; + const auto uFunction = displacementFunction(par, dx); + const auto eps = strainFunction(par, dx); + const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); + ScalarType energy = 0.0; for (const auto& [gpIndex, gp] : uFunction.viewOverIntegrationPoints()) { const auto EVoigt = (eps.evaluate(gpIndex, on(gridElement))).eval(); @@ -334,8 +327,9 @@ namespace Ikarus { const std::optional>& dx = std::nullopt) const { using namespace Dune::DerivativeDirections; using namespace Dune; - const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); - const auto eps = getStrainFunction(par, dx); + const auto& lambda = par.getParameter(Ikarus::FEParameter::loadfactor); + const auto uFunction = displacementFunction(par, dx); + const auto eps = strainFunction(par, dx); // Internal forces for (const auto& [gpIndex, gp] : eps.viewOverIntegrationPoints()) { @@ -350,7 +344,7 @@ namespace Ikarus { // External forces volume forces over the domain if (volumeLoad) { - getDisplacementFunction(par, dx); + displacementFunction(par, dx); for (const auto& [gpIndex, gp] : uFunction.viewOverIntegrationPoints()) { const double intElement = geo_->integrationElement(gp.position()) * gp.weight(); const Eigen::Vector fExt = volumeLoad(toEigen(geo_->global(gp.position())), lambda); @@ -363,7 +357,7 @@ namespace Ikarus { // External forces, boundary forces, i.e., at the Neumann boundary if (not neumannBoundary and not neumannBoundaryLoad) return; - getDisplacementFunction(par, dx); + displacementFunction(par, dx); const auto& element = this->localView().element(); for (auto&& intersection : intersections(neumannBoundary->gridView(), element)) { if (not neumannBoundary->contains(intersection)) continue; diff --git a/ikarus/python/finiteelements/registerelement.hh b/ikarus/python/finiteelements/registerelement.hh index 78cf458b0..3172a3e84 100644 --- a/ikarus/python/finiteelements/registerelement.hh +++ b/ikarus/python/finiteelements/registerelement.hh @@ -119,8 +119,8 @@ namespace Ikarus::Python { }, pybind11::arg("FErequirements"), pybind11::arg("elementMatrix").noconvert()); - if constexpr (requires { std::declval().getMaterialTangent(); }) - cls.def("getMaterialTangent", [](FE& self) { return self.getMaterialTangent(); }); + if constexpr (requires { std::declval().materialTangent(); }) + cls.def("materialTangent", [](FE& self) { return self.materialTangent(); }); cls.def( "resultAt",