NeoN
A framework for CFD software
Loading...
Searching...
No Matches
gaussGreenLaplacian.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2024 NeoN authors
3
4#pragma once
5
13
15{
16
17template<typename ValueType>
23 const dsl::Coeff
24);
25
26template<typename ValueType>
29 const SurfaceField<scalar>& gamma,
31 const dsl::Coeff operatorScaling,
32 const la::SparsityPattern& sparsityPattern,
33 const FaceNormalGradient<ValueType>& faceNormalGradient
34);
35
36template<typename ValueType>
38 public LaplacianOperatorFactory<ValueType>::template Register<GaussGreenLaplacian<ValueType>>
39{
40 using Base =
42
43public:
44
45 static std::string name() { return "Gauss"; }
46
47 static std::string doc() { return "Gauss-Green Laplacian"; }
48
49 static std::string schema() { return "none"; }
50
51 GaussGreenLaplacian(const Executor& exec, const UnstructuredMesh& mesh, const Input& inputs)
52 : Base(exec, mesh), surfaceInterpolation_(exec, mesh, inputs),
53 faceNormalGradient_(exec, mesh, inputs) {};
54
55 virtual void laplacian(
57 const SurfaceField<scalar>& gamma,
59 const dsl::Coeff operatorScaling
60 ) override
61 {
62 computeLaplacianExp<ValueType>(
63 faceNormalGradient_, gamma, phi, lapPhi.internalVector(), operatorScaling
64 );
65 };
66
68 const SurfaceField<scalar>& gamma,
70 const dsl::Coeff operatorScaling
71 ) const override
72 {
73 std::string name = "laplacian(" + gamma.name + "," + phi.name + ")";
75 this->exec_,
76 name,
77 this->mesh_,
79 );
80 NeoN::fill(lapPhi.internalVector(), zero<ValueType>());
81 NeoN::fill(lapPhi.boundaryData().value(), zero<ValueType>());
82 computeLaplacianExp<ValueType>(
83 faceNormalGradient_, gamma, phi, lapPhi.internalVector(), operatorScaling
84 );
85 return lapPhi;
86 };
87
88 virtual void laplacian(
89 Vector<ValueType>& lapPhi,
90 const SurfaceField<scalar>& gamma,
92 const dsl::Coeff operatorScaling
93 ) override
94 {
95 computeLaplacianExp<ValueType>(faceNormalGradient_, gamma, phi, lapPhi, operatorScaling);
96 };
97
98 virtual void laplacian(
100 const SurfaceField<scalar>& gamma,
102 const dsl::Coeff operatorScaling
103 ) override
104 {
106 ls, gamma, phi, operatorScaling, this->getSparsityPattern(), faceNormalGradient_
107 );
108 };
109
110 std::unique_ptr<LaplacianOperatorFactory<ValueType>> clone() const override
111 {
112 return std::make_unique<GaussGreenLaplacian<ValueType>>(*this);
113 };
114
115private:
116
117 SurfaceInterpolation<ValueType> surfaceInterpolation_;
118
119 FaceNormalGradient<ValueType> faceNormalGradient_;
120};
121
122// instantiate the template class
123template class GaussGreenLaplacian<scalar>;
124template class GaussGreenLaplacian<Vec3>;
125
126} // 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:28
A class that represents a coefficient for the NeoN dsl.
Definition coeff.hpp:22
const BoundaryData< ValueType > & boundaryData() const
Returns a const reference to the boundary field.
Definition domain.hpp:100
const Vector< ValueType > & internalVector() const
Returns a const reference to the internal field.
Definition domain.hpp:79
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:27
std::variant< Dictionary, TokenList > Input
Definition input.hpp:13
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:16
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.