LCOV - code coverage report
Current view: top level - src/kernels - INSMomentumTractionForm.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 35 38 92.1 %
Date: 2025-08-14 10:14:56 Functions: 5 5 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 "INSMomentumTractionForm.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", INSMomentumTractionForm);
      13             : 
      14             : InputParameters
      15         528 : INSMomentumTractionForm::validParams()
      16             : {
      17         528 :   InputParameters params = INSMomentumBase::validParams();
      18         528 :   params.addClassDescription("This class computes momentum equation residual and Jacobian viscous "
      19             :                              "contributions for the 'traction' form of the governing equations.");
      20         528 :   return params;
      21           0 : }
      22             : 
      23         282 : INSMomentumTractionForm::INSMomentumTractionForm(const InputParameters & parameters)
      24         282 :   : INSMomentumBase(parameters)
      25             : {
      26         282 : }
      27             : 
      28             : Real
      29     9145692 : INSMomentumTractionForm::computeQpResidualViscousPart()
      30             : {
      31             :   // The component'th row (or col, it's symmetric) of the viscous stress tensor
      32             :   RealVectorValue tau_row;
      33             : 
      34     9145692 :   switch (_component)
      35             :   {
      36     4450374 :     case 0:
      37     4450374 :       tau_row(0) = 2. * _grad_u_vel[_qp](0);                  // 2*du/dx1
      38     4450374 :       tau_row(1) = _grad_u_vel[_qp](1) + _grad_v_vel[_qp](0); // du/dx2 + dv/dx1
      39     4450374 :       tau_row(2) = _grad_u_vel[_qp](2) + _grad_w_vel[_qp](0); // du/dx3 + dw/dx1
      40     4450374 :       break;
      41             : 
      42     4450374 :     case 1:
      43     4450374 :       tau_row(0) = _grad_v_vel[_qp](0) + _grad_u_vel[_qp](1); // dv/dx1 + du/dx2
      44     4450374 :       tau_row(1) = 2. * _grad_v_vel[_qp](1);                  // 2*dv/dx2
      45     4450374 :       tau_row(2) = _grad_v_vel[_qp](2) + _grad_w_vel[_qp](1); // dv/dx3 + dw/dx2
      46     4450374 :       break;
      47             : 
      48      244944 :     case 2:
      49      244944 :       tau_row(0) = _grad_w_vel[_qp](0) + _grad_u_vel[_qp](2); // dw/dx1 + du/dx3
      50      244944 :       tau_row(1) = _grad_w_vel[_qp](1) + _grad_v_vel[_qp](2); // dw/dx2 + dv/dx3
      51      244944 :       tau_row(2) = 2. * _grad_w_vel[_qp](2);                  // 2*dw/dx3
      52      244944 :       break;
      53             : 
      54           0 :     default:
      55           0 :       mooseError("Unrecognized _component requested.");
      56             :   }
      57             : 
      58             :   // The viscous part, _mu[_qp] * tau : grad(v)
      59     9145692 :   return _mu[_qp] * (tau_row * _grad_test[_i][_qp]);
      60             : }
      61             : 
      62             : Real
      63    35662167 : INSMomentumTractionForm::computeQpJacobianViscousPart()
      64             : {
      65             :   // Viscous part, full stress tensor.  The extra contribution comes from the "2"
      66             :   // on the diagonal of the viscous stress tensor.
      67    35662167 :   return _mu[_qp] * (_grad_phi[_j][_qp] * _grad_test[_i][_qp] +
      68    35662167 :                      _grad_phi[_j][_qp](_component) * _grad_test[_i][_qp](_component));
      69             : }
      70             : 
      71             : Real
      72    35839314 : INSMomentumTractionForm::computeQpOffDiagJacobianViscousPart(unsigned jvar)
      73             : {
      74             :   // In Stokes/Laplacian version, off-diag Jacobian entries wrt u,v,w are zero
      75    35839314 :   if (jvar == _u_vel_var_number)
      76    17860608 :     return _mu[_qp] * _grad_phi[_j][_qp](_component) * _grad_test[_i][_qp](0);
      77             : 
      78    17978706 :   else if (jvar == _v_vel_var_number)
      79    17860608 :     return _mu[_qp] * _grad_phi[_j][_qp](_component) * _grad_test[_i][_qp](1);
      80             : 
      81      118098 :   else if (jvar == _w_vel_var_number)
      82      118098 :     return _mu[_qp] * _grad_phi[_j][_qp](_component) * _grad_test[_i][_qp](2);
      83             : 
      84             :   else
      85             :     return 0;
      86             : }

Generated by: LCOV version 1.14