How to install OpenFOAM CFD software 怎样安装OpenFOAM计算液体力学软件
This HowTo is aimed to all Engineers, Scientist, Students interested in learning/applying/experimenting Computational Fluids Dynamics (CFD)本教程为那些对学习、应用、实验计算液体力学（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.
AMD64 Systems 对于AMD64系统
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:
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.
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
3 * Click on download 4 * Select your version 5 * Dowload all the packges to your Desktop (very advance LINUX users can avoid obvious steps)
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
which are on ~/Desktop to the folder you've just created ~/OpenFOAM
7 * create the following folder using mkdir (remember LINUX is case sensitive)
8 * copy
- which are in ~/Desktop to ~/OpenFOAM/linux
9 * untar avery single file in the following order
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
this is a shell script that we have to execute, however we need to change it to an executable format
chmod -v 555 foamSystemCheck
press enter, then type
press enter, then type
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!!!)
chmod -v 755 foamSystemCheck
12 * * * * * * Now you have to set the environment variables for a correct file access, the environment variable settings are stored in
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
(if you are not sure which shell you are using and edit the following files according to your shell syntax)
gedit ~/.bashrc &
once in gedit type
N.B. it is 'dot', space~/....... select file>save and then file>quit
now update the environment typing
N.B. it is 'dot', space ~/.......
the environment variables are updated, you can see this if you type
Testing the installation 测试安装是否成功
13 **** look for foamInstallationTest which it is located at
in the same way, this file is a shell script
chmod -v 555 foamInstallationTest
now you don't need to export the path, since you have already done it...
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
you will find there some PDFs with tutorials and very useful examples, after a short reading you can start modelling right away.
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:
where there should be an OpenFOAM-1.3 directory after the OpenFOAM directory. To fix this, I opened a terminal and did the following:
Then, browse to the Java section, under the # Linux Workstation subsection, edit the export JAVA_HOME line to look like the following:
Then save and close, and source your bashrc
N.B. it is . space ~/....
- 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 * * * * *