Loading...
Searching...
No Matches
faDivScheme.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2017 Wikki Ltd
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::fa::divScheme
28
29Description
30 Abstract base class for finite area calculus div schemes.
31
32SourceFiles
33 faDivScheme.C
34 faDivSchemes.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_faDivScheme_H
39#define Foam_faDivScheme_H
40
41#include "areaFieldsFwd.H"
42#include "edgeFieldsFwd.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52template<class Type> class faMatrix;
53class faMesh;
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57namespace fa
58{
59
60/*---------------------------------------------------------------------------*\
61 Class divScheme Declaration
62\*---------------------------------------------------------------------------*/
63
64template<class Type>
65class divScheme
66:
67 public refCount
68{
69protected:
70
71 // Protected Data
72
73 //- Reference to mesh
74 const faMesh& mesh_;
75
76 //- Edge interpolation scheme
78
79
80public:
81
82 // Declare run-time constructor selection tables
85 (
86 tmp,
88 Istream,
89 (const faMesh& mesh, Istream& schemeData),
90 (mesh, schemeData)
91 );
92
93
94 // Generated Methods
95
96 //- No copy construct
97 divScheme(const divScheme&) = delete;
99 //- No copy assignment
100 void operator=(const divScheme&) = delete;
101
102
103 // Constructors
104
105 //- Construct from mesh
106 divScheme(const faMesh& mesh)
107 :
108 mesh_(mesh),
110 {}
112 //- Construct from mesh and Istream
113 divScheme(const faMesh& mesh, Istream& is)
114 :
115 mesh_(mesh)
116 {
117 if (is.eof())
118 {
119 tinterpScheme_.reset
121 new linearEdgeInterpolation<Type>(mesh)
122 );
123 }
124 else
125 {
126 tinterpScheme_.reset
127 (
128 edgeInterpolationScheme<Type>::New(mesh, is)
129 );
130 }
131 }
132
133
134 // Selectors
135
136 //- Return a pointer to a new divScheme created on freestore
138 (
139 const faMesh& mesh,
140 Istream& schemeData
141 );
142
143
144 //- Destructor
145 virtual ~divScheme() = default;
146
147
148 // Member Functions
149
150 //- Return mesh reference
151 const faMesh& mesh() const noexcept { return mesh_; }
152
153 virtual tmp
154 <
157 > facDiv
158 (
160 ) = 0;
161};
162
163
164// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165
166} // End namespace fa
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170} // End namespace Foam
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174// Add the patch constructor functions to the hash tables
175
176#define makeFaDivTypeScheme(SS, Type) \
177 \
178 defineNamedTemplateTypeNameAndDebug(Foam::fa::SS<Foam::Type>, 0); \
179 \
180 namespace Foam \
181 { \
182 namespace fa \
183 { \
184 divScheme<Type>::addIstreamConstructorToTable<SS<Type>> \
185 add##SS##Type##IstreamConstructorToTable_; \
186 } \
187 }
188
189#define makeFaDivScheme(SS) \
190 \
191makeFaDivTypeScheme(SS, vector) \
192makeFaDivTypeScheme(SS, tensor)
193
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197#ifdef NoRepository
198 #include "faDivScheme.C"
199#endif
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203#endif
204
205// ************************************************************************* //
Forwards and collection of common area field types.
Generic GeometricField class.
bool eof() const noexcept
True if end of input seen.
Definition IOstream.H:289
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
Mesh data needed to do the Finite Area discretisation.
Definition areaFaMesh.H:50
A special matrix type and solver, designed for finite area solutions of scalar equations....
Definition faMatrix.H:108
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
divScheme(const faMesh &mesh)
Construct from mesh.
divScheme(const faMesh &mesh, Istream &is)
Construct from mesh and Istream.
const faMesh & mesh() const noexcept
Return mesh reference.
divScheme(const divScheme &)=delete
No copy construct.
tmp< edgeInterpolationScheme< Type > > tinterpScheme_
Edge interpolation scheme.
Definition faDivScheme.H:76
void operator=(const divScheme &)=delete
No copy assignment.
const faMesh & mesh_
Reference to mesh.
Definition faDivScheme.H:71
virtual ~divScheme()=default
Destructor.
virtual tmp< GeometricField< typename innerProduct< vector, Type >::type, faPatchField, areaMesh > > facDiv(const GeometricField< Type, faPatchField, areaMesh > &)=0
static tmp< divScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new divScheme created on freestore.
Definition faDivScheme.C:35
declareRunTimeSelectionTable(tmp, divScheme, Istream,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) -2 >::type type
Definition products.H:155
Central-differencing interpolation scheme class.
constexpr refCount() noexcept
Default construct, initializing count to 0.
Definition refCount.H:63
A class for managing temporary objects.
Definition tmp.H:75
dynamicFvMesh & mesh
Forwards for edge field types.
Namespace for finite-area.
Definition limitHeight.C:30
Namespace for OpenFOAM.
const direction noexcept
Definition scalarImpl.H:265
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).