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

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