Basic Installation Steps

From OpenFOAMWiki
Revision as of 13:36, 27 May 2008 by NGJ (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is a step-by-step installation guide to OpenFOAM on 32bit machines. It is highly focused on Linux-newbies, thus many steps might look superfluous on more experienced users. The character ">" is used to signal that what follows on that specific line is to be typed in a command line.

- Make a directory for your OpenFOAM installation by typing:

 > mkdir $HOME/OpenFOAM
 > cd $HOME/OpenFOAM
 > mkdir linux

- Download the following six archives from the opencfd-homepage to the $HOME/OpenFOAM directory:

 > OpenFOAM-1.4.1.General.gtgz
 > OpenFOAM-1.4.1.linuxGccDOpt.gtgz
 > OpenFOAM-1.4.1.linuxGccSOpt.gtgz
 > gcc-4.2.1.linux.tgz
 > j2sdk1.4.2_05.linux.tgz
 > paraview-2.4.4.linux.tgz

- Open a terminal and type:

 > ls /usr/include/features.h
 a) EITHER "/usr/include/features.h" is written to screen. Do not do any further.
 b) OR "cannot access /usr/include/features.h: No such file or directory" 
    is written to screen. You need the build essentials to compile your own 
    boundary conditions, thus type the following in a terminal:
    > aptitude install build-essential gcc

- Unpack the archives by typing the following command:

 > cd $HOME/OpenFOAM
 > tar -xzf OpenFOAM-1.4.1.General.gtgz
 > tar -xzf OpenFOAM-1.4.1.linuxGCCDPOpt.gtgz
 > tar -xzf OpenFOAM-1.4.1.linuxGCCSPOpt.gtgz
 > tar -xzf gcc-4.2.1.linux.tgz linux/
 > mv *.tgz linux/.
 > cd linux
 > tar -xzf gcc-4.2.1.linux.tgz
 > tar -xzf j2sdk1.4.2_05.linux.tgz
 > tar -xzf paraview-2.4.4.linux.tgz

- You need to set some environmental variables to be able to run OpenFOAM. This is done in the following way:

 a) EITHER, if running bash or ksh (if in doubt type 'echo $SHELL'), do the 
    following:
    > nano $HOME/.bashrc (this open a text-editor in your command window)
    In the end of the file you type:
    . $HOME/OpenFOAM/OpenFOAM-1.4.1/.OpenFOAM-1.4.1/bashrc
    Press 'CTRL-X' to quit nano and agree to save changes.
 a) OR, if running tcsh or csh (if in doubt type 'echo $SHELL'), do the 
    following:
    > nano $HOME/.cshrc (this open a text-editor in your command window)
    In the end of the file you type:
    source $HOME/OpenFOAM/OpenFOAM-1.4.1/.OpenFOAM-1.4.1/cshrc
    Press 'CTRL-X' to quit nano and agree to save changes.

- Open a new command-window. This will read $HOME/.bashrc and set all the necessary environmental variables. To check the installation do:

 > cd ~/OpenFOAM/OpenFOAM-1.4.1/bin
 > sh foamInstallationTest

- On single-machine setups, the installation test will probably produce a report which looks like this in the last couple of lines:

 ==============================================================================
 Checking networking...
  
 -------------------------------------------------------------------------------
 Action                   Result                                       Crit
 -------------------------------------------------------------------------------
 Pinging_ngj-ubuntu       Successful                                   yes 
 Pinging_localHost        Successful                                   yes 
 Test_rsh:                Unsuccessful_connection_refused*             yes
 Test_ssh:                Unsuccessful_connection_refused*             yes
 FATAL ERROR: No remote shell available.
              Foam1.4.1 enviroment requires either ssh and/or rsh.
              Contact your system administrator.


 -------------------------------------------------------------------------------

 The system test has evoked 1 fatal error(s).

 Critical systems ok.

 Review the output for warning messages and consult 
 the installation guide for trouble shooting.
 ==============================================================================
 This fatal error is due the test_rsh and test_ssh critiria, though they are 
 irrelevant on single-machine installations, i.e. only relevant for parallel-
 processing on multiple machine.

- To setup the a working directory, follow step 6 in the ~/OpenFOAM/OpenFOAM-1.4.1/README file.

- You are now ready to begin working with OpenFOAM.

- Have fun:)