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) 2011-2015 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 \*---------------------------------------------------------------------------*/
25 
26 #include "fv.H"
27 #include "HashTable.H"
28 #include "linear.H"
29 #include "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  schemeData
62  ) << "Laplacian scheme not specified" << endl << endl
63  << "Valid laplacian schemes are :" << endl
64  << IstreamConstructorTablePtr_->sortedToc()
65  << exit(FatalIOError);
66  }
67 
68  const word schemeName(schemeData);
69 
70  typename IstreamConstructorTable::iterator cstrIter =
71  IstreamConstructorTablePtr_->find(schemeName);
72 
73  if (cstrIter == IstreamConstructorTablePtr_->end())
74  {
76  (
77  schemeData
78  ) << "Unknown laplacian scheme " << schemeName << nl << nl
79  << "Valid laplacian schemes are :" << endl
80  << IstreamConstructorTablePtr_->sortedToc()
81  << exit(FatalIOError);
82  }
83 
84  return cstrIter()(mesh, schemeData);
85 }
86 
87 
88 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
89 
90 template<class Type, class GType>
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
97 template<class Type, class GType>
100 (
103 )
104 {
105  return fvmLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
106 }
107 
108 
109 template<class Type, class GType>
112 (
115 )
116 {
117  return fvcLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
118 }
119 
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 } // End namespace fv
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace Foam
128 
129 // ************************************************************************* //
Foam::fv::laplacianScheme::New
static tmp< laplacianScheme< Type, GType > > New(const fvMesh &mesh, Istream &schemeData)
Return a pointer to a new laplacianScheme created on freestore.
Definition: laplacianScheme.C:45
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
fv.H
HashTable.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::IOstream::eof
bool eof() const
Return true if end of input seen.
Definition: IOstream.H:339
Foam::FatalIOError
IOerror FatalIOError
fvMatrix.H
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::fv::laplacianScheme::~laplacianScheme
virtual ~laplacianScheme()
Destructor.
Definition: laplacianScheme.C:91
Foam::interpolate
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
Definition: curveTools.C:75
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::fv::laplacianScheme::fvmLaplacian
virtual tmp< fvMatrix< Type > > fvmLaplacian(const GeometricField< GType, fvsPatchField, surfaceMesh > &, const GeometricField< Type, fvPatchField, volMesh > &)=0
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
fv
labelList fv(nPoints)
Foam::fv::laplacianScheme::fvcLaplacian
virtual tmp< GeometricField< Type, fvPatchField, volMesh > > fvcLaplacian(const GeometricField< Type, fvPatchField, volMesh > &)=0
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:330
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52