NeoN
A framework for CFD software
Loading...
Searching...
No Matches
gaussGreenDiv.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 - 2026 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
13
15{
16
17/* @brief
18 *
19 */
20template<typename FieldValueType, typename AssemblyType = FieldValueType>
22 public DivOperatorFactory<FieldValueType, AssemblyType>::template Register<
23 GaussGreenDiv<FieldValueType, AssemblyType>>
24{
27
28public:
29
30 static std::string name() { return "Gauss"; }
31
32 static std::string doc() { return "Gauss-Green Divergence"; }
33
34 static std::string schema() { return "none"; }
35
36 GaussGreenDiv(const Executor& exec, const UnstructuredMesh& mesh, const Input& inputs)
37 : Base(exec, mesh), surfaceInterpolation_(exec, mesh, inputs) {};
38
40 div(const SurfaceField<scalar>& faceFlux,
42 const dsl::Coeff operatorScaling) const override;
43
44 virtual void
46 const SurfaceField<scalar>& faceFlux,
48 const dsl::Coeff operatorScaling) const override;
49
50 virtual void
52 const SurfaceField<scalar>& faceFlux,
54 const dsl::Coeff operatorScaling) const override;
55
56 virtual void
58 const SurfaceField<scalar>& faceFlux,
60 const dsl::Coeff operatorScaling) const override;
61
62 std::unique_ptr<DivOperatorFactory<FieldValueType, AssemblyType>> clone() const override
63 {
64 return std::make_unique<GaussGreenDiv<FieldValueType, AssemblyType>>(*this);
65 }
66
67private:
68
69 SurfaceInterpolation<FieldValueType> surfaceInterpolation_;
70};
71
72// Required on MSVC: without extern template, each TU (DLL and EXE) gets its own
73// instantiation of table() static local, so the DLL's addSubType() inserts into
74// a different map than the one the test binary queries.
75extern template class GaussGreenDiv<scalar>;
76extern template class GaussGreenDiv<Vec3>;
77extern template class GaussGreenDiv<Vec3, scalar>;
78
79/* @brief Adds the explicit (deferred) divergence correction of a corrected interpolation scheme
80 * to the linear-system rhs. Shared with the fused div-laplacian operator so both implicit div
81 * paths apply linearUpwind identically. Defined and instantiated in gaussGreenDiv.cpp.
82 */
83template<typename FieldValueType, typename AssemblyType>
86 const SurfaceField<scalar>& faceFlux,
87 const SurfaceField<FieldValueType>& correction,
88 const dsl::Coeff operatorScaling
89);
90
91extern template void addDivCorrectionToRhs(
95 const dsl::Coeff
96);
97extern template void addDivCorrectionToRhs(
100 const SurfaceField<Vec3>&,
101 const dsl::Coeff
102);
103extern template void addDivCorrectionToRhs(
106 const SurfaceField<Vec3>&,
107 const dsl::Coeff
108);
109
110} // namespace NeoN
Represents an unstructured mesh in NeoN.
A class to contain the data and executors for a field and define some basic operations.
Definition vector.hpp:27
A class that represents a coefficient for the NeoN dsl.
Definition coeff.hpp:24
std::unique_ptr< DivOperatorFactory< FieldValueType, AssemblyType > > clone() const override
virtual void div(Vector< FieldValueType > &divPhi, const SurfaceField< scalar > &faceFlux, const VolumeField< FieldValueType > &phi, const dsl::Coeff operatorScaling) const override
virtual void div(VolumeField< FieldValueType > &divPhi, const SurfaceField< scalar > &faceFlux, const VolumeField< FieldValueType > &phi, const dsl::Coeff operatorScaling) const override
GaussGreenDiv(const Executor &exec, const UnstructuredMesh &mesh, const Input &inputs)
virtual void div(la::LinearSystem< AssemblyType, FieldValueType > &ls, const SurfaceField< scalar > &faceFlux, const VolumeField< FieldValueType > &phi, const dsl::Coeff operatorScaling) const override
virtual VolumeField< FieldValueType > div(const SurfaceField< scalar > &faceFlux, const VolumeField< FieldValueType > &phi, const dsl::Coeff operatorScaling) const override
Represents a surface field in a finite volume method.
Represents a volume field in a finite volume method.
A class representing a linear system of equations.
A template class for registering derived classes with a base class.
void addDivCorrectionToRhs(la::LinearSystem< AssemblyType, FieldValueType > &ls, const SurfaceField< scalar > &faceFlux, const SurfaceField< FieldValueType > &correction, const dsl::Coeff operatorScaling)
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:20