OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

convectionScheme.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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026     Abstract base class for finite volume calculus convection schemes.
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #include "fv.H"
00031 #include "HashTable.H"
00032 #include "linear.H"
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 namespace Foam
00037 {
00038 
00039 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00040 
00041 namespace fv
00042 {
00043 
00044 
00045 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00046 
00047 template<class Type>
00048 convectionScheme<Type>::convectionScheme(const convectionScheme& cs)
00049 :
00050     refCount(),
00051     mesh_(cs.mesh_)
00052 {}
00053 
00054 
00055 // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //
00056 
00057 template<class Type>
00058 tmp<convectionScheme<Type> > convectionScheme<Type>::New
00059 (
00060     const fvMesh& mesh,
00061     const surfaceScalarField& faceFlux,
00062     Istream& schemeData
00063 )
00064 {
00065     if (fv::debug)
00066     {
00067         Info<< "convectionScheme<Type>::New"
00068                "(const fvMesh&, const surfaceScalarField&, Istream&) : "
00069                "constructing convectionScheme<Type>"
00070             << endl;
00071     }
00072 
00073     if (schemeData.eof())
00074     {
00075         FatalIOErrorIn
00076         (
00077             "convectionScheme<Type>::New"
00078             "(const fvMesh&, const surfaceScalarField&, Istream&)",
00079             schemeData
00080         )   << "Convection scheme not specified" << endl << endl
00081             << "Valid convection schemes are :" << endl
00082             << IstreamConstructorTablePtr_->toc()
00083             << exit(FatalIOError);
00084     }
00085 
00086     word schemeName(schemeData);
00087 
00088     typename IstreamConstructorTable::iterator cstrIter =
00089         IstreamConstructorTablePtr_->find(schemeName);
00090 
00091     if (cstrIter == IstreamConstructorTablePtr_->end())
00092     {
00093         FatalIOErrorIn
00094         (
00095             "convectionScheme<Type>::New"
00096             "(const fvMesh&, const surfaceScalarField&, Istream&)",
00097             schemeData
00098         )   << "unknown convection scheme " << schemeName << endl << endl
00099             << "Valid convection schemes are :" << endl
00100             << IstreamConstructorTablePtr_->toc()
00101             << exit(FatalIOError);
00102     }
00103 
00104     return cstrIter()(mesh, faceFlux, schemeData);
00105 }
00106 
00107 
00108 template<class Type>
00109 tmp<convectionScheme<Type> > convectionScheme<Type>::New
00110 (
00111     const fvMesh& mesh,
00112     const typename multivariateSurfaceInterpolationScheme<Type>::
00113         fieldTable& fields,
00114     const surfaceScalarField& faceFlux,
00115     Istream& schemeData
00116 )
00117 {
00118     if (fv::debug)
00119     {
00120         Info<< "convectionScheme<Type>::New"
00121                "(const fvMesh&, "
00122                "const typename multivariateSurfaceInterpolationScheme<Type>"
00123                "::fieldTable&, const surfaceScalarField&, Istream&) : "
00124                "constructing convectionScheme<Type>"
00125             << endl;
00126     }
00127 
00128     if (schemeData.eof())
00129     {
00130         FatalIOErrorIn
00131         (
00132             "convectionScheme<Type>::New"
00133                "(const fvMesh&, "
00134                "const typename multivariateSurfaceInterpolationScheme<Type>"
00135                "::fieldTable&, const surfaceScalarField&, Istream&)",
00136             schemeData
00137         )   << "Convection scheme not specified" << endl << endl
00138             << "Valid convection schemes are :" << endl
00139             << MultivariateConstructorTablePtr_->toc()
00140             << exit(FatalIOError);
00141     }
00142 
00143     word schemeName(schemeData);
00144 
00145     typename MultivariateConstructorTable::iterator cstrIter =
00146         MultivariateConstructorTablePtr_->find(schemeName);
00147 
00148     if (cstrIter == MultivariateConstructorTablePtr_->end())
00149     {
00150         FatalIOErrorIn
00151         (
00152             "convectionScheme<Type>::New"
00153             "(const fvMesh&, "
00154             "const typename multivariateSurfaceInterpolationScheme<Type>"
00155             "::fieldTable&, const surfaceScalarField&, Istream&)",
00156             schemeData
00157         )   << "unknown convection scheme " << schemeName << endl << endl
00158             << "Valid convection schemes are :" << endl
00159             << MultivariateConstructorTablePtr_->toc()
00160             << exit(FatalIOError);
00161     }
00162 
00163     return cstrIter()(mesh, fields, faceFlux, schemeData);
00164 }
00165 
00166 
00167 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00168 
00169 template<class Type>
00170 convectionScheme<Type>::~convectionScheme()
00171 {}
00172 
00173 
00174 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
00175 
00176 template<class Type>
00177 void convectionScheme<Type>::operator=(const convectionScheme<Type>& cs)
00178 {
00179     if (this == &cs)
00180     {
00181         FatalErrorIn
00182         (
00183             "convectionScheme<Type>::operator=(const convectionScheme<Type>&)"
00184         )   << "attempted assignment to self"
00185             << abort(FatalError);
00186     }
00187 }
00188 
00189 
00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00191 
00192 } // End namespace fv
00193 
00194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00195 
00196 } // End namespace Foam
00197 
00198 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd