Cloud: Accumulate warning messages associated with location failures

Warnings about initialisation of particles with locations outside of the
mesh and about the positional inaccuracy of NCC transfers are now
accumulated and printed once per time-step. This way, the log isn't
obscured by hundreds of such warnings.

Also, the pattern in which warnings are silenced after some arbitrary
number (typically 100) have been issued has been removed. This pattern
means that user viewing the log later in the run may be unaware that a
problem is still present. Accumulated warnings are concise enough that
they do not need to be silenced. They are generated every time-step, and
so remain visible throughout the log.
This commit is contained in:
Will Bainbridge
2023-09-19 09:52:35 +01:00
parent aaf04f0481
commit e5cf0cf4ed
50 changed files with 443 additions and 431 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -243,18 +243,25 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp)
if (targetCell >= 0)
{
unmappedSource.erase(sourceParticleI);
addParticles.append(sourceParticleI);
targetParcels.addParticle
label nLocateBoundaryHits = 0;
autoPtr<passiveParticle> pPtr
(
new passiveParticle
(
meshTarget,
iter().position(meshSource),
targetCell
targetCell,
nLocateBoundaryHits
)
);
sourceParcels.remove(&iter());
if (nLocateBoundaryHits == 0)
{
unmappedSource.erase(sourceParticleI);
addParticles.append(sourceParticleI);
targetParcels.addParticle(pPtr.ptr());
sourceParcels.remove(&iter());
}
}
}
sourceParticleI++;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -241,15 +241,22 @@ void Foam::mapClouds(const fvMeshToFvMesh& interp)
);
forAll(positions, tgtParticlei)
{
tgtCloud.addParticle
label nLocateBoundaryHits = 0;
autoPtr<passiveParticle> pPtr
(
new passiveParticle
(
tgtMesh,
positions[tgtParticlei],
tgtCells[tgtParticlei]
tgtCells[tgtParticlei],
nLocateBoundaryHits
)
);
if (nLocateBoundaryHits == 0)
{
tgtCloud.addParticle(pPtr.ptr());
}
}
Info<< " mapped "

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,11 +32,12 @@ Foam::findCellParticle::findCellParticle
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const vector& displacement,
const label data
)
:
particle(mesh, position, celli),
particle(mesh, position, celli, nLocateBoundaryHits),
displacement_(displacement),
data_(data)
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -123,6 +123,7 @@ public:
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const vector& displacement,
const label data
);

View File

@ -70,6 +70,8 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
// Add particles to track to sample locations
nPatchFaces = 0;
label nLocateBoundaryHits = 0;
forAllConstIter(labelHashSet, patchSet_, iter)
{
label patchi = iter.key();
@ -86,6 +88,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
mesh_,
patch.Cf()[patchFacei],
patch.faceCells()[patchFacei],
nLocateBoundaryHits,
- distance_*nf[patchFacei],
globalWalls.toGlobal(nPatchFaces) // passive data
)

View File

@ -285,6 +285,7 @@ bool Foam::functionObjects::streamlines::write()
cloudName_,
IDLList<streamlinesParticle>()
);
label nLocateBoundaryHits;
forAll(sampledSetPtr_(), i)
{
particles.addParticle
@ -294,6 +295,7 @@ bool Foam::functionObjects::streamlines::write()
mesh_,
sampledSetPtr_().positions()[i],
sampledSetPtr_().cells()[i],
nLocateBoundaryHits,
lifeTime_,
gi.toGlobal(i)
)

View File

@ -132,11 +132,12 @@ Foam::streamlinesParticle::streamlinesParticle
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const label lifeTime,
const label trackIndex
)
:
particle(mesh, position, celli),
particle(mesh, position, celli, nLocateBoundaryHits),
lifeTime_(lifeTime),
trackIndex_(trackIndex),
trackPartIndex_(0),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -208,6 +208,7 @@ public:
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const label lifeTime,
const label trackIndex
);

View File

@ -5,7 +5,6 @@ parcels/derived/dsmcParcel/dsmcParcel.C
clouds/Templates/DSMCCloud/DSMCCloudName.C
# Sub-models
parcels/derived/dsmcParcel/defineDSMCParcel.C
parcels/derived/dsmcParcel/makeDSMCParcelBinaryCollisionModels.C
parcels/derived/dsmcParcel/makeDSMCParcelWallInteractionModels.C
parcels/derived/dsmcParcel/makeDSMCParcelInflowBoundaryModels.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -107,6 +107,8 @@ void Foam::DSMCCloud<ParcelType>::initialise
numberDensities /= nParticle_;
label nLocateBoundaryHits = 0;
forAll(mesh_.cells(), celli)
{
List<tetIndices> cellTets = polyMeshTetDecomposition::cellTetIndices
@ -174,12 +176,21 @@ void Foam::DSMCCloud<ParcelType>::initialise
U += velocity;
addNewParcel(p, celli, U, Ei, typeId);
addNewParcel(p, celli, nLocateBoundaryHits, U, Ei, typeId);
}
}
}
}
reduce(nLocateBoundaryHits, sumOp<label>());
if (nLocateBoundaryHits != 0)
{
WarningInFunction
<< "Initialisation of cloud " << this->name()
<< " did not accurately locate " << nLocateBoundaryHits
<< " particles" << endl;
}
// Initialise the sigmaTcRMax_ field to the product of the cross section of
// the most abundant species and the most probable thermal speed (Bird,
// p222-223)
@ -454,12 +465,25 @@ void Foam::DSMCCloud<ParcelType>::addNewParcel
(
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const vector& U,
const scalar Ei,
const label typeId
)
{
this->addParticle(new ParcelType(mesh_, position, celli, U, Ei, typeId));
this->addParticle
(
new ParcelType
(
mesh_,
position,
celli,
nLocateBoundaryHits,
U,
Ei,
typeId
)
);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -456,6 +456,7 @@ public:
(
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const vector& U,
const scalar Ei,
const label typeId

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -165,6 +165,7 @@ public:
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const vector& U,
const scalar Ei,
const label typeId

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -58,12 +58,13 @@ inline Foam::DSMCParcel<ParcelType>::DSMCParcel
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const vector& U,
const scalar Ei,
const label typeId
)
:
ParcelType(mesh, position, celli),
ParcelType(mesh, position, celli, nLocateBoundaryHits),
U_(U),
Ei_(Ei),
typeId_(typeId)

View File

@ -1,35 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "dsmcParcel.H"
#include "DSMCParcel.H"
namespace Foam
{
defineTemplateTypeNameAndDebug(DSMCParcel<particle>, 0);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,59 +24,13 @@ License
\*---------------------------------------------------------------------------*/
#include "dsmcParcel.H"
/*
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// defineTypeNameAndDebug(dsmcParcel, 0);
// defineParticleTypeNameAndDebug(dsmcParcel, 0);
defineTemplateTypeNameAndDebug(DSMCParcel<particle>, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dsmcParcel::dsmcParcel
(
c& owner,
const vector& position,
const vector& U,
const scalar Ei,
const label celli,
const label tetFacei,
const label tetPti,
const label typeId
)
:
DSMCParcel<dsmcParcel>
(
owner,
position,
U,
Ei,
celli,
tetFacei,
tetPti,
typeId
)
{}
Foam::dsmcParcel::dsmcParcel
(
const Cloud<dsmcParcel>& cloud,
Istream& is,
bool readFields
)
:
DSMCParcel<dsmcParcel>(cloud, is, readFields)
{}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::dsmcParcel::~dsmcParcel()
{}
*/
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,7 @@ Typedef
Foam::dsmcParcel
Description
Declaration of dsmc parcel type
Declaration of dsmc parcel type
SourceFiles
dsmcParcel.C

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -161,6 +161,7 @@ void Foam::FreeStream<CloudType>::inflow()
cloud.boundaryU().boundaryField()
);
label nLocateBoundaryHits = 0;
forAll(patches_, p)
{
@ -401,7 +402,15 @@ void Foam::FreeStream<CloudType>::inflow()
cloud.constProps(typeId).internalDegreesOfFreedom()
);
cloud.addNewParcel(p, celli, U, Ei, typeId);
cloud.addNewParcel
(
p,
celli,
nLocateBoundaryHits,
U,
Ei,
typeId
);
particlesInserted++;
}
@ -409,11 +418,19 @@ void Foam::FreeStream<CloudType>::inflow()
}
}
reduce(nLocateBoundaryHits, sumOp<label>());
if (nLocateBoundaryHits != 0)
{
WarningInFunction
<< "Freestream inflow model for cloud " << this->owner().name()
<< " did not accurately locate " << nLocateBoundaryHits
<< " particles" << endl;
}
reduce(particlesInserted, sumOp<label>());
Info<< " Particles inserted = "
<< particlesInserted << endl;
}

View File

@ -180,16 +180,6 @@ void Foam::Cloud<ParticleType>::storeRays() const
}
template<class ParticleType>
Foam::string Foam::Cloud<ParticleType>::mapOutsideMsg(const point& position)
{
OStringStream oss;
oss << "Particle at " << position << " mapped to a location outside of "
<< "the new mesh. This particle will be removed.";
return oss.str();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
@ -241,19 +231,24 @@ void Foam::Cloud<ParticleType>::deleteParticle(ParticleType& p)
template<class ParticleType>
void Foam::Cloud<ParticleType>::deleteLostParticles()
{
label lostCount = 0;
forAllIter(typename Cloud<ParticleType>, *this, pIter)
{
ParticleType& p = pIter();
if (p.cell() == -1)
if (pIter().cell() == -1)
{
WarningInFunction
<< "deleting lost particle at position "
<< p.position(pMesh_) << endl;
deleteParticle(p);
deleteParticle(pIter());
lostCount ++;
}
}
reduce(lostCount, sumOp<label>());
if (lostCount != 0)
{
WarningInFunction
<< "Cloud " << this->name()
<< " deleted " << lostCount << " lost particles" << endl;
}
}
@ -422,6 +417,23 @@ void Foam::Cloud<ParticleType>::move
}
}
}
// Warn about any approximate locates
Pstream::listCombineGather(td.patchNLocateBoundaryHits, plusEqOp<label>());
if (Pstream::master())
{
forAll(td.patchNLocateBoundaryHits, patchi)
{
if (td.patchNLocateBoundaryHits[patchi] != 0)
{
WarningInFunction
<< "Cloud " << name() << " did not accurately locate "
<< td.patchNLocateBoundaryHits[patchi]
<< " particles that transferred to patch "
<< pMesh_.boundaryMesh()[patchi].name() << nl;
}
}
}
}
@ -446,6 +458,8 @@ void Foam::Cloud<ParticleType>::topoChange(const polyTopoChangeMap& map)
const vectorField& positions = globalPositionsPtr_();
label lostCount = 0;
label particlei = 0;
forAllIter(typename Cloud<ParticleType>, *this, iter)
{
@ -453,11 +467,20 @@ void Foam::Cloud<ParticleType>::topoChange(const polyTopoChangeMap& map)
const label celli = map.reverseCellMap()[iter().cell()];
if (!iter().map(pMesh_, pos, celli, mapOutsideMsg))
if (!iter().locate(pMesh_, pos, celli))
{
this->remove(iter);
lostCount ++;
}
}
reduce(lostCount, sumOp<label>());
if (lostCount != 0)
{
WarningInFunction
<< "Topology change of cloud " << this->name()
<< " lost " << lostCount << " particles" << endl;
}
}
@ -485,6 +508,8 @@ void Foam::Cloud<ParticleType>::mapMesh(const polyMeshMap& map)
const vectorField& positions = globalPositionsPtr_();
label lostCount = 0;
// Loop the particles. Map those that remain on this processor, and
// transfer others into send arrays.
List<DynamicList<label>> sendCellIndices(Pstream::nProcs());
@ -503,14 +528,15 @@ void Foam::Cloud<ParticleType>::mapMesh(const polyMeshMap& map)
if (tgtProcCell == remote())
{
WarningInFunction << mapOutsideMsg(pos) << nl;
this->remove(iter);
lostCount ++;
}
else if (proci == Pstream::myProcNo())
{
if (!iter().map(pMesh_, pos, celli, mapOutsideMsg))
if (!iter().locate(pMesh_, pos, celli))
{
this->remove(iter);
lostCount ++;
}
}
else
@ -522,57 +548,69 @@ void Foam::Cloud<ParticleType>::mapMesh(const polyMeshMap& map)
}
}
// If serial then there is nothing more to do
if (!Pstream::parRun())
// If parallel then send and receive particles that move processes and map
// those sent to this process
if (Pstream::parRun())
{
return;
}
// Create transfer buffers
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Create transfer buffers
PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Stream into send buffers
forAll(sendParticles, proci)
{
if (sendParticles[proci].size())
// Stream into send buffers
forAll(sendParticles, proci)
{
UOPstream particleStream(proci, pBufs);
particleStream
<< sendCellIndices[proci]
<< sendPositions[proci]
<< sendParticles[proci];
}
}
// Finish sending
labelList receiveSizes(Pstream::nProcs());
pBufs.finishedSends(receiveSizes);
// Retrieve from receive buffers and map into the new mesh
forAll(sendParticles, proci)
{
if (receiveSizes[proci])
{
UIPstream particleStream(proci, pBufs);
const labelList receiveCellIndices(particleStream);
const List<point> receivePositions(particleStream);
IDLList<ParticleType> receiveParticles(particleStream);
label particlei = 0;
forAllIter(typename Cloud<ParticleType>, receiveParticles, iter)
if (sendParticles[proci].size())
{
const label celli = receiveCellIndices[particlei];
const vector& pos = receivePositions[particlei ++];
UOPstream particleStream(proci, pBufs);
if (iter().map(pMesh_, pos, celli, mapOutsideMsg))
particleStream
<< sendCellIndices[proci]
<< sendPositions[proci]
<< sendParticles[proci];
}
}
// Finish sending
labelList receiveSizes(Pstream::nProcs());
pBufs.finishedSends(receiveSizes);
// Retrieve from receive buffers and map into the new mesh
forAll(sendParticles, proci)
{
if (receiveSizes[proci])
{
UIPstream particleStream(proci, pBufs);
const labelList receiveCellIndices(particleStream);
const List<point> receivePositions(particleStream);
IDLList<ParticleType> receiveParticles(particleStream);
label particlei = 0;
forAllIter(typename Cloud<ParticleType>, receiveParticles, iter)
{
this->append(receiveParticles.remove(iter));
const label celli = receiveCellIndices[particlei];
const vector& pos = receivePositions[particlei ++];
if (iter().locate(pMesh_, pos, celli))
{
this->append(receiveParticles.remove(iter));
}
else
{
receiveParticles.remove(iter);
lostCount ++;
}
}
}
}
}
reduce(lostCount, sumOp<label>());
if (lostCount != 0)
{
WarningInFunction
<< "Mesh-to-mesh mapping of cloud " << this->name()
<< " lost " << lostCount << " particles" << endl;
}
}
@ -660,6 +698,8 @@ void Foam::Cloud<ParticleType>::distribute(const polyDistributionMap& map)
IDLList<ParticleType>()
);
label lostCount = 0;
// Locate the particles within the new mesh
forAll(cellParticles, celli)
{
@ -668,12 +708,25 @@ void Foam::Cloud<ParticleType>::distribute(const polyDistributionMap& map)
{
const point& pos = cellParticlePositions[celli][cellParticlei++];
if (iter().map(pMesh_, pos, celli, mapOutsideMsg))
if (iter().locate(pMesh_, pos, celli))
{
this->append(cellParticles[celli].remove(iter));
}
else
{
cellParticles[celli].remove(iter);
lostCount ++;
}
}
}
reduce(lostCount, sumOp<label>());
if (lostCount != 0)
{
WarningInFunction
<< "Mesh-to-mesh mapping of cloud " << this->name()
<< " lost " << lostCount << " particles" << endl;
}
}

View File

@ -119,9 +119,6 @@ class Cloud
//- Store rays necessary for non conformal cyclic transfer
void storeRays() const;
//- Generate a "mapped outside" warning messgage
static string mapOutsideMsg(const point& position);
public:

View File

@ -369,6 +369,74 @@ void Foam::particle::changeCell(const polyMesh& mesh)
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::particle::particle
(
const polyMesh& mesh,
const barycentric& coordinates,
const label celli,
const label tetFacei,
const label tetPti,
const label facei
)
:
coordinates_(coordinates),
celli_(celli),
tetFacei_(tetFacei),
tetPti_(tetPti),
facei_(facei),
stepFraction_(1),
stepFractionBehind_(0),
nTracksBehind_(0),
origProc_(Pstream::myProcNo()),
origId_(getNewParticleID())
{}
Foam::particle::particle
(
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits
)
:
coordinates_(- vGreat, - vGreat, - vGreat, - vGreat),
celli_(celli),
tetFacei_(-1),
tetPti_(-1),
facei_(-1),
stepFraction_(1),
stepFractionBehind_(0),
nTracksBehind_(0),
origProc_(Pstream::myProcNo()),
origId_(getNewParticleID())
{
if (!locate(mesh, position, celli))
{
nLocateBoundaryHits ++;
}
}
Foam::particle::particle(const particle& p)
:
coordinates_(p.coordinates_),
celli_(p.celli_),
tetFacei_(p.tetFacei_),
tetPti_(p.tetPti_),
facei_(p.facei_),
stepFraction_(p.stepFraction_),
stepFractionBehind_(p.stepFractionBehind_),
nTracksBehind_(p.nTracksBehind_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::particle::locate
(
const polyMesh& mesh,
@ -438,96 +506,13 @@ bool Foam::particle::locate
tetPti_ = minTetPti;
facei_ = -1;
reset(1);
track(mesh, displacement, 0);
if (!onFace())
{
return true;
}
return false;
// Return successful if in a cell
return !onBoundaryFace(mesh);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::particle::particle
(
const polyMesh& mesh,
const barycentric& coordinates,
const label celli,
const label tetFacei,
const label tetPti,
const label facei
)
:
coordinates_(coordinates),
celli_(celli),
tetFacei_(tetFacei),
tetPti_(tetPti),
facei_(facei),
stepFraction_(1),
stepFractionBehind_(0),
nTracksBehind_(0),
origProc_(Pstream::myProcNo()),
origId_(getNewParticleID())
{}
Foam::particle::particle
(
const polyMesh& mesh,
const vector& position,
const label celli
)
:
coordinates_(- vGreat, - vGreat, - vGreat, - vGreat),
celli_(celli),
tetFacei_(-1),
tetPti_(-1),
facei_(-1),
stepFraction_(1),
stepFractionBehind_(0),
nTracksBehind_(0),
origProc_(Pstream::myProcNo()),
origId_(getNewParticleID())
{
auto boundaryMsg = [](const point& position)
{
OStringStream oss;
oss << "Particle at " << position << " initialised in a location "
<< "outside of the mesh.";
return oss.str();
};
locate
(
mesh,
position,
celli,
false,
boundaryMsg
);
}
Foam::particle::particle(const particle& p)
:
coordinates_(p.coordinates_),
celli_(p.celli_),
tetFacei_(p.tetFacei_),
tetPti_(p.tetPti_),
facei_(p.facei_),
stepFraction_(p.stepFraction_),
stepFractionBehind_(p.stepFractionBehind_),
nTracksBehind_(p.nTracksBehind_),
origProc_(p.origProc_),
origId_(p.origId_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::particle::track
(
const polyMesh& mesh,
@ -1086,7 +1071,8 @@ void Foam::particle::prepareForNonConformalCyclicTransfer
void Foam::particle::correctAfterNonConformalCyclicTransfer
(
const polyMesh& mesh,
const label sendToPatch
const label sendToPatch,
labelList& patchNLocateBoundaryHits
)
{
const nonConformalCyclicPolyPatch& nccpp =
@ -1103,24 +1089,12 @@ void Foam::particle::correctAfterNonConformalCyclicTransfer
coordinates_.d()
);
auto boundaryMsg = [&nccpp](const point& position)
{
return
"Particle at " + name(position) + " crossed between "
+ nonConformalCyclicPolyPatch::typeName + " patches "
+ nccpp.name() + " and " + nccpp.nbrPatch().name()
+ " to a location outside of the mesh.";
};
// Locate the particle on the receiving side
locate
(
mesh,
receivePos,
mesh.faceOwner()[facei_ + nccpp.origPatch().start()],
false,
boundaryMsg
);
const label celli = mesh.faceOwner()[facei_ + nccpp.origPatch().start()];
if (!locate(mesh, receivePos, celli))
{
patchNLocateBoundaryHits[sendToPatch] ++;
}
// The particle must remain associated with a face for the tracking to
// register as incomplete
@ -1221,6 +1195,7 @@ Foam::label Foam::particle::procTetPt
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
//
bool Foam::operator==(const particle& pA, const particle& pB)
{

View File

@ -122,6 +122,10 @@ public:
//- Patch face to which to send the particle
label sendToPatchFace;
//- Number of boundary hits that occurred during locate executions
// following (non-conformal) patch transfers. For reporting.
labelList patchNLocateBoundaryHits;
// Constructor
template <class TrackCloudType>
@ -132,7 +136,13 @@ public:
sendToProc(-1),
sendFromPatch(-1),
sendToPatch(-1),
sendToPatchFace(-1)
sendToPatchFace(-1),
patchNLocateBoundaryHits
(
mesh.boundaryMesh().size()
- mesh.globalData().processorPatches().size(),
0
)
{}
};
@ -298,28 +308,6 @@ private:
void changeCell(const polyMesh& mesh);
// Geometry changes
//- Locate the particle at the given position
bool locate
(
const polyMesh& mesh,
const vector& position,
label celli
);
//- Locate the particle at the given position
template<class BoundaryMsg>
bool locate
(
const polyMesh& mesh,
const vector& position,
label celli,
const bool boundaryFail,
BoundaryMsg boundaryMsg
);
public:
// Static Data Members
@ -358,7 +346,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream
@ -467,6 +456,14 @@ public:
// for a new track
inline void reset(const scalar stepFraction);
//- Locate the particle at the given position
bool locate
(
const polyMesh& mesh,
const vector& position,
label celli
);
//- Track along the displacement for a given fraction of the overall
// step. End when the track is complete, or when a boundary is hit.
// On exit, stepFraction_ will have been incremented to the current
@ -610,7 +607,8 @@ public:
void correctAfterNonConformalCyclicTransfer
(
const polyMesh& mesh,
const label sendToPatch
const label sendToPatch,
labelList& patchNLocateBoundaryHits
);
@ -700,19 +698,6 @@ public:
) const;
// Mapping
//- Map after a mesh change
template<class BoundaryMsg>
bool map
(
const polyMesh& mesh,
const point& position,
const label celli,
BoundaryMsg boundaryMsg
);
// I-O
//- Read the fields associated with the owner cloud

View File

@ -35,74 +35,8 @@ License
#include "wedgePolyPatch.H"
#include "meshTools.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class BoundaryMsg>
bool Foam::particle::locate
(
const polyMesh& mesh,
const vector& position,
label celli,
const bool boundaryFail,
BoundaryMsg boundaryMsg
)
{
if (locate(mesh, position, celli))
{
return true;
}
// If we are here then we hit a boundary
if (boundaryFail)
{
FatalErrorInFunction << boundaryMsg(position).c_str()
<< exit(FatalError);
}
else
{
static label nWarnings = 0;
static const label maxNWarnings = 100;
if (nWarnings < maxNWarnings)
{
WarningInFunction << boundaryMsg(position).c_str() << endl;
++ nWarnings;
}
if (nWarnings == maxNWarnings)
{
WarningInFunction
<< "Suppressing any further warnings about particles being "
<< "located outside of the mesh." << endl;
++ nWarnings;
}
}
return false;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BoundaryMsg>
bool Foam::particle::map
(
const polyMesh& mesh,
const vector& position,
const label celli,
BoundaryMsg boundaryMsg
)
{
return
locate
(
mesh,
position,
celli,
true,
boundaryMsg
);
}
template<class TrackCloudType>
void Foam::particle::readFields(TrackCloudType& c)
{
@ -206,7 +140,12 @@ void Foam::particle::correctAfterParallelTransfer
}
else if (isA<nonConformalCyclicPolyPatch>(pp))
{
correctAfterNonConformalCyclicTransfer(td.mesh, td.sendToPatch);
correctAfterNonConformalCyclicTransfer
(
td.mesh,
td.sendToPatch,
td.patchNLocateBoundaryHits
);
}
else
{
@ -447,7 +386,8 @@ bool Foam::particle::hitNonConformalCyclicPatch
correctAfterNonConformalCyclicTransfer
(
td.mesh,
nccpp.nbrPatchID()
nccpp.nbrPatchID(),
td.patchNLocateBoundaryHits
);
return true;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -77,10 +77,11 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
particle(mesh, position, celli)
particle(mesh, position, celli, nLocateBoundaryHits)
{}
//- Construct from Istream

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -266,6 +266,7 @@ public:
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const tensor& Q,
const vector& v,
const vector& a,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -224,6 +224,7 @@ inline Foam::molecule::molecule
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const tensor& Q,
const vector& v,
const vector& a,
@ -236,7 +237,7 @@ inline Foam::molecule::molecule
)
:
particle(mesh, position, celli),
particle(mesh, position, celli, nLocateBoundaryHits),
Q_(Q),
v_(v),
a_(a),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -490,6 +490,8 @@ void Foam::moleculeCloud::initialiseMolecules
<< abort(FatalError);
}
label nLocateBoundaryHits = 0;
forAll(cellZones, z)
{
const cellZone& zone(cellZones[z]);
@ -750,6 +752,7 @@ void Foam::moleculeCloud::initialiseMolecules
(
globalPosition,
cell,
nLocateBoundaryHits,
id,
tethered,
temperature,
@ -830,6 +833,7 @@ void Foam::moleculeCloud::initialiseMolecules
(
globalPosition,
cell,
nLocateBoundaryHits,
id,
tethered,
temperature,
@ -901,6 +905,7 @@ void Foam::moleculeCloud::initialiseMolecules
(
globalPosition,
cell,
nLocateBoundaryHits,
id,
tethered,
temperature,
@ -957,6 +962,15 @@ void Foam::moleculeCloud::initialiseMolecules
}
}
}
reduce(nLocateBoundaryHits, sumOp<label>());
if (nLocateBoundaryHits != 0)
{
WarningInFunction
<< "Initialisation of cloud " << this->name()
<< " did not accurately locate " << nLocateBoundaryHits
<< " particles" << endl;
}
}
@ -964,6 +978,7 @@ void Foam::moleculeCloud::createMolecule
(
const point& position,
label cell,
label& nLocateBoundaryHits,
label id,
bool tethered,
scalar temperature,
@ -1022,6 +1037,7 @@ void Foam::moleculeCloud::createMolecule
mesh_,
position,
cell,
nLocateBoundaryHits,
Q,
v,
Zero,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -111,6 +111,7 @@ class moleculeCloud
(
const point& position,
label cell,
label& nLocateBoundaryHits,
label id,
bool tethered,
scalar temperature,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -229,7 +229,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -83,10 +83,11 @@ inline Foam::CollidingParcel<ParcelType>::CollidingParcel
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
ParcelType(mesh, position, celli),
ParcelType(mesh, position, celli, nLocateBoundaryHits),
f_(Zero),
angularMomentum_(Zero),
torque_(Zero),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -174,7 +174,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,10 +48,11 @@ inline Foam::MPPICParcel<ParcelType>::MPPICParcel
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
ParcelType(mesh, position, celli),
ParcelType(mesh, position, celli, nLocateBoundaryHits),
id_(-1, -1)
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -387,7 +387,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -100,10 +100,11 @@ inline Foam::MomentumParcel<ParcelType>::MomentumParcel
(
const polyMesh& owner,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
ParcelType(owner, position, celli),
ParcelType(owner, position, celli, nLocateBoundaryHits),
moving_(true),
typeId_(-1),
nParticle_(0),

View File

@ -304,7 +304,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream

View File

@ -91,10 +91,11 @@ inline Foam::ReactingMultiphaseParcel<ParcelType>::ReactingMultiphaseParcel
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
ParcelType(mesh, position, celli),
ParcelType(mesh, position, celli, nLocateBoundaryHits),
mass0_(0),
YGas_(0),
YLiquid_(0),

View File

@ -203,7 +203,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream

View File

@ -82,10 +82,11 @@ inline Foam::ReactingParcel<ParcelType>::ReactingParcel
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
ParcelType(mesh, position, celli),
ParcelType(mesh, position, celli, nLocateBoundaryHits),
Y_(0)
{}

View File

@ -208,7 +208,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream

View File

@ -138,10 +138,11 @@ inline Foam::SprayParcel<ParcelType>::SprayParcel
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
ParcelType(mesh, position, celli),
ParcelType(mesh, position, celli, nLocateBoundaryHits),
d0_(this->d()),
mass0_(this->mass()),
position0_(this->position(mesh)),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -324,7 +324,8 @@ public:
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
);
//- Construct from Istream

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -94,10 +94,11 @@ inline Foam::ThermoParcel<ParcelType>::ThermoParcel
(
const polyMesh& mesh,
const vector& position,
const label celli
const label celli,
label& nLocateBoundaryHits
)
:
ParcelType(mesh, position, celli),
ParcelType(mesh, position, celli, nLocateBoundaryHits),
T_(0.0),
Cp_(0.0)
{}

View File

@ -281,7 +281,18 @@ bool Foam::InjectionModel<CloudType>::findCellAtPosition
// Found it. Construct the barycentric coordinates.
if (proci == Pstream::myProcNo())
{
particle p(this->owner().mesh(), pos, celli);
label nLocateBoundaryHits;
particle p(this->owner().mesh(), pos, celli, nLocateBoundaryHits);
if (nLocateBoundaryHits != 0)
{
WarningInFunction
<< "Injection model " << this->modelName()
<< " for cloud " << this->owner().name()
<< " did not accurately locate the position "
<< pos << " within the mesh" << endl;
}
coordinates = p.coordinates();
celli = p.cell();
tetFacei = p.tetFace();

View File

@ -113,6 +113,8 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackCloudType& cloud)
const vectorField& Sf = mesh.Sf().boundaryField()[filmPatchi];
const scalarField& magSf = mesh.magSf().boundaryField()[filmPatchi];
label nLocateBoundaryHits = 0;
if (massParcelPatch_.size())
{
forAll(injectorCellsPatch, j)
@ -131,7 +133,13 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackCloudType& cloud)
// Create a new parcel
parcelType* pPtr =
new parcelType(this->owner().pMesh(), pos, celli);
new parcelType
(
this->owner().pMesh(),
pos,
celli,
nLocateBoundaryHits
);
// Check/set new parcel thermo properties
cloud.setParcelThermoProperties(*pPtr);
@ -156,6 +164,17 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackCloudType& cloud)
}
}
}
reduce(nLocateBoundaryHits, sumOp<label>());
if (nLocateBoundaryHits != 0)
{
WarningInFunction
<< "Injection by surface film model for cloud "
<< this->owner().name()
<< " on patch " << pbm[filmPatchi].name()
<< " did not accurately locate " << nLocateBoundaryHits
<< " particles" << endl;
}
}
}

View File

@ -347,6 +347,8 @@ void Foam::meshRefinement::markFeatureCellLevel
// what to seed. Do this on only the processor that
// holds the insidePoint.
label nLocateBoundaryHits = 0;
forAll(insidePoints, i)
{
const point& insidePoint = insidePoints[i];
@ -395,6 +397,7 @@ void Foam::meshRefinement::markFeatureCellLevel
mesh_,
insidePoint,
celli,
nLocateBoundaryHits,
featureMesh.points()[pointi], // endpos
featureLevel, // level
feati, // featureMesh
@ -438,6 +441,7 @@ void Foam::meshRefinement::markFeatureCellLevel
mesh_,
insidePoint,
celli,
nLocateBoundaryHits,
featureMesh.points()[pointi], // endpos
featureLevel, // level
feati, // featureMesh

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,6 +33,7 @@ Foam::trackedParticle::trackedParticle
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const point& end,
const label level,
const label i,
@ -40,7 +41,7 @@ Foam::trackedParticle::trackedParticle
const label k
)
:
particle(mesh, position, celli),
particle(mesh, position, celli, nLocateBoundaryHits),
start_(this->position(mesh)),
end_(end),
level_(level),

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -127,6 +127,7 @@ public:
const polyMesh& mesh,
const vector& position,
const label celli,
label& nLocateBoundaryHits,
const point& end,
const label level,
const label i,

View File

@ -121,6 +121,7 @@ void Foam::sampledSets::lineFace::calcSamples
// Create each segment in turn
label segmenti = 0;
label nLocateBoundaryHits = 0;
forAll(procCandidateCells, proci)
{
forAll(procCandidateCells[proci], candidatei)
@ -160,6 +161,7 @@ void Foam::sampledSets::lineFace::calcSamples
mesh,
p,
celli,
nLocateBoundaryHits,
0,
i == 0 ? t : 1 - t,
0
@ -206,7 +208,8 @@ void Foam::sampledSets::lineFace::calcSamples
// the tracks
if (proci == Pstream::myProcNo() && i == 0 && storeCells)
{
particle trackBwd(mesh, p, celli), trackFwd(trackBwd);
particle trackBwd(mesh, p, celli, nLocateBoundaryHits);
particle trackFwd(trackBwd);
trackBwd.trackToFace(mesh, start - p, 0);
trackFwd.trackToFace(mesh, end - p, 0);
if (trackBwd.onFace() && trackFwd.onFace())

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,6 +66,7 @@ void Foam::sampledSets::points::calcSamples
// Consider each point
label segmenti = 0, samplei = 0, pointi0 = labelMax, pointi = 0;
label nLocateBoundaryHits = 0;
scalar distance = 0;
while (pointi < points.size())
{
@ -129,6 +130,7 @@ void Foam::sampledSets::points::calcSamples
mesh,
points[pointi],
procAndCelli.second(),
nLocateBoundaryHits,
pointi,
1,
distance

View File

@ -33,12 +33,13 @@ Foam::sampledSetParticle::sampledSetParticle
const polyMesh& mesh,
const point& position,
const label celli,
label& nLocateBoundaryHits,
const label seti,
const scalar setF,
const scalar distance
)
:
particle(mesh, position, celli),
particle(mesh, position, celli, nLocateBoundaryHits),
seti_(seti),
setF_(setF),
distance_(distance),

View File

@ -149,6 +149,7 @@ public:
const polyMesh& mesh,
const point& position,
const label celli,
label& nLocateBoundaryHits,
const label seti,
const scalar setF,
const scalar distance