initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / multivariateSchemes / multivariateScheme / multivariateScheme.C
blobd4a6d38695db06e3cb296b4d010f4cdb805156ac
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "volFields.H"
28 #include "surfaceFields.H"
29 #include "upwind.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 namespace Foam
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 template<class Type, class Scheme>
39 multivariateScheme<Type, Scheme>::multivariateScheme
41     const fvMesh& mesh,
42     const typename multivariateSurfaceInterpolationScheme<Type>::
43         fieldTable& fields,
44     const surfaceScalarField& faceFlux,
45     Istream& schemeData
48     multivariateSurfaceInterpolationScheme<Type>
49     (
50         mesh,
51         fields,
52         faceFlux,
53         schemeData
54     ),
55     Scheme::LimiterType(schemeData),
56     faceFlux_(faceFlux),
57     weights_
58     (
59         IOobject
60         (
61             "multivariateWeights",
62             mesh.time().timeName(),
63             mesh
64         ),
65         mesh,
66         dimless
67     )
69     typename multivariateSurfaceInterpolationScheme<Type>::
70         fieldTable::const_iterator iter = this->fields().begin();
72     surfaceScalarField limiter = 
73         Scheme(mesh, faceFlux_, *this).limiter(*iter());
75     for (++iter; iter != this->fields().end(); ++iter)
76     {
77         limiter = min
78         (
79             limiter,
80             Scheme(mesh, faceFlux_, *this).limiter(*iter())
81         );
82     }
84     weights_ = 
85         limiter*mesh.surfaceInterpolation::weights()
86       + (scalar(1) - limiter)*upwind<Type>(mesh, faceFlux_).weights();
90 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 } // End namespace Foam
94 // ************************************************************************* //