1 | # This is a 1-D Adaptive Riemann Solver, written by Ruka Murugan
|
---|
2 | import sys
|
---|
3 | import problem
|
---|
4 | import solvers
|
---|
5 | import printdata
|
---|
6 | import numpy as np
|
---|
7 |
|
---|
8 | def main():
|
---|
9 | if len(sys.argv) == 2: solver_type = sys.argv[1]
|
---|
10 | else:
|
---|
11 | print error
|
---|
12 | return 0
|
---|
13 | time = 0
|
---|
14 | grid, t_final, frames = problem.init_grid()
|
---|
15 | framecount = 0
|
---|
16 | while time <= t_final:
|
---|
17 | if printdata.check(time, framecount):
|
---|
18 | printdata.printframe(grid, framecount)
|
---|
19 | framecount += 1
|
---|
20 | if framecount > frames: break
|
---|
21 | else: print 'Time error'
|
---|
22 | t_frame = framecount * t_final /frames
|
---|
23 | grid, time = solvers.getUpdate(grid, time, t_frame, solver_type)
|
---|
24 |
|
---|
25 |
|
---|
26 |
|
---|
27 | if __name__ == "__main__":
|
---|
28 | error = "Error, usage is 'python adaptive.py [option]. -1 for Adaptive Iterative, -2 for Adaptive Non-Iterative, -3 for Exact Solver."
|
---|
29 | main()
|
---|
30 |
|
---|