mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
making stitchMesh,mergePatchPairs work
This commit is contained in:
@ -243,14 +243,7 @@ int main(int argc, char *argv[])
|
|||||||
meshDict.lookup("mergePatchPairs")
|
meshDict.lookup("mergePatchPairs")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mergePatchPairs.size())
|
# include "mergePatchPairs.H"
|
||||||
{
|
|
||||||
FatalErrorIn(args.executable())
|
|
||||||
<< "mergePatchPairs not currently supported."
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
//// #include "mergePatchPairs.H"
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -63,6 +63,7 @@ Description
|
|||||||
#include "slidingInterface.H"
|
#include "slidingInterface.H"
|
||||||
#include "perfectInterface.H"
|
#include "perfectInterface.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
|
#include "ReadFields.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -90,34 +91,6 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read field
|
|
||||||
template<class GeoField>
|
|
||||||
void readFields
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const IOobjectList& objects,
|
|
||||||
PtrList<GeoField>& fields
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Search list of objects for volScalarFields
|
|
||||||
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
|
|
||||||
|
|
||||||
// Construct the vol scalar fields
|
|
||||||
fields.setSize(fieldObjects.size());
|
|
||||||
|
|
||||||
label fieldi = 0;
|
|
||||||
for
|
|
||||||
(
|
|
||||||
IOobjectList::iterator iter = fieldObjects.begin();
|
|
||||||
iter != fieldObjects.end();
|
|
||||||
++iter
|
|
||||||
)
|
|
||||||
{
|
|
||||||
fields.set(fieldi++, new GeoField(*iter(), mesh));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@ -343,7 +316,8 @@ int main(int argc, char *argv[])
|
|||||||
cutZoneName,
|
cutZoneName,
|
||||||
masterPatchName,
|
masterPatchName,
|
||||||
slavePatchName,
|
slavePatchName,
|
||||||
tom // integral or partial
|
tom, // integral or partial
|
||||||
|
true // couple/decouple mode
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -355,30 +329,30 @@ int main(int argc, char *argv[])
|
|||||||
// Read all current fvFields so they will get mapped
|
// Read all current fvFields so they will get mapped
|
||||||
Info<< "Reading all current volfields" << endl;
|
Info<< "Reading all current volfields" << endl;
|
||||||
PtrList<volScalarField> volScalarFields;
|
PtrList<volScalarField> volScalarFields;
|
||||||
readFields(mesh, objects, volScalarFields);
|
ReadFields(mesh, objects, volScalarFields);
|
||||||
|
|
||||||
PtrList<volVectorField> volVectorFields;
|
PtrList<volVectorField> volVectorFields;
|
||||||
readFields(mesh, objects, volVectorFields);
|
ReadFields(mesh, objects, volVectorFields);
|
||||||
|
|
||||||
PtrList<volSphericalTensorField> volSphericalTensorFields;
|
PtrList<volSphericalTensorField> volSphericalTensorFields;
|
||||||
readFields(mesh, objects, volSphericalTensorFields);
|
ReadFields(mesh, objects, volSphericalTensorFields);
|
||||||
|
|
||||||
PtrList<volSymmTensorField> volSymmTensorFields;
|
PtrList<volSymmTensorField> volSymmTensorFields;
|
||||||
readFields(mesh, objects, volSymmTensorFields);
|
ReadFields(mesh, objects, volSymmTensorFields);
|
||||||
|
|
||||||
PtrList<volTensorField> volTensorFields;
|
PtrList<volTensorField> volTensorFields;
|
||||||
readFields(mesh, objects, volTensorFields);
|
ReadFields(mesh, objects, volTensorFields);
|
||||||
|
|
||||||
//- uncomment if you want to interpolate surface fields (usually bad idea)
|
//- uncomment if you want to interpolate surface fields (usually bad idea)
|
||||||
//Info<< "Reading all current surfaceFields" << endl;
|
//Info<< "Reading all current surfaceFields" << endl;
|
||||||
//PtrList<surfaceScalarField> surfaceScalarFields;
|
//PtrList<surfaceScalarField> surfaceScalarFields;
|
||||||
//readFields(mesh, objects, surfaceScalarFields);
|
//ReadFields(mesh, objects, surfaceScalarFields);
|
||||||
//
|
//
|
||||||
//PtrList<surfaceVectorField> surfaceVectorFields;
|
//PtrList<surfaceVectorField> surfaceVectorFields;
|
||||||
//readFields(mesh, objects, surfaceVectorFields);
|
//ReadFields(mesh, objects, surfaceVectorFields);
|
||||||
//
|
//
|
||||||
//PtrList<surfaceTensorField> surfaceTensorFields;
|
//PtrList<surfaceTensorField> surfaceTensorFields;
|
||||||
//readFields(mesh, objects, surfaceTensorFields);
|
//ReadFields(mesh, objects, surfaceTensorFields);
|
||||||
|
|
||||||
if (!overwrite)
|
if (!overwrite)
|
||||||
{
|
{
|
||||||
@ -394,11 +368,22 @@ int main(int argc, char *argv[])
|
|||||||
if (overwrite)
|
if (overwrite)
|
||||||
{
|
{
|
||||||
mesh.setInstance(oldInstance);
|
mesh.setInstance(oldInstance);
|
||||||
|
stitcher.instance() = oldInstance;
|
||||||
}
|
}
|
||||||
Info << nl << "Writing polyMesh to time " << runTime.timeName() << endl;
|
Info << nl << "Writing polyMesh to time " << runTime.timeName() << endl;
|
||||||
|
|
||||||
IOstream::defaultPrecision(10);
|
IOstream::defaultPrecision(10);
|
||||||
if (!mesh.write())
|
|
||||||
|
// Bypass runTime write (since only writes at outputTime)
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!runTime.objectRegistry::writeObject
|
||||||
|
(
|
||||||
|
runTime.writeFormat(),
|
||||||
|
IOstream::currentVersion,
|
||||||
|
runTime.writeCompression()
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
<< "Failed writing polyMesh."
|
<< "Failed writing polyMesh."
|
||||||
|
|||||||
@ -35,9 +35,11 @@ License
|
|||||||
#include "plane.H"
|
#include "plane.H"
|
||||||
#include "polyTopoChanger.H"
|
#include "polyTopoChanger.H"
|
||||||
#include "polyAddPoint.H"
|
#include "polyAddPoint.H"
|
||||||
|
#include "polyRemovePoint.H"
|
||||||
#include "polyAddFace.H"
|
#include "polyAddFace.H"
|
||||||
#include "polyModifyPoint.H"
|
#include "polyModifyPoint.H"
|
||||||
#include "polyModifyFace.H"
|
#include "polyModifyFace.H"
|
||||||
|
#include "polyRemoveFace.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -765,6 +767,9 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
projectedSlavePoints
|
projectedSlavePoints
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Demand driven calculate the cut faces. Apart from the
|
||||||
|
// cutFaces/cutFaceMaster/cutFaceSlave no information from the cutPatch
|
||||||
|
// is used anymore!
|
||||||
const faceList& cutFaces = cutPatch.cutFaces();
|
const faceList& cutFaces = cutPatch.cutFaces();
|
||||||
const labelList& cutFaceMaster = cutPatch.cutFaceMaster();
|
const labelList& cutFaceMaster = cutPatch.cutFaceMaster();
|
||||||
const labelList& cutFaceSlave = cutPatch.cutFaceSlave();
|
const labelList& cutFaceSlave = cutPatch.cutFaceSlave();
|
||||||
@ -1109,22 +1114,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
{
|
{
|
||||||
nOrphanedMasters++;
|
nOrphanedMasters++;
|
||||||
|
|
||||||
// Recover original orientation
|
//// Recover original orientation
|
||||||
ref.setAction
|
//ref.setAction
|
||||||
(
|
//(
|
||||||
polyModifyFace
|
// polyModifyFace
|
||||||
(
|
// (
|
||||||
masterPatch[faceI], // new face
|
// masterPatch[faceI], // new face
|
||||||
masterPatchAddr[faceI], // master face index
|
// masterPatchAddr[faceI], // master face index
|
||||||
-1, // owner
|
// -1, // owner
|
||||||
-1, // neighbour
|
// -1, // neighbour
|
||||||
false, // flux flip
|
// false, // flux flip
|
||||||
-1, // patch ID
|
// -1, // patch ID
|
||||||
false, // remove from zone
|
// false, // remove from zone
|
||||||
masterFaceZoneID_.index(), // zone ID
|
// masterFaceZoneID_.index(), // zone ID
|
||||||
false // zone flip
|
// false // zone flip
|
||||||
)
|
// )
|
||||||
);
|
//);
|
||||||
|
|
||||||
|
//Pout<< "**MJ:deleting master face " << masterPatchAddr[faceI]
|
||||||
|
// << " old verts:" << masterPatch[faceI] << endl;
|
||||||
|
ref.setAction(polyRemoveFace(masterPatchAddr[faceI]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1136,22 +1145,26 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
{
|
{
|
||||||
nOrphanedSlaves++;
|
nOrphanedSlaves++;
|
||||||
|
|
||||||
// Recover original orientation
|
//// Recover original orientation
|
||||||
ref.setAction
|
//ref.setAction
|
||||||
(
|
//(
|
||||||
polyModifyFace
|
// polyModifyFace
|
||||||
(
|
// (
|
||||||
slavePatch[faceI], // new face
|
// slavePatch[faceI], // new face
|
||||||
slavePatchAddr[faceI], // slave face index
|
// slavePatchAddr[faceI], // slave face index
|
||||||
-1, // owner
|
// -1, // owner
|
||||||
-1, // neighbour
|
// -1, // neighbour
|
||||||
false, // flux flip
|
// false, // flux flip
|
||||||
-1, // patch ID
|
// -1, // patch ID
|
||||||
false, // remove from zone
|
// false, // remove from zone
|
||||||
slaveFaceZoneID_.index(), // zone ID
|
// slaveFaceZoneID_.index(), // zone ID
|
||||||
false // zone flip
|
// false // zone flip
|
||||||
)
|
// )
|
||||||
);
|
//);
|
||||||
|
|
||||||
|
//Pout<< "**MJ:deleting slave face " << slavePatchAddr[faceI]
|
||||||
|
// << " old verts:" << slavePatch[faceI] << endl;
|
||||||
|
ref.setAction(polyRemoveFace(slavePatchAddr[faceI]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1400,9 +1413,12 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
face newFace;
|
face newFace;
|
||||||
newFace.transfer(newFaceLabels);
|
newFace.transfer(newFaceLabels);
|
||||||
|
|
||||||
// Pout << "Modifying master stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
|
//Pout << "Modifying master stick-out face " << curFaceID
|
||||||
|
// << " old face: " << oldFace << " new face: " << newFace << endl;
|
||||||
|
|
||||||
// Modify the face
|
// Modify the face
|
||||||
|
if (mesh.isInternalFace(curFaceID))
|
||||||
|
{
|
||||||
ref.setAction
|
ref.setAction
|
||||||
(
|
(
|
||||||
polyModifyFace
|
polyModifyFace
|
||||||
@ -1412,6 +1428,24 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
own[curFaceID], // owner
|
own[curFaceID], // owner
|
||||||
nei[curFaceID], // neighbour
|
nei[curFaceID], // neighbour
|
||||||
false, // face flip
|
false, // face flip
|
||||||
|
-1, // patch for face
|
||||||
|
false, // remove from zone
|
||||||
|
modifiedFaceZone, // zone for face
|
||||||
|
modifiedFaceZoneFlip // face flip in zone
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ref.setAction
|
||||||
|
(
|
||||||
|
polyModifyFace
|
||||||
|
(
|
||||||
|
newFace, // modified face
|
||||||
|
curFaceID, // label of face being modified
|
||||||
|
own[curFaceID], // owner
|
||||||
|
-1, // neighbour
|
||||||
|
false, // face flip
|
||||||
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
|
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
|
||||||
false, // remove from zone
|
false, // remove from zone
|
||||||
modifiedFaceZone, // zone for face
|
modifiedFaceZone, // zone for face
|
||||||
@ -1420,6 +1454,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pout << "Finished master side" << endl;
|
// Pout << "Finished master side" << endl;
|
||||||
|
|
||||||
@ -1688,6 +1723,8 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
|
// Pout << "Modifying slave stick-out face " << curFaceID << " old face: " << oldFace << " new face: " << newFace << endl;
|
||||||
|
|
||||||
// Modify the face
|
// Modify the face
|
||||||
|
if (mesh.isInternalFace(curFaceID))
|
||||||
|
{
|
||||||
ref.setAction
|
ref.setAction
|
||||||
(
|
(
|
||||||
polyModifyFace
|
polyModifyFace
|
||||||
@ -1697,6 +1734,24 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
own[curFaceID], // owner
|
own[curFaceID], // owner
|
||||||
nei[curFaceID], // neighbour
|
nei[curFaceID], // neighbour
|
||||||
false, // face flip
|
false, // face flip
|
||||||
|
-1, // patch for face
|
||||||
|
false, // remove from zone
|
||||||
|
modifiedFaceZone, // zone for face
|
||||||
|
modifiedFaceZoneFlip // face flip in zone
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ref.setAction
|
||||||
|
(
|
||||||
|
polyModifyFace
|
||||||
|
(
|
||||||
|
newFace, // modified face
|
||||||
|
curFaceID, // label of face being modified
|
||||||
|
own[curFaceID], // owner
|
||||||
|
-1, // neighbour
|
||||||
|
false, // face flip
|
||||||
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
|
mesh.boundaryMesh().whichPatch(curFaceID), // patch for face
|
||||||
false, // remove from zone
|
false, // remove from zone
|
||||||
modifiedFaceZone, // zone for face
|
modifiedFaceZone, // zone for face
|
||||||
@ -1705,6 +1760,7 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Activate and retire slave patch points
|
// Activate and retire slave patch points
|
||||||
// This needs to be done last, so that the map of removed points
|
// This needs to be done last, so that the map of removed points
|
||||||
@ -1735,15 +1791,25 @@ void Foam::slidingInterface::coupleInterface(polyTopoChange& ref) const
|
|||||||
// slave patch
|
// slave patch
|
||||||
nRetiredPoints++;
|
nRetiredPoints++;
|
||||||
|
|
||||||
|
//ref.setAction
|
||||||
|
//(
|
||||||
|
// polyModifyPoint
|
||||||
|
// (
|
||||||
|
// slaveMeshPoints[pointI], // point ID
|
||||||
|
// points[slaveMeshPoints[pointI]], // point
|
||||||
|
// false, // remove from zone
|
||||||
|
// mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone
|
||||||
|
// false // in a cell
|
||||||
|
// )
|
||||||
|
//);
|
||||||
|
//Pout<< "MJ retire slave point " << slaveMeshPoints[pointI]
|
||||||
|
// << " coord " << points[slaveMeshPoints[pointI]]
|
||||||
|
// << endl;
|
||||||
ref.setAction
|
ref.setAction
|
||||||
(
|
(
|
||||||
polyModifyPoint
|
polyRemovePoint
|
||||||
(
|
(
|
||||||
slaveMeshPoints[pointI], // point ID
|
slaveMeshPoints[pointI]
|
||||||
points[slaveMeshPoints[pointI]], // point
|
|
||||||
false, // remove from zone
|
|
||||||
mesh.pointZones().whichZone(slaveMeshPoints[pointI]),// zone
|
|
||||||
false // in a cell
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,8 @@ Description
|
|||||||
|
|
||||||
#include "enrichedPatch.H"
|
#include "enrichedPatch.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "meshTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -249,6 +251,33 @@ bool Foam::enrichedPatch::checkSupport() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::enrichedPatch::writeOBJ(const fileName& fName) const
|
||||||
|
{
|
||||||
|
OFstream str(fName);
|
||||||
|
|
||||||
|
const pointField& lp = localPoints();
|
||||||
|
|
||||||
|
forAll(lp, pointI)
|
||||||
|
{
|
||||||
|
meshTools::writeOBJ(str, lp[pointI]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const faceList& faces = localFaces();
|
||||||
|
|
||||||
|
forAll(faces, faceI)
|
||||||
|
{
|
||||||
|
const face& f = faces[faceI];
|
||||||
|
|
||||||
|
str << 'f';
|
||||||
|
forAll(f, fp)
|
||||||
|
{
|
||||||
|
str << ' ' << f[fp]+1;
|
||||||
|
}
|
||||||
|
str << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -199,9 +199,9 @@ public:
|
|||||||
(
|
(
|
||||||
const primitiveFacePatch& masterPatch,
|
const primitiveFacePatch& masterPatch,
|
||||||
const primitiveFacePatch& slavePatch,
|
const primitiveFacePatch& slavePatch,
|
||||||
const labelList& slavePointPointHits,
|
const labelList& slavePointPointHits,// -1 or common point snapped to
|
||||||
const labelList& slavePointEdgeHits,
|
const labelList& slavePointEdgeHits, // -1 or common edge snapped to
|
||||||
const List<objectHit>& slavePointFaceHits
|
const List<objectHit>& slavePointFaceHits // master face snapped to
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -276,6 +276,10 @@ public:
|
|||||||
|
|
||||||
//- Check if the patch is fully supported
|
//- Check if the patch is fully supported
|
||||||
bool checkSupport() const;
|
bool checkSupport() const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Debugging: dump graphical representation to obj format file
|
||||||
|
void writeOBJ(const fileName&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -664,14 +664,15 @@ void Foam::slidingInterface::updateMesh(const mapPolyMesh& m)
|
|||||||
masterPatchID_.update(mesh.boundaryMesh());
|
masterPatchID_.update(mesh.boundaryMesh());
|
||||||
slavePatchID_.update(mesh.boundaryMesh());
|
slavePatchID_.update(mesh.boundaryMesh());
|
||||||
|
|
||||||
if (!attached())
|
//MJ:Disabled updating
|
||||||
{
|
// if (!attached())
|
||||||
calcAttachedAddressing();
|
// {
|
||||||
}
|
// calcAttachedAddressing();
|
||||||
else
|
// }
|
||||||
{
|
// else
|
||||||
renumberAttachedAddressing(m);
|
// {
|
||||||
}
|
// renumberAttachedAddressing(m);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user