From d62efed988908822280370de0fb4b68a58ed6a31 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 27 Aug 2013 18:11:35 +0100 Subject: [PATCH] ENH: CollidingParcel - refactored to remove code duplication --- .../CollidingParcel/CollidingParcel.C | 72 +------------------ 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C index f04ac77a15..f422f7ea37 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C @@ -69,13 +69,6 @@ bool Foam::CollidingParcel::move typename TrackData::cloudType::parcelType& p = static_cast(*this); - td.switchProcessor = false; - td.keepParticle = true; - - const polyMesh& mesh = td.cloud().pMesh(); - const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); - const scalarField& V = mesh.cellVolumes(); - switch (td.part()) { case TrackData::tpVelocityHalfStep: @@ -92,70 +85,7 @@ bool Foam::CollidingParcel::move case TrackData::tpLinearTrack: { - scalar tEnd = (1.0 - p.stepFraction())*trackTime; - const scalar dtMax = tEnd; - - while (td.keepParticle && !td.switchProcessor && tEnd > ROOTVSMALL) - { - // Apply correction to position for reduced-D cases - meshTools::constrainToMeshCentre(mesh, p.position()); - - const point start(p.position()); - - // Set the Lagrangian time-step - scalar dt = min(dtMax, tEnd); - - // Remember which cell the parcel is in since this - // will change if a face is hit - const label cellI = p.cell(); - - const scalar magU = mag(p.U()); - if (p.active() && magU > ROOTVSMALL) - { - const scalar d = dt*magU; - const scalar maxCo = td.cloud().solution().maxCo(); - const scalar dCorr = min(d, maxCo*cbrt(V[cellI])); - dt *= - dCorr/d - *p.trackToFace(p.position() + dCorr*p.U()/magU, td); - } - - tEnd -= dt; - p.stepFraction() = 1.0 - tEnd/trackTime; - - // Avoid problems with extremely small timesteps - if (dt > ROOTVSMALL) - { - // Update cell based properties - p.setCellValues(td, dt, cellI); - - if (td.cloud().solution().cellValueSourceCorrection()) - { - p.cellValueSourceCorrection(td, dt, cellI); - } - - p.calc(td, dt, cellI); - } - - if (p.onBoundary() && td.keepParticle) - { - if (isA(pbMesh[p.patch(p.face())])) - { - td.switchProcessor = true; - } - } - - p.age() += dt; - - td.cloud().functions().postMove - ( - p, - cellI, - dt, - start, - td.keepParticle - ); - } + ParcelType::move(td, trackTime); break; }