https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
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
91void
97
98void
104
105Real
110
111void
117
118void
127
128Real
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}
registerMooseObject("SolidMechanicsApp", AsymptoticExpansionHomogenizationElasticConstants)
const std::vector< double > y
const Real p
This postprocessor computes homogenized elastic constants.
const std::array< std::array< const VariableGradient *, 3 >, 6 > _grad
const VariableGradient & _grad_zero
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0) const
static InputParameters validParams()
virtual Real computeIntegral()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
virtual unsigned int dimension() const
virtual MooseMesh & mesh()=0