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

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-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 Class
00025     Foam::localMax
00026 
00027 Description
00028     LocalMax-mean differencing scheme class.
00029 
00030     This scheme interpolates 1/field using a scheme specified at run-time
00031     and return the reciprocal of the interpolate.
00032 
00033 SourceFiles
00034     localMax.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef localMax_H
00039 #define localMax_H
00040 
00041 #include <finiteVolume/surfaceInterpolationScheme.H>
00042 #include <finiteVolume/volFields.H>
00043 #include <finiteVolume/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, fvsPatchField, 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, fvsPatchField, surfaceMesh> > tvff
00130             (
00131                 new GeometricField<Type, fvsPatchField, 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, fvsPatchField, surfaceMesh>& vff = tvff();
00144 
00145             forAll(vff.boundaryField(), patchi)
00146             {
00147                 vff.boundaryField()[patchi] = vf.boundaryField()[patchi];
00148             }
00149 
00150             const unallocLabelList& own = mesh.owner();
00151             const unallocLabelList& nei = mesh.neighbour();
00152 
00153             forAll(vff, facei)
00154             {
00155                 vff[facei] = max(vf[own[facei]], vf[nei[facei]]);
00156             }
00157 
00158             return tvff;
00159         }
00160 };
00161 
00162 
00163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00164 
00165 } // End namespace Foam
00166 
00167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00168 
00169 #endif
00170 
00171 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines