From 84790cf89acc993f1f48536a6e5c52922c835a6b Mon Sep 17 00:00:00 2001 From: Guillaume Giudicelli Date: Wed, 4 Dec 2024 09:55:26 -0700 Subject: [PATCH] Address Peter's review - face velocity -> volumetric face flux due to A term Co-authored-by: Peter German <31662443+grmnptr@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Peter German <31662443+grmnptr@users.noreply.github.com> --- .../linearfvkernels/LinearFVScalarAdvection.md | 2 +- .../physics/WCNSLinearFVScalarTransportPhysics.md | 2 +- .../linearfvkernels/LinearFVScalarAdvection.h | 2 +- .../include/userobjects/RhieChowMassFlux.h | 4 ++-- .../src/linearfvkernels/LinearFVScalarAdvection.C | 14 +++++++------- .../src/userobjects/RhieChowMassFlux.C | 7 ++++--- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/modules/navier_stokes/doc/content/source/linearfvkernels/LinearFVScalarAdvection.md b/modules/navier_stokes/doc/content/source/linearfvkernels/LinearFVScalarAdvection.md index e3215a7977bc..6b6ab638d4c5 100644 --- a/modules/navier_stokes/doc/content/source/linearfvkernels/LinearFVScalarAdvection.md +++ b/modules/navier_stokes/doc/content/source/linearfvkernels/LinearFVScalarAdvection.md @@ -12,7 +12,7 @@ For FV, the integral of the advection term of scalar $C_i$ over a cell can be ex where $C_{if}$ is the face value of the scalar concentration. An interpolation scheme (e.g. upwind) can be used to compute the face value. This kernel adds the face contribution for each face $f$ to the right hand side and matrix. -The face mass flux $(\vec{u}\cdot \vec{n})_{RC}$ is provided by the [RhieChowMassFlux.md] object which uses pressure +The volumetric face flux $(\vec{u}\cdot \vec{n})_{RC}$ is provided by the [RhieChowMassFlux.md] object which uses pressure gradients and the discrete momentum equation to compute face velocities and mass fluxes. For more information on the expression that is used, see [SIMPLE.md]. diff --git a/modules/navier_stokes/doc/content/source/physics/WCNSLinearFVScalarTransportPhysics.md b/modules/navier_stokes/doc/content/source/physics/WCNSLinearFVScalarTransportPhysics.md index 52325cd939ab..25851d427383 100644 --- a/modules/navier_stokes/doc/content/source/physics/WCNSLinearFVScalarTransportPhysics.md +++ b/modules/navier_stokes/doc/content/source/physics/WCNSLinearFVScalarTransportPhysics.md @@ -15,7 +15,7 @@ where: - $\phi_i$ is the i-th scalar quantity - \mathbf{v} is the advecting velocity - $k_i$ the i-th scalar diffusivity -- $Q_i$ is the i-th precursor source +- $Q_i$ is the i-th scalar source - $\lambda_i$ is a reaction coefficient. It should be negative for a loss term The kernels created are: diff --git a/modules/navier_stokes/include/linearfvkernels/LinearFVScalarAdvection.h b/modules/navier_stokes/include/linearfvkernels/LinearFVScalarAdvection.h index 0084904be8b1..3dffd7e69446 100644 --- a/modules/navier_stokes/include/linearfvkernels/LinearFVScalarAdvection.h +++ b/modules/navier_stokes/include/linearfvkernels/LinearFVScalarAdvection.h @@ -47,7 +47,7 @@ class LinearFVScalarAdvection : public LinearFVFluxKernel /// Container for the velocity on the face which will be reused in the advection term's /// matrix and right hand side contribution - Real _face_velocity; + Real _volumetric_face_flux; /// The interpolation method to use for the advected quantity Moose::FV::InterpMethod _advected_interp_method; diff --git a/modules/navier_stokes/include/userobjects/RhieChowMassFlux.h b/modules/navier_stokes/include/userobjects/RhieChowMassFlux.h index 21fd8990a514..b88d089a3a02 100644 --- a/modules/navier_stokes/include/userobjects/RhieChowMassFlux.h +++ b/modules/navier_stokes/include/userobjects/RhieChowMassFlux.h @@ -46,8 +46,8 @@ class RhieChowMassFlux : public GeneralUserObject, /// Get the face velocity times density (used in advection terms) Real getMassFlux(const FaceInfo & fi) const; - /// Get the face velocity (used in advection terms) - Real getFaceVelocity(const FaceInfo & fi) const; + /// Get the volumetric face flux (used in advection terms) + Real getVolumetricFaceFlux(const FaceInfo & fi) const; /// Initialize the container for face velocities void initFaceMassFlux(); diff --git a/modules/navier_stokes/src/linearfvkernels/LinearFVScalarAdvection.C b/modules/navier_stokes/src/linearfvkernels/LinearFVScalarAdvection.C index 871e43f74d9b..175c5057934b 100644 --- a/modules/navier_stokes/src/linearfvkernels/LinearFVScalarAdvection.C +++ b/modules/navier_stokes/src/linearfvkernels/LinearFVScalarAdvection.C @@ -31,7 +31,7 @@ LinearFVScalarAdvection::LinearFVScalarAdvection(const InputParameters & params) : LinearFVFluxKernel(params), _mass_flux_provider(getUserObject("rhie_chow_user_object")), _advected_interp_coeffs(std::make_pair(0, 0)), - _face_velocity(0.0) + _volumetric_face_flux(0.0) { Moose::FV::setInterpolationMethod(*this, _advected_interp_method, "advected_interp_method"); } @@ -39,13 +39,13 @@ LinearFVScalarAdvection::LinearFVScalarAdvection(const InputParameters & params) Real LinearFVScalarAdvection::computeElemMatrixContribution() { - return _advected_interp_coeffs.first * _face_velocity * _current_face_area; + return _advected_interp_coeffs.first * _volumetric_face_flux * _current_face_area; } Real LinearFVScalarAdvection::computeNeighborMatrixContribution() { - return _advected_interp_coeffs.second * _face_velocity * _current_face_area; + return _advected_interp_coeffs.second * _volumetric_face_flux * _current_face_area; } Real @@ -71,7 +71,7 @@ LinearFVScalarAdvection::computeBoundaryMatrixContribution(const LinearFVBoundar // We support internal boundaries too so we have to make sure the normal points always outward const auto factor = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM) ? 1.0 : -1.0; - return boundary_value_matrix_contrib * factor * _face_velocity * _current_face_area; + return boundary_value_matrix_contrib * factor * _volumetric_face_flux * _current_face_area; } Real @@ -84,7 +84,7 @@ LinearFVScalarAdvection::computeBoundaryRHSContribution(const LinearFVBoundaryCo const auto factor = (_current_face_type == FaceInfo::VarFaceNeighbors::ELEM ? 1.0 : -1.0); const auto boundary_value_rhs_contrib = adv_bc->computeBoundaryValueRHSContribution(); - return -boundary_value_rhs_contrib * factor * _face_velocity * _current_face_area; + return -boundary_value_rhs_contrib * factor * _volumetric_face_flux * _current_face_area; } void @@ -94,10 +94,10 @@ LinearFVScalarAdvection::setupFaceData(const FaceInfo * face_info) // Caching the velocity on the face which will be reused in the advection term's matrix and right // hand side contributions - _face_velocity = _mass_flux_provider.getFaceVelocity(*face_info); + _volumetric_face_flux = _mass_flux_provider.getVolumetricFaceFlux(*face_info); // Caching the interpolation coefficients so they will be reused for the matrix and right hand // side terms _advected_interp_coeffs = - interpCoeffs(_advected_interp_method, *_current_face_info, true, _face_velocity); + interpCoeffs(_advected_interp_method, *_current_face_info, true, _volumetric_face_flux); } diff --git a/modules/navier_stokes/src/userobjects/RhieChowMassFlux.C b/modules/navier_stokes/src/userobjects/RhieChowMassFlux.C index 991b6af20483..a0cc5e3a33cd 100644 --- a/modules/navier_stokes/src/userobjects/RhieChowMassFlux.C +++ b/modules/navier_stokes/src/userobjects/RhieChowMassFlux.C @@ -235,15 +235,16 @@ RhieChowMassFlux::getMassFlux(const FaceInfo & fi) const } Real -RhieChowMassFlux::getFaceVelocity(const FaceInfo & fi) const +RhieChowMassFlux::getVolumetricFaceFlux(const FaceInfo & fi) const { const Moose::FaceArg face_arg{&fi, /*limiter_type=*/Moose::FV::LimiterType::CentralDifference, /*elem_is_upwind=*/true, /*correct_skewness=*/false, - &fi.elem()}; + &fi.elem(), + /*state_limiter*/ nullptr}; const Real face_rho = _rho(face_arg, Moose::currentState()); - return _face_mass_flux.evaluate(&fi) / face_rho; + return libmesh_map_find(_face_mass_flux, fi.id()) / face_rho; } void