FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

laplacianScheme.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include <finiteVolume/fv.H>
00027 #include <OpenFOAM/HashTable.H>
00028 #include <finiteVolume/linear.H>
00029 #include <finiteVolume/fvMatrix.H>
00030 
00031 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035 
00036 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00037 
00038 namespace fv
00039 {
00040 
00041 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
00042 
00043 template<class Type, class GType>
00044 tmp<laplacianScheme<Type, GType> > laplacianScheme<Type, GType>::New
00045 (
00046     const fvMesh& mesh,
00047     Istream& schemeData
00048 )
00049 {
00050     if (fv::debug)
00051     {
00052         Info<< "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&) : "
00053                "constructing laplacianScheme<Type, GType>"
00054             << endl;
00055     }
00056 
00057     if (schemeData.eof())
00058     {
00059         FatalIOErrorIn
00060         (
00061             "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
00062             schemeData
00063         )   << "Laplacian scheme not specified" << endl << endl
00064             << "Valid laplacian schemes are :" << endl
00065             << IstreamConstructorTablePtr_->sortedToc()
00066             << exit(FatalIOError);
00067     }
00068 
00069     word schemeName(schemeData);
00070 
00071     typename IstreamConstructorTable::iterator cstrIter =
00072         IstreamConstructorTablePtr_->find(schemeName);
00073 
00074     if (cstrIter == IstreamConstructorTablePtr_->end())
00075     {
00076         FatalIOErrorIn
00077         (
00078             "laplacianScheme<Type, GType>::New(const fvMesh&, Istream&)",
00079             schemeData
00080         )   << "unknown laplacian scheme " << schemeName << endl << endl
00081             << "Valid laplacian schemes are :" << endl
00082             << IstreamConstructorTablePtr_->sortedToc()
00083             << exit(FatalIOError);
00084     }
00085 
00086     return cstrIter()(mesh, schemeData);
00087 }
00088 
00089 
00090 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00091 
00092 template<class Type, class GType>
00093 laplacianScheme<Type, GType>::~laplacianScheme()
00094 {}
00095 
00096 
00097 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00098 
00099 template<class Type, class GType>
00100 tmp<fvMatrix<Type> >
00101 laplacianScheme<Type, GType>::fvmLaplacian
00102 (
00103     const GeometricField<GType, fvPatchField, volMesh>& gamma,
00104     GeometricField<Type, fvPatchField, volMesh>& vf
00105 )
00106 {
00107     return fvmLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
00108 }
00109 
00110 
00111 template<class Type, class GType>
00112 tmp<GeometricField<Type, fvPatchField, volMesh> >
00113 laplacianScheme<Type, GType>::fvcLaplacian
00114 (
00115     const GeometricField<GType, fvPatchField, volMesh>& gamma,
00116     const GeometricField<Type, fvPatchField, volMesh>& vf
00117 )
00118 {
00119     return fvcLaplacian(tinterpGammaScheme_().interpolate(gamma)(), vf);
00120 }
00121 
00122 
00123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00124 
00125 } // End namespace fv
00126 
00127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00128 
00129 } // End namespace Foam
00130 
00131 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines