From 3f5103235ea68171ff72937703f0130dee7663af Mon Sep 17 00:00:00 2001 From: Will Bainbridge <http://cfd.direct> Date: Wed, 16 Aug 2017 09:56:04 +0100 Subject: [PATCH] KinematicParcel: Apply in-cell updates before hitting the face The evolution of a KinematicParcel happens in three stages; (1) tracking across the cell, (2) interaction with the face or patch that has been hit, and (3) clculation and and update of parcel and cell properties. The KinematicParcel used to evolve in this order, as steps 1 and 2 were part of the same lower level method. This meant that the update stage was done after interacting with the face, meaning the parcel was not in the cell that had just been tracked through, or, by means of a patch interaction, had been modified such that it was no longer representative of the track through the cell. With the separation of stages 1 and 2 in the base class, it is now possible to do the update stage before interacting with the face (i.e., proceeding in the order 1, 3, 2). This makes the state consistent for the updates, and avoids the issues described. Patch contributed by Timo Niemi, VTT. This resolves bug report https://bugs.openfoam.org/view.php?id=2282 --- .../parcels/Templates/KinematicParcel/KinematicParcel.C | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 037ada186c6..74d077f7468 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -292,8 +292,8 @@ bool Foam::KinematicParcel<ParcelType>::move f = min(f, maxCo*l/max(SMALL*l, mag(s))); if (p.active()) { - // Track to and hit the next face - p.trackToAndHitFace(f*s, f, td); + // Track to the next face + p.trackToFace(f*s, f); } else { @@ -321,6 +321,11 @@ bool Foam::KinematicParcel<ParcelType>::move p.calc(td, dt, celli); } + if (p.onFace() && td.keepParticle) + { + p.hitFace(s, td); + } + if (p.onBoundaryFace() && td.keepParticle) { if (isA<processorPolyPatch>(pbMesh[p.patch()])) -- GitLab