After the simulation has finished, you can do simple calculation, such as addition and subtraction, with the field data using foamCalc utility. The source code is located in the following directories:
- applications/utilities/postProcessing/foamCalc
- src/postProcessing/foamCalcFunctions.
components |
$ foamCalc components U -latestTime
This example is to generate three component files Ux, Uy and Uz (volScalarField) from volVectorField U only at the latest time directory.
mag |
$ foamCalc mag U
This example is to generate velocity magnitude field \(|\boldsymbol{U}|\) file magU at every existing time directory.
magSqr |
$ foamCalc magSqr U
This example is to generate magnitude squared field \(|\boldsymbol{U}|^2\) file magSqrU at every existing time directory.
addSubtract |
$ foamCalc addSubtract T subtract -value 273.15 -resultName Tdeg -time 5000
This example is to convert the temperature unit from Kelvin to degrees at time 5000. The generated file name can be specified using –resultName option.
div |
$ foamCalc div phi
This example is to calculate the divergence of the flux field phi for the estimation of the continuity error of each cell for incompressible flow.
interpolate |
$ foamCalc interpolate T -latestTime
This example it to generate surfaceScalarField interpolateT from volScalarField T using the interpolation scheme specified in the system/fvSchemes file.