Stitching sliding interfaces around corners. Zeljko Tukovic

This commit is contained in:
Hrvoje Jasak 2014-05-05 20:00:32 +01:00
parent 56f871cfdb
commit 7832d77bf2
2 changed files with 54 additions and 12 deletions

View file

@ -64,7 +64,6 @@ Description
#include "IOobjectList.H" #include "IOobjectList.H"
#include "ReadFields.H" #include "ReadFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Checks whether patch present // Checks whether patch present
@ -101,7 +100,7 @@ int main(int argc, char *argv[])
Foam::argList::validOptions.insert("partial", ""); Foam::argList::validOptions.insert("partial", "");
Foam::argList::validOptions.insert("perfect", ""); Foam::argList::validOptions.insert("perfect", "");
Foam::argList::validOptions.insert("clearUnusedFaces", "");
Foam::argList::validOptions.insert("overwrite", ""); Foam::argList::validOptions.insert("overwrite", "");
# include "setRootCase.H" # include "setRootCase.H"
@ -116,6 +115,7 @@ int main(int argc, char *argv[])
bool partialCover = args.optionFound("partial"); bool partialCover = args.optionFound("partial");
bool perfectCover = args.optionFound("perfect"); bool perfectCover = args.optionFound("perfect");
bool clearUnusedFaces = args.optionFound("clearUnusedFaces");
bool overwrite = args.optionFound("overwrite"); bool overwrite = args.optionFound("overwrite");
if (partialCover && perfectCover) if (partialCover && perfectCover)
@ -364,6 +364,45 @@ int main(int argc, char *argv[])
mesh.movePoints(morphMap->preMotionPoints()); mesh.movePoints(morphMap->preMotionPoints());
if (clearUnusedFaces)
{
// Clear unused points and faces by manually resetting the list"
Info << "Clear unused points and faces" << nl << endl;
pointField& p = const_cast<pointField&>(mesh.allPoints());
p.setSize(mesh.nPoints());
faceList& f = const_cast<faceList&>(mesh.allFaces());
f.setSize(mesh.nFaces());
Xfer<pointField> pXfer(p);
Xfer<faceList> fXfer(f);
Xfer<labelList> ownXfer(mesh.faceOwner());
Xfer<labelList> neiXfer(mesh.faceNeighbour());
label nPatches = mesh.boundaryMesh().size();
labelList patchSizes(nPatches, 0);
labelList patchStarts(nPatches, -1);
forAll(patchSizes, patchI)
{
patchSizes[patchI] = mesh.boundaryMesh()[patchI].size();
patchStarts[patchI] = mesh.boundaryMesh()[patchI].start();
}
mesh.removeZones();
mesh.resetPrimitives
(
pXfer,
fXfer,
ownXfer,
neiXfer,
patchSizes,
patchStarts
);
}
// Write mesh // Write mesh
if (overwrite) if (overwrite)
{ {

View file

@ -238,18 +238,21 @@ void Foam::enrichedPatch::calcCutFaces() const
(magNewDir - magCorrNewDir)/magNewDir; (magNewDir - magCorrNewDir)/magNewDir;
// Pout << " corrected: " << corrNewDir << " mag: " << magCorrNewDir << " out of plane: " << outOfPlane << flush; // Pout << " corrected: " << corrNewDir << " mag: " << magCorrNewDir << " out of plane: " << outOfPlane << flush;
// Bug fix for cutting around corners
// ZT, 5 May 2014
if (magCorrNewDir < SMALL) if (magCorrNewDir < SMALL)
{ {
FatalErrorIn continue;
( // FatalErrorIn
"void enrichedPatch::" // (
"calcCutFaces() const" // "void enrichedPatch::"
) << "Zero length edge detected. Probable " // "calcCutFaces() const"
<< "projection error: slave patch probably " // ) << "Zero length edge detected. Probable "
<< "does not project onto master. " // << "projection error: slave patch probably "
<< "Please switch on " // << "does not project onto master. "
<< "enriched patch debug for more info" // << "Please switch on "
<< abort(FatalError); // << "enriched patch debug for more info"
// << abort(FatalError);
} }
corrNewDir /= magCorrNewDir; corrNewDir /= magCorrNewDir;