mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Parcel tracking - allow track to continue in the event of a tracking rescue
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,12 @@ License
|
||||
#include "IntegrationScheme.H"
|
||||
#include "meshTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
Foam::label Foam::KinematicParcel<ParcelType>::maxTrackAttempts = 1;
|
||||
|
||||
|
||||
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
@ -271,7 +277,8 @@ bool Foam::KinematicParcel<ParcelType>::move
|
||||
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
|
||||
const scalar dtMax = tEnd;
|
||||
|
||||
bool moving = true;
|
||||
bool tracking = true;
|
||||
label nTrackingStalled = 0;
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
||||
{
|
||||
@ -287,7 +294,7 @@ bool Foam::KinematicParcel<ParcelType>::move
|
||||
const label cellI = p.cell();
|
||||
|
||||
const scalar magU = mag(U_);
|
||||
if (p.active() && moving && (magU > ROOTVSMALL))
|
||||
if (p.active() && tracking && (magU > ROOTVSMALL))
|
||||
{
|
||||
const scalar d = dt*magU;
|
||||
const scalar dCorr = min(d, maxCo*cellLengthScale[cellI]);
|
||||
@ -300,13 +307,25 @@ bool Foam::KinematicParcel<ParcelType>::move
|
||||
|
||||
scalar newStepFraction = 1.0 - tEnd/trackTime;
|
||||
|
||||
if (tracking)
|
||||
{
|
||||
if
|
||||
(
|
||||
mag(p.stepFraction() - newStepFraction)
|
||||
< particle::minStepFractionTol
|
||||
)
|
||||
{
|
||||
moving = false;
|
||||
nTrackingStalled++;
|
||||
|
||||
if (nTrackingStalled > maxTrackAttempts)
|
||||
{
|
||||
tracking = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nTrackingStalled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
p.stepFraction() = newStepFraction;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -218,6 +218,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Number of particle tracking attempts before we assume that it stalls
|
||||
static label maxTrackAttempts;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
Reference in New Issue
Block a user