OpenFOAM logo
Open Source CFD Toolkit

blendedEdgeInterpolation.H

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-2005 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 Class
00026     blendedEdgeInterpolation
00027 
00028 Description
00029     linear/upwind blended differencing scheme.
00030 
00031 SourceFiles
00032     blendedEdgeInterpolationMake.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef blendedEdgeInterpolation_H
00037 #define blendedEdgeInterpolation_H
00038 
00039 #include "linearEdgeInterpolation.H"
00040 #include "upwindEdgeInterpolation.H"
00041 #include "areaFields.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class blended Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class Type>
00053 class blendedEdgeInterpolation
00054 :
00055     public linearEdgeInterpolation<Type>,
00056     public upwindEdgeInterpolation<Type>
00057 {
00058     // Private data
00059 
00060         const scalar blendingFactor_;
00061 
00062 
00063     // Private Member Functions
00064 
00065         //- Disallow default bitwise copy construct
00066         blendedEdgeInterpolation(const blendedEdgeInterpolation&);
00067 
00068         //- Disallow default bitwise assignment
00069         void operator=(const blendedEdgeInterpolation&);
00070 
00071 
00072 public:
00073 
00074     //- Runtime type information
00075     TypeName("blended");
00076 
00077 
00078     // Constructors
00079 
00080         //- Construct from mesh, faceFlux and blendingFactor
00081         blendedEdgeInterpolation
00082         (
00083             const faMesh& mesh,
00084             const edgeScalarField& faceFlux,
00085             const scalar blendingFactor
00086         )
00087         :
00088             edgeInterpolationScheme<Type>(mesh),
00089             linearEdgeInterpolation<Type>(mesh),
00090             upwindEdgeInterpolation<Type>(mesh, faceFlux),
00091             blendingFactor_(blendingFactor)
00092         {}
00093 
00094         //- Construct from mesh and Istream. 
00095         //  The name of the flux field is read from the Istream and looked-up
00096         //  from the database
00097         blendedEdgeInterpolation
00098         (
00099             const faMesh& mesh,
00100             Istream& is
00101         )
00102         :
00103             edgeInterpolationScheme<Type>(mesh),
00104             linearEdgeInterpolation<Type>(mesh),
00105             upwindEdgeInterpolation<Type>
00106             (
00107                 mesh,
00108                 mesh.db().objectRegistry::lookupObject<edgeScalarField>
00109                 (
00110                     word(is)
00111                 )
00112             ),
00113             blendingFactor_(readScalar(is))
00114         {}
00115 
00116         //- Construct from mesh, faceFlux and Istream
00117         blendedEdgeInterpolation
00118         (
00119             const faMesh& mesh,
00120             const edgeScalarField& faceFlux,
00121             Istream& is
00122         )
00123         :
00124             edgeInterpolationScheme<Type>(mesh),
00125             linearEdgeInterpolation<Type>(mesh),
00126             upwindEdgeInterpolation<Type>(mesh, faceFlux),
00127             blendingFactor_(readScalar(is))
00128         {}
00129 
00130 
00131     // Member Functions
00132 
00133         //- Return the interpolation weighting factors
00134         virtual tmp<edgeScalarField> weights
00135         (
00136             const GeometricField<Type, faPatchField, areaMesh>& vf
00137         ) const
00138         {
00139             return
00140                 blendingFactor_*linearEdgeInterpolation<Type>::weights(vf)
00141               + (1 - blendingFactor_)*upwindEdgeInterpolation<Type>::weights(vf);
00142         }
00143 };
00144 
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 } // End namespace Foam
00149 
00150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00151 
00152 #endif
00153 
00154 // ************************************************************************* //
For further information go to www.openfoam.org