NeoN
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
surfaceField.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2024 NeoN authors
3
4#pragma once
5
6#include <vector>
7
10
12{
13
24template<typename ValueType>
25class SurfaceField : public DomainMixin<ValueType>
26{
27
28public:
29
39 const Executor& exec,
40 std::string fieldName,
42 const std::vector<SurfaceBoundary<ValueType>>& boundaryConditions
43 )
44 : DomainMixin<ValueType>(
45 exec,
46 fieldName,
47 mesh,
48 Field<ValueType>(
49 exec, mesh.nInternalFaces() + mesh.nBoundaryFaces(), mesh.boundaryMesh().offset()
50 )
51 ),
52 boundaryConditions_(boundaryConditions)
53 {}
54
55 /* @brief Constructor for a surfaceVector with a given internal field
56 *
57 * @param exec The executor
58 * @param mesh The underlying mesh
59 * @param internalVector the underlying internal field
60 * @param boundaryConditions a vector of boundary conditions
61 */
63 const Executor& exec,
65 const Field<ValueType>& domainVector,
66 const std::vector<SurfaceBoundary<ValueType>>& boundaryConditions
67 )
68 : DomainMixin<ValueType>(exec, mesh, domainVector), boundaryConditions_(boundaryConditions)
69 {}
70
71 /* @brief Constructor for a surfaceVector with a given internal field
72 *
73 * @param exec The executor
74 * @param mesh The underlying mesh
75 * @param internalVector the underlying internal field
76 * @param boundaryConditions a vector of boundary conditions
77 */
79 const Executor& exec,
82 const BoundaryData<ValueType>& boundaryVectors,
83 const std::vector<SurfaceBoundary<ValueType>>& boundaryConditions
84 )
85 : DomainMixin<ValueType>(exec, mesh, {exec, mesh, internalVector, boundaryVectors}),
86 boundaryConditions_(boundaryConditions)
87 {}
88
95 : DomainMixin<ValueType>(other), boundaryConditions_(other.boundaryConditions_)
96 {}
97
105 {
106 for (auto& boundaryCondition : boundaryConditions_)
107 {
108 boundaryCondition.correctBoundaryCondition(this->field_);
109 }
110 }
111
112
113private:
114
115 std::vector<SurfaceBoundary<ValueType>>
116 boundaryConditions_; // The vector of boundary conditions
117};
118
119
120} // namespace NeoN
Represents the boundary fields for a computational domain.
Represents the domain fields for a computational domain.
Definition field.hpp:34
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:53
This class represents a mixin for a geometric field.
Definition domain.hpp:27
const UnstructuredMesh & mesh() const
Returns a const reference to the unstructured mesh object.
Definition domain.hpp:121
const Executor & exec() const
Returns a const reference to the executor object.
Definition domain.hpp:114
const Vector< ValueType > & internalVector() const
Returns a const reference to the internal field.
Definition domain.hpp:79
Represents a surface boundary field for a cell-centered finite volume method.
Represents a surface field in a finite volume method.
SurfaceField(const Executor &exec, std::string fieldName, const UnstructuredMesh &mesh, const std::vector< SurfaceBoundary< ValueType > > &boundaryConditions)
Constructor for a surfaceVector with a given name and mesh.
SurfaceField(const SurfaceField &other)
Copy constructor for a surface field.
SurfaceField(const Executor &exec, const UnstructuredMesh &mesh, const Field< ValueType > &domainVector, const std::vector< SurfaceBoundary< ValueType > > &boundaryConditions)
void correctBoundaryConditions()
Corrects the boundary conditions of the surface field.
SurfaceField(const Executor &exec, const UnstructuredMesh &mesh, const Vector< ValueType > &internalVector, const BoundaryData< ValueType > &boundaryVectors, const std::vector< SurfaceBoundary< ValueType > > &boundaryConditions)
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:16