15#include <Kokkos_Core.hpp>
29template<
typename ValueType>
65template<
typename ValueType>
72 const bool cellLimitedGradient =
false
83template<
typename ValueType>
90 const bool cellLimitedGradient =
false
97template<
typename ValueType,
bool CellLimited = false>
100 LinearUpwind<ValueType, CellLimited>>
108 : Base(exec, mesh), geometryScheme_(
GeometryScheme::readOrCreate(mesh)),
109 gradSchemeName_(readGradSchemeName(input))
115 geometryScheme_->ensureFaceDeltas();
118 static std::string
name() {
return CellLimited ?
"linearUpwindV" :
"linearUpwind"; }
122 return CellLimited ?
"linearUpwindV interpolation (cell-limited gradient correction)"
123 :
"linearUpwind interpolation";
126 static std::string
schema() {
return "none"; }
133 NF_ERROR_EXIT(
"linearUpwind interpolation scheme requires a faceFlux");
145 geometryScheme_->faceDeltaOwner(),
146 geometryScheme_->faceDeltaNeighbour(),
156 NF_ERROR_EXIT(
"linearUpwind interpolation scheme requires a faceFlux");
180 geometryScheme_->faceDeltaOwner(),
181 geometryScheme_->faceDeltaNeighbour(),
187 std::unique_ptr<SurfaceInterpolationFactory<ValueType>>
clone()
const override
189 return std::make_unique<LinearUpwind>(*
this);
197 static std::string readGradSchemeName(
Input& input)
199 if (std::holds_alternative<NeoN::TokenList>(input))
201 auto& tokens = std::get<NeoN::TokenList>(input);
202 if (tokens.peekIs<std::string>())
204 return tokens.next<std::string>();
210 const std::shared_ptr<GeometryScheme> geometryScheme_;
211 std::string gradSchemeName_;
219namespace fvcc = finiteVolume::cellCentred;
A class for the representation of a 3x3 tensor.
Represents an unstructured mesh in NeoN.
A class for the representation of a 3D Vec3.
static std::string name()
LinearUpwind(const Executor &exec, const UnstructuredMesh &mesh, Input input)
void correction(const SurfaceField< scalar > &faceFlux, const VolumeField< ValueType > &src, SurfaceField< ValueType > &corr) const override
void interpolate(const VolumeField< ValueType > &src, SurfaceField< ValueType > &dst) const override
void interpolate(const SurfaceField< scalar > &flux, const VolumeField< ValueType > &src, SurfaceField< ValueType > &dst) const override
void weight(const VolumeField< ValueType > &, SurfaceField< scalar > &) const override
bool corrected() const override
static std::string schema()
std::unique_ptr< SurfaceInterpolationFactory< ValueType > > clone() const override
void weight(const SurfaceField< scalar > &faceFlux, const VolumeField< ValueType > &src, SurfaceField< scalar > &weights) const override
Represents a surface field in a finite volume method.
Represents a volume field in a finite volume method.
A template class for registering derived classes with a base class.
#define NF_ERROR_EXIT(message)
Macro for printing an error message and aborting the program.
void computeUpwindInterpolationWeights(const SurfaceField< scalar > &flux, const VolumeField< ValueType > &src, SurfaceField< scalar > &weights)
void computeLinearUpwindInterpolation(const VolumeField< ValueType > &src, const SurfaceField< scalar > &flux, const SurfaceField< Vec3 > &faceDeltaOwner, const SurfaceField< Vec3 > &faceDeltaNeighbour, SurfaceField< ValueType > &dst, const bool cellLimitedGradient=false)
void computeLinearUpwindCorrection(const VolumeField< ValueType > &src, const SurfaceField< scalar > &flux, const SurfaceField< Vec3 > &faceDeltaOwner, const SurfaceField< Vec3 > &faceDeltaNeighbour, SurfaceField< ValueType > &dst, const bool cellLimitedGradient=false)
Integer types used throughout NeoN.
std::variant< Dictionary, TokenList > Input
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor