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