Installing, Compiling & Running ElmerNonGUI in Ubuntu 12.04

Discussion about building and installing Elmer
Post Reply
annier
Posts: 1168
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Installing, Compiling & Running ElmerNonGUI in Ubuntu 12.04

Post by annier »

The following links have been referred for installation and compilation of elmer in Ubuntu 12.04
http://www.elmerfem.org/elmerwiki/index ... r_on_Linux
http://ascend4.org/Building_Elmer_on_Ubuntu_12.04
https://subversion.apache.org/packages.html#debian
viewtopic.php?f=2&t=3653&sid=be626f5ee2 ... b11186abeb

Steps:
Note:
For the context of here , the scripts with "$" in their front mean that they are to be typed in the terminal and if they are without it "they are to be pasted in a file" and then will be implemented.

1. Check out for the subversion

Code: Select all

$ sudo apt-get install subversion
$ sudo apt-get install libapache2-svn
Also, one can get the rabbitvcs subversion in the Ubuntu software centre.

2. Get the elmerfem source via the subversion

Code: Select all

$ svn checkout http://svn.code.sf.net/p/elmerfem/code/trunk elmerfem
or

Code: Select all

$ svn checkout https://svn.code.sf.net/p/elmerfem/code/trunk elmerfem
3. Jump into the elmerfem directory

Code: Select all

$ cd elmerfem
4. Create the compile script with the filename compile.sh inside the elmerfem directory.The following script should be added to the compile.sh file. Note that the module fem has been dealt separately from other modules to include the "mpi" related aspect.

Code: Select all

#!/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=""
#linking
export LDFLAGS=""
#paths
#export ELMER_HOME="/path/to/Elmerdir"
export ELMER_HOME="$HOME/elmerinst"
# modules
modules="matc umfpack mathlibs elmergrid meshgen2d eio hutiter  post"
# configure and build
for m in $modules; do
   cd $m ; ./configure --prefix=$ELMER_HOME && make clean && make && make install && cd ..
# configure and build the module fem using mpi related aspect
cd fem; ./configure --prefix=$ELMER_HOME --with-mpi-inc-dir=/usr/include/mpich2 && make clean && make && make install && cd ..
done
5. Run the script as follows. This will make an installation directory "elmerinst" within the Home directory and it is the path to elmer.

Code: Select all

$ chmod u+x compile.sh
$ ./compile.sh
6. Set the environment variables in the bashrc file for defining the path of Elmer
- In the terminal, type the following;

Code: Select all

$ gedit ~/.bashrc
-Add the following scripts at the end of the bashrc file

Code: Select all

export ELMER_HOME=$HOME/elmerinst
export ELMER_POST_HOME=$ELMER_HOME/share/elmerpost
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ELMER_HOME/lib
export PATH=$PATH:$ELMER_HOME/bin
The installation and compilation of elmer in nonGui form is completed.

Steps for Testing of the ElmerNonGui
It is assumed that the elmerfem and elmerinst folders are in the home directory.
1. Make an elmer project directory

Code: Select all

$mkdir elmer_project
2. Copy a test from elmerfem directory (e.g.CavityLid) to the elmer_project directory.

Code: Select all

$cp -r $HOME/elmerfem/fem/tests/CavityLid/ $HOME/elmer_project/CavityLid
3. Jump into the CavityLid tutorial.

Code: Select all

$cd ~/elmer_project/CavityLid/
4.Convert mesh file in .grd format [1] to .mesh.*(ElmerSolver) format [2] [Please refer chapter 1 of Elmer Grid Manual (http://www.nic.funet.fi/pub/sci/physics ... Manual.pdf) to find the corresponding number of Different File Formats]

Code: Select all

$ElmerGrid 1 2 square.grd
5. For users of Paraview, open the case.sif file via

Code: Select all

$gedit case.sif
and replace post file = case.ep (in simulation section) with

Code: Select all

Post File = case.vtu

Save the edited file.

6. Run the ElmerSolver command

Code: Select all

$ElmerSolver > anyname.log 2>&1
7.Open paraview by typing in terminal

Code: Select all

$paraview
Note: paraview can be installed in ubuntu by typing

Code: Select all

$sudo apt-get install paraview
The file>open>... can lead us to opening the case.vtu file located within the $HOME/emer_project/CavityLid/square/ directory.


The following reply to this post describes the steps for running ElmerNonGUI in Ubuntu 12.04.

Yours
Anil Kunwar
Last edited by annier on 09 Dec 2014, 05:24, edited 7 times in total.
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
annier
Posts: 1168
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installation and Compilation of ElmerNonGUI on Ubuntu 12.04

Post by annier »

Steps for Running ElmerNonGUI in Ubuntu 12.04
1. We need to write all the input information (Header, Body, Solver, Simulation, Equation, Material ,Boundary Conditions) in a text file and make it a SIF (ending with .sif). Let it be named as abcd.sif. ( A sample Solver Input File for learning about the structure of .sif file can be found at different test examples in the downloaded elmer directory => $HOME/elmerfem/fem/tests or in general /path/ to elmer directory/fem/tests .)
Additionally, we need to create an empty text file with the file name ELMERSOLVER_STARTINFO and inside it we write the following thing:

Code: Select all

abcd.sif
1
The ELMERSOLVER_STARTINFO file should be in the same directory with the abcd.sif file.

2. We draw the geometry and mesh in some other preprocessors and convert it into Elmer format with ElmerGrid command in the terminal by jumping into the directory where the geometry/mesh files are located.
If the file exported by the preprocessor in .unv format has the name abcdwxyz.unv, then the following command converts the .unv file into Elmer format:

Code: Select all

$ ElmerGrid 8 2 abcdwxyz.unv -autoclean
3. Then we put the folder with mesh files (in elmer grid format) in the directory where the SIF file is located. If the folder having mesh files (in Elmer Format) is named mymesh, then Header in abcd.sif should be like:

Code: Select all

Header
Mesh DB "." "mymesh"
End
4. In the terminal, we jump into the directory containing abcd.sif and type:

Code: Select all

$ ElmerSolver
or, in case we need to see the solver logfile

Code: Select all

$ ElmerSolver > anyname.log  2>&1
This will run the Elmer Solver.

5. In order to see the result, we can open postprocessor (example : Paraview) and browse the .vtu files located within the mymesh directory.
For this, there should have been written the following command in the simulation section of abcd.sif:

Code: Select all

Simulation
...
Post File = "case.vtu"
...
End
Yours
Anil Kunwar
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
annier
Posts: 1168
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Installing, Compiling & Running ElmerNonGUI in Ubuntu 12.04

Post by annier »

Hi All,
Now, Elmer can be installed (1) using cmake as described in this post(elmer installation using cmake) or (2) with launchpad as described in post(related with installation of Elmer in Ubuntu 14.04).

Yours
Anil Kunwar
Anil Kunwar
Faculty of Mechanical Engineering, Silesian University of Technology, Gliwice
Post Reply