diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H index d0689b0eb1..86fdc7ba51 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H @@ -245,6 +245,15 @@ template List initListList(const T[nRows][nColumns]); +//- Helper class for list to append y onto the end of x +template +class ListAppendEqOp +{ +public: + void operator()(List& x, const List& y) const; +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C index be6337a428..49daa408c1 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C @@ -684,4 +684,26 @@ Foam::List Foam::initListList(const T elems[nRows][nColumns]) } +template +void Foam::ListAppendEqOp::operator()(List& x, const List& y) const +{ + if (y.size()) + { + if (x.size()) + { + label sz = x.size(); + x.setSize(sz + y.size()); + forAll(y, i) + { + x[sz++] = y[i]; + } + } + else + { + x = y; + } + } +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/ops/ops.H b/src/OpenFOAM/primitives/ops/ops.H index 66d7930849..cab91fcfb5 100644 --- a/src/OpenFOAM/primitives/ops/ops.H +++ b/src/OpenFOAM/primitives/ops/ops.H @@ -90,40 +90,68 @@ EqOp(nopEq, (void)x) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define Op(opName, op) \ - \ -template \ -class opName##Op3 \ -{ \ -public: \ - \ - T operator()(const T1& x, const T2& y) const \ - { \ - return op; \ - } \ -}; \ - \ -template \ -class opName##Op2 \ -{ \ -public: \ - \ - T1 operator()(const T1& x, const T2& y) const \ - { \ - return op; \ - } \ -}; \ - \ -template \ -class opName##Op \ -{ \ -public: \ - \ - T operator()(const T& x, const T& y) const \ - { \ - return op; \ - } \ -}; +#define Op(opName, op) \ + \ + template \ + class opName##Op3 \ + { \ + public: \ + \ + T operator()(const T1& x, const T2& y) const \ + { \ + return op; \ + } \ + }; \ + \ + template \ + class opName##Op2 \ + { \ + public: \ + \ + T1 operator()(const T1& x, const T2& y) const \ + { \ + return op; \ + } \ + }; \ + \ + template \ + class opName##Op \ + { \ + public: \ + \ + T operator()(const T& x, const T& y) const \ + { \ + return op; \ + } \ + }; + + +#define weightedOp(opName, op) \ + \ + template \ + class opName##WeightedOp \ + { \ + const CombineOp& cop_; \ + \ + public: \ + \ + opName##WeightedOp(const CombineOp& cop) \ + : \ + cop_(cop) \ + {} \ + \ + void operator() \ + ( \ + Type& x, \ + const label index, \ + const Type& y, \ + const scalar weight \ + ) const \ + { \ + cop_(x, op); \ + } \ + }; \ + Op(sum, x + y) @@ -147,6 +175,8 @@ Op(lessEq, x <= y) Op(greater, x > y) Op(greaterEq, x >= y) +weightedOp(multiply, weight * y) + #undef Op diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C index 27a050a3d5..bf418468bd 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C @@ -344,11 +344,13 @@ void Foam::SprayCloud::motion(TrackData& td) i++; } - // remove coalesced particles (diameter set to 0) + // remove coalesced parcels that fall below minimum mass threshold forAllIter(typename SprayCloud, *this, iter) { parcelType& p = iter(); - if (p.mass() < VSMALL) + scalar mass = p.nParticle()*p.mass(); + + if (mass < td.cloud().constProps().minParticleMass()) { this->deleteParticle(p); } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 1f9f4c66ec..fc60cd2fbb 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -27,63 +27,6 @@ License #include "meshTools.H" #include "mapDistribute.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - //- Helper class for list - template - class ListPlusEqOp - { - public: - void operator()(List& x, const List y) const - { - if (y.size()) - { - if (x.size()) - { - label sz = x.size(); - x.setSize(sz + y.size()); - forAll(y, i) - { - x[sz++] = y[i]; - } - } - else - { - x = y; - } - } - } - }; - - //- Combine operator for interpolateToSource/Target - template - class combineBinaryOp - { - const CombineOp& cop_; - - public: - - combineBinaryOp(const CombineOp& cop) - : - cop_(cop) - {} - - void operator() - ( - Type& x, - const label faceI, - const Type& y, - const scalar weight - ) const - { - cop_(x, weight*y); - } - }; -} - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template @@ -1550,7 +1493,7 @@ void Foam::AMIInterpolation::update } // send data back to originating procs. Note that contributions - // from different processors get added (ListPlusEqOp) + // from different processors get added (ListAppendEqOp) mapDistribute::distribute ( @@ -1560,7 +1503,7 @@ void Foam::AMIInterpolation::update map.constructMap(), map.subMap(), tgtAddress_, - ListPlusEqOp