请问Openfoam怎么分别修改输出文件的频率?



  • 比如我在跑颗粒两相流,想实现颗粒场的 U 和 positions 在每100个timestep输出一次,而颗粒场的其他文件和流体场都是每1000个timestep输出一次。

    比如说修改DPMFoam,想请问一下大家相关的代码在哪个文件里,是否可以通过再添加一个变量与 controlDict 里的 writtenInterval 区分开来来实现?



  • 我认为可以输出频率高一点,然后在数据处理的时候再根据需要选择数据不就好了吗?



  • functions
    {
        writeFields // name of the function object
        {
            type writeObjects;
            libs ( "libutilityFunctionObjects.so" );
     
            objects
            (
    	    T U rho // list of fields/variables to be written
            );
     
            // E.g. write every 1e-5 seconds of simulation time only the specified fields
            writeControl runTime;
            writeInterval 1e-5; // write every 1e-5 seconds
        }
    }
    


  • @浪迹天大 ControlDict里面的writeControl和writeInterval似乎会覆盖前面的?

    
    application     twoPhaseEulerFoam;
    
    startFrom       latestTime;
    
    startTime       0;
    
    stopAt          endTime;
    
    endTime         2;
    
    deltaT          1e-4;
    
    writeControl    timeStep;
    
    writeInterval   100;
    
    purgeWrite      0;
    
    writeFormat     ascii;
    
    writePrecision  6;
    
    writeCompression off;
    
    timeFormat      general;
    
    timePrecision   6;
    
    runTimeModifiable on;
    
    adjustTimeStep  no;
    
    maxCo           0.9;
    
    maxDeltaT       1e-04;
    
    functions
    {
        
       volFieldValue1
       {
           type            volFieldValue;
           libs            ("libfieldFunctionObjects.so");
    
           log             true;
           //writeControl    writeTime;
            writeControl    timeStep;  
            writeInterval   1;   //"这里的writeInterval 1 似乎会覆盖前面的100导致所有的输出都是每个时间步都输出?"
           
           writeFields     true;
    
           regionType      all;
           operation       volAverage;
    
           //weightField     alpha1;
    
           fields
           (
               alpha.particles   
               U.air
               U.particles  
               p
               p_rgh
           );
       }
    }
    
    
    

Log in to reply