LCOV - code coverage report
Current view: top level - src/kernels - NSMomentumViscousFlux.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 0 26 0.0 %
Date: 2025-08-14 10:14:56 Functions: 0 5 0.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 "NSMomentumViscousFlux.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", NSMomentumViscousFlux);
      13             : 
      14             : InputParameters
      15           0 : NSMomentumViscousFlux::validParams()
      16             : {
      17           0 :   InputParameters params = NSKernel::validParams();
      18           0 :   params.addClassDescription(
      19             :       "Derived instance of the NSViscousFluxBase class for the momentum equations.");
      20           0 :   params.addRequiredParam<unsigned int>("component", "");
      21           0 :   return params;
      22           0 : }
      23             : 
      24           0 : NSMomentumViscousFlux::NSMomentumViscousFlux(const InputParameters & parameters)
      25           0 :   : NSKernel(parameters), _component(getParam<unsigned int>("component")), _vst_derivs(*this)
      26             : {
      27           0 : }
      28             : 
      29             : Real
      30           0 : NSMomentumViscousFlux::computeQpResidual()
      31             : {
      32             :   // Yay for less typing!
      33           0 :   const RealTensorValue & vst = _viscous_stress_tensor[_qp];
      34             : 
      35             :   // _component'th column of vst...
      36           0 :   RealVectorValue vec(vst(0, _component), vst(1, _component), vst(2, _component));
      37             : 
      38             :   // ... dotted with grad(phi), note: sign is positive as this term was -div(tau) on the lhs
      39           0 :   return vec * _grad_test[_i][_qp];
      40             : }
      41             : 
      42             : Real
      43           0 : NSMomentumViscousFlux::computeQpJacobian()
      44             : {
      45             :   Real value = 0.0;
      46             : 
      47             :   // Set variable names as in the notes
      48           0 :   const unsigned k = _component;
      49           0 :   const unsigned m = _component + 1; // _component = 0,1,2 -> m = 1,2,3 global variable number
      50             : 
      51             :   // Use external templated friend class for common viscous stress
      52             :   // tensor derivative computations.
      53           0 :   for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
      54           0 :     value += _vst_derivs.dtau(k, ell, m) * _grad_test[_i][_qp](ell);
      55             : 
      56           0 :   return value;
      57             : }
      58             : 
      59             : Real
      60           0 : NSMomentumViscousFlux::computeQpOffDiagJacobian(unsigned int jvar)
      61             : {
      62           0 :   if (isNSVariable(jvar))
      63             :   {
      64             :     Real value = 0.0;
      65             : 
      66             :     // Set variable names as in the notes
      67           0 :     const unsigned int k = _component;
      68             : 
      69             :     // Map jvar into the variable m for our problem, regardless of
      70             :     // how Moose has numbered things.
      71           0 :     unsigned int m = mapVarNumber(jvar);
      72             : 
      73           0 :     for (unsigned ell = 0; ell < LIBMESH_DIM; ++ell)
      74           0 :       value += _vst_derivs.dtau(k, ell, m) * _grad_test[_i][_qp](ell);
      75             : 
      76           0 :     return value;
      77             :   }
      78             :   else
      79             :     return 0.0;
      80             : }

Generated by: LCOV version 1.14