16#include <Kokkos_Core.hpp>
24template<
typename ValueType>
27 const std::shared_ptr<GeometryScheme> geometryScheme,
32template<
typename ValueType>
35 const std::shared_ptr<GeometryScheme> geometryScheme,
40template<
typename ValueType>
47 static constexpr scalar DEFAULT_LIMIT_COEFF = 0.333;
52 : Base(exec, mesh), geometryScheme_(
GeometryScheme::readOrCreate(mesh)),
53 limitCoeff_(readLimitCoeff(inputs)) {};
56 : Base(exec, mesh), geometryScheme_(
GeometryScheme::readOrCreate(mesh)),
57 limitCoeff_(DEFAULT_LIMIT_COEFF) {};
59 static std::string
name() {
return "limited"; }
61 static std::string
doc()
63 return "Limited corrected face normal gradient with bounded non-orthogonality correction";
66 static std::string
schema() {
return "none"; }
77 return geometryScheme_->nonOrthDeltaCoeffs();
89 std::unique_ptr<FaceNormalGradientFactory<ValueType>>
clone()
const override
91 return std::make_unique<LimitedCorrected>(*
this);
98 if (std::holds_alternative<NeoN::Dictionary>(inputs))
100 const auto& dict = std::get<NeoN::Dictionary>(inputs);
101 if (dict.contains(
"limitCoeff"))
103 return dict.get<
scalar>(
"limitCoeff");
105 return DEFAULT_LIMIT_COEFF;
112 const auto& tl = std::get<NeoN::TokenList>(inputs);
113 if (tl.peekIs<std::string>())
115 const std::string&
sub = tl.next<std::string>();
117 sub ==
"corrected",
"limited snGrad: only 'corrected' sub-scheme is supported"
123 const std::shared_ptr<GeometryScheme> geometryScheme_;
128template class LimitedCorrected<scalar>;
129template class LimitedCorrected<Vec3>;
Represents an unstructured mesh in NeoN.
bool hasImplicitCorrection() const override
virtual const SurfaceField< scalar > & deltaCoeffs() const override
std::unique_ptr< FaceNormalGradientFactory< ValueType > > clone() const override
static std::string schema()
virtual void faceNormalGrad(const VolumeField< ValueType > &volField, SurfaceField< ValueType > &surfaceField) const override
static std::string name()
LimitedCorrected(const Executor &exec, const UnstructuredMesh &mesh, const Input &inputs)
virtual void implicitCorrection(const VolumeField< ValueType > &phi, SurfaceField< ValueType > &corrField) const override
LimitedCorrected(const Executor &exec, const UnstructuredMesh &mesh)
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_ASSERT(condition, message)
Macro for asserting a condition and printing an error message if the condition is false.
void computeLimitedCorrectedFaceNormalGrad(const VolumeField< ValueType > &volField, const std::shared_ptr< GeometryScheme > geometryScheme, scalar limitCoeff, SurfaceField< ValueType > &surfaceField)
void computeLimitedCorrectionTerm(const VolumeField< ValueType > &volField, const std::shared_ptr< GeometryScheme > geometryScheme, scalar limitCoeff, SurfaceField< ValueType > &corrField)
void sub(Vector< ValueType > &vect, const std::type_identity_t< ValueType > &value)
std::variant< Dictionary, TokenList > Input
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor