https://mooseframework.inl.gov
PorousConservedVarMaterial.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 properties userobject");
25  params.addRequiredCoupledVar(NS::density, "density");
26  params.addRequiredCoupledVar(NS::total_energy_density, "total fluid energy");
27  params.addRequiredCoupledVar(NS::superficial_momentum_x, "The x-momentum times the porosity");
28  params.addCoupledVar(NS::superficial_momentum_y, "The y-momentum times the porosity");
29  params.addCoupledVar(NS::superficial_momentum_z, "The z-momentum times the porosity");
30  params.addClassDescription("Provides access to variables for a conserved variable set "
31  "of density, total fluid energy, and momentum");
32  params.addRequiredParam<MaterialPropertyName>(NS::porosity, "the porosity");
33  return params;
34 }
35 
37  : Material(params),
38  _fluid(UserObjectInterface::getUserObject<SinglePhaseFluidProperties>(NS::fluid)),
39  _var_rho(adCoupledValue(NS::density)),
40  _var_grad_rho(adCoupledGradient(NS::density)),
41  _var_rho_ud(adCoupledValue(NS::superficial_momentum_x)),
42  _var_rho_vd(isCoupled(NS::superficial_momentum_y) ? adCoupledValue(NS::superficial_momentum_y)
43  : _ad_zero),
44  _var_rho_wd(isCoupled(NS::superficial_momentum_z) ? adCoupledValue(NS::superficial_momentum_z)
45  : _ad_zero),
46  _var_grad_rho_ud(adCoupledGradient(NS::superficial_momentum_x)),
47  _var_grad_rho_vd(isCoupled(NS::superficial_momentum_y)
48  ? adCoupledGradient(NS::superficial_momentum_y)
49  : _ad_grad_zero),
50  _var_grad_rho_wd(isCoupled(NS::superficial_momentum_z)
51  ? adCoupledGradient(NS::superficial_momentum_z)
52  : _ad_grad_zero),
53  _var_total_energy_density(adCoupledValue(NS::total_energy_density)),
54  _var_grad_rho_et(adCoupledGradient(NS::total_energy_density)),
55  _epsilon(getMaterialProperty<Real>(NS::porosity)),
56  _rho(declareADProperty<Real>(NS::density)),
57  _superficial_rho(declareADProperty<Real>(NS::superficial_density)),
58  _mass_flux(declareADProperty<RealVectorValue>(NS::mass_flux)),
59  _momentum(declareADProperty<RealVectorValue>(NS::momentum)),
60  _total_energy_density(declareADProperty<Real>(NS::total_energy_density)),
61  _velocity(declareADProperty<RealVectorValue>(NS::velocity)),
62  _speed(declareADProperty<Real>(NS::speed)),
63  _superficial_velocity(declareADProperty<RealVectorValue>(NS::superficial_velocity)),
64  _sup_vel_x(declareADProperty<Real>(NS::superficial_velocity_x)),
65  _sup_vel_y(declareADProperty<Real>(NS::superficial_velocity_y)),
66  _sup_vel_z(declareADProperty<Real>(NS::superficial_velocity_z)),
67  _grad_sup_vel_x(declareADProperty<RealVectorValue>(NS::grad(NS::superficial_velocity_x))),
68  _grad_sup_vel_y(declareADProperty<RealVectorValue>(NS::grad(NS::superficial_velocity_y))),
69  _grad_sup_vel_z(declareADProperty<RealVectorValue>(NS::grad(NS::superficial_velocity_z))),
70  _sup_mom_x(declareADProperty<Real>(NS::superficial_momentum_x)),
71  _sup_mom_y(declareADProperty<Real>(NS::superficial_momentum_y)),
72  _sup_mom_z(declareADProperty<Real>(NS::superficial_momentum_z)),
73  _vel_x(declareADProperty<Real>(NS::velocity_x)),
74  _vel_y(declareADProperty<Real>(NS::velocity_y)),
75  _vel_z(declareADProperty<Real>(NS::velocity_z)),
76  _rhou(declareADProperty<Real>(NS::momentum_x)),
77  _rhov(declareADProperty<Real>(NS::momentum_y)),
78  _rhow(declareADProperty<Real>(NS::momentum_z)),
79  _v(declareADProperty<Real>(NS::v)),
80  _specific_internal_energy(declareADProperty<Real>(NS::specific_internal_energy)),
81  _pressure(declareADProperty<Real>(NS::pressure)),
82  _grad_pressure(declareADProperty<RealVectorValue>(NS::grad(NS::pressure))),
83  _specific_total_enthalpy(declareADProperty<Real>(NS::specific_total_enthalpy)),
84  _rho_ht(declareADProperty<Real>(NS::total_enthalpy_density)),
85  _superficial_rho_et(declareADProperty<Real>(NS::superficial_total_energy_density)),
86  _superficial_rho_ht(declareADProperty<Real>(NS::superficial_total_enthalpy_density)),
87  _T_fluid(declareADProperty<Real>(NS::T_fluid)),
88  _grad_T_fluid(declareADProperty<RealVectorValue>(NS::grad(NS::T_fluid)))
89 {
90 }
91 
92 void
94 {
95  _rho[_qp] = _var_rho[_qp];
100  _sup_mom_z[_qp] = _mass_flux[_qp](2);
104 
115 
118  _vel_x[_qp] = _velocity[_qp](0);
119  _vel_y[_qp] = _velocity[_qp](1);
120  _vel_z[_qp] = _velocity[_qp](2);
121  const auto grad_vel_x = _grad_sup_vel_x[_qp] / _epsilon[_qp];
122  const auto grad_vel_y = _grad_sup_vel_y[_qp] / _epsilon[_qp];
123  const auto grad_vel_z = _grad_sup_vel_z[_qp] / _epsilon[_qp];
124  _rhou[_qp] = _vel_x[_qp] * _rho[_qp];
125  _rhov[_qp] = _vel_y[_qp] * _rho[_qp];
126  _rhow[_qp] = _vel_z[_qp] * _rho[_qp];
127 
128  _v[_qp] = 1 / _rho[_qp];
129  const auto grad_v = (-1. / (_rho[_qp] * _rho[_qp])) * _var_grad_rho[_qp];
130 
133  const auto grad_e =
136  (_vel_x[_qp] * grad_vel_x + _vel_y[_qp] * grad_vel_y + _vel_z[_qp] * grad_vel_z);
137 
138  ADReal dp_dv, dp_de;
139  _fluid.p_from_v_e(_v[_qp], _specific_internal_energy[_qp], _pressure[_qp], dp_dv, dp_de);
140  _grad_pressure[_qp] = dp_dv * grad_v + dp_de * grad_e;
141 
145 
146  ADReal dT_dv, dT_de;
147  _fluid.T_from_v_e(_v[_qp], _specific_internal_energy[_qp], _T_fluid[_qp], dT_dv, dT_de);
148  _grad_T_fluid[_qp] = dT_dv * grad_v + dT_de * grad_e;
149 }
static const std::string superficial_density
Definition: NS.h:34
static const std::string total_energy_density
Definition: NS.h:65
static const std::string momentum_x
Definition: NS.h:35
const SinglePhaseFluidProperties & _fluid
fluid properties
static const std::string superficial_velocity
Definition: NS.h:53
static InputParameters validParams()
ADMaterialProperty< RealVectorValue > & _grad_sup_vel_x
ADMaterialProperty< Real > & _rho_ht
ADMaterialProperty< RealVectorValue > & _grad_sup_vel_y
static const std::string speed
Definition: NS.h:143
const MaterialProperty< Real > & _epsilon
static const std::string momentum
Definition: NS.h:83
static const std::string superficial_momentum_y
Definition: NS.h:40
ADMaterialProperty< Real > & _sup_mom_z
virtual void computeQpProperties() override
const ADVariableValue & _var_total_energy_density
static const std::string velocity_z
Definition: NS.h:48
static const std::string superficial_momentum_x
Definition: NS.h:39
static const std::string density
Definition: NS.h:33
static const std::string fluid
Definition: NS.h:87
ADMaterialProperty< Real > & _vel_z
static const std::string superficial_momentum_z
Definition: NS.h:41
ADMaterialProperty< RealVectorValue > & _momentum
static const std::string velocity_x
Definition: NS.h:46
ADMaterialProperty< Real > & _rho
static const std::string specific_internal_energy
Definition: NS.h:62
ADMaterialProperty< Real > & _speed
ADMaterialProperty< Real > & _sup_vel_y
registerMooseObject("NavierStokesApp", PorousConservedVarMaterial)
ADMaterialProperty< RealVectorValue > & _superficial_velocity
ADMaterialProperty< Real > & _rhou
const ADVariableGradient & _var_grad_rho
unsigned int _qp
static const std::string porosity
Definition: NS.h:104
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 > & _sup_vel_z
ADMaterialProperty< Real > & _T_fluid
ADMaterialProperty< Real > & _pressure
const ADVariableGradient & _var_grad_rho_ud
static const std::string superficial_velocity_y
Definition: NS.h:51
ADMaterialProperty< Real > & _v
const ADVariableValue & _var_rho_ud
ADMaterialProperty< Real > & _vel_y
ADMaterialProperty< RealVectorValue > & _velocity
ADMaterialProperty< Real > & _sup_vel_x
ADMaterialProperty< Real > & _superficial_rho
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 > & _sup_mom_y
PorousConservedVarMaterial(const InputParameters &parameters)
ADMaterialProperty< Real > & _specific_internal_energy
static const std::string superficial_total_enthalpy_density
Definition: NS.h:72
std::string grad(const std::string &var)
Definition: NS.h:91
ADMaterialProperty< Real > & _vel_x
static const std::string momentum_y
Definition: NS.h:36
const ADVariableGradient & _var_grad_rho_et
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)
static const std::string specific_total_enthalpy
Definition: NS.h:69
ADMaterialProperty< RealVectorValue > & _grad_T_fluid
ADMaterialProperty< RealVectorValue > & _grad_pressure
ADMaterialProperty< Real > & _sup_mom_x
const ADVariableValue & _var_rho_vd
static const std::string pressure
Definition: NS.h:56
ADMaterialProperty< Real > & _superficial_rho_et
static const std::string superficial_total_energy_density
Definition: NS.h:66
ADMaterialProperty< Real > & _total_energy_density
static const std::string velocity
Definition: NS.h:45
static const std::string momentum_z
Definition: NS.h:37
ADMaterialProperty< RealVectorValue > & _grad_sup_vel_z
ADMaterialProperty< Real > & _superficial_rho_ht
This object takes a conserved porous-flow variable set (rho epsilon, rho epsilon U, rho epsilon et) and computes all the necessary quantities for solving the compressible porous Euler equations.
const ADVariableValue & _var_rho_wd
ADMaterialProperty< Real > & _rhov
ADMaterialProperty< RealVectorValue > & _mass_flux
ADMaterialProperty< Real > & _specific_total_enthalpy
const ADVariableGradient & _var_grad_rho_vd
const ADVariableGradient & _var_grad_rho_wd
static const std::string superficial_velocity_z
Definition: NS.h:52
ADMaterialProperty< Real > & _rhow
static const std::string superficial_velocity_x
Definition: NS.h:50