OpenFOAM logo
Open Source CFD Toolkit

harmonic.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     harmonic
00027 
00028 Description
00029     Harmonic-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     harmonic.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef harmonic_H
00039 #define harmonic_H
00040 
00041 #include "surfaceInterpolationScheme.H"
00042 #include "volFields.H"
00043 #include "surfaceFields.H"
00044 #include "reverseLinear.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class harmonic Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class harmonic
00056 :
00057     public surfaceInterpolationScheme<scalar>
00058 {
00059     // Private Member Functions
00060 
00061         //- Disallow default bitwise assignment
00062         void operator=(const harmonic&);
00063 
00064 
00065 public:
00066 
00067     //- Runtime type information
00068     TypeName("harmonic");
00069 
00070 
00071     // Constructors
00072 
00073         //- Construct from mesh
00074         harmonic(const fvMesh& mesh)
00075         :
00076             surfaceInterpolationScheme<scalar>(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         harmonic
00083         (
00084             const fvMesh& mesh,
00085             Istream& is
00086         )
00087         :
00088             surfaceInterpolationScheme<scalar>(mesh)
00089         {}
00090 
00091         //- Construct from faceFlux and Istream
00092         harmonic
00093         (
00094             const fvMesh& mesh,
00095             const surfaceScalarField& faceFlux,
00096             Istream& is
00097         )
00098         :
00099             surfaceInterpolationScheme<scalar>(mesh)
00100         {}
00101 
00102 
00103     // Member Functions
00104 
00105         //- Return the interpolation weighting factors
00106         virtual tmp<surfaceScalarField> weights
00107         (
00108             const GeometricField<scalar, fvPatchField, volMesh>&
00109         ) const
00110         {
00111             notImplemented
00112             (
00113                 "harmonic::weights"
00114                 "(const GeometricField<scalar, 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<scalar, fvPatchField, surfaceMesh> >
00122         interpolate
00123         (
00124             const GeometricField<scalar, fvPatchField, volMesh>& vf
00125         ) const
00126         {
00127             return 1.0/(reverseLinear<scalar>(vf.mesh()).interpolate(1.0/vf));
00128         }
00129 };
00130 
00131 
00132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00133 
00134 } // End namespace Foam
00135 
00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00137 
00138 #endif
00139 
00140 // ************************************************************************* //
For further information go to www.openfoam.org