Loading...
Searching...
No Matches
faGradScheme.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 Copyright (C) 2023 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
27Class
28 Foam::fa::gradScheme
29
30Description
31 Abstract base class for finite area calculus gradient schemes.
32
33SourceFiles
34 faGradScheme.C
35 faGradSchemes.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef faGradScheme_H
40#define faGradScheme_H
41
42#include "areaFieldsFwd.H"
43#include "edgeFieldsFwd.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50// Forward Declarations
51class faMesh;
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55namespace fa
56{
57
58/*---------------------------------------------------------------------------*\
59 Class gradScheme Declaration
60\*---------------------------------------------------------------------------*/
61
62template<class Type>
63class gradScheme
64:
65 public refCount
66{
67 // Private Data
68
69 //- Reference to mesh
70 const faMesh& mesh_;
71
72
73public:
75 // Declare run-time constructor selection tables
76
78 (
79 tmp,
81 Istream,
82 (const faMesh& mesh, Istream& schemeData),
83 (mesh, schemeData)
84 );
85
86
87 // Generated Methods
88
89 //- No copy construct
90 gradScheme(const gradScheme&) = delete;
91
92 //- No copy assignment
93 void operator=(const gradScheme&) = delete;
95
96 // Constructors
97
98 //- Construct from mesh
99 gradScheme(const faMesh& mesh)
100 :
101 mesh_(mesh)
102 {}
103
104
105 // Selectors
106
107 //- Return a pointer to a new gradScheme created on freestore
109 (
110 const faMesh& mesh,
111 Istream& schemeData
112 );
113
114
115 //- Destructor
116 virtual ~gradScheme() = default;
117
118
119 // Member Functions
120
121 //- Return mesh reference
122 const faMesh& mesh() const noexcept { return mesh_; }
124 //- Calculate and return the grad of the given field.
125 // Used by grad either to recalculate the cached gradient when it is
126 // out of date with respect to the field or when it is not cached.
127 virtual tmp
128 <
132 (
134 const word& name
135 ) const = 0;
136
137 //- Calculate and return the grad of the given field
138 //- which may have been cached
139 tmp
140 <
144 (
146 const word& name
147 ) const;
148
149 //- Calculate and return the grad of the given field
150 //- with the default name
151 //- which may have been cached
152 tmp
153 <
156 > grad
157 (
159 ) const;
160
161 //- Calculate and return the grad of the given field
162 //- with the default name
163 //- which may have been cached
164 tmp
165 <
168 > grad
169 (
171 ) const;
172};
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace fa
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181} // End namespace Foam
182
183// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184
185// Add the patch constructor functions to the hash tables
186
187#define makeFaGradTypeScheme(SS, Type) \
188 \
189 defineNamedTemplateTypeNameAndDebug(Foam::fa::SS<Foam::Type>, 0); \
190 \
191 namespace Foam \
192 { \
193 namespace fa \
194 { \
195 gradScheme<Type>::addIstreamConstructorToTable<SS<Type>> \
196 add##SS##Type##IstreamConstructorToTable_; \
197 } \
198 }
199
200
201#define makeFaGradScheme(SS) \
202 \
203makeFaGradTypeScheme(SS, scalar) \
204makeFaGradTypeScheme(SS, vector)
206
207// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208
209#ifdef NoRepository
210 #include "faGradScheme.C"
211#endif
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215#endif
216
217// ************************************************************************* //
Forwards and collection of common area field types.
Generic GeometricField class.
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
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...
const faMesh & mesh() const noexcept
Return mesh reference.
void operator=(const gradScheme &)=delete
No copy assignment.
static tmp< gradScheme< Type > > New(const faMesh &mesh, Istream &schemeData)
Return a pointer to a new gradScheme created on freestore.
tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > grad(const GeometricField< Type, faPatchField, areaMesh > &, const word &name) const
Calculate and return the grad of the given field which may have been cached.
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > calcGrad(const GeometricField< Type, faPatchField, areaMesh > &, const word &name) const =0
Calculate and return the grad of the given field.
gradScheme(const gradScheme &)=delete
No copy construct.
declareRunTimeSelectionTable(tmp, gradScheme, Istream,(const faMesh &mesh, Istream &schemeData),(mesh, schemeData))
gradScheme(const faMesh &mesh)
Construct from mesh.
virtual ~gradScheme()=default
Destructor.
typeOfRank< typenamepTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank)>::type type
Definition products.H:118
constexpr refCount() noexcept
Default construct, initializing count to 0.
Definition refCount.H:63
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
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
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes).