LCOV - code coverage report
Current view: top level - src/kernels - INSMomentumTractionFormRZ.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 32 33 97.0 %
Date: 2025-08-14 10:14:56 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          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 "INSMomentumTractionFormRZ.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", INSMomentumTractionFormRZ);
      13             : 
      14             : InputParameters
      15         410 : INSMomentumTractionFormRZ::validParams()
      16             : {
      17         410 :   InputParameters params = INSMomentumTractionForm::validParams();
      18         410 :   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.");
      21         410 :   return params;
      22           0 : }
      23             : 
      24         220 : INSMomentumTractionFormRZ::INSMomentumTractionFormRZ(const InputParameters & parameters)
      25         220 :   : INSMomentumTractionForm(parameters)
      26             : {
      27         220 : }
      28             : 
      29             : RealVectorValue
      30     6827760 : INSMomentumTractionFormRZ::strongViscousTermTraction()
      31             : {
      32     6827760 :   return INSBase::strongViscousTermTraction() + strongViscousTermTractionRZ();
      33             : }
      34             : 
      35             : RealVectorValue
      36     4216320 : INSMomentumTractionFormRZ::dStrongViscDUCompTraction(const unsigned int comp)
      37             : {
      38     4216320 :   return INSBase::dStrongViscDUCompTraction(comp) + dStrongViscDUCompTractionRZ(comp);
      39             : }
      40             : 
      41             : Real
      42     6661260 : INSMomentumTractionFormRZ::computeQpResidual()
      43             : {
      44             :   // Base class residual contribution
      45     6661260 :   Real res_base = INSMomentumTractionForm::computeQpResidual();
      46             : 
      47     6661260 :   if (_component == _rz_radial_coord)
      48             :   {
      49     3330630 :     const auto r = _q_point[_qp](_rz_radial_coord);
      50     3330630 :     const auto r_vel = (_rz_radial_coord == 0) ? _u_vel[_qp] : _v_vel[_qp];
      51             : 
      52             :     // If this is the radial component of momentum, there is an extra term for RZ.
      53     3330630 :     res_base += 2. * _mu[_qp] * r_vel / (r * r) * _test[_i][_qp];
      54             : 
      55             :     // If the pressure is also integrated by parts, there is an extra term in RZ.
      56     3330630 :     if (_integrate_p_by_parts)
      57     1161720 :       res_base += -_p[_qp] / r * _test[_i][_qp];
      58             :   }
      59             : 
      60     6661260 :   return res_base;
      61             : }
      62             : 
      63             : Real
      64    23675220 : INSMomentumTractionFormRZ::computeQpJacobian()
      65             : {
      66             :   // Base class jacobian contribution
      67    23675220 :   Real jac_base = INSMomentumTractionForm::computeQpJacobian();
      68             : 
      69    23675220 :   if (_component == _rz_radial_coord)
      70             :   {
      71    11837610 :     const auto r = _q_point[_qp](_rz_radial_coord);
      72             : 
      73             :     // If this is the radial component of momentum, there is an extra term for RZ.
      74    11837610 :     jac_base += 2. * _mu[_qp] * _phi[_j][_qp] / (r * r) * _test[_i][_qp];
      75             :   }
      76             : 
      77    23675220 :   return jac_base;
      78             : }
      79             : 
      80             : Real
      81    36020160 : INSMomentumTractionFormRZ::computeQpOffDiagJacobian(unsigned jvar)
      82             : {
      83             :   // Base class jacobian contribution
      84    36020160 :   Real jac_base = INSMomentumTractionForm::computeQpOffDiagJacobian(jvar);
      85             : 
      86             :   // If we're getting the pressure Jacobian contribution, and we
      87             :   // integrated the pressure term by parts, there is an extra term for
      88             :   // RZ.
      89    36020160 :   if (jvar == _p_var_number && _component == _rz_radial_coord && _integrate_p_by_parts)
      90             :   {
      91      622080 :     const auto r = _q_point[_qp](_rz_radial_coord);
      92      622080 :     jac_base += -_phi[_j][_qp] / r * _test[_i][_qp];
      93             :   }
      94             : 
      95    36020160 :   return jac_base;
      96             : }

Generated by: LCOV version 1.14