Lectures Location Computer labs
Tue 5–6 pm; Thu 5–6 pm Valley Life Sciences 2060 Most labs are on Wednesday. See UCB’s schedule of classes for times and locations.

Name Contact Office hours
Instructor Burkhard Militzer militzer@berkeley.edu Tue 6–7 pm
GSI Salma Ahmed salma_ahmed@berkeley.edu tbd
GSI Youssef Miled youssef_miled@berkeley.edu tbd

This course offers a general introduction to computer simulations for all science majors. Participants will use the Jupyter notebooks to perform calculations, design 3D graphics, and build on existing computer programs. No prior programming experience is required. The course teaches fundamental skills for scientists and helps students with future homework. It covers data processing techniques as well standard simulations methods including Monte Carlo and molecular dynamics. The algorithms are illustrated with a variety of applications in earth and planetary science as well as astronomy.

Check out our YouTube channel.

Check out the animations made by students of our fall 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020, 2021, 2022, and 2023 classes. For a quick scan, see the collection of titles from past projects.

Selected computer lab exercises and homework assignments form our Python class in 2018

In 2018, the class switched from using Matlab to Jupyter notebooks. While there appears to be a general trend in that direction, the real motivation was the fact that all our students' Matlab codes would stop working once they left the university and their relatively inexpensive Matlab student licenses would expire.

To do the following Jupyter exercises, we recommend:

  1. Install Anaconda on your Mac or PC.
  2. Make a new directory Jupyter in your home directory and place any data files like ice_core_temperature_data.txt there.
  3. Start Jupyter from a terminal:
    cd ~/Jupyter
    jupyter lab
  4. Start a new notebook (File → New notebook) and step-by-step paste the commands for the first lab assignment Intro_to_python_05.pdf. Press Shift + Return each time.
2018 Python assignments
Type of assignment Description Files
Lab 1 Getting to know Jupyter notebooks Intro_to_python_05.pdf
ice_core_temperature_data.txt
Homework 1 Simple calculations with Jupyter notebooks hw01_course_intro13.pdf
ice_core_CO2_data.txt
Lab 2 Pixel graphs and filling matrices pixel_graphics12.pdf
topography_180x360_grid.txt
Homework 2 Practice making a smiley hw02_pixel_graphics_13.pdf

In this course, we generate a number of simple animations and store them as MP4 files. Two examples—wave1d.ipynb and wave2d.ipynb—use the FFMPEG package in combination with the screen grab function.

Computer lab exercises and homework assignments from our Matlab class in 2016

2016 Matlab assignments
Type of assignment Description Files
Lab 1 Getting to know Matlab: vectors and matrices lab01_Matlab_intro.pdf
Homework 1 Getting to know Matlab: loops and plots hw01_Matlab_intro.pdf
Lab 2 Pixel graphics and ocean volume lab02_pixel_and_ocean_volume.pdf
example.m
topography_18x18_grid.txt
topography_180x360_grid.txt
Homework 2 Pixel graphics and ocean volume hw02_pixel_and_ocean_volume.pdf
Lab and homework 3 Logistic map lab_hw03_logistic_map.pdf
run_sin2.m
sin2.m
Lab 4 Mandelbrot set lab04_Mandelbrot.pdf
mandelbrot.m
Homework 4 San Andreas fault, Mandelbrot and Newton fractals hw04_San_Andreas_fault_and_Mandelbrot.pdf
san_andreas.m
SA_fault.txt
CA_coast_line.txt
plate.txt
CA_coast_line_no_islands.txt
Lab and homework 5 Diffusion limited aggregation lab05_DLA.pdf
hw05_DLA.pdf
diffusion_limited_aggregation2D_lab01.m
Lab and homework 6 Stationary state of heat equation lab06_heat.pdf
hw06_heat.pdf
Lab and homework 7 Solving the 1D heat equation in real time. Cooling of a lava dike lab07_heat_real_time.pdf
hw07_cooling_lava.pdf
Lab and homework 8 Solving the 2D heat equation and animations lab08_2D_heat.pdf
hw08_2D_heat.pdf
Lab 9 Landscape evolution model lab09_erosion.pdf
erosion_lab_start.m
calculate_collection_area2.m
pool_check8.m
Homework 9 Erosion of a landscape you created hw09_erosion.pdf
erosion_ocean07.m
calculate_collection_area2.m
pool_check10.m
initial_conditions_add_hill.m
Lab 10 Shallow water waves lab10_water_waves.pdf
waterwaves03.m
Homework 10 Waves over a mid-ocean ridge hw10_water_waves04.pdf
waterwave10.m
Lab and homework 11 Tadpole and horseshoe orbits lab11_kepler.pdf
hw11_tadpole_horseshoe_orbits.pdf
run_kepler_ode.m
kepler_ode.m
Homework 12 Image processing hw12_image_processing.pdf
HW12.zip
Lab and homework 13 Chaos in dynamical systems: Rössler attractor lab_hw_13_roessler_attractor08.pdf

Grade assignment

The final grade will be calculated using the following percentages:

Course description

Computer simulations in Earth and Planetary Sciences (4 units) Two hours of lecture and two hours of computer lab exercises. Prerequisites: Math 1A or equivalent. Introduction to modern computer simulation methods and their application to selected Earth and Planetary Science problems. In hands-on computer labs, students will learn about numerical algorithms, learn to program and modify provided programs, and display the solution graphically. This is an introductory course and no programming experience is required. Examples include fractals in geophysics, properties of materials at high pressure, celestial mechanics, and diffusion processes in the Earth. Topics range from ordinary and partial differential equations to molecular dynamics and Monte Carlo simulations.

Motivation

Computer simulations have become an integral part of Earth and Planetary Science (EPS) but students arrive on campus with very different levels of computational skills. This course teaches the fundamental computational methods and their application in EPS. These skills are needed for later course work and research.

Selected examples for computer simulations that may be discussed in this course

Click on the following images to start the animations. Large files (up to ~1.3 GB) may be better downloaded and played locally (with e.g. the VLC player).

Exoplanet orrery : simulations of exoplanetary orbits

Exoplanets animation 25 thumbnail
Exoplanet animation 25
Exoplanets animation 29 thumbnail
Exoplanet animation 29
Exoplanets animation 33 thumbnail
Exoplanet animation 33
Exoplanets animation 34 thumbnail
Exoplanet animation 34
Exoplanets animation 36 thumbnail
Exoplanet animation 36
Exoplanets animation 37 thumbnail
Exoplanet animation 37
Exoplanets animation 42 thumbnail
Exoplanet animation 42
Exoplanets animation 39 thumbnail
Exoplanet animation 39
Exoplanets animation 40 thumbnail
Exoplanet animation 40
Exoplanets animation 43 thumbnail
Exoplanet animation 43

Click on the images to start the animations. Here are links to additional exoplanet animations: 11, 12, 13, 14, 15, 17, 19, 20.

Animations of filled Apollonian gasket fractals

Apollonian gasket #20
Apollonian gasket #19
Apollonian gasket #11
Apollonian gasket #19 high res
Apollonian gasket #15
Apollonian gasket #20 medium
Apollonian gasket #13
Apollonian gasket #14
Apollonian gasket #19 1440p
Apollonian gasket #12
Apollonian gasket #17
Apollonian gasket #20 480p

Click on the images to start the animations.

Modified diffusion limited aggregation to grow compact structures

DLA compact structure A34 0.01
Mobility=0.01
DLA compact structure A34 0.02
Mobility=0.02
DLA compact structure A34 0.05
Mobility=0.05
DLA compact structure A34 0.1
Mobility=0.1
DLA compact structure A34 0.2
Mobility=0.2
DLA compact structure A34 0.5
Mobility=0.5
DLA compact structure A34 1
Mobility=1
DLA compact structure A34 2
Mobility=2
DLA compact structure A34 5
Mobility=5
DLA compact structure A34 10
Mobility=10
DLA compact structure A34 20
Mobility=20
DLA compact structure A34 50
Mobility=50

Diffusion limited aggregation with two species

Two-species DLA example 5
#5
Two-species DLA example 6
#6
Two-species DLA example 7
#7
Two-species DLA example 10
#10

Series of Newton fractals and animations

Newton fractal 30 #1
30‑1
Newton fractal 30 #14
30‑14
Newton fractal 30 #22
30‑22
Newton fractal 30 #40
30‑40
Newton fractal 30 #66
30‑66
Newton fractal 30 #71
30‑71
Newton fractal 30 #99
30‑99
Newton fractal 30 #119
30‑119
Newton fractal 20 #1
20‑1
Newton fractal 20 #16
20‑16
Newton fractal 20 #31
20‑31
Newton fractal 20 #46
20‑46
Newton fractal 20 #61
20‑61
Newton fractal 20 #76
20‑76
Newton fractal 20 #81
20‑81
Newton fractal 20 #104
20‑104
Newton fractal 21 #1
Newton fractal 1
Newton fractal 21 #17
Newton fractal 17
Newton fractal 21 #34
Newton fractal 34
Newton fractal 21 #51
Newton fractal 51
Newton fractal 21 #68
Newton fractal 68
Newton fractal 21 #85
Newton fractal 85
Newton fractal 21 #102
Newton fractal 102
Newton fractal 21 #119
Newton fractal 119
Newton fractal 36 #74
Newton fractal 74
Newton fractal 36 #129
Newton fractal 129
Newton fractal 36 #156
Newton fractal 156
Newton fractal 36 #168
Newton fractal 168
Newton fractal 36 #198
Newton fractal 198
Newton fractal 36 #211
Newton fractal 211
Newton fractal 36 #219
Newton fractal 219
Newton fractal 36 #255
Newton fractal 255

Animations: one, two, three, four, and five.

Newton animation frame 1
Newton animation
Newton animation frame 31
Newton animation
Newton animation frame 86
Newton animation
Newton animation frame 107
Newton animation

2D Monte Carlo simulations of Ising spin magnets

Ising model T=1.3 stripes
T=1.3 stripes
Ising model T=1.4
T=1.4
Ising model T=1.6
T=1.6
Ising model T=1.7
T=1.7
Ising model T=1.8
T=1.8
Ising model T=1.9
T=1.9
Ising model T=2.5
T=2.5
Ising model T=5.0
T=5.0
Ising model T=0.3, magnetization constraint
T=0.3, mag=50%
Ising model T=0.5, magnetization constraint
T=0.5, mag=50%
Ising model T=0.7, magnetization constraint
T=0.7, mag=50%
Ising model T=1.0, magnetization constraint
T=1.0, mag=50%
Ising model T=1.3 stripes, magnetization constraint
T=1.3 stripes, mag=50%
Ising model T=1.3 stripes, magnetization constraint
T=1.3, mag=50%
Ising model T=1.3 stripes, magnetization constraint
T=1.3, mag=50%
Ising model T=1.3 stripes, magnetization constraint
T=1.3, mag=50%
Ising model T=1.3 stripes, magnetization constraint
T=1.3, mag=50%

Additional examples discussed in this course

Triangular fractal animation thumbnail
Triangular fractal (select image to start movie)
Aggregation in 3D animation thumbnail
Aggregation in 3D (select image to start movie)
Mandelbrot set animation thumbnail
Mandelbrot fractal (select image to start movie)
Julia set animation thumbnail
Julia set (select image to start movie)
Miro-inspired animation, low-resolution preview
In the footsteps of Joan Miró (higher resolution, left and right)
Mondrian-inspired animation thumbnail
In the spirit of Piet Mondrian (higher resolution)

Landscape evolution model, three example outputs
Landscape evolution model (code written by former EPS109 student Jeff Prancevic). Three movies for different models are available: movie 1, movie 2, and movie 3.
Hill erosion model animation thumbnail
A different landscape evolution model. Select the image to start the animation.
Landscape evolution model rewritten in Python, still image
Landscape evolution model rewritten in Python. Select the image to start the animation.
Shallow water wave over mid-ocean ridge, animation
Water wave traveling along a mid-ocean ridge. Numerical solution of the shallow water wave equation. Start animations 1
Shallow water wave over mid-ocean ridge, animation
Numerical solution of the shallow water wave equation. Start animations 2

Syllabus

Date Lecture topic Computer lab exercises
Thu 8/27 1: Introduction of course, historical overview, interplay of experiments, theory, and simulation Lab 1: Matlab as a pocket calculator
Tue 9/1 2: Fractals in nature, models and computer simulations, fractal dimension and examples in topography and coast line structure Lab 2: Loops and plots in Matlab
Thu 9/3 3: Mandelbrot set and related fractals
Tue 9/8 4: Random walks and diffusion limited aggregation (DLA), percolation theory Lab 3: Programming the Mandelbrot and Julia set
Thu 9/10 5: Group discussion on fractals
Tue 9/15 6: Numerical algorithms for finding roots and minima Lab 4: DLA in 2D on a flat sheet
Thu 9/17 7: Introduction to time independent partial differential equations (PDE), algorithms and stationary state of 1D heat equation
Tue 9/22 8: Methods to find the stationary state of 2D heat equation Lab 5: Heat equation solver in 2D
Thu 9/24 9: Time dependent PDEs, diffusion equation (heat and chemical diffusion), solution of the 1D heat equation, cooling of a lava dike
Tue 9/29 10: Landscape erosion models Lab 6: Perron’s erosion model
Thu 10/1 11: Wave equations and numerical solutions
Tue 10/6 12: Shallow water wave equation, tsunamis Lab 7: 3D water wave simulations
Thu 10/8 Midterm
Tue 10/13 13: Introduction to ordinary differential equations, Euler’s method Lab 8: Keplerian orbits
Thu 10/15 14: Newton’s law of motion, Keplerian orbits
Tue 10/20 15: Planetary orbits, Hohmann transfers, spacecraft trajectories Lab 9: Lagrange points
Thu 10/22 16: Runge–Kutta method
Tue 10/27 17: Lagrange points, horseshoe and tadpole orbits of asteroids Lab 10: Exercise on tadpole and horseshoe orbits
Thu 10/29 18: Strange attractors
Tue 11/3 19: Chaotic dynamical systems and Lyapunov exponents Lab 11: Rössler attractor
Thu 11/5 20: Simple models for climate change
Tue 11/10 21: Molecular dynamics (MD) Lab 12: Box model for climate change
Thu 11/12 22: Crystal structures, simulations in periodic boundary conditions
Tue 11/17 23: Many particle simulations Lab 13: Molecular dynamics I
Thu 11/19 24: Thermodynamic equilibrium, different states of matter
Tue 11/24 25: Introduction to Monte Carlo (MC) simulations Lab 14: Molecular dynamics II
Thu 11/26 Holiday
Tue 12/1 26: Applications of MC simulations Lab 15: Comparison of MC and MD
Thu 12/3 27: Curve fitting using the least-squares method, revisions, and exam preparations
Tue 12/8 28: Students present their movie projects, part A Lab 16: Students present their movie projects, part B

Reading physical books appears to be a thing of the past. Still here is a lists of books that we found useful:

C. B. Moler, “Numerical Computing with Matlab”, Society for Industrial and Apllied Mathematics (SIAM) Philadelphia, 2004, QA 297 M625 2004 ENGI, pages 14, 120, 187, 203, available online: http://www.mathworks.com/moler/index.html

Fractals:

(*) H.-O. Peitgen, D. Saupe (ed), The Science of Fractal Images”, Springer Verlag 1988, QA 614 .86 S351 1998 MATH, pages 40, 44, 50, 147, 155,

(*) D. L. Turcotte, “Fractals and Chaos in Geology and Geophysics”, Cambridge, U.K. ; New York : Cambridge University Press, 1997, page 14, 22,45, 59, 69, 71, 91, 97, 149, 201, 235, 299

H.-O. Peigten, H. Jurgens, D. Saupe, “Fractals for the Classroom Part II Complex Systems and Mandelbort Set”, Springer 1992, QA 614 .86 P45 1992 v.2 MATH, pages 27. 58, 127, 199, 304, 318, 381, 401, 420, 446, 453.

(*) B. B. Mandelbrot, “The Fractal Geometry of Nature”, W.H. Freeman and Co. NY 1983,  QA 447 M357 1983 MATH, pages 30, 112,

D.J. Higham, N. J. Highham, “Matlab Guide”. Society for Industrial and Apllied Mathematics (SIAM) Philadelphia, 2000, QA 297 H5217 2000 ENGI, pages 14, 17, 90, , 132, 178, 221, 246.

A. Stanoyevitch, “Introduction to MATLAB with Numercial Preliminaries” Wiley 2004, TA 345 S75 2004 ENGI, pages 177.

J. Feder, “Fractals” Plenuym Press, NY, 1988, QA 447 F371 1998 MATH.

Ordinary Differential Equations, Molecular Dynamics, Solar System Dynamics:

J.H. Mathews, K.D. Fink, “Numerical Methods Using Matlab”, 4th edition, Pearson Education Inc., 2004, QA 297 M39 2004 ENGI, pgaes: 262, 418, 434, 465, 496, 505, 544, 557, 567,

J. B. Marion, S. T. Thornton, “Classical Dynamics of particles and systems”, Saunders College Publishing, Fort Worth Philadelphia.

C.D. Murray, S.F Dermott, “Solar Systems Dynamics”, Cambridge University Press, 1999.

I. De Pater, J.J. Lissauer, “Planetary Science”, Cambridge University Press, 2001.

M. P. Allen, D.J. Tildesley, “Computer Simulations of Liquids”, Oxford University Press.

S. Nakamura, “Numerical Analysis and Graphic Visualization with Matlab” 2nd edition, Prentice Hall PTR 2001, T 385 N34 2002 ENGI, pages 63, 302, 385, 396, 453, 465.

W. J. Palm III, “Introduction to Matlb 6 for Engineers”, McGraw-Hill, 2001, TA 345 P35 2001 ENGI, pages  452.

H. B. Wilson, L. H Turcotte, “Advanced Mathematics and Mechanics Applications Using Matlab”, 2nd edition, CRC Press 1997, TA 354 W55 1997 ENGI, pages: 271, 352, 382.

A.H.Nayfeh, B. Balachandram, “Applied Nonlinear Dynamics, Analytical Computational, and Experimental Maethods”, Wiley, QA 845 N39 1994 ENGI.

E. A. Jackson, “Perspectives of Non-linear Dynamics”, Cambridge University Press, 1989, QA 845 J28 1989 V.1 ENGI

V.S. Anishchenko, V. Astakhov, A. Neiman, T. Vadivasova, L. Schimansky-Geier, “Nonlinear Dynamics of Chaotic and Stochastic Systems” Springer 2007, QA 845 .N667 2007 ENGI, pages 110.

Monte Carlo:

M. H. Kalos, P. A. Whitlock, “Monte Carlo Methods”, John Wiley & Sons, NY.

Partial Differential Equations:

D. L. Turcotte and G. Schubert, “Geodynamics”, Cambridge ; New York : Cambridge University Press, 2002.

X.-S. Yang, “An Introduction to Computational Engineering with Matlab”, Cambridge International Science Publishing, 2006, TA 345 Y36 2006 ENGI, pages 33, 53, 57, 79, 224

W. E. Boyce, R. DiPirma, “Elementary Differential Equations and Boundary Value Problems”, Textbook, John Wiley & Sons, NY.

Climate:

K. Mcguffie, A. Henderson-Sellers, “A Climate modeling Primer”, Wiley 1997, QC 981 M482 1997 EART, page 85