Chapter 2 Tutorials

This chapter we describes the process of setup, simulation and post-processing for some OpenFOAM test cases, with the principal aim of introducing a user to the basic procedures of running OpenFOAM. The test cases are taken from the tutorials directory which contains numerous example cases in OpenFOAM. The directory location is represented by the $FOAM_TUTORIALS variable in the OpenFOAM “environment”.

The directory contains numerous cases that demonstrate the use of all the solver modules, other solvers and many utilities supplied with OpenFOAM. Most examples are stored in sub-directories corresponding to each of the modular solvers. For example, the cases that use the incompressibleFluid module are stored in $FOAM_TUTORIALS/incompressibleFluid. The user can explore these example cases, starting by listing the top-level of the $FOAM_TUTORIALS directory, by typing in a terminal


    ls $FOAM_TUTORIALS

The OpenFOAM environment includes a $FOAM_RUN variable which represents a directory in the user’s file system at $HOME/OpenFOAM/<USER>-11/run where <USER> is the account login name and “11” is the OpenFOAM version number. The directory provides a recommended location to store and run simulation cases. The examples presented in this chapter will be copied into the run directory. The user should check whether the directory exists by typing


    ls $FOAM_RUN
If a message is returned saying no such directory exists, the user should create the directory by typing


    mkdir -p $FOAM_RUN

Any example case from $FOAM_TUTORIALS can then be copied into the run directory. For example to try the motorBike example for the incompressibleFluid solver module, the user can copy it to the run directory by typing:


    cd $FOAM_RUN
    cp -r $FOAM_TUTORIALS/incompressibleFluid/motorBike .
OpenFOAM v11 User Guide - Chapter 2 Tutorials
CFD Direct