mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: extrudeToRegionMesh: fix indexing.
This commit is contained in:
@ -1015,6 +1015,8 @@ void addCouplingPatches
|
|||||||
const wordList& zoneNames,
|
const wordList& zoneNames,
|
||||||
const wordList& zoneShadowNames,
|
const wordList& zoneShadowNames,
|
||||||
const boolList& isInternal,
|
const boolList& isInternal,
|
||||||
|
const labelList& zoneIDs,
|
||||||
|
|
||||||
DynamicList<polyPatch*>& newPatches,
|
DynamicList<polyPatch*>& newPatches,
|
||||||
labelList& interRegionTopPatch,
|
labelList& interRegionTopPatch,
|
||||||
labelList& interRegionBottomPatch
|
labelList& interRegionBottomPatch
|
||||||
@ -1025,90 +1027,91 @@ void addCouplingPatches
|
|||||||
<< "-------\t-----\t----"
|
<< "-------\t-----\t----"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
interRegionTopPatch.setSize(zoneNames.size());
|
interRegionTopPatch.setSize(mesh.faceZones().size(), -1);
|
||||||
interRegionBottomPatch.setSize(zoneNames.size());
|
interRegionBottomPatch.setSize(mesh.faceZones().size(), -1);
|
||||||
|
|
||||||
label nCoupled = 0;
|
label nCoupled = 0;
|
||||||
forAll(zoneNames, i)
|
forAll(zoneNames, i)
|
||||||
{
|
{
|
||||||
word interName(regionName+"_to_"+shellRegionName+'_'+zoneNames[i]);
|
word interName(regionName+"_to_"+shellRegionName+'_'+zoneNames[i]);
|
||||||
|
label zoneI = zoneIDs[i];
|
||||||
|
|
||||||
if (isInternal[i])
|
if (isInternal[i])
|
||||||
{
|
{
|
||||||
interRegionTopPatch[i] = addPatch<mappedWallPolyPatch>
|
interRegionTopPatch[zoneI] = addPatch<mappedWallPolyPatch>
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
interName + "_top",
|
interName + "_top",
|
||||||
newPatches
|
newPatches
|
||||||
);
|
);
|
||||||
nCoupled++;
|
nCoupled++;
|
||||||
Pout<< interRegionTopPatch[i]
|
Pout<< interRegionTopPatch[zoneI]
|
||||||
<< '\t' << newPatches[interRegionTopPatch[i]]->name()
|
<< '\t' << newPatches[interRegionTopPatch[zoneI]]->name()
|
||||||
<< '\t' << newPatches[interRegionTopPatch[i]]->type()
|
<< '\t' << newPatches[interRegionTopPatch[zoneI]]->type()
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
|
interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
interName + "_bottom",
|
interName + "_bottom",
|
||||||
newPatches
|
newPatches
|
||||||
);
|
);
|
||||||
nCoupled++;
|
nCoupled++;
|
||||||
Pout<< interRegionBottomPatch[i]
|
Pout<< interRegionBottomPatch[zoneI]
|
||||||
<< '\t' << newPatches[interRegionBottomPatch[i]]->name()
|
<< '\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
|
||||||
<< '\t' << newPatches[interRegionBottomPatch[i]]->type()
|
<< '\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
else if (zoneShadowNames.size() == 0)
|
else if (zoneShadowNames.size() == 0)
|
||||||
{
|
{
|
||||||
interRegionTopPatch[i] = addPatch<polyPatch>
|
interRegionTopPatch[zoneI] = addPatch<polyPatch>
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
zoneNames[i] + "_top",
|
zoneNames[i] + "_top",
|
||||||
newPatches
|
newPatches
|
||||||
);
|
);
|
||||||
nCoupled++;
|
nCoupled++;
|
||||||
Pout<< interRegionTopPatch[i]
|
Pout<< interRegionTopPatch[zoneI]
|
||||||
<< '\t' << newPatches[interRegionTopPatch[i]]->name()
|
<< '\t' << newPatches[interRegionTopPatch[zoneI]]->name()
|
||||||
<< '\t' << newPatches[interRegionTopPatch[i]]->type()
|
<< '\t' << newPatches[interRegionTopPatch[zoneI]]->type()
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
|
interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
interName,
|
interName,
|
||||||
newPatches
|
newPatches
|
||||||
);
|
);
|
||||||
nCoupled++;
|
nCoupled++;
|
||||||
Pout<< interRegionBottomPatch[i]
|
Pout<< interRegionBottomPatch[zoneI]
|
||||||
<< '\t' << newPatches[interRegionBottomPatch[i]]->name()
|
<< '\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
|
||||||
<< '\t' << newPatches[interRegionBottomPatch[i]]->type()
|
<< '\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
else //patch using shadow face zones.
|
else //patch using shadow face zones.
|
||||||
{
|
{
|
||||||
interRegionTopPatch[i] = addPatch<mappedWallPolyPatch>
|
interRegionTopPatch[zoneI] = addPatch<mappedWallPolyPatch>
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
zoneShadowNames[i] + "_top",
|
zoneShadowNames[i] + "_top",
|
||||||
newPatches
|
newPatches
|
||||||
);
|
);
|
||||||
nCoupled++;
|
nCoupled++;
|
||||||
Pout<< interRegionTopPatch[i]
|
Pout<< interRegionTopPatch[zoneI]
|
||||||
<< '\t' << newPatches[interRegionTopPatch[i]]->name()
|
<< '\t' << newPatches[interRegionTopPatch[zoneI]]->name()
|
||||||
<< '\t' << newPatches[interRegionTopPatch[i]]->type()
|
<< '\t' << newPatches[interRegionTopPatch[zoneI]]->type()
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
interRegionBottomPatch[i] = addPatch<mappedWallPolyPatch>
|
interRegionBottomPatch[zoneI] = addPatch<mappedWallPolyPatch>
|
||||||
(
|
(
|
||||||
mesh.boundaryMesh(),
|
mesh.boundaryMesh(),
|
||||||
interName,
|
interName,
|
||||||
newPatches
|
newPatches
|
||||||
);
|
);
|
||||||
nCoupled++;
|
nCoupled++;
|
||||||
Pout<< interRegionBottomPatch[i]
|
Pout<< interRegionBottomPatch[zoneI]
|
||||||
<< '\t' << newPatches[interRegionBottomPatch[i]]->name()
|
<< '\t' << newPatches[interRegionBottomPatch[zoneI]]->name()
|
||||||
<< '\t' << newPatches[interRegionBottomPatch[i]]->type()
|
<< '\t' << newPatches[interRegionBottomPatch[zoneI]]->type()
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1262,7 +1265,6 @@ void addZoneSidePatches
|
|||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const word& oneDPolyPatchType,
|
const word& oneDPolyPatchType,
|
||||||
const wordList& zoneNames,
|
|
||||||
|
|
||||||
DynamicList<polyPatch*>& newPatches,
|
DynamicList<polyPatch*>& newPatches,
|
||||||
labelList& zoneSidePatch
|
labelList& zoneSidePatch
|
||||||
@ -1273,9 +1275,11 @@ void addZoneSidePatches
|
|||||||
<< "-------\t-----"
|
<< "-------\t-----"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||||
|
|
||||||
label nSide = 0;
|
label nSide = 0;
|
||||||
|
|
||||||
forAll(zoneNames, zoneI)
|
forAll(zoneSidePatch, zoneI)
|
||||||
{
|
{
|
||||||
if (oneDPolyPatchType != word::null)
|
if (oneDPolyPatchType != word::null)
|
||||||
{
|
{
|
||||||
@ -1314,7 +1318,7 @@ void addZoneSidePatches
|
|||||||
}
|
}
|
||||||
else if (zoneSidePatch[zoneI] > 0)
|
else if (zoneSidePatch[zoneI] > 0)
|
||||||
{
|
{
|
||||||
word patchName = zoneNames[zoneI] + "_" + "side";
|
word patchName = faceZones[zoneI].name() + "_" + "side";
|
||||||
|
|
||||||
zoneSidePatch[zoneI] = addPatch<polyPatch>
|
zoneSidePatch[zoneI] = addPatch<polyPatch>
|
||||||
(
|
(
|
||||||
@ -1336,7 +1340,6 @@ void addZoneSidePatches
|
|||||||
void addInterZonePatches
|
void addInterZonePatches
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const wordList& zoneNames,
|
|
||||||
const bool oneD,
|
const bool oneD,
|
||||||
|
|
||||||
labelList& zoneZonePatch_min,
|
labelList& zoneZonePatch_min,
|
||||||
@ -1349,6 +1352,8 @@ void addInterZonePatches
|
|||||||
<< "-------\t-----"
|
<< "-------\t-----"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
const faceZoneMesh& faceZones = mesh.faceZones();
|
||||||
|
|
||||||
dictionary transformDict;
|
dictionary transformDict;
|
||||||
transformDict.add
|
transformDict.add
|
||||||
(
|
(
|
||||||
@ -1361,20 +1366,20 @@ void addInterZonePatches
|
|||||||
{
|
{
|
||||||
forAll(zoneZonePatch_min, minZone)
|
forAll(zoneZonePatch_min, minZone)
|
||||||
{
|
{
|
||||||
for (label maxZone = minZone; maxZone < zoneNames.size(); maxZone++)
|
for (label maxZone = minZone; maxZone < faceZones.size(); maxZone++)
|
||||||
{
|
{
|
||||||
label index = minZone*zoneNames.size()+maxZone;
|
label index = minZone*faceZones.size()+maxZone;
|
||||||
|
|
||||||
if (zoneZonePatch_min[index] > 0)
|
if (zoneZonePatch_min[index] > 0)
|
||||||
{
|
{
|
||||||
word minToMax =
|
word minToMax =
|
||||||
zoneNames[minZone]
|
faceZones[minZone].name()
|
||||||
+ "_to_"
|
+ "_to_"
|
||||||
+ zoneNames[maxZone];
|
+ faceZones[maxZone].name();
|
||||||
word maxToMin =
|
word maxToMin =
|
||||||
zoneNames[maxZone]
|
faceZones[maxZone].name()
|
||||||
+ "_to_"
|
+ "_to_"
|
||||||
+ zoneNames[minZone];
|
+ faceZones[minZone].name();
|
||||||
|
|
||||||
{
|
{
|
||||||
transformDict.set("neighbourPatch", maxToMin);
|
transformDict.set("neighbourPatch", maxToMin);
|
||||||
@ -1457,22 +1462,25 @@ void setCouplingInfo
|
|||||||
{
|
{
|
||||||
label patchI = zoneToPatch[zoneI];
|
label patchI = zoneToPatch[zoneI];
|
||||||
|
|
||||||
const polyPatch& pp = patches[patchI];
|
if (patchI != -1)
|
||||||
|
|
||||||
if (isA<mappedWallPolyPatch>(pp))
|
|
||||||
{
|
{
|
||||||
newPatches[patchI] = new mappedWallPolyPatch
|
const polyPatch& pp = patches[patchI];
|
||||||
(
|
|
||||||
pp.name(),
|
if (isA<mappedWallPolyPatch>(pp))
|
||||||
pp.size(),
|
{
|
||||||
pp.start(),
|
newPatches[patchI] = new mappedWallPolyPatch
|
||||||
patchI,
|
(
|
||||||
sampleRegion, // sampleRegion
|
pp.name(),
|
||||||
mode, // sampleMode
|
pp.size(),
|
||||||
pp.name(), // samplePatch
|
pp.start(),
|
||||||
offsets[zoneI], // offset
|
patchI,
|
||||||
patches
|
sampleRegion, // sampleRegion
|
||||||
);
|
mode, // sampleMode
|
||||||
|
pp.name(), // samplePatch
|
||||||
|
offsets[zoneI], // offset
|
||||||
|
patches
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1819,8 +1827,8 @@ int main(int argc, char *argv[])
|
|||||||
// ~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
// From zone to interface patch (region side)
|
// From zone to interface patch (region side)
|
||||||
labelList interRegionTopPatch(zoneNames.size());
|
labelList interRegionTopPatch;
|
||||||
labelList interRegionBottomPatch(zoneNames.size());
|
labelList interRegionBottomPatch;
|
||||||
|
|
||||||
addCouplingPatches
|
addCouplingPatches
|
||||||
(
|
(
|
||||||
@ -1830,15 +1838,17 @@ int main(int argc, char *argv[])
|
|||||||
zoneNames,
|
zoneNames,
|
||||||
zoneShadowNames,
|
zoneShadowNames,
|
||||||
isInternal,
|
isInternal,
|
||||||
|
zoneIDs,
|
||||||
|
|
||||||
regionPatches,
|
regionPatches,
|
||||||
interRegionTopPatch,
|
interRegionTopPatch,
|
||||||
interRegionBottomPatch
|
interRegionBottomPatch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// From zone to interface patch (mesh side)
|
// From zone to interface patch (mesh side)
|
||||||
labelList interMeshTopPatch(zoneNames.size());
|
labelList interMeshTopPatch;
|
||||||
labelList interMeshBottomPatch(zoneNames.size());
|
labelList interMeshBottomPatch;
|
||||||
|
|
||||||
if (adaptMesh)
|
if (adaptMesh)
|
||||||
{
|
{
|
||||||
@ -1856,6 +1866,7 @@ int main(int argc, char *argv[])
|
|||||||
zoneNames,
|
zoneNames,
|
||||||
zoneShadowNames,
|
zoneShadowNames,
|
||||||
isInternal,
|
isInternal,
|
||||||
|
zoneIDs,
|
||||||
|
|
||||||
newPatches,
|
newPatches,
|
||||||
interMeshTopPatch,
|
interMeshTopPatch,
|
||||||
@ -1872,13 +1883,14 @@ int main(int argc, char *argv[])
|
|||||||
labelList extrudeBottomPatchID(extrudePatch.size());
|
labelList extrudeBottomPatchID(extrudePatch.size());
|
||||||
|
|
||||||
nExtrudeFaces = 0;
|
nExtrudeFaces = 0;
|
||||||
forAll(zoneNames, i)
|
forAll(zoneIDs, i)
|
||||||
{
|
{
|
||||||
const faceZone& fz = faceZones[zoneNames[i]];
|
label zoneI = zoneIDs[i];
|
||||||
|
const faceZone& fz = faceZones[zoneI];
|
||||||
forAll(fz, j)
|
forAll(fz, j)
|
||||||
{
|
{
|
||||||
extrudeTopPatchID[nExtrudeFaces] = interRegionTopPatch[i];
|
extrudeTopPatchID[nExtrudeFaces] = interRegionTopPatch[zoneI];
|
||||||
extrudeBottomPatchID[nExtrudeFaces] = interRegionBottomPatch[i];
|
extrudeBottomPatchID[nExtrudeFaces] = interRegionBottomPatch[zoneI];
|
||||||
nExtrudeFaces++;
|
nExtrudeFaces++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1917,7 +1929,6 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
(oneD ? dict.lookup("oneDPolyPatchType") : word::null),
|
(oneD ? dict.lookup("oneDPolyPatchType") : word::null),
|
||||||
zoneNames,
|
|
||||||
|
|
||||||
regionPatches,
|
regionPatches,
|
||||||
zoneSidePatch
|
zoneSidePatch
|
||||||
@ -1928,7 +1939,6 @@ int main(int argc, char *argv[])
|
|||||||
addInterZonePatches
|
addInterZonePatches
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
zoneNames,
|
|
||||||
oneD,
|
oneD,
|
||||||
|
|
||||||
zoneZonePatch_min,
|
zoneZonePatch_min,
|
||||||
@ -2279,31 +2289,25 @@ int main(int argc, char *argv[])
|
|||||||
// Calculate offsets from shell mesh back to original mesh
|
// Calculate offsets from shell mesh back to original mesh
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
List<pointField> topOffsets(zoneIDs.size());
|
List<pointField> topOffsets(faceZones.size());
|
||||||
List<pointField> bottomOffsets(zoneIDs.size());
|
List<pointField> bottomOffsets(faceZones.size());
|
||||||
|
|
||||||
forAll(regionMesh.boundaryMesh(), patchI)
|
forAll(regionMesh.boundaryMesh(), patchI)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = regionMesh.boundaryMesh()[patchI];
|
const polyPatch& pp = regionMesh.boundaryMesh()[patchI];
|
||||||
|
|
||||||
if
|
if (isA<mappedWallPolyPatch>(pp))
|
||||||
(
|
|
||||||
isA<mappedWallPolyPatch>(pp)
|
|
||||||
&& (findIndex(interRegionTopPatch, patchI) != -1)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
label zoneI = findIndex(interRegionTopPatch, patchI);
|
if (findIndex(interRegionTopPatch, patchI) != -1)
|
||||||
topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
|
{
|
||||||
}
|
label zoneI = findIndex(interRegionTopPatch, patchI);
|
||||||
else if
|
topOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
|
||||||
(
|
}
|
||||||
isA<mappedWallPolyPatch>(pp)
|
else if (findIndex(interRegionBottomPatch, patchI) != -1)
|
||||||
&& (findIndex(interRegionBottomPatch, patchI) != -1)
|
{
|
||||||
)
|
label zoneI = findIndex(interRegionBottomPatch, patchI);
|
||||||
{
|
bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
|
||||||
label zoneI = findIndex(interRegionBottomPatch, patchI);
|
}
|
||||||
|
|
||||||
bottomOffsets[zoneI] = calcOffset(extrudePatch, extruder, pp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -696,16 +696,21 @@ void Foam::addPatchCellLayer::calcSidePatch
|
|||||||
|
|
||||||
|
|
||||||
// Now hopefully every boundary edge has a side patch. Check
|
// Now hopefully every boundary edge has a side patch. Check
|
||||||
forAll(edgeFaces, edgeI)
|
if (debug)
|
||||||
{
|
{
|
||||||
if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
|
forAll(edgeFaces, edgeI)
|
||||||
{
|
{
|
||||||
const edge& e = pp.edges()[edgeI];
|
if (edgeFaces[edgeI].size() == 1 && sidePatchID[edgeI] == -1)
|
||||||
FatalErrorIn("addPatchCellLayer::calcSidePatch(..)")
|
{
|
||||||
<< "Have no sidePatchID for edge " << edgeI << " points "
|
const edge& e = pp.edges()[edgeI];
|
||||||
<< pp.points()[pp.meshPoints()[e[0]]]
|
//FatalErrorIn("addPatchCellLayer::calcSidePatch(..)")
|
||||||
<< pp.points()[pp.meshPoints()[e[1]]]
|
WarningIn("addPatchCellLayer::calcSidePatch(..)")
|
||||||
<< abort(FatalError);
|
<< "Have no sidePatchID for edge " << edgeI << " points "
|
||||||
|
<< pp.points()[pp.meshPoints()[e[0]]]
|
||||||
|
<< pp.points()[pp.meshPoints()[e[1]]]
|
||||||
|
//<< abort(FatalError);
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,7 +720,12 @@ void Foam::addPatchCellLayer::calcSidePatch
|
|||||||
// from.
|
// from.
|
||||||
forAll(edgeFaces, edgeI)
|
forAll(edgeFaces, edgeI)
|
||||||
{
|
{
|
||||||
if (edgeFaces[edgeI].size() == 1 && inflateFaceI[edgeI] == -1)
|
if
|
||||||
|
(
|
||||||
|
edgeFaces[edgeI].size() == 1
|
||||||
|
&& sidePatchID[edgeI] != -1
|
||||||
|
&& inflateFaceI[edgeI] == -1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// 1. Do we have a boundary face to inflate from
|
// 1. Do we have a boundary face to inflate from
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ boundary
|
|||||||
|
|
||||||
baffle1Wall_0
|
baffle1Wall_0
|
||||||
{
|
{
|
||||||
type directMappedWall;
|
type mappedWall;
|
||||||
sampleMode nearestPatchFace;
|
sampleMode nearestPatchFace;
|
||||||
sampleRegion region0;
|
sampleRegion region0;
|
||||||
samplePatch baffle1Wall_1;
|
samplePatch baffle1Wall_1;
|
||||||
@ -98,7 +98,7 @@ boundary
|
|||||||
|
|
||||||
baffle1Wall_1
|
baffle1Wall_1
|
||||||
{
|
{
|
||||||
type directMappedWall;
|
type mappedWall;
|
||||||
sampleMode nearestPatchFace;
|
sampleMode nearestPatchFace;
|
||||||
sampleRegion region0;
|
sampleRegion region0;
|
||||||
samplePatch baffle1Wall_0;
|
samplePatch baffle1Wall_0;
|
||||||
|
|||||||
Reference in New Issue
Block a user