PhiScheme.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 | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::PhiScheme
26 
27 Description
28  Class to create the weighting-factors based on the face-flux.
29 
30  The particular differencing scheme class is supplied as a template
31  argument, the weight function of which is called by the weight function
32  of this class for the internal faces as well as faces of coupled
33  patches (e.g. processor-processor patches). The weight function is
34  supplied with the central-differencing weighting factor, the face-flux,
35  the face neighbour cell values and the face area.
36 
37  This code organisation is both neat and efficient, allowing for
38  convenient implementation of new schemes to run on parallelised cases.
39 
40 SourceFiles
41  PhiScheme.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef PhiScheme_H
46 #define PhiScheme_H
47 
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class PhiScheme Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class Type, class PhiLimiter>
60 class PhiScheme
61 :
63  public PhiLimiter
64 {
65  // Private Member Functions
66 
67  //- Disallow default bitwise copy construct
68  PhiScheme(const PhiScheme&);
69 
70  //- Disallow default bitwise assignment
71  void operator=(const PhiScheme&);
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("PhiScheme");
78 
79 
80  // Constructors
81 
82  //- Construct from mesh, faceFlux and blendingFactor
84  (
85  const fvMesh& mesh,
86  const surfaceScalarField& faceFlux,
87  const PhiLimiter& weight
88  )
89  :
90  limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
91  PhiLimiter(weight)
92  {}
93 
94  //- Construct from mesh and Istream.
95  // The name of the flux field is read from the Istream and looked-up
96  // from the mesh objectRegistry
98  (
99  const fvMesh& mesh,
100  Istream& is
101  )
102  :
103  limitedSurfaceInterpolationScheme<Type>(mesh, is),
104  PhiLimiter(is)
105  {}
106 
107  //- Construct from mesh, faceFlux and Istream
109  (
110  const fvMesh& mesh,
111  const surfaceScalarField& faceFlux,
112  Istream& is
113  )
114  :
115  limitedSurfaceInterpolationScheme<Type>(mesh, faceFlux),
116  PhiLimiter(is)
117  {}
118 
119 
120  // Member Functions
121 
122  //- Return the interpolation weighting factors
124  (
126  ) const;
127 };
128 
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 } // End namespace Foam
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 // Add the patch constructor functions to the hash tables
138 #define makePhiSurfaceInterpolationScheme(SS, WEIGHT, TYPE) \
139  \
140 typedef PhiScheme<TYPE, WEIGHT> Phischeme##WEIGHT_; \
141 defineTemplateTypeNameAndDebugWithName(Phischeme##WEIGHT_, #SS, 0); \
142  \
143 surfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
144 <PhiScheme<TYPE, WEIGHT>> add##SS##TYPE##MeshConstructorToTable_; \
145  \
146 surfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
147 <PhiScheme<TYPE, WEIGHT>> add##SS##TYPE##MeshFluxConstructorToTable_; \
148  \
149 limitedSurfaceInterpolationScheme<TYPE>::addMeshConstructorToTable \
150 <PhiScheme<TYPE, WEIGHT>> add##SS##TYPE##MeshConstructorToLimitedTable_; \
151  \
152 limitedSurfaceInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
153 <PhiScheme<TYPE, WEIGHT>> add##SS##TYPE##MeshFluxConstructorToLimitedTable_;
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #ifdef NoRepository
158  #include "PhiScheme.C"
159 #endif
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
TypeName("PhiScheme")
Runtime type information.
Class to create the weighting-factors based on the face-flux.
Definition: PhiScheme.H:59
virtual tmp< surfaceScalarField > limiter(const GeometricField< Type, fvPatchField, volMesh > &) const
Return the interpolation weighting factors.
Definition: PhiScheme.C:37
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Class with limiter function which returns the limiter for the Phi differencing scheme.
Definition: Phi.H:51
Abstract base class for limited surface interpolation schemes.
A class for managing temporary objects.
Definition: PtrList.H:54
Namespace for OpenFOAM.