NeoFOAM
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 NeoFOAM authors
3
4#pragma once
5
6#include <vector>
7
10
12{
13
24template<typename ValueType>
25class SurfaceField : public GeometricFieldMixin<ValueType>
26{
27
28public:
29
39 const Executor& exec,
40 std::string fieldName,
42 const std::vector<SurfaceBoundary<ValueType>>& boundaryConditions
43 )
44 : GeometricFieldMixin<ValueType>(
45 exec,
46 fieldName,
47 mesh,
48 DomainField<ValueType>(
49 exec,
50 mesh.nInternalFaces() + mesh.nBoundaryFaces(),
51 mesh.nBoundaryFaces(),
52 mesh.nBoundaries()
53 )
54 ),
55 boundaryConditions_(boundaryConditions)
56 {}
57
58 /* @brief Constructor for a surfaceField with a given internal field
59 *
60 * @param exec The executor
61 * @param mesh The underlying mesh
62 * @param internalField the underlying internal field
63 * @param boundaryConditions a vector of boundary conditions
64 */
66 const Executor& exec,
68 const DomainField<ValueType>& domainField,
69 const std::vector<SurfaceBoundary<ValueType>>& boundaryConditions
70 )
71 : GeometricFieldMixin<ValueType>(exec, mesh, domainField),
72 boundaryConditions_(boundaryConditions)
73 {}
74
75 /* @brief Constructor for a surfaceField with a given internal field
76 *
77 * @param exec The executor
78 * @param mesh The underlying mesh
79 * @param internalField the underlying internal field
80 * @param boundaryConditions a vector of boundary conditions
81 */
83 const Executor& exec,
86 const BoundaryFields<ValueType>& boundaryFields,
87 const std::vector<SurfaceBoundary<ValueType>>& boundaryConditions
88 )
89 : GeometricFieldMixin<ValueType>(exec, mesh, {exec, mesh, internalField, boundaryFields}),
90 boundaryConditions_(boundaryConditions)
91 {}
92
99 : GeometricFieldMixin<ValueType>(other), boundaryConditions_(other.boundaryConditions_)
100 {}
101
109 {
110 for (auto& boundaryCondition : boundaryConditions_)
111 {
112 boundaryCondition.correctBoundaryCondition(this->field_);
113 }
114 }
115
116
117private:
118
119 std::vector<SurfaceBoundary<ValueType>>
120 boundaryConditions_; // The vector of boundary conditions
121};
122
123
124} // namespace NeoFOAM
Represents the boundary fields for a computational domain.
Represents the domain fields for a computational domain.
A class to contain the data and executors for a field and define some basic operations.
Definition field.hpp:49
Represents an unstructured mesh in NeoFOAM.
This class represents a mixin for a geometric field.
const UnstructuredMesh & mesh() const
Returns a const reference to the unstructured mesh object.
const Executor & exec() const
Returns a const reference to the executor object.
const Field< ValueType > & internalField() const
Returns a const reference to the internal field.
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, const UnstructuredMesh &mesh, const Field< ValueType > &internalField, const BoundaryFields< ValueType > &boundaryFields, const std::vector< SurfaceBoundary< ValueType > > &boundaryConditions)
void correctBoundaryConditions()
Corrects the boundary conditions of the surface field.
SurfaceField(const Executor &exec, std::string fieldName, const UnstructuredMesh &mesh, const std::vector< SurfaceBoundary< ValueType > > &boundaryConditions)
Constructor for a surfaceField with a given name and mesh.
SurfaceField(const SurfaceField &other)
Copy constructor for a surface field.
SurfaceField(const Executor &exec, const UnstructuredMesh &mesh, const DomainField< ValueType > &domainField, const std::vector< SurfaceBoundary< ValueType > > &boundaryConditions)
std::variant< SerialExecutor, CPUExecutor, GPUExecutor > Executor
Definition executor.hpp:16