1

Previous: Instant convergence monitoring during Up: Gnuplot – convergence monitoring Next: Aerodynamic coefficients and

This is an automatically generated documentation by LaTeX2HTML utility. In case of any issue, please, contact us at info@cfdsupport.com.

44 Instant convergence monitoring during computation

  • Convergence can be watched instantly using small script for Gnuplot

     

  • Suitable for immediate convergence watching

     

  • Create new bash script e.g. writeResiduals.sh:

     

    #!/bin/sh
    
    cat log.simpleFoam | grep Ux | cut -d' ' -f9 | tr -d ',' >  residualsUx.dat
    cat log.simpleFoam | grep Uy | cut -d' ' -f9 | tr -d ',' >  residualsUy.dat
    cat log.simpleFoam | grep Uz | cut -d' ' -f9 | tr -d ',' >  residualsUz.dat
    

     

  • Cygwin therefore OpenFOAM for Windows supports only files in Unix format (i.e. with \n for newlines as opposed to the DOS/Windows \r \n newline). If there is a problem with running script writeResiduals.sh add following line into your script just after the #! line

     

    (set -o igncr) 2>/dev/null && set -o igncr; # this comment is required
    

     

  • Create new file e.g. residuals.gp:

     

    # Gnuplot script file for plotting data from file "log"
    set title "Convergence process"
    set xlabel "Iterations"
    set ylabel "Reziduals"
    set logscale y
    
    plot 'residualsUx.dat' title 'u', \
         'residualsUy.dat' title 'v', \
         'residualsUz.dat' title 'w' 
    pause mouse
    

     

  • Run writeResiduals.sh, which creates data files with residuals
    # bash writeResiduals.sh

     

  • Run residuals.gp, by opening the script file in gnuplot program
openfoam tutorial motor bike residuals 1

Figure: OpenFOAM tutorial motor bike. Velocity residuals during computation.