NeoN
A framework for CFD software
Loading...
Searching...
No Matches
surfaceIntegrate.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 - 2026 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 label> internalFaceNeighbors,
22 View<const label> internalFaceOwners,
23 View<const label> boundaryFaceOwners,
28 const dsl::Coeff operatorScaling
29);
30
31template<typename ValueType>
33{
34
35public:
36
37 using VectorValueType = ValueType;
38
40 : flux_(flux), type_(dsl::Operator::Type::Explicit), coeffs_(1.0) {};
41
43 : flux_(surfaceIntegrate.flux_), type_(surfaceIntegrate.type_),
44 coeffs_(surfaceIntegrate.coeffs_) {};
45
46
47 void read(const Input&) {}
48
50 {
51 NeoN::Vector<ValueType> tmpsource(source.exec(), source.size(), zero<ValueType>());
52 const auto operatorScaling = this->getCoefficient();
53
54 const UnstructuredMesh& mesh = flux_.mesh();
55 const auto exec = flux_.exec();
56
57 auto nInternalFaces = mesh.nInternalFaces();
58 surfaceIntegrate<ValueType>(
59 exec,
60 nInternalFaces,
61 mesh.faceNeighbors().view(),
62 mesh.faceOwners().view(),
63 mesh.boundaryMesh().faceOwners().view(),
64 this->flux_.internalVector().view(),
65 this->flux_.boundaryData().value().view(),
66 mesh.cellVolumes().view(),
67 tmpsource.view(),
68 operatorScaling
69 );
70 source += tmpsource;
71 }
72
73 const Executor& exec() const { return flux_.exec(); }
74
75 dsl::Coeff& getCoefficient() { return coeffs_; }
76
77 const dsl::Coeff& getCoefficient() const { return coeffs_; }
78
79 dsl::Operator::Type getType() const { return type_; }
80
81 std::string getName() const { return "SurfaceIntegrate"; }
82
83 Dictionary getConfig() const { return {}; }
84
85private:
86
87 const SurfaceField<ValueType>& flux_;
89 dsl::Coeff coeffs_;
90};
91
92
93} // namespace NeoN
const labelVector & faceOwners() const
Get the list of labels of owner cells of boundary faces.
A class representing a dictionary that stores key-value pairs.
Represents an unstructured mesh in NeoN.
const labelVector & faceOwners() const
Get the list of labels of face owner cells.
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 & faceNeighbors() const
Get the list of labels of face neighbor 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:27
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 label > internalFaceNeighbors, View< const label > internalFaceOwners, View< const label > boundaryFaceOwners, View< const ValueType > flux, View< const ValueType > bFlux, 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:50
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:20