LCOV - code coverage report
Current view: top level - src/kernels - INSMomentumTractionFormRZ.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 32 33 97.0 %
Date: 2026-05-29 20:37:52 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         190 : INSMomentumTractionFormRZ::validParams()
      16             : {
      17         190 :   InputParameters params = INSMomentumTractionForm::validParams();
      18         190 :   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         190 :   return params;
      22           0 : }
      23             : 
      24         100 : INSMomentumTractionFormRZ::INSMomentumTractionFormRZ(const InputParameters & parameters)
      25         100 :   : INSMomentumTractionForm(parameters)
      26             : {
      27         100 : }
      28             : 
      29             : RealVectorValue
      30     4244280 : INSMomentumTractionFormRZ::strongViscousTermTraction()
      31             : {
      32     4244280 :   return INSBase::strongViscousTermTraction() + strongViscousTermTractionRZ();
      33             : }
      34             : 
      35             : RealVectorValue
      36     2779200 : INSMomentumTractionFormRZ::dStrongViscDUCompTraction(const unsigned int comp)
      37             : {
      38     2779200 :   return INSBase::dStrongViscDUCompTraction(comp) + dStrongViscDUCompTractionRZ(comp);
      39             : }
      40             : 
      41             : Real
      42     4169580 : INSMomentumTractionFormRZ::computeQpResidual()
      43             : {
      44             :   // Base class residual contribution
      45     4169580 :   Real res_base = INSMomentumTractionForm::computeQpResidual();
      46             : 
      47     4169580 :   if (_component == _rz_radial_coord)
      48             :   {
      49     2084790 :     const auto r = _q_point[_qp](_rz_radial_coord);
      50     2084790 :     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     2084790 :     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     2084790 :     if (_integrate_p_by_parts)
      57      636540 :       res_base += -_p[_qp] / r * _test[_i][_qp];
      58             :   }
      59             : 
      60     4169580 :   return res_base;
      61             : }
      62             : 
      63             : Real
      64    15767640 : INSMomentumTractionFormRZ::computeQpJacobian()
      65             : {
      66             :   // Base class jacobian contribution
      67    15767640 :   Real jac_base = INSMomentumTractionForm::computeQpJacobian();
      68             : 
      69    15767640 :   if (_component == _rz_radial_coord)
      70             :   {
      71     7883820 :     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     7883820 :     jac_base += 2. * _mu[_qp] * _phi[_j][_qp] / (r * r) * _test[_i][_qp];
      75             :   }
      76             : 
      77    15767640 :   return jac_base;
      78             : }
      79             : 
      80             : Real
      81    23981760 : INSMomentumTractionFormRZ::computeQpOffDiagJacobian(unsigned jvar)
      82             : {
      83             :   // Base class jacobian contribution
      84    23981760 :   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    23981760 :   if (jvar == _p_var_number && _component == _rz_radial_coord && _integrate_p_by_parts)
      90             :   {
      91      406800 :     const auto r = _q_point[_qp](_rz_radial_coord);
      92      406800 :     jac_base += -_phi[_j][_qp] / r * _test[_i][_qp];
      93             :   }
      94             : 
      95    23981760 :   return jac_base;
      96             : }

Generated by: LCOV version 1.14