Line data Source code
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 "RankFourTensorForward.h"
13 :
14 : namespace libMesh
15 : {
16 : template <typename>
17 : class VectorValue;
18 : typedef VectorValue<Real> RealGradient;
19 : }
20 : using libMesh::RealGradient;
21 :
22 : namespace ElasticityTensorTools
23 : {
24 :
25 : /**
26 : * This is used for the standard kernel stress_ij*d(test)/dx_j, when varied wrt u_k
27 : * Jacobian entry: d(stress_ij*d(test)/dx_j)/du_k = d(C_ijmn*du_m/dx_n*dtest/dx_j)/du_k
28 : */
29 : Real elasticJacobian(const RankFourTensor & r4t,
30 : unsigned int i,
31 : unsigned int k,
32 : const RealGradient & grad_test,
33 : const RealGradient & grad_phi);
34 :
35 : /**
36 : * This is used for the standard kernel stress_ij*d(test)/dx_j, when varied wrt w_k (the cosserat
37 : * rotation)
38 : * Jacobian entry: d(stress_ij*d(test)/dx_j)/dw_k = d(C_ijmn*eps_mnp*w_p*dtest/dx_j)/dw_k
39 : */
40 : Real elasticJacobianWC(const RankFourTensor & r4t,
41 : unsigned int i,
42 : unsigned int k,
43 : const RealGradient & grad_test,
44 : Real phi);
45 :
46 : /**
47 : * This is used for the moment-balancing kernel eps_ijk*stress_jk*test, when varied wrt u_k
48 : * Jacobian entry: d(eps_ijm*stress_jm*test)/du_k = d(eps_ijm*C_jmln*du_l/dx_n*test)/du_k
49 : */
50 : Real momentJacobian(const RankFourTensor & r4t,
51 : unsigned int i,
52 : unsigned int k,
53 : Real test,
54 : const RealGradient & grad_phi);
55 :
56 : /**
57 : * This is used for the moment-balancing kernel eps_ijk*stress_jk*test, when varied wrt w_k (the
58 : * cosserat rotation)
59 : * Jacobian entry: d(eps_ijm*stress_jm*test)/dw_k = d(eps_ijm*C_jmln*eps_lnp*w_p*test)/dw_k
60 : */
61 : Real
62 : momentJacobianWC(const RankFourTensor & r4t, unsigned int i, unsigned int k, Real test, Real phi);
63 :
64 : /**
65 : * Get the shear modulus for an isotropic elasticity tensor
66 : * param elasticity_tensor the tensor (must be isotropic, but not checked for efficiency)
67 : */
68 : template <typename T>
69 : T
70 : getIsotropicShearModulus(const RankFourTensorTempl<T> & elasticity_tensor)
71 : {
72 59861318 : return elasticity_tensor(0, 1, 0, 1);
73 : }
74 :
75 : /**
76 : * Get the bulk modulus for an isotropic elasticity tensor
77 : * param elasticity_tensor the tensor (must be isotropic, but not checked for efficiency)
78 : */
79 : template <typename T>
80 : T
81 : getIsotropicBulkModulus(const RankFourTensorTempl<T> & elasticity_tensor)
82 : {
83 : const T shear_modulus = getIsotropicShearModulus(elasticity_tensor);
84 : // dilatational modulus is defined as lambda plus two mu
85 238176 : const T dilatational_modulus = elasticity_tensor(0, 0, 0, 0);
86 238176 : const T lambda = dilatational_modulus - 2.0 * shear_modulus;
87 238176 : const T bulk_modulus = lambda + 2.0 * shear_modulus / 3.0;
88 : return bulk_modulus;
89 : }
90 :
91 : /**
92 : * Get the Young's modulus for an isotropic elasticity tensor
93 : * param elasticity_tensor the tensor (must be isotropic, but not checked for efficiency)
94 : */
95 : template <typename T>
96 : T
97 1424576 : getIsotropicYoungsModulus(const RankFourTensorTempl<T> & elasticity_tensor)
98 : {
99 : const T shear_modulus = getIsotropicShearModulus(elasticity_tensor);
100 : // dilatational modulus is defined as lambda plus two mu
101 1424576 : const T dilatational_modulus = elasticity_tensor(0, 0, 0, 0);
102 2849152 : const T lambda = dilatational_modulus - 2.0 * shear_modulus;
103 3392160 : const T youngs_modulus =
104 4816736 : shear_modulus * (3.0 * lambda + 2.0 * shear_modulus) / (lambda + shear_modulus);
105 1424576 : return youngs_modulus;
106 : }
107 :
108 : /**
109 : * Get the Poisson's modulus for an isotropic elasticity tensor
110 : * param elasticity_tensor the tensor (must be isotropic, but not checked for efficiency)
111 : */
112 : template <typename T>
113 : T
114 : getIsotropicPoissonsRatio(const RankFourTensorTempl<T> & elasticity_tensor)
115 : {
116 96016 : const T poissons_ratio = elasticity_tensor(1, 1, 0, 0) /
117 96016 : (elasticity_tensor(1, 1, 1, 1) + elasticity_tensor(1, 1, 0, 0));
118 : return poissons_ratio;
119 : }
120 :
121 : void toVoigtNotationIndexConversion(int, int &, int &);
122 :
123 : template <bool is_ad>
124 : void
125 108576 : toVoigtNotation(GenericDenseMatrix<is_ad> & voigt_matrix,
126 : const GenericRankFourTensor<is_ad> & tensor)
127 : {
128 108576 : std::vector<int> index_vector = {0, 1, 2, 3, 4, 5};
129 108576 : int a = 0;
130 108576 : int b = 0;
131 108576 : int c = 0;
132 108576 : int d = 0;
133 760032 : for (int i : index_vector)
134 4560192 : for (int j : index_vector)
135 : {
136 3908736 : toVoigtNotationIndexConversion(i, a, b);
137 3908736 : toVoigtNotationIndexConversion(j, c, d);
138 3908736 : voigt_matrix(i, j) = tensor(a, b, c, d);
139 : }
140 108576 : }
141 :
142 : void toMooseVoigtNotationIndexConversion(int, int &, int &);
143 :
144 : template <bool is_ad>
145 : void
146 7349012 : toMooseVoigtNotation(GenericDenseMatrix<is_ad> & voigt_matrix,
147 : const GenericRankFourTensor<is_ad> & tensor)
148 : {
149 7349012 : static std::vector<int> index_vector = {0, 1, 2, 3, 4, 5};
150 7349012 : int a = 0;
151 7349012 : int b = 0;
152 7349012 : int c = 0;
153 7349012 : int d = 0;
154 51443084 : for (int i : index_vector)
155 308658504 : for (int j : index_vector)
156 : {
157 264564432 : toMooseVoigtNotationIndexConversion(i, a, b);
158 264564432 : toMooseVoigtNotationIndexConversion(j, c, d);
159 264564432 : voigt_matrix(i, j) = tensor(a, b, c, d);
160 : }
161 7349012 : }
162 : }
|