78 for (label faceI = 0; faceI <
mesh.nInternalFaces(); faceI++)
85 || (ownType !=
HOLE && neiType ==
HOLE)
95 for (label faceI =
mesh.nInternalFaces(); faceI <
mesh.nFaces(); faceI++)
98 label neiType = nbrCellTypes[faceI-
mesh.nInternalFaces()];
102 (ownType ==
HOLE && neiType !=
HOLE)
103 || (ownType !=
HOLE && neiType ==
HOLE)
113 <<
" mesh regions after overset" <<
nl <<
endl;
131 for (label faceI = 0; faceI <
mesh.nInternalFaces(); faceI++)
135 label ownRegion = cellRegion[own[faceI]];
139 if (regionType[ownRegion] == 0)
145 regionType[ownRegion] = 1;
149 label neiRegion = cellRegion[nei[faceI]];
153 if (regionType[neiRegion] == 0)
159 regionType[neiRegion] = 1;
166 label faceI =
mesh.nInternalFaces();
167 faceI <
mesh.nFaces();
173 label ownRegion = cellRegion[own[faceI]];
175 if (regionType[ownRegion] == 0)
181 regionType[ownRegion] = 1;
200 for (
const label celli : fvp.
faceCells())
202 label regionI = cellRegion[celli];
209 regionType[regionI] = 2;
247 label regionI = cellRegion[cellI];
249 if (regionType[regionI] != 2)
251 const labelList& slots = compactStencil[cellI];
254 label otherType = cellRegionType[slots[i]];
261 regionType[regionI] = 2;
282 label
type = regionType[cellRegion[cellI]];
298 const fvBoundaryMesh&
pbm =
mesh.boundary();
302 const fvPatch& fvp =
pbm[patchI];
311 patchCellTypes[cellMap[cellI]] = OVERSET;
321 if (patchCellTypes[cellMap[cellI]] != OVERSET)
323 patchCellTypes[cellMap[cellI]] =
PATCH;
340 const labelList& slots = addressing[cellI];
348 result[cellI] = OVERSET;
354 result[cellI] =
PATCH;
357 else if (result[cellI] == -1)
369 const autoPtr<mapDistribute>& mapPtr,
375 if (result.size() != addressing.size())
389 mapPtr().distribute(work);
391 interpolatePatchTypes(addressing, work, result);
402 const label subZoneID,
406 const label donorZoneID,
410 const labelList& interpolatedOtherPatchTypes,
418 forAll(subCellMap, subCellI)
420 label cellI = subCellMap[subCellI];
422 bool validDonors =
true;
423 switch (interpolatedOtherPatchTypes[subCellI])
440 allCellTypes[cellI] = HOLE;
486 label currentDiff =
mag(subZoneID-allDonorID[cellI]);
487 label thisDiff =
mag(subZoneID-donorZoneID);
491 allDonorID[cellI] == -1
492 || (thisDiff < currentDiff)
493 || (thisDiff == currentDiff && donorZoneID > allDonorID[cellI])
496 allWeights[cellI] = weights[subCellI];
499 allDonorID[cellI] = donorZoneID;
508Foam::cellCellStencils::cellVolumeWeight::cellVolumeWeight
515 cellCellStencil(
mesh),
527 "cellInterpolationWeight",
528 mesh_.facesInstance(),
540 dict.getOrDefault(
"allowInterpolatedDonors", true)
556 mesh_.time().timeName(),
566 Pout<<
"Reading cellTypes from time " <<
mesh_.time().timeName()
571 forAll(volCellTypes, celli)
595 scalar layerRelax(
dict_.getOrDefault(
"layerRelax", 1.0));
602 nCellsPerZone[
zoneID[cellI]]++;
607 <<
" mesh regions" <<
nl <<
endl;
615 Info<<
indent<<
"zone:" << zonei <<
" nCells:"
616 << nCellsPerZone[zonei] <<
nl;
640 const fvMesh& partMesh = meshParts[partI].subMesh();
641 const labelList& partCellMap = meshParts[partI].cellMap();
647 Info<<
"Marking patch-cells on zone " << partI <<
endl;
663 <<
"After patch analysis : nCells : "
673 for (label srcI = 0; srcI < meshParts.
size()-1; srcI++)
675 const fvMesh& srcMesh = meshParts[srcI].subMesh();
676 const labelList& srcCellMap = meshParts[srcI].cellMap();
678 for (label tgtI = srcI+1; tgtI < meshParts.
size(); tgtI++)
680 const fvMesh& tgtMesh = meshParts[tgtI].subMesh();
681 const labelList& tgtCellMap = meshParts[tgtI].cellMap();
702 interpolatedTgtPatchTypes
709 forAll(tgtCellMap, tgtCellI)
711 label cellI = tgtCellMap[tgtCellI];
712 tgtGlobalCells[tgtCellI] = globalCells.
toGlobal(cellI);
716 mapper.
tgtMap()->distribute(tgtGlobalCells);
731 interpolatedTgtPatchTypes,
749 interpolatedSrcPatchTypes
754 forAll(srcCellMap, srcCellI)
756 label cellI = srcCellMap[srcCellI];
757 srcGlobalCells[srcCellI] = globalCells.
toGlobal(cellI);
761 mapper.
srcMap()->distribute(srcGlobalCells);
775 interpolatedSrcPatchTypes,
806 forAll(allPatchTypes, cellI)
808 if (allCellTypes[cellI] !=
HOLE)
810 switch (allPatchTypes[cellI])
815 scalar v =
mesh_.V()[cellI];
816 scalar overlapVol =
sum(allWeights[cellI]);
823 allCellTypes[cellI] =
HOLE;
824 allWeights[cellI].
clear();
825 allStencil[cellI].
clear();
845 stencilSize[celli] = allStencil[celli].
size();
851 tfldStencil().write();
869 stencilSize[celli] = allStencil[celli].
size();
875 tfldStencil().write();
884 mapDistribute map(globalCells, compactStencil, compactStencilMap);
899 dict_.getOrDefault(
"holeLayers", 1),
900 dict_.getOrDefault(
"useLayer", -1)
915 stencilSize[celli] = allStencil[celli].
size();
921 tfldStencil().write();
929 label nCalculated = 0;
935 if (allStencil[celli].size() == 0)
938 allCellTypes[celli] =
HOLE;
939 allWeights[celli].
clear();
940 allStencil[celli].
clear();
952 Pout<<
"Detected " << nCalculated <<
" cells changing from hole"
953 <<
" to calculated. Changed these to interpolated"
959 labelList compactCellTypes(allCellTypes);
962 label nHoleDonors = 0;
963 forAll(allCellTypes, cellI)
967 const labelList& slots = compactStencil[cellI];
972 compactCellTypes[slots[0]] ==
HOLE
980 allWeights[cellI][subCellI] = 0;
987 allWeights[cellI].
clear();
988 allStencil[cellI].
clear();
995 forAll(allCellTypes, cellI)
999 const scalar
s =
sum(allWeights[cellI]);
1003 allCellTypes[cellI] =
POROUS;
1004 allWeights[cellI].
clear();
1005 allStencil[cellI].
clear();
1009 forAll(allWeights[cellI], i)
1011 allWeights[cellI][i] /=
s;
1076 Pout<<
"cellI:" << cellI <<
" at:"
1077 <<
mesh_.cellCentres()[cellI]
1078 <<
" calculated from slots:" << slots
1087 const point& donorCc = cc[slots[i]];
1088 const point& accCc =
mesh_.cellCentres()[cellI];
1089 str.
writeLine(accCc, 0.1*accCc+0.9*donorCc);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const polyBoundaryMesh & pbm
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Minimal example by using system/controlDict.functions:
A HashTable similar to std::unordered_map.
@ NO_REGISTER
Do not request registration (bool: false).
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
void clear()
Clear the list, i.e. set size to zero.
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files.
Ostream & writeLine(const point &p0, const point &p1)
Write line joining two points.
virtual const fileName & name() const override
Read/write access to the name of the stream.
static void listReduce(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce list elements (list must be equal size on all ranks), applying bop to each list element.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of entries in the list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Calculation of interpolation stencils.
const fvMesh & mesh_
Reference to the mesh.
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.
static labelList count(const label size, const labelUList &lst)
Count occurrences (in parallel).
const labelIOList & zoneID() const
Helper: get reference to registered zoneID. Loads volScalarField.
InfoProxy< cellCellStencil > info() const noexcept
Return info proxy, used to print stencil information to a stream.
static const labelIOList & zoneID(const fvMesh &)
Helper: get reference to registered zoneID. Loads volScalarField.
void suppressMotionFields()
Helper: populate nonInterpolatedFields_ with motion solver.
Volume-weighted interpolation stencil.
labelList cellTypes_
Per cell the cell type.
virtual void stencilWeights(const point &sample, const pointList &donorCcs, scalarList &weights) const
Calculate inverse distance weights for a single acceptor. Revert.
static scalar defaultOverlapTolerance_
Default overlap tolerance. Fraction of volume.
List< scalarList > cellInterpolationWeights_
Interpolation weights.
virtual const labelUList & interpolationCells() const
Indices of interpolated cells.
void combineCellTypes(const label subZoneID, const fvMesh &subMesh, const labelList &subCellMap, const label donorZoneID, const labelListList &toOtherCells, const List< scalarList > &weights, const labelList &otherCells, const labelList &interpolatedOtherPatchTypes, labelListList &allStencil, scalarListList &allWeights, labelList &allCellTypes, labelList &allDonorID) const
void interpolatePatchTypes(const labelListList &addressing, const labelList &patchTypes, labelList &result) const
interpolate (= combine) patch types
void findHoles(const globalIndex &globalCells, const fvMesh &mesh, const labelList &zoneID, const labelListList &stencil, labelList &cellTypes) const
Find cells next to cells of type PATCH.
virtual const mapDistribute & cellInterpolationMap() const
Return a communication schedule.
labelListList cellStencil_
Interpolation stencil.
virtual ~cellVolumeWeight()
Destructor.
virtual const labelUList & cellTypes() const
Return the cell type list.
const bool allowInterpolatedDonors_
Allow interpolared as donors.
autoPtr< mapDistribute > cellInterpolationMap_
Fetch interpolated cells.
virtual bool update()
Update stencils. Return false if nothing changed.
const dictionary dict_
Dictionary of motion control parameters.
void markPatchCells(const fvMesh &mesh, const labelList &cellMap, labelList &patchCellTypes) const
according to additionalDocumentation/MEJ_oversetMesh.txt
volScalarField cellInterpolationWeight_
Amount of interpolation.
labelList interpolationCells_
Indices of interpolated cells.
scalar overlapTolerance_
Tolerance for volume overlap. Fraction of volume.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A fvBoundaryMesh is a fvPatch list with a reference to the associated fvMesh, with additional search ...
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Mesh data needed to do the Finite Volume discretisation.
Template invariant parts for fvPatchField.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
static bool constraintType(const word &patchType)
Return true if the given type is a constraint type.
virtual const labelUList & faceCells() const
Return faceCells.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label toGlobal(const label proci, const label i) const
From local to global on proci.
Class containing processor-to-processor mapping information.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute List data using default commsType, default flip/negate operator.
Class to calculate the cell-addressing between two overlapping meshes.
const autoPtr< mapDistribute > & srcMap() const noexcept
Source map pointer - valid if no singleMeshProc.
const labelListList & srcToTgtCellAddr() const
Return const access to the source to target cell addressing.
const scalarListList & srcToTgtCellWght() const
Return const access to the source to target cell weights.
const scalarListList & tgtToSrcCellWght() const
Return const access to the target to source cell weights.
const labelListList & tgtToSrcCellAddr() const
Return const access to the target to source cell addressing.
const autoPtr< mapDistribute > & tgtMap() const noexcept
Target map pointer - valid if no singleMeshProc.
static void correctBoundaryConditions(typename GeoField::Boundary &bfld)
Correct boundary conditions of certain type (TypeOnly = true) or explicitly not of the type (TypeOnly...
Boundary condition for use on overset patches. To be run in combination with special dynamicFvMesh ty...
label nCells() const noexcept
Number of mesh cells.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
label nRegions() const
Return total number of regions.
A class for managing temporary objects.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const bitSet isBlockedFace(intersectedFaces())
Namespace for handling debugging switches.
List< scalarList > scalarListList
List of scalarList.
List< word > wordList
List of word.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
const dimensionSet dimless
Dimensionless.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
UIndirectList< label > labelUIndList
UIndirectList of labels.
IOList< label > labelIOList
IO for a List of label.
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
List< point > pointList
List of point.
vector point
Point is a vector.
List< bool > boolList
A List of bools.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
List< scalar > scalarList
List of scalar.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Type gMax(const FieldField< Field, Type > &f)
static tmp< volScalarField > createField(const fvMesh &mesh, const scalar val)
constexpr char nl
The newline '\n' character (0x0a).
wordList patchTypes(nPatches)
#define forAll(list, i)
Loop across all elements in list.