www.mooseframework.org
MomentBalancing.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 #include "MomentBalancing.h"
8 
9 // MOOSE includes
10 #include "ElasticityTensorTools.h"
11 #include "Material.h"
12 #include "MooseVariable.h"
13 #include "PermutationTensor.h"
14 #include "RankFourTensor.h"
15 #include "RankTwoTensor.h"
16 
17 template <>
18 InputParameters
20 {
21  InputParameters params = validParams<Kernel>();
22  params.addRequiredRangeCheckedParam<unsigned int>(
23  "component",
24  "component<3",
25  "An integer corresponding to the direction the variable this "
26  "kernel acts in. (0 for x, 1 for y, 2 for z)");
27  params.addParam<std::string>(
28  "appended_property_name", "", "Name appended to material properties to make them unique");
29  params.addRequiredCoupledVar("Cosserat_rotations", "The 3 Cosserat rotation variables");
30  params.addRequiredCoupledVar("displacements", "The 3 displacement variables");
31  params.set<bool>("use_displaced_mesh") = false;
32 
33  return params;
34 }
35 
36 MomentBalancing::MomentBalancing(const InputParameters & parameters)
37  : Kernel(parameters),
38  _stress(getMaterialProperty<RankTwoTensor>("stress" +
39  getParam<std::string>("appended_property_name"))),
40  _Jacobian_mult(getMaterialProperty<RankFourTensor>(
41  "Jacobian_mult" + getParam<std::string>("appended_property_name"))),
42  _component(getParam<unsigned int>("component")),
43  _nrots(coupledComponents("Cosserat_rotations")),
44  _wc_var(_nrots),
45  _ndisp(coupledComponents("displacements")),
46  _disp_var(_ndisp)
47 {
48  if (_nrots != 3)
49  mooseError("MomentBalancing: This Kernel is only defined for 3-dimensional simulations so 3 "
50  "Cosserat rotation variables are needed");
51  for (unsigned i = 0; i < _nrots; ++i)
52  _wc_var[i] = coupled("Cosserat_rotations", i);
53 
54  if (_ndisp != 3)
55  mooseError("MomentBalancing: This Kernel is only defined for 3-dimensional simulations so 3 "
56  "displacement variables are needed");
57  for (unsigned i = 0; i < _ndisp; ++i)
58  _disp_var[i] = coupled("displacements", i);
59 
60  // Following check is necessary to ensure the correct Jacobian is calculated
61  if (_wc_var[_component] != _var.number())
62  mooseError("MomentBalancing: The variable for this Kernel must be equal to the Cosserat "
63  "rotation variable defined by the \"component\" and the \"Cosserat_rotations\" "
64  "parameters");
65 }
66 
67 Real
69 {
70  Real the_sum = 0.0;
71  for (unsigned int j = 0; j < LIBMESH_DIM; ++j)
72  for (unsigned int k = 0; k < LIBMESH_DIM; ++k)
73  the_sum += PermutationTensor::eps(_component, j, k) * _stress[_qp](j, k);
74  return _test[_i][_qp] * the_sum;
75 }
76 
77 Real
79 {
81  _Jacobian_mult[_qp], _component, _component, _test[_i][_qp], _phi[_j][_qp]);
82 }
83 
84 Real
86 {
87  // What does 2D look like here?
88  for (unsigned v = 0; v < _ndisp; ++v)
89  if (jvar == _disp_var[v])
91  _Jacobian_mult[_qp], _component, v, _test[_i][_qp], _grad_phi[_j][_qp]);
92 
93  // What does 2D look like here?
94  for (unsigned v = 0; v < _nrots; ++v)
95  if (jvar == _wc_var[v])
97  _Jacobian_mult[_qp], _component, v, _test[_i][_qp], _phi[_j][_qp]);
98 
99  return 0.0;
100 }
std::vector< unsigned int > _disp_var
the moose variable numbers for the displacements
std::vector< unsigned int > _wc_var
the moose variable numbers for the Cosserat rotation degrees of freedom
InputParameters validParams< MomentBalancing >()
Real momentJacobianWC(const RankFourTensor &r4t, unsigned int i, unsigned int k, Real test, Real phi)
This is used for the moment-balancing kernel eps_ijk*stress_jk*test, when varied wrt w_k (the cossera...
const MaterialProperty< RankTwoTensor > & _stress
the stress tensor (not the moment stress) at the quad-point.
const unsigned int _nrots
const MaterialProperty< RankFourTensor > & _Jacobian_mult
d(stress tensor)/(d strain tensor) Here strain_ij = grad_j disp_i + epsilon_ijk * wc_k ...
virtual Real computeQpResidual()
Real momentJacobian(const RankFourTensor &r4t, unsigned int i, unsigned int k, Real test, const RealGradient &grad_phi)
This is used for the moment-balancing kernel eps_ijk*stress_jk*test, when varied wrt u_k Jacobian ent...
const unsigned int _ndisp
virtual Real computeQpJacobian()
MomentBalancing(const InputParameters &parameters)
const unsigned int _component
The Kernel computes epsilon_{component j k}*stress_{j k}.
virtual Real computeQpOffDiagJacobian(unsigned int jvar)