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. Now, 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. |
| 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. 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. |