www.mooseframework.org
NSStagnationPressureBC.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 inclues
11 #include "NSStagnationPressureBC.h"
12 #include "NS.h"
13 
14 // FluidProperties includes
16 
17 // Full specialization of the validParams function for this object
19 
20 template <>
21 InputParameters
23 {
24  InputParameters params = validParams<NSStagnationBC>();
25  params.addClassDescription("This Dirichlet condition imposes the condition p_0 = p_0_desired.");
26  params.addRequiredCoupledVar(NS::pressure, "pressure");
27  params.addRequiredParam<Real>("desired_stagnation_pressure", "");
28  return params;
29 }
30 
31 NSStagnationPressureBC::NSStagnationPressureBC(const InputParameters & parameters)
32  : NSStagnationBC(parameters),
33  _pressure(coupledValue(NS::pressure)),
34  _desired_stagnation_pressure(getParam<Real>("desired_stagnation_pressure"))
35 {
36 }
37 
38 Real
40 {
41  // p_0 = p*(1 + 0.5*(gam-1)*M^2)^(gam/(gam-1))
42  const Real computed_stagnation_pressure =
43  _pressure[_qp] * std::pow(1. + 0.5 * (_fp.gamma() - 1.) * _mach[_qp] * _mach[_qp],
44  _fp.gamma() / (_fp.gamma() - 1.));
45 
46  // Return the difference between the current solution's stagnation pressure
47  // and the desired. The Dirichlet condition asserts that these should be equal.
48  return computed_stagnation_pressure - _desired_stagnation_pressure;
49 }
NSStagnationBC
This is the base class for the "imposed stagnation" value boundary conditions.
Definition: NSStagnationBC.h:27
IdealGasFluidProperties.h
NSStagnationPressureBC::_pressure
const VariableValue & _pressure
Definition: NSStagnationPressureBC.h:38
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
NSStagnationPressureBC::computeQpResidual
virtual Real computeQpResidual()
Definition: NSStagnationPressureBC.C:39
registerMooseObject
registerMooseObject("NavierStokesApp", NSStagnationPressureBC)
NSStagnationPressureBC::NSStagnationPressureBC
NSStagnationPressureBC(const InputParameters &parameters)
Definition: NSStagnationPressureBC.C:31
IdealGasFluidProperties::gamma
virtual Real gamma() const
Definition: IdealGasFluidProperties.h:117
NSStagnationPressureBC::_desired_stagnation_pressure
const Real _desired_stagnation_pressure
Definition: NSStagnationPressureBC.h:41
validParams< NSStagnationPressureBC >
InputParameters validParams< NSStagnationPressureBC >()
Definition: NSStagnationPressureBC.C:22
NSStagnationPressureBC
This Dirichlet condition imposes the condition p_0 = p_0_desired, where p_0 is the stagnation pressur...
Definition: NSStagnationPressureBC.h:26
NS
Definition: NS.h:14
NSStagnationPressureBC.h
validParams< NSStagnationBC >
InputParameters validParams< NSStagnationBC >()
Definition: NSStagnationBC.C:20
NS.h
NSStagnationBC::_fp
const IdealGasFluidProperties & _fp
Definition: NSStagnationBC.h:36
NSStagnationBC::_mach
const VariableValue & _mach
Definition: NSStagnationBC.h:33
NS::pressure
const std::string pressure
Definition: NS.h:25