From 1a4a214ea7a90395c659e7eb542b8fd52a620c50 Mon Sep 17 00:00:00 2001 From: Alex_Mueller Date: Tue, 9 Jan 2024 16:54:42 +0100 Subject: [PATCH] fixes --- .github/workflows/docsDryRun.yml | 2 +- .../mechanics/kirchhoffloveshell.hh | 86 ++++++++++++------- tests/src/CMakeLists.txt | 3 +- tests/src/checkfebyautodiff.hh | 18 ++-- tests/src/testadaptivestepsizing.cpp | 2 +- tests/src/testklshell.cpp | 1 - tests/src/testnonlinearelasticitysvk.cpp | 17 ++-- 7 files changed, 78 insertions(+), 51 deletions(-) diff --git a/.github/workflows/docsDryRun.yml b/.github/workflows/docsDryRun.yml index 37067d080..dee844aa1 100644 --- a/.github/workflows/docsDryRun.yml +++ b/.github/workflows/docsDryRun.yml @@ -22,7 +22,7 @@ on: - '**.md' jobs: - Build: + Build-Docs-Dry-Run: runs-on: ubuntu-latest container: image: ikarusproject/ikarus-dev:latest diff --git a/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh b/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh index 4dc197478..f9a21165a 100644 --- a/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh +++ b/ikarus/finiteelements/mechanics/kirchhoffloveshell.hh @@ -51,6 +51,28 @@ namespace Ikarus { static constexpr int membraneStrainSize = 3; static constexpr int bendingStrainSize = 3; + /** + * \brief A structure representing kinematic variables. + * + * This structure holds various kinematic variables used in a mechanical analysis. It includes material tangent, + * membrane strain, bending strain, Jacobian matrices of deformed and reference geometries, Hessian matrices of + * deformed and reference geometries, the normal vector, and the normalized normal vector. + * + * \tparam ScalarType The scalar type for the matrix and vector elements. + */ + template + struct KinematicVariables { + Eigen::Matrix C; ///< material tangent + Eigen::Vector3 epsV; ///< membrane strain in Voigt notation + Eigen::Vector3 kappaV; ///< bending strain in Voigt notation + Eigen::Matrix j; ///< Jacobian of the deformed geometry + Eigen::Matrix J; ///< Jacobian of the reference geometry + Eigen::Matrix3 h; ///< Hessian of the deformed geometry + Eigen::Matrix3 H; ///< Hessian of the reference geometry + Eigen::Vector3 a3N; ///< Normal vector of the deformed geometry + Eigen::Vector3 a3; ///< normalized normal vector of the deformed geometry + }; + /** * @brief Constructor for the KirchhoffLoveShell class. * @@ -215,44 +237,46 @@ namespace Ikarus { * \tparam geo The type of the geometry object. * \tparam uFunction The type of the displacement field function. * - * \return A tuple containing the material tangent, membrane strain, curvature variation, - * Jacobian matrix, metric tensor, Hessian matrix, second fundamental form, - * normalized normal vector, and normal vector at the given integration point. + * \return A tuple containing the material tangent, membrane strain, bending, + * Jacobian matrix of the reference position, Jacobian matrix of the current position, Hessian matrix of + * the current position, Hessian matrix of + * the reference position, normal vector, and normalized normal vector at the given + * integration point. */ - auto computeMaterialAndStrains(const Dune::FieldVector &gpPos, - int gpIndex, - const Geometry &geo, - const auto &uFunction) const { + auto computeMaterialAndStrains(const Dune::FieldVector &gpPos, int gpIndex, const Geometry &geo, + const auto &uFunction) const { using ScalarType = typename std::remove_cvref_t::ctype; + + KinematicVariables kin; using namespace Dune; using namespace Dune::DerivativeDirections; - const auto [X, Jd, Hd] = geo.impl().zeroFirstAndSecondDerivativeOfPosition(gpPos); - const auto J = toEigen(Jd); - const auto H = toEigen(Hd); - const Eigen::Matrix A = J*J.transpose(); - Eigen::Matrix G; - G.setZero(); - G.block<2, 2>(0, 0) = A; - G(2, 2) = 1; + const auto [X, Jd, Hd] = geo.impl().zeroFirstAndSecondDerivativeOfPosition(gpPos); + kin.J = toEigen(Jd); + kin.H = toEigen(Hd); + const Eigen::Matrix A = kin.J * kin.J.transpose(); + Eigen::Matrix G = Eigen::Matrix::Zero(); + + G.block<2, 2>(0, 0) = A; + G(2, 2) = 1; const Eigen::Matrix GInv = G.inverse(); - const auto C = materialTangent(GInv); - - Eigen::Vector3 epsV=membraneStrain.value(gpPos,geo,uFunction); - - const auto &Ndd = localBasis.evaluateSecondDerivatives(gpIndex); - const auto uasMatrix = Dune::viewAsEigenMatrixAsDynFixed(uFunction.coefficientsRef()); - const auto hessianu = Ndd.transpose().template cast()*uasMatrix; - const Eigen::Matrix3 h = H + hessianu; - const Eigen::Matrix gradu = toEigen( - uFunction.evaluateDerivative(gpIndex, Dune::wrt(spatialAll), Dune::on(Dune::DerivativeDirections::referenceElement))); - const Eigen::Matrix j = J + gradu.transpose(); - const Eigen::Vector3 a3N = (j.row(0).cross(j.row(1))); - const Eigen::Vector3 a3 = a3N.normalized(); - Eigen::Vector bV = h*a3; + kin.C = materialTangent(GInv); + + kin.epsV = membraneStrain.value(gpPos, geo, uFunction); + + const auto &Ndd = localBasis.evaluateSecondDerivatives(gpIndex); + const auto uasMatrix = Dune::viewAsEigenMatrixAsDynFixed(uFunction.coefficientsRef()); + const auto hessianu = Ndd.transpose().template cast() * uasMatrix; + kin.h = kin.H + hessianu; + const Eigen::Matrix gradu = toEigen(uFunction.evaluateDerivative( + gpIndex, Dune::wrt(spatialAll), Dune::on(Dune::DerivativeDirections::referenceElement))); + kin.j = kin.J + gradu.transpose(); + kin.a3N = (kin.j.row(0).cross(kin.j.row(1))); + kin.a3 = kin.a3N.normalized(); + Eigen::Vector bV = kin.h * kin.a3; bV(2) *= 2; // Voigt notation requires the two here const auto BV = toVoigt(toEigen(geo.impl().secondFundamentalForm(gpPos))); - const auto kappaV = (BV - bV).eval(); - return std::make_tuple(C, epsV, kappaV, j, J, h,H, a3N, a3); + kin.kappaV = BV - bV; + return kin; } template diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt index ecd914898..c55d20182 100644 --- a/tests/src/CMakeLists.txt +++ b/tests/src/CMakeLists.txt @@ -18,11 +18,12 @@ set(TEST_DEPENDING_ON_LOCALFEFUNCTIONS testlinearelasticity testnonlinearelasticityneohooke testnonlinearelasticitysvk + testadaptivestepsizing ) set(TEST_DEPENDING_ON_IGA testklshell testadaptivestepsizing) -set(TEST_NEED_MORE_TIME testadaptivestepsizing) +set(TEST_NEED_MORE_TIME) foreach(programSourceFile ${programSourceFiles}) get_filename_component(programName ${programSourceFile} NAME_WLE) diff --git a/tests/src/checkfebyautodiff.hh b/tests/src/checkfebyautodiff.hh index aeab1602c..057f6bf9f 100644 --- a/tests/src/checkfebyautodiff.hh +++ b/tests/src/checkfebyautodiff.hh @@ -3,14 +3,16 @@ #pragma once #include -#include -#include + #include +#include +#include + template