From 0cbddca2c8dad71a097748ab8bd5d3c04fcbd3ae Mon Sep 17 00:00:00 2001 From: graham Date: Sun, 11 Oct 2009 00:02:36 +0100 Subject: [PATCH] Neater handling of non-patch face crossing. Not applying a small tracking increase to patch interactions. --- src/lagrangian/basic/Particle/Particle.C | 41 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/lagrangian/basic/Particle/Particle.C b/src/lagrangian/basic/Particle/Particle.C index be397937a3..952f5e357b 100644 --- a/src/lagrangian/basic/Particle/Particle.C +++ b/src/lagrangian/basic/Particle/Particle.C @@ -286,6 +286,9 @@ void Foam::Particle::trackToFaceConcave { if (!cloud_.internalFace(facei_)) { + // For a patch face, allow a small value of lambda to + // ensure patch interactions occur. + label patchi = patch(facei_); const polyPatch& patch = mesh.boundaryMesh()[patchi]; @@ -312,27 +315,37 @@ void Foam::Particle::trackToFaceConcave } } } - else if (correctLambda < Cloud::minValidTrackFraction) + else { - // The particle is not far enough away from the face - // to decide if it is valid crossing. Let it move a - // little without crossing the face to resolve the - // ambiguity. + if (correctLambda < Cloud::minValidTrackFraction) + { + // The particle is not far enough away from the face + // to decide if it is valid crossing. Let it move a + // little without crossing the face to resolve the + // ambiguity. - // Pout<< "Ambiguous face crossing, correcting towards cell " - // << "centre and not crossing face" << endl; + // Pout<< "Ambiguous face crossing, correcting towards cell " + // << "centre and not crossing face" << endl; - // const point& cc = mesh.cellCentres()[celli_]; - // position_ += - // Cloud::trackingRescueTolerance - // *(cc - position_); + // const point& cc = mesh.cellCentres()[celli_]; + // position_ += + // Cloud::trackingRescueTolerance + // *(cc - position_); - // Pout<< "Ambiguous face crossing. " << endl; + // Pout<< "Ambiguous face crossing. " << endl; - facei_ = -1; + facei_ = -1; + } + + // If the face hit was not on a wall, add a small + // amount to the track to move it off the face, If it + // was not an ambiguous face crossing, this makes sure + // the face is not ambiguous next tracking step. If + // it was ambiguous, this should resolve it. + + correctLambda += Cloud::minValidTrackFraction; } - correctLambda += Cloud::minValidTrackFraction; trackFraction = correctLambda; position_ += trackFraction*(endPosition - position_); }