1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::extendedUpwindCellToFaceStencil
29 Creates upwind stencil by shifting a centred stencil to upwind and downwind
30 faces and optionally removing all non-(up/down)wind faces ('pureUpwind').
32 Note: the minOpposedness parameter is to decide which upwind and
33 downwind faces to combine the stencils from. If myArea is the
34 local area and upwindArea
35 the area of the possible upwind candidate it will be included if
36 (upwindArea & myArea)/magSqr(myArea) > minOpposedness
37 so this includes both cosine and area. WIP.
40 extendedUpwindCellToFaceStencil.C
41 extendedUpwindCellToFaceStencilTemplates.C
43 \*---------------------------------------------------------------------------*/
45 #ifndef extendedUpwindCellToFaceStencil_H
46 #define extendedUpwindCellToFaceStencil_H
48 #include "extendedCellToFaceStencil.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 class cellToFaceStencil;
57 /*---------------------------------------------------------------------------*\
58 Class extendedUpwindCellToFaceStencil Declaration
59 \*---------------------------------------------------------------------------*/
61 class extendedUpwindCellToFaceStencil
63 public extendedCellToFaceStencil
67 //- Does stencil contain upwind points only
68 const bool pureUpwind_;
70 //- Swap map for getting neigbouring data
71 autoPtr<mapDistribute> ownMapPtr_;
72 autoPtr<mapDistribute> neiMapPtr_;
74 //- Per face the stencil.
75 labelListList ownStencil_;
76 labelListList neiStencil_;
80 // Private Member Functions
82 //- Find most 'opposite' faces of cell
83 void selectOppositeFaces
85 const boolList& nonEmptyFace,
86 const scalar minOpposedness,
89 DynamicList<label>& oppositeFaces
92 //- Transport (centred) face stencil to 'opposite' face.
95 const boolList& nonEmptyFace,
96 const labelListList& faceStencil,
97 const scalar minOpposedness,
100 const bool stencilHasNeighbour,
102 DynamicList<label>& oppositeFaces,
103 labelHashSet& faceStencilSet,
104 labelList& transportedStencil
107 //- Transport (centred) face stencil to 'opposite' faces.
108 void transportStencils
110 const labelListList& faceStencil,
111 const scalar minOpposedness,
112 labelListList& ownStencil,
113 labelListList& neiStencil
117 //- Disallow default bitwise copy construct
118 extendedUpwindCellToFaceStencil(const extendedUpwindCellToFaceStencil&);
120 //- Disallow default bitwise assignment
121 void operator=(const extendedUpwindCellToFaceStencil&);
128 //- Construct from mesh and uncompacted centred face stencil.
129 // Transports facestencil to create owner and neighbour versions.
130 // pureUpwind to remove any remaining downwind cells.
131 extendedUpwindCellToFaceStencil
133 const cellToFaceStencil&,
134 const bool pureUpwind,
135 const scalar minOpposedness
138 //- Construct from mesh and uncompacted centred face stencil. Splits
139 // stencil into owner and neighbour (so always pure upwind)
140 extendedUpwindCellToFaceStencil
142 const cellToFaceStencil&
148 bool pureUpwind() const
153 //- Return reference to the parallel distribution map
154 const mapDistribute& ownMap() const
159 //- Return reference to the parallel distribution map
160 const mapDistribute& neiMap() const
165 //- Return reference to the stencil
166 const labelListList& ownStencil() const
171 //- Return reference to the stencil
172 const labelListList& neiStencil() const
177 //- Sum vol field contributions to create face values
179 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > weightedSum
181 const surfaceScalarField& phi,
182 const GeometricField<Type, fvPatchField, volMesh>& fld,
183 const List<List<scalar> >& ownWeights,
184 const List<List<scalar> >& neiWeights
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 } // End namespace Foam
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 # include "extendedUpwindCellToFaceStencilTemplates.C"
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 // ************************ vim: set sw=4 sts=4 et: ************************ //