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.
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?
@Hwang : I'm glad the code was of help to you.
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.
I learned the pseudocode at the BU's CFD course and this is helpful for me. Thanks. Maybe you can share more like this.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.