mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added active flag to KinematicParcel
- used during parcel calc() function to flag whether the parcel should be tracked - if false, parcel not tracked, but sub-models are still active - useful, e.g. for particle 'stick' condition - NOTE: stored as a bool, but read/written as a label for restarts/post-processing
This commit is contained in:
@ -258,7 +258,10 @@ bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
|
|||||||
// face is hit
|
// face is hit
|
||||||
label cellI = p.cell();
|
label cellI = p.cell();
|
||||||
|
|
||||||
dt *= p.trackToFace(p.position() + dt*U_, td);
|
if (p.active())
|
||||||
|
{
|
||||||
|
dt *= p.trackToFace(p.position() + dt*U_, td);
|
||||||
|
}
|
||||||
|
|
||||||
tEnd -= dt;
|
tEnd -= dt;
|
||||||
p.stepFraction() = 1.0 - tEnd/deltaT;
|
p.stepFraction() = 1.0 - tEnd/deltaT;
|
||||||
@ -322,6 +325,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
|
|||||||
pp,
|
pp,
|
||||||
this->face(),
|
this->face(),
|
||||||
td.keepParticle,
|
td.keepParticle,
|
||||||
|
active_,
|
||||||
U_
|
U_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -194,6 +194,9 @@ protected:
|
|||||||
|
|
||||||
// Parcel properties
|
// Parcel properties
|
||||||
|
|
||||||
|
//- Active flag - tracking inactive when active = false
|
||||||
|
bool active_;
|
||||||
|
|
||||||
//- Parcel type id
|
//- Parcel type id
|
||||||
label typeId_;
|
label typeId_;
|
||||||
|
|
||||||
@ -308,6 +311,9 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
|
//- Return const access to active flag
|
||||||
|
inline bool active() const;
|
||||||
|
|
||||||
//- Return const access to type id
|
//- Return const access to type id
|
||||||
inline label typeId() const;
|
inline label typeId() const;
|
||||||
|
|
||||||
@ -332,8 +338,11 @@ public:
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
|
//- Return const access to active flag
|
||||||
|
inline bool& active();
|
||||||
|
|
||||||
//- Return access to type id
|
//- Return access to type id
|
||||||
inline label typeId();
|
inline label& typeId();
|
||||||
|
|
||||||
//- Return access to number of particles
|
//- Return access to number of particles
|
||||||
inline scalar& nParticle();
|
inline scalar& nParticle();
|
||||||
|
|||||||
@ -75,6 +75,7 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
Particle<ParcelType>(owner, position, cellI),
|
Particle<ParcelType>(owner, position, cellI),
|
||||||
|
active_(false),
|
||||||
typeId_(owner.parcelTypeId()),
|
typeId_(owner.parcelTypeId()),
|
||||||
nParticle_(0),
|
nParticle_(0),
|
||||||
d_(0.0),
|
d_(0.0),
|
||||||
@ -102,6 +103,7 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
Particle<ParcelType>(owner, position, cellI),
|
Particle<ParcelType>(owner, position, cellI),
|
||||||
|
active_(true),
|
||||||
typeId_(typeId),
|
typeId_(typeId),
|
||||||
nParticle_(nParticle0),
|
nParticle_(nParticle0),
|
||||||
d_(d0),
|
d_(d0),
|
||||||
@ -201,6 +203,13 @@ Foam::KinematicParcel<ParcelType>::trackData::g() const
|
|||||||
|
|
||||||
// * * * * * * * * * * KinematicParcel Member Functions * * * * * * * * * * //
|
// * * * * * * * * * * KinematicParcel Member Functions * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <class ParcelType>
|
||||||
|
inline bool Foam::KinematicParcel<ParcelType>::active() const
|
||||||
|
{
|
||||||
|
return active_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class ParcelType>
|
template <class ParcelType>
|
||||||
inline Foam::label Foam::KinematicParcel<ParcelType>::typeId() const
|
inline Foam::label Foam::KinematicParcel<ParcelType>::typeId() const
|
||||||
{
|
{
|
||||||
@ -251,7 +260,14 @@ inline const Foam::vector& Foam::KinematicParcel<ParcelType>::UTurb() const
|
|||||||
|
|
||||||
|
|
||||||
template <class ParcelType>
|
template <class ParcelType>
|
||||||
inline Foam::label Foam::KinematicParcel<ParcelType>::typeId()
|
inline bool& Foam::KinematicParcel<ParcelType>::active()
|
||||||
|
{
|
||||||
|
return active_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class ParcelType>
|
||||||
|
inline Foam::label& Foam::KinematicParcel<ParcelType>::typeId()
|
||||||
{
|
{
|
||||||
return typeId_;
|
return typeId_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@ License
|
|||||||
template <class ParcelType>
|
template <class ParcelType>
|
||||||
Foam::string Foam::KinematicParcel<ParcelType>::propHeader =
|
Foam::string Foam::KinematicParcel<ParcelType>::propHeader =
|
||||||
Particle<ParcelType>::propHeader
|
Particle<ParcelType>::propHeader
|
||||||
|
+ " active"
|
||||||
+ " typeId"
|
+ " typeId"
|
||||||
+ " nParticle"
|
+ " nParticle"
|
||||||
+ " d"
|
+ " d"
|
||||||
@ -53,6 +54,7 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
Particle<ParcelType>(cloud, is, readFields),
|
Particle<ParcelType>(cloud, is, readFields),
|
||||||
|
active_(false),
|
||||||
typeId_(0),
|
typeId_(0),
|
||||||
nParticle_(0.0),
|
nParticle_(0.0),
|
||||||
d_(0.0),
|
d_(0.0),
|
||||||
@ -68,6 +70,7 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
|
|||||||
{
|
{
|
||||||
if (is.format() == IOstream::ASCII)
|
if (is.format() == IOstream::ASCII)
|
||||||
{
|
{
|
||||||
|
active_ = readBool(is);
|
||||||
typeId_ = readLabel(is);
|
typeId_ = readLabel(is);
|
||||||
nParticle_ = readScalar(is);
|
nParticle_ = readScalar(is);
|
||||||
d_ = readScalar(is);
|
d_ = readScalar(is);
|
||||||
@ -81,7 +84,8 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
|
|||||||
is.read
|
is.read
|
||||||
(
|
(
|
||||||
reinterpret_cast<char*>(&typeId_),
|
reinterpret_cast<char*>(&typeId_),
|
||||||
sizeof(typeId_)
|
sizeof(active_)
|
||||||
|
+ sizeof(typeId_)
|
||||||
+ sizeof(nParticle_)
|
+ sizeof(nParticle_)
|
||||||
+ sizeof(d_)
|
+ sizeof(d_)
|
||||||
+ sizeof(U_)
|
+ sizeof(U_)
|
||||||
@ -111,6 +115,9 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
|
|||||||
|
|
||||||
Particle<ParcelType>::readFields(c);
|
Particle<ParcelType>::readFields(c);
|
||||||
|
|
||||||
|
IOField<label> active(c.fieldIOobject("active", IOobject::MUST_READ));
|
||||||
|
c.checkFieldIOobject(c, active);
|
||||||
|
|
||||||
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::MUST_READ));
|
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::MUST_READ));
|
||||||
c.checkFieldIOobject(c, typeId);
|
c.checkFieldIOobject(c, typeId);
|
||||||
|
|
||||||
@ -138,6 +145,7 @@ void Foam::KinematicParcel<ParcelType>::readFields(Cloud<ParcelType>& c)
|
|||||||
{
|
{
|
||||||
ParcelType& p = iter();
|
ParcelType& p = iter();
|
||||||
|
|
||||||
|
p.active_ = active[i];
|
||||||
p.typeId_ = typeId[i];
|
p.typeId_ = typeId[i];
|
||||||
p.nParticle_ = nParticle[i];
|
p.nParticle_ = nParticle[i];
|
||||||
p.d_ = d[i];
|
p.d_ = d[i];
|
||||||
@ -157,6 +165,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
|
|||||||
|
|
||||||
label np = c.size();
|
label np = c.size();
|
||||||
|
|
||||||
|
IOField<label> active(c.fieldIOobject("active", IOobject::NO_READ), np);
|
||||||
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::NO_READ), np);
|
IOField<label> typeId(c.fieldIOobject("typeId", IOobject::NO_READ), np);
|
||||||
IOField<scalar> nParticle
|
IOField<scalar> nParticle
|
||||||
(
|
(
|
||||||
@ -174,6 +183,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
|
|||||||
{
|
{
|
||||||
const KinematicParcel<ParcelType>& p = iter();
|
const KinematicParcel<ParcelType>& p = iter();
|
||||||
|
|
||||||
|
active[i] = p.active();
|
||||||
typeId[i] = p.typeId();
|
typeId[i] = p.typeId();
|
||||||
nParticle[i] = p.nParticle();
|
nParticle[i] = p.nParticle();
|
||||||
d[i] = p.d();
|
d[i] = p.d();
|
||||||
@ -184,6 +194,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
active.write();
|
||||||
typeId.write();
|
typeId.write();
|
||||||
nParticle.write();
|
nParticle.write();
|
||||||
d.write();
|
d.write();
|
||||||
@ -206,6 +217,7 @@ Foam::Ostream& Foam::operator<<
|
|||||||
if (os.format() == IOstream::ASCII)
|
if (os.format() == IOstream::ASCII)
|
||||||
{
|
{
|
||||||
os << static_cast<const Particle<ParcelType>&>(p)
|
os << static_cast<const Particle<ParcelType>&>(p)
|
||||||
|
<< token::SPACE << p.active()
|
||||||
<< token::SPACE << p.typeId()
|
<< token::SPACE << p.typeId()
|
||||||
<< token::SPACE << p.nParticle()
|
<< token::SPACE << p.nParticle()
|
||||||
<< token::SPACE << p.d()
|
<< token::SPACE << p.d()
|
||||||
@ -219,8 +231,9 @@ Foam::Ostream& Foam::operator<<
|
|||||||
os << static_cast<const Particle<ParcelType>&>(p);
|
os << static_cast<const Particle<ParcelType>&>(p);
|
||||||
os.write
|
os.write
|
||||||
(
|
(
|
||||||
reinterpret_cast<const char*>(&p.typeId_),
|
reinterpret_cast<const char*>(&p.active_),
|
||||||
sizeof(p.typeId())
|
sizeof(p.active())
|
||||||
|
+ sizeof(p.typeId())
|
||||||
+ sizeof(p.nParticle())
|
+ sizeof(p.nParticle())
|
||||||
+ sizeof(p.d())
|
+ sizeof(p.d())
|
||||||
+ sizeof(p.U())
|
+ sizeof(p.U())
|
||||||
|
|||||||
@ -140,6 +140,7 @@ bool Foam::LocalInteraction<CloudType>::correct
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const label faceId,
|
const label faceId,
|
||||||
bool& keepParticle,
|
bool& keepParticle,
|
||||||
|
bool& active,
|
||||||
vector& U
|
vector& U
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -158,18 +159,21 @@ bool Foam::LocalInteraction<CloudType>::correct
|
|||||||
case PatchInteractionModel<CloudType>::itEscape:
|
case PatchInteractionModel<CloudType>::itEscape:
|
||||||
{
|
{
|
||||||
keepParticle = false;
|
keepParticle = false;
|
||||||
|
active = false;
|
||||||
U = vector::zero;
|
U = vector::zero;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PatchInteractionModel<CloudType>::itStick:
|
case PatchInteractionModel<CloudType>::itStick:
|
||||||
{
|
{
|
||||||
keepParticle = true;
|
keepParticle = true;
|
||||||
|
active = false;
|
||||||
U = vector::zero;
|
U = vector::zero;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PatchInteractionModel<CloudType>::itRebound:
|
case PatchInteractionModel<CloudType>::itRebound:
|
||||||
{
|
{
|
||||||
keepParticle = true;
|
keepParticle = true;
|
||||||
|
active = true;
|
||||||
|
|
||||||
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
|
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
|
||||||
nw /= mag(nw);
|
nw /= mag(nw);
|
||||||
|
|||||||
@ -92,6 +92,7 @@ public:
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const label faceId,
|
const label faceId,
|
||||||
bool& keepParticle,
|
bool& keepParticle,
|
||||||
|
bool& active,
|
||||||
vector& U
|
vector& U
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -155,6 +155,7 @@ public:
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const label faceId,
|
const label faceId,
|
||||||
bool& keepParticle,
|
bool& keepParticle,
|
||||||
|
bool& active,
|
||||||
vector& U
|
vector& U
|
||||||
) const = 0;
|
) const = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -61,10 +61,12 @@ bool Foam::Rebound<CloudType>::correct
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const label faceId,
|
const label faceId,
|
||||||
bool& keepParticle,
|
bool& keepParticle,
|
||||||
|
bool& active,
|
||||||
vector& U
|
vector& U
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
keepParticle = true;
|
keepParticle = true;
|
||||||
|
active = true;
|
||||||
|
|
||||||
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
|
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
|
||||||
nw /= mag(nw);
|
nw /= mag(nw);
|
||||||
|
|||||||
@ -82,6 +82,7 @@ public:
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const label faceId,
|
const label faceId,
|
||||||
bool& keepParticle,
|
bool& keepParticle,
|
||||||
|
bool& active,
|
||||||
vector& U
|
vector& U
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -98,6 +98,7 @@ bool Foam::StandardWallInteraction<CloudType>::correct
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const label faceId,
|
const label faceId,
|
||||||
bool& keepParticle,
|
bool& keepParticle,
|
||||||
|
bool& active,
|
||||||
vector& U
|
vector& U
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -108,18 +109,21 @@ bool Foam::StandardWallInteraction<CloudType>::correct
|
|||||||
case PatchInteractionModel<CloudType>::itEscape:
|
case PatchInteractionModel<CloudType>::itEscape:
|
||||||
{
|
{
|
||||||
keepParticle = false;
|
keepParticle = false;
|
||||||
|
active = false;
|
||||||
U = vector::zero;
|
U = vector::zero;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PatchInteractionModel<CloudType>::itStick:
|
case PatchInteractionModel<CloudType>::itStick:
|
||||||
{
|
{
|
||||||
keepParticle = true;
|
keepParticle = true;
|
||||||
|
active = false;
|
||||||
U = vector::zero;
|
U = vector::zero;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PatchInteractionModel<CloudType>::itRebound:
|
case PatchInteractionModel<CloudType>::itRebound:
|
||||||
{
|
{
|
||||||
keepParticle = true;
|
keepParticle = true;
|
||||||
|
active = true;
|
||||||
|
|
||||||
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
|
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
|
||||||
nw /= mag(nw);
|
nw /= mag(nw);
|
||||||
|
|||||||
@ -102,6 +102,7 @@ public:
|
|||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
const label faceId,
|
const label faceId,
|
||||||
bool& keepParticle,
|
bool& keepParticle,
|
||||||
|
bool& active,
|
||||||
vector& U
|
vector& U
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user