Line data Source code
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 : #pragma once 11 : 12 : #include "FaceInfo.h" 13 : #include "GradientLimiterType.h" 14 : #include "MooseFunctor.h" 15 : 16 : #include <utility> 17 : 18 : /** 19 : * Interface for interpolation methods that provide matrix and RHS contributions for advected face 20 : * values. 21 : */ 22 : class FVAdvectedInterpolationMethod 23 : { 24 : public: 25 : /// Matrix/RHS contribution for an advected face interpolation. 26 : struct AdvectedSystemContribution 27 : { 28 : std::pair<Real, Real> weights_matrix; 29 : Real rhs_face_value = 0.0; 30 : }; 31 : 32 : /** 33 : * Compute the matrix weights for the advected face value. Interpolation is used on 34 : * internal faces, boundary treatment is localized to the boundary conditions. 35 : * @param face The face being interpolated. 36 : * @param elem_value Element-side scalar value. 37 : * @param neighbor_value Neighbor-side scalar value. 38 : * @param elem_grad Element-side cell gradient (required). 39 : * @param neighbor_grad Neighbor-side cell gradient (required). 40 : * @param mass_flux Face mass flux for determining upwind direction. 41 : */ 42 : virtual AdvectedSystemContribution advectedInterpolate(const FaceInfo & face, 43 : Real elem_value, 44 : Real neighbor_value, 45 : const VectorValue<Real> * elem_grad, 46 : const VectorValue<Real> * neighbor_grad, 47 : Real mass_flux) const = 0; 48 : 49 : /** 50 : * Convenience overload that evaluates a scalar Moose functor at the adjacent cell centers and, 51 : * if needed, its cell gradients before applying this interpolation method. This will provide 52 : * contributions to the matrix and right hand side of a linear system. 53 : * @param functor The function which will be interpolated onto the face. 54 : * @param face The face which will be use for interpolation. 55 : * @param state The state argument for which we are performing the interpolation. 56 : * @param mass_flux The mass flux which will be used for the interpolation. 57 : */ 58 : AdvectedSystemContribution advectedInterpolate(const Moose::FunctorBase<Real> & functor, 59 : const FaceInfo & face, 60 : const Moose::StateArg & state, 61 : const Real mass_flux) const; 62 : 63 : /** 64 : * Compute the advected face value. Interpolation is used on 65 : * internal faces, boundary treatment is localized to the boundary conditions. 66 : * @param face The face being interpolated. 67 : * @param elem_value Element-side scalar value. 68 : * @param neighbor_value Neighbor-side scalar value. 69 : * @param elem_grad Element-side cell gradient (required). 70 : * @param neighbor_grad Neighbor-side cell gradient (required). 71 : * @param mass_flux Face mass flux for determining upwind direction. 72 : */ 73 : virtual Real advectedInterpolateValue(const FaceInfo & face, 74 : Real elem_value, 75 : Real neighbor_value, 76 : const VectorValue<Real> * elem_grad, 77 : const VectorValue<Real> * neighbor_grad, 78 : Real mass_flux) const; 79 : 80 : /** 81 : * Convenience overload that evaluates a scalar Moose functor at the adjacent cell centers and, 82 : * if needed, its cell gradients before applying this interpolation method. This will return 83 : * the interpolated face value. 84 : * @param functor The function which will be interpolated onto the face. 85 : * @param face The face which will be use for interpolation. 86 : * @param state The state argument for which we are performing the interpolation. 87 : * @param mass_flux The mass flux which will be used for the interpolation. 88 : */ 89 : Real advectedInterpolateValue(const Moose::FunctorBase<Real> & functor, 90 : const FaceInfo & face, 91 : const Moose::StateArg & state, 92 : const Real mass_flux) const; 93 : 94 : /** 95 : * Whether advected interpolation requires adjacent-cell gradients. 96 : */ 97 21177756 : virtual bool needsGradients() const { return false; } 98 : 99 : /** 100 : * Limiter used by interpolations that require limited gradients. 101 : */ 102 21249366 : virtual Moose::FV::GradientLimiterType gradientLimiter() const 103 : { 104 21249366 : return Moose::FV::GradientLimiterType::None; 105 : } 106 : };