Simplified near-wall distance: no neighbourhood search. Experimental

This commit is contained in:
Hrvoje Jasak 2017-12-30 09:30:07 +00:00
parent ec3f650fdb
commit bfee0e5dc0

View file

@ -33,70 +33,86 @@ License
void Foam::nearWallDist::doAll() void Foam::nearWallDist::doAll()
{ {
cellDistFuncs wallUtils(mesh_); const fvPatchList& patches = mesh_.boundary();
// AJ: make sure to pick up all patches that are specified as a wall forAll (patches, patchI)
const polyBoundaryMesh& bMesh = wallUtils.mesh().boundaryMesh();
labelHashSet wallPatchIDs(bMesh.size());
forAll(bMesh, patchI)
{ {
if (bMesh[patchI].isWall()) fvPatchScalarField& yPatch = operator[](patchI);
if (patches[patchI].isWall())
{ {
wallPatchIDs.insert(patchI); yPatch = 1/patches[patchI].deltaCoeffs();
}
}
// Get patch ids of walls
// labelHashSet wallPatchIDs(wallUtils.getPatchIDs<wallPolyPatch>());
// Size neighbours array for maximum possible
labelList neighbours(wallUtils.maxPatchSize(wallPatchIDs));
// Correct all cells with face on wall
const volVectorField& cellCentres = mesh_.C();
forAll(mesh_.boundary(), patchI)
{
fvPatchScalarField& ypatch = operator[](patchI);
const fvPatch& patch = mesh_.boundary()[patchI];
if (patch.isWall())
{
const polyPatch& pPatch = patch.patch();
const unallocLabelList& faceCells = patch.faceCells();
// Check cells with face on wall
forAll(patch, patchFaceI)
{
label nNeighbours = wallUtils.getPointNeighbours
(
pPatch,
patchFaceI,
neighbours
);
label minFaceI = -1;
ypatch[patchFaceI] = wallUtils.smallestDist
(
cellCentres[faceCells[patchFaceI]],
pPatch,
nNeighbours,
neighbours,
minFaceI
);
}
} }
else else
{ {
ypatch = 0.0; yPatch = 0.0;
} }
} }
// cellDistFuncs wallUtils(mesh_);
// // AJ: make sure to pick up all patches that are specified as a wall
// const polyBoundaryMesh& bMesh = wallUtils.mesh().boundaryMesh();
// labelHashSet wallPatchIDs(bMesh.size());
// forAll(bMesh, patchI)
// {
// if (bMesh[patchI].isWall())
// {
// wallPatchIDs.insert(patchI);
// }
// }
// // Get patch ids of walls
// // labelHashSet wallPatchIDs(wallUtils.getPatchIDs<wallPolyPatch>());
// // Size neighbours array for maximum possible
// labelList neighbours(wallUtils.maxPatchSize(wallPatchIDs));
// // Correct all cells with face on wall
// const volVectorField& cellCentres = mesh_.C();
// forAll(mesh_.boundary(), patchI)
// {
// fvPatchScalarField& ypatch = operator[](patchI);
// const fvPatch& patch = mesh_.boundary()[patchI];
// if (patch.isWall())
// {
// const polyPatch& pPatch = patch.patch();
// const unallocLabelList& faceCells = patch.faceCells();
// // Check cells with face on wall
// forAll(patch, patchFaceI)
// {
// label nNeighbours = wallUtils.getPointNeighbours
// (
// pPatch,
// patchFaceI,
// neighbours
// );
// label minFaceI = -1;
// ypatch[patchFaceI] = wallUtils.smallestDist
// (
// cellCentres[faceCells[patchFaceI]],
// pPatch,
// nNeighbours,
// neighbours,
// minFaceI
// );
// }
// }
// else
// {
// ypatch = 0.0;
// }
// }
} }