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
145 
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,
180  const VolField<Type>& fld,
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 // ************************************************************************* //
Generic GeometricField class.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for extended cell-to-face stencils (face values from neighbouring cells)
Class containing processor-to-processor mapping information.
Calculates/contains the extended cell-to-face stencil.
Creates upwind stencil by shifting a centred stencil to upwind and downwind faces and optionally remo...
const distributionMap & neiMap() const
Return reference to the parallel distribution map.
void operator=(const extendedUpwindCellToFaceStencil &)=delete
Disallow default bitwise assignment.
const labelListList & ownStencil() const
Return reference to the stencil.
const labelListList & neiStencil() const
Return reference to the stencil.
extendedUpwindCellToFaceStencil(const cellToFaceStencil &, const bool pureUpwind, const scalar minOpposedness)
Construct from mesh and uncompacted centred face stencil.
const distributionMap & ownMap() const
Return reference to the parallel distribution map.
tmp< SurfaceField< Type > > weightedSum(const surfaceScalarField &phi, const VolField< Type > &fld, const List< List< scalar >> &ownWeights, const List< List< scalar >> &neiWeights) const
Sum vol field contributions to create face values.
A class for managing temporary objects.
Definition: tmp.H:55
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.
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