diff --git a/applications/utilities/preProcessing/mapFields/mapLagrangian.C b/applications/utilities/preProcessing/mapFields/mapLagrangian.C index ed529dade8..b6d0902152 100644 --- a/applications/utilities/preProcessing/mapFields/mapLagrangian.C +++ b/applications/utilities/preProcessing/mapFields/mapLagrangian.C @@ -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 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++; diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapClouds.C b/applications/utilities/preProcessing/mapFieldsPar/mapClouds.C index be02531167..bdb9bb882a 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapClouds.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapClouds.C @@ -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 pPtr ( new passiveParticle ( tgtMesh, positions[tgtParticlei], - tgtCells[tgtParticlei] + tgtCells[tgtParticlei], + nLocateBoundaryHits ) ); + + if (nLocateBoundaryHits == 0) + { + tgtCloud.addParticle(pPtr.ptr()); + } } Info<< " mapped " diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.C b/src/functionObjects/field/nearWallFields/findCellParticle.C index 9fba611f9e..5ba9c2c562 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.C +++ b/src/functionObjects/field/nearWallFields/findCellParticle.C @@ -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) {} diff --git a/src/functionObjects/field/nearWallFields/findCellParticle.H b/src/functionObjects/field/nearWallFields/findCellParticle.H index 8b07eff819..5277d45022 100644 --- a/src/functionObjects/field/nearWallFields/findCellParticle.H +++ b/src/functionObjects/field/nearWallFields/findCellParticle.H @@ -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 ); diff --git a/src/functionObjects/field/nearWallFields/nearWallFields.C b/src/functionObjects/field/nearWallFields/nearWallFields.C index 4bb8133730..f5a2add237 100644 --- a/src/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/functionObjects/field/nearWallFields/nearWallFields.C @@ -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 ) diff --git a/src/functionObjects/field/streamlines/streamlines.C b/src/functionObjects/field/streamlines/streamlines.C index 72b5cf06b8..0fc761f5c5 100644 --- a/src/functionObjects/field/streamlines/streamlines.C +++ b/src/functionObjects/field/streamlines/streamlines.C @@ -285,6 +285,7 @@ bool Foam::functionObjects::streamlines::write() cloudName_, IDLList() ); + 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) ) diff --git a/src/functionObjects/field/streamlines/streamlinesParticle.C b/src/functionObjects/field/streamlines/streamlinesParticle.C index 26730d783e..7a01dceaac 100644 --- a/src/functionObjects/field/streamlines/streamlinesParticle.C +++ b/src/functionObjects/field/streamlines/streamlinesParticle.C @@ -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), diff --git a/src/functionObjects/field/streamlines/streamlinesParticle.H b/src/functionObjects/field/streamlines/streamlinesParticle.H index a435dcd7a7..56e4bdee21 100644 --- a/src/functionObjects/field/streamlines/streamlinesParticle.H +++ b/src/functionObjects/field/streamlines/streamlinesParticle.H @@ -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 ); diff --git a/src/lagrangian/DSMC/Make/files b/src/lagrangian/DSMC/Make/files index d02b37d1a7..0dcbd04a51 100644 --- a/src/lagrangian/DSMC/Make/files +++ b/src/lagrangian/DSMC/Make/files @@ -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 diff --git a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C index afbf2c4288..3d35beb48a 100644 --- a/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C +++ b/src/lagrangian/DSMC/clouds/Templates/DSMCCloud/DSMCCloud.C @@ -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::initialise numberDensities /= nParticle_; + label nLocateBoundaryHits = 0; + forAll(mesh_.cells(), celli) { List cellTets = polyMeshTetDecomposition::cellTetIndices @@ -174,12 +176,21 @@ void Foam::DSMCCloud::initialise U += velocity; - addNewParcel(p, celli, U, Ei, typeId); + addNewParcel(p, celli, nLocateBoundaryHits, U, Ei, typeId); } } } } + reduce(nLocateBoundaryHits, sumOp