NeoFOAM
WIP Prototype of a modern OpenFOAM core
Loading...
Searching...
No Matches
include
NeoFOAM
finiteVolume
cellCentred
boundary
surfaceBoundaryFactory.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// SPDX-FileCopyrightText: 2023 NeoFOAM authors
3
4
#pragma once
5
6
#include "
NeoFOAM/core/dictionary.hpp
"
7
#include "
NeoFOAM/core/runtimeSelectionFactory.hpp
"
8
#include "
NeoFOAM/fields/domainField.hpp
"
9
#include "
NeoFOAM/finiteVolume/cellCentred/boundary/boundaryPatchMixin.hpp
"
10
#include "
NeoFOAM/mesh/unstructured.hpp
"
11
12
namespace
NeoFOAM::finiteVolume::cellCentred
13
{
14
15
template
<
typename
ValueType>
16
class
SurfaceBoundaryFactory
:
17
public
NeoFOAM::RuntimeSelectionFactory
<
18
SurfaceBoundaryFactory<ValueType>,
19
Parameters<const UnstructuredMesh&, const Dictionary&, size_t>>,
20
public
BoundaryPatchMixin
21
{
22
public
:
23
24
static
std::string
name
() {
return
"SurfaceBoundaryFactory"
; }
25
26
SurfaceBoundaryFactory
(
27
const
UnstructuredMesh
& mesh, [[maybe_unused]]
const
Dictionary
&,
size_t
patchID
28
)
29
:
BoundaryPatchMixin
(mesh,
patchID
) {};
30
31
virtual
void
correctBoundaryCondition
(
DomainField<ValueType>
& domainField) = 0;
32
33
virtual
std::unique_ptr<SurfaceBoundaryFactory>
clone
()
const
= 0;
34
};
35
36
42
template
<
typename
ValueType>
43
class
SurfaceBoundary
:
public
BoundaryPatchMixin
44
{
45
public
:
46
47
SurfaceBoundary
(
const
UnstructuredMesh
& mesh,
const
Dictionary
& dict,
size_t
patchID
)
48
:
BoundaryPatchMixin
(
49
static_cast<
label
>(mesh.boundaryMesh().offset()[
patchID
]),
50
static_cast<
label
>(mesh.boundaryMesh().offset()[
patchID
+ 1]),
51
patchID
52
),
53
boundaryCorrectionStrategy_(
SurfaceBoundaryFactory
<ValueType>::create(
54
dict.get<std::string>(
"type"
), mesh, dict,
patchID
55
))
56
{}
57
58
SurfaceBoundary
(
const
SurfaceBoundary
& other)
59
:
BoundaryPatchMixin
(other),
60
boundaryCorrectionStrategy_(other.boundaryCorrectionStrategy_->clone())
61
{}
62
63
virtual
void
correctBoundaryCondition
(
DomainField<ValueType>
& domainField)
64
{
65
boundaryCorrectionStrategy_->correctBoundaryCondition(domainField);
66
}
67
68
69
private
:
70
71
// NOTE needs full namespace to be not ambiguous
72
std::unique_ptr<NeoFOAM::finiteVolume::cellCentred::SurfaceBoundaryFactory<ValueType>>
73
boundaryCorrectionStrategy_;
74
};
75
76
77
}
boundaryPatchMixin.hpp
NeoFOAM::Dictionary
A class representing a dictionary that stores key-value pairs.
Definition
dictionary.hpp:33
NeoFOAM::DomainField
Represents the domain fields for a computational domain.
Definition
domainField.hpp:32
NeoFOAM::RuntimeSelectionFactory
A factory class for runtime selection of derived classes.
Definition
runtimeSelectionFactory.hpp:177
NeoFOAM::UnstructuredMesh
Represents an unstructured mesh in NeoFOAM.
Definition
unstructuredMesh.hpp:27
NeoFOAM::finiteVolume::cellCentred::BoundaryPatchMixin
A base class for implementing derived boundary conditions.
Definition
boundaryPatchMixin.hpp:26
NeoFOAM::finiteVolume::cellCentred::BoundaryPatchMixin::patchID
size_t patchID() const
Definition
boundaryPatchMixin.hpp:49
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundaryFactory
Definition
surfaceBoundaryFactory.hpp:21
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundaryFactory::name
static std::string name()
Definition
surfaceBoundaryFactory.hpp:24
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundaryFactory::clone
virtual std::unique_ptr< SurfaceBoundaryFactory > clone() const =0
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundaryFactory::SurfaceBoundaryFactory
SurfaceBoundaryFactory(const UnstructuredMesh &mesh, const Dictionary &, size_t patchID)
Definition
surfaceBoundaryFactory.hpp:26
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundaryFactory::correctBoundaryCondition
virtual void correctBoundaryCondition(DomainField< ValueType > &domainField)=0
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundary
Represents a surface boundary field for a cell-centered finite volume method.
Definition
surfaceBoundaryFactory.hpp:44
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundary::correctBoundaryCondition
virtual void correctBoundaryCondition(DomainField< ValueType > &domainField)
Definition
surfaceBoundaryFactory.hpp:63
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundary::SurfaceBoundary
SurfaceBoundary(const SurfaceBoundary &other)
Definition
surfaceBoundaryFactory.hpp:58
NeoFOAM::finiteVolume::cellCentred::SurfaceBoundary::SurfaceBoundary
SurfaceBoundary(const UnstructuredMesh &mesh, const Dictionary &dict, size_t patchID)
Definition
surfaceBoundaryFactory.hpp:47
dictionary.hpp
domainField.hpp
NeoFOAM::finiteVolume::cellCentred
Definition
fieldCollection.hpp:16
NeoFOAM::label
int32_t label
Definition
label.hpp:13
runtimeSelectionFactory.hpp
unstructured.hpp
Generated by
1.9.8