From ec1e0bdff362fea801b9a8fd781423a5dc469ef2 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Tue, 18 Dec 2018 11:20:58 +0100 Subject: [PATCH] [MatL] Solids; Extract elasticTangentStiffness(). Same function is used in Ehlers and in the LinearElasticIsotropic. --- MaterialLib/SolidModels/Ehlers.cpp | 19 ++++--------------- .../SolidModels/LinearElasticIsotropic.cpp | 8 ++------ .../SolidModels/LinearElasticIsotropic.h | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/MaterialLib/SolidModels/Ehlers.cpp b/MaterialLib/SolidModels/Ehlers.cpp index a320087e1da..2cda03b5f9d 100644 --- a/MaterialLib/SolidModels/Ehlers.cpp +++ b/MaterialLib/SolidModels/Ehlers.cpp @@ -9,9 +9,10 @@ #include "Ehlers.h" #include <boost/math/special_functions/pow.hpp> - #include "MathLib/LinAlg/Eigen/EigenMapTools.h" +#include "LinearElasticIsotropic.h" + /** * Common convenitions for naming: * x_D - deviatoric part of tensor x @@ -53,19 +54,6 @@ template <int DisplacementDim> MathLib::KelvinVector::KelvinMatrixType<DisplacementDim> sOdotS( MathLib::KelvinVector::KelvinVectorType<DisplacementDim> const& v); -template <int DisplacementDim> -MathLib::KelvinVector::KelvinMatrixType<DisplacementDim> -elasticTangentStiffness(double const K, double const G) -{ - using KelvinMatrix = - MathLib::KelvinVector::KelvinMatrixType<DisplacementDim>; - - KelvinMatrix tangentStiffness = KelvinMatrix::Zero(); - tangentStiffness.template topLeftCorner<3, 3>().setConstant(K - 2. / 3 * G); - tangentStiffness.noalias() += 2 * G * KelvinMatrix::Identity(); - return tangentStiffness; -} - template <int DisplacementDim> struct PhysicalStressWithInvariants final { @@ -527,7 +515,8 @@ SolidEhlers<DisplacementDim>::integrateStress( calculateIsotropicHardening(mp.kappa, mp.hardening_coefficient, state.eps_p.eff)) < 0)) { - tangentStiffness = elasticTangentStiffness<DisplacementDim>(mp.K, mp.G); + tangentStiffness = elasticTangentStiffness<DisplacementDim>( + mp.K - 2. / 3 * mp.G, mp.G); } else { diff --git a/MaterialLib/SolidModels/LinearElasticIsotropic.cpp b/MaterialLib/SolidModels/LinearElasticIsotropic.cpp index e28133f1c42..23ea50f6e27 100644 --- a/MaterialLib/SolidModels/LinearElasticIsotropic.cpp +++ b/MaterialLib/SolidModels/LinearElasticIsotropic.cpp @@ -47,12 +47,8 @@ LinearElasticIsotropic<DisplacementDim>::getElasticTensor( double const t, ProcessLib::SpatialPosition const& x, double const /*T*/) const { - KelvinMatrix C = KelvinMatrix::Zero(); - - C.template topLeftCorner<3, 3>().setConstant(_mp.lambda(t, x)); - C.noalias() += 2 * _mp.mu(t, x) * KelvinMatrix::Identity(); - - return C; + return elasticTangentStiffness<DisplacementDim>(_mp.lambda(t, x), + _mp.mu(t, x)); } template class LinearElasticIsotropic<2>; diff --git a/MaterialLib/SolidModels/LinearElasticIsotropic.h b/MaterialLib/SolidModels/LinearElasticIsotropic.h index 5e9271dc019..ae1d1db22ee 100644 --- a/MaterialLib/SolidModels/LinearElasticIsotropic.h +++ b/MaterialLib/SolidModels/LinearElasticIsotropic.h @@ -133,5 +133,20 @@ protected: extern template class LinearElasticIsotropic<2>; extern template class LinearElasticIsotropic<3>; +template <int DisplacementDim> +MathLib::KelvinVector::KelvinMatrixType<DisplacementDim> +elasticTangentStiffness(double const first_lame_parameter, + double const shear_modulus) +{ + using KelvinMatrix = + MathLib::KelvinVector::KelvinMatrixType<DisplacementDim>; + + KelvinMatrix tangentStiffness = KelvinMatrix::Zero(); + tangentStiffness.template topLeftCorner<3, 3>().setConstant( + first_lame_parameter); + tangentStiffness.noalias() += 2 * shear_modulus * KelvinMatrix::Identity(); + return tangentStiffness; +} + } // namespace Solids } // namespace MaterialLib -- GitLab