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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::extendedUpwindCellToFaceStencil
28
29Description
30 Creates upwind stencil by shifting a centred stencil to upwind and downwind
31 faces and optionally removing all non-(up/down)wind faces ('pureUpwind').
32
33 Note: the minOpposedness parameter is to decide which upwind and
34 downwind faces to combine the stencils from. If myArea is the
35 local area and upwindArea
36 the area of the possible upwind candidate it will be included if
37 (upwindArea & myArea)/magSqr(myArea) > minOpposedness
38 so this includes both cosine and area. WIP.
39
40SourceFiles
41 extendedUpwindCellToFaceStencil.C
42 extendedUpwindCellToFaceStencilTemplates.C
43
44\*---------------------------------------------------------------------------*/
45
46#ifndef extendedUpwindCellToFaceStencil_H
47#define extendedUpwindCellToFaceStencil_H
48
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56class cellToFaceStencil;
57
58/*---------------------------------------------------------------------------*\
59 Class extendedUpwindCellToFaceStencil Declaration
60\*---------------------------------------------------------------------------*/
63:
65{
66 // Private data
67
68 //- Does stencil contain upwind points only
69 const bool pureUpwind_;
70
71 //- Swap map for getting neighbouring data
72 autoPtr<mapDistribute> ownMapPtr_;
73 autoPtr<mapDistribute> neiMapPtr_;
74
75 //- Per face the stencil.
76 labelListList ownStencil_;
77 labelListList neiStencil_;
78
79
80
81 // Private Member Functions
82
83 //- Find most 'opposite' faces of cell
84 void selectOppositeFaces
85 (
86 const boolList& nonEmptyFace,
87 const scalar minOpposedness,
88 const label facei,
89 const label celli,
90 DynamicList<label>& oppositeFaces
91 ) const;
92
93 //- Transport (centred) face stencil to 'opposite' face.
94 void transportStencil
95 (
96 const boolList& nonEmptyFace,
97 const labelListList& faceStencil,
98 const scalar minOpposedness,
99 const label facei,
100 const label celli,
101 const bool stencilHasNeighbour,
102
103 DynamicList<label>& oppositeFaces,
104 labelHashSet& faceStencilSet,
105 labelList& transportedStencil
106 ) const;
107
108 //- Transport (centred) face stencil to 'opposite' faces.
109 void transportStencils
110 (
111 const labelListList& faceStencil,
112 const scalar minOpposedness,
115 );
116
117
118 //- No copy construct
120 (
122 ) = delete;
123
124 //- No copy assignment
125 void operator=(const extendedUpwindCellToFaceStencil&) = delete;
126
127
128public:
129
130 // Constructors
131
132 //- Construct from mesh and uncompacted centred face stencil.
133 // Transports facestencil to create owner and neighbour versions.
134 // pureUpwind to remove any remaining downwind cells.
136 (
137 const cellToFaceStencil&,
138 const bool pureUpwind,
139 const scalar minOpposedness
140 );
141
142 //- Construct from mesh and uncompacted centred face stencil. Splits
143 // stencil into owner and neighbour (so always pure upwind)
145 (
146 const cellToFaceStencil&
147 );
148
149
150 // Member Functions
152 bool pureUpwind() const
153 {
154 return pureUpwind_;
155 }
156
157 //- Return reference to the parallel distribution map
158 const mapDistribute& ownMap() const
159 {
160 return *ownMapPtr_;
161 }
162
163 //- Return reference to the parallel distribution map
164 const mapDistribute& neiMap() const
165 {
166 return *neiMapPtr_;
167 }
168
169 //- Return reference to the stencil
170 const labelListList& ownStencil() const
171 {
172 return ownStencil_;
173 }
174
175 //- Return reference to the stencil
176 const labelListList& neiStencil() const
177 {
178 return neiStencil_;
179 }
180
181 //- Sum vol field contributions to create face values
182 template<class Type>
184 (
185 const surfaceScalarField& phi,
187 const List<List<scalar>>& ownWeights,
188 const List<List<scalar>>& neiWeights
189 ) const;
190
191};
192
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196} // End namespace Foam
197
198// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199
200#ifdef NoRepository
202#endif
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206#endif
207
208// ************************************************************************* //
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
surfaceScalarField & phi
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Base class for extended cell-to-face stencils (face values from neighbouring cells)
Calculates/constains the extended cell-to-face stencil.
Creates upwind stencil by shifting a centred stencil to upwind and downwind faces and optionally remo...
const labelListList & neiStencil() const
Return reference to the stencil.
const mapDistribute & ownMap() const
Return reference to the parallel distribution map.
const labelListList & ownStencil() const
Return reference to the stencil.
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.
const mapDistribute & neiMap() const
Return reference to the parallel distribution map.
Class containing processor-to-processor mapping information.
A class for managing temporary objects.
Definition: tmp.H:65
Namespace for OpenFOAM.