Skip to content

JamieJQuinn/Melvin.py

Repository files navigation

Melvin.py

A Python-powered GPU-accelerated framework for solving 2D computational fluid dynamics problems 💧

Repo status MIT license ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

GitHub tag (latest SemVer pre-release) Continuous testing

Melvin.py is a user-friendly framework for building GPU-accelerated spectral simulations of 2-dimensional computational fluid dynamics problems. This is still a work-in-progress project however the following features are functional:

  • Boundary conditions
    • doubly periodic
    • periodic in x, Dirichlet in z
  • Spatial discretisation
    • Fourier spectral in both directions
    • Fourier spectral in x and finite difference in z
    • Pseudo-spectral transform for handling nonlinear advection term
    • 2nd and 4th-order accurate finite-difference derivatives
  • Time stepping schemes
    • Explicit 2nd and 4th-order Adams-Bashforth for any discretisation
    • 2nd and 4th order predictor-corrector schemes using Adams-Bashforth and Adams-Moulton schemes
    • Semi-implicit treatment of diffusion operator in fully-spectral only
  • Incompressibility
    • Implemented via a vorticity-streamfunction formulation
  • Fully parameterised with JSON
  • WIP Restarting from checkpoint
  • WIP Automatic CFL-based timestep adaptation

Contents

Installation instructions

You can install the latest version of Melvin by cloning this repo and installing via pip:

git clone https://github.com/JamieJQuinn/Melvin.py.git
cd Melvin.py
pip install .

To install with GPU support (provided via CuPy) replace the above pip install . with

pip install .[cupy]

Note: Melvin is tested with Python 3.9. Older versions of Python 3 may work but YMMV.

Running an example

The examples can be found in the examples folder and provide a useful starting point. Currently the examples are

Let us run the double-diffusive convection example, ddc.py and place output files into a data directory. The parameters, initial conditions and boundary conditions are all set within ddc.py file and can be run with

mkdir data
cd data
python ../examples/double_diffusive_convection.py

Getting help

If you are interested in using Melvin.py or are trying to figure out how to use it, please feel free to ask questions and get in touch via email (jamiejquinn [at] jamiejquinn.com)!

Contributing

We want your help no matter how big or small your contribution may be. It's useful even just to look over the documentation and likely find a typo or two!

If you've found a bug or have a suggestion for how Melvin.py could be improved, I encourage you to open an issue or submit a pull request.

For more information, check out our contributor's guide.

About

A user-friendly framework for building GPU-accelerated spectral simulations of 2-dimensional computational fluid dynamics problems.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages