LCOV - code coverage report
Current view: top level - src/kernels - NSMassInviscidFlux.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: #32971 (54bef8) with base c6cf66 Lines: 16 19 84.2 %
Date: 2026-05-29 20:37:52 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          19 : NSMassInviscidFlux::validParams()
      16             : {
      17          19 :   InputParameters params = NSKernel::validParams();
      18          19 :   params.addClassDescription("This class computes the inviscid flux in the mass equation.");
      19          19 :   return params;
      20           0 : }
      21             : 
      22          10 : NSMassInviscidFlux::NSMassInviscidFlux(const InputParameters & parameters) : NSKernel(parameters) {}
      23             : 
      24             : Real
      25     3698688 : NSMassInviscidFlux::computeQpResidual()
      26             : {
      27     3698688 :   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     3698688 :   return -(mom * _grad_test[_i][_qp]);
      31             : }
      32             : 
      33             : Real
      34     2248704 : 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     2248704 :   return 0.0;
      51             : }
      52             : 
      53             : Real
      54     6746112 : NSMassInviscidFlux::computeQpOffDiagJacobian(unsigned int jvar)
      55             : {
      56     6746112 :   if (isNSVariable(jvar))
      57             :   {
      58             :     // Map jvar into the variable m for our problem, regardless of
      59             :     // how Moose has numbered things.
      60     6746112 :     unsigned int m = mapVarNumber(jvar);
      61             : 
      62     6746112 :     switch (m)
      63             :     {
      64             :       // Don't handle the on-diagonal case here
      65             :       // case 0: // density
      66     4497408 :       case 1:
      67             :       case 2:
      68             :       case 3: // momentums
      69     4497408 :         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