NeoN
A framework for CFD software
Loading...
Searching...
No Matches
uncorrected.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2023 - 2026 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
12
13#include <Kokkos_Core.hpp>
14
15#include <functional>
16
17
19{
20
21template<typename ValueType>
23 const VolumeField<ValueType>& volVector,
24 const std::shared_ptr<GeometryScheme> geometryScheme,
25 SurfaceField<ValueType>& surfaceVector
26);
27
28template<typename ValueType>
30 public FaceNormalGradientFactory<ValueType>::template Register<Uncorrected<ValueType>>
31{
33
34
35public:
36
37 Uncorrected(const Executor& exec, const UnstructuredMesh& mesh, Input)
38 : Base(exec, mesh), geometryScheme_(GeometryScheme::readOrCreate(mesh)) {};
39
40 Uncorrected(const Executor& exec, const UnstructuredMesh& mesh)
41 : Base(exec, mesh), geometryScheme_(GeometryScheme::readOrCreate(mesh)) {};
42
43 static std::string name() { return "uncorrected"; }
44
45 static std::string doc() { return "Uncorrected interpolation"; }
46
47 static std::string schema() { return "none"; }
48
49 virtual void faceNormalGrad(
50 const VolumeField<ValueType>& volVector, SurfaceField<ValueType>& surfaceVector
51 ) const override
52 {
53 computeFaceNormalGrad(volVector, geometryScheme_, surfaceVector);
54 }
55
56 virtual const SurfaceField<scalar>& deltaCoeffs() const override
57 {
58 // The uncorrected surface-normal gradient uses nonOrthDeltaCoeffs (1/(n.d)), NOT the
59 // orthogonal 1/|d|: on a non-orthogonal mesh 1/(n.d) is the consistent normal-gradient
60 // coefficient. The two coincide on orthogonal meshes.
61 return geometryScheme_->nonOrthDeltaCoeffs();
62 }
63
64 std::unique_ptr<FaceNormalGradientFactory<ValueType>> clone() const override
65 {
66 return std::make_unique<Uncorrected>(*this);
67 }
68
69private:
70
71 const std::shared_ptr<GeometryScheme> geometryScheme_;
72};
73
74// instantiate the template class
75template class Uncorrected<scalar>;
76template class Uncorrected<Vec3>;
77
78} // namespace NeoN
Represents an unstructured mesh in NeoN.
Represents a surface field in a finite volume method.
Uncorrected(const Executor &exec, const UnstructuredMesh &mesh)
Uncorrected(const Executor &exec, const UnstructuredMesh &mesh, Input)
virtual const SurfaceField< scalar > & deltaCoeffs() const override
virtual void faceNormalGrad(const VolumeField< ValueType > &volVector, SurfaceField< ValueType > &surfaceVector) const override
std::unique_ptr< FaceNormalGradientFactory< ValueType > > clone() const override
Represents a volume field in a finite volume method.
A template class for registering derived classes with a base class.
void computeFaceNormalGrad(const VolumeField< ValueType > &volVector, const std::shared_ptr< GeometryScheme > geometryScheme, SurfaceField< ValueType > &surfaceVector)
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:20