ENH: wallBoundedStreamline: handle patches with zero faces. See #502.

This commit is contained in:
mattijs
2017-06-21 14:05:26 +01:00
parent cbbf08dc0d
commit c462d48196
2 changed files with 34 additions and 30 deletions

View File

@ -767,7 +767,7 @@ bool Foam::functionObjects::streamLineBase::write()
// Convert scalar values // Convert scalar values
if (allScalars_.size() > 0) if (allScalars_.size() > 0 && tracks.size() > 0)
{ {
List<List<scalarField>> scalarValues(allScalars_.size()); List<List<scalarField>> scalarValues(allScalars_.size());
@ -811,7 +811,7 @@ bool Foam::functionObjects::streamLineBase::write()
// Convert vector values // Convert vector values
if (allVectors_.size() > 0) if (allVectors_.size() > 0 && tracks.size() > 0)
{ {
List<List<vectorField>> vectorValues(allVectors_.size()); List<List<vectorField>> vectorValues(allVectors_.size());

View File

@ -139,39 +139,43 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
forAll(seedPoints, i) forAll(seedPoints, i)
{ {
const point& seedPt = seedPoints[i];
label celli = seedPoints.cells()[i]; label celli = seedPoints.cells()[i];
tetIndices ids(findNearestTet(isWallPatch, seedPt, celli)); if (celli != -1)
if (ids.face() != -1 && isWallPatch[ids.face()])
{ {
//Pout<< "Seeding particle :" << nl const point& seedPt = seedPoints[i];
// << " seedPt:" << seedPt << nl tetIndices ids(findNearestTet(isWallPatch, seedPt, celli));
// << " face :" << ids.face() << nl
// << " at :" << mesh_.faceCentres()[ids.face()] << nl
// << " cell :" << mesh_.cellCentres()[ids.cell()] << nl
// << endl;
particles.addParticle if (ids.face() != -1 && isWallPatch[ids.face()])
( {
new wallBoundedStreamLineParticle //Pout<< "Seeding particle :" << nl
// << " seedPt:" << seedPt << nl
// << " face :" << ids.face() << nl
// << " at :" << mesh_.faceCentres()[ids.face()]
// << nl
// << " cell :" << mesh_.cellCentres()[ids.cell()]
// << nl << endl;
particles.addParticle
( (
mesh_, new wallBoundedStreamLineParticle
ids.faceTri(mesh_).centre(), (
ids.cell(), mesh_,
ids.face(), // tetFace ids.faceTri(mesh_).centre(),
ids.tetPt(), ids.cell(),
-1, // not on a mesh edge ids.face(), // tetFace
-1, // not on a diagonal edge ids.tetPt(),
lifeTime_ // lifetime -1, // not on a mesh edge
) -1, // not on a diagonal edge
); lifeTime_ // lifetime
} )
else );
{ }
Pout<< type() << " : ignoring seed " << seedPt else
<< " since not in wall cell." << endl; {
Pout<< type() << " : ignoring seed " << seedPt
<< " since not in wall cell." << endl;
}
} }
} }
} }