https://mooseframework.inl.gov
Loading...
Searching...
No Matches
INSFEFluidMassKernel.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
11#include "MooseMesh.h"
12
15 MDFluidMassKernel,
16 "02/01/2024 00:00",
18
21{
23 params.addClassDescription("Adds advective term of mass conservation equation along with "
24 "pressure-stabilized Petrov-Galerkin terms");
25 return params;
26}
27
30 _u_vel_second(_u_var.secondSln()),
31 _v_vel_second(_v_var.secondSln()),
32 _w_vel_second(_mesh.dimension() == 3 ? _w_var.secondSln() : _second_zero)
33{
34}
35
36Real
38{
39 RealVectorValue vec_vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
40 Real masseq_part = -_rho[_qp] * vec_vel * _grad_test[_i][_qp];
41
42 // Compute PSPG term due to momentum equation residual vector
43 Real porosity = _has_porosity ? _porosity[_qp] : 1.0;
44 RealVectorValue convection_vec(
45 vec_vel * _grad_u_vel[_qp], vec_vel * _grad_v_vel[_qp], vec_vel * _grad_w_vel[_qp]);
46 RealVectorValue psi_pspg = _tauc[_qp] * _grad_test[_i][_qp];
47
48 Real transient_pspg = _bTransient ? _rho[_qp] * velocityDot() * psi_pspg : 0;
49 Real convection_pspg = _rho[_qp] / porosity * convection_vec * psi_pspg;
50 Real pressure_pspg = porosity * _grad_u[_qp] * psi_pspg;
51 Real gravity_pspg = -porosity * _rho[_qp] * _vec_g * psi_pspg;
52
53 Real viscous_pspg = 0;
54 Real pm_friction_pspg = 0;
55 if (porosity > 0.99)
56 {
57 RealVectorValue vec_vel_second(
59 viscous_pspg =
60 -(_dynamic_viscosity[_qp] + _turbulence_viscosity[_qp]) * vec_vel_second * psi_pspg;
61 }
62 else
63 {
64 Real velmag = std::sqrt(_u_vel[_qp] * _u_vel[_qp] + _v_vel[_qp] * _v_vel[_qp] +
65 _w_vel[_qp] * _w_vel[_qp]);
66
67 pm_friction_pspg += _inertia_resistance_coeff[_qp] * vec_vel * velmag * psi_pspg;
68 pm_friction_pspg += _viscous_resistance_coeff[_qp] * vec_vel * psi_pspg;
69 }
70
71 // Assemble PSPG terms
72 Real momeq_part = transient_pspg + convection_pspg + pressure_pspg + viscous_pspg + gravity_pspg +
73 pm_friction_pspg;
74
75 // Assemble final residual
76 return masseq_part + momeq_part;
77}
78
79Real
81{
82 Real porosity = _has_porosity ? _porosity[_qp] : 1.0;
83 return porosity * _tauc[_qp] * _grad_test[_i][_qp] * _grad_phi[_j][_qp];
84}
85
86Real
88{
89 // Convert the Moose numbering to internal porous medium model variable numbering.
90 unsigned m = this->mapVarNumber(jvar);
91
92 switch (m)
93 {
94 case 1:
95 case 2:
96 case 3:
97 {
98 RealVectorValue vec_vel(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
99 Real velmag = std::sqrt(_u_vel[_qp] * _u_vel[_qp] + _v_vel[_qp] * _v_vel[_qp] +
100 _w_vel[_qp] * _w_vel[_qp]);
101
102 Real mass_eqn_part = -_rho[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp](m - 1);
103
104 Real pm_inertial_pspg = 0;
105 Real pm_viscous_pspg = 0;
106 if (velmag < 1e-3)
107 pm_inertial_pspg = 0.;
108 else
109 pm_inertial_pspg = _inertia_resistance_coeff[_qp](m - 1, m - 1) *
110 (velmag + vec_vel(m - 1) * vec_vel(m - 1) / velmag) * _phi[_j][_qp] *
111 _tauc[_qp] * _grad_test[_i][_qp](m - 1);
112 pm_viscous_pspg = _viscous_resistance_coeff[_qp](m - 1, m - 1) * _phi[_j][_qp] * _tauc[_qp] *
113 _grad_test[_i][_qp](m - 1);
114
115 return mass_eqn_part + pm_inertial_pspg + pm_viscous_pspg;
116 }
117
118 default:
119 return 0;
120 }
121}
registerMooseObject("NavierStokesApp", INSFEFluidMassKernel)
registerMooseObjectRenamed("NavierStokesApp", MDFluidMassKernel, "02/01/2024 00:00", INSFEFluidMassKernel)
const VariableValue & _w_vel
const VariableGradient & _grad_v_vel
const VariableValue & _u_vel
RealVectorValue velocityDot() const
const MaterialProperty< RealTensorValue > & _inertia_resistance_coeff
const MaterialProperty< Real > & _dynamic_viscosity
const VariableValue & _v_vel
const VariableValue & _porosity
const MaterialProperty< Real > & _turbulence_viscosity
const VariableGradient & _grad_w_vel
const MaterialProperty< RealTensorValue > & _viscous_resistance_coeff
const MaterialProperty< Real > & _rho
const VariableGradient & _grad_u_vel
unsigned int mapVarNumber(unsigned int var) const
Helper function for mapping Moose variable numberings into the "canonical" numbering for the porous m...
Base class for stabilization kernels.
const MaterialProperty< Real > & _tauc
The spatial part of the 3D mass conservation for fluid flow.
virtual Real computeQpJacobian() override
static InputParameters validParams()
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const VariableSecond & _v_vel_second
const VariableSecond & _u_vel_second
const VariableSecond & _w_vel_second
virtual Real computeQpResidual() override
INSFEFluidMassKernel(const InputParameters &parameters)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
unsigned int _j
unsigned int _i
const VariableGradient & _grad_u
const VariablePhiValue & _phi
const VariablePhiGradient & _grad_phi
const VariableTestGradient & _grad_test