粒子求解器如何实现将粒子的性质加和
-
@杨英狄 可以照抄这个原始的cloudfunction 可以类似楼上在forAllIter中生成一个值。
https://github.com/OpenFOAM/OpenFOAM-8/blob/master/src/lagrangian/intermediate/submodels/CloudFunctionObjects/RelativeVelocity/RelativeVelocity.C其实也可以在cloud中直接找Dij这个function,就能生成了
template<class CloudType> inline Foam::scalar Foam::KinematicCloud<CloudType>::Dij ( const label i, const label j ) const { scalar si = 0.0; scalar sj = 0.0; forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) { const parcelType& p = iter(); si += p.nParticle()*pow(p.d(), i); sj += p.nParticle()*pow(p.d(), j); } reduce(si, sumOp<scalar>()); reduce(sj, sumOp<scalar>()); sj = max(sj, vSmall); return si/sj; } template<class CloudType> inline Foam::scalar Foam::KinematicCloud<CloudType>::Dmax() const { scalar d = -great; forAllConstIter(typename KinematicCloud<CloudType>, *this, iter) { const parcelType& p = iter(); d = max(d, p.d()); } reduce(d, maxOp<scalar>()); return max(0.0, d); }
sprayCloud就是如下
template<class CloudType> void Foam::SprayCloud<CloudType>::info() { CloudType::info(); scalar d32 = 1.0e+6*this->Dij(3, 2); scalar d10 = 1.0e+6*this->Dij(1, 0); scalar dMax = 1.0e+6*this->Dmax(); scalar pen = this->penetration(0.95); Info << " D10, D32, Dmax (mu) = " << d10 << ", " << d32 << ", " << dMax << nl << " Liquid penetration 95% mass (m) = " << pen << endl; }