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

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