Atmospheric fluid dynamics solver optimized for GPUs.
Cuda C++ Objective-C Matlab C Makefile
Switch branches/tags
Nothing to show
Clone or download
Joao Mendonca
Joao Mendonca Update
Latest commit d84551b Feb 5, 2018
Failed to load latest commit information.
bin Add files via upload Oct 2, 2017
ifile Add files via upload Oct 2, 2017
mjolnir Add files via upload Oct 2, 2017
src Add files via upload Oct 2, 2017
Makefile Add files via upload Oct 2, 2017 Update Feb 5, 2018
license.txt Add files via upload Oct 2, 2017


Flexible Global Circulation Model to Explore Planetary Atmospheres

THOR is a GCM that solves the three-dimensional non-hydrostatic Euler equations on an icosahedral grid. THOR was designed to run on Graphics Processing Units (GPUs).

If you use this code please cite: Mendonca, J.M., Grimm, S.L., Grosheintz, L., & Heng, K., ApJ, 829, 115, 2016

Copyright (C) 2017 João Mendonça


Main instructions to compile and run THOR. This version uses only a single GPU.

Current code owner: Joao Mendonca:

Home website:


UBUNTU 17.04

1- Install cuda.

   $ sudo apt install nvidia-cuda-toolkit

2- Downgrade g++ because cuda 8 conflicts with the latest g++.

   $ sudo apt install g++-5

3- Restart your pc.

4- Install hdf5 ( Download the source code. Follow all the steps from the instructions, for example:

   $ cd <install_directory>
   $ mkdir build
   $ cd build
   $ sudo /path_to_HDF5_source/configure
   $ sudo make
   $ sudo make check
   $ sudo make install
   $ sudo apt install hdf5-helpers

5- Go to THOR home directory. Open Makefile file and set "hdf_install" and "h5lib" paths correctly.

6- Set the value SM correctly, this depends on the GPU you are using. SM stands for Streaming Multiprocessor and the number indicates the features supported by the architecture. See Example: Tesla K20 -> 35. To get information on your GPU, type in the terminal:

   $ nvidia-smi 

7- Create a config file in "/etc/" called for example "mylib.conf" with the following line:



   $ sudo ldconfig 

8- Type:

   $ make -j8


UBUNTU 17.04

0- (First run?) Create two folders called "obj" and "results".

   $ mkdir obj results

1- Set planet's parameters in "src/initial/".

2- Set model's parameter in "src/headers/define.h".

3- Run

   $ ./bin/esp

4- Press enter and relax.


  • Output is written in "results" folder.
  • Very useful command lines to quickly explore the hdf5 files can be found in or type the command ">> man h5dump".
  • You can find some Matlab routines to explore the results in "mjolnir" folder.