23 params.
addClassDescription(
"Computes the residual of advective term using finite volume method.");
25 MooseEnum eqn(
"mass momentum energy scalar");
27 MooseEnum momentum_component(
"x=0 y=1 z=2");
30 "The component of the momentum equation that this kernel applies to.");
33 params.
set<
unsigned short>(
"ghost_layers") = 2;
37 "Whether to use the Kurganov, Noelle, and Petrova method to compute the omega parameter for " 38 "stabilization. If false, then the Kurganov-Tadmor method will be used.");
50 _grad_sup_vel_x_neighbor(
56 _grad_sup_vel_y_neighbor(
62 _grad_sup_vel_z_neighbor(
66 _T_fluid_neighbor(getNeighborADMaterialProperty<
Real>(
NS::
T_fluid)),
70 _pressure_neighbor(getNeighborADMaterialProperty<
Real>(
NS::
pressure)),
76 _index(getParam<
MooseEnum>(
"momentum_component")),
77 _scalar_elem(_u_elem),
78 _scalar_neighbor(_u_neighbor),
79 _grad_scalar_elem((_eqn ==
"scalar") ? &_var.adGradSln() : nullptr),
80 _grad_scalar_neighbor((_eqn ==
"scalar") ? &_var.adGradSlnNeighbor() : nullptr),
82 _knp_for_omega(getParam<bool>(
"knp_for_omega"))
86 "If 'momentum' is specified for 'eqn', then you must provide a parameter " 87 "value for 'momentum_component'");
90 std::pair<ADReal, ADReal>
92 const ADReal & u_neighbor_normal,
94 const ADReal & c_neighbor)
const 99 std::max({c_elem + u_elem_normal, c_neighbor + u_neighbor_normal,
ADReal(0)});
100 const auto psi_neighbor =
101 std::max({c_elem - u_elem_normal, c_neighbor - u_neighbor_normal,
ADReal(0)});
104 :
alpha * std::max(psi_elem, psi_neighbor);
107 const auto dummy_quant = 0 * (c_elem + u_elem_normal + c_neighbor + u_neighbor_normal);
109 alpha += dummy_quant;
110 omega += dummy_quant;
111 return std::make_pair(std::move(
alpha), std::move(omega));
117 const ADReal & sup_vel_elem_normal,
118 const ADReal & sup_vel_neighbor_normal,
119 const ADReal & adv_quant_elem,
120 const ADReal & adv_quant_neighbor)
122 return alpha * (sup_vel_elem_normal * adv_quant_elem) +
123 (1 -
alpha) * sup_vel_neighbor_normal * adv_quant_neighbor -
124 omega * (adv_quant_neighbor - adv_quant_elem);
192 const auto sup_vel_elem = VectorValue<ADReal>(sup_vel_x_elem, sup_vel_y_elem, sup_vel_z_elem);
194 const auto rho_elem =
_fluid.rho_from_p_T(pressure_elem, T_fluid_elem);
195 const auto specific_volume_elem = 1. / rho_elem;
196 const auto e_elem =
_fluid.e_from_T_v(T_fluid_elem, specific_volume_elem);
197 const auto sup_vel_neighbor =
198 VectorValue<ADReal>(sup_vel_x_neighbor, sup_vel_y_neighbor, sup_vel_z_neighbor);
200 const auto rho_neighbor =
_fluid.rho_from_p_T(pressure_neighbor, T_fluid_neighbor);
201 const auto specific_volume_neighbor = 1. / rho_neighbor;
202 const auto e_neighbor =
_fluid.e_from_T_v(T_fluid_neighbor, specific_volume_neighbor);
204 const auto c_elem =
_fluid.c_from_v_e(specific_volume_elem, e_elem);
205 const auto c_neighbor =
_fluid.c_from_v_e(specific_volume_neighbor, e_neighbor);
208 const auto sup_vel_neighbor_normal = sup_vel_neighbor *
_face_info->
normal();
213 const auto &
alpha = pr.first;
214 const auto & omega = pr.second;
218 alpha, omega, sup_vel_elem_normal, sup_vel_neighbor_normal, rho_elem, rho_neighbor);
219 else if (
_eqn ==
"momentum")
221 const auto rhou_elem = u_elem(
_index) * rho_elem;
222 const auto rhou_neighbor = u_neighbor(
_index) * rho_neighbor;
226 sup_vel_neighbor_normal,
232 else if (
_eqn ==
"energy")
234 const auto ht_elem = e_elem + 0.5 * u_elem * u_elem + pressure_elem / rho_elem;
235 const auto ht_neighbor =
236 e_neighbor + 0.5 * u_neighbor * u_neighbor + pressure_neighbor / rho_neighbor;
237 const auto rho_ht_elem = rho_elem * ht_elem;
238 const auto rho_ht_neighbor = rho_neighbor * ht_neighbor;
240 alpha, omega, sup_vel_elem_normal, sup_vel_neighbor_normal, rho_ht_elem, rho_ht_neighbor);
242 else if (
_eqn ==
"scalar")
256 const auto rhos_elem = rho_elem * scalar_elem;
257 const auto rhos_neighbor = rho_neighbor * scalar_neighbor;
259 alpha, omega, sup_vel_elem_normal, sup_vel_neighbor_normal, rhos_elem, rhos_neighbor);
const SinglePhaseFluidProperties & _fluid
fluid properties
const unsigned int _index
When solving the momentum equation, the momentum component we are solving for.
static InputParameters validParams()
const ADMaterialProperty< RealVectorValue > & _grad_T_fluid_elem
const ADVariableGradient *const _grad_scalar_neighbor
const FaceInfo * _face_info
const MooseEnum _eqn
The equation we are solving, e.g. mass, momentum, fluid energy, or passive scalar.
static const std::string fluid
const ADMaterialProperty< Real > & _pressure_elem
pressure left == elem, right == neighbor
const MaterialProperty< Real > & _eps_neighbor
const ADMaterialProperty< Real > & _sup_vel_x_elem
superficial velocities left == elem, right == neighbor
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_z_elem
const ADMaterialProperty< Real > & _sup_vel_y_neighbor
bool isParamValid(const std::string &name) const
static const std::string porosity
virtual ADReal computeQpResidual() override
static ADReal computeFaceFlux(const ADReal &alpha, const ADReal &omega, const ADReal &sup_vel_elem_normal, const ADReal &sup_vel_neighbor_normal, const ADReal &adv_quant_elem, const ADReal &adv_quant_neighbor)
const bool _knp_for_omega
Whether to use the Kurganov, Noelle, and Petrova method to compute the omega parameter for stabilizat...
static InputParameters validParams()
const ADMaterialProperty< Real > & _sup_vel_y_elem
const ADMaterialProperty< Real > & _sup_vel_z_neighbor
static const std::string T_fluid
registerMooseObject("NavierStokesApp", PCNSFVKT)
const ADVariableGradient *const _grad_scalar_elem
const MooseEnum moose_limiter_type
static const std::string superficial_velocity_y
const ADMaterialProperty< Real > & _T_fluid_neighbor
std::unique_ptr< Moose::FV::Limiter< ADReal > > _limiter
The slope limiter we will apply when interpolating from cell centroids to faces.
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_y_neighbor
Common class for single phase fluid properties.
const Point & normal() const
void paramError(const std::string ¶m, Args... args) const
const ADMaterialProperty< Real > & _pressure_neighbor
std::string grad(const std::string &var)
const MaterialProperty< Real > & _eps_elem
porosity left == elem, right == neighbor
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_x_elem
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string alpha
static const std::string pressure
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_x_neighbor
void mooseError(Args &&... args) const
const ADMaterialProperty< RealVectorValue > & _grad_pressure_neighbor
const ADMaterialProperty< RealVectorValue > & _grad_pressure_elem
Implements the centered Kurganov-Tadmor discretization of advective fluxes.
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_z_neighbor
const ADVariableValue & _scalar_elem
passive scalar values left == elem, right == neighbor
const ADMaterialProperty< RealVectorValue > & _grad_T_fluid_neighbor
const ADMaterialProperty< Real > & _T_fluid_elem
fluid temperature left == elem, right == neighbor
void interpolate(InterpMethod m, T &result, const T2 &value1, const T3 &value2, const FaceInfo &fi, const bool one_is_elem)
const ADMaterialProperty< Real > & _sup_vel_z_elem
const ADMaterialProperty< Real > & _sup_vel_x_neighbor
const ADMaterialProperty< RealVectorValue > & _grad_sup_vel_y_elem
void ErrorVector unsigned int
static const std::string superficial_velocity_z
PCNSFVKT(const InputParameters ¶ms)
const ADVariableValue & _scalar_neighbor
std::pair< ADReal, ADReal > computeAlphaAndOmega(const ADReal &u_elem_normal, const ADReal &u_neighbor_normal, const ADReal &c_elem, const ADReal &c_neighbor) const
static const std::string superficial_velocity_x