https://mooseframework.inl.gov
ConservedVarValuesMaterial.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
12 #include "NS.h"
13 #include "NavierStokesMethods.h"
14 
15 // FluidProperties includes
17 
19 
22 {
23  auto params = Material::validParams();
24  params.addRequiredParam<UserObjectName>(NS::fluid, "fluid userobject");
25  params.addRequiredCoupledVar(NS::density, "density");
26  params.addRequiredCoupledVar(NS::total_energy_density, "total fluid energy");
27  params.addRequiredCoupledVar(NS::momentum_x, "The x-momentum");
28  params.addCoupledVar(NS::momentum_y, "The y-momentum");
29  params.addCoupledVar(NS::momentum_z, "The z-momentum");
30  params.addClassDescription("Provides access to variables for a conserved variable set "
31  "of density, total fluid energy, and momentum");
32  return params;
33 }
34 
36  : Material(params),
37  _fluid(UserObjectInterface::getUserObject<SinglePhaseFluidProperties>(NS::fluid)),
38  _var_rho(adCoupledValue(NS::density)),
39  _var_rho_u(adCoupledValue(NS::momentum_x)),
40  _var_rho_v(isCoupled(NS::momentum_y) ? adCoupledValue(NS::momentum_y) : _ad_zero),
41  _var_rho_w(isCoupled(NS::momentum_z) ? adCoupledValue(NS::momentum_z) : _ad_zero),
42  _var_total_energy_density(adCoupledValue(NS::total_energy_density)),
43  _rho(declareADProperty<Real>(NS::density)),
44  _mass_flux(declareADProperty<RealVectorValue>(NS::mass_flux)),
45  _momentum(declareADProperty<RealVectorValue>(NS::momentum)),
46  _total_energy_density(declareADProperty<Real>(NS::total_energy_density)),
47  _velocity(declareADProperty<RealVectorValue>(NS::velocity)),
48  _speed(declareADProperty<Real>(NS::speed)),
49  _vel_x(declareADProperty<Real>(NS::velocity_x)),
50  _vel_y(declareADProperty<Real>(NS::velocity_y)),
51  _vel_z(declareADProperty<Real>(NS::velocity_z)),
52  _rhou(declareADProperty<Real>(NS::momentum_x)),
53  _rhov(declareADProperty<Real>(NS::momentum_y)),
54  _rhow(declareADProperty<Real>(NS::momentum_z)),
55  _v(declareADProperty<Real>(NS::v)),
56  _specific_internal_energy(declareADProperty<Real>(NS::specific_internal_energy)),
57  _pressure(declareADProperty<Real>(NS::pressure)),
58  _specific_total_enthalpy(declareADProperty<Real>(NS::specific_total_enthalpy)),
59  _rho_ht(declareADProperty<Real>(NS::total_enthalpy_density)),
60  _T_fluid(declareADProperty<Real>(NS::T_fluid))
61 {
62 }
63 
64 void
66 {
67  _rho[_qp] = _var_rho[_qp];
71 
74  _vel_x[_qp] = _velocity[_qp](0);
75  _vel_y[_qp] = _velocity[_qp](1);
76  _vel_z[_qp] = _velocity[_qp](2);
77  _rhou[_qp] = _vel_x[_qp] * _rho[_qp];
78  _rhov[_qp] = _vel_y[_qp] * _rho[_qp];
79  _rhow[_qp] = _vel_z[_qp] * _rho[_qp];
80 
81  _v[_qp] = 1 / _rho[_qp];
82 
85 
87 
91 }
ADMaterialProperty< RealVectorValue > & _mass_flux
static const std::string total_energy_density
Definition: NS.h:65
static const std::string momentum_x
Definition: NS.h:35
registerMooseObject("NavierStokesApp", ConservedVarValuesMaterial)
ADMaterialProperty< Real > & _speed
ADMaterialProperty< Real > & _rhov
ADMaterialProperty< Real > & _rhow
static const std::string speed
Definition: NS.h:143
ADMaterialProperty< Real > & _vel_y
const ADVariableValue & _var_rho_v
static const std::string momentum
Definition: NS.h:83
static const std::string velocity_z
Definition: NS.h:48
static const std::string density
Definition: NS.h:33
static const std::string fluid
Definition: NS.h:87
ADMaterialProperty< Real > & _pressure
static const std::string velocity_x
Definition: NS.h:46
ADMaterialProperty< Real > & _rhou
ADMaterialProperty< Real > & _rho
ADMaterialProperty< Real > & _vel_z
static const std::string specific_internal_energy
Definition: NS.h:62
This object takes a conserved free-flow variable set (rho, rhoU, rho et) and computes all the necessa...
unsigned int _qp
ADMaterialProperty< RealVectorValue > & _momentum
ADMaterialProperty< Real > & _rho_ht
static const std::string T_fluid
Definition: NS.h:106
static const std::string total_enthalpy_density
Definition: NS.h:71
static InputParameters validParams()
ADMaterialProperty< Real > & _specific_internal_energy
ADMaterialProperty< Real > & _specific_total_enthalpy
virtual void computeQpProperties() override
static const std::string mass_flux
Definition: NS.h:171
Common class for single phase fluid properties.
static const std::string velocity_y
Definition: NS.h:47
ADMaterialProperty< Real > & _total_energy_density
ConservedVarValuesMaterial(const InputParameters &parameters)
ADMaterialProperty< Real > & _vel_x
static const std::string momentum_y
Definition: NS.h:36
static InputParameters validParams()
ADMaterialProperty< Real > & _T_fluid
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:84
template ADReal computeSpeed< ADReal >(const libMesh::VectorValue< ADReal > &velocity)
ADMaterialProperty< RealVectorValue > & _velocity
static const std::string specific_total_enthalpy
Definition: NS.h:69
ADMaterialProperty< Real > & _v
const SinglePhaseFluidProperties & _fluid
fluid properties
const ADVariableValue & _var_total_energy_density
static const std::string pressure
Definition: NS.h:56
static const std::string velocity
Definition: NS.h:45
static const std::string momentum_z
Definition: NS.h:37
const ADVariableValue & _var_rho_w
const ADVariableValue & _var_rho_u