https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NSMachAux.C
Go to the documentation of this file.
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 "NSMachAux.h"
12#include "NS.h"
13
14// FluidProperties includes
16
17// MOOSE includes
18#include "MooseMesh.h"
19
20#include "metaphysicl/raw_type.h"
21
22registerMooseObject("NavierStokesApp", NSMachAux);
23
26{
28
30 "Auxiliary kernel for computing the Mach number assuming an ideal gas.");
31 params.addParam<bool>("use_material_properties",
32 false,
33 "Whether to use material properties to compute the Mach number");
34 params.addCoupledVar(NS::velocity_x, "x-velocity");
35 params.addCoupledVar(NS::velocity_y, "y-velocity"); // Only required in >= 2D
36 params.addCoupledVar(NS::velocity_z, "z-velocity"); // Only required in 3D...
37 params.addCoupledVar(NS::specific_volume, "specific volume");
38 params.addCoupledVar(NS::specific_internal_energy, "internal energy");
39 params.addRequiredParam<UserObjectName>("fluid_properties",
40 "The name of the user object for fluid properties");
41
42 return params;
43}
44
46 : AuxKernel(parameters),
47 _use_mat_props(getParam<bool>("use_material_properties")),
48 _u_vel(_use_mat_props ? nullptr : &coupledValue(NS::velocity_x)),
49 _v_vel(_use_mat_props ? nullptr
50 : (_mesh.dimension() >= 2 ? &coupledValue(NS::velocity_y) : &_zero)),
51 _w_vel(_use_mat_props ? nullptr
52 : (_mesh.dimension() == 3 ? &coupledValue(NS::velocity_z) : &_zero)),
53 _specific_volume(_use_mat_props ? nullptr : &coupledValue(NS::specific_volume)),
54 _specific_internal_energy(_use_mat_props ? nullptr
55 : &coupledValue(NS::specific_internal_energy)),
56 _mat_speed(_use_mat_props ? &getADMaterialProperty<Real>(NS::speed) : nullptr),
57 _mat_pressure(_use_mat_props ? &getADMaterialProperty<Real>(NS::pressure) : nullptr),
58 _mat_T_fluid(_use_mat_props ? &getADMaterialProperty<Real>(NS::T_fluid) : nullptr),
59 _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
60{
61}
62
63Real
65{
68 _fp.c_from_p_T((*_mat_pressure)[_qp], (*_mat_T_fluid)[_qp]));
69 else
70 return RealVectorValue((*_u_vel)[_qp], (*_v_vel)[_qp], (*_w_vel)[_qp]).norm() /
72}
registerMooseObject("NavierStokesApp", NSMachAux)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
Auxiliary kernel for computing the Mach number assuming an ideal gas.
Definition NSMachAux.h:22
const SinglePhaseFluidProperties & _fp
Definition NSMachAux.h:52
NSMachAux(const InputParameters &parameters)
Definition NSMachAux.C:45
static InputParameters validParams()
Definition NSMachAux.C:25
const VariableValue *const _u_vel
Definition NSMachAux.h:36
const ADMaterialProperty< Real > *const _mat_speed
speed
Definition NSMachAux.h:43
const VariableValue *const _v_vel
Definition NSMachAux.h:37
virtual Real computeValue()
Definition NSMachAux.C:64
const ADMaterialProperty< Real > *const _mat_T_fluid
fluid temperature
Definition NSMachAux.h:49
const VariableValue *const _w_vel
Definition NSMachAux.h:38
const VariableValue *const _specific_volume
Definition NSMachAux.h:39
const VariableValue *const _specific_internal_energy
Definition NSMachAux.h:40
const ADMaterialProperty< Real > *const _mat_pressure
pressure
Definition NSMachAux.h:46
const bool _use_mat_props
Whether to use material properties instead of coupled variables to compute the Mach number.
Definition NSMachAux.h:34
Common class for single phase fluid properties.
auto raw_value(const Eigen::Map< T > &in)
static const std::string specific_volume
Definition NS.h:82
static const std::string velocity_y
Definition NS.h:48
static const std::string velocity_z
Definition NS.h:49
static const std::string velocity_x
Definition NS.h:47
static const std::string specific_internal_energy
Definition NS.h:63