1 | import math
|
---|
2 | import numpy as np
|
---|
3 |
|
---|
4 | xmin = 0 #Left Boundary
|
---|
5 | xmax = 1 #Right Boundary
|
---|
6 | dx = .01 #stepsize
|
---|
7 | t_final = .25 #Final time in Computational Units
|
---|
8 | gamma = 1.4
|
---|
9 | CFL = .05
|
---|
10 | npts = int((xmax - xmin)/dx)
|
---|
11 | frames = 1 #number of data prints
|
---|
12 | Q_TOL = 2 #tolerance level for AIRS
|
---|
13 |
|
---|
14 |
|
---|
15 | def init_grid():
|
---|
16 | U = np.zeros((npts, 3))
|
---|
17 | #From here on is user defined initial conditions
|
---|
18 | #U[i, :] is defined as [density, velocity, pressure]
|
---|
19 | UL0 = np.array([1.0,0.75,1.0])
|
---|
20 | UR0 = np.array([.125, 0.0, .1])
|
---|
21 | x0 = .5
|
---|
22 | for i in range(npts):
|
---|
23 | for j in range(3):
|
---|
24 | if (i*dx) < x0:
|
---|
25 | U[i,j] = UL0[j]
|
---|
26 | else:
|
---|
27 | U[i,j] = UR0[j]
|
---|
28 | return U, t_final, frames
|
---|