twoPhaseMixture类中添加muf()函数报错求助



  • 求助大佬,为了在compressibleInterFoam求解器中添加有效粘度muEff

    surfaceScalarField muEff
        (
            "muEff",
             mixture.muf()      
          + fvc::interpolate(rho*turbulence->nut())
        );
    

    需要定义muf()函数,mixture是twoPhaseMixtureThermo类型,在对应的H文件和C文件进行更改

    virtual tmp<surfaceScalarField> muf() const;     //muf()声明
    Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixtureThermo::muf() const   //muf()定义
    {
        const surfaceScalarField alpha1f     
        (
            min(max(fvc::interpolate(alpha1_), scalar(0)), scalar(1))
            
        );
    
        return tmp<surfaceScalarField>    
        (
            new surfaceScalarField   
            (
                "muf",
                alpha1f*(thermo1_->rho())*fvc::interpolate(nuModel1_->nu())          
              + (scalar(1) - alpha1f)*(thermo2_->rho())*fvc::interpolate(nuModel2_->nu())
            )
        );
    }
    

    编译时主要报这些错误:135: 该如何解决?为什么类似的代码在incompressibleTwoPhaseMixture中可以编译?

    /home/dell/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/GeometricField.H:99:40: error: invalid use of incomplete type ‘class Foam::surfaceMesh’
             typedef typename GeoMesh::Mesh Mesh;
    /home/dell/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/GeometricField.H:103:48: error: invalid use of incomplete type ‘class Foam::surfaceMesh’
             typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
    twoPhaseMixtureThermo.C:83:17: error: ‘fvc’ has not been declared
             min(max(fvc::interpolate(alpha1_), scalar(0)), scalar(1))
    


  • 是没添加fvc的头文件吗?



  • 感谢回答,尝试添加了fvc.H, 只报错以下内容

    /home/dell/OpenFOAM/OpenFOAM-4.x/src/finiteVolume/lnInclude/cyclicAMIFvPatch.H:39:10: fatal error: cyclicAMILduInterface.H: 没有那个文件或目录
     #include "cyclicAMILduInterface.H"
              ^~~~~~~~~~~~~~~~~~~~~~~~~
    

    不懂在哪里用到了cyclicAMILduInterface.H,先不管,它在src/meshTools路径下,在options里面添加路径,但是编译后又回到了一开始的报错:143:

    twoPhaseMixtureThermo.C:94:9: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>::GeometricField(const char [4], Foam::tmp<Foam::Field<double> >)’
             )
    

Log in to reply
 


CFD中文网 | 东岳流体学术 | 东岳流体商业 | 吉ICP备20003622号-1