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

midPoint.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::midPoint
00026 
00027 Description
00028     Mid-point interpolation (weighting factors = 0.5) scheme class.
00029 
00030 SourceFiles
00031     midPoint.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef midPoint_H
00036 #define midPoint_H
00037 
00038 #include <finiteVolume/surfaceInterpolationScheme.H>
00039 #include <finiteVolume/volFields.H>
00040 
00041 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00042 
00043 namespace Foam
00044 {
00045 
00046 /*---------------------------------------------------------------------------*\
00047                            Class midPoint Declaration
00048 \*---------------------------------------------------------------------------*/
00049 
00050 template<class Type>
00051 class midPoint
00052 :
00053     public surfaceInterpolationScheme<Type>
00054 {
00055     // Private Member Functions
00056 
00057         //- Disallow default bitwise assignment
00058         void operator=(const midPoint&);
00059 
00060 
00061 public:
00062 
00063     //- Runtime type information
00064     TypeName("midPoint");
00065 
00066 
00067     // Constructors
00068 
00069         //- Construct from mesh
00070         midPoint(const fvMesh& mesh)
00071         :
00072             surfaceInterpolationScheme<Type>(mesh)
00073         {}
00074 
00075         //- Construct from Istream
00076         midPoint(const fvMesh& mesh, Istream&)
00077         :
00078             surfaceInterpolationScheme<Type>(mesh)
00079         {}
00080 
00081         //- Construct from faceFlux and Istream
00082         midPoint
00083         (
00084             const fvMesh& mesh,
00085             const surfaceScalarField&,
00086             Istream&
00087         )
00088         :
00089             surfaceInterpolationScheme<Type>(mesh)
00090         {}
00091 
00092 
00093     // Member Functions
00094 
00095         //- Return the interpolation weighting factors
00096         tmp<surfaceScalarField> weights
00097         (
00098             const GeometricField<Type, fvPatchField, volMesh>&
00099         ) const
00100         {
00101             tmp<surfaceScalarField> taw
00102             (
00103                 new surfaceScalarField
00104                 (
00105                     IOobject
00106                     (
00107                         "midPointWeights",
00108                         this->mesh().time().timeName(),
00109                         this->mesh()
00110                     ),
00111                     this->mesh(),
00112                     dimensionedScalar("0.5", dimless, 0.5)
00113                 )
00114             );
00115 
00116             surfaceScalarField::GeometricBoundaryField& awbf =
00117                 taw().boundaryField();
00118 
00119             forAll(awbf, patchi)
00120             {
00121                 if (!awbf[patchi].coupled())
00122                 {
00123                     awbf[patchi] = 1.0;
00124                 }
00125             }
00126 
00127             return taw;
00128         }
00129 };
00130 
00131 
00132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00133 
00134 } // End namespace Foam
00135 
00136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00137 
00138 #endif
00139 
00140 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines