Vijai Kumar S
A Space to share my views on World, Science and People

# How to install Stanford SU2 in Ubuntu

SU2 is an open source fully unstructured CFD code written and maintained by stanford university. The research group maintaining this code are from AeroAstro faculty. This is an advantage for aerospace engineers and researchers around the world because of its ability to do lot of external aerodynamics stuff out of the box. Openfoam is yet another beautiful open source CFD code. But it is kept as a general purpose code. SU2 on the other hand has features like lift and drag monitors, design optimization tools available out of the box with an option to do simple python scripting. SU2 also allows for parallel computation and has CGNS mesh support which only makes it all the more awesome. There is a new plugin in gmsh which allows exporting unstructured meshes in native su2 mesh extension. I would definitely recommend running SU2 on Ubuntu because its really easy to install and maintain.

I have written an automated installer in bash. It should basically work on ubuntu / any debian based distro. Its very new and pre alpha. So i kindly request you to report any bugs to me. It has been tested well in a Ubuntu 14.04 Virtual machine. As any software goes, there will always be bugs. Hence you are free to contact me anytime you encounter an error.

To install the above script just enter the following command in your terminal.

wget https://git.io/v4OuT -O su2.sh
chmod +x su2.sh
sudo ./su2.sh


If you prefer doing the installation manually, the section below should basically list the steps of installation.

wget http://su2.stanford.edu/download/v4.0.0/SU2v4.0.0.tgz


The above line will pull the code from SU2 repository. Now if you want mpi and cgns support, then you should follow the steps below.

wget http://liquidtelecom.dl.sourceforge.net/project/cgns/cgnslib_3.2/cgnslib_3.2.1.tar.gz && tar -xzvf cgnslib*.tar.gz


You need to cd into the folder in which cgnslib has been unarchived and do the following.

cd cgnslib_3.2.1/src &&
./configure &&
make &&
sudo make install


This above will install the cgns libraries and copy then to \usr\local\bin and \usr\local\lib

Now that cgns is good to go. We need to setup MPI for parallel support. This can be easily accomplished by the commands below.

sudo apt-get install libopenmpi-dev


This should put the mpicc and mpicxx binaries in \usr\bin. Now we are good to go on SU2. Since we have already downloaded the SU2, let us untar the archive into the current directory.

tar -xzvf SU2*.tgz


Once this is done, we are ready to compile SU2 with full parallel and cgns support. If you installed everything as i explained, then the following steps would install the SU2 for you. Make sure you are in the SU2 directory by doing

cd SU2*

./configure CXXFLAGS="-O3" --enable-mpi
--with-cc=/usr/bin/mpicc --with-cxx=/usr/bin/mpicxx
--with-CGNS-lib=/usr/local/lib --with-CGNS-include=/usr/local/include


This will give you a config to be added to your .bashrc and you can simply copy paste it. Then you need to do the enter the following command to complete the installation of SU2.

sudo make install


Now you check if everything is okay by running the quick start tutorial given.

P.S : Recently there was a big outage in source forge which caused a lot of mirrors to go offline. If you get any issues due to unavailability of the cgnslib or SU2, please comment below. I will update the script and post to use my own personal mirror.

Update: I have updated the commands for install mpicc and mpicxx