BHL Notes

MY LEARNING TRAJECTORY

0%

OpenFOAM: Extracting Numerical Data From Case

Run-time data processing

When we want to process data during a simulation, they need to configure the case accordingly. The two possible configuration processes are shown as follows, using an example of monitoring flow rate at an outlet patch named outlet.

Method 1:

Firstly, we should include the flowRatePatch function in functions sub-dictionary in the case controlDict file, using the #includeFunc directive as follow.

functions 
{ 
    #includeFunc  flowRatePatch 
    //...  other function objects here ...//  
}

This configuration process will include the functionality in the flowRatePatch configuration file, located in the directory hierarchy beginning with $FOAM_ETC/caseDicts/postProcessing.

The configuration of flowRatePatch requires the name of the patch to be supplied. To do this, we copy the flowRatePatch file into their case system directory. The foamGet script can copy the file conveniently, e.g.

foamGet flowRatePatch

Now, we have a flowRatePatch file in the local case system directory. The patch name can be edited in this copied file to be outlet. The solver will get an included function in the local case system directory, in precedence over the function in $FOAM_ETC/caseDicts/postProcessing.

During the simulation, the flow rate through the patch outlet will be calculated and written out into a file within a directory named postProcessing under the case directory.

Method 2:

In this configuration process, we introduce another way to supply the name of the patch. Patch name can be easily specified by giving an argument to the flowRatePatch in the #includeFunc directive.

functions 
{ 
    #includeFunc  flowRatePatch(name=outlet) 
    //...  other function objects here ...//  
}

Some functions require the setting of many parameters, e.g. forces, forceCoeffs, surfaces, etc. For those functions, it is more reliable and convenient to copy and configure the function using method 1 rather than through arguments (method 2).


Post-processing of data