OpenFOAM logo
Open Source CFD Toolkit

localMax.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     localMax
00027 
00028 Description
00029     LocalMax-mean differencing scheme class.  This scheme interpolates 1/field
00030     using a scheme specified at run-time and return the reciprocal of the
00031     interpolate.
00032 
00033 SourceFiles
00034     localMax.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef localMax_H
00039 #define localMax_H
00040 
00041 #include "surfaceInterpolationScheme.H"
00042 #include "volFields.H"
00043 #include "surfaceFields.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class localMax Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 template<class Type>
00055 class localMax
00056 :
00057     public surfaceInterpolationScheme<Type>
00058 {
00059     // Private Member Functions
00060 
00061         //- Disallow default bitwise assignment
00062         void operator=(const localMax&);
00063 
00064 
00065 public:
00066 
00067     //- Runtime type information
00068     TypeName("localMax");
00069 
00070 
00071     // Constructors
00072 
00073         //- Construct from mesh
00074         localMax(const fvMesh& mesh)
00075         :
00076             surfaceInterpolationScheme<Type>(mesh)
00077         {}
00078 
00079         //- Construct from Istream. 
00080         //  The name of the flux field is read from the Istream and looked-up
00081         //  from the mesh objectRegistry
00082         localMax
00083         (
00084             const fvMesh& mesh,
00085             Istream& is
00086         )
00087         :
00088             surfaceInterpolationScheme<Type>(mesh)
00089         {}
00090 
00091         //- Construct from faceFlux and Istream
00092         localMax
00093         (
00094             const fvMesh& mesh,
00095             const surfaceScalarField& faceFlux,
00096             Istream& is
00097         )
00098         :
00099             surfaceInterpolationScheme<Type>(mesh)
00100         {}
00101 
00102 
00103     // Member Functions
00104 
00105         //- Return the interpolation weighting factors
00106         virtual tmp<surfaceScalarField> weights
00107         (
00108             const GeometricField<Type, fvPatchField, volMesh>&
00109         ) const
00110         {
00111             notImplemented
00112             (
00113                 "localMax::weights"
00114                 "(const GeometricField<Type, fvPatchField, volMesh>&)"
00115             );
00116 
00117             return tmp<surfaceScalarField>(NULL);
00118         }
00119 
00120         //- Return the face-interpolate of the given cell field
00121         virtual tmp<GeometricField<Type, fvPatchField, surfaceMesh> >
00122         interpolate
00123         (
00124             const GeometricField<Type, fvPatchField, volMesh>& vf
00125         ) const
00126         {
00127             const fvMesh& mesh = vf.mesh();
00128 
00129             tmp<GeometricField<Type, fvPatchField, surfaceMesh> > tvff
00130             (
00131                 new GeometricField<Type, fvPatchField, surfaceMesh>
00132                 (
00133                     IOobject
00134                     (
00135                         vf.name(),
00136                         mesh.time().timeName(),
00137                         mesh
00138                     ),
00139                     mesh,
00140                     vf.dimensions()
00141                 )
00142             );
00143             GeometricField<Type, fvPatchField, surfaceMesh>& vff = tvff();
00144             vff.boundaryField() = vf.boundaryField();
00145 
00146             const unallocLabelList& own = mesh.owner();
00147             const unallocLabelList& nei = mesh.neighbour();
00148 
00149             forAll(vff, facei)
00150             {
00151                 vff[facei] = max(vf[own[facei]], vf[nei[facei]]);
00152             }
00153 
00154             return tvff;
00155         }
00156 };
00157 
00158 
00159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00160 
00161 } // End namespace Foam
00162 
00163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00164 
00165 #endif
00166 
00167 // ************************************************************************* //
For further information go to www.openfoam.org