extendedUpwindCellToFaceStencil.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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 neighbouring data
70  autoPtr<distributionMap> ownMapPtr_;
71  autoPtr<distributionMap> 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 public:
117 
118  // Constructors
119 
120  //- Construct from mesh and uncompacted centred face stencil.
121  // Transports facestencil to create owner and neighbour versions.
122  // pureUpwind to remove any remaining downwind cells.
124  (
125  const cellToFaceStencil&,
126  const bool pureUpwind,
127  const scalar minOpposedness
128  );
129 
130  //- Construct from mesh and uncompacted centred face stencil. Splits
131  // stencil into owner and neighbour (so always pure upwind)
133  (
134  const cellToFaceStencil&
135  );
136 
137  //- Disallow default bitwise copy construction
139  (
141  ) = delete;
142 
143 
144  // Member Functions
146  bool pureUpwind() const
147  {
148  return pureUpwind_;
149  }
150 
151  //- Return reference to the parallel distribution map
152  const distributionMap& ownMap() const
153  {
154  return ownMapPtr_();
155  }
156 
157  //- Return reference to the parallel distribution map
158  const distributionMap& neiMap() const
159  {
160  return neiMapPtr_();
161  }
162 
163  //- Return reference to the stencil
164  const labelListList& ownStencil() const
165  {
166  return ownStencil_;
167  }
168 
169  //- Return reference to the stencil
170  const labelListList& neiStencil() const
171  {
172  return neiStencil_;
173  }
174 
175  //- Sum vol field contributions to create face values
176  template<class Type>
178  (
179  const surfaceScalarField& phi,
181  const List<List<scalar>>& ownWeights,
182  const List<List<scalar>>& neiWeights
183  ) const;
184 
185 
186  // Member Operators
187 
188  //- Disallow default bitwise assignment
189  void operator=(const extendedUpwindCellToFaceStencil&) = delete;
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #ifdef NoRepository
201 #endif
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 #endif
206 
207 // ************************************************************************* //
const labelListList & neiStencil() const
Return reference to the stencil.
void operator=(const extendedUpwindCellToFaceStencil &)=delete
Disallow default bitwise assignment.
Calculates/contains 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) ...
extendedUpwindCellToFaceStencil(const cellToFaceStencil &, const bool pureUpwind, const scalar minOpposedness)
Construct from mesh and uncompacted centred face stencil.
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))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
phi
Definition: correctPhi.H:3
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
const distributionMap & neiMap() const
Return reference to the parallel distribution map.
A class for managing temporary objects.
Definition: PtrList.H:53
const distributionMap & ownMap() const
Return reference to the parallel distribution map.
Namespace for OpenFOAM.