OpenFOAM Cheatsheet

Fast post-processing

  • create an empty file called foam.foam in the analysis folder
  • open the latest Paraview on your machine and open the foam.foam; hit apply
  • post-process

Running in parallel

  • decide how many processor you want to use:
  • the dictionary decomposeParDict must be located in the folde system; use the method simple; the product of simpleCoeffs must give the number of processors
  • type decomposePar in the terminal to decompose the mesh
  • type mpirun -np N solver to run the analysis
  • type reconstructPar in the terminal to put together the solution
  • post-process

Plotting residuals

  • type solver >output in the terminal to save all the output into a log file
  • create a file called residuals in the analysis folder containing the following:

    set logscale y

    set title "Residuals"
    set ylabel 'Residual'
    set xlabel 'TimeStep'
    plot "< cat log | grep 'Solving for Ux' | cut -d' ' -f9 | tr -d ','" title 'Ux' with lines, "< cat log | grep 'Solving for Uy' | cut -d' ' -f9 | tr -d ','" title 'Uy' with lines, "< cat log | grep 'Solving for p' | cut -d' ' -f9 | tr -d ','" title 'p' with lines
    pause 1
    reread

  • type gnuplot residuals in the terminal