lagrangian: Delete lost particles on restart

Warning messages are generated for each particle deleted
This commit is contained in:
Henry Weller
2016-08-16 11:32:27 +01:00
parent 3f82568b74
commit bc71a7d208
9 changed files with 27 additions and 1 deletions

View File

@ -172,6 +172,25 @@ void Foam::Cloud<ParticleType>::deleteParticle(ParticleType& p)
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::deleteLostParticles()
{
forAllIter(typename Cloud<ParticleType>, *this, pIter)
{
ParticleType& p = pIter();
if (p.cell() == -1)
{
WarningInFunction
<< "deleting lost particle at position " << p.position()
<< endl;
deleteParticle(p);
}
}
}
template<class ParticleType>
void Foam::Cloud<ParticleType>::cloudReset(const Cloud<ParticleType>& c)
{

View File

@ -109,6 +109,7 @@ Foam::CollidingCloud<CloudType>::CollidingCloud
if (readFields)
{
parcelType::readFields(*this);
this->deleteLostParticles();
}
}
}

View File

@ -394,6 +394,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
if (readFields)
{
parcelType::readFields(*this);
this->deleteLostParticles();
}
}

View File

@ -94,6 +94,7 @@ Foam::MPPICCloud<CloudType>::MPPICCloud
if (readFields)
{
parcelType::readFields(*this);
this->deleteLostParticles();
}
}
}

View File

@ -111,6 +111,7 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
if (readFields)
{
parcelType::readFields(*this, this->composition());
this->deleteLostParticles();
}
}

View File

@ -98,6 +98,7 @@ Foam::ReactingMultiphaseCloud<CloudType>::ReactingMultiphaseCloud
if (readFields)
{
parcelType::readFields(*this, this->composition());
this->deleteLostParticles();
}
}

View File

@ -203,6 +203,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
if (readFields)
{
parcelType::readFields(*this);
this->deleteLostParticles();
}
}

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -94,6 +94,7 @@ Foam::SprayCloud<CloudType>::SprayCloud
if (readFields)
{
parcelType::readFields(*this, this->composition());
this->deleteLostParticles();
}
Info << "Average parcel mass: " << averageParcelMass_ << endl;