Skip to content

Commit

Permalink
[MatL] Solids; Extract elasticTangentStiffness().
Browse files Browse the repository at this point in the history
Same function is used in Ehlers and in the LinearElasticIsotropic.
  • Loading branch information
endJunction committed Dec 18, 2018
1 parent edd0974 commit edc7f83
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
19 changes: 4 additions & 15 deletions MaterialLib/SolidModels/Ehlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
8 changes: 2 additions & 6 deletions MaterialLib/SolidModels/LinearElasticIsotropic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
15 changes: 15 additions & 0 deletions MaterialLib/SolidModels/LinearElasticIsotropic.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,20 @@ class LinearElasticIsotropic : public MechanicsBase<DisplacementDim>
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

0 comments on commit edc7f83

Please sign in to comment.