top of page

Burgers' Equation: Numerical Solver

Background

Near the end of my time at the Center of Advanced Computing and Data Science (CACDS), all Vistas in Advanced Computing students were asked to work on an individual final project to showcase everything we had learned by applying our new skills to solve some problem. Since many of the people at CACDS have interests in fluid mechanics, one of the problems they assigned (to me) was creating a solver for the one-dimensional Burgers' equation.

​

Problem statement

Write a solver for the 1D Burgers' equation using C. The user must be able to vary all parameters, initial conditions, and time/space step size. Output should be made visual. Use a stable scheme that doesn't blow up. 

​

My approach

The equation wasn't quite as simple as some of the other equations we had discretized and programmed, so I had to get some help from the faculty to understand exactly what I was doing. From there, I was able to discretize the FTCS and implicit scheme.

 

Those methods blew up, giving me unusable output. I knew I needed a stable scheme, but I couldn't derive the Crank-Nicholson discretization. However, I was able to find it online, and after verifying its correctness, I implemented  it. So I had 3 different discretization schemes.

​

I wrote the solver code and test suite to enable easy manipulation of parameters. I exported the data in .csv files and wrote a MATLAB script to animate the results. Below, you can view a couple of the animations for the initial condition of a sine wave. The bad case failed because the viscosity was set very high.

​

​

Normal case

Normal case

Play Video
Bad case: blew up

Bad case: blew up

Play Video

​

Additional information

I had just finished my freshman year, so I had just finished taking calculus 1-3. Over the summer in VAC, I learned about finite difference methods and other numerical methods, computer architecture, and good computing practices. 

​

After I wrote the solver, I wanted to easily modify my initial conditions and generally play around with the equations, so I decided to rewrite my code to do this. I wrote the program to import text files with the test information from a folder of all test cases to be run. This allowed me to have a very quick workflow when I knew which tests I wanted to run.

​

A major limitation of my program was the inability for the wave to crest. In the real world, propogating liquids can collapse on themselves (think of an ocean wave). However, since these numerical models are functions, they cannot hold 2 position values at a single x value. For example, in the below picture, my model can predict steps t=0 and t1, but could not calculate t2.

​

burgrers equation.png

​

Potential applications

The focus of the project was not on application, but on getting the numerical code to work. Nonetheless, it is worth noting that Burgers' equation has enjoyed use in traffic-flow modelling, as well as for nonlinear acoustics and gas dynamics. However, it is not a great equation to use for fluid mechanics in general.

​

bottom of page