From bfee0e5dc03d27d9f747ac8b46880d3e6554f54b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Sat, 30 Dec 2017 09:30:07 +0000 Subject: [PATCH] Simplified near-wall distance: no neighbourhood search. Experimental --- .../fvMesh/wallDist/nearWallDist.C | 128 ++++++++++-------- 1 file changed, 72 insertions(+), 56 deletions(-) diff --git a/src/finiteVolume/fvMesh/wallDist/nearWallDist.C b/src/finiteVolume/fvMesh/wallDist/nearWallDist.C index cee71aafe..93fc1abfc 100644 --- a/src/finiteVolume/fvMesh/wallDist/nearWallDist.C +++ b/src/finiteVolume/fvMesh/wallDist/nearWallDist.C @@ -33,70 +33,86 @@ License 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 - const polyBoundaryMesh& bMesh = wallUtils.mesh().boundaryMesh(); - labelHashSet wallPatchIDs(bMesh.size()); - forAll(bMesh, patchI) + forAll (patches, patchI) { - if (bMesh[patchI].isWall()) + fvPatchScalarField& yPatch = operator[](patchI); + + if (patches[patchI].isWall()) { - wallPatchIDs.insert(patchI); - } - } - - // Get patch ids of walls - // labelHashSet wallPatchIDs(wallUtils.getPatchIDs()); - - // 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 - ); - } + yPatch = 1/patches[patchI].deltaCoeffs(); } 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()); + + // // 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; + // } + // } }