Changes between Version 81 and Version 82 of u/erica/GudonovMethodEuler


Ignore:
Timestamp:
05/08/13 12:01:34 (12 years ago)
Author:
Erica Kaminski
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • u/erica/GudonovMethodEuler

    v81 v82  
    142142I ran into issues with the original revisions of this code. I started debugging by first adding sequential print statements throughout the code, module, and subroutines, to make sure the routines were called in the correct order, and that values of cells, were being delivered correctly to the various parts of the program. These all checked out. Next I began adding print statements to the iterative scheme, that checked the time step (dt), and the cfl. For the first time step, dt was calculated correctly, and the cfl was also correct. The next thing I checked was that between time = 0 and time = 0 + dt, the values of q were being computed correctly at those cells near the discontinuity where I expected to see non-linear wave formation. I made a spreadsheet of values, and calculated the updated values of q for these cells. Here is a screenshot of that spreadsheet:
    143143
    144 [[Image(GodDebug.png, 35%)]]
     144[[Image(GodDebug.png, 50%)]]
    145145
    146146Using my standard out, I checked the updated values of q I calculated for the cells adjacent to the discontinuity, and it checked out. Running the code again, after the 8th or 9th time step, the code stopped after the Newton Iteration Scheme failed to converge... But everything was being computed correctly! A look at the time by this 8th or 9th time step hinted to a bug... The time was extremely small, at this rate, the simulation wouldn't get done for hundreds and hundreds of time steps. This was wrong. Checking then the cfl, dt, and max speed for the time steps between 2 and 8, provided the answer. Smax was not changing, but the cfl was getting smaller and smaller, decreasing the time step by many factors. I checked the code I was using to set up the cfl coefficient, and found an error in the way I was doing so. I was rewriting the cfl coeff each time, and then re-using this value when I'd ask for 20% of the cfl coeff during those first 5 time steps (see above cfl condition subroutine explanation). I adjusted the code to not do this any more, and sure enough, the code ran smoothly afterward... No more divergence in iteration scheme for pstar, and the code finished with the correct output. Interesting an error that led to divergence in the iteration scheme was produced with such small time steps...