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 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
72 
73  //- Per face the stencil.
76 
77 
78 
79  // Private Member Functions
80 
81  //- Find most 'opposite' faces of cell
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
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
146 
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 // ************************************************************************* //
Foam::extendedUpwindCellToFaceStencil::ownStencil
const labelListList & ownStencil() const
Return reference to the stencil.
Definition: extendedUpwindCellToFaceStencil.H:164
Foam::extendedUpwindCellToFaceStencil::selectOppositeFaces
void selectOppositeFaces(const boolList &nonEmptyFace, const scalar minOpposedness, const label faceI, const label cellI, DynamicList< label > &oppositeFaces) const
Find most 'opposite' faces of cell.
Definition: extendedUpwindCellToFaceStencil.C:35
extendedCellToFaceStencil.H
Foam::extendedUpwindCellToFaceStencil::weightedSum
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.
Foam::extendedUpwindCellToFaceStencil::ownMapPtr_
autoPtr< mapDistribute > ownMapPtr_
Swap map for getting neigbouring data.
Definition: extendedUpwindCellToFaceStencil.H:69
extendedUpwindCellToFaceStencilTemplates.C
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::DynamicList< label >
Foam::extendedUpwindCellToFaceStencil::pureUpwind_
const bool pureUpwind_
Does stencil contain upwind points only.
Definition: extendedUpwindCellToFaceStencil.H:66
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::extendedUpwindCellToFaceStencil::pureUpwind
bool pureUpwind() const
Definition: extendedUpwindCellToFaceStencil.H:146
Foam::extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil
extendedUpwindCellToFaceStencil(const extendedUpwindCellToFaceStencil &)
Disallow default bitwise copy construct.
Foam::HashSet< label, Hash< label > >
Foam::extendedUpwindCellToFaceStencil::operator=
void operator=(const extendedUpwindCellToFaceStencil &)
Disallow default bitwise assignment.
Foam::extendedUpwindCellToFaceStencil
Creates upwind stencil by shifting a centred stencil to upwind and downwind faces and optionally remo...
Definition: extendedUpwindCellToFaceStencil.H:59
Foam::label
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
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:152
Foam::extendedUpwindCellToFaceStencil::ownMap
const mapDistribute & ownMap() const
Return reference to the parallel distribution map.
Definition: extendedUpwindCellToFaceStencil.H:152
Foam::extendedUpwindCellToFaceStencil::neiMapPtr_
autoPtr< mapDistribute > neiMapPtr_
Definition: extendedUpwindCellToFaceStencil.H:70
Foam::extendedUpwindCellToFaceStencil::neiMap
const mapDistribute & neiMap() const
Return reference to the parallel distribution map.
Definition: extendedUpwindCellToFaceStencil.H:158
fld
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))
Foam::extendedCellToFaceStencil
Calculates/constains the extended cell-to-face stencil.
Definition: extendedCellToFaceStencil.H:65
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::extendedUpwindCellToFaceStencil::neiStencil_
labelListList neiStencil_
Definition: extendedUpwindCellToFaceStencil.H:74
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::cellToFaceStencil
Base class for extended cell-to-face stencils (face values from neighbouring cells)
Definition: cellToFaceStencil.H:54
Foam::extendedUpwindCellToFaceStencil::neiStencil
const labelListList & neiStencil() const
Return reference to the stencil.
Definition: extendedUpwindCellToFaceStencil.H:170
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::extendedUpwindCellToFaceStencil::transportStencils
void transportStencils(const labelListList &faceStencil, const scalar minOpposedness, labelListList &ownStencil, labelListList &neiStencil)
Transport (centred) face stencil to 'opposite' faces.
Definition: extendedUpwindCellToFaceStencil.C:200
Foam::extendedUpwindCellToFaceStencil::ownStencil_
labelListList ownStencil_
Per face the stencil.
Definition: extendedUpwindCellToFaceStencil.H:73
Foam::extendedUpwindCellToFaceStencil::transportStencil
void transportStencil(const boolList &nonEmptyFace, const labelListList &faceStencil, const scalar minOpposedness, const label faceI, const label cellI, const bool stencilHasNeighbour, DynamicList< label > &oppositeFaces, labelHashSet &faceStencilSet, labelList &transportedStencil) const
Transport (centred) face stencil to 'opposite' face.
Definition: extendedUpwindCellToFaceStencil.C:107