LCOV - code coverage report
Current view: top level - src/postprocessors - NSEntropyError.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 21 22 95.5 %
Date: 2025-08-14 10:14:56 Functions: 4 4 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 "NSEntropyError.h"
      12             : #include "NS.h"
      13             : 
      14             : // FluidProperties includes
      15             : #include "IdealGasFluidProperties.h"
      16             : 
      17             : registerMooseObject("NavierStokesApp", NSEntropyError);
      18             : 
      19             : InputParameters
      20          41 : NSEntropyError::validParams()
      21             : {
      22          41 :   InputParameters params = ElementIntegralPostprocessor::validParams();
      23          41 :   params.addClassDescription("Computes entropy error.");
      24          82 :   params.addRequiredParam<Real>("rho_infty", "Freestream density");
      25          82 :   params.addRequiredParam<Real>("p_infty", "Freestream pressure");
      26          82 :   params.addRequiredCoupledVar("rho", "density");
      27          41 :   params.addRequiredCoupledVar(NS::pressure, "pressure");
      28          82 :   params.addRequiredParam<UserObjectName>("fluid_properties",
      29             :                                           "The name of the user object for fluid properties");
      30          41 :   return params;
      31           0 : }
      32             : 
      33          22 : NSEntropyError::NSEntropyError(const InputParameters & parameters)
      34             :   : ElementIntegralPostprocessor(parameters),
      35          22 :     _rho_infty(getParam<Real>("rho_infty")),
      36          44 :     _p_infty(getParam<Real>("p_infty")),
      37          22 :     _rho(coupledValue("rho")),
      38          22 :     _pressure(coupledValue(NS::pressure)),
      39          44 :     _fp(getUserObject<IdealGasFluidProperties>("fluid_properties"))
      40             : {
      41          22 : }
      42             : 
      43             : Real
      44         155 : NSEntropyError::getValue() const
      45             : {
      46         155 :   return std::sqrt(ElementIntegralPostprocessor::getValue());
      47             : }
      48             : 
      49             : Real
      50       76800 : NSEntropyError::computeQpIntegral()
      51             : {
      52       76800 :   Real integrand = (_pressure[_qp] / _p_infty) * std::pow(_rho_infty / _rho[_qp], _fp.gamma()) - 1.;
      53       76800 :   return integrand * integrand;
      54             : }

Generated by: LCOV version 1.14