关于网格内particle的平均速度求解
-
大家好,如题,想要得到网格内的平均速度。我编写的是类似这样的,但是得到的不是网格内的平均速度,麻烦有经验的朋友给更正一下,谢谢。
forAllIter(typename CloudType, this->owner(), iter) { typename CloudType::parcelType& p = iter(); const label cellI = p.cell(); const fvMesh& mesh = this->owner().mesh(); // average velocity of the lagrangian particle [m/s] volVectorField particleAverageVelocity ( IOobject ( "particleAverageVelocity", this->owner().db().time().timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedVector("zero", dimVelocity*dimMass/dimMass, vector::zero) ); forAll(particleAverageVelocity,i) { particleAverageVelocity[i] +=p.nParticle()*p.mass()*p.U(); } massTotal_ += p.nParticle()*p.mass(); p.U() =(particleAverageVelocity[cellI] * (1.0/massTotal_)); }