Last change
on this file since 2869 was
2869,
checked in by sexton, 18 years ago
|
updates to slump/slide formulation and document
|
File size:
1.4 KB
|
Line | |
---|
1 | """ |
---|
2 | Determining maximum of SMF slump surface elevation function. |
---|
3 | Jane Sexton, GA 2006 |
---|
4 | """ |
---|
5 | |
---|
6 | from math import exp, cosh |
---|
7 | import Numeric |
---|
8 | |
---|
9 | # Grilli and Watts 2005 example |
---|
10 | dx = 2.0 |
---|
11 | x0 = 10.0 |
---|
12 | y0 = 0.0 |
---|
13 | w = 2.0 |
---|
14 | kappa = 3 |
---|
15 | g = 9.8 |
---|
16 | d = 0.259 |
---|
17 | T = 0.052 |
---|
18 | theta = 15.0 |
---|
19 | lam0 = 5.0 |
---|
20 | |
---|
21 | def func(x,y,kappad): |
---|
22 | numerator = exp(-((x-x0)/lam0)**2.0) - kappad*exp(-((x-dx-x0)/lam0)**2.0) |
---|
23 | denominator = cosh(kappa*(y-y0)/(w+lam0))**2.0 |
---|
24 | return -numerator/denominator |
---|
25 | |
---|
26 | def dfuncdx(x,kappad): |
---|
27 | dfdx = (x-x0)*exp(-((x-x0)/lam0)**2.0)-kappad*(x-dx-x0)*exp(-((x-dx-x0)/lam0)**2.0) |
---|
28 | return dfdx |
---|
29 | |
---|
30 | step = 0.001 |
---|
31 | x = x0 |
---|
32 | deriv = 10 |
---|
33 | tol = 0.001 |
---|
34 | c = 0 |
---|
35 | direction = 'positive' |
---|
36 | while c < 100000 and deriv > 0: |
---|
37 | deriv = dfuncdx(x,1.0) |
---|
38 | if deriv < 0: xstar = x |
---|
39 | if direction == 'positive': x += step |
---|
40 | if direction == 'negative': x -= step |
---|
41 | c += 1 |
---|
42 | |
---|
43 | print 'location of maximum of surface elevation function: xstar = %f' % (xstar/lam0) |
---|
44 | const = 1.0 #a3D = ? #sydney = 86? and kappad=1 |
---|
45 | |
---|
46 | x = arange(-20,25,0.001) |
---|
47 | y = arange(-10,10,0.1) |
---|
48 | X,Y = meshgrid(x,y) |
---|
49 | |
---|
50 | test = 0.0 |
---|
51 | for xi in x: |
---|
52 | testi = func(xi,0.0,1.0) |
---|
53 | if direction == 'positive': |
---|
54 | if testi > test: |
---|
55 | test = testi |
---|
56 | xstar = xi |
---|
57 | else: |
---|
58 | if testi < test: |
---|
59 | test = testi |
---|
60 | xstar = xi |
---|
61 | |
---|
62 | print 'check: xstar = %f and eta(xstar) = %f' %(xstar/lam0, test) |
---|
Note: See
TracBrowser
for help on using the repository browser.