Skip to main content

A CFD python package for the Shallow Water Equations

Project description

MattFlow

Conda Lincense

A CFD python package for the Shallow Water Equations

MattFlow simulates the surface of the water after any initial conditions, such as drops or stones falling on.


requirements os
python3 GNU/Linux
click >= 7.0 Windows
joblib >= 0.13.2 OSX
matplotlib >= 3.3.1
numba >= 0.51.2
numpy >= 1.18.5
ffmpeg (optional)

Install

$ conda create --name mattflow -y
$ conda activate mattflow
$ conda install -c mattasa mattflow
$ pip install mattflow

Usage

$ mattflow [OPTIONS]
Options:
  -m, --mode [drop|drops|rain]    [default: drops]
  -d, --drops INTEGER             number of drops to generate  [default: 5]
  -s, --style [water|contour|wireframe]
                                  [default: wireframe]
  --rotation / --no-rotation      rotate the domain  [default: True]
  -b, --basin                     render the fluid basin
  --show / --no-show              [default: True]
  --save
  --format [mp4|gif]              [default: mp4]
  --fps INTEGER                   [default: 18]
  --dpi INTEGER                   [default: 75]
  --fig-height INTEGER            figure height (width is 1.618 * height)
                                  [default: 18]
  --help                          Show this message and exit.

Swallow Water Equations

SWE is a simpified CFD problem which models the surface of the water, with the assumption
that the horizontal length scale is much greater than the vertical length scale.

SWE is a coupled system of 3 hyperbolic partial differential equations, that derive from the
conservation of mass and the conservation of linear momentum (Navier-Stokes) equations, in
case of a horizontal stream bed, with no Coriolis, frictional or viscours forces (wiki).

{\displaystyle {\begin{aligned}{\frac {\partial (\rho \eta )}{\partial t}}&+{\frac {\partial (\rho \eta u)}{\partial x}}+{\frac {\partial (\rho \eta v)}{\partial y}}=0,\\[3pt]{\frac {\partial (\rho \eta u)}{\partial t}}&+{\frac {\partial }{\partial x}}\left(\rho \eta u^{2}+{\frac {1}{2}}\rho g\eta ^{2}\right)+{\frac {\partial (\rho \eta uv)}{\partial y}}=0,\\[3pt]{\frac {\partial (\rho \eta v)}{\partial t}}&+{\frac {\partial (\rho \eta uv)}{\partial x}}+{\frac {\partial }{\partial y}}\left(\rho \eta v^{2}+{\frac {1}{2}}\rho g\eta ^{2}\right)=0.\end{aligned}}}

where:
η : height
u : velocity along the x axis
υ : velocity along the y axis
ρ : density
g : gravity acceleration

Structure

Open In Colab

  1. configuration of the simulation via a config file
  2. pre-process
    structured/cartesian mesh
  3. solution
    supported solvers:
    • Lax-Friedrichs Riemann    | O(Δt, Δx2, Δy2)
    • 2-stage Runge-Kutta         | O(Δt2, Δx2, Δy2)  | default
    • MacCormack           | O(Δt2, Δx2, Δy2)  | experimental
  4. post-processing
    matplotlib animation

Configuration options

  • mesh sizing
  • domain sizing
  • initial conditions (single drop, multiple drops, rain)
  • boundary conditions (currently: reflective)
  • solver
  • multiprocessing
  • plotting style
  • animation options

Currently, the simulation can be configured at the config.py module.

TODO

  1. CI
  2. GUI
  3. Consider Cythonizing or moving to C++
  4. Higher order schemes
  5. Include source terms
  6. Include viscous models
  7. Algorithm that converts every computational second to a real-time second, modifying the fps at
    the post-processing animation, because each iteration uses different time-step (CFL condition).
  8. Moving objects inside the domain
  9. Unstructured mesh
  10. 3D CFD

License

GNU General Public License v3.0

Special thanks to Marios Mitalidis for the valuable feedback.


Start the flow!

(C) 2019, Athanasios Mattas
thanasismatt@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mattflow-1.4.2.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mattflow-1.4.2-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file mattflow-1.4.2.tar.gz.

File metadata

  • Download URL: mattflow-1.4.2.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for mattflow-1.4.2.tar.gz
Algorithm Hash digest
SHA256 518dcdbbdcf392dbb0bd243cf6c19a5cbace44ba3dea16d0c8af27e08d7d2039
MD5 15d94f57af50ab72a925e6dd75836bfe
BLAKE2b-256 ec9520c83e3cd153fddb9c3ab02ab33636adead51921567bc85f36c0b77a49a4

See more details on using hashes here.

File details

Details for the file mattflow-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: mattflow-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 43.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for mattflow-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce0dd3cdda590d0833dcd1dc30636ae6d920c0b538d664ed5e3bbcecbbcf179e
MD5 32f84f6956465e62972d2699e3c38999
BLAKE2b-256 d9d8c58bf0e94020f72b061d57655b9ec3ce53fec68482ae5d334bc13f8bff64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page