www.mooseframework.org
NSEntropyError.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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
16 
17 registerMooseObject("NavierStokesApp", NSEntropyError);
18 
19 template <>
20 InputParameters
22 {
23  InputParameters params = validParams<ElementIntegralPostprocessor>();
24  params.addClassDescription("Computes entropy error.");
25  params.addRequiredParam<Real>("rho_infty", "Freestream density");
26  params.addRequiredParam<Real>("p_infty", "Freestream pressure");
27  params.addRequiredCoupledVar(NS::density, "density");
28  params.addRequiredCoupledVar(NS::pressure, "pressure");
29  params.addRequiredParam<UserObjectName>("fluid_properties",
30  "The name of the user object for fluid properties");
31  return params;
32 }
33 
34 NSEntropyError::NSEntropyError(const InputParameters & parameters)
35  : ElementIntegralPostprocessor(parameters),
36  _rho_infty(getParam<Real>("rho_infty")),
37  _p_infty(getParam<Real>("p_infty")),
38  _rho(coupledValue(NS::density)),
39  _pressure(coupledValue(NS::pressure)),
40  _fp(getUserObject<IdealGasFluidProperties>("fluid_properties"))
41 {
42 }
43 
44 Real
46 {
47  return std::sqrt(ElementIntegralPostprocessor::getValue());
48 }
49 
50 Real
52 {
53  Real integrand = (_pressure[_qp] / _p_infty) * std::pow(_rho_infty / _rho[_qp], _fp.gamma()) - 1.;
54  return integrand * integrand;
55 }
NSEntropyError::_p_infty
Real _p_infty
Definition: NSEntropyError.h:31
IdealGasFluidProperties.h
NSEntropyError
Definition: NSEntropyError.h:21
NSEntropyError::getValue
virtual Real getValue()
Definition: NSEntropyError.C:45
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
IdealGasFluidProperties
Ideal gas fluid properties Default parameters are for air at atmospheric pressure and temperature.
Definition: IdealGasFluidProperties.h:26
validParams< NSEntropyError >
InputParameters validParams< NSEntropyError >()
Definition: NSEntropyError.C:21
NSEntropyError::NSEntropyError
NSEntropyError(const InputParameters &parameters)
Definition: NSEntropyError.C:34
IdealGasFluidProperties::gamma
virtual Real gamma() const
Definition: IdealGasFluidProperties.h:117
NS
Definition: NS.h:14
NS::density
const std::string density
Definition: NS.h:16
NSEntropyError::_rho
const VariableValue & _rho
Definition: NSEntropyError.h:33
NSEntropyError::_pressure
const VariableValue & _pressure
Definition: NSEntropyError.h:34
registerMooseObject
registerMooseObject("NavierStokesApp", NSEntropyError)
NS.h
NSEntropyError::_rho_infty
Real _rho_infty
Definition: NSEntropyError.h:30
NSEntropyError.h
NSEntropyError::_fp
const IdealGasFluidProperties & _fp
Definition: NSEntropyError.h:37
NSEntropyError::computeQpIntegral
virtual Real computeQpIntegral()
Definition: NSEntropyError.C:51
NS::pressure
const std::string pressure
Definition: NS.h:25