faNVDscheme.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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::faNVDscheme
28 
29 Description
30  Class to create the weighting-factors based on the NVD
31  (Normalised Variable Diagram).
32 
33  The particular differencing scheme class is supplied as a template argument,
34  the weight function of which is called by the weight function of this class
35  for the internal edges as well as edges of coupled patches
36  (e.g. processor-processor patches). The weight function is supplied the
37  central-differencing weighting factor, the edge-flux, the cell and edge
38  gradients (from which the normalised variable distribution may be created)
39  and the cell centre distance.
40 
41  This code organisation is both neat and efficient, allowing for convenient
42  implementation of new schemes to run on parallelised cases.
43 
44 SourceFiles
45  faNVDscheme.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef Foam_faNVDscheme_H
50 #define Foam_faNVDscheme_H
51 
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class faNVDscheme Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class Type, class NVDweight>
64 class faNVDscheme
65 :
66  public edgeInterpolationScheme<Type>,
67  public NVDweight
68 {
69 protected:
70 
71  // Protected Data
72 
74 
75  // Protected Member Functions
76 
77  //- No copy construct
78  faNVDscheme(const faNVDscheme&) = delete;
79 
80  //- No copy assignment
81  void operator=(const faNVDscheme&) = delete;
82 
83 
84 public:
85 
86  //- Define a typedef for the NVDweight
87  typedef NVDweight Weight;
88 
89 
90  //- Runtime type information
91  TypeName("faNVDscheme");
92 
93 
94  // Constructors
95 
96  //- Construct from mesh and edgeFlux and blendingFactor
98  (
99  const faMesh& mesh,
100  const edgeScalarField& edgeFlux,
101  const NVDweight& weight
102  )
103  :
105  NVDweight(weight),
106  edgeFlux_(edgeFlux)
107  {}
108 
109  //- Construct from mesh and Istream.
110  // The name of the flux field is read from the Istream and looked-up
111  // from the database
113  (
114  const faMesh& mesh,
115  Istream& is
116  )
117  :
119  NVDweight(is),
120  edgeFlux_
121  (
122  mesh.thisDb().lookupObject<edgeScalarField>
123  (
124  word(is)
125  )
126  )
127  {}
128 
129  //- Construct from mesh, edgeFlux and Istream
131  (
132  const faMesh& mesh,
133  const edgeScalarField& edgeFlux,
134  Istream& is
135  )
136  :
138  NVDweight(is),
139  edgeFlux_(edgeFlux)
140  {}
142 
143  // Member Functions
144 
145  //- Return the interpolation weighting factors
147  (
149  ) const;
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 // Add the patch constructor functions to the hash tables
160 
161 #define makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, TYPE) \
162  \
163 typedef faNVDscheme<TYPE, WEIGHT> faNVDscheme##TYPE##WEIGHT_; \
164 defineTemplateTypeNameAndDebugWithName(faNVDscheme##TYPE##WEIGHT_, NAME, 0); \
165  \
166 edgeInterpolationScheme<TYPE>::addMeshConstructorToTable \
167 <faNVDscheme<TYPE, WEIGHT>> \
168  add##SS##TYPE##MeshConstructorToTable_; \
169  \
170 edgeInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
171 <faNVDscheme<TYPE, WEIGHT>> \
172  add##SS##TYPE##MeshFluxConstructorToTable_;
174 
175 #define makeNVDedgeInterpolationScheme(SS, WEIGHT, NAME) \
176  \
177 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, scalar) \
178 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, vector) \
179 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, tensor)
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #ifdef NoRepository
185  #include "faNVDscheme.C"
186 #endif
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:87
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Abstract base class for edge interpolation schemes.
NVDweight Weight
Define a typedef for the NVDweight.
Definition: faNVDscheme.H:88
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("faNVDscheme")
Runtime type information.
Class to create the weighting-factors based on the NVD (Normalised Variable Diagram).
Definition: faNVDscheme.H:59
const edgeScalarField & edgeFlux_
Definition: faNVDscheme.H:68
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the interpolation weighting factors.
Definition: faNVDscheme.C:52
faNVDscheme(const faNVDscheme &)=delete
No copy construct.
void operator=(const faNVDscheme &)=delete
No copy assignment.
const faMesh & mesh() const
Return mesh reference.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.