OpenFOAM中的binaryblock如何读取?



  • 各位大哥,我下载网上的tutorial到自己电脑上运行的时候,会出现下面的错误:

    --> FOAM FATAL IO ERROR: 
    Expected a ')' while reading binaryBlock, found on line 20 the word '�R'
    file: /home/Desktop/libAcoustics/Tutorials-4.1/monopole3D/constant/polyMesh/faces at line 20.
        From function Foam::Istream& Foam::Istream::readEnd(const char*)
        in file db/IOstreams/IOstreams/Istream.C at line 109.
    FOAM exiting
    

    错误出现在读取网格的时候,具体的网格形式是如下的.gz格式,我有用gzip -d *.gz把它们都解压,然后将controlDict中的writeformat改为了binary,但是结果还是出现上面的问题。:zoule: :zoule:
    d6a6ea60-b4b7-4358-b71d-af8f25f1e3f8-image.png



  • 我用notepad打开解压后的faces,发现就是从第20行的第一个“(”就开始报错了。
    92f40010-3acb-4e8e-b9c6-f23a1d86008f-image.png



  • 下面是我的controlDict文件,不知道读取网格的时候应该怎么设置读取binary格式?

    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  3.0.0                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        location    "system";
        object      controlDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    application     rhoPimpleFoam;
    
    startFrom       startTime; //latestTime;
    
    startTime       0;
    
    stopAt          endTime;
    
    endTime         0.1;
    
    deltaT          2.5e-6;
    
    writeControl    adjustableRunTime;
    
    writeInterval   5e-3;
    
    purgeWrite      200;
    
    writeFormat     binary; // ascii;
    
    writePrecision  9;
    
    writeCompression compressed;
    
    timeFormat      general;
    
    timePrecision   6;
    
    runTimeModifiable true;
    
    adjustTimeStep  false;
    
    maxCo           0.5;
    
    maxDeltaT       1e-5;
    
    functions
    {
           #include "probeControl"
           #include "fwhControl"
           #include "sphereAverage"
           #include "soundPressureSampling"
    }
    
    // ************************************************************************* //
    


  • --> FOAM FATAL IO ERROR: 
    Expected a ')' while reading binaryBlock, found on line 20 the word '�R'
    file: /home/Desktop/libAcoustics/Tutorials-4.1/monopole3D/constant/polyMesh/faces at line 20.
        From function Foam::Istream& Foam::Istream::readEnd(const char*)
        in file db/IOstreams/IOstreams/Istream.C at line 109.
    FOAM exiting
    

    做什么出现的这种错误?



  • @东岳 您好!我从网上下载了一个俄罗斯人的例子,他们用的网格是二进制格式,我在读取网格的时候就出现了这个错误。不知道是不是我的centos7系统缺少某些打开binary的库,还是openfoam里面需要进行格式转换,或者是设置读取格式。:mianmo:



  • 可能你的操作系统位数和别人不一样。
    试下装一个和你目前系统位数不一样的虚拟机(或者用超算、别人的电脑)
    然后把case搬到这台机器上,在controlDict 里面writeFormat 改成 ascii,终端键入foamFormatConvert看看能不能转换



  • @Jacobian 换了操作系统貌似可以啦


Log in to reply