# Is there a general framework for solving PDEs on uniform grid in parallel

Hej,

I want to simulate a partial differential equation (a modified Cahn-Hilliard equation, but the details do not matter much. The questions also applies to the diffusion equation). I'm looking for a good framework to do heavy numerics. My requirements are:

• No license costs (matlab is no option, because we do not have enough licenses to run many jobs on our cluster)
• Fast code (ideally it would be compiled code. Using an interpreted language like python at runtime might be too slow)
• Flexible geometries. In fact I'd like to simulate a three dimensional problem with cylindrical symmetry. For computational efficiency I want to express my concentration field as a function of radius and the z coordinate, which makes of course the Laplacian a little bit more difficult to implement.
• Neumann boundary conditions (periodic boundary conditions are ok, too, but they cannot be used for the aforementioned cylindrical geometry). Neumann boundary conditions essential ensure no-flux conditions at the boundary, such that the total amount of material in the system is conserved.
• Ideally multiprocessing would be supported.

Currently, I'm using XMDS2, which is a great toolset. I use it to automatically generate C code, which I can compile and then run. It works like a charm, except for the boundary conditions. Unfortunately, XMDS only supports Dirichlet boundary conditions for cylindrical geometry, which does not help much in my case.

Does anyone know alternative frameworks, which support my requirements and are easy to use? If everything fails, I have to develop my own code, but I'm afraid that I cannot write as efficient code as experienced people would be able to do.

From your description, PETSc's DMDA is probably sufficient. It is easy to use with geometric multigrid (or many other solvers) and should meet your other requirements. There are many examples (some linked at the bottom of the man page) and even some examples for Cahn-Hilliard. Feel free to ask further questions here or on the petsc-users mailing list. [Disclaimer: I am a PETSc developer.]

• Thanks Jed, DMDA (and PETSc in general) looks interesting and can certainly get the job done, but it is quite low level, as far as I can see. I was hoping for a solution that is a little easier to use, i.e. where I have to write less code. If I cannot find anything, I will certainly consider using some of PETSc's routines! – David Zwicker Nov 26 '13 at 9:43

deal.II (http://www.dealii.org/) satisfies all of your requirements. Like Jed, let me suggest to ask your question on the deal.II mailing lists.

• Thank Wolfgang for the suggestion. As far as I can see, deal.II is a finite element solver, which is a little bit more complicated than I was hoping for. I can discretize my problem on a rectangular, regular (z, r) grid and mostly need to implement the cylindrical Laplacian together with the Neumann boundary conditions. While a finite element solver can certainly achieve this, I'm afraid that it adds unnecessary overhead. – David Zwicker Nov 26 '13 at 9:46
• Whether you discretize the equation using a finite element method of anything else doesn't make that much difference in practice. You will find that the complexity comes into play with your requirements of flexible geometries and parallel computing, and this is where you want to use existing packages rather than writing things yourself. The discretization you choose is not the most complicated part of your program. – Wolfgang Bangerth Nov 26 '13 at 13:44
• I total agree, but luckily my problem does not possess a complicated geometry. The advantage of using a regular grid is that the differential operator does not need to be discretized for each point, but I can express it very efficiently in for instance Fourier space (or Hankel space for the polar coordinates). Here, the operator becomes local. The computational cost is then moved to a Fourier transform, which can be done very efficiently. I completely agree that this approach has limits, i.e. it can't account for complicated boundaries or meshes. – David Zwicker Nov 26 '13 at 14:00

The authors of XMDS2 added support for Neumann conditions in connection with the Bessel transform (i.e. radial symmetric coordinates) in the latest development version (revision 2913). I will therefore continue using XMDS2, since it now contains all features that I need. Thanks again to the very helpful XMDS2 authors!