File Exchange

image thumbnail

Burgers Equation in 1D and 2D

version 1.0 (3.23 KB) by

Simulating the Burgers equation in both 1D and 2D using finite differencing.

21 Downloads

Updated

View License

The 1D Burgers equation is solved using explicit spatial discretization (upwind and central difference) with periodic boundary conditions on the domain (0,2). The 2D case is solved on a square domain of 2X2 and both explicit and implicit methods are used for the diffusive terms. Dirichlet boundary conditions are used along the edges of the domain.

Comments and Ratings (5)

Lisa97

Lisa97 (view profile)

Thanks Suraj for the effort. Unfortunately, I think there is a small error in this script. It is about the periodic boundary condition using the auxiliary variables ip,im. I think ip(nx) should be equal to index 2 ,i.e. ip(nx)=2. For im(1) it should be equal to nx-1, i.e. im(1)=nx-1.

Another issue that I do not understand is the if condition in the solution for loop, I am not sure what is it about, if you can explain?

Suraj Shankar

Suraj Shankar (view profile)

@Hwang : I'm glad the code was of help to you.

Suraj Shankar

Suraj Shankar (view profile)

The code is meant to be pedagogical in nature and has been made in line with the 12-steps to Navier-Stokes practical module, for which I would like to credit Lorena Barba and her online course on CFD.

Hwang

Hwang (view profile)

I learned the pseudocode at the BU's CFD course and this is helpful for me. Thanks. Maybe you can share more like this.

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today