Skip Navigation
Jack Baskin School of EngineeringUC Santa Cruz

AMS 227 Winter, Fall 2016


As a complement to the course, we will be using the Dedalus code to run some numerical experiments. This is completely voluntary -- you do not need to do it if you do not want to. However, it's nice to see how things work in practice, in addition to seeing the theory. Dedalus will help you do that.


To get started with Dedalus, see http://dedalus-project.org


Installation instructions. You have two options:

  • Installation on your own laptop
  • Using the pre-installed version on the SOE computers

If you want to install it on your laptop, please see the installation instructions. By experience, it's reasonably easy to install it on a Mac as long as you do the manual install , and already have Homebrew installed. Good luck with anything else, as I have not had much luck.


Eric Shell, together with the developers of Dedalus, very kindly installed it on the SOE machines Jerez and Muscat. To use the installation from these machines, here is what you have to do.

  • If you are not an SOE student, you first have to get an SOE account. To do so, please fill in the online application form. Most of it is self-explanatory. Please select "Graduate Student" or "Undergraduate student" accordingly to describe who you are. please select "Applied Mathematics and Statistics" as the department that should be associated with the account. Please select me (Pascale Garaud) as the sponsoring faculty. You should get an account reasonably shortly.
  • Once you have an account, please log in to jerez.soe.ucsc.edu or muscat.soe.ucsc.edu
  • In your home directory, or elsewhere, create a directory called dedalus, or some obvious name.
  • Go to that directory, and do cp -r /share/local/dedalus/src/dedalus/examples .
  • This will create a directory called examples, and populated with already-made examples for Dedalus. These examples are discussed in the online documentation linked above.
  • Before you can run anything, you'll have to type (each time), source /share/local/dedalus/bin/activate.csh or put this in your .login or .bashrc or .cshrc or .profile (whichever one you use).

Once you have installed Dedalus and linked everything properly as above, you can now try to run some of the examples.


  • First try the 1d KdV equation (located in examples/ivp/1d_kdv_burgers). You should be able to run it easily by typing python3 kdv_burgers.py and obtain a nice figure as kdv_burgers.png
  • Next, try the 2D Rayleigh Benard problem (located in examples/ivp/2d_rayleigh_benard). Again, you should be able to run it by typing python3 rayleigh_benard.py . This time, the script does not create an image by default, but stores the data in files that can be used to create snapshots, for instance. To do that, use the other script provided, typing python3 plot_2d_series.py snapshots/snapshots_s1/snapshots_s1_p0.h5 . This reads the data stored in the snapshots directories, and creates images that are stored in the new directory called frames. You can also do the same with the snapshots stored in the snapshot/snapshot_s2 directory (for later-time behavior). Some examples of what you should be getting are write_000030.png and write_000060.png
  • .
Once you have all of these working as they should, you can now move on to some of the suggested practice problems below.

Problem set 1
  • Problem 1: Modify the 1D KdV script to solve the wave equation in 1D, starting from Gaussian initial conditions. Try to understand what each parts of the script does. Plot both the pressure field, and the velocity field, and create somethign that resembles the following figures: ufield.png and pfield.png . Hand in your script and your figures.
  • Problem 2: Modify the 2D Rayleigh-Benard script to solve the 2D wave equation with constant sound speed, in a square of size (10,10), with periodic boundary conditions in x and z. As an initial condition, assume zero velocity field, and a pressure field that is a Gaussian wave packet of the kind p(x,z) = cos(10x+10z)exp(-(x2+z2)/0.4). Create a movie, or some frames, of the solution. Here is an examples of what you may get:
If you have problems: (1) see if your timestep is not too big. (2) see if your resolution is high enough (3) ask me.