Getting started with OpenFOAM

Some notes before we start …

OpenFOAM is an open-source CFD (computational fluid dynamics) toolbox, which you can use on your GNU/Linux machine. To get started with OpenFOAM you can read the documentation on the website and/or run tutorial cases. For every solver there are several tutorial cases which you can run on your PC. However you probably need to know more to set up your own simulations. First of all some general information on CFD. Every Simulation consists of several steps, you have to go through, before you can view your results. These steps are:

  • Preprocessing
  • Solving
  • Postprocessing

Preprocessing includes building the CAD geometry and deciding on the boundary conditions (BC’s). It means that the CAD geometry will be meshed, which means the surface of the CAD geometry will be used to create an underlying grid, representing your original geometry features. On this grid/mesh the solver calculates the values for the several transport equations (mass, motion and energy). This is meant by the term solving. With the mesh the equations of motion, energy and mass are solved on each grid point. Meaning the more grid points one has (a finer the mesh) the longer it takes to solve the simulation, but also a finer mesh may result in a more accurate solution. Problem is: An accurate solution depends on your mesh (quality and size), algorithms, included simplifications (make your case solvable but inaccurate because you just can’t account for everything).

One example of such a simplification is turbulence. This is a really complex physical process where eddies (velocity fluctuations) of any size occur in a flow field. The physics behind it are not yet fully understood and therefor mathematical models are necessary to simplify this process. Since these eddies range from really small (microscopic) to really large (macroscopic) the requirements on the mesh are extreme to simulate very tiny eddies (DNS – Direct Numerical Simulation). One can account only a range of eddies by applying a filter (LES – Large Eddy Simulation). It is also possible, since turbulence is a highly transient process, to average over time (RANS – Reynolds Averaged Navier Stokes) and therefor reduce the equation of motion by several unknowns, the velocity fluctuations. But enough from turbulence … for now :)

After the solving of the problem you get values for p, U, T (depending on the solver) …

p: Pressure
U: Velocity
T: Temperature

on every grid point. In Postprocessing these values can now be plotted as scalar fields (p, T) or vector fields (U). For postprocessing the tool “paraFoam” (which is Paraview) is included in every OpenFOAM installation. It lets you process the data from the time folders (0, 5, 10 etc.) very easily. Contour plots, surface plots of scalar or vector fields, vector plots (glyphs), slices … you name it. Many filters will help you sort your data, clip and modify data.

There are 3 default folders in every case folder:

  • 0/
  • constant/
  • system/

The folder “0” includes all boundary conditions or initial conditions for your simulation. In “constant” are the properties of the fluids, solids, porous media stored as well as the value of the gravitational vector “g”. Inside this folder you’ll find another folder “polyMesh” which includes the data of your mesh (points, faces etc.). In “system” the properties of the solution algorithms (fvSolution, fvSchemes) and properties of the simulation are stored in the “controlDict”.

Creating a mesh with blockMesh

(to be continued)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s