NeoN
A framework for CFD software
Loading...
Searching...
No Matches
gaussGreenLaplacian.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
14
16{
17
18// Deferred non-orthogonal correction kernel for the Laplacian (defined in gaussGreenLaplacian.cpp).
19// Declared here so other operators (e.g. GaussGreenDivLaplacian) can reuse it. Adds the explicit
20// snGrad correction to the linear system's rhs; a no-op unless the snGrad scheme is corrected.
21template<typename FieldValueType, typename AssemblyType = FieldValueType>
24 const SurfaceField<scalar>& gamma,
26 const dsl::Coeff coeff,
27 const FaceNormalGradient<FieldValueType>& faceNormalGradient
28);
29
30// Implicit transform-BC (slip/symmetry "implicit") per-component diagonal of the Laplacian,
31// accumulated into the linear system's diagCmpt store (defined in gaussGreenLaplacian.cpp). A no-op
32// for scalar fields or when no boundary condition is an implicit transform. Declared here so the
33// fused GaussGreenDivLaplacian applies the same contribution as the plain Laplacian.
34template<typename FieldValueType, typename AssemblyType = FieldValueType>
37 const SurfaceField<scalar>& gamma,
39 const dsl::Coeff operatorScaling,
40 const FaceNormalGradient<FieldValueType>& faceNormalGradient
41);
42
43template<typename FieldValueType, typename AssemblyType = FieldValueType>
45 public LaplacianOperatorFactory<FieldValueType, AssemblyType>::template Register<
46 GaussGreenLaplacian<FieldValueType, AssemblyType>>
47{
50
51public:
52
53 static std::string name() { return "Gauss"; }
54
55 static std::string doc() { return "Gauss-Green Laplacian"; }
56
57 static std::string schema() { return "none"; }
58
59 GaussGreenLaplacian(const Executor& exec, const UnstructuredMesh& mesh, const Input& inputs)
60 : Base(exec, mesh), surfaceInterpolation_(exec, mesh, inputs),
61 faceNormalGradient_(exec, mesh, inputs) {};
62
63 virtual void laplacian(
65 const SurfaceField<scalar>& gamma,
67 const dsl::Coeff coeff
68 ) override;
69
71 const SurfaceField<scalar>& gamma,
73 const dsl::Coeff coeff
74 ) const override;
75
76 virtual void laplacian(
78 const SurfaceField<scalar>& gamma,
80 const dsl::Coeff coeff
81 ) override;
82
83 virtual void laplacian(
85 const SurfaceField<scalar>& gamma,
87 const dsl::Coeff coeff
88 ) override;
89
90 std::unique_ptr<LaplacianOperatorFactory<FieldValueType, AssemblyType>> clone() const override
91 {
92 return std::make_unique<GaussGreenLaplacian<FieldValueType, AssemblyType>>(*this);
93 };
94
95private:
96
97 SurfaceInterpolation<FieldValueType> surfaceInterpolation_;
98
99 FaceNormalGradient<FieldValueType> faceNormalGradient_;
100};
101
102// Required on MSVC: without extern template, each TU (DLL and EXE) gets its own
103// instantiation of table() static local, so the DLL's addSubType() inserts into
104// a different map than the one the test binary queries.
105extern template class GaussGreenLaplacian<scalar>;
106extern template class GaussGreenLaplacian<Vec3>;
107extern template class GaussGreenLaplacian<Vec3, scalar>;
108
109} // namespace NeoN
Represents an unstructured mesh in NeoN.
An executor-aware contiguous container for numerical data with vector-style arithmetic semantics.
Definition vector.hpp:40
A class that represents a coefficient for the NeoN dsl.
Definition coeff.hpp:24
std::unique_ptr< LaplacianOperatorFactory< FieldValueType, AssemblyType > > clone() const override
virtual VolumeField< FieldValueType > laplacian(const SurfaceField< scalar > &gamma, const VolumeField< FieldValueType > &phi, const dsl::Coeff coeff) const override
virtual void laplacian(Vector< FieldValueType > &lapPhi, const SurfaceField< scalar > &gamma, const VolumeField< FieldValueType > &phi, const dsl::Coeff coeff) override
virtual void laplacian(VolumeField< FieldValueType > &lapPhi, const SurfaceField< scalar > &gamma, const VolumeField< FieldValueType > &phi, const dsl::Coeff coeff) override
GaussGreenLaplacian(const Executor &exec, const UnstructuredMesh &mesh, const Input &inputs)
virtual void laplacian(la::LinearSystem< AssemblyType, FieldValueType > &ls, const SurfaceField< scalar > &gamma, const VolumeField< FieldValueType > &phi, const dsl::Coeff coeff) 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 computeLaplacianNonOrthCorrImpl(la::LinearSystem< AssemblyType, FieldValueType > &ls, const SurfaceField< scalar > &gamma, const VolumeField< FieldValueType > &phi, const dsl::Coeff coeff, const FaceNormalGradient< FieldValueType > &faceNormalGradient)
void computeLaplacianImplicitTransformDiagImpl(la::LinearSystem< AssemblyType, FieldValueType > &ls, const SurfaceField< scalar > &gamma, const VolumeField< FieldValueType > &phi, const dsl::Coeff operatorScaling, const FaceNormalGradient< FieldValueType > &faceNormalGradient)
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:21
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15