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

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