forall遍历操作慢怎么加快
-
不遍历计算一步大概0.4秒,遍历以后要10秒,网格300w,求大佬们帮帮忙
代码如下volScalarField Lambda ( 2*mag(skew(fvc::grad(this->U_))) ); volScalarField meshd ( 6.283*pow(Cmu_.value()*k*omega,0.5)/pow(Lambda,1.5)/pow(cv,1.0/3.0) ); volScalarField K_1 ( 0.239*pow(Lambda,1.5)*pow(cv,1.0/3.0)/pow(Cmu_.value()*k*omega,0.5) ); volScalarField K_2 ( 0.286*pow(Lambda,1.5)*pow(k,1.5)/pow(Cmu_.value()*k*omega,1.5) ); volScalarField K_3 ( 0.661/pow(Cmu_.value()*k*omega,1.0/3.0)*Lambda*pow(cv,2.0/9.0) ); forAll(meshd, celli) { if (meshd[celli] < 1) { K_ = min ( max((K_1 + 0.75) / (K_2 + 0.75), lo_), u_ ); } else { K_ = min ( max(K_3 / (K_2 + 0.75), lo_), u_ ); } }
-
return neg(Re - 1000)*24*(1.0 + 0.15*pow(Re, 0.687)) + pos0(Re - 1000)*0.44*max(Re, residualRe_);
结合SchillerNaumann阻力模型的公式,你看一下,公式我笔记里面有