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 
76 public:
77 
78  //- Define a typedef for the NVDweight
79  typedef NVDweight Weight;
80 
81 
82  //- Runtime type information
83  TypeName("faNVDscheme");
84 
85 
86  // Generated Methods
87 
88  //- No copy construct
89  faNVDscheme(const faNVDscheme&) = delete;
90 
91  //- No copy assignment
92  void operator=(const faNVDscheme&) = delete;
93 
94 
95  // Constructors
96 
97  //- Construct from mesh and edgeFlux and blendingFactor
99  (
100  const faMesh& mesh,
101  const edgeScalarField& edgeFlux,
102  const NVDweight& weight
103  )
104  :
106  NVDweight(weight),
107  edgeFlux_(edgeFlux)
108  {}
109 
110  //- Construct from mesh and Istream.
111  // The name of the flux field is read from the Istream and looked-up
112  // from the database
114  (
115  const faMesh& mesh,
116  Istream& is
117  )
118  :
120  NVDweight(is),
121  edgeFlux_
122  (
123  mesh.thisDb().lookupObject<edgeScalarField>
124  (
125  word(is)
126  )
127  )
128  {}
129 
130  //- Construct from mesh, edgeFlux and Istream
132  (
133  const faMesh& mesh,
134  const edgeScalarField& edgeFlux,
135  Istream& is
136  )
137  :
139  NVDweight(is),
140  edgeFlux_(edgeFlux)
141  {}
143 
144  // Member Functions
145 
146  //- Return the interpolation weighting factors
148  (
150  ) const;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 // Add the patch constructor functions to the hash tables
161 
162 #define makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, TYPE) \
163  \
164 typedef faNVDscheme<TYPE, WEIGHT> faNVDscheme##TYPE##WEIGHT_; \
165 defineTemplateTypeNameAndDebugWithName(faNVDscheme##TYPE##WEIGHT_, NAME, 0); \
166  \
167 edgeInterpolationScheme<TYPE>::addMeshConstructorToTable \
168 <faNVDscheme<TYPE, WEIGHT>> \
169  add##SS##TYPE##MeshConstructorToTable_; \
170  \
171 edgeInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
172 <faNVDscheme<TYPE, WEIGHT>> \
173  add##SS##TYPE##MeshFluxConstructorToTable_;
175 
176 #define makeNVDedgeInterpolationScheme(SS, WEIGHT, NAME) \
177  \
178 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, scalar) \
179 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, vector) \
180 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, tensor)
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #ifdef NoRepository
186  #include "faNVDscheme.C"
187 #endif
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
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:76
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.