PywebCFD


2025-07-29 20:28:34

During the shift to online learning imposed by the geopolitical situation, I found myself with a lot of free time. so I decided to experienment with CFD solvers, and that led me to the creation of PywebCFD, my first ever web-based interactive FDM CFD solver.

A little background, PywebCFD is a Finite Difference Method (FDM) solver that numerically solves the flow equations, specifically oprimised for incompressible flows. it is built using python (witb an HTML web interface).

the main challenge for me as a first year undergraduate student, was to polish my understanding of the flow equations, and then finish them by learning how to solve them numerically. initially I was aiming to use the Lattice Boltzmann Method (LBM), as I believed that they are more efficient for a web-hosted solver. however, I found tuning the model to be especially challenging, I am still working on that so any new meaningful progress will be posted.

for the time being, I am using the FDM method, which is a lot more intuitive and easier to implement. its main issue is performance, as it is quite diffuicult to run fine grid simulations on a web server, with multiple users at the same time. My solution was to limit the solver to a largely coarse grid, limiting initial parameters and playing with relaxation parameters to ensure stability.

One last issue I faced was data visulisation, I wanted to be able to visualise the flow field in a way smooth manner that didnt kill performance. after lots of experienmentation I found that using the matplotlib library to generate a static image of the flow field, and then updating frequently enough was a surprisingly good solution.

My objectives for the forseeible future:

1. switch to a segregated solver, with seperate pressure and velocity solvers.

2. Ditch FDM altogether. the lattice Bolzmann method is more efficient (albeit usually less accurate). Still cracking this one—any suggestions are welcome!

3. Implementing force monitors and improving accuracy / stability



you can try it out (you need to have lots of patience though) in this link
update : I stopped hosting it, contact me for src code.

screenshot of the pywebCFD solver screenshot of the pywebCFD solver screenshot of the pywebCFD solver screenshot of the pywebCFD solver