Go to the documentation of this file.
35 #define VOIGTFROMDIM( x ) ( ( ( x * x ) + x ) >> 1 )
41 namespace ContinuumMechanics::VoigtNotation {
49 return (
VoigtSize)( ( ( x * x ) + x ) >> 1 );
118 template < enum VoigtSize voigtSize >
122 return ( Eigen::Matrix< double, 1, 1 >() << Voigt3D( 0 ) ).finished();
128 throw std::invalid_argument(
MakeString() << __PRETTY_FUNCTION__ <<
": invalid dimension specified" );
151 template < enum VoigtSize voigtSize >
161 throw std::invalid_argument(
MakeString() << __PRETTY_FUNCTION__ <<
": invalid dimension specified" );
183 template <
typename T >
184 Eigen::Matrix< T, 3, 3 >
voigtToStrain(
const Eigen::Matrix< T, 6, 1 >& voigt )
186 Eigen::Matrix< T, 3, 3 > strain;
188 strain << voigt[0], voigt[3] * 0.5, voigt[4] * 0.5,
189 voigt[3] * 0.5, voigt[1], voigt[5] * 0.5,
190 voigt[4] * 0.5, voigt[5] * 0.5, voigt[2];
212 template <
typename T >
213 Eigen::Matrix< T, 3, 3 >
voigtToStress(
const Eigen::Matrix< T, 6, 1 >& voigt )
215 Eigen::Matrix< T, 3, 3 > stress;
217 stress << voigt[0], voigt[3], voigt[4],
218 voigt[3], voigt[1], voigt[5],
219 voigt[4], voigt[5], voigt[2];
260 template <
typename T =
double >
261 Eigen::Matrix< T, 6, 1 >
stressToVoigt(
const Eigen::Matrix< T, 3, 3 >& stressTensor )
263 Eigen::Matrix< T, 6, 1 > stress;
265 stress << stressTensor( 0, 0 ),
266 stressTensor( 1, 1 ),
267 stressTensor( 2, 2 ),
268 stressTensor( 0, 1 ),
269 stressTensor( 0, 2 ),
270 stressTensor( 1, 2 );
275 Eigen::Matrix< double, 6, 6 >
stiffnessToVoigt(
const Eigen::Tensor< double, 4 >& C );
277 Eigen::Tensor< double, 4 >
voigtToStiffness(
const Eigen::Matrix< double, 6, 6 >& voigtStiffness );
279 template <
int nDim >
283 if constexpr (
nDim == 1 )
284 return ( Eigen::Matrix< double, nDim, nDim >() << Voigt( 0 ) ).finished();
285 else if constexpr (
nDim == 2 )
286 return ( Eigen::Matrix< double, nDim, nDim >() << Voigt( 0 ), Voigt( 2 ), Voigt( 2 ), Voigt( 1 ) ).finished();
287 else if constexpr (
nDim == 3 )
290 throw std::invalid_argument(
MakeString() << __PRETTY_FUNCTION__ <<
": invalid dimension specified" );
293 template <
int nDim >
295 const Eigen::Matrix< double, nDim, nDim >& strain )
297 if constexpr (
nDim == 1 )
298 return ( Eigen::Matrix<
double,
VOIGTFROMDIM(
nDim ), 1 >() << strain( 0, 0 ) ).finished();
299 else if constexpr (
nDim == 2 )
300 return ( Eigen::Matrix<
double,
VOIGTFROMDIM(
nDim ), 1 >() << strain( 0, 0 ),
304 else if constexpr (
nDim == 3 )
307 throw std::invalid_argument(
MakeString() << __PRETTY_FUNCTION__ <<
": invalid dimension specified" );
310 namespace Invariants {
378 template <
typename T >
403 template <
typename T >
404 T
I1(
const Eigen::Matrix< T, 6, 1 >& stress )
406 return stress( 0 ) + stress( 1 ) + stress( 2 );
422 template <
typename T >
423 T
I2(
const Eigen::Matrix< T, 6, 1 >& stress )
425 const Eigen::Matrix< T, 6, 1 >& s = stress;
426 return s( 0 ) * s( 1 ) + s( 1 ) * s( 2 ) + s( 2 ) * s( 0 ) - s( 3 ) * s( 3 ) - s( 4 ) * s( 4 ) -
443 template <
typename T >
444 T
I3(
const Eigen::Matrix< T, 6, 1 >& stress )
446 const Eigen::Matrix< T, 6, 1 >& s = stress;
447 return s( 0 ) * s( 1 ) * s( 2 ) + 2. * s( 3 ) * s( 4 ) * s( 5 ) - s( 0 ) * s( 5 ) * s( 5 ) -
448 s( 1 ) * s( 4 ) * s( 4 ) - s( 2 ) * s( 3 ) * s( 3 );
461 template <
typename T >
462 T
J2(
const Eigen::Matrix< T, 6, 1 >& stress )
464 const T I1_ =
I1( stress );
465 const T I2_ =
I2( stress );
466 const T res = ( 1. / 3 ) * I1_ * I1_ - I2_;
484 template <
typename T >
485 T
J3(
const Eigen::Matrix< T, 6, 1 >& stress )
487 const T I1_ =
I1( stress );
488 const T I2_ =
I2( stress );
489 const T I3_ =
I3( stress );
491 return ( 2. / 27 ) * pow( I1_, 3 ) - ( 1. / 3 ) * I1_ * I2_ + I3_;
501 const Eigen::Matrix< double, 6, 1 >& S );
505 namespace Derivatives {
518 template <
typename T >
519 Eigen::Matrix< T, 6, 1 >
dRho_dStress( T rho,
const Eigen::Matrix< T, 6, 1 >& stress )
522 return Eigen::Matrix< T, 6, 1 >::Zero();
524 Eigen::Matrix< T, 6, 1 > s =
IDev * stress;
526 return T( 1. / rho ) *
P.array() * s.array();
647 namespace Transformations {
Eigen::Vector3d principalStresses(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:126
constexpr int voigtSize
Definition: MarmotFiniteElement.h:113
const Marmot::Vector6d PInv
Definition: MarmotVoigt.cpp:16
double I1Strain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:268
constexpr VoigtSize voigtSizeFromDimension(int x)
Definition: MarmotVoigt.h:47
double vonMisesEquivalentStrain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:247
RowVector6d dDeltaEpvneg_dE(const Marmot::Vector6d &dEp, const Matrix6d &CelInv, const Matrix6d &Cep)
Definition: MarmotVoigt.cpp:499
double normStress(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:255
Eigen::Vector3d sortedPrincipalStrains(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:132
Eigen::Matrix< T, 6, 1 > stressToVoigt(const Eigen::Matrix< T, 3, 3 > &stressTensor)
Definition: MarmotVoigt.h:261
Marmot::Matrix36 dSortedStrainPrincipal_dStrain(const Marmot::Vector6d &dEp)
Definition: MarmotVoigt.cpp:454
T normStrain(const Eigen::Matrix< T, 6, 1 > &strain)
Definition: MarmotVoigt.h:379
Eigen::Matrix< double, 6, 6 > Matrix6d
Definition: MarmotTypedefs.h:35
Eigen::Matrix< T, 6, 1 > dRho_dStress(T rho, const Eigen::Matrix< T, 6, 1 > &stress)
Definition: MarmotVoigt.h:519
Marmot::Matrix36 dStressPrincipals_dStress(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:413
Vector6d dStressMean_dStress()
Definition: MarmotVoigt.cpp:304
double dThetaStrain_dJ2Strain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:358
@ Axial
Definition: MarmotVoigt.h:45
Marmot::Vector6d make3DVoigt(const Eigen::Matrix< double, voigtSize, 1 > &Voigt)
Definition: MarmotVoigt.h:152
constexpr int nDim
Definition: MarmotFiniteElement.h:112
T I1(const Eigen::Matrix< T, 6, 1 > &stress)
Definition: MarmotVoigt.h:404
T J2(const Eigen::Matrix< T, 6, 1 > &stress)
Definition: MarmotVoigt.h:462
Marmot::Vector6d dJ3Strain_dStrain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:399
Eigen::Vector3d voigtToPlaneVoigt(const Marmot::Vector6d &voigt)
Definition: MarmotVoigt.cpp:97
Eigen::Matrix< double, 3, 1 > Vector3d
Definition: MarmotTypedefs.h:42
double makeReal(const double &value)
Definition: MarmotMath.cpp:37
@ ThreeD
Definition: MarmotVoigt.h:45
Marmot::Vector6d strainToVoigt(const Eigen::Matrix3d &strainTensor)
#define VOIGTFROMDIM(x)
Definition: MarmotVoigt.h:35
double dTheta_dJ3(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:342
T I2(const Eigen::Matrix< T, 6, 1 > &stress)
Definition: MarmotVoigt.h:423
const Marmot::Vector6d I
Definition: MarmotVoigt.cpp:18
Eigen::Vector3d dStrainVolumetricNegative_dStrainPrincipal(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:433
Matrix6d dEp_dE(const Matrix6d &CelInv, const Matrix6d &Cep)
Definition: MarmotVoigt.cpp:444
Eigen::Matrix< double, VOIGTFROMDIM(nDim), 1 > voigtFromStrainMatrix(const Eigen::Matrix< double, nDim, nDim > &strain)
Definition: MarmotVoigt.h:294
Marmot::Vector6d dTheta_dStress(double theta, const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:309
Eigen::Matrix< T, 3, 3 > voigtToStrain(const Eigen::Matrix< T, 6, 1 > &voigt)
Definition: MarmotVoigt.h:184
Eigen::Matrix< double, 3, 3 > Matrix3d
Definition: MarmotTypedefs.h:40
Eigen::Matrix< double, voigtSize, 1 > reduce3DVoigt(const Marmot::Vector6d &Voigt3D)
Definition: MarmotVoigt.h:119
T J3(const Eigen::Matrix< T, 6, 1 > &stress)
Definition: MarmotVoigt.h:485
This file includes functions needed for calculations with stress and strain tensors written in voigt ...
Definition: MarmotTesting.h:37
double StrainVolumetricNegative(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:260
double dTheta_dJ2(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:326
const Marmot::Vector6d IHyd
Definition: MarmotVoigt.cpp:19
RowVector6d dDeltaEpv_dE(const Matrix6d &CelInv, const Matrix6d &Cep)
Definition: MarmotVoigt.cpp:449
const Marmot::Vector6d P
Definition: MarmotVoigt.cpp:15
double J2Strain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:288
VoigtSize
Definition: MarmotVoigt.h:45
Eigen::Matrix< double, 6, 1 > Vector6d
Definition: MarmotTypedefs.h:43
Marmot::Vector6d dJ2Strain_dStrain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:394
double vonMisesEquivalentStress(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:242
Eigen::Matrix< double, 1, 6 > RowVector6d
Definition: MarmotTypedefs.h:48
Eigen::Matrix< T, 3, 3 > voigtToStress(const Eigen::Matrix< T, 6, 1 > &voigt)
Definition: MarmotVoigt.h:213
Eigen::Vector3d principalStrains(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:120
Eigen::Matrix3d principalStressesDirections(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:144
T I3(const Eigen::Matrix< T, 6, 1 > &stress)
Definition: MarmotVoigt.h:444
Marmot::Vector6d planeVoigtToVoigt(const Eigen::Vector3d &voigtPlane)
double J3Strain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:294
std::pair< Eigen::Vector3d, Eigen::Matrix< double, 3, 6 > > principalValuesAndDerivatives(const Eigen::Matrix< double, 6, 1 > &S)
Definition: MarmotVoigt.cpp:152
Marmot::Vector6d dJ2_dStress(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:382
@ OneD
Definition: MarmotVoigt.h:45
Marmot::Vector6d dThetaStrain_dStrain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:406
Eigen::Matrix< double, nDim, nDim > stressMatrixFromVoigt(const Eigen::Matrix< double, VOIGTFROMDIM(nDim), 1 > &Voigt)
Definition: MarmotVoigt.h:280
@ TwoD
Definition: MarmotVoigt.h:45
Eigen::Matrix< double, 6, 6 > stiffnessToVoigt(const Eigen::Tensor< double, 4 > &C)
Definition: MarmotVoigt.cpp:45
Marmot::Vector6d dJ3_dStress(const Marmot::Vector6d &stress)
Definition: MarmotVoigt.cpp:387
double I3Strain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:282
double I2Strain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:273
Eigen::Tensor< double, 4 > voigtToStiffness(const Eigen::Matrix< double, 6, 6 > &voigtStiffness)
Definition: MarmotVoigt.cpp:73
const Matrix6d IDev
Definition: MarmotVoigt.cpp:21
double dThetaStrain_dJ3Strain(const Marmot::Vector6d &strain)
Definition: MarmotVoigt.cpp:370
Eigen::Matrix< double, 3, 6 > Matrix36d
Definition: MarmotTypedefs.h:53
Definition: MarmotJournal.h:32
Eigen::Matrix< double, 3, 6 > Matrix36
Definition: MarmotTypedefs.h:54