边界条件tableFile读取错误问题



  • 模拟二维大气边界层流动,入口添加ESDU的对数律剖面时,采用如下方式定义,

    INLET
       {
           type            fixedProfile;
       profile 	tableFile;
    
       profileCoeffs
       {
               nHeaderLine         0;          // Number of header lines
               refColumn           1;          // Reference column index
               componentColumns    (1);    // Component column indices
               separator           " ";        // Optional (defaults to ",")
               mergeSeparators     no;         // Merge multiple separators
               file                "inVelocity.txt";//"inletProfiles/inVelocity.csv";
               outOfBounds         clamp;      // Optional out-of-bounds handling
               interpolationScheme linear;     // Optional interpolation scheme
           }
           direction        (0 1 0);
           origin           0;
        }
    

    运行simpleFoam时,提示如下错误
    7aded185-8189-4194-bfb8-dc1151b16edf-image.png
    inVelocity.txt文件为

    0.899251
    3.78464
    3.88646
    3.96812
    4.03721
    4.09802 
    4.15319
    4.20449
    4.25314
    4.30008 
    4.34601 
    4.39149	 
    4.43702
    4.483
    4.5298
    4.57773
    4.62706
    4.67807 
    4.73099
    4.78608 
    4.84357
    4.90368
    4.96665
    5.03268
    5.10199	 
    5.17476	 
    5.25119	 
    5.33143	 
    5.41563	 
    5.50394	 
    5.59645	 
    5.69327	 
    5.79447	 
    5.90012	 
    6.01023
    

    不知道问题在哪里?还请各位指教



  • 速度应该给矢量?你这是标量



  • @东岳 李老师,我边界条件代码修改后如下:

        INLET
        {
            type            fixedProfile;
    	profile 	tableFile;
    
    	profileCoeffs
    	{
                nHeaderLine         0;          // Number of header lines
                refColumn           0;          // Reference column index
                componentColumns    (1 2 3);    // Component column indices
                separator           ",";        // Optional (defaults to ",")
                mergeSeparators     no;         // Merge multiple separators
                file                "inVelocity.txt";//"inletProfiles/inVelocity.csv";
                outOfBounds         clamp;      // Optional out-of-bounds handling
                interpolationScheme linear;     // Optional interpolation scheme
            }
            direction        (0 1 0);
            origin           0;
         }
    

    同时inVelocity.txt数据按照下面格式给出,但还是有同样的报错信息

    2.31474,0,0
    3.07832,0,0
    3.44144,0,0
    3.64768,0,0
    3.78464,0,0
    3.88646,0,0
    3.96812,0,0
    4.03721,0,0
    4.09802,0,0
    4.15319,0,0
    4.20449,0,0
    4.25314,0,0
    4.30008,0,0
    4.34601,0,0
    4.39149,0,0
    4.43702,0,0
    4.483,0,0
    4.5298,0,0
    


  • 文件位置正确么?



  • @东岳 嗯嗯,是在同一个文件夹0/下的



  • inlet
        {
            type            fixedProfile;
    	profile 	tableFile;
    
    	profileCoeffs
    	{
                //nHeaderLine         0;          // Number of header lines
                //refColumn           0;          // Reference column index
                //componentColumns    (1 2 3);    // Component column indices
                //separator           ",";        // Optional (defaults to ",")
                //mergeSeparators     no;         // Merge multiple separators
                file                "0/inVelocity";//"inletProfiles/inVelocity.csv";
                //outOfBounds         clamp;      // Optional out-of-bounds handling
                //interpolationScheme linear;     // Optional interpolation scheme
            }
            direction        (0 1 0);
            origin           0;
        }
    

    inVelocity

    (
                (0.0 (1 2 3))
                (1.0 (4 5 6))
    )
    

    https://github.com/OpenFOAM/OpenFOAM-3.0.x/blob/master/src/OpenFOAM/primitives/functions/DataEntry/TableFile/TableFile.H

    另外写在csvFile更容易些:

    inlet
        {
            type            fixedProfile;
    	profile 	   csvFile;
    ...
          }
    


  • @东岳 好的,我试一下。谢谢老师~


Log in to reply