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

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