From c1b07cd103e3059149c6b0d34809feb6619c1b08 Mon Sep 17 00:00:00 2001 From: sergio <s.ferraris@opencfd.co.uk> Date: Mon, 16 Dec 2019 14:54:10 -0800 Subject: [PATCH] BUG: post-processing of parcels on patch interaction models Adding check for p.active at the end of KinematicParcel::move. p.hitFace() is called only for active parcels. Setting to zero the initialization for stored lists of stick and escape parcels in LocalInteraction and StandardWallInteraction models NOTE: KinematicParcel::hitPatch counts overall system escaped parcels and mass based on polyPatch type and not on type of patchInteractionModel. Thus, if a patch is a Wall for fluid but escape for parcel the overall report will be wrong but the local report for each patch is correct --- .../KinematicParcel/KinematicParcel.C | 7 ++++-- .../KinematicParcel/KinematicParcelI.H | 2 +- .../LocalInteraction/LocalInteraction.C | 22 +++++++++++++------ .../StandardWallInteraction.C | 21 ++++++++++++------ 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index caa6c6a431a..dc1e1f077e3 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -353,14 +353,14 @@ bool Foam::KinematicParcel<ParcelType>::move p.age() += dt; - if (p.onFace()) + if (p.active() && p.onFace()) { cloud.functions().postFace(p, ttd.keepParticle); } cloud.functions().postMove(p, dt, start, ttd.keepParticle); - if (p.onFace() && ttd.keepParticle) + if (p.active() && p.onFace() && ttd.keepParticle) { p.hitFace(s, cloud, ttd); } @@ -399,6 +399,9 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch } else { + // This does not take into account the wall interation model + // Just the polyPatch type. Then, a patch type which has 'rebound' + // interation model will count as escaped parcel while it is not if (!isA<wallPolyPatch>(pp) && !polyPatch::constraintType(pp.type())) { cloud.patchInteraction().addToEscapedParcels(nParticle_*mass()); diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H index cab17295c39..439c509d1f1 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H @@ -470,7 +470,7 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::Eo ) { const vector dir = U/max(mag(U), ROOTVSMALL); - return mag(g & dir)*(rho - rhoc)*sqr(d)/max(sigma, ROOTVSMALL); + return mag(g & dir)*mag(rho - rhoc)*sqr(d)/max(sigma, ROOTVSMALL); } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 99cdf18c34f..2daf570d2e0 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -334,16 +334,24 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os) PatchInteractionModel<CloudType>::info(os); // retrieve any stored data - labelListList npe0(nEscape_); - this->getModelProperty("nEscape", npe0); + labelListList npe0(patchData_.size()); + labelListList mpe0(patchData_.size()); + labelListList nps0(patchData_.size()); + labelListList mps0(patchData_.size()); + + forAll(patchData_, patchi) + { + label lsd = nEscape_[patchi].size(); + npe0[patchi].setSize(lsd, Zero); + mpe0[patchi].setSize(lsd, Zero); + nps0[patchi].setSize(lsd, Zero); + mps0[patchi].setSize(lsd, Zero); + } - scalarListList mpe0(massEscape_); + + this->getModelProperty("nEscape", npe0); this->getModelProperty("massEscape", mpe0); - - labelListList nps0(nStick_); this->getModelProperty("nStick", nps0); - - scalarListList mps0(massStick_); this->getModelProperty("massStick", mps0); // accumulate current data diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C index efff7013ad0..8df1002ebbb 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/StandardWallInteraction/StandardWallInteraction.C @@ -248,16 +248,23 @@ void Foam::StandardWallInteraction<CloudType>::info(Ostream& os) { PatchInteractionModel<CloudType>::info(os); - labelListList npe0(nEscape_); + labelListList npe0(nEscape_.size()); + labelListList mpe0(nEscape_.size()); + labelListList nps0(nEscape_.size()); + labelListList mps0(nEscape_.size()); + + forAll(nEscape_, patchi) + { + label lsd = nEscape_[patchi].size(); + npe0[patchi].setSize(lsd, Zero); + mpe0[patchi].setSize(lsd, Zero); + nps0[patchi].setSize(lsd, Zero); + mps0[patchi].setSize(lsd, Zero); + } + this->getModelProperty("nEscape", npe0); - - scalarListList mpe0(massEscape_); this->getModelProperty("massEscape", mpe0); - - labelListList nps0(nStick_); this->getModelProperty("nStick", nps0); - - scalarListList mps0(massStick_); this->getModelProperty("massStick", mps0); // Accumulate current data -- GitLab