Numerical Methods for ODEs and PDEs

screenshot of my 2D fluid simulation

In this course I studied various methods of numerically simulating several different ODEs and PDEs. The culimation of this course was a numerical solution to a 2D incompressible fluid flow PDE. Begin dirty details: the boundary conditions were Dirichlet in x and periodic in y. The partially periodic boundary conditions allowed me to use the Fast Fourier Transform to solve the system. I implemented both upwind differences and RK2 for advection and achieved desired stability rates. Incompressibility was achieved using the projection method, in which I essentially project the compressible solution down to an incompressible space and subtract out the portion of my solution that accounts for its divergence. End dirty details. Click for a wmv showing it in action. In this video, I show a density field responding to the PDE whose initial conditions consist of negative densities in the upper half of the image and positive densities in the lower half of the image, with a bit of random noise thrown in for fun. Note that there was a gravity term in y, which explains all of the amusing motion. I implemented this in both Matlab and C++ and used Matlab for debugging/convergence testing.