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 : #include "AsymptoticExpansionHomogenizationElasticConstants.h"
11 : #include "MooseMesh.h"
12 :
13 : registerMooseObject("SolidMechanicsApp", AsymptoticExpansionHomogenizationElasticConstants);
14 :
15 : InputParameters
16 140 : AsymptoticExpansionHomogenizationElasticConstants::validParams()
17 : {
18 140 : InputParameters params = ElementIntegralPostprocessor::validParams();
19 140 : params.addClassDescription(
20 : "Postprocessor for asymptotic expansion homogenization for elasticity");
21 280 : params.addRequiredCoupledVar("dx_xx", "solution in xx");
22 280 : params.addRequiredCoupledVar("dy_xx", "solution in xx");
23 280 : params.addCoupledVar("dz_xx", "solution in xx");
24 280 : params.addRequiredCoupledVar("dx_yy", "solution in yy");
25 280 : params.addRequiredCoupledVar("dy_yy", "solution in yy");
26 280 : params.addCoupledVar("dz_yy", "solution in yy");
27 280 : params.addCoupledVar("dx_zz", "solution in zz");
28 280 : params.addCoupledVar("dy_zz", "solution in zz");
29 280 : params.addCoupledVar("dz_zz", "solution in zz");
30 280 : params.addRequiredCoupledVar("dx_xy", "solution in xy");
31 280 : params.addRequiredCoupledVar("dy_xy", "solution in xy");
32 280 : params.addCoupledVar("dz_xy", "solution in xy");
33 280 : params.addCoupledVar("dx_yz", "solution in yz");
34 280 : params.addCoupledVar("dy_yz", "solution in yz");
35 280 : params.addCoupledVar("dz_yz", "solution in yz");
36 280 : params.addCoupledVar("dx_zx", "solution in zx");
37 280 : params.addCoupledVar("dy_zx", "solution in zx");
38 280 : params.addCoupledVar("dz_zx", "solution in zx");
39 280 : 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 280 : MooseEnum column("xx yy zz yz xz xy");
44 280 : 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 280 : 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 140 : return params;
53 140 : }
54 :
55 70 : AsymptoticExpansionHomogenizationElasticConstants::
56 70 : AsymptoticExpansionHomogenizationElasticConstants(const InputParameters & parameters)
57 : : ElementIntegralPostprocessor(parameters),
58 210 : _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
59 70 : _grad({{{{&coupledGradient("dx_xx"),
60 140 : &coupledGradient("dy_xx"),
61 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_xx") : &_grad_zero)}},
62 140 : {{&coupledGradient("dx_yy"),
63 140 : &coupledGradient("dy_yy"),
64 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_yy") : &_grad_zero)}},
65 140 : {{(_subproblem.mesh().dimension() == 3 ? &coupledGradient("dx_zz") : &_grad_zero),
66 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dy_zz") : &_grad_zero),
67 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_zz") : &_grad_zero)}},
68 140 : {{(_subproblem.mesh().dimension() == 3 ? &coupledGradient("dx_yz") : &_grad_zero),
69 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dy_yz") : &_grad_zero),
70 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_yz") : &_grad_zero)}},
71 140 : {{(_subproblem.mesh().dimension() == 3 ? &coupledGradient("dx_zx") : &_grad_zero),
72 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dy_zx") : &_grad_zero),
73 140 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_zx") : &_grad_zero)}},
74 140 : {{(&coupledGradient("dx_xy")),
75 140 : (&coupledGradient("dy_xy")),
76 70 : (_subproblem.mesh().dimension() == 3 ? &coupledGradient("dz_xy") : &_grad_zero)}}}}),
77 140 : _elasticity_tensor(getMaterialPropertyByName<RankFourTensor>(_base_name + "elasticity_tensor")),
78 140 : _column(getParam<MooseEnum>("column")),
79 140 : _row(getParam<MooseEnum>("row")),
80 70 : _ik_index({{0, 1, 2, 1, 0, 0}}),
81 70 : _jl_index({{0, 1, 2, 2, 2, 1}}),
82 70 : _i(_ik_index[_row]),
83 70 : _j(_jl_index[_row]),
84 70 : _k(_ik_index[_column]),
85 70 : _l(_jl_index[_column]),
86 70 : _volume(0),
87 70 : _integral_value(0)
88 : {
89 70 : }
90 :
91 : void
92 150 : AsymptoticExpansionHomogenizationElasticConstants::initialize()
93 : {
94 150 : _integral_value = 0;
95 150 : _volume = 0;
96 150 : }
97 :
98 : void
99 28160 : AsymptoticExpansionHomogenizationElasticConstants::execute()
100 : {
101 28160 : _integral_value += computeIntegral();
102 28160 : _volume += _current_elem_volume;
103 28160 : }
104 :
105 : Real
106 150 : AsymptoticExpansionHomogenizationElasticConstants::getValue() const
107 : {
108 150 : return (_integral_value / _volume);
109 : }
110 :
111 : void
112 150 : AsymptoticExpansionHomogenizationElasticConstants::finalize()
113 : {
114 150 : gatherSum(_integral_value);
115 150 : gatherSum(_volume);
116 150 : }
117 :
118 : void
119 0 : AsymptoticExpansionHomogenizationElasticConstants::threadJoin(const UserObject & y)
120 : {
121 : const AsymptoticExpansionHomogenizationElasticConstants & pps =
122 0 : dynamic_cast<const AsymptoticExpansionHomogenizationElasticConstants &>(y);
123 :
124 0 : _integral_value += pps._integral_value;
125 0 : _volume += pps._volume;
126 0 : }
127 :
128 : Real
129 112640 : AsymptoticExpansionHomogenizationElasticConstants::computeQpIntegral()
130 : {
131 : Real value = 0;
132 450560 : for (unsigned p = 0; p < 3; ++p)
133 1351680 : for (unsigned q = 0; q < 3; ++q)
134 1013760 : value += _elasticity_tensor[_qp](_i, _j, p, q) * (*_grad[_column][p])[_qp](q);
135 :
136 112640 : return _elasticity_tensor[_qp](_i, _j, _k, _l) + value;
137 : }
|