From 1a61449dcec3eb504db6d80213970c87a1532d02 Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Mon, 25 Oct 2010 17:52:35 +0100 Subject: [PATCH] ENH: Code updates in lieu of cloud updates --- ...pressibleUncoupledKinematicParcelDyMFoam.C | 2 +- .../UEqn.H | 2 +- .../YEqn.H | 2 +- .../hsEqn.H | 2 +- .../rhoEqn.H | 2 +- .../lagrangian/reactingParcelFilmFoam/UEqn.H | 2 +- .../lagrangian/reactingParcelFilmFoam/YEqn.H | 2 +- .../lagrangian/reactingParcelFilmFoam/hsEqn.H | 2 +- .../reactingParcelFilmFoam/rhoEqn.H | 2 +- .../lagrangian/reactingParcelFoam/UEqn.H | 2 +- .../lagrangian/reactingParcelFoam/YEqn.H | 2 +- .../lagrangian/reactingParcelFoam/hsEqn.H | 2 +- .../lagrangian/reactingParcelFoam/rhoEqn.H | 2 +- .../GeometricField/GeometricField.C | 2 +- src/lagrangian/dieselSpray/parcel/parcel.C | 9 +++---- src/lagrangian/dieselSpray/parcel/parcel.H | 2 +- .../dieselSpray/spray/sprayInject.C | 3 ++- src/lagrangian/dieselSpray/spray/sprayOps.C | 2 +- .../clouds/Templates/DsmcCloud/DsmcCloud.C | 2 +- .../parcels/Templates/DsmcParcel/DsmcParcel.C | 8 +++--- .../parcels/Templates/DsmcParcel/DsmcParcel.H | 9 ++++--- .../parcels/derived/dsmcParcel/dsmcParcel.H | 4 +-- .../molecule/molecule/molecule.C | 26 +++++++++---------- .../molecule/molecule/molecule.H | 6 ++--- .../molecule/moleculeCloud/moleculeCloud.C | 8 +++--- src/lagrangian/solidParticle/solidParticle.C | 13 ++++++---- src/lagrangian/solidParticle/solidParticle.H | 6 ++--- .../solidParticle/solidParticleCloud.C | 2 +- .../meshRefinement/meshRefinementRefine.C | 4 +-- .../trackedParticle/trackedParticle.C | 13 +++++----- .../trackedParticle/trackedParticle.H | 12 ++++++--- .../field/streamLine/streamLine.C | 9 ++++--- .../field/streamLine/streamLineParticle.C | 13 +++++----- .../field/streamLine/streamLineParticle.H | 6 ++--- 34 files changed, 99 insertions(+), 86 deletions(-) diff --git a/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/incompressibleUncoupledKinematicParcelDyMFoam.C b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/incompressibleUncoupledKinematicParcelDyMFoam.C index f5fba006e02..40b642a2847 100644 --- a/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/incompressibleUncoupledKinematicParcelDyMFoam.C +++ b/applications/solvers/lagrangian/incompressibleUncoupledKinematicParcelDyMFoam/incompressibleUncoupledKinematicParcelDyMFoam.C @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - # include "createDynamicFvMesh.H" + #include "createDynamicFvMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H index e77fe75dabb..fee0fe1a689 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H @@ -6,7 +6,7 @@ + turbulence->divDevRhoReff(U) == rho.dimensionedInternalField()*g - + parcels.SU() + + parcels.SU(U) + momentumSource.Su() ); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H index f54be04bb87..ac369f3df43 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/YEqn.H @@ -26,7 +26,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == - parcels.Srho(i) + parcels.SYi(i, Yi) + kappa*chemistry.RR(i)().dimensionedInternalField() + massSource.Su(i), mesh.solver("Yi") diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H index 73c276c2942..f448144f163 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/hsEqn.H @@ -37,7 +37,7 @@ - fvm::laplacian(turbulence->alphaEff(), hs) == pWork() - + parcels.Sh() + + parcels.Sh(hs) + radiation->Shs(thermo) + energySource.Su() + chemistrySh diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/rhoEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/rhoEqn.H index 0dea187edac..b1770a5a9d5 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/rhoEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/rhoEqn.H @@ -35,7 +35,7 @@ Description fvm::ddt(rho) + fvc::div(phi) == - parcels.Srho() + parcels.Srho(rho) + massSource.SuTot() ); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H index 3c4a927091a..2e8f979be41 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H @@ -5,7 +5,7 @@ + turbulence->divDevRhoReff(U) == rho.dimensionedInternalField()*g - + parcels.SU() + + parcels.SU(U) ); UEqn.relax(); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H index 0a2c36b7b50..da9a289d69b 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H @@ -25,7 +25,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == - parcels.Srho(i) + parcels.SYi(i, Yi) + surfaceFilm.Srho(i) + kappa*chemistry.RR(i)().dimensionedInternalField(), mesh.solver("Yi") diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H index 3c76f1384c8..0cb2318252b 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/hsEqn.H @@ -6,7 +6,7 @@ - fvm::laplacian(turbulence->alphaEff(), hs) == DpDt - + parcels.Sh() + + parcels.Sh(hs) + surfaceFilm.Sh() + radiation->Shs(thermo) + chemistrySh diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.H index 2c5d41f4fe5..617f1df8a64 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.H @@ -35,7 +35,7 @@ Description fvm::ddt(rho) + fvc::div(phi) == - parcels.Srho() + parcels.Srho(rho) + surfaceFilm.Srho() ); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H index 3c4a927091a..2e8f979be41 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H @@ -5,7 +5,7 @@ + turbulence->divDevRhoReff(U) == rho.dimensionedInternalField()*g - + parcels.SU() + + parcels.SU(U) ); UEqn.relax(); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H index c687f2035ba..c4a929c4494 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H @@ -25,7 +25,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->muEff(), Yi) == - parcels.Srho(i) + parcels.SYi(i, Yi) + kappa*chemistry.RR(i)().dimensionedInternalField(), mesh.solver("Yi") ); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H index ce12ec3ad48..7821d340d4b 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/hsEqn.H @@ -6,7 +6,7 @@ - fvm::laplacian(turbulence->alphaEff(), hs) == DpDt - + parcels.Sh() + + parcels.Sh(hs) + radiation->Shs(thermo) + chemistrySh ); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H index b9b2d6a13f9..d4f69d8f600 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H @@ -35,7 +35,7 @@ Description fvm::ddt(rho) + fvc::div(phi) == - parcels.Srho() + parcels.Srho(rho) ); } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index b77b68d1e88..10c6d9c300f 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -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), diff --git a/src/lagrangian/dieselSpray/parcel/parcel.C b/src/lagrangian/dieselSpray/parcel/parcel.C index 3862508f7a5..d9249bf66e9 100644 --- a/src/lagrangian/dieselSpray/parcel/parcel.C +++ b/src/lagrangian/dieselSpray/parcel/parcel.C @@ -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 { diff --git a/src/lagrangian/dieselSpray/parcel/parcel.H b/src/lagrangian/dieselSpray/parcel/parcel.H index 90d46e0231e..db4afe7922b 100644 --- a/src/lagrangian/dieselSpray/parcel/parcel.H +++ b/src/lagrangian/dieselSpray/parcel/parcel.H @@ -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 diff --git a/src/lagrangian/dieselSpray/spray/sprayInject.C b/src/lagrangian/dieselSpray/spray/sprayInject.C index 06dbc9b7c61..022c119e11a 100644 --- a/src/lagrangian/dieselSpray/spray/sprayInject.C +++ b/src/lagrangian/dieselSpray/spray/sprayInject.C @@ -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) { diff --git a/src/lagrangian/dieselSpray/spray/sprayOps.C b/src/lagrangian/dieselSpray/spray/sprayOps.C index 7904771fa14..9ac54f2b70a 100644 --- a/src/lagrangian/dieselSpray/spray/sprayOps.C +++ b/src/lagrangian/dieselSpray/spray/sprayOps.C @@ -76,7 +76,7 @@ void Foam::spray::move() srhos_[i] = 0.0; } - Cloud<parcel>::move(*this); + Cloud<parcel>::move(*this, runTime_.deltaTValue()); } diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index 8b92319bcb5..495c49b6e9b 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -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(); diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C index a6a6949122c..843a96456f8 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C @@ -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) { diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H index 8d09a91e8d7..6047911db01 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H @@ -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 diff --git a/src/lagrangian/dsmc/parcels/derived/dsmcParcel/dsmcParcel.H b/src/lagrangian/dsmc/parcels/derived/dsmcParcel/dsmcParcel.H index 6286e06c60e..35a6c2d486a 100644 --- a/src/lagrangian/dsmc/parcels/derived/dsmcParcel/dsmcParcel.H +++ b/src/lagrangian/dsmc/parcels/derived/dsmcParcel/dsmcParcel.H @@ -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)); } diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C index ef3b1395cc8..7742ecc8869 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C @@ -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()) { diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index 8df55ca8faf..622f8376b33 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -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); diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C index da5f1ce1ddc..413f0e1f225 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C @@ -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()); } diff --git a/src/lagrangian/solidParticle/solidParticle.C b/src/lagrangian/solidParticle/solidParticle.C index e802e67d06a..e8cd324a68f 100644 --- a/src/lagrangian/solidParticle/solidParticle.C +++ b/src/lagrangian/solidParticle/solidParticle.C @@ -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); diff --git a/src/lagrangian/solidParticle/solidParticle.H b/src/lagrangian/solidParticle/solidParticle.H index 04ff8e9e510..e00e4a6422f 100644 --- a/src/lagrangian/solidParticle/solidParticle.H +++ b/src/lagrangian/solidParticle/solidParticle.H @@ -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 diff --git a/src/lagrangian/solidParticle/solidParticleCloud.C b/src/lagrangian/solidParticle/solidParticleCloud.C index 625116d525c..cc4543cb6a0 100644 --- a/src/lagrangian/solidParticle/solidParticleCloud.C +++ b/src/lagrangian/solidParticle/solidParticleCloud.C @@ -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()); } diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C index bda9fc6e8e9..7c445b24321 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C @@ -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()); } diff --git a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C index 5714b3062ee..49c0fccdc42 100644 --- a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C +++ b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.C @@ -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; diff --git a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H index 1f62e6f37a5..a376d672ad7 100644 --- a/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H +++ b/src/mesh/autoMesh/autoHexMesh/trackedParticle/trackedParticle.H @@ -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 diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLine.C b/src/postProcessing/functionObjects/field/streamLine/streamLine.C index 8336fd8f9a9..f052f0580e0 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLine.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLine.C @@ -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); } diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C index 56b05c88caf..406a1177b2a 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C @@ -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) { diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.H b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.H index d556e4791de..a7eb9f33ffd 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.H +++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.H @@ -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 -- GitLab