From 06e29c44ab3829bca91148a2bc649900b170f646 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 25 Nov 2022 12:04:08 +0000 Subject: [PATCH] Lagrangian: Removed sub-cycling and improved injection behaviour Support for mesh sub-cycling has been removed from Lagrangian. Various Lagrangian processes already support sub-dividing the time-step. It is easier and more efficient to extend that support all the way to the high-level cloud objects, rather than to sub-cycle the mesh. This has additional benefits. The cloud now no longer needs to reset the step fraction at the start of every sub-motion. Injection can take advantage of this by modifying particles' step fractions in order to distribute them uniformly through the time-step. This is a simple and efficient method. Previously, injection would track the particles some distance after injection. This was more expensive to do, it resulted in spatial artefacts in the injected Lagrangian field, and it did not correctly handle interactions with patches or parallel transfers. The lack of injection tracking also means that particles injected through patches now start their simulation topologically connected to the face on which they are created. This means that they correctly trigger cloud functions associated with that face and/or patch. The injection models now also return barycentric coordinates directly, rather than the global position of injected particles. For methods that initially generate locations naturally in terms of barycentric coordinates, this prevents unnecessary and potentially fragile conversion from barycentric to Cartesian and back again. These are typically the methods that "fill" some sort of space; e.g., patch or cell-zone injections. --- .../field/nearWallFields/findCellParticle.C | 20 +- .../field/nearWallFields/findCellParticle.H | 14 +- .../field/nearWallFields/nearWallFields.C | 9 +- .../field/streamlines/streamlines.C | 4 +- .../field/streamlines/streamlinesParticle.C | 3 +- .../field/streamlines/streamlinesParticle.H | 2 +- .../clouds/Templates/DSMCCloud/DSMCCloud.C | 2 +- .../parcels/Templates/DSMCParcel/DSMCParcel.C | 5 +- .../parcels/Templates/DSMCParcel/DSMCParcel.H | 20 +- .../Templates/DSMCParcel/DSMCParcelI.H | 20 -- src/lagrangian/basic/Cloud/Cloud.C | 32 ++- src/lagrangian/basic/Cloud/Cloud.H | 10 +- .../basic/indexedParticle/indexedParticle.H | 15 -- src/lagrangian/basic/particle/particle.C | 5 +- src/lagrangian/basic/particle/particle.H | 17 +- src/lagrangian/basic/particle/particleI.H | 50 +--- .../basic/particle/particleTemplates.C | 3 +- .../basic/passiveParticle/passiveParticle.H | 2 +- .../molecule/molecule/molecule.C | 5 +- .../molecule/molecule/molecule.H | 21 +- .../molecule/molecule/moleculeI.H | 37 --- .../molecule/moleculeCloud/moleculeCloud.C | 8 +- .../Templates/CollidingCloud/CollidingCloud.C | 73 ++--- .../Templates/CollidingCloud/CollidingCloud.H | 11 +- .../clouds/Templates/MPPICCloud/MPPICCloud.C | 12 +- .../Templates/MomentumCloud/MomentumCloud.C | 108 +++----- .../Templates/MomentumCloud/MomentumCloud.H | 15 +- .../Templates/ReactingCloud/ReactingCloud.C | 8 +- .../Templates/ReactingCloud/ReactingCloud.H | 7 +- .../ReactingMultiphaseCloud.C | 8 +- .../ReactingMultiphaseCloud.H | 7 +- .../clouds/Templates/SprayCloud/SprayCloud.C | 8 +- .../clouds/Templates/SprayCloud/SprayCloud.H | 7 +- .../Templates/ThermoCloud/ThermoCloud.C | 8 +- .../Templates/ThermoCloud/ThermoCloud.H | 7 +- .../CollidingParcel/CollidingParcel.C | 18 +- .../CollidingParcel/CollidingParcel.H | 10 +- .../CollidingParcel/CollidingParcelI.H | 5 +- .../Templates/MPPICParcel/MPPICParcel.C | 11 +- .../Templates/MPPICParcel/MPPICParcel.H | 10 +- .../Templates/MPPICParcel/MPPICParcelI.H | 5 +- .../Templates/MomentumParcel/MomentumParcel.C | 16 +- .../Templates/MomentumParcel/MomentumParcel.H | 34 ++- .../MomentumParcel/MomentumParcelI.H | 5 +- .../MomentumParcelTrackingDataI.H | 54 +++- .../ReactingMultiphaseParcel.H | 3 +- .../ReactingMultiphaseParcelI.H | 5 +- .../Templates/ReactingParcel/ReactingParcel.H | 3 +- .../ReactingParcel/ReactingParcelI.H | 5 +- .../Templates/SprayParcel/SprayParcel.H | 3 +- .../Templates/SprayParcel/SprayParcelI.H | 5 +- .../Templates/ThermoParcel/ThermoParcel.H | 3 +- .../Templates/ThermoParcel/ThermoParcelI.H | 5 +- .../PairSpringSliderDashpot.C | 11 +- .../WallLocalSpringSliderDashpot.C | 11 +- .../WallSpringSliderDashpot.C | 11 +- .../CellZoneInjection/CellZoneInjection.C | 56 ++-- .../CellZoneInjection/CellZoneInjection.H | 17 +- .../ConeInjection/ConeInjection.C | 31 ++- .../ConeInjection/ConeInjection.H | 10 +- .../FieldActivatedInjection.C | 18 +- .../FieldActivatedInjection.H | 10 +- .../InflationInjection/InflationInjection.C | 14 +- .../InflationInjection/InflationInjection.H | 7 +- .../InjectionModel/InjectionModel.C | 251 ++++++++++-------- .../InjectionModel/InjectionModel.H | 30 ++- .../InjectionModel/InjectionModelList.C | 5 +- .../InjectionModel/InjectionModelList.H | 3 +- .../ManualInjection/ManualInjection.C | 17 +- .../ManualInjection/ManualInjection.H | 10 +- .../MomentumLookupTableInjection.C | 18 +- .../MomentumLookupTableInjection.H | 10 +- .../InjectionModel/NoInjection/NoInjection.C | 5 +- .../InjectionModel/NoInjection/NoInjection.H | 9 +- .../PatchFlowRateInjection.C | 14 +- .../PatchFlowRateInjection.H | 7 +- .../PatchInjection/PatchInjection.C | 14 +- .../PatchInjection/PatchInjection.H | 7 +- .../PatchInjection/patchInjectionBase.C | 242 ++++++----------- .../PatchInjection/patchInjectionBase.H | 32 +-- .../NoStochasticCollision.C | 5 +- .../NoStochasticCollision.H | 8 +- .../StochasticCollisionModel.C | 7 +- .../StochasticCollisionModel.H | 14 +- .../SurfaceFilmModel/SurfaceFilmModel.C | 4 +- .../ReactingLookupTableInjection.C | 19 +- .../ReactingLookupTableInjection.H | 10 +- .../ReactingMultiphaseLookupTableInjection.C | 19 +- .../ReactingMultiphaseLookupTableInjection.H | 10 +- .../SuppressionCollision.C | 5 +- .../SuppressionCollision.H | 8 +- .../ORourkeCollision/ORourkeCollision.C | 6 +- .../ORourkeCollision/ORourkeCollision.H | 8 +- .../TrajectoryCollision/TrajectoryCollision.C | 5 +- .../TrajectoryCollision/TrajectoryCollision.H | 8 +- .../ThermoLookupTableInjection.C | 19 +- .../ThermoLookupTableInjection.H | 8 +- src/lagrangian/solidParticle/solidParticle.C | 6 +- src/lagrangian/solidParticle/solidParticle.H | 14 +- .../solidParticle/solidParticleCloud.C | 4 +- src/lagrangian/solidParticle/solidParticleI.H | 17 -- .../meshRefinement/meshRefinementRefine.C | 11 +- .../trackedParticle/trackedParticle.C | 29 +- .../trackedParticle/trackedParticle.H | 22 +- src/sampling/sampledSet/lineFace/lineFace.C | 2 +- src/sampling/sampledSet/points/points.C | 4 +- .../sampledSet/sampledSetParticle.C | 3 +- .../sampledSet/sampledSetParticle.H | 2 +- 108 files changed, 819 insertions(+), 1111 deletions(-) diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.C b/src/functionObjects/field/nearWallFields/findCellParticle.C index 655588fef0..9fba611f9e 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.C +++ b/src/functionObjects/field/nearWallFields/findCellParticle.C @@ -27,23 +27,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::findCellParticle::findCellParticle -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPtI, - const vector& displacement, - const label data -) -: - particle(mesh, coordinates, celli, tetFacei, tetPtI), - displacement_(displacement), - data_(data) -{} - - Foam::findCellParticle::findCellParticle ( const polyMesh& mesh, @@ -94,8 +77,7 @@ Foam::findCellParticle::findCellParticle(Istream& is, bool readFields) bool Foam::findCellParticle::move ( Cloud& cloud, - trackingData& td, - const scalar maxTrackLen + trackingData& td ) { td.keepParticle = true; diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index cb18907e4b..8b07eff819 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -116,18 +116,6 @@ public: // Constructors - //- Construct from components - findCellParticle - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPtI, - const vector& displacement, - const label data - ); - //- Construct from a position and a cell, searching for the rest of the // required topology findCellParticle @@ -185,7 +173,7 @@ public: // Tracking //- Track all particles to their end point - bool move(Cloud&, trackingData&, const scalar); + bool move(Cloud&, trackingData&); //- Overridable function to handle the particle hitting a wedge void hitWedgePatch(Cloud&, trackingData&); diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.C b/src/functionObjects/field/nearWallFields/nearWallFields.C index 9f91a152cf..01e84878a6 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/functionObjects/field/nearWallFields/nearWallFields.C @@ -86,7 +86,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing() mesh_, patch.Cf()[patchFacei], patch.faceCells()[patchFacei], - - distance_*nf[patchFacei], + - distance_*nf[patchFacei], globalWalls.toGlobal(nPatchFaces) // passive data ) ); @@ -123,10 +123,6 @@ void Foam::functionObjects::nearWallFields::calcAddressing() // Database to pass into findCellParticle::move findCellParticle::trackingData td(cloud, cellToWalls_, cellToSamples_); - // Track all particles to their end position. - scalar maxTrackLen = 2.0*mesh_.bounds().mag(); - - // Debug: collect start points pointField start; if (debug) @@ -141,7 +137,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing() } - cloud.move(cloud, td, maxTrackLen); + // Track + cloud.move(cloud, td); // Rework cell-to-globalpatchface into a map diff --git a/src/functionObjects/field/streamlines/streamlines.C b/src/functionObjects/field/streamlines/streamlines.C index 129c2e5682..8346c088ea 100644 --- a/src/functionObjects/field/streamlines/streamlines.C +++ b/src/functionObjects/field/streamlines/streamlines.C @@ -334,13 +334,13 @@ bool Foam::functionObjects::streamlines::write() initialParticles = particles; } - particles.move(particles, td, rootGreat); + particles.move(particles, td); if (trackDirection_ == trackDirection::both) { particles.IDLList::operator=(initialParticles); td.trackForward_ = !td.trackForward_; - particles.move(particles, td, rootGreat); + particles.move(particles, td); } } diff --git a/src/functionObjects/field/streamlines/streamlinesParticle.C b/src/functionObjects/field/streamlines/streamlinesParticle.C index e65b23c2ad..df82a4000e 100644 --- a/src/functionObjects/field/streamlines/streamlinesParticle.C +++ b/src/functionObjects/field/streamlines/streamlinesParticle.C @@ -200,8 +200,7 @@ Foam::streamlinesParticle::streamlinesParticle bool Foam::streamlinesParticle::move ( streamlinesCloud& cloud, - trackingData& td, - const scalar + trackingData& td ) { td.keepParticle = true; diff --git a/src/functionObjects/field/streamlines/streamlinesParticle.H b/src/functionObjects/field/streamlines/streamlinesParticle.H index 0e636ed7e1..a435dcd7a7 100644 --- a/src/functionObjects/field/streamlines/streamlinesParticle.H +++ b/src/functionObjects/field/streamlines/streamlinesParticle.H @@ -236,7 +236,7 @@ public: // Tracking //- Track all particles to their end point - bool move(streamlinesCloud&, trackingData&, const scalar); + bool move(streamlinesCloud&, trackingData&); //- Overridable function to handle the particle hitting a wedge void hitWedgePatch(streamlinesCloud&, trackingData&); diff --git a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C index 58227a1777..afbf2c4288 100644 --- a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C +++ b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C @@ -953,7 +953,7 @@ void Foam::DSMCCloud::evolve() this->inflowBoundary().inflow(); // Move the particles ballistically with their current velocities - Cloud::move(*this, td, mesh_.time().deltaTValue()); + Cloud::move(*this, td); // 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 a626f7815b..ebad65c048 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C @@ -33,8 +33,7 @@ template bool Foam::DSMCParcel::move ( TrackCloudType& cloud, - trackingData& td, - const scalar trackTime + trackingData& td ) { typename TrackCloudType::parcelType& p = @@ -45,6 +44,8 @@ bool Foam::DSMCParcel::move const polyMesh& mesh = cloud.pMesh(); + const scalar trackTime = mesh.time().deltaTValue(); + // For reduced-D cases, the velocity used to track needs to be // constrained, but the actual U_ of the parcel must not be // altered or used, as it is altered by patch interactions an diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H index 8243196ac2..9c0cb4d93e 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.H @@ -158,19 +158,6 @@ public: // Constructors - //- Construct from components - inline DSMCParcel - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const vector& U, - const scalar Ei, - const label typeId - ); - //- Construct from a position and a cell, searching for the rest of the // required topology inline DSMCParcel @@ -228,12 +215,7 @@ public: //- Move the parcel template - bool move - ( - TrackCloudType& cloud, - trackingData& td, - const scalar trackTime - ); + bool move(TrackCloudType& cloud, trackingData& td); // Patch interactions diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelI.H b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelI.H index c6b0b463ae..e12a3af135 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelI.H +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcelI.H @@ -52,26 +52,6 @@ inline Foam::DSMCParcel::constantProperties::constantProperties {} -template -inline Foam::DSMCParcel::DSMCParcel -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const vector& U, - const scalar Ei, - const label typeId -) -: - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), - U_(U), - Ei_(Ei), - typeId_(typeId) -{} - - template inline Foam::DSMCParcel::DSMCParcel ( diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index e1ba62db02..f3a3f5fc17 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -196,7 +196,8 @@ Foam::Cloud::Cloud patchNbrProc_(patchNbrProc(pMesh)), patchNbrProcPatch_(patchNbrProcPatch(pMesh)), patchNonConformalCyclicPatches_(patchNonConformalCyclicPatches(pMesh)), - globalPositionsPtr_() + globalPositionsPtr_(), + timeIndex_(-1) { // Ask for the tetBasePtIs and oldCellCentres to trigger all processors to // build them, otherwise, if some processors have no particles then there @@ -256,27 +257,38 @@ void Foam::Cloud::cloudReset(const Cloud& c) } +template +void Foam::Cloud::changeTimeStep() +{ + forAllIter(typename Cloud, *this, pIter) + { + pIter().reset(0); + } + + timeIndex_ = pMesh_.time().timeIndex(); +} + + template template void Foam::Cloud::move ( TrackCloudType& cloud, - typename ParticleType::trackingData& td, - const scalar trackTime + typename ParticleType::trackingData& td ) { + // If the time has changed, modify the particles accordingly + if (timeIndex_ != pMesh_.time().timeIndex()) + { + changeTimeStep(); + } + // Clear the global positions as these are about to change globalPositionsPtr_.clear(); // Ensure rays are available for non conformal transfers storeRays(); - // Initialise the stepFraction moved for the particles - forAllIter(typename Cloud, *this, pIter) - { - pIter().reset(0); - } - // Create transfer buffers PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking); @@ -300,7 +312,7 @@ void Foam::Cloud::move ParticleType& p = pIter(); // Move the particle - bool keepParticle = p.move(cloud, td, trackTime); + const bool keepParticle = p.move(cloud, td); // If the particle is to be kept if (keepParticle) diff --git a/src/lagrangian/basic/Cloud/Cloud.H b/src/lagrangian/basic/Cloud/Cloud.H index 701c90c039..92b9da2cdf 100644 --- a/src/lagrangian/basic/Cloud/Cloud.H +++ b/src/lagrangian/basic/Cloud/Cloud.H @@ -91,6 +91,9 @@ class Cloud //- Temporary storage for the global particle positions mutable autoPtr globalPositionsPtr_; + //- Time index + mutable label timeIndex_; + // Private Member Functions @@ -243,13 +246,16 @@ public: //- Reset the particles void cloudReset(const Cloud& c); + //- Change the particles' state from the end of the previous time + // step to the start of the next time step + void changeTimeStep(); + //- Move the particles template void move ( TrackCloudType& cloud, - typename ParticleType::trackingData& td, - const scalar trackTime + typename ParticleType::trackingData& td ); diff --git a/src/lagrangian/basic/indexedParticle/indexedParticle.H b/src/lagrangian/basic/indexedParticle/indexedParticle.H index b813e1af18..d52200f42e 100644 --- a/src/lagrangian/basic/indexedParticle/indexedParticle.H +++ b/src/lagrangian/basic/indexedParticle/indexedParticle.H @@ -61,21 +61,6 @@ public: // Constructors - //- Construct from components - indexedParticle - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const label index = 0 - ) - : - particle(mesh, coordinates, celli, tetFacei, tetPti), - index_(index) - {} - //- Construct from Istream indexedParticle(Istream& is, bool readFields = true) : diff --git a/src/lagrangian/basic/particle/particle.C b/src/lagrangian/basic/particle/particle.C index c0378a054a..171452cf27 100644 --- a/src/lagrangian/basic/particle/particle.C +++ b/src/lagrangian/basic/particle/particle.C @@ -480,14 +480,15 @@ Foam::particle::particle const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : coordinates_(coordinates), celli_(celli), tetFacei_(tetFacei), tetPti_(tetPti), - facei_(-1), + facei_(facei), stepFraction_(1), stepFractionBehind_(0), nTracksBehind_(0), diff --git a/src/lagrangian/basic/particle/particle.H b/src/lagrangian/basic/particle/particle.H index 4049a0a096..df576a6884 100644 --- a/src/lagrangian/basic/particle/particle.H +++ b/src/lagrangian/basic/particle/particle.H @@ -339,7 +339,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the @@ -397,6 +398,9 @@ public: //- Return current face particle is on otherwise -1 inline label face() const; + //- Return current face particle is on otherwise -1 + inline label& face(); + //- Return the fraction of time-step completed inline scalar stepFraction() const; @@ -418,17 +422,6 @@ public: // Check - //- Return the step fraction change within the overall time-step. - // Returns the start value and the change as a scalar pair. Always - // return Pair(0, 1), unless sub-cycling is in effect, in - // which case the values will reflect the span of the sub-cycle - // within the time-step. - inline Pair stepFractionSpan(const polyMesh& mesh) const; - - //- Return the current fraction within the timestep. This differs - // from the stored step fraction due to sub-cycling. - inline scalar currentTimeFraction(const polyMesh& mesh) const; - //- Return the indices of the current tet that the // particle occupies. inline tetIndices currentTetIndices(const polyMesh& mesh) const; diff --git a/src/lagrangian/basic/particle/particleI.H b/src/lagrangian/basic/particle/particleI.H index 99fc73c4ee..98e3d9a21e 100644 --- a/src/lagrangian/basic/particle/particleI.H +++ b/src/lagrangian/basic/particle/particleI.H @@ -77,11 +77,7 @@ inline void Foam::particle::movingTetGeometry const vector ccOld = mesh.oldCellCentres()[celli_]; const vector ccNew = mesh.cellCentres()[celli_]; - // Old and new points and cell centres are not sub-cycled. If we are sub- - // cycling, then we have to account for the timestep change here by - // modifying the fractions that we take of the old and new geometry. - const Pair s = stepFractionSpan(mesh); - const scalar f0 = s[0] + stepFraction_*s[1], f1 = fraction*s[1]; + const scalar f0 = stepFraction_, f1 = fraction; centre[0] = ccOld + f0*(ccNew - ccOld); base[0] = ptsOld[triIs[0]] + f0*(ptsNew[triIs[0]] - ptsOld[triIs[0]]); @@ -159,6 +155,12 @@ inline Foam::label Foam::particle::face() const } +inline Foam::label& Foam::particle::face() +{ + return facei_; +} + + inline Foam::scalar Foam::particle::stepFraction() const { return stepFraction_; @@ -195,44 +197,6 @@ inline Foam::label& Foam::particle::origId() } -inline Foam::Pair Foam::particle::stepFractionSpan -( - const polyMesh& mesh -) const -{ - if (mesh.time().subCycling()) - { - const TimeState& tsNew = mesh.time(); - const TimeState& tsOld = mesh.time().prevTimeState(); - - const scalar tFrac = - ( - (tsNew.value() - tsNew.deltaTValue()) - - (tsOld.value() - tsOld.deltaTValue()) - )/tsOld.deltaTValue(); - - const scalar dtFrac = tsNew.deltaTValue()/tsOld.deltaTValue(); - - return Pair(tFrac, dtFrac); - } - else - { - return Pair(0, 1); - } -} - - -inline Foam::scalar Foam::particle::currentTimeFraction -( - const polyMesh& mesh -) const -{ - const Pair s = stepFractionSpan(mesh); - - return s[0] + stepFraction_*s[1]; -} - - inline Foam::tetIndices Foam::particle::currentTetIndices ( const polyMesh& mesh diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index d15834ea6c..c57d556e2a 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -347,8 +347,7 @@ bool Foam::particle::hitNonConformalCyclicPatch const remote receiveProcFace = nccpp.ray ( - stepFractionSpan(td.mesh)[0] - + stepFraction_*stepFractionSpan(td.mesh)[1], + stepFraction_, nccpp.origPatch().whichFace(facei_), sendPos, displacement - fraction*sendDisplacement, diff --git a/src/lagrangian/basic/passiveParticle/passiveParticle.H b/src/lagrangian/basic/passiveParticle/passiveParticle.H index ee70e787a3..5adf038b5c 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticle.H +++ b/src/lagrangian/basic/passiveParticle/passiveParticle.H @@ -67,7 +67,7 @@ public: const label tetPti ) : - particle(mesh, coordinates, celli, tetFacei, tetPti) + particle(mesh, coordinates, celli, tetFacei, tetPti, -1) {} diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C index d9369ffa83..b65ba8d546 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.C @@ -68,8 +68,7 @@ Foam::tensor Foam::molecule::rotationTensorZ(scalar phi) const bool Foam::molecule::move ( moleculeCloud& cloud, - trackingData& td, - const scalar trackTime + trackingData& td ) { td.keepParticle = true; @@ -77,6 +76,8 @@ bool Foam::molecule::move const constantProperties& constProps(cloud.constProps(id_)); + const scalar trackTime = td.mesh.time().deltaTValue(); + if (td.part() == trackingData::tpVelocityHalfStep0) { // First leapfrog velocity adjust part, required before tracking+force diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index dad76dbfc7..ac3bd9ccbd 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -259,25 +259,6 @@ public: // Constructors - //- Construct from components - inline molecule - ( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const tensor& Q, - const vector& v, - const vector& a, - const vector& pi, - const vector& tau, - const vector& specialPosition, - const constantProperties& constProps, - const label special, - const label id - ); - //- Construct from a position and a cell, searching for the rest of the // required topology inline molecule @@ -316,7 +297,7 @@ public: // Tracking - bool move(moleculeCloud&, trackingData&, const scalar trackTime); + bool move(moleculeCloud&, trackingData&); virtual void transformProperties(const transformer&); diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H index f18e6662e3..9d314c717b 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeI.H @@ -219,43 +219,6 @@ inline Foam::molecule::constantProperties::constantProperties } -inline Foam::molecule::molecule -( - const polyMesh& mesh, - const barycentric& coordinates, - const label celli, - const label tetFacei, - const label tetPti, - const tensor& Q, - const vector& v, - const vector& a, - const vector& pi, - const vector& tau, - const vector& specialPosition, - const constantProperties& constProps, - const label special, - const label id - -) -: - particle(mesh, coordinates, celli, tetFacei, tetPti), - Q_(Q), - v_(v), - a_(a), - pi_(pi), - tau_(tau), - specialPosition_(specialPosition), - potentialEnergy_(0.0), - rf_(Zero), - special_(special), - id_(id), - siteForces_(constProps.nSites(), Zero), - sitePositions_(constProps.nSites()) -{ - setSitePositions(mesh, constProps); -} - - inline Foam::molecule::molecule ( const polyMesh& mesh, diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C index d325f9b820..836036ea9e 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C @@ -1116,18 +1116,18 @@ void Foam::moleculeCloud::evolve() molecule::trackingData td(*this); td.part() = molecule::trackingData::tpVelocityHalfStep0; - Cloud::move(*this, td, mesh_.time().deltaTValue()); + Cloud::move(*this, td); td.part() = molecule::trackingData::tpLinearTrack; - Cloud::move(*this, td, mesh_.time().deltaTValue()); + Cloud::move(*this, td); td.part() = molecule::trackingData::tpRotationalTrack; - Cloud::move(*this, td, mesh_.time().deltaTValue()); + Cloud::move(*this, td); calculateForce(); td.part() = molecule::trackingData::tpVelocityHalfStep1; - Cloud::move(*this, td, mesh_.time().deltaTValue()); + Cloud::move(*this, td); } diff --git a/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.C b/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.C index cdcf95e25f..24c76ae657 100644 --- a/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,34 +45,6 @@ void Foam::CollidingCloud::setModels() } -template -template -void Foam::CollidingCloud::moveCollide -( - TrackCloudType& cloud, - typename parcelType::trackingData& td, - const scalar deltaT -) -{ - td.part() = parcelType::trackingData::tpVelocityHalfStep; - CloudType::move(cloud, td, deltaT); - - td.part() = parcelType::trackingData::tpLinearTrack; - CloudType::move(cloud, td, deltaT); - - // td.part() = parcelType::trackingData::tpRotationalTrack; - // CloudType::move(cloud, td, deltaT); - - this->updateCellOccupancy(); - - this->collision().collide(); - - td.part() = parcelType::trackingData::tpVelocityHalfStep; - CloudType::move(cloud, td, deltaT); -} - - - template void Foam::CollidingCloud::cloudReset(CollidingCloud& c) { @@ -216,29 +188,40 @@ void Foam::CollidingCloud::motion // + calculate forces in new position // + apply half deltaV with new force - label nSubCycles = collision().nSubCycles(); + const label nSubCycles = collision().nSubCycles(); if (nSubCycles > 1) { Info<< " " << nSubCycles << " move-collide subCycles" << endl; - - subCycleTime moveCollideSubCycle - ( - const_cast(this->db().time()), - nSubCycles - ); - - while(!(++moveCollideSubCycle).end()) - { - moveCollide(cloud, td, this->db().time().deltaTValue()); - } - - moveCollideSubCycle.endSubCycle(); } - else + + for (label subCyclei = 0; subCyclei < nSubCycles; ++ subCyclei) { - moveCollide(cloud, td, this->db().time().deltaTValue()); + td.stepFractionRange() = + Pair + ( + scalar(subCyclei)/nSubCycles, + scalar(subCyclei + 1)/nSubCycles + ); + + td.part() = parcelType::trackingData::tpVelocityHalfStep; + CloudType::move(cloud, td); + + td.part() = parcelType::trackingData::tpLinearTrack; + CloudType::move(cloud, td); + + // td.part() = parcelType::trackingData::tpRotationalTrack; + // CloudType::move(cloud, td); + + this->updateCellOccupancy(); + + this->collision().collide(); + + td.part() = parcelType::trackingData::tpVelocityHalfStep; + CloudType::move(cloud, td); } + + td.stepFractionRange() = Pair(0, 1); } diff --git a/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.H b/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.H index a88ddbdd40..e0a92d4cda 100644 --- a/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/CollidingCloud/CollidingCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -116,15 +116,6 @@ protected: // Cloud evolution functions - //- Move-collide particles - template - void moveCollide - ( - TrackCloudType& cloud, - typename parcelType::trackingData& td, - const scalar deltaT - ); - //- Reset state of cloud void cloudReset(CollidingCloud& c); diff --git a/src/lagrangian/parcel/clouds/Templates/MPPICCloud/MPPICCloud.C b/src/lagrangian/parcel/clouds/Templates/MPPICCloud/MPPICCloud.C index 3d8173f4b5..1a670d2375 100644 --- a/src/lagrangian/parcel/clouds/Templates/MPPICCloud/MPPICCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/MPPICCloud/MPPICCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -196,7 +196,7 @@ void Foam::MPPICCloud::motion // force calculation and tracking td.part() = parcelType::trackingData::tpPredictTrack; - CloudType::move(cloud, td, this->db().time().deltaTValue()); + CloudType::move(cloud, td); // Preliminary @@ -227,11 +227,11 @@ void Foam::MPPICCloud::motion // calculate the damping velocity corrections without moving the parcels td.part() = parcelType::trackingData::tpDampingNoTrack; - CloudType::move(cloud, td, this->db().time().deltaTValue()); + CloudType::move(cloud, td); // correct the parcel positions and velocities td.part() = parcelType::trackingData::tpCorrectTrack; - CloudType::move(cloud, td, this->db().time().deltaTValue()); + CloudType::move(cloud, td); // finalise and free memory dampingModel_->cacheFields(false); @@ -254,9 +254,9 @@ void Foam::MPPICCloud::motion td.updateAverages(cloud); packingModel_->cacheFields(true); td.part() = parcelType::trackingData::tpPackingNoTrack; - CloudType::move(cloud, td, this->db().time().deltaTValue()); + CloudType::move(cloud, td); td.part() = parcelType::trackingData::tpCorrectTrack; - CloudType::move(cloud, td, this->db().time().deltaTValue()); + CloudType::move(cloud, td); packingModel_->cacheFields(false); } diff --git a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C index 1abc8dd465..d69cf1d19f 100644 --- a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C @@ -94,29 +94,57 @@ void Foam::MomentumCloud::solve typename parcelType::trackingData& td ) { + this->changeTimeStep(); + if (solution_.steadyState()) { cloud.storeState(); + } - cloud.preEvolve(); + cloud.preEvolve(); - evolveCloud(cloud, td); + if (solution_.coupled()) + { + cloud.resetSourceTerms(); + } - if (solution_.coupled()) + if (solution_.transient()) + { + label preInjectionSize = this->size(); + + this->surfaceFilm().inject(cloud); + + // Update the cellOccupancy if the size of the cloud has changed + // during the injection. + if (preInjectionSize != this->size()) { - cloud.relaxSources(cloud.cloudCopy()); + updateCellOccupancy(); + preInjectionSize = this->size(); } + + injectors_.inject(cloud, td); + + // Assume that motion will update the cellOccupancy as necessary + // before it is required. + cloud.motion(cloud, td); + + stochasticCollision().update(td); } else { - cloud.preEvolve(); + injectors_.injectSteadyState(cloud, td); - evolveCloud(cloud, td); + CloudType::move(cloud, td); + } - if (solution_.coupled()) - { - cloud.scaleSources(); - } + if (solution_.coupled() && solution_.transient()) + { + cloud.scaleSources(); + } + + if (solution_.coupled() && solution_.steadyState()) + { + cloud.relaxSources(cloud.cloudCopy()); } cloud.info(); @@ -175,53 +203,6 @@ void Foam::MomentumCloud::updateCellOccupancy() } -template -template -void Foam::MomentumCloud::evolveCloud -( - TrackCloudType& cloud, - typename parcelType::trackingData& td -) -{ - if (solution_.coupled()) - { - cloud.resetSourceTerms(); - } - - if (solution_.transient()) - { - label preInjectionSize = this->size(); - - this->surfaceFilm().inject(cloud); - - // Update the cellOccupancy if the size of the cloud has changed - // during the injection. - if (preInjectionSize != this->size()) - { - updateCellOccupancy(); - preInjectionSize = this->size(); - } - - injectors_.inject(cloud, td); - - - // Assume that motion will update the cellOccupancy as necessary - // before it is required. - cloud.motion(cloud, td); - - stochasticCollision().update(td, solution_.trackTime()); - } - else - { -// this->surfaceFilm().injectSteadyState(cloud); - - injectors_.injectSteadyState(cloud, td, solution_.trackTime()); - - CloudType::move(cloud, td, solution_.trackTime()); - } -} - - template void Foam::MomentumCloud::postEvolve() { @@ -553,8 +534,7 @@ Foam::MomentumCloud::~MomentumCloud() template void Foam::MomentumCloud::setParcelThermoProperties ( - parcelType& parcel, - const scalar lagrangianDt + parcelType& parcel ) { parcel.rho() = constProps_.rho0(); @@ -565,13 +545,9 @@ template void Foam::MomentumCloud::checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ) { - const scalar carrierDt = this->mesh().time().deltaTValue(); - parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt; - if (parcel.typeId() == -1) { parcel.typeId() = constProps_.parcelTypeId(); @@ -694,7 +670,7 @@ void Foam::MomentumCloud::motion typename parcelType::trackingData& td ) { - CloudType::move(cloud, td, solution_.trackTime()); + CloudType::move(cloud, td); updateCellOccupancy(); } @@ -731,9 +707,7 @@ void Foam::MomentumCloud::patchData const vector& Uw0 = U_.oldTime().boundaryField()[patchi][patchFacei]; - const scalar f = p.currentTimeFraction(this->mesh()); - - const vector Uw = Uw0 + f*(Uw1 - Uw0); + const vector Uw = Uw0 + p.stepFraction()*(Uw1 - Uw0); const tensor nnw = nw*nw; diff --git a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H index df8713e789..428986fe6b 100644 --- a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H @@ -253,14 +253,6 @@ protected: // already been used void updateCellOccupancy(); - //- Evolve the cloud - template - void evolveCloud - ( - TrackCloudType& cloud, - typename parcelType::trackingData& td - ); - //- Post-evolve void postEvolve(); @@ -538,17 +530,12 @@ public: // Cloud evolution functions //- Set parcel thermo properties - void setParcelThermoProperties - ( - parcelType& parcel, - const scalar lagrangianDt - ); + void setParcelThermoProperties(parcelType& parcel); //- Check parcel properties void checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ); diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C index e8e88184b4..6caa681f71 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -195,11 +195,10 @@ Foam::ReactingCloud::~ReactingCloud() template void Foam::ReactingCloud::setParcelThermoProperties ( - parcelType& parcel, - const scalar lagrangianDt + parcelType& parcel ) { - CloudType::setParcelThermoProperties(parcel, lagrangianDt); + CloudType::setParcelThermoProperties(parcel); parcel.Y() = this->composition().YMixture0(); } @@ -209,11 +208,10 @@ template void Foam::ReactingCloud::checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ) { - CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); + CloudType::checkParcelProperties(parcel, fullyDescribed); if (fullyDescribed) { diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H index 456dbd7193..8bc4e6e584 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -259,17 +259,12 @@ public: // Cloud evolution functions //- Set parcel thermo properties - void setParcelThermoProperties - ( - parcelType& parcel, - const scalar lagrangianDt - ); + void setParcelThermoProperties(parcelType& parcel); //- Check parcel properties void checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ); diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 867ab2af37..e05c5e0bfb 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -152,11 +152,10 @@ Foam::ReactingMultiphaseCloud::~ReactingMultiphaseCloud() template void Foam::ReactingMultiphaseCloud::setParcelThermoProperties ( - parcelType& parcel, - const scalar lagrangianDt + parcelType& parcel ) { - CloudType::setParcelThermoProperties(parcel, lagrangianDt); + CloudType::setParcelThermoProperties(parcel); label idGas = this->composition().idGas(); label idLiquid = this->composition().idLiquid(); @@ -172,11 +171,10 @@ template void Foam::ReactingMultiphaseCloud::checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ) { - CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); + CloudType::checkParcelProperties(parcel, fullyDescribed); if (fullyDescribed) { diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index 437119379b..4a7336b9d8 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -255,17 +255,12 @@ public: // Cloud evolution functions //- Set parcel thermo properties - void setParcelThermoProperties - ( - parcelType& parcel, - const scalar lagrangianDt - ); + void setParcelThermoProperties(parcelType& parcel); //- Check parcel properties void checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ); diff --git a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C index a96dca3149..a3ef21cd69 100644 --- a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C @@ -140,11 +140,10 @@ Foam::SprayCloud::~SprayCloud() template void Foam::SprayCloud::setParcelThermoProperties ( - parcelType& parcel, - const scalar lagrangianDt + parcelType& parcel ) { - CloudType::setParcelThermoProperties(parcel, lagrangianDt); + CloudType::setParcelThermoProperties(parcel); const liquidMixtureProperties& liqMix = this->composition().liquids(); @@ -164,11 +163,10 @@ template void Foam::SprayCloud::checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ) { - CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); + CloudType::checkParcelProperties(parcel, fullyDescribed); // store the injection position and initial drop size parcel.position0() = parcel.position(this->mesh()); diff --git a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H index 20e30ecafb..7dd93961fb 100644 --- a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H @@ -209,17 +209,12 @@ public: // Cloud evolution functions //- Set parcel thermo properties - void setParcelThermoProperties - ( - parcelType& parcel, - const scalar lagrangianDt - ); + void setParcelThermoProperties(parcelType& parcel); //- Check parcel properties void checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ); diff --git a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C index a3d705278b..63aab27d5b 100644 --- a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -359,11 +359,10 @@ Foam::ThermoCloud::~ThermoCloud() template void Foam::ThermoCloud::setParcelThermoProperties ( - parcelType& parcel, - const scalar lagrangianDt + parcelType& parcel ) { - CloudType::setParcelThermoProperties(parcel, lagrangianDt); + CloudType::setParcelThermoProperties(parcel); parcel.T() = constProps_.T0(); parcel.Cp() = constProps_.Cp0(); @@ -374,11 +373,10 @@ template void Foam::ThermoCloud::checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ) { - CloudType::checkParcelProperties(parcel, lagrangianDt, fullyDescribed); + CloudType::checkParcelProperties(parcel, fullyDescribed); } diff --git a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H index 15158ad4ba..403225d1a2 100644 --- a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -348,17 +348,12 @@ public: // Cloud evolution functions //- Set parcel thermo properties - void setParcelThermoProperties - ( - parcelType& parcel, - const scalar lagrangianDt - ); + void setParcelThermoProperties(parcelType& parcel); //- Check parcel properties void checkParcelProperties ( parcelType& parcel, - const scalar lagrangianDt, const bool fullyDescribed ); diff --git a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.C b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.C index e8cbf94a37..414445d277 100644 --- a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.C @@ -48,8 +48,7 @@ template bool Foam::CollidingParcel::move ( TrackCloudType& cloud, - trackingData& td, - const scalar trackTime + trackingData& td ) { typename TrackCloudType::parcelType& p = @@ -62,9 +61,11 @@ bool Foam::CollidingParcel::move // First and last leapfrog velocity adjust part, required // before and after tracking and force calculation - p.U() += 0.5*trackTime*p.f()/p.mass(); + const Pair& sfr = td.stepFractionRange(); + const scalar dt = (sfr.second() - sfr.first())*td.trackTime()/2; - p.angularMomentum() += 0.5*trackTime*p.torque(); + p.U() += dt*p.f()/p.mass(); + p.angularMomentum() += dt*p.torque(); td.keepParticle = true; td.sendToProc = -1; @@ -74,7 +75,7 @@ bool Foam::CollidingParcel::move case trackingData::tpLinearTrack: { - ParcelType::move(cloud, td, trackTime); + ParcelType::move(cloud, td); break; } @@ -85,13 +86,6 @@ bool Foam::CollidingParcel::move break; } - - default: - { - FatalErrorInFunction - << td.part() << " is an invalid part of the tracking method." - << abort(FatalError); - } } return td.keepParticle; diff --git a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H index 0acf726840..b5ffa7c3a7 100644 --- a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcel.H @@ -219,7 +219,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the @@ -286,12 +287,7 @@ public: //- Move the parcel template - bool move - ( - TrackCloudType& cloud, - trackingData& td, - const scalar trackTime - ); + bool move(TrackCloudType& cloud, trackingData& td); //- Transform the physical properties of the particle // according to the given transformation tensor diff --git a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H index 28140e6b71..03b41c34e4 100644 --- a/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/CollidingParcel/CollidingParcelI.H @@ -66,10 +66,11 @@ inline Foam::CollidingParcel::CollidingParcel const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), + ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), f_(Zero), angularMomentum_(Zero), torque_(Zero), diff --git a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.C b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.C index ec2c2aa855..76634417ff 100644 --- a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.C @@ -45,8 +45,7 @@ template bool Foam::MPPICParcel::move ( TrackCloudType& cloud, - trackingData& td, - const scalar trackTime + trackingData& td ) { typename TrackCloudType::parcelType& p = @@ -56,14 +55,14 @@ bool Foam::MPPICParcel::move { case trackingData::tpPredictTrack: { - ParcelType::move(cloud, td, trackTime); + ParcelType::move(cloud, td); break; } case trackingData::tpDampingNoTrack: { p.UCorrect() = - cloud.dampingModel().velocityCorrection(p, trackTime); + cloud.dampingModel().velocityCorrection(p, td.trackTime()); td.keepParticle = true; td.sendToProc = -1; @@ -73,7 +72,7 @@ bool Foam::MPPICParcel::move case trackingData::tpPackingNoTrack: { p.UCorrect() = - cloud.packingModel().velocityCorrection(p, trackTime); + cloud.packingModel().velocityCorrection(p, td.trackTime()); td.keepParticle = true; td.sendToProc = -1; @@ -87,7 +86,7 @@ bool Foam::MPPICParcel::move Swap(p.U(), p.UCorrect()); - ParcelType::move(cloud, td, trackTime); + ParcelType::move(cloud, td); Swap(p.U(), p.UCorrect()); diff --git a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H index d5f17431ee..f5398ba9c8 100644 --- a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcel.H @@ -191,7 +191,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the @@ -237,12 +238,7 @@ public: //- Move the parcel template - bool move - ( - TrackCloudType& cloud, - trackingData& td, - const scalar trackTime - ); + bool move(TrackCloudType& cloud, trackingData& td); // Friend Functions diff --git a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H index 787cdb9389..5a25816942 100644 --- a/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/MPPICParcel/MPPICParcelI.H @@ -34,10 +34,11 @@ inline Foam::MPPICParcel::MPPICParcel const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), + ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), UCorrect_(Zero) {} diff --git a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.C b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.C index f6736f4d0b..113651696d 100644 --- a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.C @@ -257,8 +257,7 @@ template bool Foam::MomentumParcel::move ( TrackCloudType& cloud, - trackingData& td, - const scalar trackTime + trackingData& td ) { typename TrackCloudType::parcelType& p = @@ -272,7 +271,12 @@ bool Foam::MomentumParcel::move const scalarField& cellLengthScale = cloud.cellLengthScale(); const scalar maxCo = cloud.solution().maxCo(); - while (ttd.keepParticle && ttd.sendToProc == -1 && p.stepFraction() < 1) + while + ( + ttd.keepParticle + && ttd.sendToProc == -1 + && p.stepFraction() < ttd.stepFractionRange().second() + ) { if (p.moving() && p.onFace()) { @@ -284,7 +288,7 @@ bool Foam::MomentumParcel::move const scalar sfrac = p.stepFraction(); // Total displacement over the time-step - const vector s = trackTime*U_; + const vector s = ttd.trackTime()*U_; // Cell length scale const scalar l = cellLengthScale[p.cell()]; @@ -295,7 +299,7 @@ bool Foam::MomentumParcel::move // Fraction of the displacement to track in this loop. This is limited // to ensure that the both the time and distance tracked is less than // maxCo times the total value. - scalar f = 1 - p.stepFraction(); + scalar f = ttd.stepFractionRange().second() - p.stepFraction(); f = min(f, maxCo); f = min(f, maxCo/min(max(mag(s)/l, rootSmall), rootGreat)); if (p.moving()) @@ -313,7 +317,7 @@ bool Foam::MomentumParcel::move p.stepFraction() += f; } - const scalar dt = (p.stepFraction() - sfrac)*trackTime; + const scalar dt = (p.stepFraction() - sfrac)*ttd.trackTime(); // Avoid problems with extremely small timesteps if (dt > rootVSmall) diff --git a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H index 533baf432d..deb90b02b5 100644 --- a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcel.H @@ -191,6 +191,16 @@ public: const vector& g_; + // Tracking Parameters + + //- Track time. Total across the entire step. + scalar trackTime_; + + //- Step fraction range to track between. Allows for the + // creation of sub-steps. + Pair stepFractionRange_; + + public: // Constructors @@ -232,8 +242,20 @@ public: //- Access the continuous phase viscosity inline scalar& muc(); - // Return const access to the gravitational acceleration vector + // Return the gravitational acceleration vector inline const vector& g() const; + + //- Return the tracking time + inline scalar trackTime() const; + + //- Access the tracking time + inline scalar& trackTime(); + + //- Return the step fraction range to track between + inline Pair stepFractionRange() const; + + //- Access the step fraction range to track between + inline Pair& stepFractionRange(); }; @@ -355,7 +377,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the @@ -536,12 +559,7 @@ public: //- Move the parcel template - bool move - ( - TrackCloudType& cloud, - trackingData& td, - const scalar trackTime - ); + bool move(TrackCloudType& cloud, trackingData& td); // Transformations diff --git a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H index 931665953c..041341506e 100644 --- a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelI.H @@ -77,10 +77,11 @@ inline Foam::MomentumParcel::MomentumParcel const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), + ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), moving_(true), typeId_(-1), nParticle_(0), diff --git a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelTrackingDataI.H b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelTrackingDataI.H index a65e7e8271..ab7a937585 100644 --- a/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelTrackingDataI.H +++ b/src/lagrangian/parcel/parcels/Templates/MomentumParcel/MomentumParcelTrackingDataI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,7 +58,9 @@ inline Foam::MomentumParcel::trackingData::trackingData rhoc_(Zero), Uc_(Zero), muc_(Zero), - g_(cloud.g().value()) + g_(cloud.g().value()), + trackTime_(cloud.solution().trackTime()), + stepFractionRange_(0, 1) {} @@ -86,14 +88,6 @@ Foam::MomentumParcel::trackingData::muInterp() const } -template -inline const Foam::vector& -Foam::MomentumParcel::trackingData::g() const -{ - return g_; -} - - template inline Foam::scalar Foam::MomentumParcel::trackingData::rhoc() const @@ -138,4 +132,44 @@ inline Foam::scalar& Foam::MomentumParcel::trackingData::muc() } +template +inline const Foam::vector& +Foam::MomentumParcel::trackingData::g() const +{ + return g_; +} + + +template +inline Foam::scalar +Foam::MomentumParcel::trackingData::trackTime() const +{ + return trackTime_; +} + + +template +inline Foam::scalar& +Foam::MomentumParcel::trackingData::trackTime() +{ + return trackTime_; +} + + +template +inline Foam::Pair +Foam::MomentumParcel::trackingData::stepFractionRange() const +{ + return stepFractionRange_; +} + + +template +inline Foam::Pair& +Foam::MomentumParcel::trackingData::stepFractionRange() +{ + return stepFractionRange_; +} + + // ************************************************************************* // diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 5428dbb67d..83ac2cdd6c 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -290,7 +290,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index caa0c31818..f4b936b893 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H @@ -73,10 +73,11 @@ inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), + ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), YGas_(0), YLiquid_(0), YSolid_(0), diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H index 78d4ac66ae..f7b02d2d32 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -197,7 +197,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H index e7c0ba157b..b82b063afe 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H @@ -68,10 +68,11 @@ inline Foam::ReactingParcel::ReactingParcel const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), + ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), mass0_(0.0), Y_(0) {} diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H index b3876d710c..bf96160e01 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H @@ -199,7 +199,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H index bf20d72de3..cfbc1432c2 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H @@ -112,10 +112,11 @@ inline Foam::SprayParcel::SprayParcel const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), + ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), d0_(this->d()), position0_(this->position(mesh)), sigma_(0.0), diff --git a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H index d004df72ee..a1216eeadd 100644 --- a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -314,7 +314,8 @@ public: const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ); //- Construct from a position and a cell, searching for the rest of the diff --git a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H index b25dd327cd..cf41181f92 100644 --- a/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -79,10 +79,11 @@ inline Foam::ThermoParcel::ThermoParcel const barycentric& coordinates, const label celli, const label tetFacei, - const label tetPti + const label tetPti, + const label facei ) : - ParcelType(mesh, coordinates, celli, tetFacei, tetPti), + ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), T_(0.0), Cp_(0.0) {} diff --git a/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C b/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C index d2d0136937..444798f775 100644 --- a/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C +++ b/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/PairModel/PairSpringSliderDashpot/PairSpringSliderDashpot.C @@ -144,22 +144,19 @@ bool Foam::PairSpringSliderDashpot::controlsTimestep() const template Foam::label Foam::PairSpringSliderDashpot::nSubCycles() const { - if (!(this->owner().size())) + if (!this->owner().size()) { return 1; } - scalar RMin; - scalar rhoMax; - scalar UMagMax; - + scalar RMin, rhoMax, UMagMax; findMinMaxProperties(RMin, rhoMax, UMagMax); // Note: pi^(7/5)*(5/4)^(2/5) = 5.429675 - scalar minCollisionDeltaT = + const scalar minCollisionDeltaT = 5.429675 *RMin - *pow(rhoMax/(Estar_*sqrt(UMagMax) + vSmall), 0.4) + *pow(rhoMax/(Estar_*sqrt(UMagMax) + rootVSmall), 0.4) /collisionResolutionSteps_; return ceil(this->owner().time().deltaTValue()/minCollisionDeltaT); diff --git a/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C b/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C index d8bc939966..a7500a337f 100644 --- a/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C +++ b/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallLocalSpringSliderDashpot/WallLocalSpringSliderDashpot.C @@ -311,22 +311,19 @@ bool Foam::WallLocalSpringSliderDashpot::controlsTimestep() const template Foam::label Foam::WallLocalSpringSliderDashpot::nSubCycles() const { - if (!(this->owner().size())) + if (!this->owner().size()) { return 1; } - scalar rMin; - scalar rhoMax; - scalar UMagMax; - + scalar rMin, rhoMax, UMagMax; findMinMaxProperties(rMin, rhoMax, UMagMax); // Note: pi^(7/5)*(5/4)^(2/5) = 5.429675 - scalar minCollisionDeltaT = + const scalar minCollisionDeltaT = 5.429675 *rMin - *pow(rhoMax/(Estar_[maxEstarIndex_]*sqrt(UMagMax) + vSmall), 0.4) + *pow(rhoMax/(Estar_[maxEstarIndex_]*sqrt(UMagMax) + rootVSmall), 0.4) /collisionResolutionSteps_; return ceil(this->owner().time().deltaTValue()/minCollisionDeltaT); diff --git a/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C b/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C index c2d3394052..acb4320e13 100644 --- a/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C +++ b/src/lagrangian/parcel/submodels/Momentum/CollisionModel/PairCollision/WallModel/WallSpringSliderDashpot/WallSpringSliderDashpot.C @@ -241,22 +241,19 @@ bool Foam::WallSpringSliderDashpot::controlsTimestep() const template Foam::label Foam::WallSpringSliderDashpot::nSubCycles() const { - if (!(this->owner().size())) + if (!this->owner().size()) { return 1; } - scalar rMin; - scalar rhoMax; - scalar UMagMax; - + scalar rMin, rhoMax, UMagMax; findMinMaxProperties(rMin, rhoMax, UMagMax); // Note: pi^(7/5)*(5/4)^(2/5) = 5.429675 - scalar minCollisionDeltaT = + const scalar minCollisionDeltaT = 5.429675 *rMin - *pow(rhoMax/(Estar_*sqrt(UMagMax) + vSmall), 0.4) + *pow(rhoMax/(Estar_*sqrt(UMagMax) + rootVSmall), 0.4) /collisionResolutionSteps_; return ceil(this->owner().time().deltaTValue()/minCollisionDeltaT); diff --git a/src/lagrangian/parcel/submodels/Momentum/InjectionModel/CellZoneInjection/CellZoneInjection.C b/src/lagrangian/parcel/submodels/Momentum/InjectionModel/CellZoneInjection/CellZoneInjection.C index eb0db978f7..9e7245b835 100644 --- a/src/lagrangian/parcel/submodels/Momentum/InjectionModel/CellZoneInjection/CellZoneInjection.C +++ b/src/lagrangian/parcel/submodels/Momentum/InjectionModel/CellZoneInjection/CellZoneInjection.C @@ -42,7 +42,7 @@ void Foam::CellZoneInjection::setPositions const label nCells = cellZoneCells.size(); Random& rnd = this->owner().rndGen(); - DynamicList positions(nCells); // initial size only + DynamicList injectorCoordinates(nCells); // initial size only DynamicList