4 releases

0.2.0 Apr 1, 2023
0.1.0 Mar 24, 2022
0.1.0-beta.2 Dec 1, 2022
0.1.0-beta.1 Oct 10, 2022

#555 in Math

33 downloads per month

MIT license

11K SLoC


Dzahui is a library oriented to real-time simulation of ODE/PDE via Finite Element Method and OpenGL providing a simple interface.

To use it, one simply creates an .obj file (see blender and obj files) composed of triangles representing a mesh, specifies initial and/or boundary conditions:

let naviers_params = StokesParams::static_pressure().
        Box::new(|_| -10_f64)

builds a window indicating the problem to solve:

let window_builder: DzahuiWindowBuilder = DzahuiWindow::builder("./assets/1dbar.obj")

let window = window_builder.build();

and runs the window:


The resulting mesh will be colored from blue to red indicating speed (or pressure in the case of the hydrostatic pressure equation).

Available equations

  • 1D time-dependent diffussion equation
  • 1D time-independent diffussion equation
  • Hysrostatic pressure equation (Or simplified 1D time-independent Stokes)

For now, only three equations with Dirichlet boundaries are implemented, but more will be added in the future, including two an three-dimensional cases of Navier Stokes.

How to use

Dzahui is available on crates.io. Only add it as a dependency and follow one of the many binaries available in the crate to generate a simulation.


Dzahui has a few ways to interact with the GUI: On MacOS:

  • You can press esc to quit simulation
  • Press s to save current result
  • Hold t to view triangles of mesh
  • Left-click and move mouse or trackpad to move camera

Future implementations

  • Simmulate various types of curves akin to the problem being solved (like streamlines, pathlines and streaklines).
  • Improve GUI by adding buttons and graphs.
  • Improve method to create boundary conditions via GUI (vertex selector) and function-defined boundaries.
  • Include Newmann conditions.
  • Homogenize controls for view on different OS.
  • Implement 2D and 3D integration algorithms.
  • Improve crate structure and access modifiers.
  • Improve matrix algorithms (more stable ones).
  • Change/create traits to be directly implemented by the user.
  • Correct some implementations to improve performance.
  • Increase polynomial degree to be used on problems.
  • Use macros to embed newly user-created equations into the possible equations to simmulate.

Dzahui is a project to mayor in physics at Facultad de Ciencias, UNAM.




~265K SLoC