NeoN
A framework for CFD software
Loading...
Searching...
No Matches
surfaceBoundaryFactory.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2023 - 2026 NeoN authors
2//
3// SPDX-License-Identifier: MIT
4
5#pragma once
6
10#include "NeoN/fields/field.hpp"
13
15{
16
17template<typename ValueType>
20 SurfaceBoundaryFactory<ValueType>,
21 Parameters<const UnstructuredMesh&, const Dictionary&, localIdx>>,
23{
24public:
25
26 static std::string name() { return "SurfaceBoundaryFactory"; }
27
29 const UnstructuredMesh& mesh, [[maybe_unused]] const Dictionary&, localIdx patchID
30 )
31 : BoundaryPatchMixin(mesh, patchID) {};
32
34
41 virtual void set([[maybe_unused]] Field<ValueType>& domainVector) {}
42
48 virtual void update(Field<ValueType>& domainVector) { correctBoundaryCondition(domainVector); }
49
50 virtual std::unique_ptr<SurfaceBoundaryFactory> clone() const = 0;
51};
52
53
59template<typename ValueType>
61{
62public:
63
66 mesh.boundaryMesh().offset()[static_cast<size_t>(patchID)],
67 mesh.boundaryMesh().offset()[static_cast<size_t>(patchID) + 1],
69 ),
70 boundaryCorrectionStrategy_(SurfaceBoundaryFactory<ValueType>::create(
71 dict.get<std::string>("type"), mesh, dict, patchID
72 ))
73 {}
74
76 : BoundaryPatchMixin(other),
77 boundaryCorrectionStrategy_(other.boundaryCorrectionStrategy_->clone())
78 {}
79
80 virtual void correctBoundaryCondition(Field<ValueType>& domainVector)
81 {
82 boundaryCorrectionStrategy_->correctBoundaryCondition(domainVector);
83 }
84
85 virtual void set(Field<ValueType>& domainVector)
86 {
87 boundaryCorrectionStrategy_->set(domainVector);
88 }
89
90 virtual void update(Field<ValueType>& domainVector)
91 {
92 boundaryCorrectionStrategy_->update(domainVector);
93 }
94
95
96private:
97
98 // NOTE needs full namespace to be not ambiguous
99 std::unique_ptr<NeoN::finiteVolume::cellCentred::SurfaceBoundaryFactory<ValueType>>
100 boundaryCorrectionStrategy_;
101};
102
103
104}
A class representing a dictionary that stores key-value pairs.
Represents the domain fields for a computational domain.
Definition field.hpp:34
A factory class for runtime selection of derived classes.
Represents an unstructured mesh in NeoN.
A base class for implementing derived boundary conditions.
virtual void update(Field< ValueType > &domainVector)
Per-iteration boundary update, applied on every correctBoundaryConditions() call.
virtual std::unique_ptr< SurfaceBoundaryFactory > clone() const =0
virtual void set(Field< ValueType > &domainVector)
One-time patch initialisation, applied once per field before the first update().
virtual void correctBoundaryCondition(Field< ValueType > &field)=0
SurfaceBoundaryFactory(const UnstructuredMesh &mesh, const Dictionary &, localIdx patchID)
Represents a surface boundary field for a cell-centered finite volume method.
virtual void update(Field< ValueType > &domainVector)
virtual void set(Field< ValueType > &domainVector)
virtual void correctBoundaryCondition(Field< ValueType > &domainVector)
SurfaceBoundary(const UnstructuredMesh &mesh, const Dictionary &dict, localIdx patchID)
int32_t localIdx
Definition label.hpp:50
std::size_t size_t
Definition label.hpp:56