LCOV - code coverage report
Current view: top level - src/auxkernels - NSInternalEnergyAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 19 20 95.0 %
Date: 2025-08-14 10:14:56 Functions: 3 3 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             : // Navier-Stokes includes
      11             : #include "NSInternalEnergyAux.h"
      12             : #include "NS.h"
      13             : 
      14             : // MOOSE includes
      15             : #include "MooseMesh.h"
      16             : 
      17             : registerMooseObject("NavierStokesApp", NSInternalEnergyAux);
      18             : 
      19             : InputParameters
      20          41 : NSInternalEnergyAux::validParams()
      21             : {
      22          41 :   InputParameters params = AuxKernel::validParams();
      23             : 
      24          41 :   params.addClassDescription("Auxiliary kernel for computing the internal energy of the fluid.");
      25          41 :   params.addRequiredCoupledVar(NS::density, "density");
      26          41 :   params.addRequiredCoupledVar(NS::velocity_x, "x-velocity");
      27          41 :   params.addCoupledVar(NS::velocity_y, "y-velocity"); // Only required in >= 2D
      28          41 :   params.addCoupledVar(NS::velocity_z, "z-velocity"); // Only required in 3D...
      29          41 :   params.addRequiredCoupledVar(NS::total_energy_density, "total energy");
      30             : 
      31          41 :   return params;
      32           0 : }
      33             : 
      34          22 : NSInternalEnergyAux::NSInternalEnergyAux(const InputParameters & parameters)
      35             :   : AuxKernel(parameters),
      36          44 :     _rho(coupledValue(NS::density)),
      37          22 :     _u_vel(coupledValue(NS::velocity_x)),
      38          22 :     _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero),
      39          22 :     _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
      40          44 :     _rho_et(coupledValue(NS::total_energy_density))
      41             : {
      42          22 : }
      43             : 
      44             : Real
      45      422100 : NSInternalEnergyAux::computeValue()
      46             : {
      47      422100 :   const RealVectorValue vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
      48             : 
      49      422100 :   return _rho_et[_qp] / _rho[_qp] - 0.5 * vel.norm_sq();
      50             : }

Generated by: LCOV version 1.14