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

multivariateSelectionScheme.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 "multivariateSelectionScheme.H"
00027 #include <finiteVolume/limitedSurfaceInterpolationScheme.H>
00028 #include <finiteVolume/volFields.H>
00029 #include <finiteVolume/surfaceFields.H>
00030 #include <finiteVolume/upwind.H>
00031 
00032 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00033 
00034 namespace Foam
00035 {
00036 
00037 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00038 
00039 template<class Type>
00040 multivariateSelectionScheme<Type>::multivariateSelectionScheme
00041 (
00042     const fvMesh& mesh,
00043     const typename multivariateSurfaceInterpolationScheme<Type>::
00044         fieldTable& fields,
00045     const surfaceScalarField& faceFlux,
00046     Istream& schemeData
00047 )
00048 :
00049     multivariateSurfaceInterpolationScheme<Type>
00050     (
00051         mesh,
00052         fields,
00053         faceFlux,
00054         schemeData
00055     ),
00056     schemes_(schemeData),
00057     faceFlux_(faceFlux),
00058     weights_
00059     (
00060         IOobject
00061         (
00062             "multivariateWeights",
00063             mesh.time().timeName(),
00064             mesh
00065         ),
00066         mesh,
00067         dimless
00068     )
00069 {
00070     typename multivariateSurfaceInterpolationScheme<Type>::
00071         fieldTable::const_iterator iter = this->fields().begin();
00072 
00073     surfaceScalarField limiter =
00074     (
00075         limitedSurfaceInterpolationScheme<Type>::New
00076         (
00077             mesh,
00078             faceFlux_,
00079             schemes_.lookup(iter()->name())
00080         )().limiter(*iter())
00081     );
00082 
00083     for (++iter; iter != this->fields().end(); ++iter)
00084     {
00085         limiter = min
00086         (
00087             limiter,
00088             limitedSurfaceInterpolationScheme<Type>::New
00089             (
00090                 mesh,
00091                 faceFlux_,
00092                 schemes_.lookup(iter()->name())
00093             )().limiter(*iter())
00094         );
00095     }
00096 
00097     weights_ =
00098         limiter*mesh.surfaceInterpolation::weights()
00099       + (scalar(1) - limiter)*upwind<Type>(mesh, faceFlux_).weights();
00100 }
00101 
00102 
00103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00104 
00105 } // End namespace Foam
00106 
00107 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines