NeoN
A framework for CFD software
Loading...
Searching...
No Matches
surfaceIntegrate.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
9#include "NeoN/core/input.hpp"
10#include "NeoN/dsl/operator.hpp"
13
15{
16
17template<typename ValueType>
19 const Executor& exec,
20 localIdx nInternalFaces,
21 View<const int> neighbour,
22 View<const int> owner,
23 View<const int> faceCells,
27 const dsl::Coeff operatorScaling
28);
29
30template<typename ValueType>
32{
33
34public:
35
36 using VectorValueType = ValueType;
37
39 : flux_(flux), type_(dsl::Operator::Type::Explicit), coeffs_(1.0) {};
40
42 : flux_(surfaceIntegrate.flux_), type_(surfaceIntegrate.type_),
43 coeffs_(surfaceIntegrate.coeffs_) {};
44
45
46 void read(const Input&) {}
47
49 {
50 NeoN::Vector<ValueType> tmpsource(source.exec(), source.size(), zero<ValueType>());
51 const auto operatorScaling = this->getCoefficient();
52
53 const UnstructuredMesh& mesh = flux_.mesh();
54 const auto exec = flux_.exec();
55
56 auto nInternalFaces = mesh.nInternalFaces();
57 surfaceIntegrate<ValueType>(
58 exec,
59 nInternalFaces,
60 mesh.faceNeighbour().view(),
61 mesh.faceOwner().view(),
62 mesh.boundaryMesh().faceCells().view(),
63 this->flux_.internalVector().view(),
64 mesh.cellVolumes().view(),
65 tmpsource.view(),
66 operatorScaling
67 );
68 source += tmpsource;
69 }
70
71 const Executor& exec() const { return flux_.exec(); }
72
73 dsl::Coeff& getCoefficient() { return coeffs_; }
74
75 const dsl::Coeff& getCoefficient() const { return coeffs_; }
76
77 dsl::Operator::Type getType() const { return type_; }
78
79 std::string getName() const { return "SurfaceIntegrate"; }
80
81private:
82
83 const SurfaceField<ValueType>& flux_;
85 dsl::Coeff coeffs_;
86};
87
88
89} // namespace NeoN
const labelVector & faceCells() const
Get the field of face cells.
Represents an unstructured mesh in NeoN.
const scalarVector & cellVolumes() const
Get the field of cell volumes in the mesh.
localIdx nInternalFaces() const
Get the number of internal faces in the mesh.
const labelVector & faceNeighbour() const
Get the field of face neighbour cells.
const labelVector & faceOwner() const
Get the field of face owner cells.
const BoundaryMesh & boundaryMesh() const
Get the boundary mesh.
A class to contain the data and executors for a field and define some basic operations.
Definition vector.hpp:30
View< ValueType > view() &&=delete
A class that represents a coefficient for the NeoN dsl.
Definition coeff.hpp:24
Represents a surface field in a finite volume method.
SurfaceIntegrate(const SurfaceField< ValueType > &flux)
void explicitOperation(Vector< ValueType > &source) const
SurfaceIntegrate(const SurfaceIntegrate &surfaceIntegrate)
void surfaceIntegrate(const Executor &exec, localIdx nInternalFaces, View< const int > neighbour, View< const int > owner, View< const int > faceCells, View< const ValueType > flux, View< const scalar > v, View< ValueType > res, const dsl::Coeff operatorScaling)
std::variant< Dictionary, TokenList > Input
Definition input.hpp:15
int32_t localIdx
Definition label.hpp:32
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:18