CloudFunctionObjects: ParticleErosion, PatchCollisionDensity: Execute before hitting the face

These functions cannot execute on the 'postPatch' hook because at this
point the particle properties have already been altered by the patch
interaction (i.e., the rebound has occurred and the velocity has
reversed). They need to execute in advance of the patch interaction.
There is no 'prePatch' hook, and implementing one is not
straightforward, so these functions have been changed to use the
'preFace' hook and manually check that the face in question is a
boundary face.

Patch contributed by Timo Niemi, VTT.
This commit is contained in:
Will Bainbridge
2023-09-07 14:52:11 +01:00
parent 046c5b7d83
commit 5e8748c6eb
4 changed files with 16 additions and 16 deletions

View File

@ -161,12 +161,12 @@ void Foam::ParticleErosion<CloudType>::preEvolve()
template<class CloudType>
void Foam::ParticleErosion<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp
)
void Foam::ParticleErosion<CloudType>::preFace(const parcelType& p)
{
const fvMesh& mesh = this->owner().mesh();
if (!p.onBoundaryFace(mesh)) return;
const polyPatch& pp = mesh.boundaryMesh()[p.patch(mesh)];
const label patchi = pp.index();
const label localPatchi = applyToPatch(patchi);

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
@ -169,8 +169,8 @@ public:
//- Pre-evolve hook
virtual void preEvolve();
//- Post-patch hook
virtual void postPatch(const parcelType& p, const polyPatch& pp);
//- Pre-face hook
virtual void preFace(const parcelType& p);
};

View File

@ -280,12 +280,12 @@ void Foam::PatchCollisionDensity<CloudType>::preEvolve()
template<class CloudType>
void Foam::PatchCollisionDensity<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp
)
void Foam::PatchCollisionDensity<CloudType>::preFace(const parcelType& p)
{
const fvMesh& mesh = this->owner().mesh();
if (!p.onBoundaryFace(mesh)) return;
const polyPatch& pp = mesh.boundaryMesh()[p.patch(mesh)];
if (pp.coupled()) return;
const label patchi = pp.index();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -135,8 +135,8 @@ public:
//- Pre-evolve hook
virtual void preEvolve();
//- Post-patch hook
virtual void postPatch(const parcelType& p, const polyPatch& pp);
//- Pre-face hook
virtual void preFace(const parcelType& p);
};