34 void Foam::extendedUpwindCellToFaceStencil::selectOppositeFaces
37 const scalar minOpposedness,
40 DynamicList<label>& oppositeFaces
47 SortableList<scalar> opposedness(cFaces.size(), -great);
52 label otherFacei = cFaces[i];
54 if (otherFacei != facei && nonEmptyFace[otherFacei])
56 if ((own[otherFacei] == celli) == (own[facei] == celli))
58 opposedness[i] = -(areas[otherFacei] & areas[facei]);
62 opposedness[i] = (areas[otherFacei] & areas[facei]);
67 label sz = opposedness.size();
69 oppositeFaces.clear();
71 scalar myAreaSqr =
magSqr(areas[facei]);
73 if (myAreaSqr > vSmall)
77 opposedness[i] /= myAreaSqr;
83 oppositeFaces.append(cFaces[opposedness.indices()[sz-1]]);
85 for (
label i = sz-2; i >= 0; --i)
87 if (opposedness[i] < minOpposedness)
91 oppositeFaces.append(cFaces[opposedness.indices()[i]]);
101 oppositeFaces.append(cFaces[opposedness.indices()[sz-1]]);
106 void Foam::extendedUpwindCellToFaceStencil::transportStencil
110 const scalar minOpposedness,
113 const bool stencilHasNeighbour,
115 DynamicList<label>& oppositeFaces,
120 label globalOwn = faceStencil[facei][0];
121 label globalNei = -1;
122 if (stencilHasNeighbour && faceStencil[facei].size() >= 2)
124 globalNei = faceStencil[facei][1];
138 faceStencilSet.clear();
141 const labelList& fStencil = faceStencil[oppositeFaces[i]];
145 label globalI = fStencil[j];
147 if (globalI != globalOwn && globalI != globalNei)
149 faceStencilSet.insert(globalI);
155 if (stencilHasNeighbour)
157 transportedStencil.setSize(faceStencilSet.size()+2);
159 transportedStencil[n++] = globalOwn;
160 transportedStencil[n++] = globalNei;
164 if (iter.key() != globalOwn && iter.key() != globalNei)
166 transportedStencil[n++] = iter.key();
169 if (n != transportedStencil.size())
172 <<
"problem:" << faceStencilSet
178 transportedStencil.setSize(faceStencilSet.size()+1);
180 transportedStencil[n++] = globalOwn;
184 if (iter.key() != globalOwn)
186 transportedStencil[n++] = iter.key();
189 if (n != transportedStencil.size())
192 <<
"problem:" << faceStencilSet
199 void Foam::extendedUpwindCellToFaceStencil::transportStencils
202 const scalar minOpposedness,
213 DynamicList<label> oppositeFaces;
221 const polyPatch& pp = patches[
patchi];
223 if (isA<emptyPolyPatch>(pp))
225 label facei = pp.start();
228 nonEmptyFace[facei++] =
false;
260 const polyPatch& pp = patches[
patchi];
261 label facei = pp.start();
283 else if (!isA<emptyPolyPatch>(pp))
355 const polyPatch& pp = patches[
patchi];
356 label facei = pp.start();
362 neiStencil[facei].transfer
382 const bool pureUpwind,
383 const scalar minOpposedness
387 pureUpwind_(pureUpwind)
463 collectData(ownMapPtr_(), ownStencil_, mesh.
C(), stencilPoints);
466 forAll(stencilPoints, facei)
472 const labelList& stencil = ownStencil_[facei];
477 if (((points[i]-fc) & fArea) < 0)
479 newStencil.append(stencil[i]);
482 if (newStencil.size() != stencil.
size())
484 ownStencil_[facei].
transfer(newStencil);
492 collectData(neiMapPtr_(), neiStencil_, mesh.
C(), stencilPoints);
495 forAll(stencilPoints, facei)
501 const labelList& stencil = neiStencil_[facei];
506 if (((points[i]-fc) & fArea) > 0)
508 newStencil.append(stencil[i]);
511 if (newStencil.size() != stencil.
size())
513 neiStencil_[facei].
transfer(newStencil);
533 ownStencil_ = stencil;
551 collectData(ownMapPtr_(), ownStencil_, mesh.
C(), stencilPoints);
556 forAll(stencilPoints, facei)
562 const labelList& stencil = ownStencil_[facei];
568 if (((points[i]-fc) & fArea) > 0)
570 newNeiStencil.append(stencil[i]);
574 newOwnStencil.append(stencil[i]);
577 if (newNeiStencil.size() > 0)
579 ownStencil_[facei].
transfer(newOwnStencil);
580 neiStencil_[facei].
transfer(newNeiStencil);
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static void collectData(const distributionMap &map, const labelListList &stencil, const GeometricField< T, fvPatchField, volMesh > &fld, List< List< T >> &stencilFld)
Use map to get the data into stencil order.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
const cellList & cells() const
Base class for extended cell-to-face stencils (face values from neighbouring cells) ...
const globalIndex & globalNumbering() const
Global numbering for cells and boundary faces.
List< bool > boolList
Bool container classes.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
extendedUpwindCellToFaceStencil(const cellToFaceStencil &, const bool pureUpwind, const scalar minOpposedness)
Construct from mesh and uncompacted centred face stencil.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
extendedCellToFaceStencil(const polyMesh &)
Construct from mesh.
virtual const labelList & faceOwner() const
Return face owner.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const polyMesh & mesh() const
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
Class containing processor-to-processor mapping information.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Mesh data needed to do the Finite Volume discretisation.
const vectorField & faceAreas() const
Field< vector > vectorField
Specialisation of Field<T> for vector.
const volVectorField & C() const
Return cell centres.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.