1 | """ This code implements run up solutions to the shallow water wave |
---|
2 | equations. |
---|
3 | |
---|
4 | References: |
---|
5 | Madsen and Fuhrman 2008. Run-up of tsunamis and long waves |
---|
6 | in terms of surf-similarity. Coastal Engineering, 55, p209. |
---|
7 | |
---|
8 | Creator: Jonathan Griffin, Geoscience Australia |
---|
9 | Created: 10 November 2009 |
---|
10 | """ |
---|
11 | |
---|
12 | def Madsen(depth, slope, height, period, gravity = 9.81): |
---|
13 | |
---|
14 | freq = (2*pi)/period |
---|
15 | a = (depth*power(freq,2.0))/(gravity*power(slope,2.0)) |
---|
16 | #print 'a',a |
---|
17 | b = power(a,0.25) |
---|
18 | #print 'b',b |
---|
19 | run_up_madsen = 2*power(np.pi,0.5)*b*height |
---|
20 | |
---|
21 | R_break = gravity*(power(slope,2.0))/(power(freq,2.0)) |
---|
22 | run_up = min(run_up_madsen, R_break) |
---|
23 | return run_up |
---|
24 | |
---|
25 | def surf_sim(depth, slope, height, period, gravity = 9.81): |
---|
26 | wavelength = period*sqrt(gravity*depth) |
---|
27 | print 'wavelength', wavelength |
---|
28 | surf_sim_param = slope/(sqrt(height/wavelength)) |
---|
29 | print 'surf_sim_param', surf_sim_param |
---|
30 | #print 'height',height |
---|
31 | ## print 'depth', depth |
---|
32 | a = 2*(power(pi,(0.75))) |
---|
33 | HA = height/depth |
---|
34 | #print HA |
---|
35 | b = power(HA,-0.25) |
---|
36 | c =power(surf_sim_param,(-0.5)) |
---|
37 | ## print 'a', a |
---|
38 | ## print 'b' ,b |
---|
39 | ## print 'c', c |
---|
40 | R = height*a*b*c |
---|
41 | #R = height*2*(power(pi,(3/4)))*(power((height/depth),(-1/4)))*(power(surf_sim_param,(-1/2))) |
---|
42 | print 'R',R |
---|
43 | R_break = height*(1.0/pi)*power(surf_sim_param,2.0) |
---|
44 | print 'R_break',R_break |
---|
45 | run_up = min(R, R_break) |
---|
46 | ## print 'run_up',run_up |
---|
47 | return run_up |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | def energy_conserv(crest_integrated_energy,theta = 3.,alpha = 2.,gravity = 9.81): |
---|
54 | E = crest_integrated_energy |
---|
55 | print 'crest_integrated_energy', crest_integrated_energy |
---|
56 | a = 1/tan(alpha*pi/180.) |
---|
57 | b = 1/tan(theta*pi/180.) |
---|
58 | |
---|
59 | F = a-b |
---|
60 | # print 'F',F |
---|
61 | R3 = 6.*E/(1000.*gravity*F) |
---|
62 | # print 'R3', R3 |
---|
63 | R = power(R3,(1./3.)) |
---|
64 | |
---|
65 | return R |
---|
66 | |
---|
67 | import numpy as np |
---|
68 | from numpy import sin,tan,cos,power,pi, sqrt |
---|
69 | if __name__ == '__main__': |
---|
70 | sys.exit(main()) |
---|