I would like to solve two types of simple 2D problems, namely the stationary heat equation on an L shaped geometry like this:

enter image description here

And also compute the magnetostactic field in an air gap of the following geometry:

enter image description here

Since it wouldn’t be smart to reinvent the wheel, I searched for an open-source library that could handle such problems. At far as I could tell, neither in Python, Octave, Scilab or R there is a Finite-Difference (FD) library that could handle this type of geometries, which is not rectangular but should nonetheless fit on a rectangular grid (if I remember correctly from reading from “Heat Transfer” from Incropera, internal and external nodes can be handled by FD)

This lack of availability strikes me as odd; Python, Octave, Scilab and R all of them have built-in libraries for solution of ODEs, but why not FD for PDEs? Was it concluded that focusing on Finite-Element (FE) would be enough/better? I would like to stay with FD for two reasons: simplicity and I would like in the future to solve other types of PDEs, which may not be available on a FE solver.

Would it make sense to think of developing such a library? Are the limitations of FD (to simple geometries) not worth the effort?

Many thanks in advance!

  • $\begingroup$ In a sense an ODE package is a tool for solving PDEs, you just need to provide a grid and spatial discretization of your PDEs, and use the method of lines $\endgroup$ – Maxim Umansky Oct 14 '20 at 17:59
  • $\begingroup$ I would like to solve boundarz value problems, so no time dependency, as far as I know, MOL is only for time-dependent PDEs $\endgroup$ – Ken Grimes Oct 14 '20 at 18:03
  • $\begingroup$ In principle you can solve boundary problems with MOL by relaxation, using artificial time. $\endgroup$ – Maxim Umansky Oct 14 '20 at 18:23
  • $\begingroup$ I found a library called findiff in like 2 seconds, how much redearch have you done? $\endgroup$ – Emil Oct 15 '20 at 5:54
  • $\begingroup$ Ok perhaps one would have to implement the grid oneself, but the stencils are readily available at least. $\endgroup$ – Emil Oct 15 '20 at 6:06

It seems hard to write a general enough FD library thas has wide applicability, since FD methods are not as easy to write for general domains, unlike FEM which uses unstructured grids, for which there is a standard approach.

I know of two libraries which might be useful for you

Overture: An Object-Oriented Toolkit for Solving Partial Differential Equations in Complex Geometry http://www.overtureframework.org

OpenSBLI: A framework for the automated derivation of finite difference solvers from high-level problem descriptions. https://opensbli.github.io


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.