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 "INSMomentumLaplaceFormRZ.h" 11 : 12 : registerMooseObject("NavierStokesApp", INSMomentumLaplaceFormRZ); 13 : 14 : InputParameters 15 558 : INSMomentumLaplaceFormRZ::validParams() 16 : { 17 558 : InputParameters params = INSMomentumLaplaceForm::validParams(); 18 558 : params.addClassDescription("This class computes additional momentum equation residual and " 19 : "Jacobian contributions for the incompressible Navier-Stokes momentum " 20 : "equation in RZ (axisymmetric cylindrical) coordinates, using the " 21 : "'Laplace' form of the governing equations."); 22 558 : return params; 23 0 : } 24 : 25 294 : INSMomentumLaplaceFormRZ::INSMomentumLaplaceFormRZ(const InputParameters & parameters) 26 294 : : INSMomentumLaplaceForm(parameters) 27 : { 28 294 : } 29 : 30 : RealVectorValue 31 24264528 : INSMomentumLaplaceFormRZ::strongViscousTermLaplace() 32 : { 33 24264528 : return INSBase::strongViscousTermLaplace() + strongViscousTermLaplaceRZ(); 34 : } 35 : 36 : RealVectorValue 37 20641104 : INSMomentumLaplaceFormRZ::dStrongViscDUCompLaplace(const unsigned int comp) 38 : { 39 20641104 : return INSBase::dStrongViscDUCompLaplace(comp) + dStrongViscDUCompLaplaceRZ(comp); 40 : } 41 : 42 : Real 43 17724984 : INSMomentumLaplaceFormRZ::computeQpResidual() 44 : { 45 : // Base class residual contribution 46 17724984 : Real res_base = INSMomentumLaplaceForm::computeQpResidual(); 47 : 48 17724984 : if (_component == _rz_radial_coord) 49 : { 50 8862492 : const auto r = _q_point[_qp](_rz_radial_coord); 51 : 52 : // If this is the radial component of momentum, there is an extra term for RZ. 53 : // The only difference between this and the traction form is a factor of 2. 54 8862492 : res_base += 55 8862492 : _mu[_qp] * ((_rz_radial_coord == 0) ? _u_vel[_qp] : _v_vel[_qp]) / (r * r) * _test[_i][_qp]; 56 : 57 : // If the pressure is also integrated by parts, there is an extra term in RZ. 58 8862492 : if (_integrate_p_by_parts) 59 7597392 : res_base += -_p[_qp] / r * _test[_i][_qp]; 60 : } 61 : 62 17724984 : return res_base; 63 : } 64 : 65 : Real 66 102165912 : INSMomentumLaplaceFormRZ::computeQpJacobian() 67 : { 68 : // Base class jacobian contribution 69 102165912 : Real jac_base = INSMomentumLaplaceForm::computeQpJacobian(); 70 : 71 : // If this is the radial component of momentum, there is an extra term for RZ. 72 102165912 : if (_component == _rz_radial_coord) 73 : { 74 51082956 : const auto r = _q_point[_qp](_rz_radial_coord); 75 : // The only difference between this and the traction form is a factor of 2. 76 51082956 : jac_base += _mu[_qp] * _phi[_j][_qp] * _test[_i][_qp] / (r * r); 77 : } 78 : 79 102165912 : return jac_base; 80 : } 81 : 82 : Real 83 152189964 : INSMomentumLaplaceFormRZ::computeQpOffDiagJacobian(const unsigned int jvar) 84 : { 85 : // Base class jacobian contribution 86 152189964 : Real jac_base = INSMomentumLaplaceForm::computeQpOffDiagJacobian(jvar); 87 : 88 : // If we're getting the pressure Jacobian contribution, and we 89 : // integrated the pressure term by parts, there is an extra term for 90 : // RZ. 91 152189964 : if ((jvar == _p_var_number) && (_component == _rz_radial_coord) && _integrate_p_by_parts) 92 : { 93 21626586 : const auto r = _q_point[_qp](_rz_radial_coord); 94 21626586 : jac_base += -_phi[_j][_qp] / r * _test[_i][_qp]; 95 : } 96 : 97 152189964 : return jac_base; 98 : }