5 | | 1. 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 sampled that is a function of the domlen. In test 1, u(i) is the velocity of the i-th position along the Gaussian, with the first position being x=dx. In test 2, u(i) = ith position along grid with first position x = 0. I don't think the difference here is important. |
| 5 | 1. 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. In test 1, u(i) is the velocity of the i-th position along the Gaussian, with the first position being x=dx. In test 2, u(i) = ith position along grid with first position x = 0. I don't think the difference here is important. |
| 6 | |
| 7 | 2. After initialization, the program begins the time evolution of the initial condition. !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, d) updates the cells along the grid using a conservation formula, and finally 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. |