diff --git a/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H b/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H index 3eb7ebcaf8..5f7c7bcd6f 100644 --- a/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H +++ b/src/finiteVolume/fvMesh/wallDist/wallPointYPlus/wallPointYPlusI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,25 +42,29 @@ inline bool wallPointYPlus::update { scalar dist2 = magSqr(pt - w2.origin()); - scalar diff = distSqr() - dist2; - - if (diff < 0) + if (valid(td)) { - // already nearer to pt - return false; + scalar diff = distSqr() - dist2; + + if (diff < 0) + { + // already nearer to pt + return false; + } + + if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol))) + { + // don't propagate small changes + return false; + } } - if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol))) - { - // don't propagate small changes - return false; - } - else + + // Either *this is not yet valid or w2 is closer { // only propagate if interesting (i.e. y+ < 100) scalar yPlus = Foam::sqrt(dist2)/w2.data(); - if (yPlus < yPlusCutOff) { // update with new values diff --git a/src/meshTools/cellDist/patchWave/patchDataWave.C b/src/meshTools/cellDist/patchWave/patchDataWave.C index d6ba4bd2bf..2231458e78 100644 --- a/src/meshTools/cellDist/patchWave/patchDataWave.C +++ b/src/meshTools/cellDist/patchWave/patchDataWave.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -101,8 +101,9 @@ Foam::label Foam::patchDataWave::getValues else { // Illegal/unset value. What to do with data? + // Note: mag for now. Should maybe be member of TransferType? - distance_[cellI] = dist; + distance_[cellI] = mag(dist); //cellData_[cellI] = point::max; cellData_[cellI] = cellInfo[cellI].data(); @@ -149,7 +150,7 @@ Foam::label Foam::patchDataWave::getValues { // Illegal/unset value. What to do with data? - patchField[patchFaceI] = dist; + patchField[patchFaceI] = mag(dist); //patchDataField[patchFaceI] = point::max; patchDataField[patchFaceI] = faceInfo[meshFaceI].data(); diff --git a/src/meshTools/cellDist/wallPoint/wallPointDataI.H b/src/meshTools/cellDist/wallPoint/wallPointDataI.H index a9969812bc..3ec9dd9d5b 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointDataI.H +++ b/src/meshTools/cellDist/wallPoint/wallPointDataI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,24 @@ inline bool wallPointData::update { scalar dist2 = magSqr(pt - w2.origin()); - if (!valid(td)) + if (valid(td)) + { + scalar diff = distSqr() - dist2; + + if (diff < 0) + { + // already nearer to pt + return false; + } + + if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol))) + { + // don't propagate small changes + return false; + } + } + + // Either *this is not yet valid or w2 is closer { // current not yet set so use any value distSqr() = dist2; @@ -52,29 +69,6 @@ inline bool wallPointData::update return true; } - - scalar diff = distSqr() - dist2; - - if (diff < 0) - { - // already nearer to pt - return false; - } - - if ((diff < SMALL) || ((distSqr() > SMALL) && (diff/distSqr() < tol))) - { - // don't propagate small changes - return false; - } - else - { - // update with new values - distSqr() = dist2; - origin() = w2.origin(); - data_ = w2.data(); - - return true; - } } diff --git a/src/meshTools/cellDist/wallPoint/wallPointI.H b/src/meshTools/cellDist/wallPoint/wallPointI.H index f013664849..8cad5f6a76 100644 --- a/src/meshTools/cellDist/wallPoint/wallPointI.H +++ b/src/meshTools/cellDist/wallPoint/wallPointI.H @@ -85,7 +85,7 @@ inline bool Foam::wallPoint::update inline Foam::wallPoint::wallPoint() : origin_(point::max), - distSqr_(GREAT) + distSqr_(-GREAT) {}