mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Code updates in lieu of cloud updates
This commit is contained in:
@ -327,7 +327,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
|
||||
const PtrList<PatchField<Type> >& ptfl
|
||||
)
|
||||
:
|
||||
DimensionedField<Type, GeoMesh>(io, mesh, ds, iField, false),
|
||||
DimensionedField<Type, GeoMesh>(io, mesh, ds, iField),
|
||||
timeIndex_(this->time().timeIndex()),
|
||||
field0Ptr_(NULL),
|
||||
fieldPrevIterPtr_(NULL),
|
||||
|
||||
@ -94,14 +94,13 @@ Foam::parcel::parcel
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::parcel::move(spray& sDB)
|
||||
bool Foam::parcel::move(spray& sDB, const scalar trackTime)
|
||||
{
|
||||
const polyMesh& mesh = cloud().pMesh();
|
||||
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
|
||||
|
||||
const liquidMixture& fuels = sDB.fuels();
|
||||
|
||||
scalar deltaT = sDB.runTime().deltaTValue();
|
||||
label Nf = fuels.components().size();
|
||||
label Ns = sDB.composition().Y().size();
|
||||
|
||||
@ -156,12 +155,12 @@ bool Foam::parcel::move(spray& sDB)
|
||||
pg,
|
||||
Yfg,
|
||||
m()*fuels.Y(X()),
|
||||
deltaT
|
||||
trackTime
|
||||
);
|
||||
|
||||
|
||||
// set the end-time for the track
|
||||
scalar tEnd = (1.0 - stepFraction())*deltaT;
|
||||
scalar tEnd = (1.0 - stepFraction())*trackTime;
|
||||
|
||||
// set the maximum time step for this parcel
|
||||
scalar dtMax = min
|
||||
@ -215,7 +214,7 @@ bool Foam::parcel::move(spray& sDB)
|
||||
tEnd -= dt;
|
||||
|
||||
// Set the current time-step fraction.
|
||||
stepFraction() = 1.0 - tEnd/deltaT;
|
||||
stepFraction() = 1.0 - tEnd/trackTime;
|
||||
|
||||
if (onBoundary()) // hit face
|
||||
{
|
||||
|
||||
@ -349,7 +349,7 @@ public:
|
||||
|
||||
// Parcel operations
|
||||
|
||||
bool move(spray& sprayData);
|
||||
bool move(spray& sprayData, const scalar trackTime);
|
||||
|
||||
//- Transform the position and physical properties of the particle
|
||||
// according to the given transformation tensor
|
||||
|
||||
@ -159,7 +159,8 @@ void Foam::spray::inject()
|
||||
(runTime_.deltaTValue() - dt)
|
||||
/runTime_.deltaTValue();
|
||||
|
||||
bool keepParcel = pPtr->move(*this);
|
||||
bool keepParcel =
|
||||
pPtr->move(*this, runTime_.deltaTValue());
|
||||
|
||||
if (keepParcel)
|
||||
{
|
||||
|
||||
@ -76,7 +76,7 @@ void Foam::spray::move()
|
||||
srhos_[i] = 0.0;
|
||||
}
|
||||
|
||||
Cloud<parcel>::move(*this);
|
||||
Cloud<parcel>::move(*this, runTime_.deltaTValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -984,7 +984,7 @@ void Foam::DsmcCloud<ParcelType>::evolve()
|
||||
this->inflowBoundary().inflow();
|
||||
|
||||
// Move the particles ballistically with their current velocities
|
||||
Cloud<ParcelType>::move(td);
|
||||
Cloud<ParcelType>::move(td, mesh_.time().deltaTValue());
|
||||
|
||||
// Update cell occupancy
|
||||
buildCellOccupancy();
|
||||
|
||||
@ -32,7 +32,8 @@ template<class ParcelType>
|
||||
template<class TrackData>
|
||||
bool Foam::DsmcParcel<ParcelType>::move
|
||||
(
|
||||
TrackData& td
|
||||
TrackData& td,
|
||||
const scalar trackTime
|
||||
)
|
||||
{
|
||||
ParcelType& p = static_cast<ParcelType&>(*this);
|
||||
@ -43,8 +44,7 @@ bool Foam::DsmcParcel<ParcelType>::move
|
||||
const polyMesh& mesh = td.cloud().pMesh();
|
||||
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
|
||||
|
||||
const scalar deltaT = mesh.time().deltaTValue();
|
||||
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
|
||||
scalar tEnd = (1.0 - p.stepFraction())*trackTime;
|
||||
const scalar dtMax = tEnd;
|
||||
|
||||
// For reduced-D cases, the velocity used to track needs to be
|
||||
@ -71,7 +71,7 @@ bool Foam::DsmcParcel<ParcelType>::move
|
||||
|
||||
tEnd -= dt;
|
||||
|
||||
p.stepFraction() = 1.0 - tEnd/deltaT;
|
||||
p.stepFraction() = 1.0 - tEnd/trackTime;
|
||||
|
||||
if (p.onBoundary() && td.keepParticle)
|
||||
{
|
||||
|
||||
@ -200,9 +200,12 @@ public:
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<ParcelType> clone() const
|
||||
virtual autoPtr<Particle<ParcelType> > clone() const
|
||||
{
|
||||
return autoPtr<ParcelType>(new DsmcParcel<ParcelType>(*this));
|
||||
return autoPtr<Particle<ParcelType> >
|
||||
(
|
||||
new DsmcParcel<ParcelType>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -234,7 +237,7 @@ public:
|
||||
|
||||
//- Move the parcel
|
||||
template<class TrackData>
|
||||
bool move(TrackData& td);
|
||||
bool move(TrackData& td, const scalar trackTime);
|
||||
|
||||
|
||||
// Patch interactions
|
||||
|
||||
@ -81,9 +81,9 @@ public:
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<dsmcParcel> clone() const
|
||||
autoPtr<Particle<dsmcParcel> > clone() const
|
||||
{
|
||||
return autoPtr<dsmcParcel>(new dsmcParcel(*this));
|
||||
return autoPtr<Particle<dsmcParcel> >(new dsmcParcel(*this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -80,29 +80,27 @@ Foam::molecule::trackData::trackData
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
bool Foam::molecule::move(molecule::trackData& td)
|
||||
bool Foam::molecule::move(molecule::trackData& td, const scalar trackTime)
|
||||
{
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
|
||||
const constantProperties& constProps(td.molCloud().constProps(id_));
|
||||
|
||||
scalar deltaT = cloud().pMesh().time().deltaTValue();
|
||||
|
||||
if (td.part() == 0)
|
||||
{
|
||||
// First leapfrog velocity adjust part, required before tracking+force
|
||||
// part
|
||||
|
||||
v_ += 0.5*deltaT*a_;
|
||||
v_ += 0.5*trackTime*a_;
|
||||
|
||||
pi_ += 0.5*deltaT*tau_;
|
||||
pi_ += 0.5*trackTime*tau_;
|
||||
}
|
||||
else if (td.part() == 1)
|
||||
{
|
||||
// Leapfrog tracking part
|
||||
|
||||
scalar tEnd = (1.0 - stepFraction())*deltaT;
|
||||
scalar tEnd = (1.0 - stepFraction())*trackTime;
|
||||
scalar dtMax = tEnd;
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL)
|
||||
@ -113,7 +111,7 @@ bool Foam::molecule::move(molecule::trackData& td)
|
||||
dt *= trackToFace(position() + dt*v_, td);
|
||||
|
||||
tEnd -= dt;
|
||||
stepFraction() = 1.0 - tEnd/deltaT;
|
||||
stepFraction() = 1.0 - tEnd/trackTime;
|
||||
}
|
||||
}
|
||||
else if (td.part() == 2)
|
||||
@ -130,26 +128,26 @@ bool Foam::molecule::move(molecule::trackData& td)
|
||||
|
||||
if (!constProps.linearMolecule())
|
||||
{
|
||||
R = rotationTensorX(0.5*deltaT*pi_.x()/momentOfInertia.xx());
|
||||
R = rotationTensorX(0.5*trackTime*pi_.x()/momentOfInertia.xx());
|
||||
pi_ = pi_ & R;
|
||||
Q_ = Q_ & R;
|
||||
}
|
||||
|
||||
R = rotationTensorY(0.5*deltaT*pi_.y()/momentOfInertia.yy());
|
||||
R = rotationTensorY(0.5*trackTime*pi_.y()/momentOfInertia.yy());
|
||||
pi_ = pi_ & R;
|
||||
Q_ = Q_ & R;
|
||||
|
||||
R = rotationTensorZ(deltaT*pi_.z()/momentOfInertia.zz());
|
||||
R = rotationTensorZ(trackTime*pi_.z()/momentOfInertia.zz());
|
||||
pi_ = pi_ & R;
|
||||
Q_ = Q_ & R;
|
||||
|
||||
R = rotationTensorY(0.5*deltaT*pi_.y()/momentOfInertia.yy());
|
||||
R = rotationTensorY(0.5*trackTime*pi_.y()/momentOfInertia.yy());
|
||||
pi_ = pi_ & R;
|
||||
Q_ = Q_ & R;
|
||||
|
||||
if (!constProps.linearMolecule())
|
||||
{
|
||||
R = rotationTensorX(0.5*deltaT*pi_.x()/momentOfInertia.xx());
|
||||
R = rotationTensorX(0.5*trackTime*pi_.x()/momentOfInertia.xx());
|
||||
pi_ = pi_ & R;
|
||||
Q_ = Q_ & R;
|
||||
}
|
||||
@ -177,9 +175,9 @@ bool Foam::molecule::move(molecule::trackData& td)
|
||||
tau_ += (constProps.siteReferencePositions()[s] ^ (Q_.T() & f));
|
||||
}
|
||||
|
||||
v_ += 0.5*deltaT*a_;
|
||||
v_ += 0.5*trackTime*a_;
|
||||
|
||||
pi_ += 0.5*deltaT*tau_;
|
||||
pi_ += 0.5*trackTime*tau_;
|
||||
|
||||
if (constProps.pointMolecule())
|
||||
{
|
||||
|
||||
@ -251,9 +251,9 @@ public:
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<molecule> clone() const
|
||||
autoPtr<Particle<molecule> > clone() const
|
||||
{
|
||||
return autoPtr<molecule>(new molecule(*this));
|
||||
return autoPtr<Particle<molecule> >(new molecule(*this));
|
||||
}
|
||||
|
||||
|
||||
@ -261,7 +261,7 @@ public:
|
||||
|
||||
// Tracking
|
||||
|
||||
bool move(trackData&);
|
||||
bool move(trackData&, const scalar trackTime);
|
||||
|
||||
void transformProperties(const tensor& T);
|
||||
|
||||
|
||||
@ -1160,18 +1160,18 @@ Foam::moleculeCloud::moleculeCloud
|
||||
void Foam::moleculeCloud::evolve()
|
||||
{
|
||||
molecule::trackData td0(*this, 0);
|
||||
Cloud<molecule>::move(td0);
|
||||
Cloud<molecule>::move(td0, mesh_.time().deltaTValue());
|
||||
|
||||
molecule::trackData td1(*this, 1);
|
||||
Cloud<molecule>::move(td1);
|
||||
Cloud<molecule>::move(td1, mesh_.time().deltaTValue());
|
||||
|
||||
molecule::trackData td2(*this, 2);
|
||||
Cloud<molecule>::move(td2);
|
||||
Cloud<molecule>::move(td2, mesh_.time().deltaTValue());
|
||||
|
||||
calculateForce();
|
||||
|
||||
molecule::trackData td3(*this, 3);
|
||||
Cloud<molecule>::move(td3);
|
||||
Cloud<molecule>::move(td3, mesh_.time().deltaTValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,7 +27,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::solidParticle::move(solidParticle::trackData& td)
|
||||
bool Foam::solidParticle::move
|
||||
(
|
||||
solidParticle::trackData& td,
|
||||
const scalar trackTime
|
||||
)
|
||||
{
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
@ -35,8 +39,7 @@ bool Foam::solidParticle::move(solidParticle::trackData& td)
|
||||
const polyMesh& mesh = cloud().pMesh();
|
||||
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
|
||||
|
||||
scalar deltaT = mesh.time().deltaTValue();
|
||||
scalar tEnd = (1.0 - stepFraction())*deltaT;
|
||||
scalar tEnd = (1.0 - stepFraction())*trackTime;
|
||||
scalar dtMax = tEnd;
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
|
||||
@ -44,7 +47,7 @@ bool Foam::solidParticle::move(solidParticle::trackData& td)
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Time = " << mesh.time().timeName()
|
||||
<< " deltaT = " << deltaT
|
||||
<< " trackTime = " << trackTime
|
||||
<< " tEnd = " << tEnd
|
||||
<< " steptFraction() = " << stepFraction() << endl;
|
||||
}
|
||||
@ -59,7 +62,7 @@ bool Foam::solidParticle::move(solidParticle::trackData& td)
|
||||
dt *= trackToFace(position() + dt*U_, td);
|
||||
|
||||
tEnd -= dt;
|
||||
stepFraction() = 1.0 - tEnd/deltaT;
|
||||
stepFraction() = 1.0 - tEnd/trackTime;
|
||||
|
||||
cellPointWeight cpw(mesh, position(), cellI, face());
|
||||
scalar rhoc = td.rhoInterp().interpolate(cpw);
|
||||
|
||||
@ -143,9 +143,9 @@ public:
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<solidParticle> clone() const
|
||||
virtual autoPtr<Particle<solidParticle> > clone() const
|
||||
{
|
||||
return autoPtr<solidParticle>(new solidParticle(*this));
|
||||
return autoPtr<Particle<solidParticle> >(new solidParticle(*this));
|
||||
}
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ public:
|
||||
// Tracking
|
||||
|
||||
//- Move
|
||||
bool move(trackData&);
|
||||
bool move(trackData&, const scalar);
|
||||
|
||||
|
||||
// Patch interactions
|
||||
|
||||
@ -83,7 +83,7 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g)
|
||||
|
||||
solidParticle::trackData td(*this, rhoInterp, UInterp, nuInterp, g.value());
|
||||
|
||||
Cloud<solidParticle>::move(td);
|
||||
Cloud<solidParticle>::move(td, mesh_.time().deltaTValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
|
||||
trackedParticle::trackData td(cloud, maxFeatureLevel);
|
||||
|
||||
// Track all particles to their end position (= starting feature point)
|
||||
cloud.move(td);
|
||||
cloud.move(td, mesh_.time().deltaTValue());
|
||||
|
||||
// Reset level
|
||||
maxFeatureLevel = -1;
|
||||
@ -406,7 +406,7 @@ Foam::label Foam::meshRefinement::markFeatureRefinement
|
||||
}
|
||||
|
||||
// Track all particles to their end position.
|
||||
cloud.move(td);
|
||||
cloud.move(td, mesh_.time().deltaTValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,7 +27,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//- Construct from components
|
||||
Foam::trackedParticle::trackedParticle
|
||||
(
|
||||
const Cloud<trackedParticle>& c,
|
||||
@ -49,7 +48,6 @@ Foam::trackedParticle::trackedParticle
|
||||
{}
|
||||
|
||||
|
||||
//- Construct from Istream
|
||||
Foam::trackedParticle::trackedParticle
|
||||
(
|
||||
const Cloud<trackedParticle>& c,
|
||||
@ -89,13 +87,16 @@ Foam::trackedParticle::trackedParticle
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::trackedParticle::move(trackedParticle::trackData& td)
|
||||
bool Foam::trackedParticle::move
|
||||
(
|
||||
trackedParticle::trackData& td,
|
||||
const scalar trackedParticle
|
||||
)
|
||||
{
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
|
||||
scalar deltaT = cloud().pMesh().time().deltaTValue();
|
||||
scalar tEnd = (1.0 - stepFraction())*deltaT;
|
||||
scalar tEnd = (1.0 - stepFraction())*trackedParticle;
|
||||
scalar dtMax = tEnd;
|
||||
|
||||
while (td.keepParticle && !td.switchProcessor && tEnd > SMALL)
|
||||
@ -109,7 +110,7 @@ bool Foam::trackedParticle::move(trackedParticle::trackData& td)
|
||||
dt *= trackToFace(end_, td);
|
||||
|
||||
tEnd -= dt;
|
||||
stepFraction() = 1.0 - tEnd/deltaT;
|
||||
stepFraction() = 1.0 - tEnd/trackedParticle;
|
||||
}
|
||||
|
||||
return td.keepParticle;
|
||||
|
||||
@ -47,7 +47,7 @@ namespace Foam
|
||||
class trackedParticleCloud;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class trackedParticle Declaration
|
||||
Class trackedParticle Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class trackedParticle
|
||||
@ -68,6 +68,7 @@ class trackedParticle
|
||||
//- passive label
|
||||
label j_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
friend class Cloud<trackedParticle>;
|
||||
@ -135,9 +136,12 @@ public:
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<trackedParticle> clone() const
|
||||
autoPtr<Particle<trackedParticle> > clone() const
|
||||
{
|
||||
return autoPtr<trackedParticle>(new trackedParticle(*this));
|
||||
return autoPtr<Particle<trackedParticle> >
|
||||
(
|
||||
new trackedParticle(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -166,7 +170,7 @@ public:
|
||||
// Tracking
|
||||
|
||||
//- Track all particles to their end point
|
||||
bool move(trackData&);
|
||||
bool move(trackData&, const scalar);
|
||||
|
||||
|
||||
//- Overridable function to handle the particle hitting a patch
|
||||
|
||||
@ -233,10 +233,13 @@ void Foam::streamLine::track()
|
||||
allVectors_
|
||||
);
|
||||
|
||||
|
||||
// Set very large dt. Note: cannot use GREAT since 1/GREAT is SMALL
|
||||
// which is a trigger value for the tracking...
|
||||
const scalar trackTime = Foam::sqrt(GREAT);
|
||||
|
||||
// Track
|
||||
//Pout<< "Tracking particles." << endl;
|
||||
particles.move(td);
|
||||
//Pout<< "Finished tracking particles." << endl;
|
||||
particles.move(td, trackTime);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -152,15 +152,16 @@ Foam::streamLineParticle::streamLineParticle
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::streamLineParticle::move(streamLineParticle::trackData& td)
|
||||
bool Foam::streamLineParticle::move
|
||||
(
|
||||
streamLineParticle::trackData& td,
|
||||
const scalar trackTime
|
||||
)
|
||||
{
|
||||
td.switchProcessor = false;
|
||||
td.keepParticle = true;
|
||||
|
||||
// Set very large dt. Note: cannot use GREAT since 1/GREAT is SMALL
|
||||
// which is a trigger value for the tracking...
|
||||
scalar deltaT = Foam::sqrt(GREAT); //cloud().pMesh().time().deltaTValue();
|
||||
scalar tEnd = (1.0 - stepFraction())*deltaT;
|
||||
scalar tEnd = (1.0 - stepFraction())*trackTime;
|
||||
scalar dtMax = tEnd;
|
||||
|
||||
while
|
||||
@ -189,7 +190,7 @@ bool Foam::streamLineParticle::move(streamLineParticle::trackData& td)
|
||||
dt *= trackToFace(position()+dt*U, td);
|
||||
|
||||
tEnd -= dt;
|
||||
stepFraction() = 1.0 - tEnd/deltaT;
|
||||
stepFraction() = 1.0 - tEnd/trackTime;
|
||||
|
||||
if (tEnd <= ROOTVSMALL)
|
||||
{
|
||||
|
||||
@ -157,9 +157,9 @@ public:
|
||||
streamLineParticle(const streamLineParticle& c);
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<streamLineParticle> clone() const
|
||||
autoPtr<Particle<streamLineParticle> > clone() const
|
||||
{
|
||||
return autoPtr<streamLineParticle>
|
||||
return autoPtr<Particle<streamLineParticle> >
|
||||
(
|
||||
new streamLineParticle(*this)
|
||||
);
|
||||
@ -173,7 +173,7 @@ public:
|
||||
// Tracking
|
||||
|
||||
//- Track all particles to their end point
|
||||
bool move(trackData&);
|
||||
bool move(trackData&, const scalar trackTime);
|
||||
|
||||
|
||||
//- Overridable function to handle the particle hitting a patch
|
||||
|
||||
Reference in New Issue
Block a user