BUG: discrete tut tweaks and fixes to make them run.

This commit is contained in:
graham
2010-10-08 20:34:59 +01:00
parent 9eb1ae7307
commit f2842e76b9
16 changed files with 280 additions and 89 deletions

View File

@ -686,8 +686,14 @@ public:
// Useful derived info
//- Is the point in the cell bounding box
bool pointInCellBB(const point& p, label celli) const;
//- Is the point in the cell bounding box, option relative
// tolerance to increase the effective size of the boundBox
bool pointInCellBB
(
const point& p,
label celli,
scalar tol = 0
) const;
//- Is the point in the cell
bool pointInCell(const point& p, label celli) const;

View File

@ -30,16 +30,33 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Is the point in the cell bounding box
bool Foam::primitiveMesh::pointInCellBB(const point& p, label celli) const
bool Foam::primitiveMesh::pointInCellBB
(
const point& p,
label celli,
scalar tol
) const
{
return boundBox
boundBox bb
(
cells()[celli].points
(
faces(),
points()
)
).contains(p);
),
false
);
if (tol > SMALL)
{
bb = boundBox
(
bb.min() - tol*bb.span(),
bb.max() + tol*bb.span()
);
}
return bb.contains(p);
}

View File

@ -970,11 +970,12 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
// number, but hasn't been able to find a cell to
// occupy.
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI))
if(!cloud_.polyMesh_.pointInCellBB(position_, oldCellI, 0.1))
{
// If the position is not inside the bound-box of
// the cell that it thought it should be in, then
// this is considered an error.
// If the position is not inside the (slightly
// extended) bound-box of the cell that it thought
// it should be in, then this is considered an
// error.
FatalErrorIn
(
@ -985,18 +986,20 @@ inline void Foam::Particle<ParticleType>::initCellFacePt()
")"
) << "cell, tetFace and tetPt search failure at position "
<< position_ << nl
<< "for requested cell " << oldCellI << nl
<< abort(FatalError);
}
// The position is in the bound-box of the cell. This
// situation may arise because the face decomposition
// of the cell is not the same as when the particle
// acquired the cell index. For example, it has been
// read into a mesh that has made a different face
// base-point decision for a boundary face and now
// this particle is in a position that is not in the
// mesh. Gradually move the particle towards the
// centre of the cell that it thought that it was in.
// The position is in the (slightly extended)
// bound-box of the cell. This situation may arise
// because the face decomposition of the cell is not
// the same as when the particle acquired the cell
// index. For example, it has been read into a mesh
// that has made a different face base-point decision
// for a boundary face and now this particle is in a
// position that is not in the mesh. Gradually move
// the particle towards the centre of the cell that it
// thought that it was in.
cellI_ = oldCellI;

View File

@ -1108,7 +1108,7 @@ Foam::moleculeCloud::moleculeCloud
mesh_(mesh),
pot_(pot),
cellOccupancy_(mesh_.nCells()),
il_(mesh_, pot_.pairPotentials().rCutMax(), true),
il_(mesh_, pot_.pairPotentials().rCutMax(), false),
constPropList_(),
rndGen_(clock::getTime())
{