I would like some super simple computational code for solving magnetohydrodynamics problems. High accuracy nor performance is not my concern. I wan't it just to visually explore qualitative behavior of plasma. Important for me is:

  • Generality - it should not be specialised on any particular subproblem of MHD
  • Easy to get it work - does not require any libraries difficult to instal. Input is strightforward and well documented by some examples
  • Easy to read and modify - you can read the code and learn about MHD solution from it. You can use this code as starting point for your own MHD code development

Something as simple as this Navier stokes solver would be best

best would be something in python-numpy or java, but C++ or Fortran is not a big problem for me.

Up to now I found:

some libraries ( MHD-Hermes and python-mhd ) which are in python, but doesn't seem to have any documantation or examples how to use it.

and this A Free, Fast, Simple and Efficient TVD MHD Code which is in frotran but has just 400 lines

I was thinking about writing something by myself but I want to be sure there is nothing similar already avaible. I think it could be quite easy, just take the Navier-Stokes solver from the link above and introduce electric and magnetic potential by FFT poisson solver ( or Particle Mesh Ewald ).

  • $\begingroup$ That little OpenMP Fortran code is really neat. $\endgroup$ – stali Jul 4 '13 at 13:42
  • 1
    $\begingroup$ I love reading things with comments like "! to keep things stable". $\endgroup$ – Rhys Ulerich Jul 5 '13 at 0:19
  • $\begingroup$ How about mhdFOAM? github.com/OpenFOAM/OpenFOAM-2.2.x/blob/master/applications/… $\endgroup$ – Subodh Jul 5 '13 at 8:11
  • $\begingroup$ I don't find OpenFOAM easy to read and modify, but that's because the parts I've had to investigate are buried deep within the code. Plus, even the Wikipedia page mentions that OpenFOAM is poorly documented and has a very gradual learning curve. $\endgroup$ – Geoff Oxberry Jul 6 '13 at 11:07
  • $\begingroup$ Try pyClaw, based on Randy LeVeque's CLAWPACK. $\endgroup$ – Kyle Kanos Jul 13 '13 at 0:32

Have a look on these three:

  • Piernik MHD it is a code which evolved from the Pen & Trac MHD you mentioned in your question. Now its quite mature and the development is still active. Written in modern Fortran 95/2003.

  • Godunov MHD an MHD code designed especially for simulating the reconnection events, but can be easily modified and applied to other problems. It can be parallelized from single multicore machine (OpenMP) up to clusters with many nodes (MPI). Written in Fortran 90/95.

  • python-mhd a small and simple MHD code, easy to play with it. Written in Python and C.

| cite | improve this answer | |
  • $\begingroup$ thanks, I sould look on that in more detail. About python-mhd: This would be ideal because it is pytho. I mentioned it also in original question. However, I have problem running the example (I write an issue code.google.com/p/python-mhd/issues/detail?id=1). I didn't found any other documentation or example than that on frontpage. $\endgroup$ – Prokop Hapala Jul 8 '13 at 11:16

Give a try to PLUTO


I hope this helps ! Cheers, Tom

| cite | improve this answer | |

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.