BUG: wallPoint: initialise to -GREAT to handle ami interpolation

This commit is contained in:
mattijs
2012-03-05 11:03:40 +00:00
parent 95b29c7ee4
commit f82f5ff3fb
4 changed files with 41 additions and 42 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,25 +42,29 @@ inline bool wallPointYPlus::update
{ {
scalar dist2 = magSqr(pt - w2.origin()); scalar dist2 = magSqr(pt - w2.origin());
scalar diff = distSqr() - dist2; if (valid(td))
if (diff < 0)
{ {
// already nearer to pt scalar diff = distSqr() - dist2;
return false;
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)))
{ // Either *this is not yet valid or w2 is closer
// don't propagate small changes
return false;
}
else
{ {
// only propagate if interesting (i.e. y+ < 100) // only propagate if interesting (i.e. y+ < 100)
scalar yPlus = Foam::sqrt(dist2)/w2.data(); scalar yPlus = Foam::sqrt(dist2)/w2.data();
if (yPlus < yPlusCutOff) if (yPlus < yPlusCutOff)
{ {
// update with new values // update with new values

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -101,8 +101,9 @@ Foam::label Foam::patchDataWave<TransferType>::getValues
else else
{ {
// Illegal/unset value. What to do with data? // 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] = point::max;
cellData_[cellI] = cellInfo[cellI].data(); cellData_[cellI] = cellInfo[cellI].data();
@ -149,7 +150,7 @@ Foam::label Foam::patchDataWave<TransferType>::getValues
{ {
// Illegal/unset value. What to do with data? // Illegal/unset value. What to do with data?
patchField[patchFaceI] = dist; patchField[patchFaceI] = mag(dist);
//patchDataField[patchFaceI] = point::max; //patchDataField[patchFaceI] = point::max;
patchDataField[patchFaceI] = faceInfo[meshFaceI].data(); patchDataField[patchFaceI] = faceInfo[meshFaceI].data();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,24 @@ inline bool wallPointData<Type>::update
{ {
scalar dist2 = magSqr(pt - w2.origin()); 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 // current not yet set so use any value
distSqr() = dist2; distSqr() = dist2;
@ -52,29 +69,6 @@ inline bool wallPointData<Type>::update
return true; 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;
}
} }

View File

@ -85,7 +85,7 @@ inline bool Foam::wallPoint::update
inline Foam::wallPoint::wallPoint() inline Foam::wallPoint::wallPoint()
: :
origin_(point::max), origin_(point::max),
distSqr_(GREAT) distSqr_(-GREAT)
{} {}