Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 wan't to be sure there is nothing similar already avaible.

share|cite|improve this question

closed as off-topic by dmckee Jul 3 '13 at 14:39

  • This question does not appear to be about physics within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

This question appears to be off-topic because it is a "shopping list" question and because we don't address computational questions on Physics.SE (use the computational science site instead). – dmckee Jul 3 '13 at 14:39
Depending on how you count, there are 2 scalar evolution eqns., 2 vector evolution eqns., a scalar constraint, and 3 ancillary vector eqns. (see here). Plus, not demanding high accuracy doesn't free you from the requirement that a working code must avoid all sorts of numerical instabilities to be of any use at all. Simplicity and generality are going to be hard to come by. – Chris White Jul 3 '13 at 14:44
Athena 4.1 is freely available, though written in C and with heavy use of preprocessors – Kyle Kanos Jul 5 '13 at 20:34
You seem to be suggesting that to write your own 2D MHD solver will be easy. It won't. I would start by reading about ideal MHD and Hyperbolic Methods for systems of conservative equations, namely Godunov-type methods. A good scheme to start with would be the HLL solver. I would start by writing a 1D solver for ideal hydro-dynamics, then 1D MHD. once you have a good class (if using C#, or C++) or method base (FORTRAN et al.) then you can extend the solver to work on a 2D grid. The HLL scheme above is very diffusive and thus you should not have to deal with excessive instability issues. – Killercam Sep 3 '13 at 11:11