FreeFOAM The Cross-Platform CFD Toolkit
laplacianScheme.C
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) 1991-2010 OpenCFD Ltd.
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 \*---------------------------------------------------------------------------*/
25 
26 #include <finiteVolume/fv.H>
27 #include <OpenFOAM/HashTable.H>
28 #include <finiteVolume/linear.H>
29 #include <finiteVolume/fvMatrix.H>
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace fv
39 {
40 
41 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
42 
43 template<class Type, class GType>
44 tmp<laplacianScheme<Type, GType> > laplacianScheme<Type, GType>::New
45 (
46  const fvMesh& mesh,
47  Istream& schemeData
48 )
49 {
50  if (fv::debug)
51  {
52  Info<< "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&) : "
53  "constructing laplacianScheme<Type, GType>"
54  << endl;
55  }
56 
57  if (schemeData.eof())
58  {
60  (
61  "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
62  schemeData
63  ) << "Laplacian scheme not specified" << endl << endl
64  << "Valid laplacian schemes are :" << endl
65  << IstreamConstructorTablePtr_->sortedToc()
66  << exit(FatalIOError);
67  }
68 
69  word schemeName(schemeData);
70 
71  typename IstreamConstructorTable::iterator cstrIter =
72  IstreamConstructorTablePtr_->find(schemeName);
73 
74  if (cstrIter == IstreamConstructorTablePtr_->end())
75  {
77  (
78  "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
79  schemeData
80  ) << "unknown laplacian scheme " << schemeName << endl << endl
81  << "Valid laplacian schemes are :" << endl
82  << IstreamConstructorTablePtr_->sortedToc()
83  << exit(FatalIOError);
84  }
85 
86  return cstrIter()(mesh, schemeData);
87 }
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
92 template<class Type, class GType>
94 {}
95 
96 
97 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
98 
99 template<class Type, class GType>
102 (
105 )
106 {
107  return fvmLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
108 }
109 
110 
111 template<class Type, class GType>
114 (
117 )
118 {
119  return fvcLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
120 }
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace fv
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 } // End namespace Foam
130 
131 // ************************ vim: set sw=4 sts=4 et: ************************ //