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

extendedUpwindCellToFaceStencil.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::extendedUpwindCellToFaceStencil
00026 
00027 Description
00028     Creates upwind stencil by shifting a centred stencil to upwind and downwind
00029     faces and optionally removing all non-(up/down)wind faces ('pureUpwind').
00030 
00031     Note: the minOpposedness parameter is to decide which upwind and
00032     downwind faces to combine the stencils from. If myArea is the
00033     local area and upwindArea
00034     the area of the possible upwind candidate it will be included if
00035         (upwindArea & myArea)/magSqr(myArea) > minOpposedness
00036     so this includes both cosine and area. WIP.
00037 
00038 SourceFiles
00039     extendedUpwindCellToFaceStencil.C
00040     extendedUpwindCellToFaceStencilTemplates.C
00041 
00042 \*---------------------------------------------------------------------------*/
00043 
00044 #ifndef extendedUpwindCellToFaceStencil_H
00045 #define extendedUpwindCellToFaceStencil_H
00046 
00047 #include "extendedCellToFaceStencil.H"
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 class cellToFaceStencil;
00055 
00056 /*---------------------------------------------------------------------------*\
00057                            Class extendedUpwindCellToFaceStencil Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 class extendedUpwindCellToFaceStencil
00061 :
00062     public extendedCellToFaceStencil
00063 {
00064     // Private data
00065 
00066         //- Does stencil contain upwind points only
00067         const bool pureUpwind_;
00068 
00069         //- Swap map for getting neigbouring data
00070         autoPtr<mapDistribute> ownMapPtr_;
00071         autoPtr<mapDistribute> neiMapPtr_;
00072 
00073         //- Per face the stencil.
00074         labelListList ownStencil_;
00075         labelListList neiStencil_;
00076 
00077 
00078 
00079     // Private Member Functions
00080 
00081         //- Find most 'opposite' faces of cell
00082         void selectOppositeFaces
00083         (
00084             const boolList& nonEmptyFace,
00085             const scalar minOpposedness,
00086             const label faceI,
00087             const label cellI,
00088             DynamicList<label>& oppositeFaces
00089         ) const;
00090 
00091         //- Transport (centred) face stencil to 'opposite' face.
00092         void transportStencil
00093         (
00094             const boolList& nonEmptyFace,
00095             const labelListList& faceStencil,
00096             const scalar minOpposedness,
00097             const label faceI,
00098             const label cellI,
00099             const bool stencilHasNeighbour,
00100 
00101             DynamicList<label>& oppositeFaces,
00102             labelHashSet& faceStencilSet,
00103             labelList& transportedStencil
00104         ) const;
00105 
00106         //- Transport (centred) face stencil to 'opposite' faces.
00107         void transportStencils
00108         (
00109             const labelListList& faceStencil,
00110             const scalar minOpposedness,
00111             labelListList& ownStencil,
00112             labelListList& neiStencil
00113         );
00114 
00115 
00116         //- Disallow default bitwise copy construct
00117         extendedUpwindCellToFaceStencil(const extendedUpwindCellToFaceStencil&);
00118 
00119         //- Disallow default bitwise assignment
00120         void operator=(const extendedUpwindCellToFaceStencil&);
00121 
00122 
00123 public:
00124 
00125     // Constructors
00126 
00127         //- Construct from mesh and uncompacted centred face stencil.
00128         //  Transports facestencil to create owner and neighbour versions.
00129         //  pureUpwind to remove any remaining downwind cells.
00130         extendedUpwindCellToFaceStencil
00131         (
00132             const cellToFaceStencil&,
00133             const bool pureUpwind,
00134             const scalar minOpposedness
00135         );
00136 
00137         //- Construct from mesh and uncompacted centred face stencil. Splits
00138         //  stencil into owner and neighbour (so always pure upwind)
00139         extendedUpwindCellToFaceStencil
00140         (
00141             const cellToFaceStencil&
00142         );
00143 
00144 
00145     // Member Functions
00146 
00147         bool pureUpwind() const
00148         {
00149             return pureUpwind_;
00150         }
00151 
00152         //- Return reference to the parallel distribution map
00153         const mapDistribute& ownMap() const
00154         {
00155             return ownMapPtr_();
00156         }
00157 
00158         //- Return reference to the parallel distribution map
00159         const mapDistribute& neiMap() const
00160         {
00161             return neiMapPtr_();
00162         }
00163 
00164         //- Return reference to the stencil
00165         const labelListList& ownStencil() const
00166         {
00167             return ownStencil_;
00168         }
00169 
00170         //- Return reference to the stencil
00171         const labelListList& neiStencil() const
00172         {
00173             return neiStencil_;
00174         }
00175 
00176         //- Sum vol field contributions to create face values
00177         template<class Type>
00178         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > weightedSum
00179         (
00180             const surfaceScalarField& phi,
00181             const GeometricField<Type, fvPatchField, volMesh>& fld,
00182             const List<List<scalar> >& ownWeights,
00183             const List<List<scalar> >& neiWeights
00184         ) const;
00185 
00186 };
00187 
00188 
00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00190 
00191 } // End namespace Foam
00192 
00193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00194 
00195 #ifdef NoRepository
00196 #   include "extendedUpwindCellToFaceStencilTemplates.C"
00197 #endif
00198 
00199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00200 
00201 #endif
00202 
00203 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines