From c7f24b57ed21e3b1062fbcb7ed02fbe214319902 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Wed, 30 May 2018 12:56:01 +0100 Subject: [PATCH] Added immersed boundary support to wall distance --- .../fvMesh/wallDist/nearWallDist.C | 2 +- src/finiteVolume/fvMesh/wallDist/wallDist.C | 20 +++++++++---------- src/finiteVolume/fvMesh/wallDist/wallDist.H | 5 ++--- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/finiteVolume/fvMesh/wallDist/nearWallDist.C b/src/finiteVolume/fvMesh/wallDist/nearWallDist.C index b00bfab9b..79aba48a2 100644 --- a/src/finiteVolume/fvMesh/wallDist/nearWallDist.C +++ b/src/finiteVolume/fvMesh/wallDist/nearWallDist.C @@ -80,7 +80,7 @@ void Foam::nearWallDist::correct() if (mesh_.changing()) { // Update size of GeometricBoundaryField - forAll(mesh_.boundary(), patchI) + forAll (mesh_.boundary(), patchI) { operator[](patchI).setSize(mesh_.boundary()[patchI].size()); } diff --git a/src/finiteVolume/fvMesh/wallDist/wallDist.C b/src/finiteVolume/fvMesh/wallDist/wallDist.C index 7c41b18cd..74a592aed 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDist.C +++ b/src/finiteVolume/fvMesh/wallDist/wallDist.C @@ -78,24 +78,22 @@ void Foam::wallDist::correct() } } - // Get patchids of walls - // labelHashSet wallPatchIDs(getPatchIDs()); - // Calculate distance starting from wallPatch faces. patchWave wave(cellDistFuncs::mesh(), wallPatchIDs, correctWalls_); // Transfer cell values from wave into *this transfer(wave.distance()); - // Transfer values on patches into boundaryField of *this - forAll (boundaryField(), patchI) - { - if (!isA(boundaryField()[patchI])) - { - scalarField& waveFld = wave.patchDistance()[patchI]; + // Make near-wall distance consistent with wall distance + // This is needed by immersed boundary walls + // HJ, 29/May/2018 + const fvPatchList& patches = volScalarField::mesh().boundary(); - boundaryField()[patchI].transfer(waveFld); - } + forAll (patches, patchI) + { + fvPatchScalarField& yPatch = boundaryField()[patchI]; + + boundaryField()[patchI] = 1/patches[patchI].deltaCoeffs(); } // Transfer number of unset values diff --git a/src/finiteVolume/fvMesh/wallDist/wallDist.H b/src/finiteVolume/fvMesh/wallDist/wallDist.H index f37c91c05..4525c30f8 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallDist.H +++ b/src/finiteVolume/fvMesh/wallDist/wallDist.H @@ -112,9 +112,8 @@ public: wallDist(const fvMesh& mesh, bool correctWalls = true); - // Destructor - - virtual ~wallDist(); + //- Destructor + virtual ~wallDist(); // Member Functions