Tag/tag.png

Style Cleanup Required
This article does not follow the style standards in the Wiki Guide. More info...

How to install OpenFOAM CFD software

The information below is out of date as of June 2010 since deb packs of OpenFOAM are being produced by OpenCFD (the producers of OpenFOAM) for Ubuntu Linux. To install OpenFOAM on ubuntu, go to http://www.openfoam.com/download/ubuntu.php

Introduction

This is aimed to all Engineers, Scientist, Students interested in learning/applying/experimenting Computational Fluids Dynamics (CFD), CFD uses numerical approximation to the partial differential equations that govern flow of fluids in nature (i.e. Navier-Stokes equation, etc) the solution of the Navier-Stokes equation once it comply with the requirements of the Continuity equation gives the behavior of the fluids subject to the given boundary and initial conditions. This has a tremendous importance since practically any fluid can be simulated/modelled in a computer before doing any 'real life' experiment. For example you can test the design of a new aircraft using computational techniques before even build a small scale prototype for wind tunnel testing. Thus a wide range of experimental conditions can be fully tested and corrected on the fly... Since the basic equations (full) that govern fluid flow are in form of PDEs, the numerical methods to approximate the solution are complex, a very simple problem can be solved in a couple of minutes however if the problem is much more complicated the solver can take days in find a solution... in general CFD is not intended for common PCs but for high end computers designed to tackle this kind of problems. Of course this cannot stop you, you can install this software in your computer and 'play' with simple geometries and doing a lot of assumptions to solve a given problem more easily. There are several CFD brands out there like Fluent, COMSOL, CFD-RC, CFD-ADAPCO, (which are quite expensive though) ... however there are also free alternatives like ELMER Multiphysics, OpenFOAM and many others. Inherently CFD software is a bit complicated to use, it requires a deep understanding of the physical phenomena involved in given problem, and a good mathematical background.

Installer Script

An automatic script to install OpenFOAM-1.6.x from the official git repository is disponible at:

This script is done by Fábio C. Canesin and Bruno Santos from cfd-online forum.

The script is reported to work with sucess in:

  • Hardy Heron 8.04 LTS
  • Intrepid Ibex 8.10
  • Jaunty Jackalope 9.04
  • Karmic Koala 9.10
  • Lucid Lynx 10.04 LTS - Beta1

PS: For both i386 and x86-64 versions of both OpenFOAM as Ubuntu.

Manual Install

AMD64 Systems

If you are installing this on an AMD64 system, it is necessary to set the parameter $WM_64 to "on". To achieve this, do the following in a terminal:

gedit ~/OpenFOAM/OpenFOAM-1.3/.bashrc

Then, I added directly above the Java section, the following:

# 64 Bit Machine set to on else set to blank
WM_64="on"

After doing so you must source your bashrc to make sure the changes take effect.

. ~/.bashrc

N.B. it is . space ~/...

System requirements

(based on the specs of the PC tested for the installation)

  • AMD Athlon XP LV 1500+ (or equivalent or higher or better or Intel or PowerPC)
  • 640 MB (The web page states nothing, but everybody knows the more, the better)
  • 1 GB hard drive available, this is a must, uncompressed files takes 750 MB, plus the cases, tutorials, grids, etc
  • Broadband conection (the compressed files are from 50 to 100 MB average) of course you can use dial up and wait 48 hours to download it, it's up to you...
  • Ubuntu LINUX 5.10 Breeze Badger Kernel version 2.6.12-9-386, if you download the AMD64 version then use the 64bit LINUX kernel
  • Not tested on kernel versions above or below (you should try to do this if this is not yor kernel version)
  • Not sure if this would work on other LINUX distributions

Step by step instructions

1 * Check system requirements (listed above)

2 * Enter to OpenFOAM web page

or

3 * Click on download 4 * Select your version 5 * Dowload all the packges to your Desktop (very advance LINUX users can avoid obvious steps)

~/Desktop

where ~/ is the home folder for example /home/<username>

N.B from this point it is necesary to remenber that LINUX is CASE SENSITIVE, a mistake can delay you some hours...

second I did install everything in my home folder which is ~/ it is the recommended option from the web site

6 * create a folder caller OpenFOAM in ~/ using mkdir

copy

  • OpenFOAM-1.3.General.gtgz
  • OpenFOAM-1.3.linuxGcc4DPOpt.gtgz
  • OpenFOAM-1.3.linuxGcc4SPOpt.gtgz

which are on ~/Desktop to the folder you've just created ~/OpenFOAM

7 * create the following folder using mkdir (remember LINUX is case sensitive)

~/OpenFOAM/linux

8 * copy

  • gcc-4.1.0.linux.tgz
  • paraview-2.4.2.linux.tgz
  • j2sdk1.4.2_05.linux.tgz
  • which are in ~/Desktop to ~/OpenFOAM/linux

9 * untar avery single file in the following order

  • OpenFOAM-1.3.General.gtgz
  • OpenFOAM-1.3.linuxGcc4DPOpt.gtgz
  • OpenFOAM-1.3.linuxGcc4SPOpt.gtgz
  • gcc-4.1.0.linux.tgz
  • paraview-2.4.2.linux.tgz
  • j2sdk1.4.2_05.linux.tgz

typing

tar -xzvf <filename>

This takes a bit of time

10 * after finishing you will see new directories created in ~/OpenFOAM

11 * now look for foamSystemCheck which is located at

~/OpenFOAM/OpenFOAM-1.3/bin

this is a shell script that we have to execute, however we need to change it to an executable format

type

chmod -v 555 foamSystemCheck

press enter, then type

["export PATH=$PATH:~/OpenFOAM/OpenFOAM-1.3/bin/"]

press enter, then type

foamSystemCheck

press enter

At this time, the shell script will call some functions to check if your system comply with the minimum requirements for the installation, Host, username, Linux version, and Network conectivity, however at the end of the process some error occur, just ignore any warning or fatal error about ssh or rsh, this is not needed for the stand alone installation (It doesn't matter what it tells you, just ignore it!!!)

type

chmod -v 755 foamSystemCheck

press enter

12 * * * * * * Now you have to set the environment variables for a correct file access, the environment variable settings are stored in

~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3

since I am using the default options in UBUNTU, my shell is BASH and my text editor is gedit, you can use VIM as well

type

echo $SHELL

(if you are not sure which shell you are using and edit the following files according to your shell syntax)

now type

gedit ~/.bashrc &

once in gedit type

. ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc

N.B. it is 'dot', space~/....... select file>save and then file>quit

now update the environment typing

. ~/.bashrc

N.B. it is 'dot', space ~/.......

the environment variables are updated, you can see this if you type

echo $PATH

Testing the installation

13 **** look for foamInstallationTest which it is located at

~/OpenFOAM/OpenFOAM-1.3/bin

in the same way, this file is a shell script

type

chmod -v 555 foamInstallationTest

press enter

now you don't need to export the path, since you have already done it...

now type

foamInstallationTest

press enter

here the shell scrip verifies every directory and assigns to each of them an environment variable (PATH), also this takes a bit of time. However you will see an error at the end of the process, something like this:

test_rsh unsuccessful_conection_refused* test_ssh unsuccessful_conection_refused*

FATAL: No remote shell available (etc....)

For the stand alone version, this message is normal and you can safely ignore it, just after this OpenFOAM is ready to run

Getting started with OpenFOAM

Library documentation is included in

~/OpenFOAM/OpenFOAM-1.3/doc/Guides-a4

you will find there some PDFs with tutorials and very useful examples, after a short reading you can start modelling right away.

Troubleshooting

When installing this on a Dapper 64-bit system, I ran into the problem that the default JAVA_HOME, and therefore JAVA_PATH were directed to the following:

/home/<username>/OpenFOAM/<architecture>/j2sdk1.4.2_05

where there should be an OpenFOAM-1.3 directory after the OpenFOAM directory. To fix this, I opened a terminal and did the following:

gedit ~/OpenFOAM/OpenFOAM-1.3/.bashrc

Then, browse to the Java section, under the # Linux Workstation subsection, edit the export JAVA_HOME line to look like the following:

export JAVA_HOME=$WM_PROJECT_INST_DIR/OpenFOAM-1.3/$WM_ARCH/j2sdk1.4.2_05

Then save and close, and source your bashrc

. ~/.bashrc

N.B. it is . space ~/....

Acknowledgements

  • Thank you to the OpenFOAM CFD developement team for making it available under the GLP.
  • Thank you to Ubuntu Team for the great effort in this Operating System
  • Thank you for reading this wiki
  • This wiki is based in my previous Ubuntu Forum Thread ScientificUbuntu Installing OpenFOAM CFD Software

* * * * * derjames * * * * *


CategoryScience

OpenFOAM (last edited 2010-09-05 14:30:26 by greeno)