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 faNVDscheme_H
50 #define 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 
70 protected:
71 
72  // Protected data
73 
75 
76 
77 private:
78 
79  // Private Member Functions
80 
81  //- No copy construct
82  faNVDscheme(const faNVDscheme&) = delete;
83 
84  //- No copy assignment
85  void operator=(const faNVDscheme&) = delete;
86 
87 
88 public:
89 
90  //- Define a typedef for the NVDweight
91  typedef NVDweight Weight;
92 
93 
94  //- Runtime type information
95  TypeName("faNVDscheme");
96 
97 
98  // Constructors
99 
100  //- Construct from mesh and edgeFlux and blendingFactor
102  (
103  const faMesh& mesh,
104  const edgeScalarField& edgeFlux,
105  const NVDweight& weight
106  )
107  :
109  NVDweight(weight),
110  edgeFlux_(edgeFlux)
111  {}
112 
113  //- Construct from mesh and Istream.
114  // The name of the flux field is read from the Istream and looked-up
115  // from the database
117  (
118  const faMesh& mesh,
119  Istream& is
120  )
121  :
123  NVDweight(is),
124  edgeFlux_
125  (
126  mesh().objectRegistry::lookupObject<edgeScalarField>
127  (
128  word(is)
129  )
130  )
131  {}
132 
133  //- Construct from mesh, edgeFlux and Istream
135  (
136  const faMesh& mesh,
137  const edgeScalarField& edgeFlux,
138  Istream& is
139  )
140  :
142  NVDweight(is),
143  edgeFlux_(edgeFlux)
144  {}
145 
146 
147  // Member Functions
148 
149  //- Return the interpolation weighting factors
151  (
153  ) const;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 // Add the patch constructor functions to the hash tables
164 
165 #define makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, TYPE) \
166  \
167 typedef faNVDscheme<TYPE, WEIGHT> faNVDscheme##TYPE##WEIGHT_; \
168 defineTemplateTypeNameAndDebugWithName(faNVDscheme##TYPE##WEIGHT_, NAME, 0); \
169  \
170 edgeInterpolationScheme<TYPE>::addMeshConstructorToTable \
171 <faNVDscheme<TYPE, WEIGHT>> \
172  add##SS##TYPE##MeshConstructorToTable_; \
173  \
174 edgeInterpolationScheme<TYPE>::addMeshFluxConstructorToTable \
175 <faNVDscheme<TYPE, WEIGHT>> \
176  add##SS##TYPE##MeshFluxConstructorToTable_;
177 
178 
179 #define makeNVDedgeInterpolationScheme(SS, WEIGHT, NAME) \
180  \
181 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, scalar) \
182 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, vector) \
183 makeNVDedgeInterpolationTypeScheme(SS, WEIGHT, NAME, tensor)
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 #ifdef NoRepository
189  #include "faNVDscheme.C"
190 #endif
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 #endif
195 
196 // ************************************************************************* //
Foam::faNVDscheme::TypeName
TypeName("faNVDscheme")
Runtime type information.
edgeInterpolationScheme.H
Foam::edgeInterpolationScheme
Abstract base class for edge interpolation schemes.
Definition: edgeInterpolationScheme.H:57
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::faNVDscheme::Weight
NVDweight Weight
Define a typedef for the NVDweight.
Definition: faNVDscheme.H:90
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::edgeInterpolationScheme::mesh
const faMesh & mesh() const
Return mesh reference.
Definition: edgeInterpolationScheme.H:138
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::faNVDscheme::weights
virtual tmp< edgeScalarField > weights(const GeometricField< Type, faPatchField, areaMesh > &) const
Return the interpolation weighting factors.
Definition: faNVDscheme.C:58
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::faNVDscheme
Class to create the weighting-factors based on the NVD (Normalised Variable Diagram).
Definition: faNVDscheme.H:63
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::faNVDscheme::edgeFlux_
const edgeScalarField & edgeFlux_
Definition: faNVDscheme.H:73
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
faNVDscheme.C
Foam::GeometricField< scalar, faePatchField, edgeMesh >