https://mooseframework.inl.gov
Loading...
Searching...
No Matches
RankFourTensor.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#include "Moose.h"
13#include "MooseTypes.h"
17#include "MooseError.h"
18
19#include "libmesh/libmesh.h"
20#include "libmesh/tuple_of.h"
21#include "libmesh/int_range.h"
22
23#include "metaphysicl/raw_type.h"
24
25#include <petscsys.h>
26
27#include <Eigen/Core>
28#include <Eigen/Dense>
29
31namespace libMesh
32{
33template <typename>
34class TensorValue;
35template <typename>
36class TypeTensor;
37template <typename>
38class VectorValue;
39}
40
41// Forward declarations
42class MooseEnum;
43
44namespace MathUtils
45{
46template <typename T>
47void mooseSetToZero(T & v);
48
53template <>
55template <>
57}
58
64template <typename T>
66{
67public:
69 static constexpr unsigned int N = Moose::dim;
70 static constexpr unsigned int N2 = N * N;
71 static constexpr unsigned int N3 = N * N * N;
72 static constexpr unsigned int N4 = N * N * N * N;
74
75 typedef tuple_of<4, unsigned int> index_type;
76 typedef T value_type;
77
87
107
108 template <template <typename> class Tensor, typename Scalar>
110 {
111 static const bool value = false;
112 };
113 template <typename Scalar>
118 template <typename Scalar>
119 struct TwoTensorMultTraits<TensorValue, Scalar>
120 {
122 };
123 template <typename Scalar>
124 struct TwoTensorMultTraits<TypeTensor, Scalar>
125 {
127 };
128
131
134
136 RankFourTensorTempl(const std::vector<T> &, FillMethod);
137
140
144 template <typename T2>
146
150 template <typename T2>
152 {
153 for (const auto a : make_range(SymmetricRankFourTensorTempl<T2>::N))
154 for (const auto b : make_range(SymmetricRankFourTensorTempl<T2>::N))
155 {
156 const auto & idx = SymmetricRankFourTensorTempl<T2>::full_index[a][b];
157 const auto i = idx[0];
158 const auto j = idx[1];
159 const auto k = idx[2];
160 const auto l = idx[3];
161
162 // Rijkl = Rjikl = Rijlk = Rjilk
163 (*this)(i, j, k, l) = t(a, b) / SymmetricRankFourTensorTempl<T2>::mandelFactor(a, b);
164 (*this)(j, i, k, l) = t(a, b) / SymmetricRankFourTensorTempl<T2>::mandelFactor(a, b);
165 (*this)(i, j, l, k) = t(a, b) / SymmetricRankFourTensorTempl<T2>::mandelFactor(a, b);
166 (*this)(j, i, l, k) = t(a, b) / SymmetricRankFourTensorTempl<T2>::mandelFactor(a, b);
167 }
168 }
169
170 // Named constructors
178
180 inline T & operator()(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
181 {
182 return _vals[i * N3 + j * N2 + k * N + l];
183 }
184
189 inline const T & operator()(unsigned int i, unsigned int j, unsigned int k, unsigned int l) const
190 {
191 return _vals[i * N3 + j * N2 + k * N + l];
192 }
193
195 void zero();
196
198 void print(std::ostream & stm = Moose::out) const;
199
200 friend std::ostream & operator<<(std::ostream & os, const RankFourTensorTempl<T> & t)
201 {
202 t.print(os);
203 return os;
204 }
205
207 void printReal(std::ostream & stm = Moose::out) const;
208
211
217 template <typename Scalar>
218 typename std::enable_if<libMesh::ScalarTraits<Scalar>::value, RankFourTensorTempl &>::type
219 operator=(const Scalar & libmesh_dbg_var(p))
220 {
221 libmesh_assert_equal_to(p, Scalar(0));
222 this->zero();
223 return *this;
224 }
225
227 template <template <typename> class Tensor, typename T2>
228 auto operator*(const Tensor<T2> & a) const ->
229 typename std::enable_if<TwoTensorMultTraits<Tensor, T2>::value,
230 RankTwoTensorTempl<decltype(T() * T2())>>::type;
231
233 template <typename T2>
234 auto operator*(const T2 & a) const ->
235 typename std::enable_if<libMesh::ScalarTraits<T2>::value,
236 RankFourTensorTempl<decltype(T() * T2())>>::type;
237
239 RankFourTensorTempl<T> & operator*=(const T & a);
240
242 template <typename T2>
243 auto operator/(const T2 & a) const ->
244 typename std::enable_if<libMesh::ScalarTraits<T2>::value,
245 RankFourTensorTempl<decltype(T() / T2())>>::type;
246
248 RankFourTensorTempl<T> & operator/=(const T & a);
249
252
254 template <typename T2>
255 auto operator+(const RankFourTensorTempl<T2> & a) const
256 -> RankFourTensorTempl<decltype(T() + T2())>;
257
260
262 template <typename T2>
263 auto operator-(const RankFourTensorTempl<T2> & a) const
264 -> RankFourTensorTempl<decltype(T() - T2())>;
265
268
270 template <typename T2>
271 auto operator*(const RankFourTensorTempl<T2> & a) const
272 -> RankFourTensorTempl<decltype(T() * T2())>;
273
275 T L2norm() const;
276
282
288
293 void rotate(const TypeTensor<T> & R);
294
300
306
312
317 template <int m>
319
332 void surfaceFillFromInputVector(const std::vector<T> & input);
333
335 static MooseEnum fillMethodEnum();
336
352 void fillFromInputVector(const std::vector<T> & input, FillMethod fill_method);
353
355 void fillGeneralIsotropic(const T & i0, const T & i1, const T & i2);
356 void fillAntisymmetricIsotropic(const T & i0);
357 void fillSymmetricIsotropic(const T & i0, const T & i1);
358 void fillSymmetricIsotropicEandNu(const T & E, const T & nu);
360
371 template <typename T2>
372 void fillSymmetric9FromInputVector(const T2 & input);
373
382 template <typename T2>
383 void fillSymmetric21FromInputVector(const T2 & input);
384
387
389 T contractionIj(unsigned int, unsigned int, const RankTwoTensorTempl<T> &) const;
390
392 T contractionKl(unsigned int, unsigned int, const RankTwoTensorTempl<T> &) const;
393
395 T sum3x3() const;
396
399
402 const RankTwoTensorTempl<T> &,
403 const RankTwoTensorTempl<T> &) const;
406 const RankTwoTensorTempl<T> &,
407 const RankTwoTensorTempl<T> &) const;
410 const RankTwoTensorTempl<T> &,
411 const RankTwoTensorTempl<T> &) const;
414 const RankTwoTensorTempl<T> &,
415 const RankTwoTensorTempl<T> &) const;
416
425
427 bool isSymmetric() const;
428
430 bool isIsotropic() const;
431
432protected:
436
443 void fillAntisymmetricFromInputVector(const std::vector<T> & input);
444
453 void fillGeneralIsotropicFromInputVector(const std::vector<T> & input);
454
461 void fillAntisymmetricIsotropicFromInputVector(const std::vector<T> & input);
462
470 void fillSymmetricIsotropicFromInputVector(const std::vector<T> & input);
471
481 void fillSymmetricIsotropicEandNuFromInputVector(const std::vector<T> & input);
482
490 void fillAxisymmetricRZFromInputVector(const std::vector<T> & input);
491
497 void fillGeneralFromInputVector(const std::vector<T> & input);
498
513 void fillPrincipalFromInputVector(const std::vector<T> & input);
514
521 void fillGeneralOrthotropicFromInputVector(const std::vector<T> & input);
522
523 template <class T2>
524 friend void dataStore(std::ostream &, RankFourTensorTempl<T2> &, void *);
525
526 template <class T2>
527 friend void dataLoad(std::istream &, RankFourTensorTempl<T2> &, void *);
528
529 template <typename T2>
530 friend class RankTwoTensorTempl;
531 template <typename T2>
533 template <typename T2>
535};
536
537namespace MetaPhysicL
538{
539template <typename T>
540struct RawType<RankFourTensorTempl<T>>
541{
543
545 {
546 constexpr auto N = RankFourTensorTempl<T>::N;
547 value_type ret;
548 for (auto i : libMesh::make_range(N))
549 for (auto j : libMesh::make_range(N))
550 for (auto k : libMesh::make_range(N))
551 for (auto l : libMesh::make_range(N))
552 ret(i, j, k, l) = raw_value(in(i, j, k, l));
553
554 return ret;
555 }
556};
557}
558
559template <typename T1, typename T2>
560inline auto
561operator*(const T1 & a, const RankFourTensorTempl<T2> & b) ->
562 typename std::enable_if<libMesh::ScalarTraits<T1>::value,
563 RankFourTensorTempl<decltype(T1() * T2())>>::type
564{
565 return b * a;
566}
567
568template <typename T>
569template <typename T2>
571{
572 for (auto i : libMesh::make_range(N4))
573 _vals[i] = copy._vals[i];
574}
575
576template <typename T>
577template <typename T2>
578auto
580 typename std::enable_if<libMesh::ScalarTraits<T2>::value,
581 RankFourTensorTempl<decltype(T() * T2())>>::type
582{
583 typedef decltype(T() * T2()) ValueType;
585
586 for (auto i : libMesh::make_range(N4))
587 result._vals[i] = _vals[i] * b;
588
589 return result;
590}
591
592template <typename T>
593template <typename T2>
594auto
596 typename std::enable_if<libMesh::ScalarTraits<T2>::value,
597 RankFourTensorTempl<decltype(T() / T2())>>::type
598{
599 RankFourTensorTempl<decltype(T() / T2())> result;
600 for (auto i : libMesh::make_range(N4))
601 result._vals[i] = _vals[i] / b;
602 return result;
603}
604
605template <typename T>
606template <typename T2>
607void
609{
610 mooseAssert(input.size() == 9,
611 "To use fillSymmetric9FromInputVector, your input must have size 9.");
612 zero();
613
614 (*this)(0, 0, 0, 0) = input[0]; // C1111
615 (*this)(1, 1, 1, 1) = input[3]; // C2222
616 (*this)(2, 2, 2, 2) = input[5]; // C3333
617
618 (*this)(0, 0, 1, 1) = input[1]; // C1122
619 (*this)(1, 1, 0, 0) = input[1];
620
621 (*this)(0, 0, 2, 2) = input[2]; // C1133
622 (*this)(2, 2, 0, 0) = input[2];
623
624 (*this)(1, 1, 2, 2) = input[4]; // C2233
625 (*this)(2, 2, 1, 1) = input[4];
626
627 (*this)(1, 2, 1, 2) = input[6]; // C2323
628 (*this)(2, 1, 2, 1) = input[6];
629 (*this)(2, 1, 1, 2) = input[6];
630 (*this)(1, 2, 2, 1) = input[6];
631
632 (*this)(0, 2, 0, 2) = input[7]; // C1313
633 (*this)(2, 0, 2, 0) = input[7];
634 (*this)(2, 0, 0, 2) = input[7];
635 (*this)(0, 2, 2, 0) = input[7];
636
637 (*this)(0, 1, 0, 1) = input[8]; // C1212
638 (*this)(1, 0, 1, 0) = input[8];
639 (*this)(1, 0, 0, 1) = input[8];
640 (*this)(0, 1, 1, 0) = input[8];
641}
642template <typename T>
643template <typename T2>
644void
646{
647 mooseAssert(input.size() == 21,
648 "To use fillSymmetric21FromInputVector, your input must have size 21.");
649
650 (*this)(0, 0, 0, 0) = input[0]; // C1111
651 (*this)(1, 1, 1, 1) = input[6]; // C2222
652 (*this)(2, 2, 2, 2) = input[11]; // C3333
653
654 (*this)(0, 0, 1, 1) = input[1]; // C1122
655 (*this)(1, 1, 0, 0) = input[1];
656
657 (*this)(0, 0, 2, 2) = input[2]; // C1133
658 (*this)(2, 2, 0, 0) = input[2];
659
660 (*this)(1, 1, 2, 2) = input[7]; // C2233
661 (*this)(2, 2, 1, 1) = input[7];
662
663 (*this)(0, 0, 0, 2) = input[4]; // C1113
664 (*this)(0, 0, 2, 0) = input[4];
665 (*this)(0, 2, 0, 0) = input[4];
666 (*this)(2, 0, 0, 0) = input[4];
667
668 (*this)(0, 0, 0, 1) = input[5]; // C1112
669 (*this)(0, 0, 1, 0) = input[5];
670 (*this)(0, 1, 0, 0) = input[5];
671 (*this)(1, 0, 0, 0) = input[5];
672
673 (*this)(1, 1, 1, 2) = input[8]; // C2223
674 (*this)(1, 1, 2, 1) = input[8];
675 (*this)(1, 2, 1, 1) = input[8];
676 (*this)(2, 1, 1, 1) = input[8];
677
678 (*this)(1, 1, 1, 0) = input[10];
679 (*this)(1, 1, 0, 1) = input[10];
680 (*this)(1, 0, 1, 1) = input[10];
681 (*this)(0, 1, 1, 1) = input[10]; // C2212 //flipped for filling purposes
682
683 (*this)(2, 2, 2, 1) = input[12];
684 (*this)(2, 2, 1, 2) = input[12];
685 (*this)(2, 1, 2, 2) = input[12];
686 (*this)(1, 2, 2, 2) = input[12]; // C3323 //flipped for filling purposes
687
688 (*this)(2, 2, 2, 0) = input[13];
689 (*this)(2, 2, 0, 2) = input[13];
690 (*this)(2, 0, 2, 2) = input[13];
691 (*this)(0, 2, 2, 2) = input[13]; // C3313 //flipped for filling purposes
692
693 (*this)(0, 0, 1, 2) = input[3]; // C1123
694 (*this)(0, 0, 2, 1) = input[3];
695 (*this)(1, 2, 0, 0) = input[3];
696 (*this)(2, 1, 0, 0) = input[3];
697
698 (*this)(1, 1, 0, 2) = input[9];
699 (*this)(1, 1, 2, 0) = input[9];
700 (*this)(0, 2, 1, 1) = input[9]; // C2213 //flipped for filling purposes
701 (*this)(2, 0, 1, 1) = input[9];
702
703 (*this)(2, 2, 0, 1) = input[14];
704 (*this)(2, 2, 1, 0) = input[14];
705 (*this)(0, 1, 2, 2) = input[14]; // C3312 //flipped for filling purposes
706 (*this)(1, 0, 2, 2) = input[14];
707
708 (*this)(1, 2, 1, 2) = input[15]; // C2323
709 (*this)(2, 1, 2, 1) = input[15];
710 (*this)(2, 1, 1, 2) = input[15];
711 (*this)(1, 2, 2, 1) = input[15];
712
713 (*this)(0, 2, 0, 2) = input[18]; // C1313
714 (*this)(2, 0, 2, 0) = input[18];
715 (*this)(2, 0, 0, 2) = input[18];
716 (*this)(0, 2, 2, 0) = input[18];
717
718 (*this)(0, 1, 0, 1) = input[20]; // C1212
719 (*this)(1, 0, 1, 0) = input[20];
720 (*this)(1, 0, 0, 1) = input[20];
721 (*this)(0, 1, 1, 0) = input[20];
722
723 (*this)(1, 2, 0, 2) = input[16];
724 (*this)(0, 2, 1, 2) = input[16]; // C2313 //flipped for filling purposes
725 (*this)(2, 1, 0, 2) = input[16];
726 (*this)(1, 2, 2, 0) = input[16];
727 (*this)(2, 0, 1, 2) = input[16];
728 (*this)(0, 2, 2, 1) = input[16];
729 (*this)(2, 1, 2, 0) = input[16];
730 (*this)(2, 0, 2, 1) = input[16];
731
732 (*this)(1, 2, 0, 1) = input[17];
733 (*this)(0, 1, 1, 2) = input[17]; // C2312 //flipped for filling purposes
734 (*this)(2, 1, 0, 1) = input[17];
735 (*this)(1, 2, 1, 0) = input[17];
736 (*this)(1, 0, 1, 2) = input[17];
737 (*this)(0, 1, 2, 1) = input[17];
738 (*this)(2, 1, 1, 0) = input[17];
739 (*this)(1, 0, 2, 1) = input[17];
740
741 (*this)(0, 2, 0, 1) = input[19];
742 (*this)(0, 1, 0, 2) = input[19]; // C1312 //flipped for filling purposes
743 (*this)(2, 0, 0, 1) = input[19];
744 (*this)(0, 2, 1, 0) = input[19];
745 (*this)(1, 0, 0, 2) = input[19];
746 (*this)(0, 1, 2, 0) = input[19];
747 (*this)(2, 0, 1, 0) = input[19];
748 (*this)(1, 0, 2, 0) = input[19];
749}
750
751template <typename T>
754{
755
756 // The inverse of a 3x3x3x3 in the C_ijkl*A_klmn = de_im de_jn sense is
757 // simply the inverse of the 9x9 matrix of the tensor entries.
758 // So all we need to do is inverse _vals (with the appropriate row-major
759 // storage)
760
762
763 if constexpr (RankFourTensorTempl<T>::N4 * sizeof(T) > EIGEN_STACK_ALLOCATION_LIMIT)
764 {
765 // Allocate on the heap if you're going to exceed the stack size limit
766 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> mat(9, 9);
767 for (auto i : libMesh::make_range(9 * 9))
768 mat(i) = _vals[i];
769
770 mat = mat.inverse();
771
772 for (auto i : libMesh::make_range(9 * 9))
773 result._vals[i] = mat(i);
774 }
775 else
776 {
777 // Allocate on the stack if small enough
778 const Eigen::Map<const Eigen::Matrix<T, 9, 9, Eigen::RowMajor>> mat(&_vals[0]);
779 Eigen::Map<Eigen::Matrix<T, 9, 9, Eigen::RowMajor>> res(&result._vals[0]);
780 res = mat.inverse();
781 }
782
783 return result;
784}
785
786template <typename T>
787template <int m>
790{
792 static constexpr std::size_t z[4][3] = {{1, 2, 3}, {0, 2, 3}, {0, 1, 3}, {0, 1, 2}};
793 std::size_t x[4];
794 for (x[0] = 0; x[0] < N; ++x[0])
795 for (x[1] = 0; x[1] < N; ++x[1])
796 for (x[2] = 0; x[2] < N; ++x[2])
797 for (x[3] = 0; x[3] < N; ++x[3])
798 result(x[z[m][0]], x[z[m][1]], x[z[m][2]]) += (*this)(x[0], x[1], x[2], x[3]) * b(x[m]);
799
800 return result;
801}
auto operator*(const T1 &a, const RankFourTensorTempl< T2 > &b) -> typename std::enable_if< libMesh::ScalarTraits< T1 >::value, RankFourTensorTempl< decltype(T1() *T2())> >::type
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
RankFourTensorTempl is designed to handle any N-dimensional fourth order tensor, C.
friend std::ostream & operator<<(std::ostream &os, const RankFourTensorTempl< T > &t)
void fillSymmetricIsotropic(const T &i0, const T &i1)
friend void dataStore(std::ostream &, RankFourTensorTempl< T2 > &, void *)
static constexpr unsigned int N3
void fillFromInputVector(const std::vector< T > &input, FillMethod fill_method)
fillFromInputVector takes some number of inputs to fill the Rank-4 tensor.
void fillGeneralOrthotropicFromInputVector(const std::vector< T > &input)
fillGeneralOrhotropicFromInputVector takes 10 inputs to fill the Rank-4 tensor It defines a general o...
RankFourTensorTempl< T > singleProductL(const RankTwoTensorTempl< T > &) const
Calculates C_ijkm A_lm.
RankFourTensorTempl< T > & operator+=(const RankFourTensorTempl< T > &a)
C_ijkl += a_ijkl for all i, j, k, l.
void fillSymmetric9FromInputVector(const T2 &input)
fillSymmetric9FromInputVector takes 9 inputs to fill in the Rank-4 tensor with the appropriate crysta...
T sum3x3() const
Calculates the sum of Ciijj for i and j varying from 0 to 2.
void fillGeneralIsotropicFromInputVector(const std::vector< T > &input)
fillGeneralIsotropicFromInputVector takes 3 inputs to fill the Rank-4 tensor with symmetries C_ijkl =...
RankFourTensorTempl< T > & operator=(const RankFourTensorTempl< T > &a)=default
copies values from a into this tensor
bool isIsotropic() const
checks if the tensor is isotropic
RankFourTensorTempl< T > inverse() const
This returns A_ijkl such that C_ijkl*A_klmn = de_im de_jn i.e.
T contractionIj(unsigned int, unsigned int, const RankTwoTensorTempl< T > &) const
Sum C_ijkl M_kl for a given i,j.
RankFourTensorTempl< T > & operator/=(const T &a)
C_ijkl /= a for all i, j, k, l.
RankFourTensorTempl< 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 th...
void rotate(const TypeTensor< T > &R)
Rotate the tensor using C_ijkl = R_im R_jn R_ko R_lp C_mnop.
T & operator()(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
Gets the value for the indices specified. Takes indices ranging from 0-2 for i, j,...
RankFourTensorTempl< T > tripleProductIjk(const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &) const
Calculates C_mntl A_im B_jn C_kt.
static MooseEnum fillMethodEnum()
Static method for use in validParams for getting the "fill_method".
const T & operator()(unsigned int i, unsigned int j, unsigned int k, unsigned int l) const
Gets the value for the indices specified.
RankFourTensorTempl< T > singleProductK(const RankTwoTensorTempl< T > &) const
Calculates C_ijml A_km.
RankFourTensorTempl< T > transposeMajor() const
Transpose the tensor by swapping the first pair with the second pair of indices.
auto operator+(const RankFourTensorTempl< T2 > &a) const -> RankFourTensorTempl< decltype(T()+T2())>
C_ijkl + a_ijkl.
static constexpr unsigned int N4
RankFourTensorTempl< T > transposeIj() const
Transpose the tensor by swapping the first two indeces.
void fillAntisymmetricIsotropicFromInputVector(const std::vector< T > &input)
fillAntisymmetricIsotropicFromInputVector takes 1 input to fill the the antisymmetric Rank-4 tensor w...
libMesh::VectorValue< T > sum3x1() const
Calculates the vector a[i] = sum over j Ciijj for i and j varying from 0 to 2.
static RankFourTensorTempl< T > IdentityFour()
RankFourTensorTempl< T > & operator*=(const T &a)
C_ijkl *= a.
InitMethod
Initialization method.
RankFourTensorTempl< T > operator-() const
-C_ijkl
void fillPrincipalFromInputVector(const std::vector< T > &input)
fillPrincipalFromInputVector takes 9 inputs to fill a Rank-4 tensor C1111 = input0 C1122 = input1 C11...
T contractionKl(unsigned int, unsigned int, const RankTwoTensorTempl< T > &) const
Sum M_ij C_ijkl for a given k,l.
void fillSymmetricIsotropicEandNu(const T &E, const T &nu)
tuple_of< 4, unsigned int > index_type
RankFourTensorTempl< T > & operator-=(const RankFourTensorTempl< T > &a)
C_ijkl -= a_ijkl.
void fillGeneralIsotropic(const T &i0, const T &i1, const T &i2)
Vector-less fill API functions. See docs of the corresponding ...FromInputVector methods.
void fillSymmetricIsotropicEandNuFromInputVector(const std::vector< T > &input)
fillSymmetricIsotropicEandNuFromInputVector is a variation of the fillSymmetricIsotropicFromInputVect...
RankFourTensorTempl< T > tripleProductIjl(const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &) const
Calculates C_mnkt A_im B_jn C_lt.
RankFourTensorTempl< T > transposeKl() const
Transpose the tensor by swapping the last two indeces.
void fillSymmetricIsotropicFromInputVector(const std::vector< T > &input)
fillSymmetricIsotropicFromInputVector takes 2 inputs to fill the the symmetric Rank-4 tensor with the...
void zero()
Zeros out the tensor.
T _vals[N4]
The values of the rank-four tensor stored by index=(((i * LIBMESH_DIM + j) * LIBMESH_DIM + k) * LIBME...
RankFourTensorTempl< T > singleProductJ(const RankTwoTensorTempl< T > &) const
Calculates C_imkl A_jm.
RankFourTensorTempl(const SymmetricRankFourTensorTempl< T2 > &t)
The conversion operator from a SymmetricRankFourTensorTempl
friend void dataLoad(std::istream &, RankFourTensorTempl< T2 > &, void *)
auto operator/(const T2 &a) const -> typename std::enable_if< libMesh::ScalarTraits< T2 >::value, RankFourTensorTempl< decltype(T()/T2())> >::type
C_ijkl/a.
RankFourTensorTempl< T > singleProductI(const RankTwoTensorTempl< T > &) const
Calculates C_mjkl A_im.
RankFourTensorTempl< T > tripleProductJkl(const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &) const
Calculates C_imnt A_jm B_kn C_lt.
void fillGeneralFromInputVector(const std::vector< T > &input)
fillGeneralFromInputVector takes 81 inputs to fill the Rank-4 tensor No symmetries are explicitly mai...
void fillSymmetric21FromInputVector(const T2 &input)
fillSymmetric21FromInputVector takes either 21 inputs to fill in the Rank-4 tensor with the appropria...
bool isSymmetric() const
checks if the tensor is symmetric
void fillAxisymmetricRZFromInputVector(const std::vector< T > &input)
fillAxisymmetricRZFromInputVector takes 5 inputs to fill the axisymmetric Rank-4 tensor with the appr...
RankFourTensorTempl(const RankFourTensorTempl< T > &a)=default
Copy assignment operator must be defined if used.
RankFourTensorTempl< T > tripleProductIkl(const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &, const RankTwoTensorTempl< T > &) const
Calculates C_mjnt A_im B_kn C_lt.
static RankFourTensorTempl< T > Identity()
void printReal(std::ostream &stm=Moose::out) const
Print the values of the rank four tensor.
static RankFourTensorTempl< T > IdentityDeviatoric()
Identity of type \delta_{ik} \delta_{jl} - \delta_{ij} \delta_{kl} / 3.
void fillAntisymmetricFromInputVector(const std::vector< T > &input)
fillAntisymmetricFromInputVector takes 6 inputs to fill the the antisymmetric Rank-4 tensor with the ...
RankThreeTensorTempl< T > contraction(const libMesh::VectorValue< T > &b) const
single contraction of a RankFourTensor with a vector over index m
RankTwoTensorTempl< T > innerProductTranspose(const RankTwoTensorTempl< T > &) const
Inner product of the major transposed tensor with a rank two tensor.
friend class RankFourTensorTempl
std::enable_if< libMesh::ScalarTraits< Scalar >::value, RankFourTensorTempl & >::type operator=(const Scalar &libmesh_dbg_var(p))
Assignment-from-scalar operator.
FillMethod
To fill up the 81 entries in the 4th-order tensor, fillFromInputVector is called with one of the foll...
static constexpr unsigned int N2
T L2norm() const
sqrt(C_ijkl*C_ijkl)
auto operator*(const Tensor< T2 > &a) const -> typename std::enable_if< TwoTensorMultTraits< Tensor, T2 >::value, RankTwoTensorTempl< decltype(T() *T2())> >::type
C_ijkl*a_kl.
static constexpr unsigned int N
tensor dimension and powers of the dimension
void print(std::ostream &stm=Moose::out) const
Print the rank four tensor.
void fillAntisymmetricIsotropic(const T &i0)
void surfaceFillFromInputVector(const std::vector< T > &input)
Fills the tensor entries ignoring the last dimension (ie, C_ijkl=0 if any of i, j,...
RankThreeTensor is designed to handle any N-dimensional third order tensor, r.
RankTwoTensorTempl is designed to handle the Stress or Strain Tensor for a fully anisotropic material...
SymmetricRankFourTensorTempl is designed to handle an N-dimensional fourth order tensor with minor sy...
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.
void mooseSetToZero(T &v)
Helper function templates to set a variable to zero.
Definition MathUtils.h:373
void mooseSetToZero< ADRankFourTensor >(ADRankFourTensor &v)
void mooseSetToZero< RankFourTensor >(RankFourTensor &v)
Helper function template specialization to set an object to zero.
We need to instantiate the following CompareTypes to tell the compiler that ADReal is a subtype of Ch...
auto raw_value(const Eigen::Map< T > &in)
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
Definition Moose.h:165
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
typename tuple_n< Index, T >::template type<> tuple_of
IntRange< T > make_range(T beg, T end)
static value_type value(const RankFourTensorTempl< T > &in)
RankFourTensorTempl< typename RawType< T >::value_type > value_type