mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Cloud tracking - handle case where tracking stalls due to stepFraction
This commit is contained in:
@ -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-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -34,6 +34,8 @@ const Foam::scalar Foam::particle::trackingCorrectionTol = 1e-5;
|
|||||||
|
|
||||||
const Foam::scalar Foam::particle::lambdaDistanceToleranceCoeff = 1e3*SMALL;
|
const Foam::scalar Foam::particle::lambdaDistanceToleranceCoeff = 1e3*SMALL;
|
||||||
|
|
||||||
|
const Foam::scalar Foam::particle::minStepFractionTol = 1e5*SMALL;
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(particle, 0);
|
defineTypeNameAndDebug(particle, 0);
|
||||||
|
|||||||
@ -307,6 +307,9 @@ public:
|
|||||||
// for the denominator and numerator of lambda
|
// for the denominator and numerator of lambda
|
||||||
static const scalar lambdaDistanceToleranceCoeff;
|
static const scalar lambdaDistanceToleranceCoeff;
|
||||||
|
|
||||||
|
//- Minimum stepFraction tolerance
|
||||||
|
static const scalar minStepFractionTol;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
|||||||
@ -271,6 +271,8 @@ bool Foam::KinematicParcel<ParcelType>::move
|
|||||||
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
|
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
|
||||||
const scalar dtMax = tEnd;
|
const scalar dtMax = tEnd;
|
||||||
|
|
||||||
|
bool moving = true;
|
||||||
|
|
||||||
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
||||||
{
|
{
|
||||||
// Apply correction to position for reduced-D cases
|
// Apply correction to position for reduced-D cases
|
||||||
@ -281,22 +283,36 @@ bool Foam::KinematicParcel<ParcelType>::move
|
|||||||
// Set the Lagrangian time-step
|
// Set the Lagrangian time-step
|
||||||
scalar dt = min(dtMax, tEnd);
|
scalar dt = min(dtMax, tEnd);
|
||||||
|
|
||||||
// Remember which cell the parcel is in since this will change if
|
// Cache the parcel current cell as this will change if a face is hit
|
||||||
// a face is hit
|
|
||||||
const label cellI = p.cell();
|
const label cellI = p.cell();
|
||||||
|
|
||||||
const scalar magU = mag(U_);
|
const scalar magU = mag(U_);
|
||||||
if (p.active() && magU > ROOTVSMALL)
|
if (p.active())
|
||||||
{
|
{
|
||||||
const scalar d = dt*magU;
|
const scalar d = dt*magU;
|
||||||
const scalar dCorr = min(d, maxCo*cbrt(V[cellI]));
|
const scalar dCorr = min(d, maxCo*cbrt(V[cellI]));
|
||||||
dt *=
|
dt *= dCorr/d;
|
||||||
dCorr/d
|
|
||||||
*p.trackToFace(p.position() + dCorr*U_/magU, td);
|
if (moving && (magU > ROOTVSMALL))
|
||||||
|
{
|
||||||
|
dt *= p.trackToFace(p.position() + dCorr*U_/magU, td);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tEnd -= dt;
|
tEnd -= dt;
|
||||||
p.stepFraction() = 1.0 - tEnd/trackTime;
|
|
||||||
|
scalar newStepFraction = 1.0 - tEnd/trackTime;
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
mag(p.stepFraction() - newStepFraction)
|
||||||
|
< particle::minStepFractionTol
|
||||||
|
)
|
||||||
|
{
|
||||||
|
moving = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.stepFraction() = newStepFraction;
|
||||||
|
|
||||||
// Avoid problems with extremely small timesteps
|
// Avoid problems with extremely small timesteps
|
||||||
if (dt > ROOTVSMALL)
|
if (dt > ROOTVSMALL)
|
||||||
|
|||||||
Reference in New Issue
Block a user