From fc2149b0052897028b35d476dafcaceddb1004c6 Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Fri, 2 Aug 2024 11:08:08 +0200 Subject: [PATCH] CosseratEnergyLocalStiffness: Provide constructor without external loads Energies of particular models should not implement external loads themselves, because that would lead to a lot of code duplication (and possible inconsistencies). A one step towards that goal, allow to construct a CosseratEnergyLocalStiffness object without external loads. --- .../gfe/assemblers/cosseratenergystiffness.hh | 35 ++++++++++++++++++- test/localadolcstiffnesstest.cc | 4 +-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/dune/gfe/assemblers/cosseratenergystiffness.hh b/dune/gfe/assemblers/cosseratenergystiffness.hh index 9932ba10..d506ea8d 100644 --- a/dune/gfe/assemblers/cosseratenergystiffness.hh +++ b/dune/gfe/assemblers/cosseratenergystiffness.hh @@ -100,6 +100,39 @@ public: /** \brief Constructor with a set of material parameters * \param parameters The material parameters */ + CosseratEnergyLocalStiffness(const Dune::ParameterTree& parameters) + { + // The shell thickness // only relevant for dim == 2 + thickness_ = parameters.template get<double>("thickness"); + + // Lame constants + mu_ = parameters.template get<double>("mu"); + lambda_ = parameters.template get<double>("lambda"); + + // Cosserat couple modulus + mu_c_ = parameters.template get<double>("mu_c"); + + // Length scale parameter + L_c_ = parameters.template get<double>("L_c"); + + // Curvature exponent + q_ = parameters.template get<double>("q"); + + // Shear correction factor // only relevant for dim == 2 + kappa_ = parameters.template get<double>("kappa"); + + // Curvature parameters + b1_ = parameters.template get<double>("b1"); + b2_ = parameters.template get<double>("b2"); + b3_ = parameters.template get<double>("b3"); + } + + /** \brief Constructor with material parameters and external loads + * \param parameters The material parameters + * \param neumannBoundary The part of the boundary where a surface load is applied + * \param neumannFunction Surface load density + * \param volumeLoad Volume load density + */ CosseratEnergyLocalStiffness(const Dune::ParameterTree& parameters, const BoundaryPatch<GridView>* neumannBoundary, const std::function<Dune::FieldVector<double,3>(Dune::FieldVector<double,dimworld>)> neumannFunction, @@ -317,7 +350,7 @@ public: double b1_, b2_, b3_; /** \brief The Neumann boundary */ - const BoundaryPatch<GridView>* neumannBoundary_; + const BoundaryPatch<GridView>* neumannBoundary_ = nullptr; /** \brief The function implementing the Neumann data */ const std::function<Dune::FieldVector<double,3>(Dune::FieldVector<double,dimworld>)> neumannFunction_; diff --git a/test/localadolcstiffnesstest.cc b/test/localadolcstiffnesstest.cc index 9557f652..2cd55096 100644 --- a/test/localadolcstiffnesstest.cc +++ b/test/localadolcstiffnesstest.cc @@ -175,14 +175,14 @@ int main (int argc, char *argv[]) try /////////////////////////////////////////////////////////////////////// // Assembler using ADOL-C - auto cosseratLocalEnergy = std::make_shared<CosseratEnergyLocalStiffness<FEBasis, 3,adouble> >(materialParameters, nullptr, nullptr, nullptr); + auto cosseratLocalEnergy = std::make_shared<CosseratEnergyLocalStiffness<FEBasis, 3,adouble> >(materialParameters); LocalGeodesicFEADOLCStiffness<FEBasis, TargetSpace> localGFEADOLCStiffness(cosseratLocalEnergy); // Assembler using finite differences CosseratEnergyLocalStiffness<FEBasis, 3,FDType> - cosseratEnergyFDLocalStiffness(materialParameters, nullptr, nullptr, nullptr); + cosseratEnergyFDLocalStiffness(materialParameters); LocalGeodesicFEFDStiffness<FEBasis, TargetSpace, FDType> localGFEFDStiffness(&cosseratEnergyFDLocalStiffness); -- GitLab