extendedUpwindCellToFaceStencil.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  Foam::extendedUpwindCellToFaceStencil
26 
27 Description
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').
30 
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.
37 
38 SourceFiles
39  extendedUpwindCellToFaceStencil.C
40  extendedUpwindCellToFaceStencilTemplates.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef extendedUpwindCellToFaceStencil_H
45 #define extendedUpwindCellToFaceStencil_H
46 
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 class cellToFaceStencil;
55 
56 /*---------------------------------------------------------------------------*\
57  Class extendedUpwindCellToFaceStencil Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 :
63 {
64  // Private data
65 
66  //- Does stencil contain upwind points only
67  const bool pureUpwind_;
68 
69  //- Swap map for getting neigbouring data
70  autoPtr<mapDistribute> ownMapPtr_;
71  autoPtr<mapDistribute> neiMapPtr_;
72 
73  //- Per face the stencil.
74  labelListList ownStencil_;
75  labelListList neiStencil_;
76 
77 
78 
79  // Private Member Functions
80 
81  //- Find most 'opposite' faces of cell
82  void selectOppositeFaces
83  (
84  const boolList& nonEmptyFace,
85  const scalar minOpposedness,
86  const label facei,
87  const label celli,
88  DynamicList<label>& oppositeFaces
89  ) const;
90 
91  //- Transport (centred) face stencil to 'opposite' face.
92  void transportStencil
93  (
94  const boolList& nonEmptyFace,
95  const labelListList& faceStencil,
96  const scalar minOpposedness,
97  const label facei,
98  const label celli,
99  const bool stencilHasNeighbour,
100 
101  DynamicList<label>& oppositeFaces,
102  labelHashSet& faceStencilSet,
103  labelList& transportedStencil
104  ) const;
105 
106  //- Transport (centred) face stencil to 'opposite' faces.
107  void transportStencils
108  (
109  const labelListList& faceStencil,
110  const scalar minOpposedness,
113  );
114 
115 
116  //- Disallow default bitwise copy construct
118 
119  //- Disallow default bitwise assignment
120  void operator=(const extendedUpwindCellToFaceStencil&);
121 
122 
123 public:
124 
125  // Constructors
126 
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.
131  (
132  const cellToFaceStencil&,
133  const bool pureUpwind,
134  const scalar minOpposedness
135  );
136 
137  //- Construct from mesh and uncompacted centred face stencil. Splits
138  // stencil into owner and neighbour (so always pure upwind)
140  (
141  const cellToFaceStencil&
142  );
143 
144 
145  // Member Functions
147  bool pureUpwind() const
148  {
149  return pureUpwind_;
150  }
151 
152  //- Return reference to the parallel distribution map
153  const mapDistribute& ownMap() const
154  {
155  return ownMapPtr_();
156  }
157 
158  //- Return reference to the parallel distribution map
159  const mapDistribute& neiMap() const
160  {
161  return neiMapPtr_();
162  }
163 
164  //- Return reference to the stencil
165  const labelListList& ownStencil() const
166  {
167  return ownStencil_;
168  }
169 
170  //- Return reference to the stencil
171  const labelListList& neiStencil() const
172  {
173  return neiStencil_;
174  }
175 
176  //- Sum vol field contributions to create face values
177  template<class Type>
179  (
180  const surfaceScalarField& phi,
182  const List<List<scalar>>& ownWeights,
183  const List<List<scalar>>& neiWeights
184  ) const;
185 
186 };
187 
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 } // End namespace Foam
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 #ifdef NoRepository
197 #endif
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
surfaceScalarField & phi
const labelListList & neiStencil() const
Return reference to the stencil.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const mapDistribute & ownMap() const
Return reference to the parallel distribution map.
Calculates/constains the extended cell-to-face stencil.
const labelListList & ownStencil() const
Return reference to the stencil.
Base class for extended cell-to-face stencils (face values from neighbouring cells) ...
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const mapDistribute & neiMap() const
Return reference to the parallel distribution map.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > weightedSum(const surfaceScalarField &phi, const GeometricField< Type, fvPatchField, volMesh > &fld, const List< List< scalar >> &ownWeights, const List< List< scalar >> &neiWeights) const
Sum vol field contributions to create face values.
Class containing processor-to-processor mapping information.
Creates upwind stencil by shifting a centred stencil to upwind and downwind faces and optionally remo...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.