convectionScheme.C
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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2019-2021 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Description
28 Abstract base class for finite volume calculus convection schemes.
29
30\*---------------------------------------------------------------------------*/
31
32#include "fv.H"
33#include "HashTable.H"
34#include "linear.H"
35
36// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37
38namespace Foam
39{
40
41// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42
43namespace fv
44{
45
46
47// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48
49template<class Type>
51:
52 refCount(),
53 mesh_(cs.mesh_)
54{}
55
56
57// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
58
59template<class Type>
61(
62 const fvMesh& mesh,
63 const surfaceScalarField& faceFlux,
64 Istream& schemeData
65)
66{
67 if (fv::debug)
68 {
69 InfoInFunction << "Constructing convectionScheme<Type>" << endl;
70 }
71
72 if (schemeData.eof())
73 {
74 FatalIOErrorInFunction(schemeData)
75 << "Convection scheme not specified" << endl << endl
76 << "Valid convection schemes are :" << endl
77 << IstreamConstructorTablePtr_->sortedToc()
79 }
80
81 const word schemeName(schemeData);
82
83 if (fv::debug)
84 {
85 InfoInFunction << "schemeName:" << schemeName << endl;
86 }
87
88 auto* ctorPtr = IstreamConstructorTable(schemeName);
89
90 if (!ctorPtr)
91 {
93 (
94 schemeData,
95 "convection",
96 schemeName,
97 *IstreamConstructorTablePtr_
98 ) << exit(FatalIOError);
99 }
100
101 return ctorPtr(mesh, faceFlux, schemeData);
102}
103
104
105template<class Type>
107(
108 const fvMesh& mesh,
110 fieldTable& fields,
111 const surfaceScalarField& faceFlux,
112 Istream& schemeData
113)
114{
115 if (fv::debug)
116 {
117 InfoInFunction << "Constructing convectionScheme<Type>" << endl;
119
120 if (schemeData.eof())
121 {
122 FatalIOErrorInFunction(schemeData)
123 << "Convection scheme not specified" << endl << endl
124 << "Valid convection schemes are :" << endl
125 << MultivariateConstructorTablePtr_->sortedToc()
126 << exit(FatalIOError);
127 }
128
129 const word schemeName(schemeData);
130
131 auto* ctorPtr = MultivariateConstructorTable(schemeName);
132
133 if (!ctorPtr)
136 (
137 schemeData,
138 "convection",
139 schemeName,
140 *MultivariateConstructorTablePtr_
141 ) << exit(FatalIOError);
142 }
143
144 return ctorPtr(mesh, fields, faceFlux, schemeData);
145}
146
147
148// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
149
150template<class Type>
152{}
153
154
155// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
156
157template<class Type>
159{
160 if (this == &cs)
161 {
162 return; // Self-assignment is a no-op
163 }
164}
165
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169} // End namespace fv
170
171// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172
173} // End namespace Foam
174
175// ************************************************************************* //
bool eof() const noexcept
True if end of input seen.
Definition: IOstream.H:239
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
Abstract base class for finite area calculus convection schemes.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
Abstract base class for convection schemes.
void operator=(const convectionScheme< Type > &)
virtual ~convectionScheme()
Destructor.
Abstract base class for multi-variate surface interpolation schemes.
Reference counter for various OpenFOAM components.
Definition: refCount.H:51
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
#define InfoInFunction
Report an information message using Foam::Info.
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
IOerror FatalIOError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
labelList fv(nPoints)
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Definition: createFields.H:97