www.mooseframework.org
NonlinearRZ.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 
8 #include "NonlinearRZ.h"
9 #include "SolidModel.h"
10 #include "Problem.h"
12 
13 #include "libmesh/quadrature.h"
14 
15 namespace SolidMechanics
16 {
17 
19  const std::string & name,
20  const InputParameters & parameters)
21  : Nonlinear(solid_model, name, parameters),
22  _grad_disp_r(coupledGradient("disp_r")),
23  _grad_disp_z(coupledGradient("disp_z")),
24  _grad_disp_r_old(coupledGradientOld("disp_r")),
25  _grad_disp_z_old(coupledGradientOld("disp_z")),
26  _disp_r(coupledValue("disp_r")),
27  _disp_r_old(coupledValueOld("disp_r")),
28  _volumetric_locking_correction(_solid_model.getParam<bool>("volumetric_locking_correction"))
29 {
30 }
31 
33 
35 
37 
38 void
40 {
41  // A = grad(u(k+1) - u(k))
42  // Fbar = 1 + grad(u(k))
43  // Fhat = 1 + A*(Fbar^-1)
44  ColumnMajorMatrix A;
45  ColumnMajorMatrix Fbar;
46  ColumnMajorMatrix Fbar_inverse;
47  ColumnMajorMatrix Fhat_average;
48  Real volume(0);
49 
50  _Fbar.resize(_solid_model.qrule()->n_points());
51 
52  for (unsigned qp = 0; qp < _solid_model.qrule()->n_points(); ++qp)
53  {
56 
57  A -= Fbar;
58 
59  Fbar.addDiag(1);
60 
61  _Fbar[qp] = Fbar;
62 
63  // Get Fbar^(-1)
64  // Computing the inverse is generally a bad idea.
65  // It's better to compute LU factors. For now at least, we'll take
66  // a direct route.
67 
68  invertMatrix(Fbar, Fbar_inverse);
69 
70  Fhat[qp] = A * Fbar_inverse;
71  Fhat[qp].addDiag(1);
72 
74  {
75  // Now include the contribution for the integration of Fhat over the element
76  Fhat_average += Fhat[qp] * _solid_model.JxW(qp) * _solid_model.q_point(qp)(0);
77 
78  volume += _solid_model.JxW(qp) *
79  _solid_model.q_point(qp)(0); // Accumulate original configuration volume
80  }
81  }
82 
84  {
85  Fhat_average /= volume;
86  const Real det_Fhat_average(detMatrix(Fhat_average));
87 
88  // Finalize volumetric locking correction
89  for (unsigned qp = 0; qp < _solid_model.qrule()->n_points(); ++qp)
90  {
91  const Real det_Fhat(detMatrix(Fhat[qp]));
92  const Real factor(std::cbrt(det_Fhat_average / det_Fhat));
93 
94  Fhat[qp] *= factor;
95  }
96  }
97  // Moose::out << "Fhat(0,0)" << Fhat[0](0,0) << std::endl;
98 }
99 
101 
102 void
103 NonlinearRZ::computeDeformationGradient(unsigned int qp, ColumnMajorMatrix & F)
104 {
105  mooseAssert(F.n() == 3 && F.m() == 3, "computeDefGrad requires 3x3 matrix");
106 
107  F(0, 0) = _grad_disp_r[qp](0) + 1;
108  F(0, 1) = _grad_disp_r[qp](1);
109  F(0, 2) = 0;
110  F(1, 0) = _grad_disp_z[qp](0);
111  F(1, 1) = _grad_disp_z[qp](1) + 1;
112  F(1, 2) = 0;
113  F(2, 0) = 0;
114  F(2, 1) = 0;
115  F(2, 2) =
116  (_solid_model.q_point(qp)(0) != 0.0 ? _disp_r[qp] / _solid_model.q_point(qp)(0) : 0.0) + 1;
117 }
118 
120 
121 void
122 NonlinearRZ::fillMatrix(unsigned int qp,
123  const VariableGradient & grad_r,
124  const VariableGradient & grad_z,
125  const VariableValue & u,
126  ColumnMajorMatrix & A) const
127 {
128  mooseAssert(A.n() == 3 && A.m() == 3, "computeDefGrad requires 3x3 matrix");
129 
130  A(0, 0) = grad_r[qp](0);
131  A(0, 1) = grad_r[qp](1);
132  A(0, 2) = 0;
133  A(1, 0) = grad_z[qp](0);
134  A(1, 1) = grad_z[qp](1);
135  A(1, 2) = 0;
136  A(2, 0) = 0;
137  A(2, 1) = 0;
138  A(2, 2) = (_solid_model.q_point(qp)(0) != 0.0 ? u[qp] / _solid_model.q_point(qp)(0) : 0.0);
139 }
140 
142 
143 Real
144 NonlinearRZ::volumeRatioOld(unsigned int qp) const
145 {
146  ColumnMajorMatrix Fnm1T;
148  Fnm1T.addDiag(1);
149 
150  return detMatrix(Fnm1T);
151 }
152 
154 }
Nonlinear is the base class for all large strain/rotation models.
Definition: Nonlinear.h:22
const Point & q_point(unsigned i) const
Definition: SolidModel.h:54
virtual void fillMatrix(unsigned int qp, const VariableGradient &grad_r, const VariableGradient &grad_z, const VariableValue &u, ColumnMajorMatrix &A) const
Definition: NonlinearRZ.C:122
const VariableGradient & _grad_disp_z_old
Definition: NonlinearRZ.h:30
std::vector< ColumnMajorMatrix > _Fbar
Definition: Nonlinear.h:46
const VariableGradient & _grad_disp_r
Definition: NonlinearRZ.h:27
virtual Real volumeRatioOld(unsigned qp) const
Definition: NonlinearRZ.C:144
SolidModel is the base class for all this module&#39;s solid mechanics material models.
Definition: SolidModel.h:31
QBase * qrule()
Definition: SolidModel.h:53
const VariableValue & _disp_r
Definition: NonlinearRZ.h:31
static Real detMatrix(const ColumnMajorMatrix &A)
Definition: Element.C:28
virtual void computeIncrementalDeformationGradient(std::vector< ColumnMajorMatrix > &Fhat)
Definition: NonlinearRZ.C:39
NonlinearRZ(SolidModel &solid_model, const std::string &name, const InputParameters &parameters)
Definition: NonlinearRZ.C:18
virtual void computeDeformationGradient(unsigned int qp, ColumnMajorMatrix &F)
Definition: NonlinearRZ.C:103
Real JxW(unsigned i) const
Definition: SolidModel.h:55
const std::vector< ColumnMajorMatrix > & Fhat() const
Definition: Nonlinear.h:31
SolidModel & _solid_model
Definition: Element.h:72
const VariableGradient & _grad_disp_z
Definition: NonlinearRZ.h:28
const VariableValue & _disp_r_old
Definition: NonlinearRZ.h:32
const VariableGradient & _grad_disp_r_old
Definition: NonlinearRZ.h:29
static void invertMatrix(const ColumnMajorMatrix &A, ColumnMajorMatrix &Ainv)
Definition: Element.C:49
const bool _volumetric_locking_correction
Definition: NonlinearRZ.h:45