OpenFoam张量取值运算



  • 我的部分代码是这样的

            volTensorField gradU("gradU", fvc::grad(U));
            scalarField parU1 = gradU.xz();
            scalarField parU2 = gradU.zz(); 
    

    我想取速度梯度中的某两个量,可是出现了这样的错误

    TEqn.H:4:35: error: ‘Foam::volTensorField {aka class Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>}’ has no member named ‘xz’
             scalarField parU1 = gradU.xz();
                                       ^
    TEqn.H:5:35: error: ‘Foam::volTensorField {aka class Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>}’ has no member named ‘zz’
             scalarField parU2 = gradU.zz(); 
                                       ^
    

    大神们帮我看看这是为什么呢?该怎么改呢?



  • xz()只能用于tensor,但是你的gradUvolTensorField,因此只能用于处理gradU[celli].xy()



  • @李东岳 那我该怎么提取速度梯度中的量呢?

    gradU.component(tensor::ZX)
    

    这样对吗?


登录后回复
 

与 CFD中文网 的连接断开,我们正在尝试重连,请耐心等待