Alfvén waves in one dimension

Fortran code that simulates how nonlinear interaction deforms Alfvén waves in a plasma, with a LaTeX report. I did it on my own in one month, between August and September 2022.

The problem

Alfvén waves are magnetohydrodynamic waves. In the Elsässer variables, Z+ and Z-, they are two waves travelling in opposite directions: if the equation were linear they would cross without disturbing each other, with the nonlinear terms they deform each other. I wanted to see how, by solving the equations myself.

Evolution of Z+ and Z- at five times, with and without nonlinearity

How it works

  1. 01

    The scheme

    Compact finite differences with a Lele filter; the derivatives require solving tridiagonal and pentadiagonal systems. About 525 lines of Fortran in separate modules.

  2. 02

    The report

    It derives the equations in the Elsässer variables and discusses the results (title: "Nonlinear effects on Alfvén waves in one dimension").

  3. 03

    The plots

    Built with gfortran and a Makefile; the plots are made in Python with matplotlib.

Evolution of Z+ and Z- at five times, with and without nonlinearity
Z+ (top) and Z- (bottom) at five times; dashed, the linear solution. At t = 3.48 the profile steepens and steps appear: the filter is needed.
  • What I did

    Everything: the code, the report and the plots. 21 commits.

  • Limits

    It is study code, not an application. I did not compare the results with other codes.

Stack: Fortran (gfortran), Python and matplotlib, LaTeX.