Skip to content
Snippets Groups Projects
Commit 6a1b5673 authored by andy's avatar andy
Browse files

ENH: Cloud tracking - handle case where tracking stalls due to stepFraction

parent 2f04e975
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -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; ...@@ -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: ...@@ -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 ...@@ -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 ...@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment