Field mapping for patch reset
This commit is contained in:
parent
9cc1acc8a0
commit
41829c7a53
26 changed files with 335 additions and 173 deletions
|
@ -342,26 +342,35 @@ autoPtr<mapPolyMesh> reorderMesh
|
|||
mesh.nPoints(), // nOldPoints,
|
||||
mesh.nFaces(), // nOldFaces,
|
||||
mesh.nCells(), // nOldCells,
|
||||
|
||||
identity(mesh.nPoints()), // pointMap,
|
||||
List<objectMap>(0), // pointsFromPoints,
|
||||
|
||||
faceOrder, // faceMap,
|
||||
List<objectMap>(0), // facesFromPoints,
|
||||
List<objectMap>(0), // facesFromEdges,
|
||||
List<objectMap>(0), // facesFromFaces,
|
||||
|
||||
cellOrder, // cellMap,
|
||||
List<objectMap>(0), // cellsFromPoints,
|
||||
List<objectMap>(0), // cellsFromEdges,
|
||||
List<objectMap>(0), // cellsFromFaces,
|
||||
List<objectMap>(0), // cellsFromCells,
|
||||
|
||||
identity(mesh.nPoints()), // reversePointMap,
|
||||
reverseFaceOrder, // reverseFaceMap,
|
||||
reverseCellOrder, // reverseCellMap,
|
||||
|
||||
labelHashSet(0), // flipFaceFlux,
|
||||
|
||||
patchPointMap, // patchPointMap,
|
||||
labelListList(0), // pointZoneMap,
|
||||
labelListList(0), // faceZonePointMap,
|
||||
labelListList(0), // faceZoneFaceMap,
|
||||
labelListList(0), // cellZoneMap,
|
||||
|
||||
boolList(mesh.boundaryMesh().size(), false), // resetPatchFlag
|
||||
|
||||
pointField(0), // preMotionPoints,
|
||||
patchStarts, // oldPatchStarts,
|
||||
oldPatchNMeshPoints // oldPatchNMeshPoints
|
||||
|
|
|
@ -651,6 +651,7 @@ int main(int argc, char *argv[])
|
|||
processorDb
|
||||
)
|
||||
);
|
||||
procMesh.syncUpdateMesh();
|
||||
|
||||
labelIOList cellProcAddressing
|
||||
(
|
||||
|
|
|
@ -142,6 +142,7 @@ int main(int argc, char *argv[])
|
|||
regionName
|
||||
);
|
||||
|
||||
// Get reconstructed mesh
|
||||
autoPtr<fvMesh> meshPtr = procMeshes.reconstructMesh(runTime);
|
||||
|
||||
|
||||
|
|
|
@ -272,24 +272,9 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
|||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Owner and neighbour processor index are the same
|
||||
// across the processor boundary. This face will be
|
||||
// re-merged into internal faces in load balancing
|
||||
// and therefore remains in the processor patch
|
||||
Pout<< "Preserved proc[" << patchFaceI << "]: "
|
||||
<< ownerProc << " " << neighbourProc << endl;
|
||||
|
||||
// Add the face
|
||||
procFaceList[ownerProc].append
|
||||
(
|
||||
patchStart + patchFaceI
|
||||
);
|
||||
|
||||
// Increment the number of faces for this patch
|
||||
procPatchSize_[ownerProc][patchI]++;
|
||||
}
|
||||
// Note: cannot insert regular faces here, because
|
||||
// they are out of sequence.
|
||||
// HJ, 24/Apr/2018
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -516,24 +501,9 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
|||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Owner and neighbour processor index are the same
|
||||
// across the processor boundary. This face will be
|
||||
// re-merged into internal faces in load balancing
|
||||
// and therefore remains in the processor patch
|
||||
Pout<< "Preserved proc[" << patchFaceI << "]: "
|
||||
<< ownerProc << " " << neighbourProc << endl;
|
||||
|
||||
// Add the face
|
||||
procFaceList[ownerProc].append
|
||||
(
|
||||
patchStart + patchFaceI
|
||||
);
|
||||
|
||||
// Increment the number of faces for this patch
|
||||
procPatchSize_[ownerProc][patchI]++;
|
||||
}
|
||||
// Note: cannot insert regular faces here, because
|
||||
// they are out of sequence.
|
||||
// HJ, 24/Apr/2018
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -555,35 +525,53 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
|||
const label patchStart = patches[patchI].patch().start();
|
||||
|
||||
// Do normal patches. Note that processor patches
|
||||
// have already been done and need to be skipped
|
||||
// For all other patches patchNbrCellToProc_ will be empty
|
||||
if (!patchNbrCellToProc_[patchI].empty())
|
||||
// have already been partially done and need special treatment
|
||||
if
|
||||
(
|
||||
isA<processorFvPatch>(patches[patchI])
|
||||
&& !patchNbrCellToProc_[patchI].empty()
|
||||
)
|
||||
{
|
||||
// Only collect faces where the owner and neighbour processor
|
||||
// index are the same.
|
||||
// If owner and neighbour processor index are different,
|
||||
// the face was already collected into a separate patch
|
||||
// HJ, 23/Apr/2018
|
||||
|
||||
const unallocLabelList& fc = patches[patchI].faceCells();
|
||||
|
||||
// Get neighbour cellToProc addressing across the interface
|
||||
const labelList& curNbrPtc = patchNbrCellToProc_[patchI];
|
||||
|
||||
forAll (fc, patchFaceI)
|
||||
{
|
||||
// Local owner proc is looked up using faceCells
|
||||
const label ownerProc = cellToProc_[fc[patchFaceI]];
|
||||
|
||||
// Neighbour proc is looked up directly
|
||||
const label neighbourProc = curNbrPtc[patchFaceI];
|
||||
|
||||
// If the owner and neighbour processor index is the same,
|
||||
// the face remains in the processor patch
|
||||
// In load balancing, it will be re-merged on reconstruction
|
||||
// HJ, 23/Apr/2018
|
||||
if (ownerProc == neighbourProc)
|
||||
{
|
||||
// Add the face
|
||||
procFaceList[ownerProc].append(patchStart + patchFaceI);
|
||||
Pout<< "Add proc face to proc patch. Face "
|
||||
<< patchStart + patchFaceI
|
||||
<< endl;
|
||||
// Increment the number of faces for this patch
|
||||
procPatchSize_[ownerProc][patchI]++;
|
||||
}
|
||||
}
|
||||
|
||||
// Processor patch. Skip it
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isA<cyclicFvPatch>(patches[patchI]))
|
||||
{
|
||||
// Normal patch. Add faces to processor where the cell
|
||||
// next to the face lives
|
||||
|
||||
const unallocLabelList& patchFaceCells =
|
||||
patches[patchI].faceCells();
|
||||
|
||||
forAll (patchFaceCells, patchFaceI)
|
||||
{
|
||||
const label curProc =
|
||||
cellToProc_[patchFaceCells[patchFaceI]];
|
||||
|
||||
// add the face
|
||||
procFaceList[curProc].append(patchStart + patchFaceI);
|
||||
|
||||
// increment the number of faces for this patch
|
||||
procPatchSize_[curProc][patchI]++;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (isA<cyclicFvPatch>(patches[patchI]))
|
||||
{
|
||||
// Cyclic patch special treatment
|
||||
|
||||
|
@ -785,6 +773,24 @@ void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal patch. Add faces to processor where the cell
|
||||
// next to the face lives
|
||||
|
||||
const unallocLabelList& fc = patches[patchI].faceCells();
|
||||
|
||||
forAll (fc, patchFaceI)
|
||||
{
|
||||
const label curProc = cellToProc_[fc[patchFaceI]];
|
||||
|
||||
// add the face
|
||||
procFaceList[curProc].append(patchStart + patchFaceI);
|
||||
|
||||
// increment the number of faces for this patch
|
||||
procPatchSize_[curProc][patchI]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Face zone treatment. HJ, 27/Mar/2009
|
||||
|
|
|
@ -207,7 +207,13 @@ Foam::autoPtr<Foam::fvMesh> Foam::domainDecomposition::processorMesh
|
|||
}
|
||||
|
||||
// Create processor mesh without a boundary
|
||||
|
||||
Pout<< "RAW MESH: points: " << procPoints.size()
|
||||
<< " faces: " << procFaces.size()
|
||||
<< " owner: " << procOwner.size()
|
||||
<< " procNeighbour: " << procNeighbour.size() << nl
|
||||
<< "curPatchSizes: " << procPatchSize_[procI] << nl
|
||||
<< " curPatchStarts: " << procPatchStartIndex_[procI] << nl
|
||||
<< endl;
|
||||
// Create the mesh
|
||||
autoPtr<fvMesh> procMeshPtr
|
||||
(
|
||||
|
|
|
@ -3162,6 +3162,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::directTopoChange::changeMesh
|
|||
calcFaceZonePointMap(mesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
|
||||
|
||||
|
||||
// Patch reset map is currently dummy
|
||||
// HJ, 23/Apr/2018
|
||||
boolList resetPatchFlag(mesh.boundaryMesh().size(), false);
|
||||
|
||||
return autoPtr<mapPolyMesh>
|
||||
(
|
||||
new mapPolyMesh
|
||||
|
@ -3199,6 +3203,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::directTopoChange::changeMesh
|
|||
faceZoneFaceMap,
|
||||
cellZoneMap,
|
||||
|
||||
resetPatchFlag,
|
||||
|
||||
newPoints, // if empty signals no inflation.
|
||||
oldPatchStarts,
|
||||
oldPatchNMeshPoints,
|
||||
|
@ -3470,6 +3476,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::directTopoChange::makeMesh
|
|||
writeMeshStats(mesh, Pout);
|
||||
}
|
||||
|
||||
// Patch reset map is currently dummy
|
||||
// HJ, 23/Apr/2018
|
||||
boolList resetPatchFlag(mesh.boundaryMesh().size(), false);
|
||||
|
||||
return autoPtr<mapPolyMesh>
|
||||
(
|
||||
new mapPolyMesh
|
||||
|
@ -3507,6 +3517,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::directTopoChange::makeMesh
|
|||
faceZoneFaceMap,
|
||||
cellZoneMap,
|
||||
|
||||
resetPatchFlag,
|
||||
|
||||
newPoints, // if empty signals no inflation.
|
||||
oldPatchStarts,
|
||||
oldPatchNMeshPoints,
|
||||
|
|
|
@ -87,7 +87,7 @@ void Foam::layerAdditionRemoval::addCellLayer
|
|||
{
|
||||
extrusionDir[mpI] = points[ptc[mpI]] - points[mp[mpI]];
|
||||
}
|
||||
extrusionDir *= addDelta_*maxLayerThickness_;
|
||||
extrusionDir *= addDelta_()*maxLayerThickness_;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ void Foam::layerAdditionRemoval::addCellLayer
|
|||
polyAddPoint
|
||||
(
|
||||
points[mp[pointI]] // point
|
||||
// + addDelta_*maxLayerThickness_*extrusionDir[pointI],
|
||||
// + addDelta_()*maxLayerThickness_*extrusionDir[pointI],
|
||||
+ extrusionDir[pointI],
|
||||
mp[pointI], // master point
|
||||
-1, // zone for point
|
||||
|
|
|
@ -48,8 +48,19 @@ namespace Foam
|
|||
}
|
||||
|
||||
|
||||
const Foam::scalar Foam::layerAdditionRemoval::addDelta_ = 0.3;
|
||||
const Foam::scalar Foam::layerAdditionRemoval::removeDelta_ = 0.1;
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::layerAdditionRemoval::motionDelta_
|
||||
(
|
||||
"layerAdditionRemoval::motionDelta",
|
||||
0.01
|
||||
);
|
||||
|
||||
const Foam::debug::tolerancesSwitch
|
||||
Foam::layerAdditionRemoval::addDelta_
|
||||
(
|
||||
"layerAdditionRemoval::addDelta",
|
||||
0.3
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
@ -354,7 +365,12 @@ bool Foam::layerAdditionRemoval::changeTopology() const
|
|||
|
||||
topologicalChange = false;
|
||||
}
|
||||
else if (avgDelta < oldLayerThickness_)
|
||||
// New criterion to avoid round-off triggering layer addition/removal
|
||||
// HJ, 30/Mar/2018
|
||||
else if
|
||||
(
|
||||
(oldLayerThickness_ - avgDelta) > motionDelta_()*minLayerThickness_
|
||||
)
|
||||
{
|
||||
// Layers moving towards removal
|
||||
if (minDelta < minLayerThickness_)
|
||||
|
@ -397,7 +413,12 @@ bool Foam::layerAdditionRemoval::changeTopology() const
|
|||
oldLayerThickness_ = avgDelta;
|
||||
}
|
||||
}
|
||||
else
|
||||
// New criterion to avoid round-off triggering layer addition/removal
|
||||
// HJ, 30/Mar/2018
|
||||
else if
|
||||
(
|
||||
(avgDelta - oldLayerThickness_) > motionDelta_()*minLayerThickness_
|
||||
)
|
||||
{
|
||||
// Layers moving towards addition
|
||||
if (maxDelta > maxLayerThickness_)
|
||||
|
@ -422,6 +443,8 @@ bool Foam::layerAdditionRemoval::changeTopology() const
|
|||
oldLayerThickness_ = avgDelta;
|
||||
}
|
||||
}
|
||||
// else the motion change is smaller than the tolerance and the layer
|
||||
// interface is practically static. HJ, 30/Mar/2018
|
||||
|
||||
return topologicalChange;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ SourceFiles
|
|||
#include "polyMeshModifier.H"
|
||||
#include "primitiveFacePatch.H"
|
||||
#include "ZoneIDs.H"
|
||||
#include "tolerancesSwitch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -128,13 +129,14 @@ class layerAdditionRemoval
|
|||
|
||||
// Static data members
|
||||
|
||||
//- Thickness insertion fraction for the pre-motion
|
||||
static const scalar addDelta_;
|
||||
//- Motion detection fraction: if the motion is smaller than
|
||||
// motionDelta*minLayerThickness_, it is assumed that the mesh is
|
||||
// not layering
|
||||
static const debug::tolerancesSwitch motionDelta_;
|
||||
|
||||
//- Thickness insertion fraction for the pre-motion
|
||||
static const debug::tolerancesSwitch addDelta_;
|
||||
|
||||
//- Thickness removal fraction for the cell collapse
|
||||
// Note: the cell will be collapsed to this relative
|
||||
// thickness before the layer is removed.
|
||||
static const scalar removeDelta_;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -2416,6 +2416,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChanger::changeMesh
|
|||
List<objectMap> facesFromFaces;
|
||||
List<objectMap> cellsFromCells;
|
||||
|
||||
// Patch reset map is currently dummy: does not support change in number
|
||||
// of boundary patches
|
||||
// HJ, 23/Apr/2018
|
||||
boolList resetPatchFlag(boundary.size(), false);
|
||||
|
||||
autoPtr<mapPolyMesh> topoChangeMap
|
||||
(
|
||||
|
@ -2453,6 +2457,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::polyTopoChanger::changeMesh
|
|||
fzFaceRenumber,
|
||||
czRenumber,
|
||||
|
||||
resetPatchFlag,
|
||||
|
||||
newPointsMotion,
|
||||
oldPatchStarts,
|
||||
oldPatchNMeshPoints,
|
||||
|
|
|
@ -4253,6 +4253,11 @@ bool dynamicTopoFvMesh::resetMesh()
|
|||
}
|
||||
}
|
||||
|
||||
// Patch reset map is currently dummy: does not support change
|
||||
// in number of boundary patches
|
||||
// HJ, 23/Apr/2018
|
||||
boolList resetPatchFlag(boundaryMesh().size(), false);
|
||||
|
||||
// Generate new mesh mapping information
|
||||
mapPolyMesh mpm
|
||||
(
|
||||
|
@ -4260,30 +4265,39 @@ bool dynamicTopoFvMesh::resetMesh()
|
|||
nOldPoints_,
|
||||
nOldFaces_,
|
||||
nOldCells_,
|
||||
|
||||
pointMap_,
|
||||
pointsFromPoints_,
|
||||
|
||||
faceMap_,
|
||||
facesFromPoints_,
|
||||
facesFromEdges_,
|
||||
facesFromFaces_,
|
||||
|
||||
cellMap_,
|
||||
cellsFromPoints_,
|
||||
cellsFromEdges_,
|
||||
cellsFromFaces_,
|
||||
cellsFromCells_,
|
||||
|
||||
reversePointMap_,
|
||||
reverseFaceMap_,
|
||||
reverseCellMap_,
|
||||
|
||||
flipFaces_,
|
||||
|
||||
patchPointMap,
|
||||
pointZoneMap,
|
||||
faceZonePointMap,
|
||||
faceZoneFaceMap,
|
||||
cellZoneMap,
|
||||
|
||||
resetPatchFlag,
|
||||
|
||||
preMotionPoints,
|
||||
oldPatchStarts,
|
||||
oldPatchNMeshPoints,
|
||||
true
|
||||
true // Re-use storage
|
||||
);
|
||||
|
||||
// Update the underlying mesh, and map all related fields
|
||||
|
|
|
@ -192,6 +192,7 @@ topoMapper::topoMapper
|
|||
cellMap_(NULL),
|
||||
surfaceMap_(NULL),
|
||||
boundaryMap_(NULL),
|
||||
resetPatchFlag_(mesh.boundaryMesh().size(), false), // Disabled
|
||||
fluxCorrector_(fluxCorrector::New(mesh, dict)),
|
||||
cellVolumesPtr_(NULL),
|
||||
cellCentresPtr_(NULL)
|
||||
|
|
|
@ -69,6 +69,7 @@ class topoMapper
|
|||
typedef Tuple2<word, label> GradientMap;
|
||||
typedef HashTable<GradientMap> GradientTable;
|
||||
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to fvMesh
|
||||
|
@ -77,6 +78,7 @@ class topoMapper
|
|||
//- Reference to the options dictionary
|
||||
const dictionary& dict_;
|
||||
|
||||
|
||||
// Demand-driven private data
|
||||
|
||||
//- Cell mapper
|
||||
|
@ -88,6 +90,10 @@ class topoMapper
|
|||
//- Boundary mapper
|
||||
mutable autoPtr<topoBoundaryMeshMapper> boundaryMap_;
|
||||
|
||||
//- Reset patch flag. Set true for the rebuilt patch (no mapping)
|
||||
// Disabled. HJ, 24/Apr/2018
|
||||
boolList resetPatchFlag_;
|
||||
|
||||
//- Flux corrector
|
||||
mutable autoPtr<fluxCorrector> fluxCorrector_;
|
||||
|
||||
|
@ -118,6 +124,7 @@ class topoMapper
|
|||
mutable labelListList patchSizes_;
|
||||
mutable labelListList patchStarts_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
@ -141,6 +148,7 @@ class topoMapper
|
|||
//- Set geometric information
|
||||
void storeGeometry() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
@ -148,10 +156,11 @@ public:
|
|||
//- Construct from mesh and dictionary
|
||||
topoMapper(const fvMesh& mesh, const dictionary& dict);
|
||||
|
||||
// Destructor
|
||||
|
||||
//- Destructor
|
||||
~topoMapper();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return reference to the mesh
|
||||
|
@ -256,6 +265,12 @@ public:
|
|||
//- Return boundary mapper
|
||||
const topoBoundaryMeshMapper& boundaryMap() const;
|
||||
|
||||
//- Return reset patch flag
|
||||
const boolList& resetPatchFlag() const
|
||||
{
|
||||
return resetPatchFlag_;
|
||||
}
|
||||
|
||||
//- Return flux-corrector
|
||||
const fluxCorrector& surfaceFluxCorrector() const;
|
||||
|
||||
|
|
|
@ -279,9 +279,6 @@ bool Foam::loadBalanceFvMesh::update()
|
|||
// Insert own mesh if there is a piece to insert
|
||||
if (curMigratedCells[Pstream::myProcNo()] > 0)
|
||||
{
|
||||
Pout<< "Inserting local mesh piece, proc " << Pstream::myProcNo()
|
||||
<< endl;
|
||||
|
||||
procMeshes.set
|
||||
(
|
||||
Pstream::myProcNo(),
|
||||
|
@ -293,9 +290,7 @@ bool Foam::loadBalanceFvMesh::update()
|
|||
true // Create passive processor patches
|
||||
)
|
||||
);
|
||||
Pout<< "Local proc mesh: " << Pstream::myProcNo() << nl
|
||||
<< procMeshes[Pstream::myProcNo()].boundaryMesh()
|
||||
<< endl;
|
||||
|
||||
// Set local fields
|
||||
}
|
||||
|
||||
|
@ -334,9 +329,7 @@ bool Foam::loadBalanceFvMesh::update()
|
|||
false // Do not sync
|
||||
)
|
||||
);
|
||||
Pout<< "Received boundary: " << nl
|
||||
<< procMeshes[procI].boundaryMesh()
|
||||
<< endl;
|
||||
|
||||
// Receive the fields
|
||||
}
|
||||
}
|
||||
|
@ -564,10 +557,13 @@ bool Foam::loadBalanceFvMesh::update()
|
|||
resetFvPatchFlag,
|
||||
true // Valid boundary
|
||||
);
|
||||
Pout<< "BMESH: " << boundaryMesh() << endl;
|
||||
|
||||
// To Do: build a reconstructor from addressing data
|
||||
Pout<< nl << nl
|
||||
<< "FINISHED CYCLE" << nl << nl << nl
|
||||
<< endl;
|
||||
|
||||
write();
|
||||
|
||||
// Create field reconstructor
|
||||
// fvFieldReconstructor fieldReconstructor
|
||||
|
|
|
@ -75,7 +75,6 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
|
|||
)
|
||||
{
|
||||
// Zones found. Check topo changer
|
||||
|
||||
if (topoChanger_.empty())
|
||||
{
|
||||
FatalErrorIn
|
||||
|
@ -138,7 +137,6 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Do face zones for slider
|
||||
|
||||
// Inner slider
|
||||
|
@ -242,7 +240,7 @@ void Foam::linearValveLayersFvMesh::addZonesAndModifiers()
|
|||
fz.setSize(nFz);
|
||||
// Cell zones remain unchanged
|
||||
|
||||
Info << "Adding point and face zones" << endl;
|
||||
Info<< "Adding point and face zones" << endl;
|
||||
removeZones();
|
||||
addZones(pz, fz, cz);
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ Foam::faMeshMapper::faMeshMapper
|
|||
oldPatchEdgeFaces_(mesh.boundary().size()),
|
||||
areaMap_(mesh, mpm),
|
||||
edgeMap_(mesh, mpm),
|
||||
boundaryMap_(mesh, mpm)
|
||||
boundaryMap_(mesh, mpm),
|
||||
resetPatchFlag_(mesh.boundary().size(), false) // Disabled
|
||||
{
|
||||
// Capture old patch information
|
||||
const faBoundaryMesh& patches = mesh.boundary();
|
||||
|
|
|
@ -103,6 +103,10 @@ class faMeshMapper
|
|||
//- Boundary mapper
|
||||
faBoundaryMeshMapper boundaryMap_;
|
||||
|
||||
//- Reset patch flag. Set true for the rebuilt patch (no mapping)
|
||||
//- Disabled. HJ, 24/Apr/2018
|
||||
boolList resetPatchFlag_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
@ -201,6 +205,13 @@ public:
|
|||
{
|
||||
return boundaryMap_;
|
||||
}
|
||||
|
||||
//- Return reset patch flag
|
||||
//- Disabled. HJ, 24/Apr/2018
|
||||
const boolList& resetPatchFlag() const
|
||||
{
|
||||
return resetPatchFlag_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -422,16 +422,11 @@ void Foam::fvMesh::resetFvPrimitives
|
|||
validBoundary
|
||||
);
|
||||
|
||||
// Reset fvPatches HJ, 16/Apr/2018
|
||||
boundary_.resetFvPatches(resetFvPatchFlag);
|
||||
surfaceInterpolation::clearOut();
|
||||
clearGeomNotOldVol();
|
||||
|
||||
// Reset fvPatches? HJ, 16/Apr/2018
|
||||
|
||||
// Clear LDU
|
||||
clearAddressing();
|
||||
|
||||
// Clear cell volumes?
|
||||
// Clear all mesh data
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -73,6 +73,9 @@ class fvMeshMapper
|
|||
//- Boundary mapper
|
||||
fvBoundaryMeshMapper boundaryMap_;
|
||||
|
||||
//- Reset patch flag. Set true for the rebuilt patch (no mapping)
|
||||
boolList resetPatchFlag_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
@ -130,6 +133,12 @@ public:
|
|||
{
|
||||
return boundaryMap_;
|
||||
}
|
||||
|
||||
//- Return reset patch flag
|
||||
const boolList& resetPatchFlag() const
|
||||
{
|
||||
return resetPatchFlag_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ License
|
|||
|
||||
Class
|
||||
Foam::MapInternalField
|
||||
Foam::MapGeometricFields
|
||||
|
||||
Description
|
||||
Generic internal field mapper. For "real" mapping, add template
|
||||
|
@ -131,17 +132,72 @@ void MapGeometricFields
|
|||
mapper
|
||||
);
|
||||
|
||||
// Map the patch fields
|
||||
forAll (field.boundaryField(), patchi)
|
||||
{
|
||||
// Cannot check sizes for patch fields because of
|
||||
// empty fields in FV and because point fields get their size
|
||||
// from the patch which has already been resized
|
||||
|
||||
field.boundaryField()[patchi].autoMap
|
||||
// Repatch boundary if needed
|
||||
if
|
||||
(
|
||||
mapper.boundaryMap()[patchi]
|
||||
field.boundaryField().size()
|
||||
!= mapper.mesh().boundary().size()
|
||||
)
|
||||
{
|
||||
if (polyMesh::debug)
|
||||
{
|
||||
InfoIn("void MapGeometricFields(const MeshMapper& mapper)")
|
||||
<< "Resizing boundary field for "
|
||||
<< field.typeName << ' ' << field.name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
field.boundaryField().setSize(mapper.mesh().boundary().size());
|
||||
}
|
||||
|
||||
// Get repatch flag
|
||||
const boolList& resetPatchFlag = mapper.resetPatchFlag();
|
||||
|
||||
if (resetPatchFlag.size() != field.boundaryField().size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void MapGeometricFields(const MeshMapper& mapper)"
|
||||
) << "Incorrect resetPatchFlag array size. Boundary: "
|
||||
<< field.boundaryField().size() << " flag: "
|
||||
<< resetPatchFlag.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Map the patch fields
|
||||
forAll (field.boundaryField(), patchI)
|
||||
{
|
||||
// Flag reset can only take place for the constrained patches
|
||||
// such as empty or processor
|
||||
if (resetPatchFlag[patchI])
|
||||
{
|
||||
// Build a new patchField if reset is true
|
||||
field.boundaryField().set
|
||||
(
|
||||
patchI,
|
||||
PatchField<Type>::New
|
||||
(
|
||||
mapper.mesh().boundary()[patchI].type(),
|
||||
field.mesh().boundary()[patchI],
|
||||
field.dimensionedInternalField()
|
||||
)
|
||||
);
|
||||
|
||||
// Set to zero to avoid NaNs?
|
||||
}
|
||||
else
|
||||
{
|
||||
// No reset: auto-map
|
||||
|
||||
// Cannot check sizes for patch fields because of
|
||||
// empty fields in FV and because point fields get
|
||||
// their size from the patch which has already been resized
|
||||
|
||||
field.boundaryField()[patchI].autoMap
|
||||
(
|
||||
mapper.boundaryMap()[patchI]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
field.instance() = field.time().timeName();
|
||||
|
|
|
@ -36,6 +36,7 @@ SourceFiles
|
|||
#ifndef pointMeshMapper_H
|
||||
#define pointMeshMapper_H
|
||||
|
||||
#include "mapPolyMesh.H"
|
||||
#include "pointMapper.H"
|
||||
#include "pointBoundaryMeshMapper.H"
|
||||
|
||||
|
@ -65,6 +66,9 @@ class pointMeshMapper
|
|||
//- Boundary mapper
|
||||
pointBoundaryMeshMapper boundaryMap_;
|
||||
|
||||
//- Reset patch flag. Set true for the rebuilt patch (no mapping)
|
||||
boolList resetPatchFlag_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
@ -84,7 +88,8 @@ public:
|
|||
:
|
||||
mesh_(mesh),
|
||||
pointMap_(mpm),
|
||||
boundaryMap_(mesh, pointMap_, mpm)
|
||||
boundaryMap_(mesh, pointMap_, mpm),
|
||||
resetPatchFlag_(mpm.resetPatchFlag())
|
||||
{}
|
||||
|
||||
|
||||
|
@ -115,6 +120,12 @@ public:
|
|||
{
|
||||
return boundaryMap_;
|
||||
}
|
||||
|
||||
//- Return reset patch flag
|
||||
const boolList& resetPatchFlag() const
|
||||
{
|
||||
return resetPatchFlag_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ Foam::mapPolyMesh::mapPolyMesh
|
|||
const labelListList& faceZonePointMap,
|
||||
const labelListList& faceZoneFaceMap,
|
||||
const labelListList& cellZoneMap,
|
||||
const boolList& resetPatchFlag,
|
||||
const pointField& preMotionPoints,
|
||||
const labelList& oldPatchStarts,
|
||||
const labelList& oldPatchNMeshPoints
|
||||
|
@ -99,6 +100,7 @@ Foam::mapPolyMesh::mapPolyMesh
|
|||
faceZonePointMap_(faceZonePointMap),
|
||||
faceZoneFaceMap_(faceZoneFaceMap),
|
||||
cellZoneMap_(cellZoneMap),
|
||||
resetPatchFlag_(resetPatchFlag),
|
||||
preMotionPoints_(preMotionPoints),
|
||||
oldPatchSizes_(oldPatchStarts.size()),
|
||||
oldPatchStarts_(oldPatchStarts),
|
||||
|
@ -155,6 +157,7 @@ Foam::mapPolyMesh::mapPolyMesh
|
|||
labelListList& faceZonePointMap,
|
||||
labelListList& faceZoneFaceMap,
|
||||
labelListList& cellZoneMap,
|
||||
boolList& resetPatchFlag,
|
||||
pointField& preMotionPoints,
|
||||
labelList& oldPatchStarts,
|
||||
labelList& oldPatchNMeshPoints,
|
||||
|
@ -186,6 +189,7 @@ Foam::mapPolyMesh::mapPolyMesh
|
|||
faceZonePointMap_(faceZonePointMap, reUse),
|
||||
faceZoneFaceMap_(faceZoneFaceMap, reUse),
|
||||
cellZoneMap_(cellZoneMap, reUse),
|
||||
resetPatchFlag_(resetPatchFlag, reUse),
|
||||
preMotionPoints_(preMotionPoints, reUse),
|
||||
oldPatchSizes_(oldPatchStarts.size()),
|
||||
oldPatchStarts_(oldPatchStarts, reUse),
|
||||
|
|
|
@ -139,6 +139,7 @@ SourceFiles
|
|||
#ifndef mapPolyMesh_H
|
||||
#define mapPolyMesh_H
|
||||
|
||||
#include "boolList.H"
|
||||
#include "labelList.H"
|
||||
#include "objectMap.H"
|
||||
#include "pointField.H"
|
||||
|
@ -259,6 +260,10 @@ class mapPolyMesh
|
|||
// For added cells, the index is set to -1
|
||||
const labelListList cellZoneMap_;
|
||||
|
||||
//- Reset patch flag
|
||||
// True for the rebuilt patch (no mapping)
|
||||
boolList resetPatchFlag_;
|
||||
|
||||
//- Pre-motion point positions.
|
||||
// This specifies the correct way of blowing up zero-volume objects
|
||||
const pointField preMotionPoints_;
|
||||
|
@ -296,26 +301,36 @@ public:
|
|||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
|
||||
const labelList& pointMap,
|
||||
const List<objectMap>& pointsFromPoints,
|
||||
|
||||
const labelList& faceMap,
|
||||
const List<objectMap>& facesFromPoints,
|
||||
const List<objectMap>& facesFromEdges,
|
||||
const List<objectMap>& facesFromFaces,
|
||||
|
||||
const labelList& cellMap,
|
||||
const List<objectMap>& cellsFromPoints,
|
||||
const List<objectMap>& cellsFromEdges,
|
||||
const List<objectMap>& cellsFromFaces,
|
||||
const List<objectMap>& cellsFromCells,
|
||||
|
||||
const labelList& reversePointMap,
|
||||
const labelList& reverseFaceMap,
|
||||
const labelList& reverseCellMap,
|
||||
|
||||
const labelHashSet& flipFaceFlux,
|
||||
|
||||
const labelListList& patchPointMap,
|
||||
|
||||
const labelListList& pointZoneMap,
|
||||
const labelListList& faceZonePointMap,
|
||||
const labelListList& faceZoneFaceMap,
|
||||
const labelListList& cellZoneMap,
|
||||
|
||||
const boolList& resetPatchFlag,
|
||||
|
||||
const pointField& preMotionPoints,
|
||||
const labelList& oldPatchStarts,
|
||||
const labelList& oldPatchNMeshPoints
|
||||
|
@ -328,26 +343,36 @@ public:
|
|||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
|
||||
labelList& pointMap,
|
||||
List<objectMap>& pointsFromPoints,
|
||||
|
||||
labelList& faceMap,
|
||||
List<objectMap>& facesFromPoints,
|
||||
List<objectMap>& facesFromEdges,
|
||||
List<objectMap>& facesFromFaces,
|
||||
|
||||
labelList& cellMap,
|
||||
List<objectMap>& cellsFromPoints,
|
||||
List<objectMap>& cellsFromEdges,
|
||||
List<objectMap>& cellsFromFaces,
|
||||
List<objectMap>& cellsFromCells,
|
||||
|
||||
labelList& reversePointMap,
|
||||
labelList& reverseFaceMap,
|
||||
labelList& reverseCellMap,
|
||||
|
||||
labelHashSet& flipFaceFlux,
|
||||
|
||||
labelListList& patchPointMap,
|
||||
|
||||
labelListList& pointZoneMap,
|
||||
labelListList& faceZonePointMap,
|
||||
labelListList& faceZoneFaceMap,
|
||||
labelListList& cellZoneMap,
|
||||
|
||||
boolList& resetPatchFlag,
|
||||
|
||||
pointField& preMotionPoints,
|
||||
labelList& oldPatchStarts,
|
||||
labelList& oldPatchNMeshPoints,
|
||||
|
@ -616,6 +641,14 @@ public:
|
|||
return cellZoneMap_;
|
||||
}
|
||||
|
||||
//- Reset patch flag
|
||||
// True for the rebuilt patch (no mapping)
|
||||
const boolList& resetPatchFlag() const
|
||||
{
|
||||
return resetPatchFlag_;
|
||||
}
|
||||
|
||||
|
||||
//- Pre-motion point positions.
|
||||
// This specifies the correct way of blowing up
|
||||
// zero-volume objects
|
||||
|
|
|
@ -751,7 +751,6 @@ void Foam::polyMesh::resetPrimitives
|
|||
|
||||
|
||||
// Reset patch sizes and starts
|
||||
Pout<< "Resetting patches: starts: " << patchStarts << endl;
|
||||
forAll (boundary_, patchI)
|
||||
{
|
||||
boundary_[patchI].resetPatch
|
||||
|
@ -1294,65 +1293,9 @@ const Foam::globalMeshData& Foam::polyMesh::globalData() const
|
|||
<< "Constructing parallelData from processor topology"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Construct globalMeshData using processorPatch information only.
|
||||
globalMeshDataPtr_ = new globalMeshData(*this);
|
||||
|
||||
// Old method. HJ, 6/Dec/2006
|
||||
|
||||
// // Check for parallel boundaries
|
||||
// bool parBoundaries = false;
|
||||
|
||||
// forAll (boundaryMesh(), patchI)
|
||||
// {
|
||||
// if
|
||||
// (
|
||||
// typeid(boundaryMesh()[patchI])
|
||||
// == typeid(processorPolyPatch)
|
||||
// )
|
||||
// {
|
||||
// parBoundaries = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (parBoundaries)
|
||||
// {
|
||||
// // All is well - read the parallel data
|
||||
|
||||
// globalDataPtr_ =
|
||||
// new globalMeshData
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "globalData",
|
||||
// time().findInstance(meshDir(), "globalData"),
|
||||
// meshSubDir,
|
||||
// *this,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// ),
|
||||
// *this
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // The mesh has no parallel boundaries. Create and hook a
|
||||
// // "non-parallel" parallel info
|
||||
// globalDataPtr_ =
|
||||
// new globalMeshData
|
||||
// (
|
||||
// *this,
|
||||
// false,
|
||||
// false, // cyclicParallel. Remove when fixed
|
||||
// nPoints(),
|
||||
// nFaces(),
|
||||
// nCells(),
|
||||
// 0,
|
||||
// labelList(0),
|
||||
// labelList(0),
|
||||
// labelList(0)
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
return *globalMeshDataPtr_;
|
||||
|
|
|
@ -604,8 +604,6 @@ void Foam::polyPatch::resetPatch
|
|||
boundaryMesh_.mesh().allPoints()
|
||||
)
|
||||
);
|
||||
|
||||
Pout<< "Patch reset: faceCells: " << faceCells() << endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ SourceFiles
|
|||
#define tetPolyMeshMapper_H
|
||||
|
||||
#include "tetPointMapper.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "pointMapper.H"
|
||||
#include "faceMapper.H"
|
||||
#include "cellMapper.H"
|
||||
|
@ -76,6 +77,9 @@ class tetPolyMeshMapper
|
|||
//- Boundary mapper
|
||||
tetPolyBoundaryMapper boundaryMap_;
|
||||
|
||||
//- Reset patch flag. Set true for the rebuilt patch (no mapping)
|
||||
boolList resetPatchFlag_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
@ -94,15 +98,16 @@ public:
|
|||
tetPolyMeshMapper
|
||||
(
|
||||
const tetPolyMesh& mesh,
|
||||
const mapPolyMesh& meshMap
|
||||
const mapPolyMesh& mpm
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
pointMap_(meshMap),
|
||||
faceMap_(meshMap),
|
||||
cellMap_(meshMap),
|
||||
tetPointMap_(mesh, meshMap, pointMap_, faceMap_, cellMap_),
|
||||
boundaryMap_(mesh, meshMap, pointMap_, faceMap_)
|
||||
pointMap_(mpm),
|
||||
faceMap_(mpm),
|
||||
cellMap_(mpm),
|
||||
tetPointMap_(mesh, mpm, pointMap_, faceMap_, cellMap_),
|
||||
boundaryMap_(mesh, mpm, pointMap_, faceMap_),
|
||||
resetPatchFlag_(mpm.resetPatchFlag())
|
||||
{}
|
||||
|
||||
|
||||
|
@ -138,6 +143,12 @@ public:
|
|||
{
|
||||
return boundaryMap_;
|
||||
}
|
||||
|
||||
//- Return reset patch flag
|
||||
const boolList& resetPatchFlag() const
|
||||
{
|
||||
return resetPatchFlag_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
Reference in a new issue