23 params.
addClassDescription(
"Momentum flux kernel with porous-specific advection handling.");
55 stress = {transmissibility, -transmissibility, -transmissibility, transmissibility, 0.0, 0.0};
80 const Real stress_rhs =
83 const Real advection_rhs = correct_baffle
94 const Real stress_rhs =
97 const Real advection_rhs = correct_baffle
148 const auto & normal = fi.normal();
150 const auto upstream_velocity =
152 const auto interstitial_tangential_velocity =
153 (upstream_velocity - (upstream_velocity * normal) * normal) *
156 const Real baffle_advected_velocity =
158 normal_velocity * normal(
_index);
159 const Real factor = elem_side ? 1.0 : -1.0;
169 const auto & elem_info = *fi.
elemInfo();
170 const auto & neighbor_info = *fi.neighborInfo();
172 const auto & normal = fi.normal();
181 if (!elem_clear && !neighbor_clear)
182 return {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
186 if (face_viscosity == 0.0)
187 return {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
189 const auto elem_to_face = fi.faceCentroid() - elem_info.centroid();
190 const auto face_to_neighbor = neighbor_info.centroid() - fi.faceCentroid();
191 const Real elem_distance =
193 const Real neighbor_distance =
206 const Real transmissibility = face_viscosity /
distance;
210 RealVectorValue elem_correction;
211 RealVectorValue neighbor_correction;
214 const auto elem_correction_vector = normal - elem_to_face / elem_distance;
215 const auto neighbor_correction_vector = normal - face_to_neighbor / neighbor_distance;
216 for (
const auto component : make_range(
_dim))
220 elem_correction(component) =
gradient.gradient(elem_info) * elem_correction_vector;
222 neighbor_correction(component) =
223 gradient.gradient(neighbor_info) * neighbor_correction_vector;
227 RealVectorValue elem_velocity;
228 RealVectorValue neighbor_velocity;
229 for (
const auto component : make_range(
_dim))
232 elem_velocity(component) = velocity.getElemValue(elem_info, state);
233 neighbor_velocity(component) = velocity.getElemValue(neighbor_info, state);
239 const auto elem_face_velocity =
240 elem_clear ? RealVectorValue(elem_velocity - elem_distance * elem_correction)
242 const auto neighbor_face_velocity =
243 neighbor_clear ? RealVectorValue(neighbor_velocity + neighbor_distance * neighbor_correction)
245 const auto face_velocity_difference = neighbor_face_velocity - elem_face_velocity;
246 const auto shear_traction =
247 transmissibility * (face_velocity_difference - (face_velocity_difference * normal) * normal);
254 const Real n_i = normal(
_index);
255 const Real coefficient = transmissibility * (1.0 - n_i * n_i);
259 data.elem_neighbor = -coefficient;
260 data.neighbor_elem = -coefficient;
261 data.neighbor_neighbor = coefficient;
263 shear_traction(
_index) + coefficient * (elem_velocity(
_index) - neighbor_velocity(
_index));
265 -shear_traction(
_index) + coefficient * (neighbor_velocity(
_index) - elem_velocity(
_index));
297 return 1.0 / porosity;
registerMooseObject("NavierStokesApp", LinearPWCNSFVMomentumFlux)
const std::vector< std::vector< dof_id_type > > & dofIndices() const
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
const ElemInfo * elemInfo() const
const ElemInfo * neighborInfo() const
virtual Real computeBoundaryValueMatrixContribution() const=0
virtual Real computeBoundaryValueRHSContribution() const=0
FaceInfo::VarFaceNeighbors _current_face_type
DenseMatrix< Real > _matrix_contribution
DenseVector< dof_id_type > _dof_indices
virtual void addMatrixContribution() override
const FaceInfo * _current_face_info
MooseLinearVariableFV< Real > & _var
const unsigned int _sys_num
const unsigned int _var_num
Momentum flux kernel for porous equations written in superficial velocity.
LinearPWCNSFVMomentumFlux(const InputParameters ¶ms)
Construct the porous momentum flux kernel.
Real computeElemRightHandSideContribution() override
Compute the element-row internal-face right-hand-side contribution.
Real computeAdvectionBoundaryMatrixContribution(const LinearFVAdvectionDiffusionBC *bc) override
Compute the boundary advection matrix contribution with local porosity scaling.
bool isClearFluidSide(bool elem_side) const
Whether one side of the current face is clear fluid, i.e.
const PorousRhieChowMassFlux & _porous_mass_flux_provider
Porous Rhie-Chow object supplying porosity and pressure-baffle data.
void addMatrixContribution() override
Assemble the internal-face matrix with side-specific porosity scaling of advection.
Real computeNeighborRightHandSideContribution() override
Compute the neighbor-row internal-face right-hand-side contribution.
Real computeAdvectionBoundaryRHSContribution(const LinearFVAdvectionDiffusionBC *bc) override
Compute the boundary advection right-hand-side contribution with local porosity scaling.
static InputParameters validParams()
Real inversePorosity(bool elem_side) const
Return the inverse porosity on one side of the current face.
BaffleStressData baffleStressData() const
Compute the stress on the current baffle face, per unit face area.
Real computeBaffleAdvectionExplicitCorrection(bool elem_side) const
Compute the correction that replaces the shared advected state with the baffle face state: the upstre...
std::vector< SparseMatrix< Number > * > _matrices
Kernel that implements the stress tensor and advection terms for the momentum equation.
Real computeInternalStressMatrixContribution()
Computes the matrix contribution of the stress term on the current face when the face is an internal ...
const MooseLinearVariableFVReal & velocityVar(unsigned int dir) const
Helper to access the velocity variable for a given direction.
Real _face_mass_flux
Container for the mass flux on the face which will be reused in the advection term's matrix and right...
Real computeInternalAdvectionElemMatrixContribution()
Computes the matrix contribution of the advective flux on the element side of current face when the f...
FVAdvectedInterpolationMethod::AdvectedSystemContribution _adv_interp_result
Current advected interpolation contribution on the face.
const Moose::Functor< Real > & _mu
The functor for the dynamic viscosity.
Real computeCellStressExplicitCorrection(const ElemInfo &cell_info, const RealVectorValue &nonorthogonal_correction_vector) const
Compute the explicit stress correction reconstructed from one adjacent cell.
const LinearFVGradientReader & velocityGradientField(unsigned int dir) const
Helper to access the velocity gradient field for a given direction.
const unsigned int _index
Index x|y|z, this is mainly to handle the deviatoric parts correctly in in the stress term.
const bool _use_deviatoric_terms
Switch to enable/disable deviatoric parts in the stress term.
Real computeInternalStressRHSContribution()
Computes the right hand side contribution of the stress term on the current face when the face is an ...
Real computeInternalAdvectionNeighborMatrixContribution()
Computes the matrix contribution of the advective flux on the neighbor side of current face when the ...
const unsigned int _dim
The dimension of the mesh.
const bool _use_nonorthogonal_correction
Switch to enable/disable nonorthogonal correction in the stress term.
static InputParameters validParams()
void mooseError(Args &&... args) const
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
virtual const OutputTools< Real >::VariableGradient & gradient()
Computes Rhie-Chow face mass fluxes for porous flow with optional internal pressure jumps.
bool faceIsBaffle(const FaceInfo &fi) const
Whether a face is governed by a pressure-jump model.
Real baffleNormalVelocity(const FaceInfo &fi) const
Return the normal superficial velocity at a baffle face, recovered from the shared face mass flux and...
Real getFaceSidePorosity(const FaceInfo &fi, bool elem_side, const Moose::StateArg &time) const
Return the porosity on one side of a face.
RealVectorValue baffleFaceVelocity(const FaceInfo &fi, bool elem_side) const
Return the superficial velocity at a baffle face as seen from one side.
Moose::StateArg determineState() const
std::vector< T > & get_values()
std::pair< Real, Real > weights_matrix
Implicit coefficients and deferred right-hand sides of the stress on a baffle face.
Real elem_rhs
Explicit parts of the element and neighbor rows.
Real elem_elem
Coefficients of the element row on the element and neighbor values.
Real neighbor_elem
Coefficients of the neighbor row on the element and neighbor values.
Real distance(const Point &p)