1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2010 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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
25 Foam::extendedUpwindCellToFaceStencil
28 Creates upwind stencil by shifting a centred stencil to upwind and downwind
29 faces and optionally removing all non-(up/down)wind faces ('pureUpwind').
31 Note: the minOpposedness parameter is to decide which upwind and
32 downwind faces to combine the stencils from. If myArea is the
33 local area and upwindArea
34 the area of the possible upwind candidate it will be included if
35 (upwindArea & myArea)/magSqr(myArea) > minOpposedness
36 so this includes both cosine and area. WIP.
39 extendedUpwindCellToFaceStencil.C
40 extendedUpwindCellToFaceStencilTemplates.C
42 \*---------------------------------------------------------------------------*/
44 #ifndef extendedUpwindCellToFaceStencil_H
45 #define extendedUpwindCellToFaceStencil_H
47 #include "extendedCellToFaceStencil.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 class cellToFaceStencil;
56 /*---------------------------------------------------------------------------*\
57 Class extendedUpwindCellToFaceStencil Declaration
58 \*---------------------------------------------------------------------------*/
60 class extendedUpwindCellToFaceStencil
62 public extendedCellToFaceStencil
66 //- Does stencil contain upwind points only
67 const bool pureUpwind_;
69 //- Swap map for getting neigbouring data
70 autoPtr<mapDistribute> ownMapPtr_;
71 autoPtr<mapDistribute> neiMapPtr_;
73 //- Per face the stencil.
74 labelListList ownStencil_;
75 labelListList neiStencil_;
79 // Private Member Functions
81 //- Find most 'opposite' faces of cell
82 void selectOppositeFaces
84 const boolList& nonEmptyFace,
85 const scalar minOpposedness,
88 DynamicList<label>& oppositeFaces
91 //- Transport (centred) face stencil to 'opposite' face.
94 const boolList& nonEmptyFace,
95 const labelListList& faceStencil,
96 const scalar minOpposedness,
99 const bool stencilHasNeighbour,
101 DynamicList<label>& oppositeFaces,
102 labelHashSet& faceStencilSet,
103 labelList& transportedStencil
106 //- Transport (centred) face stencil to 'opposite' faces.
107 void transportStencils
109 const labelListList& faceStencil,
110 const scalar minOpposedness,
111 labelListList& ownStencil,
112 labelListList& neiStencil
116 //- Disallow default bitwise copy construct
117 extendedUpwindCellToFaceStencil(const extendedUpwindCellToFaceStencil&);
119 //- Disallow default bitwise assignment
120 void operator=(const extendedUpwindCellToFaceStencil&);
127 //- Construct from mesh and uncompacted centred face stencil.
128 // Transports facestencil to create owner and neighbour versions.
129 // pureUpwind to remove any remaining downwind cells.
130 extendedUpwindCellToFaceStencil
132 const cellToFaceStencil&,
133 const bool pureUpwind,
134 const scalar minOpposedness
137 //- Construct from mesh and uncompacted centred face stencil. Splits
138 // stencil into owner and neighbour (so always pure upwind)
139 extendedUpwindCellToFaceStencil
141 const cellToFaceStencil&
147 bool pureUpwind() const
152 //- Return reference to the parallel distribution map
153 const mapDistribute& ownMap() const
158 //- Return reference to the parallel distribution map
159 const mapDistribute& neiMap() const
164 //- Return reference to the stencil
165 const labelListList& ownStencil() const
170 //- Return reference to the stencil
171 const labelListList& neiStencil() const
176 //- Sum vol field contributions to create face values
178 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > weightedSum
180 const surfaceScalarField& phi,
181 const GeometricField<Type, fvPatchField, volMesh>& fld,
182 const List<List<scalar> >& ownWeights,
183 const List<List<scalar> >& neiWeights
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 } // End namespace Foam
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 # include "extendedUpwindCellToFaceStencilTemplates.C"
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 // ************************************************************************* //