www.mooseframework.org
HomogenizedElasticConstants.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 #include "SymmElasticityTensor.h"
10 #include "SubProblem.h"
11 #include "MooseMesh.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<ElementAverageValue>();
18  params.addRequiredCoupledVar("dx_xx", "solution in xx");
19  params.addRequiredCoupledVar("dy_xx", "solution in xx");
20  params.addCoupledVar("dz_xx", "solution in xx");
21  params.addRequiredCoupledVar("dx_yy", "solution in yy");
22  params.addRequiredCoupledVar("dy_yy", "solution in yy");
23  params.addCoupledVar("dz_yy", "solution in yy");
24  params.addCoupledVar("dx_zz", "solution in zz");
25  params.addCoupledVar("dy_zz", "solution in zz");
26  params.addCoupledVar("dz_zz", "solution in zz");
27  params.addRequiredCoupledVar("dx_xy", "solution in xy");
28  params.addRequiredCoupledVar("dy_xy", "solution in xy");
29  params.addCoupledVar("dz_xy", "solution in xy");
30  params.addCoupledVar("dx_yz", "solution in yz");
31  params.addCoupledVar("dy_yz", "solution in yz");
32  params.addCoupledVar("dz_yz", "solution in yz");
33  params.addCoupledVar("dx_zx", "solution in zx");
34  params.addCoupledVar("dy_zx", "solution in zx");
35  params.addCoupledVar("dz_zx", "solution in zx");
36  params.addParam<std::string>(
37  "appended_property_name", "", "Name appended to material properties to make them unique");
38  params.addRequiredParam<unsigned int>("column",
39  "An integer corresponding to the direction the "
40  "variable this kernel acts in. (0 for xx, 1 for "
41  "yy, 2 for zz, 3 for xy, 4 for yz, 5 for zx)");
42  params.addRequiredParam<unsigned int>("row",
43  "An integer corresponding to the direction the "
44  "variable this kernel acts in. (0 for xx, 1 for yy, "
45  "2 for zz, 3 for xy, 4 for yz, 5 for zx)");
46  return params;
47 }
48 
50  : ElementAverageValue(parameters),
51  _grad_disp_x_xx(coupledGradient("dx_xx")),
52  _grad_disp_y_xx(coupledGradient("dy_xx")),
53  _grad_disp_z_xx(_subproblem.mesh().dimension() == 3 ? coupledGradient("dz_xx") : _grad_zero),
54  _grad_disp_x_yy(coupledGradient("dx_yy")),
55  _grad_disp_y_yy(coupledGradient("dy_yy")),
56  _grad_disp_z_yy(_subproblem.mesh().dimension() == 3 ? coupledGradient("dz_yy") : _grad_zero),
57  _grad_disp_x_zz(_subproblem.mesh().dimension() == 3 ? coupledGradient("dx_zz") : _grad_zero),
58  _grad_disp_y_zz(_subproblem.mesh().dimension() == 3 ? coupledGradient("dy_zz") : _grad_zero),
59  _grad_disp_z_zz(_subproblem.mesh().dimension() == 3 ? coupledGradient("dz_zz") : _grad_zero),
60  _grad_disp_x_xy(coupledGradient("dx_xy")),
61  _grad_disp_y_xy(coupledGradient("dy_xy")),
62  _grad_disp_z_xy(_subproblem.mesh().dimension() == 3 ? coupledGradient("dz_xy") : _grad_zero),
63  _grad_disp_x_yz(_subproblem.mesh().dimension() == 3 ? coupledGradient("dx_yz") : _grad_zero),
64  _grad_disp_y_yz(_subproblem.mesh().dimension() == 3 ? coupledGradient("dy_yz") : _grad_zero),
65  _grad_disp_z_yz(_subproblem.mesh().dimension() == 3 ? coupledGradient("dz_yz") : _grad_zero),
66  _grad_disp_x_zx(_subproblem.mesh().dimension() == 3 ? coupledGradient("dx_zx") : _grad_zero),
67  _grad_disp_y_zx(_subproblem.mesh().dimension() == 3 ? coupledGradient("dy_zx") : _grad_zero),
68  _grad_disp_z_zx(_subproblem.mesh().dimension() == 3 ? coupledGradient("dz_zx") : _grad_zero),
69  _elasticity_tensor(getMaterialProperty<SymmElasticityTensor>(
70  "elasticity_tensor" + getParam<std::string>("appended_property_name"))),
71  _column(getParam<unsigned int>("column")),
72  _row(getParam<unsigned int>("row")),
73  _volume(0),
74  _integral_value(0)
75 {
76 
77  if (_column == 0)
78  {
79  _k = 0;
80  _l = 0;
81  }
82 
83  if (_column == 1)
84  {
85  _k = 1;
86  _l = 1;
87  }
88 
89  if (_column == 2)
90  {
91  _k = 2;
92  _l = 2;
93  }
94 
95  if (_column == 3)
96  {
97  _k = 0;
98  _l = 1;
99  }
100 
101  if (_column == 4)
102  {
103  _k = 1;
104  _l = 2;
105  }
106 
107  if (_column == 5)
108  {
109  _k = 2;
110  _l = 0;
111  }
112 
113  if (_row == 0)
114  {
115  _i = 0;
116  _j = 0;
117  }
118 
119  if (_row == 1)
120  {
121  _i = 1;
122  _j = 1;
123  }
124 
125  if (_row == 2)
126  {
127  _i = 2;
128  _j = 2;
129  }
130 
131  if (_row == 3)
132  {
133  _i = 0;
134  _j = 1;
135  }
136 
137  if (_row == 4)
138  {
139  _i = 1;
140  _j = 2;
141  }
142 
143  if (_row == 5)
144  {
145  _i = 2;
146  _j = 0;
147  }
148 
149  _J = (3 * _l + _k);
150  _I = (3 * _j + _i);
151 }
152 
153 void
155 {
156  _integral_value = 0;
157  _volume = 0;
158 }
159 
160 void
162 {
163  _integral_value += computeIntegral();
164  _volume += _current_elem_volume;
165 }
166 
167 Real
169 {
170 
171  gatherSum(_integral_value);
172  gatherSum(_volume);
173 
174  return (_integral_value / _volume);
175 }
176 
177 void
179 {
180  const HomogenizedElasticConstants & pps = dynamic_cast<const HomogenizedElasticConstants &>(y);
181 
183  _volume += pps._volume;
184 }
185 
186 Real
188 {
189  ColumnMajorMatrix E(_elasticity_tensor[_qp].columnMajorMatrix9x9());
190  Real value;
191 
192  value = 0.0;
193 
194  const VariableGradient * grad[6][3];
195  grad[0][0] = &_grad_disp_x_xx;
196  grad[0][1] = &_grad_disp_y_xx;
197  grad[0][2] = &_grad_disp_z_xx;
198 
199  grad[1][0] = &_grad_disp_x_yy;
200  grad[1][1] = &_grad_disp_y_yy;
201  grad[1][2] = &_grad_disp_z_yy;
202 
203  grad[2][0] = &_grad_disp_x_zz;
204  grad[2][1] = &_grad_disp_y_zz;
205  grad[2][2] = &_grad_disp_z_zz;
206 
207  grad[3][0] = &_grad_disp_x_xy;
208  grad[3][1] = &_grad_disp_y_xy;
209  grad[3][2] = &_grad_disp_z_xy;
210 
211  grad[4][0] = &_grad_disp_x_yz;
212  grad[4][1] = &_grad_disp_y_yz;
213  grad[4][2] = &_grad_disp_z_yz;
214 
215  grad[5][0] = &_grad_disp_x_zx;
216  grad[5][1] = &_grad_disp_y_zx;
217  grad[5][2] = &_grad_disp_z_zx;
218 
219  for (int p = 0; p < 3; p++)
220  {
221  for (int q = 0; q < 3; q++)
222  {
223  value += E(_I, 3 * q + p) * (*grad[_column][p])[_qp](q);
224  }
225  }
226 
227  return (E(_I, _J) + value);
228 }
This class defines a basic set of capabilities any elasticity tensor should have. ...
const VariableGradient & _grad_disp_z_yy
const VariableGradient & _grad_disp_y_yy
const VariableGradient & _grad_disp_z_zz
const VariableGradient & _grad_disp_x_yz
const VariableGradient & _grad_disp_z_zx
const VariableGradient & _grad_disp_z_yz
const VariableGradient & _grad_disp_y_yz
const VariableGradient & _grad_disp_y_zz
const VariableGradient & _grad_disp_x_xy
const VariableGradient & _grad_disp_y_xx
const MaterialProperty< SymmElasticityTensor > & _elasticity_tensor
const VariableGradient & _grad_disp_z_xy
InputParameters validParams< HomogenizedElasticConstants >()
const VariableGradient & _grad_disp_y_zx
const VariableGradient & _grad_disp_x_yy
const VariableGradient & _grad_disp_x_zx
const VariableGradient & _grad_disp_z_xx
const VariableGradient & _grad_disp_x_zz
const VariableGradient & _grad_disp_y_xy
This postprocessor computes the average grain area in a polycrystal.
HomogenizedElasticConstants(const InputParameters &parameters)
virtual void threadJoin(const UserObject &y)
const VariableGradient & _grad_disp_x_xx