LCOV - code coverage report
Current view: top level - src/kernels - NSMassInviscidFlux.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 16 19 84.2 %
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 "NSMassInviscidFlux.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", NSMassInviscidFlux);
      13             : 
      14             : InputParameters
      15          41 : NSMassInviscidFlux::validParams()
      16             : {
      17          41 :   InputParameters params = NSKernel::validParams();
      18          41 :   params.addClassDescription("This class computes the inviscid flux in the mass equation.");
      19          41 :   return params;
      20           0 : }
      21             : 
      22          22 : NSMassInviscidFlux::NSMassInviscidFlux(const InputParameters & parameters) : NSKernel(parameters) {}
      23             : 
      24             : Real
      25     5483520 : NSMassInviscidFlux::computeQpResidual()
      26             : {
      27     5483520 :   const RealVectorValue mom(_rho_u[_qp], _rho_v[_qp], _rho_w[_qp]);
      28             : 
      29             :   // -(rho*U) * grad(phi), negative sign comes from integration-by-parts
      30     5483520 :   return -(mom * _grad_test[_i][_qp]);
      31             : }
      32             : 
      33             : Real
      34     3354624 : NSMassInviscidFlux::computeQpJacobian()
      35             : {
      36             :   // This seems weird at first glance, but remember we have to differentiate
      37             :   // wrt the *conserved* variables
      38             :   //
      39             :   // [ U_0 ] = [ rho       ]
      40             :   // [ U_1 ] = [ rho * u_1 ]
      41             :   // [ U_2 ] = [ rho * u_2 ]
      42             :   // [ U_3 ] = [ rho * u_3 ]
      43             :   // [ U_4 ] = [ rho * E   ]
      44             :   //
      45             :   // and the inviscid mass flux residual, in terms of these variables, is:
      46             :   //
      47             :   // f(U) = ( U_k * dphi_i/dx_k ), summation over k=1,2,3
      48             :   //
      49             :   // ie. does not depend on U_0, the on-diagonal Jacobian component.
      50     3354624 :   return 0.0;
      51             : }
      52             : 
      53             : Real
      54    10063872 : NSMassInviscidFlux::computeQpOffDiagJacobian(unsigned int jvar)
      55             : {
      56    10063872 :   if (isNSVariable(jvar))
      57             :   {
      58             :     // Map jvar into the variable m for our problem, regardless of
      59             :     // how Moose has numbered things.
      60    10063872 :     unsigned int m = mapVarNumber(jvar);
      61             : 
      62    10063872 :     switch (m)
      63             :     {
      64             :       // Don't handle the on-diagonal case here
      65             :       // case 0: // density
      66     6709248 :       case 1:
      67             :       case 2:
      68             :       case 3: // momentums
      69     6709248 :         return -_phi[_j][_qp] * _grad_test[_i][_qp](m - 1);
      70             : 
      71             :       case 4: // energy
      72             :         return 0.0;
      73             : 
      74           0 :       default:
      75           0 :         mooseError("Should not get here!");
      76             :         break;
      77             :     }
      78             :   }
      79             :   else
      80             :     return 0.0;
      81             : }

Generated by: LCOV version 1.14