diff --git a/MaterialLib/SolidModels/LinearElasticOrthotropic.cpp b/MaterialLib/SolidModels/LinearElasticOrthotropic.cpp index d4b0dd3076e43e274da4aaec25d7d201ade7e4f8..f15f3e45125c6b8bd2cccd4823c79c4f8f02aabb 100644 --- a/MaterialLib/SolidModels/LinearElasticOrthotropic.cpp +++ b/MaterialLib/SolidModels/LinearElasticOrthotropic.cpp @@ -68,7 +68,14 @@ LinearElasticOrthotropic<DisplacementDim>::getElasticTensor( // clang-format on KelvinMatrixType<3> const C_ortho = S_ortho.inverse(); - KelvinMatrixType<3> const Q = fourthOrderRotationMatrix(x); + auto const Q = [this, &x]() -> KelvinMatrixType<3> { + if (!_local_coordinate_system) + { + return MathLib::KelvinVector::KelvinMatrixType<3>::Identity(); + } + return MathLib::KelvinVector::fourthOrderRotationMatrix( + _local_coordinate_system->transformation<3>(x)); + }(); // Rotate the forth-order tenser in Kelvin mapping with Q*C_ortho*Q^T and // return the top left corner block of size 4x4 for two-dimensional case or diff --git a/MaterialLib/SolidModels/LinearElasticOrthotropic.h b/MaterialLib/SolidModels/LinearElasticOrthotropic.h index 524ce694f4b053e695d394e9bc22077ac1de66ea..13c5b8140b70379b0719c4fec713aa7b5e5504c8 100644 --- a/MaterialLib/SolidModels/LinearElasticOrthotropic.h +++ b/MaterialLib/SolidModels/LinearElasticOrthotropic.h @@ -172,47 +172,6 @@ public: MaterialProperties getMaterialProperties() const { return _mp; } -private: - /// Rotation matrix of a forth order tensor in 3D. - MathLib::KelvinVector::KelvinMatrixType<3> fourthOrderRotationMatrix( - ParameterLib::SpatialPosition const& x) const - { - if (!_local_coordinate_system) - { - return MathLib::KelvinVector::KelvinMatrixType<3>::Identity(); - } - - // 1-based index access for convenience. - auto Q = [R = _local_coordinate_system->transformation<3>(x)]( - int const i, int const j) { return R(i - 1, j - 1); }; - - MathLib::KelvinVector::KelvinMatrixType<3> R; - R << Q(1, 1) * Q(1, 1), Q(1, 2) * Q(1, 2), Q(1, 3) * Q(1, 3), - std::sqrt(2) * Q(1, 1) * Q(1, 2), std::sqrt(2) * Q(1, 2) * Q(1, 3), - std::sqrt(2) * Q(1, 1) * Q(1, 3), Q(2, 1) * Q(2, 1), - Q(2, 2) * Q(2, 2), Q(2, 3) * Q(2, 3), - std::sqrt(2) * Q(2, 1) * Q(2, 2), std::sqrt(2) * Q(2, 2) * Q(2, 3), - std::sqrt(2) * Q(2, 1) * Q(2, 3), Q(3, 1) * Q(3, 1), - Q(3, 2) * Q(3, 2), Q(3, 3) * Q(3, 3), - std::sqrt(2) * Q(3, 1) * Q(3, 2), std::sqrt(2) * Q(3, 2) * Q(3, 3), - std::sqrt(2) * Q(3, 1) * Q(3, 3), std::sqrt(2) * Q(1, 1) * Q(2, 1), - std::sqrt(2) * Q(1, 2) * Q(2, 2), std::sqrt(2) * Q(1, 3) * Q(2, 3), - Q(1, 1) * Q(2, 2) + Q(1, 2) * Q(2, 1), - Q(1, 2) * Q(2, 3) + Q(1, 3) * Q(2, 2), - Q(1, 1) * Q(2, 3) + Q(1, 3) * Q(2, 1), - std::sqrt(2) * Q(2, 1) * Q(3, 1), std::sqrt(2) * Q(2, 2) * Q(3, 2), - std::sqrt(2) * Q(2, 3) * Q(3, 3), - Q(2, 1) * Q(3, 2) + Q(2, 2) * Q(3, 1), - Q(2, 2) * Q(3, 3) + Q(2, 3) * Q(3, 2), - Q(2, 1) * Q(3, 3) + Q(2, 3) * Q(3, 1), - std::sqrt(2) * Q(1, 1) * Q(3, 1), std::sqrt(2) * Q(1, 2) * Q(3, 2), - std::sqrt(2) * Q(1, 3) * Q(3, 3), - Q(1, 1) * Q(3, 2) + Q(1, 2) * Q(3, 1), - Q(1, 2) * Q(3, 3) + Q(1, 3) * Q(3, 2), - Q(1, 1) * Q(3, 3) + Q(1, 3) * Q(3, 1); - return R; - } - protected: MaterialProperties _mp; boost::optional<ParameterLib::CoordinateSystem> const& diff --git a/MathLib/KelvinVector.cpp b/MathLib/KelvinVector.cpp index 575b03344031bebf6ca917ccd6c46cab4c623efe..eaed17384d46e5293864bdb2e40a5703435e7898 100644 --- a/MathLib/KelvinVector.cpp +++ b/MathLib/KelvinVector.cpp @@ -178,5 +178,37 @@ kelvinVectorToSymmetricTensor(Eigen::Matrix<double, "or 6, but a vector of size %d was given.", v.size()); } + +KelvinMatrixType<3> fourthOrderRotationMatrix( + Eigen::Matrix3d const& transformation) +{ + // 1-based index access for convenience. + auto Q = [&](int const i, int const j) { + return transformation(i - 1, j - 1); + }; + + MathLib::KelvinVector::KelvinMatrixType<3> R; + R << Q(1, 1) * Q(1, 1), Q(1, 2) * Q(1, 2), Q(1, 3) * Q(1, 3), + std::sqrt(2) * Q(1, 1) * Q(1, 2), std::sqrt(2) * Q(1, 2) * Q(1, 3), + std::sqrt(2) * Q(1, 1) * Q(1, 3), Q(2, 1) * Q(2, 1), Q(2, 2) * Q(2, 2), + Q(2, 3) * Q(2, 3), std::sqrt(2) * Q(2, 1) * Q(2, 2), + std::sqrt(2) * Q(2, 2) * Q(2, 3), std::sqrt(2) * Q(2, 1) * Q(2, 3), + Q(3, 1) * Q(3, 1), Q(3, 2) * Q(3, 2), Q(3, 3) * Q(3, 3), + std::sqrt(2) * Q(3, 1) * Q(3, 2), std::sqrt(2) * Q(3, 2) * Q(3, 3), + std::sqrt(2) * Q(3, 1) * Q(3, 3), std::sqrt(2) * Q(1, 1) * Q(2, 1), + std::sqrt(2) * Q(1, 2) * Q(2, 2), std::sqrt(2) * Q(1, 3) * Q(2, 3), + Q(1, 1) * Q(2, 2) + Q(1, 2) * Q(2, 1), + Q(1, 2) * Q(2, 3) + Q(1, 3) * Q(2, 2), + Q(1, 1) * Q(2, 3) + Q(1, 3) * Q(2, 1), std::sqrt(2) * Q(2, 1) * Q(3, 1), + std::sqrt(2) * Q(2, 2) * Q(3, 2), std::sqrt(2) * Q(2, 3) * Q(3, 3), + Q(2, 1) * Q(3, 2) + Q(2, 2) * Q(3, 1), + Q(2, 2) * Q(3, 3) + Q(2, 3) * Q(3, 2), + Q(2, 1) * Q(3, 3) + Q(2, 3) * Q(3, 1), std::sqrt(2) * Q(1, 1) * Q(3, 1), + std::sqrt(2) * Q(1, 2) * Q(3, 2), std::sqrt(2) * Q(1, 3) * Q(3, 3), + Q(1, 1) * Q(3, 2) + Q(1, 2) * Q(3, 1), + Q(1, 2) * Q(3, 3) + Q(1, 3) * Q(3, 2), + Q(1, 1) * Q(3, 3) + Q(1, 3) * Q(3, 1); + return R; +} } // namespace KelvinVector } // namespace MathLib diff --git a/MathLib/KelvinVector.h b/MathLib/KelvinVector.h index e65b1ba18681ea362827078eadb78c7bf0e7d315..fc83db6d7855c29eb30d0c664a04580a53dc4227 100644 --- a/MathLib/KelvinVector.h +++ b/MathLib/KelvinVector.h @@ -205,6 +205,13 @@ symmetricTensorToKelvinVector(Eigen::MatrixBase<Derived> const& v) } return result; } + +/// Rotation tensor for Kelvin mapped vectors and tensors. It is meant to be +/// used for rotation of stress/strain tensors epsilon:Q and tangent stiffness +/// tensors Q*C*Q^t. +KelvinMatrixType<3> fourthOrderRotationMatrix( + Eigen::Matrix3d const& transformation); + } // namespace KelvinVector } // namespace MathLib