Compilation of Elmer on Linux

From Elmer Wiki
Revision as of 18:47, 24 June 2013 by Deric (talk | contribs) (removed "-" from chmod -u+x & changed ~./bashrc to ~/.bashrc)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Detailed compilation instructions can be found from here.

Get the source via subversion:

$ svn checkout elmerfem
$ cd elmerfem

Create the script

#!/bin/sh -f
#the compiler (here the gcc 4.X suite)
export CC=gcc
export CXX=g++
export FC=gfortran
export F77=gfortran
#the compiler flags
export CFLAGS=""
export FCFLAGS=""
export F77FLAGS=""
export FFLAGS=""
export LDFLAGS=""
export ELMER_HOME="/path/to/Elmerdir"
# modules
modules="matc umfpack mathlibs elmergrid meshgen2d eio hutiter fem post"
# configure and build
for m in $modules; do
   cd $m ; ./configure --prefix=$ELMER_HOME && make clean && make && make install && cd ..

If you compile on a 32-bit machine, you may want to play safe and add the switch "--with-64bits=no" to the configure command:

./configure --prefix=$ELMER_HOME --with-64bits=no

Run the script as follows:

$ chmod u+x
$ ./

Finally, we need to set up some environment variables and extend the path:

$ export ELMER_HOME="/path/to/Elmerdir"
$ export PATH=$PATH:$ELMER_HOME/bin

For bash users, a good place to put the above lines is in the end of ~/.bashrc.