LCOV - code coverage report
Current view: top level - src/kernels - NSEnergyViscousFlux.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 0 36 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 "NSEnergyViscousFlux.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", NSEnergyViscousFlux);
      13             : 
      14             : InputParameters
      15           0 : NSEnergyViscousFlux::validParams()
      16             : {
      17           0 :   InputParameters params = NSKernel::validParams();
      18           0 :   params.addClassDescription("Viscous flux terms in energy equation.");
      19           0 :   return params;
      20           0 : }
      21             : 
      22           0 : NSEnergyViscousFlux::NSEnergyViscousFlux(const InputParameters & parameters)
      23           0 :   : NSKernel(parameters), _vst_derivs(*this)
      24             : {
      25           0 : }
      26             : 
      27             : Real
      28           0 : NSEnergyViscousFlux::computeQpResidual()
      29             : {
      30             :   // (tau * u) * grad(phi)
      31           0 :   RealVectorValue velocity(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
      32           0 :   RealVectorValue vec = _viscous_stress_tensor[_qp] * velocity;
      33             : 
      34           0 :   return vec * _grad_test[_i][_qp];
      35             : }
      36             : 
      37             : Real
      38           0 : NSEnergyViscousFlux::computeQpJacobian()
      39             : {
      40             :   // No dependence of this term on U_4!
      41           0 :   return 0.0;
      42             : }
      43             : 
      44             : Real
      45           0 : NSEnergyViscousFlux::computeQpOffDiagJacobian(unsigned int jvar)
      46             : {
      47           0 :   if (isNSVariable(jvar))
      48             :   {
      49             : 
      50             :     // Convenience variables
      51           0 :     const RealTensorValue & tau = _viscous_stress_tensor[_qp];
      52             : 
      53           0 :     Real rho = _rho[_qp];
      54           0 :     Real phij = _phi[_j][_qp];
      55           0 :     RealVectorValue U(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
      56             : 
      57             :     // Map jvar into the variable m for our problem, regardless of
      58             :     // how Moose has numbered things.
      59           0 :     unsigned m = mapVarNumber(jvar);
      60             : 
      61             :     // Compute Jacobian terms based on the value of m
      62           0 :     switch (m)
      63             :     {
      64             :       case 0: // Density
      65             :       {
      66             :         // Return value
      67             :         Real value = 0.0;
      68             : 
      69           0 :         for (const auto k : make_range(Moose::dim))
      70             :         {
      71             :           Real intermediate_value = 0.0;
      72             : 
      73           0 :           for (unsigned ell = 0; ell < LIBMESH_DIM; ++ell)
      74           0 :             intermediate_value +=
      75           0 :                 (U(ell) / rho * (-tau(k, ell) * phij / rho + _vst_derivs.dtau(k, ell, 0)));
      76             : 
      77             :           // Hit accumulated value with test function
      78           0 :           value += intermediate_value * _grad_test[_i][_qp](k);
      79             :         } // end for k
      80             : 
      81           0 :         return value;
      82             :       }
      83             : 
      84           0 :       case 1:
      85             :       case 2:
      86             :       case 3: // Momentums
      87             :       {
      88             :         // Return value
      89             :         Real value = 0.0;
      90             : 
      91             :         // "local" version of m, mapped to 0, 1, 2, for indexing
      92             :         // into Point objects.
      93           0 :         const unsigned int m_local = m - 1;
      94             : 
      95           0 :         for (const auto k : make_range(Moose::dim))
      96             :         {
      97           0 :           Real intermediate_value = tau(k, m_local) * phij / rho;
      98             : 
      99           0 :           for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
     100           0 :             intermediate_value += _vst_derivs.dtau(k, ell, m) * U(ell) /
     101             :                                   rho; // Note: pass 'm' to dtau, it will convert it internally
     102             : 
     103             :           // Hit accumulated value with test function
     104           0 :           value += intermediate_value * _grad_test[_i][_qp](k);
     105             :         } // end for k
     106             : 
     107           0 :         return value;
     108             :       }
     109             : 
     110             :       default:
     111             :         return 0.0;
     112             :     } // end switch (m)
     113             :   }
     114             :   else
     115             :     return 0.0;
     116             : }

Generated by: LCOV version 1.14