Mars

A hydrodynamic simulation code written in python, designed to be minimalistic and easy to understand; but don't take my word for it, ask cowsay 🐮💬!

-------------------------------------
/ \\\\\\\\\      /\     |\\\\\ /\\\\\ \
| ||  ||  \\    //\\    ||  // ||     |
| ||  ||  ||   //  \\   ||\\\\ \\\\\\ |
| ||  ||  ||  //\\\\\\  ||  ||     || |
| ||  ||  || //      \\ ||  || \\\\\/ |
\ Its a mooooost have!                /
 -------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Mars can be downloaded from the code repository. Here, have some free space emojis: 🪐🚀🛰️🔭👨‍🚀☀️🌕🌖🌗🌘🌑🌒🌓🌔🌕

Why the name "Mars"

This name doesn't mean anything, I am just following the trend for codes in astrophysics to be named after Roman/Greek/Egyptian gods. I also quite quite like the name, which is NAATILLO (Not An Acronym Even Though It Looks Like One).

Mars is intended to be used for learning and as a test bed for python optimisation via the numpy, numba, cython and scipy modules. Mars is inspired by the code PLUTO and makes use of algorithms from that project.

Features

🪐 1D, 2D and 3D
☀️ 1st and 2nd order accuracy
🔭 Output formats in vtk, hdf5 and npy
🛰️ Restart using hdf5 files
👨‍🚀 User generated problems
🚀 Optimised for speed using numpy and numba

Dependencies

- Python 3.5 or greater
- Numpy
- Numba
- vtk
- h5py
- cython (optional)

Using Anaconda python these dependencies can be installed with the following commands:

$ conda create --name mars  # Creates a conda env for mars to run in
$ conda activate mars
$ conda install -c anaconda numpy numba h5py cython
$ conda install -c e3sm evtk

Running a problem script

Running a simulation with Mars is centred around executing a problem script, i.e.

$ python problem.py

A collection of these scripts can be found under 'mars/problems/', they test the code in 1D, 2D and 3D using the reconstruction and Riemann solvers available.

Mars is written in python allowing for rich on the fly analysis. This can be done in the `problem.py` file, as part of calling the `main_loop` function.

if __name__ == "__main__":
    main_loop(Problem())

This can be modified to perform batch simulations where simulation parameters are modified per iteration. For example, to perform three simulations concurrently at increasing resolution in the `x1`-direction:

if __name__ == "__main__":
    p = Problem()
    for res in [16, 32, 64]:
        p.parameter['x1 resolution'] = res
        main_loop(p)

Some modifications would also be required to the output file names to prevent overwriting, but the example serves to illustrate the point.