Version 1 (modified by 12 years ago) ( diff ) | ,
---|
Program Outline
Program reads in vars: 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 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.
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.