# Postprocessing with foamCalc utility

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.

## Author: fumiya

CFD engineer in Japan

## 2 thoughts on “Postprocessing with foamCalc utility”

1. Hi fumiya, I see you do some aeroacoustic simulations, too. Do you have an idea how to postprocess the time derivative of the pressure to better visualize the sound waves? I guess it is currently not possible via the standard postProcess utility…

1. fumiya says:

Hi,

Thank you for your useful question!
You can use coded function object to calculate and write time-derivative of pressure field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.