在collidingCloud中添加一个体积分数的判定,怎么实现?
-
如题目所示,由于不想在高浓度的粒子群中存在碰撞,所以添加了一个体积分数theta的判定。当theta>0.5时,修正粒子速度为0。当theta<=0.5时,正常发生碰撞。下面是添加后的code,编译是通过的,但是出来的结果完全不对。theta的定义是第二个code。希望有经验的朋友帮忙解惑,谢谢拉。
label nSubCycles = collision().nSubCycles(); if (nSubCycles > 1) { Info<< " " << nSubCycles << " move-collide subCycles" << endl; volScalarField::Internal& thetaIn = theta().ref(); forAll(thetaIn, celli) { if( thetaIn[celli] > 0.5 ) //if volume fraction > 0.5, { nonMoveCollide(cloud, td, this->db().time().deltaTValue()); } else { subCycleTime moveCollideSubCycle ( const_cast<Time&>(this->db().time()), nSubCycles ); while(!(++moveCollideSubCycle).end()) { moveCollide(cloud, td, this->db().time().deltaTValue()); } moveCollideSubCycle.endSubCycle(); } } } else { moveCollide(cloud, td, this->db().time().deltaTValue()); } } 这是theta的定义: Foam::CollidingCloud<CloudType>::theta() const { tmp<volScalarField> ttheta ( new volScalarField ( IOobject ( this->name() + ":theta", this->db().time().timeName(), this->db(), IOobject::NO_READ, IOobject::NO_WRITE, false ), mesh_, dimensionedScalar(dimless, Zero), extrapolatedCalculatedFvPatchScalarField::typeName ) ); volScalarField& theta = ttheta.ref(); forAllConstIter(typename CollidingCloud<CloudType>, *this, iter) { const parcelType& p = iter(); const label celli = p.cell(); theta[celli] += p.nParticle()*p.volume(); } theta.primitiveFieldRef() /= mesh_.V(); theta.correctBoundaryConditions(); return ttheta; }