https://mooseframework.inl.gov
AsymptoticExpansionHomogenizationElasticConstants.C
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 
11 #include "MooseMesh.h"
12 
14 
17 {
19  params.addClassDescription(
20  "Postprocessor for asymptotic expansion homogenization for elasticity");
21  params.addRequiredCoupledVar("dx_xx", "solution in xx");
22  params.addRequiredCoupledVar("dy_xx", "solution in xx");
23  params.addCoupledVar("dz_xx", "solution in xx");
24  params.addRequiredCoupledVar("dx_yy", "solution in yy");
25  params.addRequiredCoupledVar("dy_yy", "solution in yy");
26  params.addCoupledVar("dz_yy", "solution in yy");
27  params.addCoupledVar("dx_zz", "solution in zz");
28  params.addCoupledVar("dy_zz", "solution in zz");
29  params.addCoupledVar("dz_zz", "solution in zz");
30  params.addRequiredCoupledVar("dx_xy", "solution in xy");
31  params.addRequiredCoupledVar("dy_xy", "solution in xy");
32  params.addCoupledVar("dz_xy", "solution in xy");
33  params.addCoupledVar("dx_yz", "solution in yz");
34  params.addCoupledVar("dy_yz", "solution in yz");
35  params.addCoupledVar("dz_yz", "solution in yz");
36  params.addCoupledVar("dx_zx", "solution in zx");
37  params.addCoupledVar("dy_zx", "solution in zx");
38  params.addCoupledVar("dz_zx", "solution in zx");
39  params.addParam<std::string>("base_name",
40  "Optional parameter that allows the user to define "
41  "multiple mechanics material systems on the same "
42  "block, i.e. for multiple phases");
43  MooseEnum column("xx yy zz yz xz xy");
44  params.addRequiredParam<MooseEnum>("column",
45  column,
46  "The column of the material matrix this kernel acts in. "
47  "(xx, yy, zz, yz, xz, or xy)");
48  params.addRequiredParam<MooseEnum>("row",
49  column,
50  "The row of the material matrix this kernel acts in. "
51  "(xx, yy, zz, yz, xz, or xy)");
52  return params;
53 }
54 
57  : ElementIntegralPostprocessor(parameters),
58  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
59  _grad({{{{&coupledGradient("dx_xx"),
60  &coupledGradient("dy_xx"),
61  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_xx") : &_grad_zero)}},
62  {{&coupledGradient("dx_yy"),
63  &coupledGradient("dy_yy"),
64  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_yy") : &_grad_zero)}},
65  {{(_subproblem.mesh().dimension() == 3 ? &coupledGradient("dx_zz") : &_grad_zero),
66  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dy_zz") : &_grad_zero),
67  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_zz") : &_grad_zero)}},
68  {{(_subproblem.mesh().dimension() == 3 ? &coupledGradient("dx_yz") : &_grad_zero),
69  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dy_yz") : &_grad_zero),
70  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_yz") : &_grad_zero)}},
71  {{(_subproblem.mesh().dimension() == 3 ? &coupledGradient("dx_zx") : &_grad_zero),
72  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dy_zx") : &_grad_zero),
73  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_zx") : &_grad_zero)}},
74  {{(&coupledGradient("dx_xy")),
75  (&coupledGradient("dy_xy")),
76  (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_xy") : &_grad_zero)}}}}),
77  _elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_base_name + "elasticity_tensor")),
78  _column(getParam<MooseEnum>("column")),
79  _row(getParam<MooseEnum>("row")),
80  _ik_index({{0, 1, 2, 1, 0, 0}}),
81  _jl_index({{0, 1, 2, 2, 2, 1}}),
82  _i(_ik_index[_row]),
83  _j(_jl_index[_row]),
84  _k(_ik_index[_column]),
85  _l(_jl_index[_column]),
86  _volume(0),
87  _integral_value(0)
88 {
89 }
90 
91 void
93 {
94  _integral_value = 0;
95  _volume = 0;
96 }
97 
98 void
100 {
103 }
104 
105 Real
107 {
108  return (_integral_value / _volume);
109 }
110 
111 void
113 {
116 }
117 
118 void
120 {
123 
125  _volume += pps._volume;
126 }
127 
128 Real
130 {
131  Real value = 0;
132  for (unsigned p = 0; p < 3; ++p)
133  for (unsigned q = 0; q < 3; ++q)
134  value += _elasticity_tensor[_qp](_i, _j, p, q) * (*_grad[_column][p])[_qp](q);
135 
136  return _elasticity_tensor[_qp](_i, _j, _k, _l) + value;
137 }
const std::array< std::array< const VariableGradient *, 3 >, 6 > _grad
virtual MooseMesh & mesh()=0
registerMooseObject("SolidMechanicsApp", AsymptoticExpansionHomogenizationElasticConstants)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const VariableGradient & _grad_zero
const std::vector< double > y
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
static InputParameters validParams()
virtual unsigned int dimension() const
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This postprocessor computes homogenized elastic constants.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real computeIntegral()
void addClassDescription(const std::string &doc_string)