编译新的湍流模型遇到no match for ‘operator<’



  • 我在编译一个新湍流模型,遇到了以下报错问题:

    no match for ‘operator<’ (operand types are ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ and ‘int’)
         if (p2 < 0) 
    

    源代码为:

    tmp<volScalarField> KEF::fMu2() const
    {
        const tmp<volTensorField> tgradU = fvc::grad(U_);
        const volTensorField& gradU = tgradU();
        volSymmTensorField sij(symm(gradU));
        volTensorField wij(skew(gradU));
        
        volScalarField Sij(mag(sij)*k_/epsilon_);//Sij*
        volScalarField Wij(mag(wij)*k_/epsilon_);//Wij*
        
        volScalarField S(sqrt(2*Sij*Sij));//S*
        volScalarField W(sqrt(2*Wij*Wij));//W*
    
        volScalarField Eta(fw_*S);//η
        volScalarField Kce(fw_*W);//ξ
     
        volScalarField As = sqr(alpha3_)*sqr(Kce) - sqr(alpha2_)*sqr(Eta)/3;
        volScalarField p1 = C0_*(C0_*C0_/27-(As+alpha1_*Eta*Eta)/6+0.5);
        volScalarField p2 = p1*p1 - (C0_*C0_/9-(As+alpha1_*Eta*Eta)/3);
        volScalarField g(As);
        if (p2 < 0) 
        {
    	g = C0_/3+2*pow(p1*p1-p2), 1/6)+cos(1/3*acos(p1/(sqrt(p1*p1-p2))));//p1,p2的类型导致错误
        }
        else 
        {
    	g = C0_/3+pow(p1+pow(p2, 0.5), 1/3)+sign(p1-pow(p2, 0.5))*pow(mag(p1-pow(p2, 0.5)), 1/3);
        }
    
        volScalarField fMu2_ = 5*(1+g)/(g*g+Cmu_*g*g*g+As);
    
        return fMu2_;
    }
    

    请问李老师和各位同学,这个地方应该怎么处理呢?找了很多源码,没有发现类似的问题,求解答!谢谢各位啦:xiexie:



  • @东岳 李老师,求指点:xinxin3:



  • p2是一个volScalarField,不能写if (p2 < 0)



  • @东岳 是的李老师,p2是一个体标量场,0是整型,那这个地方应该怎么处理呢,求指点


Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2