diff --git a/ikarus/finiteelements/mechanics/linearelastic.hh b/ikarus/finiteelements/mechanics/linearelastic.hh index 33f0b7338..567ce62c3 100644 --- a/ikarus/finiteelements/mechanics/linearelastic.hh +++ b/ikarus/finiteelements/mechanics/linearelastic.hh @@ -233,10 +233,10 @@ namespace Ikarus { Dune::CachedLocalBasis< std::remove_cvref_t().tree().child(0).finiteElement().localBasis())>> localBasis; - std::function(const Eigen::Vector&, + std::function(const Dune::FieldVector&, const double&)> volumeLoad; - std::function(const Eigen::Vector&, + std::function(const Dune::FieldVector&, const double&)> neumannBoundaryLoad; const BoundaryPatch* neumannBoundary; @@ -270,7 +270,7 @@ namespace Ikarus { if (volumeLoad) { for (const auto& [gpIndex, gp] : eps.viewOverIntegrationPoints()) { const auto uVal = u.evaluate(gpIndex); - Eigen::Vector fext = volumeLoad(toEigen(geo.global(gp.position())), lambda); + Eigen::Vector fext = volumeLoad(geo.global(gp.position()), lambda); energy -= uVal.dot(fext) * geo.integrationElement(gp.position()) * gp.weight(); } } @@ -294,7 +294,7 @@ namespace Ikarus { const auto uVal = u.evaluate(quadPos); // Value of the Neumann data at the current position - auto neumannValue = neumannBoundaryLoad(toEigen(intersection.geometry().global(curQuad.position())), lambda); + auto neumannValue = neumannBoundaryLoad(intersection.geometry().global(curQuad.position()), lambda); energy -= neumannValue.dot(uVal) * curQuad.weight() * integrationElement; } @@ -327,7 +327,7 @@ namespace Ikarus { if (volumeLoad) { const auto u = getDisplacementFunction(par, dx); for (const auto& [gpIndex, gp] : u.viewOverIntegrationPoints()) { - Eigen::Vector fext = volumeLoad(toEigen(geo.global(gp.position())), lambda); + Eigen::Vector fext = volumeLoad(geo.global(gp.position()), lambda); for (size_t i = 0; i < numberOfNodes; ++i) { const auto udCi = u.evaluateDerivative(gpIndex, wrt(coeff(i))); force.template segment(myDim * i) @@ -357,8 +357,7 @@ namespace Ikarus { const auto udCi = u.evaluateDerivative(quadPos, wrt(coeff(i))); // Value of the Neumann data at the current position - auto neumannValue - = neumannBoundaryLoad(toEigen(intersection.geometry().global(curQuad.position())), lambda); + auto neumannValue = neumannBoundaryLoad(intersection.geometry().global(curQuad.position()), lambda); force.template segment(myDim * i) -= udCi * neumannValue * curQuad.weight() * integrationElement; } } diff --git a/ikarus/finiteelements/mechanics/membranestrains.hh b/ikarus/finiteelements/mechanics/membranestrains.hh index 66e949731..891ca4e9d 100644 --- a/ikarus/finiteelements/mechanics/membranestrains.hh +++ b/ikarus/finiteelements/mechanics/membranestrains.hh @@ -40,7 +40,8 @@ namespace Ikarus { const Eigen::Matrix j = J + gradu.transpose(); epsV << J.row(0).dot(gradu.col(0)) + 0.5 * gradu.col(0).squaredNorm(), - J.row(1).dot(gradu.col(1)) + 0.5 * gradu.col(1).squaredNorm(), j.row(0).dot(j.row(1)); + J.row(1).dot(gradu.col(1)) + 0.5 * gradu.col(1).squaredNorm(), + j.row(0).dot(j.row(1)) - J.row(0).dot(J.row(1)); return epsV; } diff --git a/ikarus/python/finiteelements/nonlinearelastic.hh b/ikarus/python/finiteelements/nonlinearelastic.hh index 550014728..db6b58913 100644 --- a/ikarus/python/finiteelements/nonlinearelastic.hh +++ b/ikarus/python/finiteelements/nonlinearelastic.hh @@ -39,8 +39,8 @@ namespace Ikarus::Python { }), pybind11::keep_alive<1, 2>(), pybind11::keep_alive<1, 3>()); - using LoadFunction = std::function(Eigen::Vector, - const double&)>; + using LoadFunction = std::function( + Dune::FieldVector, const double&)>; cls.def(pybind11::init( [](const GlobalBasis& basis, const Element& element, const Material& mat, diff --git a/ikarus/python/finiteelements/registerelement.hh b/ikarus/python/finiteelements/registerelement.hh index b7d1d025d..c9e6cf033 100644 --- a/ikarus/python/finiteelements/registerelement.hh +++ b/ikarus/python/finiteelements/registerelement.hh @@ -59,8 +59,8 @@ namespace Ikarus::Python { }), pybind11::keep_alive<1, 2>(), pybind11::keep_alive<1, 3>()); - using LoadFunction = std::function(Eigen::Vector, - const double&)>; + using LoadFunction = std::function( + Dune::FieldVector, const double&)>; if constexpr (defaultInitializers) cls.def( pybind11::init([](const GlobalBasis& basis, const Element& element, double emod, double nu, diff --git a/python/ikarus/finite_elements/__init__.py b/python/ikarus/finite_elements/__init__.py index f395d4eac..7072c1dbd 100644 --- a/python/ikarus/finite_elements/__init__.py +++ b/python/ikarus/finite_elements/__init__.py @@ -104,13 +104,7 @@ def KirchhoffLoveShell( includes = ["ikarus/python/finiteelements/kirchhoffloveshell.hh"] includes += ["ikarus/finiteelements/febases/autodifffe.hh"] - autodiffWrapper = "AutoDiffFE" - element_type = ( - "Ikarus::" - + autodiffWrapper - + f">,true>," - f"Ikarus::FERequirements>,true>" - ) + element_type = f"Ikarus::KirchhoffLoveShell<{basis.cppTypeName},Ikarus::FERequirements>,true>" # else: # element_type = "Ikarus::" + func.__name__ + f"<{basis.cppTypeName}, {material.cppTypeName} ,Ikarus::FERequirements>,true>" diff --git a/tests/src/checkfebyautodiff.hh b/tests/src/checkfebyautodiff.hh index 6fb079498..230617f42 100644 --- a/tests/src/checkfebyautodiff.hh +++ b/tests/src/checkfebyautodiff.hh @@ -11,7 +11,7 @@ template