Loading...
Searching...
No Matches
inverseDistance Class Reference

Inverse-distance-weighted interpolation stencil. More...

#include <inverseDistanceCellCellStencil.H>

Inheritance diagram for inverseDistance:
Collaboration diagram for inverseDistance:

Classes

struct  interpolatedDonorSet
 Data for a set of interpolated/donor set. More...

Public Member Functions

 TypeName ("inverseDistance")
 Runtime type information.
 inverseDistance (const fvMesh &, const dictionary &, const bool)
 Construct from fvMesh.
virtual ~inverseDistance ()
 Destructor.
virtual bool update ()
 Update stencils. Return false if nothing changed.
virtual const labelUListcellTypes () const
 Return the cell type list.
virtual const labelUListinterpolationCells () const
 Indices of interpolated cells.
virtual const mapDistributecellInterpolationMap () const
 Return a communication schedule.
virtual const labelListListcellStencil () const
 Per interpolated cell the neighbour cells (in terms of slots as.
virtual const scalarListListcellInterpolationWeights () const
 Weights for cellStencil.
virtual const scalarListcellInterpolationWeight () const
 Per interpolated cell the interpolation factor. (0 = use.
virtual void stencilWeights (const point &sample, const pointList &donorCcs, scalarList &weights) const
 Calculate inverse distance weights for a single acceptor.
Public Member Functions inherited from cellCellStencil
 TypeName ("cellCellStencil")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, cellCellStencil, mesh,(const fvMesh &mesh, const dictionary &dict, const bool update),(mesh, dict, update))
 cellCellStencil (const fvMesh &)
 Construct from fvMesh.
virtual ~cellCellStencil ()
 Destructor.
virtual const wordHashSetnonInterpolatedFields () const
 Return the names of any (stencil or mesh specific) fields that.
virtual wordHashSetnonInterpolatedFields ()
 Return non-const non-interpolating fields.
bool localStencil (const labelUList &) const
 Helper: is stencil fully local.
const labelIOListzoneID () const
 Helper: get reference to registered zoneID. Loads volScalarField.
template<class T>
void interpolate (const fvMesh &mesh, Field< T > &psi) const
 Explicit interpolation of acceptor cells from donor cells. Looks up cellCellStencil.
template<class GeoField>
void interpolate (GeoField &psi) const
 Explicit interpolation of acceptor cells from donor cells with boundary condition handling.
template<class GeoField>
void interpolate (const fvMesh &mesh, const wordHashSet &suppressed) const
 Explicit interpolation of all registered fields. No boundary conditions. Excludes selected fields (and their old-time fields).
void walkFront (const globalIndex &globalCells, const scalar layerRelax, const labelListList &allStencil, labelList &allCellTypes, scalarField &allWeight, const scalarList &compactCellVol, const labelListList &compactStencil, const labelList &zoneID, const label holeLayers, const label useLayer) const
 Surround holes with layer(s) of interpolated cells.
void setUpFront (const labelList &allCellTypes, bitSet &isFront) const
 Set up front using allCellTypes.
void setUpFrontOnOversetPatch (const labelList &allCellTypes, bitSet &isFront) const
 Set up front on overset patches.
void seedCell (const label cellI, const scalar wantedFraction, bitSet &isFront, scalarField &fraction) const
 Seed faces of cell with wantedFraction (if higher than current).
InfoProxy< cellCellStencil > info () const noexcept
 Return info proxy, used to print stencil information to a stream.
template<class Type>
Foam::tmp< Foam::volScalarFieldcreateField (const fvMesh &mesh, const word &name, const UList< Type > &psi)

Protected Member Functions

void markPatchesAsHoles (PstreamBuffers &pBufs, const PtrList< fvMeshSubset > &meshParts, const List< treeBoundBoxList > &patchBb, const List< labelVector > &patchDivisions, const PtrList< PackedList< 2 > > &patchParts, const label srcI, const label tgtI, labelList &allCellTypes) const
 Mark all cells overlapping (a voxel covered by) a src patch.
bool betterDonor (const label destMesh, const label currentDonorMesh, const label newDonorMesh) const
 If multiple donors meshes: decide which is best.
void markDonors (const globalIndex &globalCells, PstreamBuffers &pBufs, const PtrList< fvMeshSubset > &meshParts, const List< treeBoundBoxList > &meshBb, const labelList &allCellTypes, const label srcI, const label tgtI, labelListList &allStencil, labelList &allDonor) const
 Determine donors for all tgt cells.
void uncompactedRegionSplit (const fvMesh &mesh, const globalIndex &globalFaces, const label nZones, const labelList &zoneID, const labelList &cellTypes, const boolList &isBlockedFace, labelList &cellRegion) const
 Replacement of regionSplit.
autoPtr< globalIndexcompactedRegionSplit (const fvMesh &mesh, const globalIndex &globalFaces, labelList &cellRegion) const
void findHoles (const globalIndex &globalCells, const fvMesh &mesh, const labelList &zoneID, const labelListList &stencil, labelList &cellTypes) const
 Do flood filling to detect unreachable (from patches) sections.
void seedCell (const label cellI, const scalar wantedFraction, bitSet &isFront, scalarField &fraction) const
 Seed faces of cell with wantedFraction (if higher than current).
virtual void createStencil (const globalIndex &, const bool allowHoleDonors)
 Create stencil starting from the donor containing the acceptor allowHoleDonors : allow donors of type HOLE (otherwise are filtered out).
void holeExtrapolationStencil (const globalIndex &globalCells)
 Make holes next to live ones type SPECIAL and include in interpolation stencil.
Protected Member Functions inherited from cellCellStencil
void suppressMotionFields ()
 Helper: populate nonInterpolatedFields_ with motion solver.

Static Protected Member Functions

static label index (const labelVector &nDivs, const labelVector &)
 Convert ijk indices into single index.
static labelVector index3 (const labelVector &nDivs, const label)
 Convert single index into ijk.
static labelVector index3 (const boundBox &bb, const labelVector &nDivs, const point &pt)
 Convert coordinate into ijk.
static point position (const boundBox &bb, const labelVector &nDivs, const label boxI)
 Convert index back into coordinate.
static void fill (PackedList< 2 > &elems, const boundBox &bb, const labelVector &nDivs, const boundBox &subBb, const unsigned int val)
 Fill all elements overlapping subBb with value val.
static bool overlaps (const boundBox &bb, const labelVector &nDivs, const PackedList< 2 > &voxels, const treeBoundBox &subBb, const unsigned int val)
 Is any voxel inside subBb set to val.
static void markBoundaries (const fvMesh &mesh, const vector &smallVec, const boundBox &bb, const labelVector &nDivs, PackedList< 2 > &patchTypes, const labelList &cellMap, labelList &patchCellTypes)
 Mark voxels of patchTypes with type of patch face.
Static Protected Member Functions inherited from cellCellStencil
template<class Type>
static tmp< volScalarFieldcreateField (const fvMesh &mesh, const word &name, const UList< Type > &)
 Helper: create volScalarField for postprocessing.
static word baseName (const word &name)
 Helper: strip off trailing _0.

Protected Attributes

const dictionary dict_
 Dictionary of motion control parameters.
const bool allowHoleDonors_
 Allow holes as donors.
const bool allowInterpolatedDonors_
 Allow interpolared as donors.
vector smallVec_
 Small perturbation vector for geometric tests.
labelList cellTypes_
 Per cell the cell type.
labelList interpolationCells_
 Indices of interpolated cells.
autoPtr< mapDistributecellInterpolationMap_
 Fetch interpolated cells.
labelListList cellStencil_
 Interpolation stencil.
scalarListList cellInterpolationWeights_
 Interpolation weights.
volScalarField cellInterpolationWeight_
 Amount of interpolation.
Protected Attributes inherited from cellCellStencil
const fvMeshmesh_
 Reference to the mesh.
wordHashSet nonInterpolatedFields_
 Set of fields that should not be interpolated.
const dictionary dict_
 Dictionary of motion control parameters.

Additional Inherited Members

Public Types inherited from cellCellStencil
enum  patchCellType { OTHER = 0 , PATCH = 1 , OVERSET = 2 }
enum  cellType {
  CALCULATED = 0 , INTERPOLATED = 1 , HOLE = 2 , SPECIAL = 3 ,
  POROUS = 4
}
Static Public Member Functions inherited from cellCellStencil
static autoPtr< cellCellStencil > New (const fvMesh &, const dictionary &dict, const bool update=true)
 New function which constructs and returns pointer to a.
static const labelIOListzoneID (const fvMesh &)
 Helper: get reference to registered zoneID. Loads volScalarField.
static labelList count (const label size, const labelUList &lst)
 Count occurrences (in parallel).
static void globalCellCells (const globalIndex &gi, const polyMesh &mesh, const boolList &isValidDonor, const labelList &selectedCells, labelListList &cellCells, pointListList &cellCellCentres)
 Helper: create cell-cell addressing in global numbering.
template<class T>
static void interpolate (Field< T > &psi, const fvMesh &mesh, const cellCellStencil &overlap, const List< scalarList > &wghts)
 Interpolation of acceptor cells from donor cells.
template<class GeoField, class SuppressBC>
static void correctBoundaryConditions (GeoField &psi)
 Version of correctBoundaryConditions that excludes 'overset' bcs.
Static Protected Attributes inherited from cellCellStencil
static const Enum< cellTypecellTypeNames_
 Mode type names.

Detailed Description

Inverse-distance-weighted interpolation stencil.

hole finding:

  • mark boundary faces on helper (voxel) mesh
  • mark any cell overlaying these voxels
  • use flood filling to find any unreachable cell Alternative is to use an octree of the boundary faces and determine directly for all cells whether we are outside. Might be slow though.
Source files

Definition at line 63 of file inverseDistanceCellCellStencil.H.

Constructor & Destructor Documentation

◆ inverseDistance()

◆ ~inverseDistance()

~inverseDistance ( )
virtual

Destructor.

Definition at line 1778 of file inverseDistanceCellCellStencil.C.

Member Function Documentation

◆ index()

Foam::label index ( const labelVector & nDivs,
const labelVector & ijk )
staticprotected

Convert ijk indices into single index.

Definition at line 55 of file inverseDistanceCellCellStencil.C.

Referenced by fill(), and overlaps().

Here is the caller graph for this function:

◆ index3() [1/2]

Foam::labelVector index3 ( const labelVector & nDivs,
const label boxI )
staticprotected

Convert single index into ijk.

Definition at line 65 of file inverseDistanceCellCellStencil.C.

References k.

Referenced by fill(), overlaps(), and position().

Here is the caller graph for this function:

◆ index3() [2/2]

Foam::labelVector index3 ( const boundBox & bb,
const labelVector & nDivs,
const point & pt )
staticprotected

Convert coordinate into ijk.

Definition at line 80 of file inverseDistanceCellCellStencil.C.

References boundBox::min(), and boundBox::span().

Here is the call graph for this function:

◆ position()

Foam::point position ( const boundBox & bb,
const labelVector & nDivs,
const label boxI )
staticprotected

Convert index back into coordinate.

Definition at line 99 of file inverseDistanceCellCellStencil.C.

References index3(), boundBox::min(), and boundBox::span().

Here is the call graph for this function:

◆ fill()

void fill ( PackedList< 2 > & elems,
const boundBox & bb,
const labelVector & nDivs,
const boundBox & subBb,
const unsigned int val )
staticprotected

Fill all elements overlapping subBb with value val.

Definition at line 116 of file inverseDistanceCellCellStencil.C.

References index(), index3(), k, boundBox::max(), Foam::max(), boundBox::min(), Foam::min(), and VectorSpace< Form, Cmpt, Ncmpts >::zero.

Referenced by markBoundaries().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ overlaps()

bool overlaps ( const boundBox & bb,
const labelVector & nDivs,
const PackedList< 2 > & voxels,
const treeBoundBox & subBb,
const unsigned int val )
staticprotected

Is any voxel inside subBb set to val.

Definition at line 230 of file inverseDistanceCellCellStencil.C.

References index(), index3(), k, boundBox::max(), Foam::max(), boundBox::min(), Foam::min(), cellCellStencil::PATCH, and VectorSpace< Form, Cmpt, Ncmpts >::zero.

Referenced by markDonors(), trackingInverseDistance::markDonors(), and markPatchesAsHoles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ markBoundaries()

void markBoundaries ( const fvMesh & mesh,
const vector & smallVec,
const boundBox & bb,
const labelVector & nDivs,
PackedList< 2 > & patchTypes,
const labelList & cellMap,
labelList & patchCellTypes )
staticprotected

Mark voxels of patchTypes with type of patch face.

Definition at line 154 of file inverseDistanceCellCellStencil.C.

References fvPatch::constraintType(), fvPatch::faceCells(), fill(), forAll, boundBox::grow(), Foam::isA(), mesh, cellCellStencil::OTHER, boundBox::overlaps(), cellCellStencil::OVERSET, cellCellStencil::PATCH, fvPatch::patch(), patchTypes(), pbm, and pp().

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ markPatchesAsHoles()

void markPatchesAsHoles ( PstreamBuffers & pBufs,
const PtrList< fvMeshSubset > & meshParts,
const List< treeBoundBoxList > & patchBb,
const List< labelVector > & patchDivisions,
const PtrList< PackedList< 2 > > & patchParts,
const label srcI,
const label tgtI,
labelList & allCellTypes ) const
protected

Mark all cells overlapping (a voxel covered by) a src patch.

with type HOLE

Definition at line 274 of file inverseDistanceCellCellStencil.C.

References UPstream::allProcs(), PstreamBuffers::clear(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, PstreamBuffers::finishedSends(), forAll, boundBox::grow(), cellCellStencil::HOLE, cellCellStencil::mesh_, UPstream::myProcNo(), os(), overlaps(), treeBoundBox::overlaps(), cellCellStencil::PATCH, and smallVec_.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ betterDonor()

bool betterDonor ( const label destMesh,
const label currentDonorMesh,
const label newDonorMesh ) const
protected

If multiple donors meshes: decide which is best.

Definition at line 398 of file inverseDistanceCellCellStencil.C.

References Foam::mag().

Referenced by markDonors(), and trackingInverseDistance::markDonors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ markDonors()

◆ uncompactedRegionSplit()

void uncompactedRegionSplit ( const fvMesh & mesh,
const globalIndex & globalFaces,
const label nZones,
const labelList & zoneID,
const labelList & cellTypes,
const boolList & isBlockedFace,
labelList & cellRegion ) const
protected

Replacement of regionSplit.

References cellTypes(), isBlockedFace(), mesh, and cellCellStencil::zoneID().

Here is the call graph for this function:

◆ compactedRegionSplit()

autoPtr< globalIndex > compactedRegionSplit ( const fvMesh & mesh,
const globalIndex & globalFaces,
labelList & cellRegion ) const
protected

References cellTypes(), mesh, and cellCellStencil::zoneID().

Here is the call graph for this function:

◆ findHoles()

void findHoles ( const globalIndex & globalCells,
const fvMesh & mesh,
const labelList & zoneID,
const labelListList & stencil,
labelList & cellTypes ) const
protected

◆ seedCell()

void seedCell ( const label cellI,
const scalar wantedFraction,
bitSet & isFront,
scalarField & fraction ) const
protected

Seed faces of cell with wantedFraction (if higher than current).

◆ createStencil()

void createStencil ( const globalIndex & globalCells,
const bool allowHoleDonors )
protectedvirtual

Create stencil starting from the donor containing the acceptor allowHoleDonors : allow donors of type HOLE (otherwise are filtered out).

Note: empty slots can happen for interpolated cells with

bad/insufficient donors. These are handled later on.

Definition at line 1501 of file inverseDistanceCellCellStencil.C.

References Foam::abort(), cellInterpolationMap(), cellInterpolationMap_, cellInterpolationWeights_, cellStencil_, cellTypes_, mapDistributeBase::distribute(), Foam::FatalError, FatalErrorInFunction, forAll, cellCellStencil::globalCellCells(), cellCellStencil::HOLE, interpolationCells_, cellCellStencil::mesh_, UPstream::msgType(), UPstream::nonBlocking, nSamples(), List< T >::null(), Foam::returnReduceOr(), samples(), bitSet::set(), UList< T >::size(), and stencilWeights().

Referenced by update(), and trackingInverseDistance::update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ holeExtrapolationStencil()

◆ TypeName()

TypeName ( "inverseDistance" )

Runtime type information.

◆ update()

bool update ( )
virtual

Update stencils. Return false if nothing changed.

Implements cellCellStencil.

Reimplemented in trackingInverseDistance.

Definition at line 1784 of file inverseDistanceCellCellStencil.C.

References Pstream::allGatherList(), allowHoleDonors_, allowInterpolatedDonors_, boundaryFieldRef(), cellCellStencil::CALCULATED, Foam::cbrt(), cellInterpolationMap(), cellInterpolationMap_, cellInterpolationWeight_, cellInterpolationWeights_, cellStencil_, cellTypes_, List< T >::clear(), oversetFvMeshBase::correctBoundaryConditions(), cellCellStencil::count(), Foam::createField(), createStencil(), DebugInfo, Foam::decrIndent(), dict_, mapDistribute::distribute(), e, Foam::endl(), findHoles(), forAll, dictionary::found(), FUNCTION_NAME, dictionary::getOrDefault(), Foam::gMax(), cellCellStencil::HOLE, holeExtrapolationStencil(), Foam::incrIndent(), Foam::indent(), Foam::Info, cellCellStencil::INTERPOLATED, interpolationCells(), interpolationCells_, Pstream::listReduce(), Foam::mag(), markBoundaries(), markDonors(), markPatchesAsHoles(), cellCellStencil::mesh_, meshBb(), boundBox::min(), Foam::mkDir(), UPstream::myProcNo(), Foam::name(), OFstream::name(), polyMesh::nGeometricD(), Foam::nl, primitiveMesh::nPoints(), UPstream::nProcs(), cellCellStencil::OTHER, cellCellStencil::OVERSET, polyMesh::points(), cellCellStencil::POROUS, Foam::Pout, Foam::reduce(), tmp< T >::ref(), Foam::returnReduce(), PtrList< T >::set(), List< T >::setSize(), UList< T >::size(), UPtrList< T >::size(), smallVec_, boundBox::span(), Foam::sqrt(), dictionary::subDict(), Foam::type(), cellCellStencil::walkFront(), OBJstream::writeLine(), Foam::Zero, and cellCellStencil::zoneID().

Referenced by inverseDistance(), and leastSquares::leastSquares().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cellTypes()

virtual const labelUList & cellTypes ( ) const
inlinevirtual

Return the cell type list.

Implements cellCellStencil.

Definition at line 362 of file inverseDistanceCellCellStencil.H.

References cellTypes_.

Referenced by compactedRegionSplit(), findHoles(), and uncompactedRegionSplit().

Here is the caller graph for this function:

◆ interpolationCells()

virtual const labelUList & interpolationCells ( ) const
inlinevirtual

Indices of interpolated cells.

Implements cellCellStencil.

Definition at line 370 of file inverseDistanceCellCellStencil.H.

References interpolationCells_.

Referenced by update(), and trackingInverseDistance::update().

Here is the caller graph for this function:

◆ cellInterpolationMap()

virtual const mapDistribute & cellInterpolationMap ( ) const
inlinevirtual

Return a communication schedule.

Implements cellCellStencil.

Definition at line 378 of file inverseDistanceCellCellStencil.H.

References cellInterpolationMap_.

Referenced by createStencil(), holeExtrapolationStencil(), update(), and trackingInverseDistance::update().

Here is the caller graph for this function:

◆ cellStencil()

virtual const labelListList & cellStencil ( ) const
inlinevirtual

Per interpolated cell the neighbour cells (in terms of slots as.

constructed by above cellInterpolationMap) to interpolate

Implements cellCellStencil.

Definition at line 392 of file inverseDistanceCellCellStencil.H.

References cellStencil_.

◆ cellInterpolationWeights()

virtual const scalarListList & cellInterpolationWeights ( ) const
inlinevirtual

Weights for cellStencil.

Implements cellCellStencil.

Definition at line 400 of file inverseDistanceCellCellStencil.H.

References cellInterpolationWeights_.

◆ cellInterpolationWeight()

virtual const scalarList & cellInterpolationWeight ( ) const
inlinevirtual

Per interpolated cell the interpolation factor. (0 = use.

calculated, 1 = use interpolated)

Implements cellCellStencil.

Definition at line 410 of file inverseDistanceCellCellStencil.H.

References cellInterpolationWeight_.

◆ stencilWeights()

void stencilWeights ( const point & sample,
const pointList & donorCcs,
scalarList & weights ) const
virtual

Calculate inverse distance weights for a single acceptor.

Implements cellCellStencil.

Reimplemented in leastSquares.

Definition at line 1174 of file inverseDistanceCellCellStencil.C.

References forAll, Foam::mag(), List< T >::setSize(), UList< T >::size(), and Foam::sum().

Referenced by createStencil(), and holeExtrapolationStencil().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ dict_

const dictionary dict_
protected

Dictionary of motion control parameters.

Definition at line 87 of file inverseDistanceCellCellStencil.H.

Referenced by inverseDistance(), update(), and trackingInverseDistance::update().

◆ allowHoleDonors_

const bool allowHoleDonors_
protected

Allow holes as donors.

Definition at line 92 of file inverseDistanceCellCellStencil.H.

Referenced by inverseDistance(), update(), and trackingInverseDistance::update().

◆ allowInterpolatedDonors_

const bool allowInterpolatedDonors_
protected

Allow interpolared as donors.

Definition at line 97 of file inverseDistanceCellCellStencil.H.

Referenced by inverseDistance(), update(), and trackingInverseDistance::update().

◆ smallVec_

◆ cellTypes_

labelList cellTypes_
protected

◆ interpolationCells_

labelList interpolationCells_
protected

◆ cellInterpolationMap_

autoPtr<mapDistribute> cellInterpolationMap_
protected

◆ cellStencil_

labelListList cellStencil_
protected

◆ cellInterpolationWeights_

scalarListList cellInterpolationWeights_
protected

◆ cellInterpolationWeight_

volScalarField cellInterpolationWeight_
protected

The documentation for this class was generated from the following files: