NeoN
A framework for CFD software
Loading...
Searching...
No Matches
corrected.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
13
14#include <Kokkos_Core.hpp>
15
16#include <functional>
17
18
20{
21
22template<typename ValueType>
24 const VolumeField<ValueType>& volField,
25 const std::shared_ptr<GeometryScheme> geometryScheme,
26 SurfaceField<ValueType>& surfaceField
27);
28
29template<typename ValueType>
31 const VolumeField<ValueType>& volField,
32 const std::shared_ptr<GeometryScheme> geometryScheme,
34);
35
36template<typename ValueType>
37class Corrected :
38 public FaceNormalGradientFactory<ValueType>::template Register<Corrected<ValueType>>
39{
41
42public:
43
44 Corrected(const Executor& exec, const UnstructuredMesh& mesh, Input)
45 : Base(exec, mesh), geometryScheme_(GeometryScheme::readOrCreate(mesh)) {};
46
47 Corrected(const Executor& exec, const UnstructuredMesh& mesh)
48 : Base(exec, mesh), geometryScheme_(GeometryScheme::readOrCreate(mesh)) {};
49
50 static std::string name() { return "corrected"; }
51
52 static std::string doc()
53 {
54 return "Corrected face normal gradient with explicit non-orthogonality correction";
55 }
56
57 static std::string schema() { return "none"; }
58
59 virtual void faceNormalGrad(
60 const VolumeField<ValueType>& volField, SurfaceField<ValueType>& surfaceField
61 ) const override
62 {
63 computeCorrectedFaceNormalGrad(volField, geometryScheme_, surfaceField);
64 }
65
66 virtual const SurfaceField<scalar>& deltaCoeffs() const override
67 {
68 return geometryScheme_->nonOrthDeltaCoeffs();
69 }
70
71 bool hasImplicitCorrection() const override { return true; }
72
73 virtual void implicitCorrection(
75 ) const override
76 {
77 computeCorrectionTerm(phi, geometryScheme_, corrField);
78 }
79
80 std::unique_ptr<FaceNormalGradientFactory<ValueType>> clone() const override
81 {
82 return std::make_unique<Corrected>(*this);
83 }
84
85private:
86
87 const std::shared_ptr<GeometryScheme> geometryScheme_;
88};
89
90// instantiate the template class
91template class Corrected<scalar>;
92template class Corrected<Vec3>;
93
94} // namespace NeoN
Represents an unstructured mesh in NeoN.
std::unique_ptr< FaceNormalGradientFactory< ValueType > > clone() const override
Definition corrected.hpp:80
virtual void faceNormalGrad(const VolumeField< ValueType > &volField, SurfaceField< ValueType > &surfaceField) const override
Definition corrected.hpp:59
virtual void implicitCorrection(const VolumeField< ValueType > &phi, SurfaceField< ValueType > &corrField) const override
Definition corrected.hpp:73
bool hasImplicitCorrection() const override
Definition corrected.hpp:71
Corrected(const Executor &exec, const UnstructuredMesh &mesh, Input)
Definition corrected.hpp:44
virtual const SurfaceField< scalar > & deltaCoeffs() const override
Definition corrected.hpp:66
Corrected(const Executor &exec, const UnstructuredMesh &mesh)
Definition corrected.hpp:47
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.
void computeCorrectionTerm(const VolumeField< ValueType > &volField, const std::shared_ptr< GeometryScheme > geometryScheme, SurfaceField< ValueType > &corrField)
void computeCorrectedFaceNormalGrad(const VolumeField< ValueType > &volField, const std::shared_ptr< GeometryScheme > geometryScheme, SurfaceField< ValueType > &surfaceField)
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:20