NeoN
A framework for CFD software
Loading...
Searching...
No Matches
gaussGreenLaplacian.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 - 2025 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
14
16{
17
18template<typename ValueType>
24 const dsl::Coeff
25);
26
27template<typename ValueType>
30 const SurfaceField<scalar>& gamma,
32 const dsl::Coeff operatorScaling,
33 const la::SparsityPattern& sparsityPattern,
34 const FaceNormalGradient<ValueType>& faceNormalGradient
35);
36
37template<typename ValueType>
39 public LaplacianOperatorFactory<ValueType>::template Register<GaussGreenLaplacian<ValueType>>
40{
41 using Base =
43
44public:
45
46 static std::string name() { return "Gauss"; }
47
48 static std::string doc() { return "Gauss-Green Laplacian"; }
49
50 static std::string schema() { return "none"; }
51
52 GaussGreenLaplacian(const Executor& exec, const UnstructuredMesh& mesh, const Input& inputs)
53 : Base(exec, mesh), surfaceInterpolation_(exec, mesh, inputs),
54 faceNormalGradient_(exec, mesh, inputs) {};
55
56 virtual void laplacian(
58 const SurfaceField<scalar>& gamma,
60 const dsl::Coeff operatorScaling
61 ) override
62 {
63 computeLaplacianExp<ValueType>(
64 faceNormalGradient_, gamma, phi, lapPhi.internalVector(), operatorScaling
65 );
66 };
67
69 const SurfaceField<scalar>& gamma,
71 const dsl::Coeff operatorScaling
72 ) const override
73 {
74 std::string name = "laplacian(" + gamma.name + "," + phi.name + ")";
76 this->exec_,
77 name,
78 this->mesh_,
80 );
81 NeoN::fill(lapPhi.internalVector(), zero<ValueType>());
82 NeoN::fill(lapPhi.boundaryData().value(), zero<ValueType>());
83 computeLaplacianExp<ValueType>(
84 faceNormalGradient_, gamma, phi, lapPhi.internalVector(), operatorScaling
85 );
86 return lapPhi;
87 };
88
89 virtual void laplacian(
90 Vector<ValueType>& lapPhi,
91 const SurfaceField<scalar>& gamma,
93 const dsl::Coeff operatorScaling
94 ) override
95 {
96 computeLaplacianExp<ValueType>(faceNormalGradient_, gamma, phi, lapPhi, operatorScaling);
97 };
98
99 virtual void laplacian(
101 const SurfaceField<scalar>& gamma,
103 const dsl::Coeff operatorScaling
104 ) override
105 {
107 ls, gamma, phi, operatorScaling, this->getSparsityPattern(), faceNormalGradient_
108 );
109 };
110
111 std::unique_ptr<LaplacianOperatorFactory<ValueType>> clone() const override
112 {
113 return std::make_unique<GaussGreenLaplacian<ValueType>>(*this);
114 };
115
116private:
117
118 SurfaceInterpolation<ValueType> surfaceInterpolation_;
119
120 FaceNormalGradient<ValueType> faceNormalGradient_;
121};
122
123// instantiate the template class
124template class GaussGreenLaplacian<scalar>;
125template class GaussGreenLaplacian<Vec3>;
126
127} // namespace NeoN
const Vector< T > & value() const
Get the view storing the computed values from the boundary condition.
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:30
A class that represents a coefficient for the NeoN dsl.
Definition coeff.hpp:24
const BoundaryData< ValueType > & boundaryData() const
Returns a const reference to the boundary field.
Definition domain.hpp:101
const Vector< ValueType > & internalVector() const
Returns a const reference to the internal field.
Definition domain.hpp:80
GaussGreenLaplacian(const Executor &exec, const UnstructuredMesh &mesh, const Input &inputs)
virtual VolumeField< ValueType > laplacian(const SurfaceField< scalar > &gamma, VolumeField< ValueType > &phi, const dsl::Coeff operatorScaling) const override
virtual void laplacian(la::LinearSystem< ValueType, localIdx > &ls, const SurfaceField< scalar > &gamma, VolumeField< ValueType > &phi, const dsl::Coeff operatorScaling) override
virtual void laplacian(VolumeField< ValueType > &lapPhi, const SurfaceField< scalar > &gamma, VolumeField< ValueType > &phi, const dsl::Coeff operatorScaling) override
virtual void laplacian(Vector< ValueType > &lapPhi, const SurfaceField< scalar > &gamma, VolumeField< ValueType > &phi, const dsl::Coeff operatorScaling) override
std::unique_ptr< LaplacianOperatorFactory< ValueType > > clone() const override
Represents a surface field in a finite volume method.
Represents a volume boundary field for a cell-centered 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 computeLaplacianExp(const FaceNormalGradient< ValueType > &, const SurfaceField< scalar > &, VolumeField< ValueType > &, Vector< ValueType > &, const dsl::Coeff)
void computeLaplacianImpl(la::LinearSystem< ValueType, localIdx > &ls, const SurfaceField< scalar > &gamma, VolumeField< ValueType > &phi, const dsl::Coeff operatorScaling, const la::SparsityPattern &sparsityPattern, const FaceNormalGradient< ValueType > &faceNormalGradient)
std::vector< BoundaryType > createCalculatedBCs(const UnstructuredMesh &mesh)
Definition boundary.hpp:28
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:18
void fill(ContType< ValueType > &cont, const std::type_identity_t< ValueType > value, std::pair< localIdx, localIdx > range={0, 0})
Fill the field with a vector value using a specific executor.