### Program Outline

This program is for solving the Inviscid Burger's equation, a non-linear PDE in x, using the Godunov method. The program follows the following outline.

- Read in variables such as: domlen, tfinal, cflcoeff (used for calc timestep give max speed on grid), mx, test (type of initial condition), maxitr (how many iterations should code do to try and advance solution to tfinal?), nfreq (controls how many time states should be output).

- Initialize the 1-D grid. Pass in the number of cells to Init routine. Init initializes the large (>> number of cells for safety) arrays of u (an array of velocity for each cell) and flux to be 0. Init then checks which test is being used. If test 1 is being used, Init samples a Gaussian function centered on 0, on a domain from -1 to 1 to assign values to u. If test 2 is used, a step function is set up that is a function of the domlen. Next, the grid cells are labeled i =1, mx, so there are a total of mx cells on the grid. The ghost cells flank these cells and are labeled by i = 0 and i = mx+1. They are important so a flux can be calculated on both sides of the bounding cells.

- Next, the program begins the time evolution of the initial condition, by updating each cell on the grid based on the conservation law. timeNow = 0.0, and a do-loop is entered that a) updates the ghost cells with a periodic boundary condition, b) figures out the dt to advance the simulation by considering a stable cfl condition for this scheme, c) computes the fluxes across inter-cell boundaries by solving the local Riemann Problem (F(i) = 0.5*ustar*ustar is flux between ith and ith+1 cell), d) updates the cells along the grid using a conservation formula, and finally e) checks if the final time has been reached - at which point if it has, the code stops and prints out final values, and if not, proceeds through the loop again until either the former is true or the max number of iterations has been reached.

Note, the program does not explicitly use the time in any subroutine. It is just used in the main body of the program to determine if the end of the iterations (i.e. tfinal satisfied) has been reached. If timenow + dt DNE tfinal, the program iterates through, setting the BC's to get the ghost cell values, so that a flux can be calculated for each side of each cell, getting the timestep to be used in the update subroutine, calculating the fluxes to be used in the update routine, then updating the mesh. Applying the conservation law to update cells repeats until tfinal has been reached or the max iterations have.

### Readable version of code

### Results

### Attachments (1)

- Burgers.png (41.0 KB ) - added by 12 years ago.

Download all attachments as: .zip

**Note:**See TracWiki for help on using the wiki.