https://mooseframework.inl.gov
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
SymmetricRankFourTensorTempl< T > Class Template Reference

SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor symmetry, C. More...

#include <SymmetricRankFourTensor.h>

Classes

struct  TwoTensorMultTraits
 
struct  TwoTensorMultTraits< SymmetricRankTwoTensorTempl, Scalar >
 
struct  TwoTensorMultTraits< TensorValue, Scalar >
 
struct  TwoTensorMultTraits< TypeTensor, Scalar >
 

Public Types

enum  InitMethod { initNone, initIdentity, initIdentitySymmetricFour }
 Initialization method. More...
 
enum  FillMethod {
  symmetric9, symmetric21, symmetric_isotropic, symmetric_isotropic_E_nu,
  axisymmetric_rz, principal, orthotropic
}
 To fill up the 36 entries in the 4th-order tensor, fillFromInputVector is called with one of the following fill_methods. More...
 

Public Member Functions

 SymmetricRankFourTensorTempl ()
 Default constructor; fills to zero. More...
 
 SymmetricRankFourTensorTempl (const InitMethod)
 Select specific initialization pattern. More...
 
 SymmetricRankFourTensorTempl (const std::vector< T > &, FillMethod)
 Fill from vector. More...
 
 SymmetricRankFourTensorTempl (const SymmetricRankFourTensorTempl< T > &a)=default
 Copy assignment operator must be defined if used. More...
 
template<typename T2 >
 SymmetricRankFourTensorTempl (const SymmetricRankFourTensorTempl< T2 > &copy)
 Copy constructor. More...
 
 SymmetricRankFourTensorTempl (const RankFourTensorTempl< T > &a)
 Copy constructor from RankFourTensorTempl<T> More...
 
 operator RankFourTensorTempl< T > ()
 The conversion operator to RankFourTensorTempl More...
 
T & operator() (unsigned int i, unsigned int j)
 Gets the value for the indices specified. Takes indices ranging from 0-5 for i and j. More...
 
const T & operator() (unsigned int i, unsigned int j) const
 Gets the value for the indices specified. More...
 
void zero ()
 Zeros out the tensor. More...
 
void print (std::ostream &stm=Moose::out) const
 Print the rank four tensor. More...
 
void printReal (std::ostream &stm=Moose::out) const
 Print the values of the rank four tensor. More...
 
SymmetricRankFourTensorTempl< T > & operator= (const SymmetricRankFourTensorTempl< T > &a)=default
 copies values from a into this tensor More...
 
template<typename Scalar >
boostcopy::enable_if_c< libMesh::ScalarTraits< Scalar >::value, SymmetricRankFourTensorTempl & >::type operator= (const Scalar &libmesh_dbg_var(p))
 Assignment-from-scalar operator. More...
 
template<typename T2 >
auto operator* (const SymmetricRankTwoTensorTempl< T2 > &b) const -> SymmetricRankTwoTensorTempl< decltype(T() *T2())>
 C_ijkl*a_kl. More...
 
template<typename T2 >
auto operator* (const T2 &a) const -> typename std::enable_if< libMesh::ScalarTraits< T2 >::value, SymmetricRankFourTensorTempl< decltype(T() *T2())>>::type
 C_ijkl*a. More...
 
SymmetricRankFourTensorTempl< T > & operator*= (const T &a)
 C_ijkl *= a. More...
 
template<typename T2 >
auto operator/ (const T2 &a) const -> typename std::enable_if< libMesh::ScalarTraits< T2 >::value, SymmetricRankFourTensorTempl< decltype(T()/T2())>>::type
 C_ijkl/a. More...
 
SymmetricRankFourTensorTempl< T > & operator/= (const T &a)
 C_ijkl /= a for all i, j, k, l. More...
 
SymmetricRankFourTensorTempl< T > & operator+= (const SymmetricRankFourTensorTempl< T > &a)
 C_ijkl += a_ijkl for all i, j, k, l. More...
 
template<typename T2 >
auto operator+ (const SymmetricRankFourTensorTempl< T2 > &a) const -> SymmetricRankFourTensorTempl< decltype(T()+T2())>
 C_ijkl + a_ijkl. More...
 
SymmetricRankFourTensorTempl< T > & operator-= (const SymmetricRankFourTensorTempl< T > &a)
 C_ijkl -= a_ijkl. More...
 
template<typename T2 >
auto operator- (const SymmetricRankFourTensorTempl< T2 > &a) const -> SymmetricRankFourTensorTempl< decltype(T() - T2())>
 C_ijkl - a_ijkl. More...
 
SymmetricRankFourTensorTempl< T > operator- () const
 -C_ijkl More...
 
template<typename T2 >
auto operator* (const SymmetricRankFourTensorTempl< T2 > &a) const -> SymmetricRankFourTensorTempl< decltype(T() *T2())>
 C_ijpq*a_pqkl. More...
 
L2norm () const
 sqrt(C_ijkl*C_ijkl) More...
 
SymmetricRankFourTensorTempl< T > invSymm () const
 This returns A_ijkl such that C_ijkl*A_klmn = 0.5*(de_im de_jn + de_in de_jm) This routine assumes that C_ijkl = C_jikl = C_ijlk. More...
 
void rotate (const TypeTensor< T > &R)
 Rotate the tensor using C_ijkl = R_im R_jn R_ko R_lp C_mnop. More...
 
SymmetricRankFourTensorTempl< T > transposeMajor () const
 Transpose the tensor by swapping the first pair with the second pair of indices This amounts to a regular transpose of the 6x6 matrix. More...
 
SymmetricRankFourTensorTempl< T > transposeIj () const
 Transpose the tensor by swapping the first two indices - a no-op. More...
 
void fillFromInputVector (const std::vector< T > &input, FillMethod fill_method)
 fillFromInputVector takes some number of inputs to fill the Rank-4 tensor. More...
 
template<typename T2 >
void fillSymmetric9FromInputVector (const T2 &input)
 fillSymmetric9FromInputVector takes 9 inputs to fill in the Rank-4 tensor with the appropriate crystal symmetries maintained. More...
 
template<typename T2 >
void fillSymmetric21FromInputVector (const T2 &input)
 fillSymmetric21FromInputVector takes 21 inputs to fill in the Rank-4 tensor with the appropriate crystal symmetries maintained. More...
 
sum3x3 () const
 Calculates the sum of Ciijj for i and j varying from 0 to 2. More...
 
libMesh::VectorValue< T > sum3x1 () const
 Calculates the vector a[i] = sum over j Ciijj for i and j varying from 0 to 2. More...
 
bool isSymmetric () const
 checks if the tensor is symmetric More...
 
bool isIsotropic () const
 checks if the tensor is isotropic More...
 
void fillSymmetricIsotropic (const T &i0, const T &i1)
 Vector-less fill API functions. See docs of the corresponding ...FromInputVector methods. More...
 
void fillSymmetricIsotropicEandNu (const T &E, const T &nu)
 

Static Public Member Functions

static constexpr Real mandelFactor (unsigned int i, unsigned int j)
 returns the 1, sqrt(2), or 2 prefactor in the Mandel notation for the indices i,j ranging from 0-5. More...
 
static SymmetricRankFourTensorTempl< T > identity ()
 
static SymmetricRankFourTensorTempl< T > identitySymmetricFour ()
 
static SymmetricRankFourTensorTempl< T > rotationMatrix (const TypeTensor< T > &R)
 Build a 6x6 rotation matrix MEHRABADI, MORTEZA M. More...
 
static MooseEnum fillMethodEnum ()
 Static method for use in validParams for getting the "fill_method". More...
 

Static Public Attributes

static constexpr unsigned int full_index [6][6][4]
 
static constexpr unsigned int Ndim = LIBMESH_DIM
 tensor dimension, Mandel matrix dimension, and Mandel matrix size More...
 
static constexpr unsigned int N = Ndim + Ndim * (Ndim - 1) / 2
 
static constexpr unsigned int N2 = N * N
 

Protected Member Functions

void fillSymmetricIsotropicFromInputVector (const std::vector< T > &input)
 fillSymmetricIsotropicFromInputVector takes 2 inputs to fill the the symmetric Rank-4 tensor with the appropriate symmetries maintained. More...
 
void fillSymmetricIsotropicEandNuFromInputVector (const std::vector< T > &input)
 fillSymmetricIsotropicEandNuFromInputVector is a variation of the fillSymmetricIsotropicFromInputVector which takes as inputs the more commonly used Young's modulus (E) and Poisson's ratio (nu) constants to fill the isotropic elasticity tensor. More...
 
void fillAxisymmetricRZFromInputVector (const std::vector< T > &input)
 fillAxisymmetricRZFromInputVector takes 5 inputs to fill the axisymmetric Rank-4 tensor with the appropriate symmetries maintatined for use with axisymmetric problems using coord_type = RZ. More...
 
void fillPrincipalFromInputVector (const std::vector< T > &input)
 fillPrincipalFromInputVector takes 9 inputs to fill a Rank-4 tensor C1111 = input0 C1122 = input1 C1133 = input2 C2211 = input3 C2222 = input4 C2233 = input5 C3311 = input6 C3322 = input7 C3333 = input8 with all other components being zero More...
 
void fillGeneralOrthotropicFromInputVector (const std::vector< T > &input)
 fillGeneralOrhotropicFromInputVector takes 10 inputs to fill the Rank-4 tensor It defines a general orthotropic tensor for which some constraints among elastic parameters exist More...
 

Protected Attributes

std::array< T, N2_vals
 The values of the rank-four tensor. More...
 

Friends

template<typename T2 >
class SymmetricRankTwoTensorTempl
 
template<typename T2 >
class SymmetricRankFourTensorTempl
 
template<typename T2 >
class RankThreeTensorTempl
 
std::ostream & operator<< (std::ostream &os, const SymmetricRankFourTensorTempl< T > &t)
 
template<class T2 >
void dataStore (std::ostream &, SymmetricRankFourTensorTempl< T2 > &, void *)
 
template<class T2 >
void dataLoad (std::istream &, SymmetricRankFourTensorTempl< T2 > &, void *)
 

Detailed Description

template<typename T>
class SymmetricRankFourTensorTempl< T >

SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor symmetry, C.

Since N is hard-coded to 3, SymmetricRankFourTensorTempl holds 36 separate C_ij entries. Within the code i,j = 0, .., 5.

Definition at line 69 of file SymmetricRankFourTensor.h.

Member Enumeration Documentation

◆ FillMethod

template<typename T>
enum SymmetricRankFourTensorTempl::FillMethod

To fill up the 36 entries in the 4th-order tensor, fillFromInputVector is called with one of the following fill_methods.

See the fill*FromInputVector functions for more details

Enumerator
symmetric9 
symmetric21 
symmetric_isotropic 
symmetric_isotropic_E_nu 
axisymmetric_rz 
principal 
orthotropic 

Definition at line 107 of file SymmetricRankFourTensor.h.

108  {
109  symmetric9, // fillSymmetric9FromInputVector
110  symmetric21, // fillSymmetric21FromInputVector
111  symmetric_isotropic, // fillSymmetricIsotropicFromInputVector
112  symmetric_isotropic_E_nu, // fillSymmetricIsotropicEandNu
113  axisymmetric_rz, // fillAxisymmetricRZFromInputVector
114  principal, // fillPrincipalFromInputVector
115  orthotropic // fillGeneralOrthotropicFromInputVector
116  };

◆ InitMethod

template<typename T>
enum SymmetricRankFourTensorTempl::InitMethod

Constructor & Destructor Documentation

◆ SymmetricRankFourTensorTempl() [1/6]

Default constructor; fills to zero.

Definition at line 48 of file SymmetricRankFourTensorImplementation.h.

49 {
50  mooseAssert(Ndim == 3,
51  "SymmetricRankFourTensorTempl<T> is designed to only work in 3 dimensions.");
52  zero();
53 }
static constexpr unsigned int Ndim
tensor dimension, Mandel matrix dimension, and Mandel matrix size

◆ SymmetricRankFourTensorTempl() [2/6]

template<typename T >
SymmetricRankFourTensorTempl< T >::SymmetricRankFourTensorTempl ( const InitMethod  init)

Select specific initialization pattern.

Definition at line 56 of file SymmetricRankFourTensorImplementation.h.

57 {
58  switch (init)
59  {
60  case initNone:
61  break;
62 
63  case initIdentity:
64  zero();
65  for (const auto i : make_range(Ndim))
66  (*this)(i, i) = 1.0;
67  break;
68 
70  zero();
71  for (const auto i : make_range(N))
72  (*this)(i, i) = 1.0;
73  break;
74 
75  default:
76  mooseError("Unknown SymmetricRankFourTensorTempl<T> initialization pattern.");
77  }
78 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
static constexpr unsigned int N
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int Ndim
tensor dimension, Mandel matrix dimension, and Mandel matrix size

◆ SymmetricRankFourTensorTempl() [3/6]

template<typename T >
SymmetricRankFourTensorTempl< T >::SymmetricRankFourTensorTempl ( const std::vector< T > &  input,
FillMethod  fill_method 
)

Fill from vector.

Definition at line 120 of file SymmetricRankFourTensorImplementation.h.

122 {
123  fillFromInputVector(input, fill_method);
124 }
void fillFromInputVector(const std::vector< T > &input, FillMethod fill_method)
fillFromInputVector takes some number of inputs to fill the Rank-4 tensor.

◆ SymmetricRankFourTensorTempl() [4/6]

template<typename T>
SymmetricRankFourTensorTempl< T >::SymmetricRankFourTensorTempl ( const SymmetricRankFourTensorTempl< T > &  a)
default

Copy assignment operator must be defined if used.

◆ SymmetricRankFourTensorTempl() [5/6]

template<typename T >
template<typename T2 >
SymmetricRankFourTensorTempl< T >::SymmetricRankFourTensorTempl ( const SymmetricRankFourTensorTempl< T2 > &  copy)

Copy constructor.

Definition at line 450 of file SymmetricRankFourTensor.h.

452 {
453  for (const auto i : make_range(N2))
454  _vals[i] = copy._vals[i];
455 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ SymmetricRankFourTensorTempl() [6/6]

template<typename T >
SymmetricRankFourTensorTempl< T >::SymmetricRankFourTensorTempl ( const RankFourTensorTempl< T > &  a)
explicit

Copy constructor from RankFourTensorTempl<T>

Definition at line 81 of file SymmetricRankFourTensorImplementation.h.

82 {
83  for (const auto a : make_range(N))
84  for (const auto b : make_range(N))
85  {
86  const auto & idx = full_index[a][b];
87  auto i = idx[0];
88  auto j = idx[1];
89  auto k = idx[2];
90  auto l = idx[3];
91  (*this)(a, b) =
92  (t(i, j, k, l) + t(j, i, l, k) + t(j, i, k, l) + t(i, j, l, k)) / 4 * mandelFactor(a, b);
93  }
94 }
static constexpr Real mandelFactor(unsigned int i, unsigned int j)
returns the 1, sqrt(2), or 2 prefactor in the Mandel notation for the indices i,j ranging from 0-5...
static constexpr unsigned int N
static constexpr unsigned int full_index[6][6][4]
IntRange< T > make_range(T beg, T end)
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)

Member Function Documentation

◆ fillAxisymmetricRZFromInputVector()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillAxisymmetricRZFromInputVector ( const std::vector< T > &  input)
protected

fillAxisymmetricRZFromInputVector takes 5 inputs to fill the axisymmetric Rank-4 tensor with the appropriate symmetries maintatined for use with axisymmetric problems using coord_type = RZ.

I.e. C1111 = C2222, C1133 = C2233, C2323 = C3131 and C1212 = 0.5*(C1111-C1122)

Parameters
inputthis is C1111, C1122, C1133, C3333, C2323.

Definition at line 382 of file SymmetricRankFourTensorImplementation.h.

383 {
384  mooseAssert(input.size() == 5,
385  "To use fillAxisymmetricRZFromInputVector, your input must have size 5.");
386 
387  // C1111 C1122 C1133 0 0 0
388  // C2222 C2233=C1133 0 0 0
389  // C3333 0 0 0
390  // C2323 0 0
391  // C3131=C2323 0
392  // C1212
393  // clang-format off
394  fillSymmetric21FromInputVector(std::array<T,21>
395  {{input[0],input[1],input[2], 0.0, 0.0, 0.0,
396  input[0],input[2], 0.0, 0.0, 0.0,
397  input[3], 0.0, 0.0, 0.0,
398  input[4], 0.0, 0.0,
399  input[4], 0.0,
400  (input[0] - input[1]) * 0.5}});
401  // clang-format on
402 }
void fillSymmetric21FromInputVector(const T2 &input)
fillSymmetric21FromInputVector takes 21 inputs to fill in the Rank-4 tensor with the appropriate crys...

◆ fillFromInputVector()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillFromInputVector ( const std::vector< T > &  input,
FillMethod  fill_method 
)

fillFromInputVector takes some number of inputs to fill the Rank-4 tensor.

Parameters
inputthe numbers that will be placed in the tensor
fill_methodSee FillMethod

Definition at line 299 of file SymmetricRankFourTensorImplementation.h.

301 {
302 
303  switch (fill_method)
304  {
305  case symmetric9:
307  break;
308  case symmetric21:
310  break;
311  case symmetric_isotropic:
313  break;
316  break;
317  case axisymmetric_rz:
319  break;
320  case principal:
322  break;
323  case orthotropic:
325  break;
326  default:
327  mooseError("fillFromInputVector called with unknown fill_method of ", fill_method);
328  }
329 }
void fillAxisymmetricRZFromInputVector(const std::vector< T > &input)
fillAxisymmetricRZFromInputVector takes 5 inputs to fill the axisymmetric Rank-4 tensor with the appr...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
void fillSymmetric21FromInputVector(const T2 &input)
fillSymmetric21FromInputVector takes 21 inputs to fill in the Rank-4 tensor with the appropriate crys...
void fillSymmetricIsotropicEandNuFromInputVector(const std::vector< T > &input)
fillSymmetricIsotropicEandNuFromInputVector is a variation of the fillSymmetricIsotropicFromInputVect...
void fillPrincipalFromInputVector(const std::vector< T > &input)
fillPrincipalFromInputVector takes 9 inputs to fill a Rank-4 tensor C1111 = input0 C1122 = input1 C11...
void fillSymmetricIsotropicFromInputVector(const std::vector< T > &input)
fillSymmetricIsotropicFromInputVector takes 2 inputs to fill the the symmetric Rank-4 tensor with the...
void fillGeneralOrthotropicFromInputVector(const std::vector< T > &input)
fillGeneralOrhotropicFromInputVector takes 10 inputs to fill the Rank-4 tensor It defines a general o...
void fillSymmetric9FromInputVector(const T2 &input)
fillSymmetric9FromInputVector takes 9 inputs to fill in the Rank-4 tensor with the appropriate crysta...

◆ fillGeneralOrthotropicFromInputVector()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillGeneralOrthotropicFromInputVector ( const std::vector< T > &  input)
protected

fillGeneralOrhotropicFromInputVector takes 10 inputs to fill the Rank-4 tensor It defines a general orthotropic tensor for which some constraints among elastic parameters exist

Parameters
inputEa, Eb, Ec, Gab, Gbc, Gca, nuba, nuca, nucb, nuab, nuac, nubc

Definition at line 428 of file SymmetricRankFourTensorImplementation.h.

429 {
430  mooseAssert(LIBMESH_DIM == 3, "This method assumes LIBMESH_DIM == 3");
431  if (input.size() != 12)
432  mooseError("To use fillGeneralOrhotropicFromInputVector, your input must have size 12. Yours "
433  "has size ",
434  input.size());
435 
436  const T & Ea = input[0];
437  const T & Eb = input[1];
438  const T & Ec = input[2];
439  const T & Gab = input[3];
440  const T & Gbc = input[4];
441  const T & Gca = input[5];
442  const T & nuba = input[6];
443  const T & nuca = input[7];
444  const T & nucb = input[8];
445  const T & nuab = input[9];
446  const T & nuac = input[10];
447  const T & nubc = input[11];
448 
449  // Input must satisfy constraints.
450  bool preserve_symmetry = MooseUtils::relativeFuzzyEqual(nuab * Eb, nuba * Ea) &&
451  MooseUtils::relativeFuzzyEqual(nuca * Ea, nuac * Ec) &&
452  MooseUtils::relativeFuzzyEqual(nubc * Ec, nucb * Eb);
453 
454  if (!preserve_symmetry)
455  mooseError("Orthotropic elasticity tensor input is not consistent with symmetry requirements. "
456  "Check input for accuracy");
457 
458  zero();
459  T k = 1 - nuab * nuba - nubc * nucb - nuca * nuac - nuab * nubc * nuca - nuba * nucb * nuac;
460 
461  bool is_positive_definite =
462  (k > 0) && (1 - nubc * nucb) > 0 && (1 - nuac * nuca) > 0 && (1 - nuab * nuba) > 0;
463  if (!is_positive_definite)
464  mooseError("Orthotropic elasticity tensor input is not positive definite. Check input for "
465  "accuracy");
466 
467  _vals[0] = Ea * (1 - nubc * nucb) / k;
468  _vals[1] = Ea * (nubc * nuca + nuba) / k;
469  _vals[2] = Ea * (nuba * nucb + nuca) / k;
470 
471  _vals[6] = Eb * (nuac * nucb + nuab) / k;
472  _vals[7] = Eb * (1 - nuac * nuca) / k;
473  _vals[8] = Eb * (nuab * nuca + nucb) / k;
474 
475  _vals[12] = Ec * (nuab * nubc + nuac) / k;
476  _vals[13] = Ec * (nuac * nuba + nubc) / k;
477  _vals[14] = Ec * (1 - nuab * nuba) / k;
478 
479  _vals[21] = 2 * Gbc;
480  _vals[28] = 2 * Gca;
481  _vals[35] = 2 * Gab;
482 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
bool relativeFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within a relative tolerance.
Definition: MooseUtils.h:492

◆ fillMethodEnum()

template<typename T >
MooseEnum SymmetricRankFourTensorTempl< T >::fillMethodEnum ( )
static

Static method for use in validParams for getting the "fill_method".

Definition at line 41 of file SymmetricRankFourTensorImplementation.h.

42 {
43  return MooseEnum("symmetric9 symmetric21 symmetric_isotropic symmetric_isotropic_E_nu "
44  "axisymmetric_rz principal orthotropic");
45 }
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33

◆ fillPrincipalFromInputVector()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillPrincipalFromInputVector ( const std::vector< T > &  input)
protected

fillPrincipalFromInputVector takes 9 inputs to fill a Rank-4 tensor C1111 = input0 C1122 = input1 C1133 = input2 C2211 = input3 C2222 = input4 C2233 = input5 C3311 = input6 C3322 = input7 C3333 = input8 with all other components being zero

Definition at line 406 of file SymmetricRankFourTensorImplementation.h.

407 {
408  if (input.size() != 9)
409  mooseError("To use fillPrincipalFromInputVector, your input must have size 9. Yours has size ",
410  input.size());
411 
412  zero();
413 
414  // top left block
415  _vals[0] = input[0];
416  _vals[1] = input[1];
417  _vals[2] = input[2];
418  _vals[6] = input[3];
419  _vals[7] = input[4];
420  _vals[8] = input[5];
421  _vals[12] = input[6];
422  _vals[13] = input[7];
423  _vals[14] = input[8];
424 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

◆ fillSymmetric21FromInputVector()

template<typename T >
template<typename T2 >
void SymmetricRankFourTensorTempl< T >::fillSymmetric21FromInputVector ( const T2 &  input)

fillSymmetric21FromInputVector takes 21 inputs to fill in the Rank-4 tensor with the appropriate crystal symmetries maintained.

I.e., C_ijkl = C_klij, C_ijkl = C_ijlk, C_ijkl = C_jikl

Parameters
inputis C1111 C1122 C1133 C1123 C1113 C1112 C2222 C2233 C2223 C2213 C2212 C3333 C3323 C3313 C3312 C2323 C2313 C2312 C1313 C1312 C1212

Definition at line 537 of file SymmetricRankFourTensor.h.

538 {
539  // C1111 C1122 C1133 C1123 C1113 C1112
540  // C2222 C2233 C2223 C2213 C2212
541  // C3333 C3323 C3313 C3312
542  // C2323 C2313 C2312
543  // C1313 C1312
544  // C1212
545 
546  mooseAssert(LIBMESH_DIM == 3, "This method assumes LIBMESH_DIM == 3");
547  mooseAssert(input.size() == 21,
548  "To use fillSymmetric21FromInputVector, your input must have size 21.");
549  std::size_t index = 0;
550  for (const auto i : make_range(N))
551  for (const auto j : make_range(i, N))
552  {
553  _vals[i + N * j] = mandelFactor(i, j) * input[index];
554  _vals[j + N * i] = mandelFactor(j, i) * input[index];
555  index++;
556  }
557 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr Real mandelFactor(unsigned int i, unsigned int j)
returns the 1, sqrt(2), or 2 prefactor in the Mandel notation for the indices i,j ranging from 0-5...
static constexpr unsigned int N
IntRange< T > make_range(T beg, T end)

◆ fillSymmetric9FromInputVector()

template<typename T >
template<typename T2 >
void SymmetricRankFourTensorTempl< T >::fillSymmetric9FromInputVector ( const T2 &  input)

fillSymmetric9FromInputVector takes 9 inputs to fill in the Rank-4 tensor with the appropriate crystal symmetries maintained.

I.e., C_ijkl = C_klij, C_ijkl = C_ijlk, C_ijkl = C_jikl

Parameters
inputis: C1111 C1122 C1133 C2222 C2233 C3333 C2323 C1313 C1212 In the isotropic case this is (la is first Lame constant, mu is second (shear) Lame constant) la+2mu la la la+2mu la la+2mu mu mu mu

Definition at line 510 of file SymmetricRankFourTensor.h.

511 {
512  mooseAssert(LIBMESH_DIM == 3, "This method assumes LIBMESH_DIM == 3");
513  mooseAssert(input.size() == 9,
514  "To use fillSymmetric9FromInputVector, your input must have size 9.");
515  zero();
516 
517  _vals[0] = input[0]; // C1111
518  _vals[7] = input[3]; // C2222
519  _vals[14] = input[5]; // C3333
520 
521  _vals[1] = _vals[6] = input[1]; // C1122
522  _vals[2] = _vals[12] = input[2]; // C1133
523  _vals[8] = _vals[13] = input[4]; // C2233
524 
525  static constexpr std::size_t C2323 = 21;
526  static constexpr std::size_t C1313 = 28;
527  static constexpr std::size_t C1212 = 35;
528 
529  _vals[C2323] = 2.0 * input[6];
530  _vals[C1313] = 2.0 * input[7];
531  _vals[C1212] = 2.0 * input[8];
532 }
std::array< T, N2 > _vals
The values of the rank-four tensor.

◆ fillSymmetricIsotropic()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillSymmetricIsotropic ( const T &  i0,
const T &  i1 
)

Vector-less fill API functions. See docs of the corresponding ...FromInputVector methods.

Definition at line 342 of file SymmetricRankFourTensorImplementation.h.

343 {
344  // clang-format off
345  fillSymmetric21FromInputVector(std::array<T,21>
346  {{lambda + 2.0 * G, lambda, lambda, 0.0, 0.0, 0.0,
347  lambda + 2.0 * G, lambda, 0.0, 0.0, 0.0,
348  lambda + 2.0 * G, 0.0, 0.0, 0.0,
349  G, 0.0, 0.0,
350  G, 0.0,
351  G}});
352  // clang-format on
353 }
void fillSymmetric21FromInputVector(const T2 &input)
fillSymmetric21FromInputVector takes 21 inputs to fill in the Rank-4 tensor with the appropriate crys...

◆ fillSymmetricIsotropicEandNu()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillSymmetricIsotropicEandNu ( const T &  E,
const T &  nu 
)

Definition at line 371 of file SymmetricRankFourTensorImplementation.h.

372 {
373  // Calculate lambda and the shear modulus from the given young's modulus and poisson's ratio
374  const T & lambda = E * nu / ((1.0 + nu) * (1.0 - 2.0 * nu));
375  const T & G = E / (2.0 * (1.0 + nu));
376 
377  fillSymmetricIsotropic(lambda, G);
378 }
void fillSymmetricIsotropic(const T &i0, const T &i1)
Vector-less fill API functions. See docs of the corresponding ...FromInputVector methods.

◆ fillSymmetricIsotropicEandNuFromInputVector()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillSymmetricIsotropicEandNuFromInputVector ( const std::vector< T > &  input)
protected

fillSymmetricIsotropicEandNuFromInputVector is a variation of the fillSymmetricIsotropicFromInputVector which takes as inputs the more commonly used Young's modulus (E) and Poisson's ratio (nu) constants to fill the isotropic elasticity tensor.

Using well-known formulas, E and nu are used to calculate lambda and mu and then the vector is passed to fillSymmetricIsotropicFromInputVector.

Parameters
inputYoung's modulus (E) and Poisson's ratio (nu)

Definition at line 357 of file SymmetricRankFourTensorImplementation.h.

359 {
360  if (input.size() != 2)
361  mooseError(
362  "To use fillSymmetricIsotropicEandNuFromInputVector, your input must have size 2. Yours "
363  "has size ",
364  input.size());
365 
366  fillSymmetricIsotropicEandNu(input[0], input[1]);
367 }
void fillSymmetricIsotropicEandNu(const T &E, const T &nu)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302

◆ fillSymmetricIsotropicFromInputVector()

template<typename T >
void SymmetricRankFourTensorTempl< T >::fillSymmetricIsotropicFromInputVector ( const std::vector< T > &  input)
protected

fillSymmetricIsotropicFromInputVector takes 2 inputs to fill the the symmetric Rank-4 tensor with the appropriate symmetries maintained.

C_ijkl = lambda*de_ij*de_kl + mu*(de_ik*de_jl + de_il*de_jk) where lambda is the first Lame modulus, mu is the second (shear) Lame modulus,

Parameters
inputthis is lambda and mu in the above formula

Definition at line 333 of file SymmetricRankFourTensorImplementation.h.

334 {
335  mooseAssert(input.size() == 2,
336  "To use fillSymmetricIsotropicFromInputVector, your input must have size 2.");
337  fillSymmetricIsotropic(input[0], input[1]);
338 }
void fillSymmetricIsotropic(const T &i0, const T &i1)
Vector-less fill API functions. See docs of the corresponding ...FromInputVector methods.

◆ identity()

template<typename T>
static SymmetricRankFourTensorTempl<T> SymmetricRankFourTensorTempl< T >::identity ( )
inlinestatic

Definition at line 164 of file SymmetricRankFourTensor.h.

165  {
167  }
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...

◆ identitySymmetricFour()

template<typename T>
static SymmetricRankFourTensorTempl<T> SymmetricRankFourTensorTempl< T >::identitySymmetricFour ( )
inlinestatic

Definition at line 168 of file SymmetricRankFourTensor.h.

169  {
171  };
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...

◆ invSymm()

template<typename T >
SymmetricRankFourTensorTempl< T > SymmetricRankFourTensorTempl< T >::invSymm ( ) const

This returns A_ijkl such that C_ijkl*A_klmn = 0.5*(de_im de_jn + de_in de_jm) This routine assumes that C_ijkl = C_jikl = C_ijlk.

Definition at line 561 of file SymmetricRankFourTensor.h.

562 {
564 
565  if constexpr (SymmetricRankFourTensorTempl<T>::N2 * sizeof(T) > EIGEN_STACK_ALLOCATION_LIMIT)
566  {
567  Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> mat(N, N);
568  for (const auto i : make_range(N))
569  for (const auto j : make_range(N))
570  mat(i, j) = (*this)(i, j);
571  mat = mat.inverse();
572  for (const auto i : make_range(N))
573  for (const auto j : make_range(N))
574  result(i, j) = mat(i, j);
575  }
576  else
577  {
578  const Eigen::Map<const Eigen::Matrix<T, N, N, Eigen::RowMajor>> mat(&_vals[0]);
579  Eigen::Map<Eigen::Matrix<T, N, N, Eigen::RowMajor>> res(&result._vals[0]);
580  res = mat.inverse();
581  }
582 
583  return result;
584 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
IntRange< T > make_range(T beg, T end)

◆ isIsotropic()

template<typename T >
bool SymmetricRankFourTensorTempl< T >::isIsotropic ( ) const

checks if the tensor is isotropic

Definition at line 522 of file SymmetricRankFourTensorImplementation.h.

523 {
524  // prerequisite is symmetry
525  if (!isSymmetric())
526  return false;
527 
528  // inspect shear components
529  const T & mu = _vals[35];
530 
531  // ...diagonal
532  if (_vals[28] != mu || _vals[21] != mu)
533  return false;
534 
535  // ...off-diagonal
536  if (_vals[22] != 0.0 || _vals[23] != 0.0 || _vals[29] != 0.0)
537  return false;
538 
539  // off diagonal blocks in Voigt
540  for (const auto i : make_range(3))
541  for (const auto j : make_range(3))
542  if (_vals[3 + i + N * j] != 0.0)
543  return false;
544 
545  // top left block
546  const T & K1 = _vals[0];
547  const T & K2 = _vals[1];
548  if (!MooseUtils::relativeFuzzyEqual(K1 - 2.0 * mu / 3.0, K2 + mu / 3.0))
549  return false;
550  if (_vals[7] != K1 || _vals[14] != K1)
551  return false;
552 
553  for (const auto i : make_range(1, 3))
554  for (const auto j : make_range(i))
555  if (_vals[i + N * j] != K2)
556  return false;
557 
558  return true;
559 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N
bool relativeFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within a relative tolerance.
Definition: MooseUtils.h:492
IntRange< T > make_range(T beg, T end)
bool isSymmetric() const
checks if the tensor is symmetric

◆ isSymmetric()

template<typename T >
bool SymmetricRankFourTensorTempl< T >::isSymmetric ( ) const

checks if the tensor is symmetric

Definition at line 510 of file SymmetricRankFourTensorImplementation.h.

511 {
512  for (unsigned int i = 0; i < N; ++i)
513  for (unsigned int j = 0; j < N; ++j)
514  // major symmetry
515  if (_vals[i + N * j] != _vals[N * i + j])
516  return false;
517  return true;
518 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N

◆ L2norm()

template<typename T >
T SymmetricRankFourTensorTempl< T >::L2norm ( ) const

sqrt(C_ijkl*C_ijkl)

Definition at line 251 of file SymmetricRankFourTensorImplementation.h.

252 {
253  T l2 = Utility::pow<2>(_vals[0]);
254  for (const auto i : make_range(1u, N2))
255  l2 += Utility::pow<2>(_vals[i]);
256  return std::sqrt(l2);
257 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
IntRange< T > make_range(T beg, T end)
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template pow< 2 >(tan(_arg))+1.0) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(sqrt
static constexpr unsigned int N2

◆ mandelFactor()

template<typename T>
static constexpr Real SymmetricRankFourTensorTempl< T >::mandelFactor ( unsigned int  i,
unsigned int  j 
)
inlinestatic

returns the 1, sqrt(2), or 2 prefactor in the Mandel notation for the indices i,j ranging from 0-5.

Definition at line 88 of file SymmetricRankFourTensor.h.

Referenced by SymmetricRankTwoTensorTempl< Real >::d2thirdInvariant(), and RankFourTensorTempl< T >::RankFourTensorTempl().

89  {
92  }
static constexpr Real mandelFactor(unsigned int i)
returns the 1 or sqrt(2) prefactor in the Mandel notation for the index i ranging from 0-5...

◆ operator RankFourTensorTempl< T >()

template<typename T >
SymmetricRankFourTensorTempl< T >::operator RankFourTensorTempl< T > ( )
explicit

The conversion operator to RankFourTensorTempl

Definition at line 97 of file SymmetricRankFourTensorImplementation.h.

98 {
99  auto & q = *this;
101  for (const auto a : make_range(N))
102  for (const auto b : make_range(N))
103  {
104  const auto i = full_index[a][b][0];
105  const auto j = full_index[a][b][1];
106  const auto k = full_index[a][b][2];
107  const auto l = full_index[a][b][3];
108 
109  // Rijkl = Rjikl = Rijlk = Rjilk
110  r(i, j, k, l) = q(a, b) / mandelFactor(a, b);
111  r(j, i, k, l) = q(a, b) / mandelFactor(a, b);
112  r(i, j, l, k) = q(a, b) / mandelFactor(a, b);
113  r(j, i, l, k) = q(a, b) / mandelFactor(a, b);
114  }
115 
116  return r;
117 }
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
static constexpr Real mandelFactor(unsigned int i, unsigned int j)
returns the 1, sqrt(2), or 2 prefactor in the Mandel notation for the indices i,j ranging from 0-5...
static constexpr unsigned int N
static constexpr unsigned int full_index[6][6][4]
IntRange< T > make_range(T beg, T end)

◆ operator()() [1/2]

template<typename T>
T& SymmetricRankFourTensorTempl< T >::operator() ( unsigned int  i,
unsigned int  j 
)
inline

Gets the value for the indices specified. Takes indices ranging from 0-5 for i and j.

Definition at line 174 of file SymmetricRankFourTensor.h.

174 { return _vals[i * N + j]; }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N

◆ operator()() [2/2]

template<typename T>
const T& SymmetricRankFourTensorTempl< T >::operator() ( unsigned int  i,
unsigned int  j 
) const
inline

Gets the value for the indices specified.

Takes indices ranging from 0-5 for i and j. used for const

Definition at line 180 of file SymmetricRankFourTensor.h.

180 { return _vals[i * N + j]; }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N

◆ operator*() [1/3]

template<typename T >
template<typename T2 >
auto SymmetricRankFourTensorTempl< T >::operator* ( const SymmetricRankTwoTensorTempl< T2 > &  b) const -> SymmetricRankTwoTensorTempl<decltype(T() * T2())>

C_ijkl*a_kl.

Definition at line 476 of file SymmetricRankFourTensor.h.

478 {
479  typedef decltype(T() * T2()) ValueType;
480  SymmetricRankTwoTensorTempl<ValueType> result;
481 
482  std::size_t index = 0;
483  for (const auto i : make_range(N))
484  {
485  ValueType tmp = 0.0;
486  for (const auto j : make_range(N))
487  tmp += _vals[index++] * b._vals[j];
488  result._vals[i] = tmp;
489  }
490 
491  return result;
492 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N
SymmetricRankTwoTensorTempl is designed to handle the Stress or Strain Tensor for an anisotropic mate...
IntRange< T > make_range(T beg, T end)
for(PetscInt i=0;i< nvars;++i)

◆ operator*() [2/3]

template<typename T >
template<typename T2 >
auto SymmetricRankFourTensorTempl< T >::operator* ( const T2 &  a) const -> typename std::enable_if<libMesh::ScalarTraits<T2>::value, SymmetricRankFourTensorTempl<decltype(T() * T2())>>::type

C_ijkl*a.

Definition at line 460 of file SymmetricRankFourTensor.h.

463 {
464  typedef decltype(T() * T2()) ValueType;
465  SymmetricRankFourTensorTempl<ValueType> result;
466 
467  for (const auto i : make_range(N2))
468  result._vals[i] = _vals[i] * b;
469 
470  return result;
471 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
for(PetscInt i=0;i< nvars;++i)
static constexpr unsigned int N2

◆ operator*() [3/3]

template<typename T >
template<typename T2 >
auto SymmetricRankFourTensorTempl< T >::operator* ( const SymmetricRankFourTensorTempl< T2 > &  a) const -> SymmetricRankFourTensorTempl<decltype(T() * T2())>

C_ijpq*a_pqkl.

Definition at line 235 of file SymmetricRankFourTensorImplementation.h.

237 {
238  typedef decltype(T() * T2()) ValueType;
239  SymmetricRankFourTensorTempl<ValueType> result;
240 
241  for (const auto i : make_range(N))
242  for (const auto j : make_range(N))
243  for (const auto p : make_range(N))
244  result(i, j) += (*this)(i, p) * b(p, j);
245 
246  return result;
247 }
static constexpr unsigned int N
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
for(PetscInt i=0;i< nvars;++i)

◆ operator*=()

template<typename T >
SymmetricRankFourTensorTempl< T > & SymmetricRankFourTensorTempl< T >::operator*= ( const T &  a)

C_ijkl *= a.

Definition at line 164 of file SymmetricRankFourTensorImplementation.h.

165 {
166  for (const auto i : make_range(N2))
167  _vals[i] *= a;
168  return *this;
169 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator+()

template<typename T >
template<typename T2 >
auto SymmetricRankFourTensorTempl< T >::operator+ ( const SymmetricRankFourTensorTempl< T2 > &  a) const -> SymmetricRankFourTensorTempl<decltype(T() + T2())>

C_ijkl + a_ijkl.

Definition at line 192 of file SymmetricRankFourTensorImplementation.h.

194 {
196  for (const auto i : make_range(N2))
197  result._vals[i] = _vals[i] + b._vals[i];
198  return result;
199 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator+=()

template<typename T >
SymmetricRankFourTensorTempl< T > & SymmetricRankFourTensorTempl< T >::operator+= ( const SymmetricRankFourTensorTempl< T > &  a)

C_ijkl += a_ijkl for all i, j, k, l.

Definition at line 182 of file SymmetricRankFourTensorImplementation.h.

183 {
184  for (const auto i : make_range(N2))
185  _vals[i] += a._vals[i];
186  return *this;
187 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator-() [1/2]

template<typename T >
template<typename T2 >
auto SymmetricRankFourTensorTempl< T >::operator- ( const SymmetricRankFourTensorTempl< T2 > &  a) const -> SymmetricRankFourTensorTempl<decltype(T() - T2())>

C_ijkl - a_ijkl.

Definition at line 213 of file SymmetricRankFourTensorImplementation.h.

215 {
216  SymmetricRankFourTensorTempl<decltype(T() - T2())> result;
217  for (const auto i : make_range(N2))
218  result._vals[i] = _vals[i] - b._vals[i];
219  return result;
220 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator-() [2/2]

template<typename T >
SymmetricRankFourTensorTempl< T > SymmetricRankFourTensorTempl< T >::operator- ( ) const

-C_ijkl

Definition at line 224 of file SymmetricRankFourTensorImplementation.h.

225 {
227  for (const auto i : make_range(N2))
228  result._vals[i] = -_vals[i];
229  return result;
230 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator-=()

template<typename T >
SymmetricRankFourTensorTempl< T > & SymmetricRankFourTensorTempl< T >::operator-= ( const SymmetricRankFourTensorTempl< T > &  a)

C_ijkl -= a_ijkl.

Definition at line 203 of file SymmetricRankFourTensorImplementation.h.

204 {
205  for (const auto i : make_range(N2))
206  _vals[i] -= a._vals[i];
207  return *this;
208 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator/()

template<typename T >
template<typename T2 >
auto SymmetricRankFourTensorTempl< T >::operator/ ( const T2 &  a) const -> typename std::enable_if<libMesh::ScalarTraits<T2>::value, SymmetricRankFourTensorTempl<decltype(T() / T2())>>::type

C_ijkl/a.

Definition at line 497 of file SymmetricRankFourTensor.h.

500 {
501  SymmetricRankFourTensorTempl<decltype(T() / T2())> result;
502  for (const auto i : make_range(N2))
503  result._vals[i] = _vals[i] / b;
504  return result;
505 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator/=()

template<typename T >
SymmetricRankFourTensorTempl< T > & SymmetricRankFourTensorTempl< T >::operator/= ( const T &  a)

C_ijkl /= a for all i, j, k, l.

Definition at line 173 of file SymmetricRankFourTensorImplementation.h.

174 {
175  for (const auto i : make_range(N2))
176  _vals[i] /= a;
177  return *this;
178 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
IntRange< T > make_range(T beg, T end)
static constexpr unsigned int N2

◆ operator=() [1/2]

template<typename T>
SymmetricRankFourTensorTempl<T>& SymmetricRankFourTensorTempl< T >::operator= ( const SymmetricRankFourTensorTempl< T > &  a)
default

copies values from a into this tensor

◆ operator=() [2/2]

template<typename T>
template<typename Scalar >
boostcopy::enable_if_c<libMesh::ScalarTraits<Scalar>::value, SymmetricRankFourTensorTempl &>::type SymmetricRankFourTensorTempl< T >::operator= ( const Scalar &  libmesh_dbg_varp)
inline

Assignment-from-scalar operator.

Used only to zero out the tensor.

Returns
A reference to *this.

Definition at line 208 of file SymmetricRankFourTensor.h.

209  {
210  libmesh_assert_equal_to(p, Scalar(0));
211  this->zero();
212  return *this;
213  }

◆ print()

template<typename T >
void SymmetricRankFourTensorTempl< T >::print ( std::ostream &  stm = Moose::out) const

Print the rank four tensor.

Definition at line 261 of file SymmetricRankFourTensorImplementation.h.

262 {
263  for (const auto i : make_range(N))
264  {
265  for (const auto j : make_range(N))
266  stm << std::setw(15) << _vals[i * N + j] << " ";
267  stm << '\n';
268  }
269  stm << std::flush;
270 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N
IntRange< T > make_range(T beg, T end)

◆ printReal()

template<typename T >
void SymmetricRankFourTensorTempl< T >::printReal ( std::ostream &  stm = Moose::out) const

Print the values of the rank four tensor.

Definition at line 274 of file SymmetricRankFourTensorImplementation.h.

275 {
276  for (const auto i : make_range(N))
277  {
278  for (const auto j : make_range(N))
279  stm << std::setw(15) << MetaPhysicL::raw_value(_vals[i * N + j]) << " ";
280  stm << '\n';
281  }
282  stm << std::flush;
283 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
static constexpr unsigned int N
IntRange< T > make_range(T beg, T end)

◆ rotate()

template<typename T >
void SymmetricRankFourTensorTempl< T >::rotate ( const TypeTensor< T > &  R)

Rotate the tensor using C_ijkl = R_im R_jn R_ko R_lp C_mnop.

Definition at line 153 of file SymmetricRankFourTensorImplementation.h.

154 {
155  // build 6x6 rotation matrix
157 
158  // rotate tensor
159  (*this) = M * (*this) * M.transposeMajor();
160 }
static SymmetricRankFourTensorTempl< T > rotationMatrix(const TypeTensor< T > &R)
Build a 6x6 rotation matrix MEHRABADI, MORTEZA M.

◆ rotationMatrix()

template<typename T >
SymmetricRankFourTensorTempl< T > SymmetricRankFourTensorTempl< T >::rotationMatrix ( const TypeTensor< T > &  R)
static

Build a 6x6 rotation matrix MEHRABADI, MORTEZA M.

; COWIN, STEPHEN C. (1990). EIGENTENSORS OF LINEAR ANISOTROPIC ELASTIC MATERIALS. The Quarterly Journal of Mechanics and Applied Mathematics, 43(1), 15-41. doi:10.1093/qjmam/43.1.15

Definition at line 135 of file SymmetricRankFourTensorImplementation.h.

Referenced by SymmetricRankTwoTensorTempl< Real >::rotate(), and SymmetricRankFourTensorTempl< T >::rotate().

136 {
138  const static std::array<std::size_t, 3> a = {{1, 0, 0}};
139  const static std::array<std::size_t, 3> b = {{2, 2, 1}};
140  for (std::size_t i = 0; i < 3; ++i)
141  for (std::size_t j = 0; j < 3; ++j)
142  {
143  M(i, j) = R(i, j) * R(i, j);
144  M(i + 3, j) = MathUtils::sqrt2 * R((i + 1) % 3, j) * R((i + 2) % 3, j);
145  M(j, i + 3) = MathUtils::sqrt2 * R(j, (i + 1) % 3) * R(j, (i + 2) % 3);
146  M(i + 3, j + 3) = R(a[i], a[j]) * R(b[i], b[j]) + R(a[i], b[j]) * R(b[i], a[j]);
147  }
148  return M;
149 }
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
static constexpr Real sqrt2
std::sqrt is not constexpr, so we add sqrt(2) as a constant (used in Mandel notation) ...
Definition: MathUtils.h:25

◆ sum3x1()

template<typename T >
libMesh::VectorValue< T > SymmetricRankFourTensorTempl< T >::sum3x1 ( ) const

Calculates the vector a[i] = sum over j Ciijj for i and j varying from 0 to 2.

Definition at line 499 of file SymmetricRankFourTensorImplementation.h.

500 {
501  mooseAssert(LIBMESH_DIM == 3, "This method assumes LIBMESH_DIM == 3");
502  // used for volumetric locking correction
503  return libMesh::VectorValue<T>(_vals[0] + _vals[1] + _vals[2],
504  _vals[6] + _vals[7] + _vals[8],
505  _vals[12] + _vals[13] + _vals[14]);
506 }
std::array< T, N2 > _vals
The values of the rank-four tensor.

◆ sum3x3()

template<typename T >
T SymmetricRankFourTensorTempl< T >::sum3x3 ( ) const

Calculates the sum of Ciijj for i and j varying from 0 to 2.

Definition at line 486 of file SymmetricRankFourTensorImplementation.h.

487 {
488  mooseAssert(LIBMESH_DIM == 3, "This method assumes LIBMESH_DIM == 3");
489  // summation of Ciijj used in the volumetric locking correction
490  T sum = 0;
491  for (const auto i : make_range(3))
492  for (const auto j : make_range(3))
493  sum += (*this)(i, j);
494  return sum;
495 }
IntRange< T > make_range(T beg, T end)

◆ transposeIj()

template<typename T>
SymmetricRankFourTensorTempl<T> SymmetricRankFourTensorTempl< T >::transposeIj ( ) const
inline

Transpose the tensor by swapping the first two indices - a no-op.

Definition at line 295 of file SymmetricRankFourTensor.h.

295 { return *this; }

◆ transposeMajor()

template<typename T >
SymmetricRankFourTensorTempl< T > SymmetricRankFourTensorTempl< T >::transposeMajor ( ) const

Transpose the tensor by swapping the first pair with the second pair of indices This amounts to a regular transpose of the 6x6 matrix.

Returns
C_klji

Definition at line 287 of file SymmetricRankFourTensorImplementation.h.

288 {
289  std::size_t index = 0;
291  for (const auto i : make_range(N))
292  for (const auto j : make_range(N))
293  ret._vals[index++] = _vals[i + N * j];
294  return ret;
295 }
std::array< T, N2 > _vals
The values of the rank-four tensor.
static constexpr unsigned int N
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
IntRange< T > make_range(T beg, T end)

◆ zero()

template<typename T >
void SymmetricRankFourTensorTempl< T >::zero ( )

Zeros out the tensor.

Definition at line 128 of file SymmetricRankFourTensorImplementation.h.

Referenced by SymmetricRankFourTensorTempl< T >::operator=().

129 {
130  std::fill(_vals.begin(), _vals.end(), 0.0);
131 }
std::array< T, N2 > _vals
The values of the rank-four tensor.

Friends And Related Function Documentation

◆ dataLoad

template<typename T>
template<class T2 >
void dataLoad ( std::istream &  ,
SymmetricRankFourTensorTempl< T2 > &  ,
void  
)
friend

◆ dataStore

template<typename T>
template<class T2 >
void dataStore ( std::ostream &  ,
SymmetricRankFourTensorTempl< T2 > &  ,
void  
)
friend

◆ operator<<

template<typename T>
std::ostream& operator<< ( std::ostream &  os,
const SymmetricRankFourTensorTempl< T > &  t 
)
friend

Definition at line 191 of file SymmetricRankFourTensor.h.

192  {
193  t.print(os);
194  return os;
195  }
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:33
void print(std::ostream &stm=Moose::out) const
Print the rank four tensor.

◆ RankThreeTensorTempl

template<typename T>
template<typename T2 >
friend class RankThreeTensorTempl
friend

Definition at line 417 of file SymmetricRankFourTensor.h.

◆ SymmetricRankFourTensorTempl

template<typename T>
template<typename T2 >
friend class SymmetricRankFourTensorTempl
friend

Definition at line 415 of file SymmetricRankFourTensor.h.

◆ SymmetricRankTwoTensorTempl

template<typename T>
template<typename T2 >
friend class SymmetricRankTwoTensorTempl
friend

Definition at line 413 of file SymmetricRankFourTensor.h.

Member Data Documentation

◆ _vals

template<typename T>
std::array<T, N2> SymmetricRankFourTensorTempl< T >::_vals
protected

◆ full_index

template<typename T>
constexpr unsigned int SymmetricRankFourTensorTempl< T >::full_index[6][6][4]
static
Initial value:
= {
{{0, 0, 0, 0}, {0, 0, 1, 1}, {0, 0, 2, 2}, {0, 0, 1, 2}, {0, 0, 0, 2}, {0, 0, 0, 1}},
{{1, 1, 0, 0}, {1, 1, 1, 1}, {1, 1, 2, 2}, {1, 1, 1, 2}, {1, 1, 0, 2}, {1, 1, 0, 1}},
{{2, 2, 0, 0}, {2, 2, 1, 1}, {2, 2, 2, 2}, {2, 2, 1, 2}, {2, 2, 0, 2}, {2, 2, 0, 1}},
{{1, 2, 0, 0}, {1, 2, 1, 1}, {1, 2, 2, 2}, {1, 2, 1, 2}, {1, 2, 0, 2}, {1, 2, 0, 1}},
{{0, 2, 0, 0}, {0, 2, 1, 1}, {0, 2, 2, 2}, {0, 2, 1, 2}, {0, 2, 0, 2}, {0, 2, 0, 1}},
{{0, 1, 0, 0}, {0, 1, 1, 1}, {0, 1, 2, 2}, {0, 1, 1, 2}, {0, 1, 0, 2}, {0, 1, 0, 1}}}

Definition at line 79 of file SymmetricRankFourTensor.h.

◆ N

template<typename T>
constexpr unsigned int SymmetricRankFourTensorTempl< T >::N = Ndim + Ndim * (Ndim - 1) / 2
static

◆ N2

template<typename T>
constexpr unsigned int SymmetricRankFourTensorTempl< T >::N2 = N * N
static

Definition at line 75 of file SymmetricRankFourTensor.h.

◆ Ndim

template<typename T>
constexpr unsigned int SymmetricRankFourTensorTempl< T >::Ndim = LIBMESH_DIM
static

tensor dimension, Mandel matrix dimension, and Mandel matrix size

Definition at line 73 of file SymmetricRankFourTensor.h.


The documentation for this class was generated from the following files: