LCOV - code coverage report
Current view: top level - src/kernels - INSMomentumLaplaceFormRZ.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 "INSMomentumLaplaceFormRZ.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", INSMomentumLaplaceFormRZ);
      13             : 
      14             : InputParameters
      15        1186 : INSMomentumLaplaceFormRZ::validParams()
      16             : {
      17        1186 :   InputParameters params = INSMomentumLaplaceForm::validParams();
      18        1186 :   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        1186 :   return params;
      23           0 : }
      24             : 
      25         638 : INSMomentumLaplaceFormRZ::INSMomentumLaplaceFormRZ(const InputParameters & parameters)
      26         638 :   : INSMomentumLaplaceForm(parameters)
      27             : {
      28         638 : }
      29             : 
      30             : RealVectorValue
      31    36445104 : INSMomentumLaplaceFormRZ::strongViscousTermLaplace()
      32             : {
      33    36445104 :   return INSBase::strongViscousTermLaplace() + strongViscousTermLaplaceRZ();
      34             : }
      35             : 
      36             : RealVectorValue
      37    31006260 : INSMomentumLaplaceFormRZ::dStrongViscDUCompLaplace(const unsigned int comp)
      38             : {
      39    31006260 :   return INSBase::dStrongViscDUCompLaplace(comp) + dStrongViscDUCompLaplaceRZ(comp);
      40             : }
      41             : 
      42             : Real
      43    26396784 : INSMomentumLaplaceFormRZ::computeQpResidual()
      44             : {
      45             :   // Base class residual contribution
      46    26396784 :   Real res_base = INSMomentumLaplaceForm::computeQpResidual();
      47             : 
      48    26396784 :   if (_component == _rz_radial_coord)
      49             :   {
      50    13198392 :     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    13198392 :     res_base +=
      55    13198392 :         _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    13198392 :     if (_integrate_p_by_parts)
      59    11300742 :       res_base += -_p[_qp] / r * _test[_i][_qp];
      60             :   }
      61             : 
      62    26396784 :   return res_base;
      63             : }
      64             : 
      65             : Real
      66   151854750 : INSMomentumLaplaceFormRZ::computeQpJacobian()
      67             : {
      68             :   // Base class jacobian contribution
      69   151854750 :   Real jac_base = INSMomentumLaplaceForm::computeQpJacobian();
      70             : 
      71             :   // If this is the radial component of momentum, there is an extra term for RZ.
      72   151854750 :   if (_component == _rz_radial_coord)
      73             :   {
      74    75927375 :     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    75927375 :     jac_base += _mu[_qp] * _phi[_j][_qp] * _test[_i][_qp] / (r * r);
      77             :   }
      78             : 
      79   151854750 :   return jac_base;
      80             : }
      81             : 
      82             : Real
      83   226286730 : INSMomentumLaplaceFormRZ::computeQpOffDiagJacobian(const unsigned int jvar)
      84             : {
      85             :   // Base class jacobian contribution
      86   226286730 :   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   226286730 :   if ((jvar == _p_var_number) && (_component == _rz_radial_coord) && _integrate_p_by_parts)
      92             :   {
      93    32137830 :     const auto r = _q_point[_qp](_rz_radial_coord);
      94    32137830 :     jac_base += -_phi[_j][_qp] / r * _test[_i][_qp];
      95             :   }
      96             : 
      97   226286730 :   return jac_base;
      98             : }

Generated by: LCOV version 1.14