OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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