Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-03-18 16:22:10 +01:00
6 changed files with 337 additions and 114 deletions

View File

@ -189,8 +189,8 @@ Foam::createShellMesh::createShellMesh
void Foam::createShellMesh::setRefinement void Foam::createShellMesh::setRefinement
( (
const pointField& thickness, const pointField& thickness,
const labelList& extrudeMasterPatchID, const labelList& topPatchID,
const labelList& extrudeSlavePatchID, const labelList& bottomPatchID,
const labelListList& extrudeEdgePatches, const labelListList& extrudeEdgePatches,
polyTopoChange& meshMod polyTopoChange& meshMod
) )
@ -205,14 +205,14 @@ void Foam::createShellMesh::setRefinement
if if
( (
extrudeMasterPatchID.size() != patch_.size() topPatchID.size() != patch_.size()
&& extrudeSlavePatchID.size() != patch_.size() && bottomPatchID.size() != patch_.size()
) )
{ {
FatalErrorIn("createShellMesh::setRefinement(..)") FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nFaces:" << patch_.size() << "nFaces:" << patch_.size()
<< " extrudeMasterPatchID:" << extrudeMasterPatchID.size() << " topPatchID:" << topPatchID.size()
<< " extrudeSlavePatchID:" << extrudeSlavePatchID.size() << " bottomPatchID:" << bottomPatchID.size()
<< exit(FatalError); << exit(FatalError);
} }
@ -302,11 +302,9 @@ void Foam::createShellMesh::setRefinement
} }
// Add face on patch' master side // Add face on bottom side
//labelList masterFaces(patch_.localFaces().size());
forAll(patch_.localFaces(), faceI) forAll(patch_.localFaces(), faceI)
{ {
//masterFaces[faceI] =
meshMod.addFace meshMod.addFace
( (
patch_.localFaces()[faceI].reverseFace(),// vertices patch_.localFaces()[faceI].reverseFace(),// vertices
@ -316,14 +314,14 @@ void Foam::createShellMesh::setRefinement
-1, // masterEdgeID -1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI faceToFaceMap.size(), // masterFaceID : current faceI
true, // flipFaceFlux true, // flipFaceFlux
extrudeMasterPatchID[faceI],// patchID bottomPatchID[faceI],// patchID
-1, // zoneID -1, // zoneID
false // zoneFlip false // zoneFlip
); );
faceToFaceMap.append(faceI+1); // points to unflipped original face faceToFaceMap.append(-faceI-1); // points to flipped original face
faceToEdgeMap.append(-1); faceToEdgeMap.append(-1);
//Pout<< "Added master face " //Pout<< "Added bottom face "
// << patch_.localFaces()[faceI].reverseFace() // << patch_.localFaces()[faceI].reverseFace()
// << " own " << addedCells[faceI] // << " own " << addedCells[faceI]
// << " at " << patch_.faceCentres()[faceI] // << " at " << patch_.faceCentres()[faceI]
@ -331,8 +329,7 @@ void Foam::createShellMesh::setRefinement
} }
// Add face on patch' slave side // Add face on top
//labelList slaveFaces(patch_.localFaces().size());
forAll(patch_.localFaces(), faceI) forAll(patch_.localFaces(), faceI)
{ {
// Get face in original ordering // Get face in original ordering
@ -346,7 +343,6 @@ void Foam::createShellMesh::setRefinement
newF[fp] = addedPoints[region]; newF[fp] = addedPoints[region];
} }
//slaveFaces[faceI] =
meshMod.addFace meshMod.addFace
( (
newF, // vertices newF, // vertices
@ -356,14 +352,14 @@ void Foam::createShellMesh::setRefinement
-1, // masterEdgeID -1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI faceToFaceMap.size(), // masterFaceID : current faceI
false, // flipFaceFlux false, // flipFaceFlux
extrudeSlavePatchID[faceI], // patchID topPatchID[faceI], // patchID
-1, // zoneID -1, // zoneID
false // zoneFlip false // zoneFlip
); );
faceToFaceMap.append(-faceI-1); faceToFaceMap.append(faceI+1); // unflipped
faceToEdgeMap.append(-1); faceToEdgeMap.append(-1);
//Pout<< "Added slave face " << newF //Pout<< "Added top face " << newF
// << " own " << addedCells[faceI] // << " own " << addedCells[faceI]
// << " at " << patch_.faceCentres()[faceI] // << " at " << patch_.faceCentres()[faceI]
// << endl; // << endl;

View File

@ -31,6 +31,10 @@ Description
SourceFiles SourceFiles
createShellMesh.C createShellMesh.C
Extrudes into thickness direction.
- bottom faces originate from reversed original faces (have turning index)
- top faces originate from original faces (no turning index)
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef createShellMesh_H #ifndef createShellMesh_H
@ -59,9 +63,6 @@ class createShellMesh
//- Reference to patch to extrude //- Reference to patch to extrude
const primitiveFacePatch& patch_; const primitiveFacePatch& patch_;
// //- Non-manifold edges on patch
// const PackedBoolList& nonManifoldEdge_;
//- Per point on face the region //- Per point on face the region
const faceList& pointRegions_; const faceList& pointRegions_;
@ -99,7 +100,6 @@ public:
createShellMesh createShellMesh
( (
const primitiveFacePatch& patch, const primitiveFacePatch& patch,
// const PackedBoolList& nonManifoldEdge,
const faceList& pointRegions, const faceList& pointRegions,
const labelList& regionPoints const labelList& regionPoints
); );
@ -117,10 +117,10 @@ public:
} }
//- From region face to patch face. Contains turning index: //- From region face to patch face. Contains turning index:
// > 0 : face originating from master side // > 0 : face in same orientation as patch face. face will
// (owner side for unflipped face) // be in top patch
// < 0 : (bottom) face originating from slave side // < 0 : face in opposite orientation as patch face. face will
// (neighbour side for unflipped face) // be in bottom patch
// = 0 : for all side faces // = 0 : for all side faces
const labelList& faceToFaceMap() const const labelList& faceToFaceMap() const
{ {
@ -155,8 +155,8 @@ public:
void setRefinement void setRefinement
( (
const pointField& thickness, const pointField& thickness,
const labelList& extrudeMasterPatchID, const labelList& topPatchID,
const labelList& extrudeSlavePatchID, const labelList& bottomPatchID,
const labelListList& extrudeEdgePatches, const labelListList& extrudeEdgePatches,
polyTopoChange& meshMod polyTopoChange& meshMod
); );

View File

@ -37,6 +37,73 @@ Description
if flipMap is false) if flipMap is false)
- not parallel - not parallel
Internal face extrusion
-----------------------
+-------------+
| |
| |
+---AAAAAAA---+
| |
| |
+-------------+
AAA=faceZone to extrude.
For the case of no flipMap the extrusion starts at owner and extrudes
into the space of the neighbour:
+CCCCCCC+
| | <= extruded mesh
+BBBBBBB+
+-------------+
| |
| (neighbour) |
|___CCCCCCC___| <= original mesh (with 'baffles' added)
| BBBBBBB |
|(owner side) |
| |
+-------------+
BBB=directMapped between owner on original mesh and new extrusion.
(zero offset)
CCC=directMapped between neighbour on original mesh and new extrusion
(offset due to the thickness of the extruded mesh)
For the case of flipMap the extrusion is the other way around: from the
neighbour side into the owner side.
Boundary face extrusion
-----------------------
+--AAAAAAA--+
| |
| |
+-----------+
AAA=faceZone to extrude. E.g. slave side is owner side (no flipmap)
becomes
+CCCCCCC+
| | <= extruded mesh
+BBBBBBB+
+--BBBBBBB--+
| | <= original mesh
| |
+-----------+
BBB=directMapped between original mesh and new extrusion
CCC=polypatch
Usage Usage
- extrudeToRegionMesh <regionName> <faceZones> <thickness> - extrudeToRegionMesh <regionName> <faceZones> <thickness>
@ -467,6 +534,30 @@ void reorderPatches
} }
// Remove zero-sized patches
void deleteEmptyPatches(fvMesh& mesh)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
labelList oldToNew(patches.size());
label usedI = 0;
label notUsedI = patches.size();
forAll(patches, patchI)
{
if (returnReduce(patches[patchI].size(), sumOp<label>()) == 0)
{
oldToNew[patchI] = --notUsedI;
}
else
{
oldToNew[patchI] = usedI++;
}
}
reorderPatches(mesh, oldToNew, usedI);
}
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName) void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
{ {
// Create dummy system/fv* // Create dummy system/fv*
@ -585,23 +676,6 @@ int main(int argc, char *argv[])
} }
// Add interface patches
// Note: should be one per faceZone?
word masterPatchName = regionName + "_to_" + shellRegionName + "_master";
label masterPatchID = addPatch<directMappedWallPolyPatch>
(
mesh,
masterPatchName
);
word slavePatchName = regionName + "_to_" + shellRegionName + "_slave";
label slavePatchID = addPatch<directMappedWallPolyPatch>
(
mesh,
slavePatchName
);
// Create dummy fv* files // Create dummy fv* files
createDummyFvMeshFiles(mesh, shellRegionName); createDummyFvMeshFiles(mesh, shellRegionName);
@ -620,39 +694,49 @@ int main(int argc, char *argv[])
Info<< "Writing meshes to " << meshInstance << nl << endl; Info<< "Writing meshes to " << meshInstance << nl << endl;
// Collect faces to extrude
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();
const faceZoneMesh& faceZones = mesh.faceZones(); const faceZoneMesh& faceZones = mesh.faceZones();
label nExtrudeFaces = 0;
// Check zones
// ~~~~~~~~~~~
labelList zoneIDs(zoneNames.size());
forAll(zoneNames, i) forAll(zoneNames, i)
{ {
label zoneI = faceZones.findZoneID(zoneNames[i]); zoneIDs[i] = faceZones.findZoneID(zoneNames[i]);
if (zoneI == -1) if (zoneIDs[i] == -1)
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "Cannot find zone " << zoneNames[i] << endl << "Cannot find zone " << zoneNames[i] << endl
<< "Valid zones are " << faceZones.names() << "Valid zones are " << faceZones.names()
<< exit(FatalError); << exit(FatalError);
} }
nExtrudeFaces += faceZones[zoneI].size(); }
// Collect faces to extrude and per-face information
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
label nExtrudeFaces = 0;
forAll(zoneIDs, i)
{
nExtrudeFaces += faceZones[zoneIDs[i]].size();
} }
labelList extrudeMeshFaces(nExtrudeFaces); labelList extrudeMeshFaces(nExtrudeFaces);
faceList zoneFaces(nExtrudeFaces); faceList zoneFaces(nExtrudeFaces);
labelList zoneID(nExtrudeFaces); labelList zoneID(nExtrudeFaces);
boolList zoneFlipMap(nExtrudeFaces); boolList zoneFlipMap(nExtrudeFaces);
nExtrudeFaces = 0; nExtrudeFaces = 0;
forAll(zoneNames, i) forAll(zoneIDs, i)
{ {
label zoneI = faceZones.findZoneID(zoneNames[i]); const faceZone& fz = faceZones[zoneIDs[i]];
const faceZone& fz = faceZones[zoneI];
const primitiveFacePatch& fzp = fz(); const primitiveFacePatch& fzp = fz();
forAll(fz, j) forAll(fz, j)
{ {
extrudeMeshFaces[nExtrudeFaces] = fz[j]; extrudeMeshFaces[nExtrudeFaces] = fz[j];
zoneFaces[nExtrudeFaces] = fzp[j]; zoneFaces[nExtrudeFaces] = fzp[j];
zoneID[nExtrudeFaces] = zoneI; zoneID[nExtrudeFaces] = zoneIDs[i];
zoneFlipMap[nExtrudeFaces] = fz.flipMap()[j]; zoneFlipMap[nExtrudeFaces] = fz.flipMap()[j];
nExtrudeFaces++; nExtrudeFaces++;
} }
@ -662,13 +746,6 @@ int main(int argc, char *argv[])
const faceList& extrudeFaces = extrudePatch.localFaces(); const faceList& extrudeFaces = extrudePatch.localFaces();
const labelListList& edgeFaces = extrudePatch.edgeFaces(); const labelListList& edgeFaces = extrudePatch.edgeFaces();
labelList extrudeSlavePatchID(extrudePatch.size());
labelList extrudeMasterPatchID(extrudePatch.size());
forAll(extrudeMeshFaces, i)
{
extrudeSlavePatchID[i] = slavePatchID;
extrudeMasterPatchID[i] = masterPatchID;
}
Info<< "extrudePatch :" Info<< "extrudePatch :"
<< " faces:" << extrudePatch.size() << " faces:" << extrudePatch.size()
@ -678,6 +755,128 @@ int main(int argc, char *argv[])
<< endl; << endl;
// Check whether the zone is internal or external faces to determine
// what patch type to insert. Cannot be mixed
// since then how to couple? - directMapped only valid for a whole patch.
boolList isInternal(zoneIDs.size(), false);
forAll(zoneIDs, i)
{
const faceZone& fz = faceZones[zoneIDs[i]];
forAll(fz, j)
{
if (mesh.isInternalFace(fz[j]))
{
isInternal[i] = true;
break;
}
}
}
Pstream::listCombineGather(isInternal, orEqOp<bool>());
Pstream::listCombineScatter(isInternal);
forAll(zoneIDs, i)
{
const faceZone& fz = faceZones[zoneIDs[i]];
if (isInternal[i])
{
Info<< "FaceZone " << fz.name() << " has internal faces" << endl;
}
else
{
Info<< "FaceZone " << fz.name() << " has boundary faces" << endl;
}
}
// Add interface patches
// ~~~~~~~~~~~~~~~~~~~~~
Info<< "Adding coupling patches:" << nl << nl
<< "patchID\tpatch\ttype" << nl
<< "-------\t-----\t----"
<< endl;
labelList interRegionTopPatch(zoneNames.size());
labelList interRegionBottomPatch(zoneNames.size());
label nCoupled = 0;
forAll(zoneIDs, i)
{
word interName(regionName+"_to_"+shellRegionName+'_'+zoneNames[i]);
if (isInternal[i])
{
interRegionTopPatch[i] = addPatch<directMappedWallPolyPatch>
(
mesh,
interName + "_top"
);
nCoupled++;
Info<< interRegionTopPatch[i]
<< '\t' << patches[interRegionTopPatch[i]].name()
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
(
mesh,
interName + "_bottom"
);
nCoupled++;
Info<< interRegionBottomPatch[i]
<< '\t' << patches[interRegionBottomPatch[i]].name()
<< '\t' << patches[interRegionBottomPatch[i]].type()
<< nl;
}
else
{
interRegionTopPatch[i] = addPatch<polyPatch>
(
mesh,
zoneNames[i] + "_top"
);
nCoupled++;
Info<< interRegionTopPatch[i]
<< '\t' << patches[interRegionTopPatch[i]].name()
<< '\t' << patches[interRegionTopPatch[i]].type()
<< nl;
interRegionBottomPatch[i] = addPatch<directMappedWallPolyPatch>
(
mesh,
interName
);
nCoupled++;
Info<< interRegionBottomPatch[i]
<< '\t' << patches[interRegionBottomPatch[i]].name()
<< '\t' << patches[interRegionBottomPatch[i]].type()
<< nl;
}
}
Info<< "Added " << nCoupled << " inter-region patches." << nl
<< endl;
labelList extrudeTopPatchID(extrudePatch.size());
labelList extrudeBottomPatchID(extrudePatch.size());
nExtrudeFaces = 0;
forAll(zoneNames, i)
{
label zoneI = faceZones.findZoneID(zoneNames[i]);
const faceZone& fz = faceZones[zoneI];
forAll(fz, j)
{
extrudeTopPatchID[nExtrudeFaces] = interRegionTopPatch[i];
extrudeBottomPatchID[nExtrudeFaces] = interRegionBottomPatch[i];
nExtrudeFaces++;
}
}
// Count how many patches on special edges of extrudePatch are necessary // Count how many patches on special edges of extrudePatch are necessary
// - zoneXXX_sides // - zoneXXX_sides
// - zoneXXX_zoneYYY // - zoneXXX_zoneYYY
@ -716,9 +915,9 @@ int main(int argc, char *argv[])
Pstream::listCombineScatter(zoneZonePatch); Pstream::listCombineScatter(zoneZonePatch);
// Now check which patches to add. // Now check which patches to add.
Info<< "Adding patches for edges on zones:" << nl Info<< "Adding patches for edges on zones:" << nl << nl
<< "\tpatchID\tpatch" << nl << "patchID\tpatch" << nl
<< "\t-------\t-----" << "-------\t-----"
<< endl; << endl;
label nSide = 0; label nSide = 0;
@ -726,15 +925,14 @@ int main(int argc, char *argv[])
{ {
if (zoneSidePatch[zoneI] > 0) if (zoneSidePatch[zoneI] > 0)
{ {
word patchName = faceZones[zoneI].name() + "_" + "sidePatch"; word patchName = faceZones[zoneI].name() + "_" + "side";
zoneSidePatch[zoneI] = addPatch<polyPatch> zoneSidePatch[zoneI] = addPatch<polyPatch>
( (
mesh, mesh,
patchName patchName
); );
Info<< '\t' << zoneSidePatch[zoneI] Info<< zoneSidePatch[zoneI] << '\t' << patchName << nl;
<< '\t' << patchName << nl;
nSide++; nSide++;
} }
@ -744,9 +942,9 @@ int main(int argc, char *argv[])
Info<< "Adding inter-zone patches:" << nl Info<< "Adding inter-zone patches:" << nl << nl
<< "\tpatchID\tpatch" << nl << "patchID\tpatch" << nl
<< "\t-------\t-----" << "-------\t-----"
<< endl; << endl;
dictionary transformDict; dictionary transformDict;
@ -777,7 +975,7 @@ int main(int argc, char *argv[])
transformDict transformDict
); );
Info<< '\t' << zoneZonePatch[index] Info<< zoneZonePatch[index]
<< '\t' << patchName << nl; << '\t' << patchName << nl;
nInter++; nInter++;
@ -943,12 +1141,7 @@ int main(int argc, char *argv[])
// Create a new mesh // Create a new mesh
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
createShellMesh extruder createShellMesh extruder(extrudePatch, pointRegions, regionPoints);
(
extrudePatch,
pointRegions,
regionPoints
);
autoPtr<fvMesh> regionMeshPtr; autoPtr<fvMesh> regionMeshPtr;
@ -959,8 +1152,8 @@ int main(int argc, char *argv[])
extruder.setRefinement extruder.setRefinement
( (
thickness*regionNormals, thickness*regionNormals,
extrudeMasterPatchID, extrudeTopPatchID,
extrudeSlavePatchID, extrudeBottomPatchID,
extrudeEdgePatches, extrudeEdgePatches,
meshMod meshMod
); );
@ -990,11 +1183,12 @@ int main(int argc, char *argv[])
extruder.updateMesh(shellMap); extruder.updateMesh(shellMap);
// Change master and slave boundary conditions on regionMesh // Change top and bottom boundary conditions on regionMesh
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Save offsets from shell mesh back to original mesh // Save offsets from shell mesh back to original mesh
pointField masterOffsets, slaveOffsets; List<pointField> topOffsets(zoneIDs.size());
List<pointField> bottomOffsets(zoneIDs.size());
{ {
const polyBoundaryMesh& regionPatches = regionMesh.boundaryMesh(); const polyBoundaryMesh& regionPatches = regionMesh.boundaryMesh();
@ -1002,9 +1196,16 @@ int main(int argc, char *argv[])
forAll(regionPatches, patchI) forAll(regionPatches, patchI)
{ {
const polyPatch& pp = regionPatches[patchI]; const polyPatch& pp = regionPatches[patchI];
if (pp.name() == masterPatchName)
if
(
isA<directMappedWallPolyPatch>(pp)
&& (findIndex(interRegionTopPatch, patchI) != -1)
)
{ {
masterOffsets = calcOffset(extrudePatch, extruder, pp); label index = findIndex(interRegionTopPatch, patchI);
topOffsets[index] = calcOffset(extrudePatch, extruder, pp);
newPatches[patchI] = new directMappedWallPolyPatch newPatches[patchI] = new directMappedWallPolyPatch
( (
@ -1012,16 +1213,22 @@ int main(int argc, char *argv[])
pp.size(), pp.size(),
pp.start(), pp.start(),
patchI, patchI,
regionName, // sampleRegion regionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE, // sampleMode directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch pp.name(), // samplePatch
masterOffsets, // offset topOffsets[index], // offset
patches patches
); );
} }
else if (pp.name() == slavePatchName) else if
(
isA<directMappedWallPolyPatch>(pp)
&& (findIndex(interRegionBottomPatch, patchI) != -1)
)
{ {
slaveOffsets = calcOffset(extrudePatch, extruder, pp); label index = findIndex(interRegionBottomPatch, patchI);
bottomOffsets[index] = calcOffset(extrudePatch, extruder, pp);
newPatches[patchI] = new directMappedWallPolyPatch newPatches[patchI] = new directMappedWallPolyPatch
( (
@ -1029,10 +1236,10 @@ int main(int argc, char *argv[])
pp.size(), pp.size(),
pp.start(), pp.start(),
patchI, patchI,
regionName, // sampleRegion regionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE, // sampleMode directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch pp.name(), // samplePatch
slaveOffsets, // offset bottomOffsets[index], // offset
patches patches
); );
} }
@ -1049,6 +1256,7 @@ int main(int argc, char *argv[])
} }
regionMesh.removeFvBoundary(); regionMesh.removeFvBoundary();
regionMesh.addFvPatches(newPatches, true); regionMesh.addFvPatches(newPatches, true);
deleteEmptyPatches(regionMesh);
} }
@ -1153,7 +1361,7 @@ int main(int argc, char *argv[])
{ {
polyTopoChange meshMod(mesh); polyTopoChange meshMod(mesh);
// Modify faces to be in master patch // Modify faces to be in bottom (= always coupled) patch
forAll(extrudeMeshFaces, zoneFaceI) forAll(extrudeMeshFaces, zoneFaceI)
{ {
label meshFaceI = extrudeMeshFaces[zoneFaceI]; label meshFaceI = extrudeMeshFaces[zoneFaceI];
@ -1170,7 +1378,7 @@ int main(int argc, char *argv[])
mesh.faceOwner()[meshFaceI],// owner mesh.faceOwner()[meshFaceI],// owner
-1, // neighbour -1, // neighbour
false, // face flip false, // face flip
masterPatchID, // patch for face extrudeBottomPatchID[zoneFaceI],// patch for face
zoneI, // zone for face zoneI, // zone for face
flip // face flip in zone flip // face flip in zone
); );
@ -1184,14 +1392,14 @@ int main(int argc, char *argv[])
mesh.faceNeighbour()[meshFaceI],// owner mesh.faceNeighbour()[meshFaceI],// owner
-1, // neighbour -1, // neighbour
true, // face flip true, // face flip
masterPatchID, // patch for face extrudeBottomPatchID[zoneFaceI],// patch for face
zoneI, // zone for face zoneI, // zone for face
!flip // face flip in zone !flip // face flip in zone
); );
} }
} }
// Add faces (using same points) to be in slave patch // Add faces (using same points) to be in top patch
forAll(extrudeMeshFaces, zoneFaceI) forAll(extrudeMeshFaces, zoneFaceI)
{ {
label meshFaceI = extrudeMeshFaces[zoneFaceI]; label meshFaceI = extrudeMeshFaces[zoneFaceI];
@ -1211,7 +1419,7 @@ int main(int argc, char *argv[])
-1, // master edge -1, // master edge
meshFaceI, // master face meshFaceI, // master face
true, // flip flux true, // flip flux
slavePatchID, // patch for face extrudeTopPatchID[zoneFaceI], // patch for face
-1, // zone for face -1, // zone for face
false // face flip in zone false // face flip in zone
); );
@ -1228,7 +1436,7 @@ int main(int argc, char *argv[])
-1, // master edge -1, // master edge
meshFaceI, // master face meshFaceI, // master face
false, // flip flux false, // flip flux
slavePatchID, // patch for face extrudeTopPatchID[zoneFaceI], // patch for face
-1, // zone for face -1, // zone for face
false // zone flip false // zone flip
); );
@ -1266,33 +1474,45 @@ int main(int argc, char *argv[])
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
if (pp.name() == masterPatchName)
if
(
isA<directMappedWallPolyPatch>(pp)
&& (findIndex(interRegionTopPatch, patchI) != -1)
)
{ {
label index = findIndex(interRegionTopPatch, patchI);
newPatches[patchI] = new directMappedWallPolyPatch newPatches[patchI] = new directMappedWallPolyPatch
( (
pp.name(), pp.name(),
pp.size(), pp.size(),
pp.start(), pp.start(),
patchI, patchI,
shellRegionName, // sampleRegion shellRegionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE, // sampleMode directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch pp.name(), // samplePatch
-masterOffsets, // offset -topOffsets[index], // offset
patches patches
); );
} }
else if (pp.name() == slavePatchName) else if
(
isA<directMappedWallPolyPatch>(pp)
&& (findIndex(interRegionBottomPatch, patchI) != -1)
)
{ {
label index = findIndex(interRegionBottomPatch, patchI);
newPatches[patchI] = new directMappedWallPolyPatch newPatches[patchI] = new directMappedWallPolyPatch
( (
pp.name(), pp.name(),
pp.size(), pp.size(),
pp.start(), pp.start(),
patchI, patchI,
shellRegionName, // sampleRegion shellRegionName, // sampleRegion
directMappedPatchBase::NEARESTPATCHFACE, // sampleMode directMappedPatchBase::NEARESTPATCHFACE,// sampleMode
pp.name(), // samplePatch pp.name(), // samplePatch
-slaveOffsets, // offset -bottomOffsets[index], // offset
patches patches
); );
} }
@ -1309,6 +1529,7 @@ int main(int argc, char *argv[])
} }
mesh.removeFvBoundary(); mesh.removeFvBoundary();
mesh.addFvPatches(newPatches, true); mesh.addFvPatches(newPatches, true);
deleteEmptyPatches(mesh);
} }

View File

@ -960,7 +960,14 @@ int main(int argc, char *argv[])
# endif # endif
} }
if (rawLine.empty() || rawLine[0] == '#') // Strip off anything after #
string::size_type i = rawLine.find_first_of("#");
if (i != string::npos)
{
rawLine = rawLine(0, i);
}
if (rawLine.empty())
{ {
continue; continue;
} }

View File

@ -181,7 +181,6 @@ inline unsigned Hash<triFace>::operator()(const triFace& t, unsigned seed) const
//- Hash specialization for hashing triFace - a commutative hash value. //- Hash specialization for hashing triFace - a commutative hash value.
// Hash incrementally.
template<> template<>
inline unsigned Hash<triFace>::operator()(const triFace& t) const inline unsigned Hash<triFace>::operator()(const triFace& t) const
{ {

View File

@ -148,11 +148,10 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
// Current info on points // Current info on points
List<pointEdgeStructuredWalk> allPointInfo(mesh().nPoints()); List<pointEdgeStructuredWalk> allPointInfo(mesh().nPoints());
// Mark points inside cellZone.
// Mark points inside cellZone.
// Note that we use points0, not mesh.points() // Note that we use points0, not mesh.points()
// so as not to accumulate errors. // so as not to accumulate errors.
forAll(isZonePoint, pointI) forAll(isZonePoint, pointI)
{ {
if (isZonePoint[pointI]) if (isZonePoint[pointI])
@ -169,6 +168,7 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
// Current info on edges // Current info on edges
List<pointEdgeStructuredWalk> allEdgeInfo(mesh().nEdges()); List<pointEdgeStructuredWalk> allEdgeInfo(mesh().nEdges());
// Mark edges inside cellZone // Mark edges inside cellZone
forAll(isZoneEdge, edgeI) forAll(isZoneEdge, edgeI)
{ {