70 globalCellIDs[cellI] = globalNumbering.toGlobal(cellI);
72 overlap.cellInterpolationMap().distribute(globalCellIDs);
91 Pout<<
"oversetFvMeshBase::update() : extended addressing from"
93 <<
" to nFaces:" << lowerAddr.
size()
94 <<
" nExtraFaces:" << nExtraFaces <<
endl;
118 const label nbrCelli = nbrs[nbri];
119 label globalNbr = globalCellIDs[nbrCelli];
120 label proci = globalNumbering.whichProcID(globalNbr);
121 label remoteCelli = globalNumbering.toLocal(proci, globalNbr);
126 procOwner[proci].append(celli);
127 dynProcNeighbour[proci].append(remoteCelli);
139 procNeighbour[i] = std::move(dynProcNeighbour[i]);
147 if (procOwner[proci].size())
151 if (mySendCells[proci].size())
171 Pout<<
"Adding interface " << nbri
172 <<
" to receive my " << procOwner[proci].size()
173 <<
" from " << proci <<
endl;
175 procToInterface[proci] = nbri;
179 new lduPrimitiveProcessorInterface
193 Pout<<
"Adding interface " << nbri
194 <<
" to send my " << mySendCells[proci].size()
195 <<
" to " << proci <<
endl;
200 new lduPrimitiveProcessorInterface
217 Pout<<
"Adding interface " << nbri
218 <<
" to receive my " << procOwner[proci].size()
219 <<
" from " << proci <<
endl;
221 procToInterface[proci] = nbri;
225 new lduPrimitiveProcessorInterface
239 Pout<<
"Adding interface " << nbri
240 <<
" to send my " << mySendCells[proci].size()
241 <<
" to " << proci <<
endl;
246 new lduPrimitiveProcessorInterface
273 UPtrList<const labelUList> patchAddr;
275 const fvBoundaryMesh& fvp =
mesh_.boundary();
285 patchAddr.set(patchi, &fvp[patchi].faceCells());
290 label patchi = fvp.size()+i;
291 const lduPrimitiveProcessorInterface&
pp =
300 patchAddr.set(patchi, &
pp.faceCells());
315 new fvMeshPrimitiveLduAddressing
318 std::move(lowerAddr),
319 std::move(upperAddr),
329 const lduAddressing& addr =
lduPtr_();
331 Pout<<
"Adapted addressing:"
332 <<
" lower:" << addr.lowerAddr().size()
333 <<
" upper:" << addr.upperAddr().size() <<
endl;
338 Pout<<
" " << patchi <<
"\tpatchAddr:"
339 << addr.patchAddr(patchi).size()
345 Pout<<
"Adapted interFaces:" << iFaces.size() <<
endl;
348 if (iFaces.set(patchi))
350 Pout<<
" " << patchi <<
"\tinterface:"
351 << iFaces[patchi].type() <<
endl;
370 const labelList& own = mesh_.faceOwner();
371 const labelList& nei = mesh_.faceNeighbour();
372 const cell& cFaces = mesh_.cells()[celli];
376 for (
const label facei : cFaces)
378 if (mesh_.isInternalFace(facei))
380 label nbrCelli = (own[facei] == celli ? nei[facei] : own[facei]);
381 if (norm[nbrCelli] == -GREAT)
389 avg += norm[nbrCelli];
395 if (nbrNorm[facei-mesh_.nInternalFaces()] == -GREAT)
401 avg += nbrNorm[facei-mesh_.nInternalFaces()];
420 const GAMGAgglomeration& agglom
433 mesh_.time().timeName(),
445 fld[celli] = cellToCoarse[celli];
453 >(scalarAgglomeration.boundaryFieldRef());
454 scalarAgglomeration.
write();
456 Info<<
"Writing initial cell distribution to "
457 << mesh_.time().timeName() <<
endl;
461 for (label level = 0; level < agglom.size(); level++)
463 const labelList& addr = agglom.restrictAddressing(level);
464 label coarseSize =
max(addr)+1;
467 <<
" current size : "
469 <<
" agglomerated size : "
474 const labelList& cellLabels = coarseToCell[fineI];
477 cellToCoarse[cellLabels[i]] = addr[fineI];
489 mesh_.time().timeName(),
501 fld[celli] = cellToCoarse[celli];
512 >(scalarAgglomeration.boundaryFieldRef());
513 scalarAgglomeration.
write();
521Foam::oversetFvMeshBase::oversetFvMeshBase(
const fvMesh&
mesh,
bool doInit)
544 return mesh_.fvMesh::lduAddr();
559 return mesh_.fvMesh::interfaces();
566 return allInterfaces_;
619 mesh_.schemesDict().findDict(
"oversetInterpolationSuppressed")
623 suppressed.insert(dictPtr->toc());
639 const bool writeOnProc
654 mesh_.time().timeName(),
678 mesh_.time().timeName(),
694 volZoneID[cellI] = zoneID[cellI];
696 volZoneID.correctBoundaryConditions();
697 volZoneID.writeObject(streamOpt, writeOnProc);
718 mesh_.time().timeName(),
730 forAll(cellStencil, cellI)
732 const labelList& stencil = cellStencil[cellI];
735 volDonorZoneID[cellI] = donorZoneID[stencil[0]];
736 for (label i = 1; i < stencil.size(); i++)
738 if (donorZoneID[stencil[i]] != volDonorZoneID[cellI])
741 << cellI <<
" at " << mesh_.C()[cellI]
744 volDonorZoneID[cellI] = -2;
759 ok = volDonorZoneID.writeObject(streamOpt, writeOnProc);
Macros for easy insertion into run-time selection tables.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Geometric agglomerated algebraic multigrid agglomeration class.
const labelField & restrictAddressing(const label leveli) const
Return cell restrict addressing of given level.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
const Internal & internalField() const noexcept
Return a const-reference to the dimensioned internal field.
void correctBoundaryConditions()
Correct boundary field.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A simple container for options an IOstream can normally have.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &val)
Append an element at the end of the list.
static FOAM_NO_DANGLING_REFERENCE const cellCellStencilObject & New(const fvMesh &mesh, Args &&... args)
static void exchange(const UList< Container > &sendBufs, const labelUList &recvSizes, List< Container > &recvBufs, const int tag=UPstream::msgType(), const int comm=UPstream::worldComm, const bool wait=true)
Helper: exchange contiguous data. Sends sendBufs, receives into recvBufs using predetermined receive ...
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static int & msgType() noexcept
Message tag of standard messages.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
A list of pointers to objects of type <T>, without 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,...
void setSize(const label n)
Alias for resize().
label size() const noexcept
The number of entries in the list.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
virtual const mapDistribute & cellInterpolationMap() const
Return a communication schedule.
virtual const labelListList & cellStencil() const
Per interpolated cell the neighbour cells (in terms of slots as.
static void correctBoundaryConditions(GeoField &psi)
Version of correctBoundaryConditions that excludes 'overset' bcs.
static void interpolate(Field< T > &psi, const fvMesh &mesh, const cellCellStencil &overlap, const List< scalarList > &wghts)
Interpolation of acceptor cells from donor cells.
static const labelIOList & zoneID(const fvMesh &)
Helper: get reference to registered zoneID. Loads volScalarField.
A cell is defined as a list of faces with extra functionality.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
wordList toc() const
Return the table of contents.
Smooth ATC in cells next to a set of patches supplied by type.
A fvBoundaryMesh is a fvPatch list with a reference to the associated fvMesh, with additional search ...
Variant of fvMeshLduAddressing that contains addressing instead of slices.
static labelList addAddressing(const lduAddressing &addr, const labelListList &nbrCells, label &nExtraFaces, labelList &lower, labelList &upper, labelListList &nbrCellFaces, const globalIndex &, const labelList &globalCellIDs, labelListList &localFaceCells, labelListList &remoteFaceCells)
Given additional addressing (in the form of additional neighbour cells, i.e. like cellCells).
Mesh data needed to do the Finite Volume discretisation.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label toLocal(const label proci, const label i) const
From global to local on proci.
label whichProcID(const label proci, const label i) const
Which processor does global id come from? Checks proci first (assumed to occur reasonably frequently)...
label toGlobal(const label proci, const label i) const
From local to global on proci.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
virtual const labelUList & patchAddr(const label patchNo) const =0
Return patch to internal addressing given patch number.
label size() const noexcept
Return number of equations.
static lduSchedule nonBlockingSchedule(const lduInterfacePtrsList &)
Get non-scheduled send/receive schedule.
Concrete implementation of processor interface. Used to temporarily store settings.
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.
Support for overset functionality.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
bool active_
Select base addressing (false) or locally stored extended.
void writeAgglomeration(const GAMGAgglomeration &agglom) const
Debug: dump agglomeration.
static void correctBoundaryConditions(typename GeoField::Boundary &bfld)
Correct boundary conditions of certain type (TypeOnly = true) or explicitly not of the type (TypeOnly...
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
virtual bool interpolateFields()
Update fields when mesh is updated.
const fvMesh & mesh_
Reference to mesh.
virtual const lduAddressing & lduAddr() const
Return ldu addressing. If active: is (extended).
PtrList< const lduPrimitiveProcessorInterface > remoteStencilInterfaces_
Added (processor)lduInterfaces for remote bits of stencil.
autoPtr< fvMeshPrimitiveLduAddressing > lduPtr_
Extended addressing (extended with local interpolation stencils).
labelListList stencilFaces_
Corresponding faces (in above lduPtr) to the stencil.
virtual bool updateAddressing() const
Calculate the extended lduAddressing.
labelListList stencilPatches_
Corresponding patches (in above lduPtr) to the stencil.
const fvMeshPrimitiveLduAddressing & primitiveLduAddr() const
Return extended ldu addressing.
virtual bool update()
Update the mesh for both mesh motion and topology change.
lduInterfacePtrsList allInterfaces_
Interfaces for above mesh. Contains both original and above added processorLduInterfaces.
virtual ~oversetFvMeshBase()
Destructor.
scalar cellAverage(const labelUList &types, const labelUList &nbrTypes, const scalarField &norm, const scalarField &nbrNorm, const label celli, bitSet &isFront) const
Average norm of valid neighbours.
void clearOut()
Clear out local storage.
labelList reverseFaceMap_
From old to new face labels.
Boundary condition for use on overset patches. To be run in combination with special dynamicFvMesh ty...
virtual void write(Ostream &os) const
Write.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const cellCellStencilObject & overlap
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
IOList< label > labelIOList
IO for a List of label.
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< lduScheduleEntry > lduSchedule
A List of lduSchedule entries.
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 & endl(Ostream &os)
Add newline and flush stream.
GeometricField< tensor, fvPatchField, volMesh > volTensorField
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
errorManip< error > abort(error &err)
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
static constexpr const zero Zero
Global zero (0).
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
labelListList invertOneToMany(const label len, const labelUList &map)
Invert one-to-many map. Unmapped elements will be size 0.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
UList< label > labelUList
A UList of labels.
const labelUList & cellTypes
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
#define forAll(list, i)
Loop across all elements in list.