www.mooseframework.org
NSMachAux.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 "NSMachAux.h"
12 #include "NS.h"
13 
14 // FluidProperties includes
16 
17 // MOOSE includes
18 #include "MooseMesh.h"
19 
20 registerMooseObject("NavierStokesApp", NSMachAux);
21 
22 template <>
23 InputParameters
25 {
26  InputParameters params = validParams<AuxKernel>();
27 
28  params.addClassDescription(
29  "Auxiliary kernel for computing the Mach number assuming an ideal gas.");
30  params.addRequiredCoupledVar(NS::velocity_x, "x-velocity");
31  params.addCoupledVar(NS::velocity_y, "y-velocity"); // Only required in >= 2D
32  params.addCoupledVar(NS::velocity_z, "z-velocity"); // Only required in 3D...
33  params.addRequiredCoupledVar(NS::specific_volume, "specific volume");
34  params.addRequiredCoupledVar(NS::internal_energy, "internal energy");
35  params.addRequiredParam<UserObjectName>("fluid_properties",
36  "The name of the user object for fluid properties");
37 
38  return params;
39 }
40 
41 NSMachAux::NSMachAux(const InputParameters & parameters)
42  : AuxKernel(parameters),
43  _u_vel(coupledValue(NS::velocity_x)),
44  _v_vel(_mesh.dimension() >= 2 ? coupledValue(NS::velocity_y) : _zero),
45  _w_vel(_mesh.dimension() == 3 ? coupledValue(NS::velocity_z) : _zero),
46  _specific_volume(coupledValue(NS::specific_volume)),
47  _internal_energy(coupledValue(NS::internal_energy)),
48  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
49 {
50 }
51 
52 Real
54 {
55  return RealVectorValue(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]).norm() /
56  _fp.c_from_v_e(_specific_volume[_qp], _internal_energy[_qp]);
57 }
NS::velocity_x
const std::string velocity_x
Definition: NS.h:22
NSMachAux::_fp
const SinglePhaseFluidProperties & _fp
Definition: NSMachAux.h:42
NSMachAux::_w_vel
const VariableValue & _w_vel
Definition: NSMachAux.h:37
SinglePhaseFluidProperties
Common class for single phase fluid properties.
Definition: SinglePhaseFluidProperties.h:89
NS::specific_volume
const std::string specific_volume
Definition: NS.h:30
NSMachAux.h
SinglePhaseFluidProperties.h
NS::velocity_y
const std::string velocity_y
Definition: NS.h:23
NS::velocity_z
const std::string velocity_z
Definition: NS.h:24
NSMachAux::_specific_volume
const VariableValue & _specific_volume
Definition: NSMachAux.h:38
NSMachAux::_u_vel
const VariableValue & _u_vel
Definition: NSMachAux.h:35
NS
Definition: NS.h:14
NSMachAux::_internal_energy
const VariableValue & _internal_energy
Definition: NSMachAux.h:39
NSMachAux::_v_vel
const VariableValue & _v_vel
Definition: NSMachAux.h:36
registerMooseObject
registerMooseObject("NavierStokesApp", NSMachAux)
NSMachAux::computeValue
virtual Real computeValue()
Definition: NSMachAux.C:53
NS::internal_energy
const std::string internal_energy
Definition: NS.h:29
NS.h
NSMachAux::NSMachAux
NSMachAux(const InputParameters &parameters)
Definition: NSMachAux.C:41
NSMachAux
Auxiliary kernel for computing the Mach number assuming an ideal gas.
Definition: NSMachAux.h:25
validParams< NSMachAux >
InputParameters validParams< NSMachAux >()
Definition: NSMachAux.C:24