zwicker-group / py-pde

Python package for solving partial differential equations using finite differences.
https://py-pde.readthedocs.io
MIT License
396 stars 50 forks source link

3-dimensional Laplace matrix not implemented #480

Closed parsarahimi closed 8 months ago

parsarahimi commented 8 months ago

The simple example below gives an error for 3-dimensional Laplace matrix not implemented I took a look at the documentation and seems like there is a numba version of the 3D Laplace but couldn't figure out how to set that up.


from pde import CartesianGrid, solve_laplace_equation

grid = CartesianGrid([[0, 2 * np.pi]] * 3, 64)
bcs = [[{"value": "0"},{"value": "2"}], [{"value": "0"},{"value": "1"}], [{"value": 0},{"value": "1"}]]
field = pde.ScalarField(grid)
res = solve_laplace_equation(grid, bcs)
plt.plot(res[:,:,0])
david-zwicker commented 8 months ago

Yes, solving Laplace's equation is not a core task of the package. One could quite easily add the definition for the 3d laplacian, but I'm afraid the solution would not be very efficient.