Solving PDE in Python to run simulations in Rust

I am doing some simulations for particles mostly in Rust. However, Rust does not seem to have a reliable partial differential equation solver (PDE) so I am using Python to solve the PDE. I am not sure how to even begin implementing Python in Rust other than using PyO3. I have a solution as a VectorFunctionSpace object (https://fenicsproject.org/olddocs/dolfin/1.4.0/python/programmers-reference/functions/functionspace/VectorFunctionSpace.html) in Python, that I need to reference mutiple times (in Python) to get the electric field at a point for each time step in the simulation.

I am running the simulation portion in Rust because it is much faster than Python, and the speed of the PDE solver should still be faster than running it all in Python.

It looks like DOLFIN is actually mostly written in C++ and python is a convenient interface on top? Using the C++ interface directly from rust would probably be a better option than trying to call the python code.

3 Likes