From 2d6c691e750efe8ffba5eea2cd655e795d683a68 Mon Sep 17 00:00:00 2001 From: graham Date: Thu, 8 Oct 2009 18:50:46 +0100 Subject: [PATCH] Adding instrumentation Pout statements. Using an additional test for best guess face, which is the nearest face, although this is not fully thought out, and can be a problem if the nearest face is on a patch and this is not appropriate. --- src/lagrangian/basic/Cloud/Cloud.C | 15 +-- src/lagrangian/basic/Particle/Particle.C | 150 ++++++++++++++++++----- 2 files changed, 127 insertions(+), 38 deletions(-) diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 5d6cc5705a..81bf07b378 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -39,10 +39,10 @@ template const Foam::scalar Foam::Cloud::minValidTrackFraction = 1e-10; template -const Foam::scalar Foam::Cloud::trackingRescueTolerance = 1e-3; +const Foam::scalar Foam::Cloud::trackingRescueTolerance = 1e-6; template -const Foam::scalar Foam::Cloud::intersectionTolerance = SMALL; +const Foam::scalar Foam::Cloud::intersectionTolerance = 1e-3; template const Foam::scalar Foam::Cloud::planarCosAngle = (1 - 1e-6); @@ -189,13 +189,14 @@ void Foam::Cloud::calcConcaveCells() const intrudesIntoOwnerPtr_.reset(new PackedBoolList(pMesh().nFaces())); intrudesIntoNeighbourPtr_.reset(new PackedBoolList(pMesh().nFaces())); - forAll(cells, cellI) { - if (isConcaveCell(cellI)) - { - concaveCell[cellI] = 1; - } + // if (isConcaveCell(cellI)) + // { + // concaveCell[cellI] = 1; + // } + + concaveCell[cellI] = 1; } { diff --git a/src/lagrangian/basic/Particle/Particle.C b/src/lagrangian/basic/Particle/Particle.C index b2dc2d3299..cbc4a9ccc0 100644 --- a/src/lagrangian/basic/Particle/Particle.C +++ b/src/lagrangian/basic/Particle/Particle.C @@ -118,6 +118,14 @@ void Foam::Particle::trackToFaceConcave return; } + Pout<< nl << origProc_ << " " + << origId_ << " " + << position_ << " " + << endPosition << " " + << celli_ << nl + << potentiallyCrossedFaces + << endl; + label nFaceCrossings = 0; forAll (potentiallyCrossedFaces, pCFI) @@ -156,11 +164,13 @@ void Foam::Particle::trackToFaceConcave if (nFaceCrossings > 1) { Pout<< "In cell " << celli_ << " there were " << nFaceCrossings - << " face crossings detected tracking from cell centre to " + << " face crossings detected tracking from concave cell centre to " << " endPosition" << endl; } + Pout<< nFaceCrossings << " " << (nFaceCrossings % 2) << endl; + if (nFaceCrossings % 2 == 0) { // Even number of face crossings, so the particle must end up @@ -201,7 +211,7 @@ void Foam::Particle::trackToFaceConcave // has been found Pout<< "New face crossing " << facei - << " of cell " << celli_ << " found" + << " of concave cell " << celli_ << " found" << endl; potentiallyCrossedFaces.append(facei); @@ -209,6 +219,8 @@ void Foam::Particle::trackToFaceConcave } } + Pout<< potentiallyCrossedFaces << endl; + vector deltaPosition = endPosition - position_; scalar tmpLambda = GREAT; @@ -261,9 +273,19 @@ void Foam::Particle::trackToFaceConcave { // No face has been identified to be crossed yet, but the cell // must have been left, so the best guess of which face to - // cross is required. This face will not be one of those - // faces already tested, and could be any other face of the - // cell. + // cross is required. + + vector delta = + mag(mesh.cellCentres()[celli_] - position_) + *deltaPosition/mag(deltaPosition); + + Pout<< "Need a best guess " << nl + << position_ << nl + << position_ + delta << nl + << position_ - delta + << endl; + + // ---- Best guess by projection -- DynamicList tmpLambdas; DynamicList