mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: tet decomposed particle tracking.
Squashed merge of particleInteractions up to commit e7cb5bcf0315c359539ef1e715e1d51991343391
This commit is contained in:
@ -38,12 +38,13 @@ static const scalar perturbFactor = 1E-6;
|
||||
|
||||
// Special version of findCell that generates a cell guaranteed to be
|
||||
// compatible with tracking.
|
||||
static label findCell(const meshSearch& meshSearcher, const point& pt)
|
||||
static label findCell(const Cloud<passiveParticle>& cloud, const point& pt)
|
||||
{
|
||||
const polyMesh& mesh = meshSearcher.mesh();
|
||||
label cellI = -1;
|
||||
label tetFaceI = -1;
|
||||
label tetPtI = -1;
|
||||
|
||||
// Use tracking to find cell containing pt
|
||||
label cellI = meshSearcher.findCell(pt);
|
||||
cloud.findCellFacePt(pt, cellI, tetFaceI, tetPtI);
|
||||
|
||||
if (cellI >= 0)
|
||||
{
|
||||
@ -54,16 +55,24 @@ static label findCell(const meshSearch& meshSearcher, const point& pt)
|
||||
// See if particle on face by finding nearest face and shifting
|
||||
// particle.
|
||||
|
||||
const polyMesh& mesh = cloud.pMesh();
|
||||
|
||||
meshSearch meshSearcher(mesh, false);
|
||||
|
||||
label faceI = meshSearcher.findNearestBoundaryFace(pt);
|
||||
|
||||
if (faceI >= 0)
|
||||
{
|
||||
const point& cc = mesh.cellCentres()[mesh.faceOwner()[faceI]];
|
||||
|
||||
const point perturbPt = (1-perturbFactor)*pt+perturbFactor*cc;
|
||||
|
||||
return meshSearcher.findCell(perturbPt);
|
||||
cloud.findCellFacePt(perturbPt, cellI, tetFaceI, tetPtI);
|
||||
|
||||
return cellI;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -207,8 +216,6 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
|
||||
|
||||
if (unmappedSource.size())
|
||||
{
|
||||
meshSearch targetSearcher(meshTarget, false);
|
||||
|
||||
sourceParticleI = 0;
|
||||
|
||||
forAllIter(Cloud<passiveParticle>, sourceParcels, iter)
|
||||
@ -216,7 +223,7 @@ void mapLagrangian(const meshToMesh& meshToMeshInterp)
|
||||
if (unmappedSource.found(sourceParticleI))
|
||||
{
|
||||
label targetCell =
|
||||
findCell(targetSearcher, iter().position());
|
||||
findCell(targetParcels, iter().position());
|
||||
|
||||
if (targetCell >= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user