www.mooseframework.org
StressDivergenceRSphericalTensors.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 
10 #include "FEProblem.h"
11 #include "MooseMesh.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<StressDivergenceTensors>();
18  params.addClassDescription(
19  "Calculate stress divergence for an spherically symmetric 1D problem in polar coordinates.");
20  params.addRequiredParam<unsigned int>(
21  "component",
22  "An integer corresponding to the direction the variable this kernel acts in. (0 "
23  "for x, 1 for y, 2 for z; note in this kernel disp_x refers to the radial "
24  "displacement and disp_y refers to the axial displacement.)");
25  params.set<bool>("use_displaced_mesh") = true;
26  return params;
27 }
28 
30  const InputParameters & parameters)
31  : StressDivergenceTensors(parameters)
32 {
33  if (_component != 0)
34  mooseError("Invalid component for this 1D RSpherical problem.");
35 }
36 
37 void
39 {
40  if (getBlockCoordSystem() != Moose::COORD_RSPHERICAL)
41  mooseError("The coordinate system in the Problem block must be set to RSPHERICAL for 1D "
42  "spherically symmetric geometries.");
43 }
44 
45 Real
47 {
48  return _grad_test[_i][_qp](0) * _stress[_qp](0, 0) + // stress_{rr} part 1
49  +(_test[_i][_qp] / _q_point[_qp](0)) * _stress[_qp](1, 1) + // stress_{\theta \theta}
50  +(_test[_i][_qp] / _q_point[_qp](0)) * _stress[_qp](2, 2); // stress_{\phi \phi}
51 }
52 
53 Real
55 {
57 }
58 
59 Real
61 {
62  for (unsigned int i = 0; i < _ndisp; ++i)
63  if (jvar == _disp_var[i])
64  return calculateJacobian(_component, i);
65 
66  if (_temp_coupled && jvar == _temp_var)
67  return 0.0;
68 
69  return 0.0;
70 }
71 
72 Real
73 StressDivergenceRSphericalTensors::calculateJacobian(unsigned int ivar, unsigned int jvar)
74 {
75  RealGradient test_r, phi_r;
76 
77  mooseAssert(ivar == 0 && jvar == 0,
78  "Invalid component in Jacobian Calculation"); // Only nonzero case for a 1D simulation
79 
80  if (ivar == 0) // Case grad_test for r, requires contributions from stress_{rr}, stress_{\theta
81  // \theta}, and stress_{\phi \phi}
82  {
83  test_r(0) = _grad_test[_i][_qp](0);
84  test_r(1) = _test[_i][_qp] / _q_point[_qp](0);
85  test_r(2) = _test[_i][_qp] / _q_point[_qp](0);
86  }
87 
88  if (jvar == 0)
89  {
90  phi_r(0) = _grad_phi[_j][_qp](0);
91  phi_r(1) = _phi[_j][_qp] / _q_point[_qp](0);
92  phi_r(2) = _phi[_j][_qp] / _q_point[_qp](0);
93  }
94 
95  return ElasticityTensorTools::elasticJacobian(_Jacobian_mult[_qp], ivar, jvar, test_r, phi_r);
96 }
InputParameters validParams< StressDivergenceRSphericalTensors >()
unsigned int _ndisp
Coupled displacement variables.
Real elasticJacobian(const RankFourTensor &r4t, unsigned int i, unsigned int k, const RealGradient &grad_test, const RealGradient &grad_phi)
This is used for the standard kernel stress_ij*d(test)/dx_j, when varied wrt u_k Jacobian entry: d(st...
StressDivergenceRSphericalTensors(const InputParameters &parameters)
std::vector< unsigned int > _disp_var
const MaterialProperty< RankFourTensor > & _Jacobian_mult
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
Real calculateJacobian(unsigned int ivar, unsigned int jvar)
const MaterialProperty< RankTwoTensor > & _stress
InputParameters validParams< StressDivergenceTensors >()
StressDivergenceTensors mostly copies from StressDivergence.