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

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