source: inundation/pyvolution/smf.py @ 1995

Last change on this file since 1995 was 1578, checked in by hitchman, 19 years ago

generate water initial condition caused by submarine mass failure

File size: 11.3 KB
Line 
1#
2# slide_tsunami function
3#
4
5"""This function returns a callable object representing an initial water
6   displacement generated by a submarine sediment slide.
7
8Using input parameters:
9
10Required
11 length  downslope slide length
12 depth   water depth to slide centre of mass
13 slope   bathymetric slope
14
15Optional
16 x0      x origin (0)
17 y0      y origin (0)
18 alpha   angular orientation of slide in xy plane (0)
19 w       slide width (0.25*b)
20 T       slide thickness (0.01*b)
21 g       acceleration due to gravity (9.8)
22 gamma   specific density of sediments (1.85)
23 Cm      added mass coefficient (1)
24 Cd      drag coefficient (1)
25 Cn      friction coefficient (0)
26 psi     (0)
27 dx      offset of second Gaussian (0.2*width of first Gaussian)
28 kappa   multiplier for sech^2 function (3.0)
29 kappad  multiplier for second Gaussian function (0.8)
30 zsmall  an amount near to zero (0.01)
31
32The following parameters are calculated:
33
34 a0      initial acceleration
35 ut      theoretical terminal velocity
36 s0      charactistic distance of motion
37 t0      characteristic time of motion
38 w       initial wavelength of tsunami
39 a2D     2D initial amplitude of tsunami
40 a3D     3D initial amplitude of tsunami
41
42The returned object is a callable double Gaussian function that represents
43the initial water displacement generated by a submarine sediment slide.
44
45Adrian Hitchman
46Geoscience Australia, June 2005
47"""
48
49def slide_tsunami(length, depth, slope, width=None, thickness=None, \
50                  x0=0.0, y0=0.0, alpha=0.0, \
51                  gravity=9.8, gamma=1.85, \
52                  massco=1, dragco=1, frictionco=0, psi=0, \
53                  dx=None, kappa=3.0, kappad=0.8, zsmall=0.01):
54
55    from math import sin, tan, radians, pi, sqrt, exp
56
57    #if width not provided, set to typical value
58    if width is None:
59        width = 0.25 * length
60
61    #if thickness not provided, set to typical value
62    if thickness is None:
63        thickness = 0.01 * length
64
65    #calculate some parameters of the slide
66
67    sint = sin(radians(slope))
68    tant = tan(radians(slope))
69    tanp = tan(radians(psi))
70
71    a0 = gravity * sint * ((gamma-1)/(gamma+massco)) * (1-(tanp/tant))
72    ut = sqrt((gravity*depth) * (length*sint/depth) \
73                    * (pi*(gamma-1)/(2*dragco)) * (1-(tanp/tant)))
74    s0 = ut**2 / a0
75    t0 = ut / a0
76
77    #calculate some parameters of the water displacement produced by the slide
78
79    w = t0 * sqrt(gravity*depth)
80    a2D = s0 * (0.0574 - (0.0431*sint)) \
81             * (thickness/length) \
82             * ((length*sint/depth)**1.25) \
83             * (1 - exp(-2.2*(gamma-1)))
84    a3D = a2D / (1 + (15.5*sqrt(depth/(length*sint))))
85
86    #a few temporary print statements
87    print '\nThe slide ...'
88    print '\tLength: ', length
89    print '\tDepth: ', depth
90    print '\tSlope: ', slope
91    print '\tWidth: ', width
92    print '\tThickness: ', thickness
93    print '\tx0: ', x0
94    print '\ty0: ', y0
95    print '\tAlpha: ', alpha
96    print '\tAcceleration: ', a0
97    print '\tTerminal velocity: ', ut
98    print '\tChar time: ', t0
99    print '\tChar distance: ', s0
100    print '\nThe tsunami ...'
101    print '\tWavelength: ', w
102    print '\t2D amplitude: ', a2D
103    print '\t3D amplitude: ', a3D
104
105    #keep an eye on some of the assumptions built into the maths
106
107    if ((slope < 5) or (slope > 30)):
108        print 'WARNING: slope out of range (5 - 30 degrees) ', slope
109    if ((depth/length < 0.06) or (depth/length > 1.5)):
110        print  'WARNING: d/b out of range (0.06 - 1.5) ', depth/length
111    if ((thickness/length < 0.008) or (thickness/length > 0.2)):
112        print 'WARNING: T/b out of range (0.008 - 0.2) ', thickness/length
113    if ((gamma < 1.46) or (gamma > 2.93)):
114        print 'WARNING: gamma out of range (1.46 - 2.93) ', gamma
115
116    return Double_gaussian(a3D=a3D, wavelength=w, width=width, \
117                           x0=x0, y0=y0, alpha=alpha, \
118                           dx=dx, kappa=kappa, kappad=kappad, zsmall=zsmall)
119
120#
121# slump_tsunami function
122#
123
124"""This function returns a callable object representing an initial water
125   displacement generated by a submarine sediment slump.
126
127Using input parameters:
128
129Required
130 length  downslope slump length
131 depth   water depth to slump centre of mass
132 slope   bathymetric slope
133
134Optional
135 x0      x origin (0)
136 y0      y origin (0)
137 alpha   angular orientation of slide in xy plane (0)
138 w       slump width (1.0*b)
139 T       slump thickness (0.1*b)
140 R       slump radius of curvature (b^2/(8*T))
141 del_phi slump angular displacement (0.48)
142 g       acceleration due to gravity (9.8)
143 gamma   specific density of sediments (1.85)
144 Cm      added mass coefficient (1)
145 Cd      drag coefficient (1)
146 Cn      friction coefficient (0)
147 dx      offset of second Gaussian (0.2*width of first Gaussian)
148 kappa   multiplier for sech^2 function (3.0)
149 kappad  multiplier for second Gaussian function (0.8)
150 zsmall  an amount near to zero (0.01)
151
152The following parameters are calculated:
153
154 a0      initial acceleration
155 um      maximum velocity
156 s0      charactistic distance of motion
157 t0      characteristic time of motion
158 w       initial wavelength of tsunami
159 a2D     2D initial amplitude of tsunami
160 a3D     3D initial amplitude of tsunami
161
162The returned object is a callable double Gaussian function that represents
163the initial water displacement generated by a submarine sediment slump.
164
165Adrian Hitchman
166Geoscience Australia, June 2005
167"""
168
169def slump_tsunami(length, depth, slope, width=None, thickness=None, \
170                  radius=None, dphi=0.48, x0=0.0, y0=0.0, alpha=0.0, \
171                  gravity=9.8, gamma=1.85, \
172                  massco=1, dragco=1, frictionco=0, \
173                  dx=None, kappa=3.0, kappad=0.8, zsmall=0.01):
174
175    from math import sin, radians, sqrt
176
177    #if width not provided, set to typical value
178    if width is None:
179        width = length
180
181    #if thickness not provided, set to typical value
182    if thickness is None:
183        thickness = 0.1 * length
184
185    #if radius not provided, set to typical value
186    if radius is None:
187        radius = length**2 / (8.0 * thickness)
188
189    #calculate some parameters of the slump
190
191    sint = sin(radians(slope))
192
193    s0 = radius * dphi / 2
194    t0 = sqrt((radius*(gamma+massco)) / (gravity*(gamma-1)))
195    a0 = s0 / t0**2
196    um = s0 / t0
197
198    #calculate some parameters of the water displacement produced by the slump
199
200    w = t0 * sqrt(gravity*depth)
201    a2D = s0 * (0.131/sint) \
202             * (thickness/length) \
203             * (length*sint/depth)**1.25 \
204             * (length/radius)**0.63 * dphi**0.39 \
205             * (1.47 - (0.35*(gamma-1))) * (gamma-1)
206    a3D = a2D / (1 + (2.06*sqrt(depth/length)))
207
208    #a few temporary print statements
209    print '\nThe slump ...'
210    print '\tLength: ', length
211    print '\tDepth: ', depth
212    print '\tSlope: ', slope
213    print '\tWidth: ', width
214    print '\tThickness: ', thickness
215    print '\tRadius: ', radius
216    print '\tDphi: ', dphi
217    print '\tx0: ', x0
218    print '\ty0: ', y0
219    print '\tAlpha: ', alpha
220    print '\tAcceleration: ', a0
221    print '\tMaximum velocity: ', um
222    print '\tChar time: ', t0
223    print '\tChar distance: ', s0
224    print '\nThe tsunami ...'
225    print '\tWavelength: ', w
226    print '\t2D amplitude: ', a2D
227    print '\t3D amplitude: ', a3D
228
229    #keep an eye on some of the assumptions built into the maths
230
231    if ((slope < 10) or (slope > 30)):
232        print 'WARNING: slope out of range (10 - 30 degrees) ', slope
233    if ((depth/length < 0.34) or (depth/length > 0.5)):
234        print  'WARNING: d/b out of range (0.34 - 0.5) ', depth/length
235    if ((thickness/length < 0.10) or (thickness/length > 0.15)):
236        print 'WARNING: T/b out of range (0.10 - 0.15) ', thickness/length
237    if ((radius/length < 1.0) or (radius/length > 2.0)):
238        print 'WARNING: R/b out of range (1 - 2) ', radius/length
239    if ((dphi < 0.10) or (dphi > 0.52)):
240        print 'WARNING: del_phi out of range (0.10 - 0.52) ', dphi
241    if ((gamma < 1.46) or (gamma > 2.93)):
242        print 'WARNING: gamma out of range (1.46 - 2.93) ', gamma
243
244    return Double_gaussian(a3D=a3D, wavelength=w, width=width, \
245                           x0=x0, y0=y0, alpha=alpha, \
246                           dx=dx, kappa=kappa, kappad=kappad, zsmall=zsmall)
247
248#
249# Double_gaussian class
250#
251
252"""This is a callable class representing the initial water displacment
253   generated by a submarine mass failure (smf -> sediment slide or slump).
254
255Using input parameters:
256
257Required
258 w       initial wavelength of tsunami
259 a3D     3D initial amplitude of tsunami
260 width   width of smf
261
262Optional
263 x0      x origin of smf
264 y0      y origin of smf
265 alpha   angular orientation of smf in xy plane (0)
266 dx      offset of second Gaussian (0.2*width of first Gaussian)
267 kappa   multiplier for sech^2 function (3.0)
268 kappad  multiplier for second Gaussian function (0.8)
269 zsmall  an amount near to zero (0.01)
270
271Adrian Hitchman
272Geoscience Australia, June 2005
273"""
274
275class Double_gaussian:
276
277    def __init__(self, a3D, wavelength, width, x0, y0, alpha, \
278                 dx, kappa, kappad, zsmall):
279        self.a3D = a3D
280        self.wavelength = wavelength
281        self.width = width
282        self.x0 = x0
283        self.y0 = y0
284        self.alpha = alpha
285        self.kappa = kappa
286        self.kappad = kappad
287
288        if dx is None:
289            self.determineDX(zsmall=zsmall)
290        else:
291            self.dx = dx
292
293    def __call__(self, x, y):
294        """Make Double_gaussian a callable object.
295
296        If called as a function, this object returns z values representing
297        the initial 3D distribution of water heights at the points (x,y)
298        produced by a submarine mass failure.
299        """
300
301        from math import sin, cos, radians, exp, cosh
302        from Numeric import zeros, Float
303
304        #ensure vectors x and y have the same length
305        N = len(x)
306        assert N == len(y)
307
308        am = self.a3D
309        wa = self.wavelength
310        wi = self.width
311        x0 = self.x0
312        y0 = self.y0
313        alpha = self.alpha
314        dx = self.dx
315        kappa = self.kappa
316        kappad = self.kappad
317
318        #double Gaussian calculation assumes water displacement is oriented
319        #E-W, so, for displacement at some angle alpha clockwise from the E-W
320        #direction, rotate (x,y) coordinates anti-clockwise by alpha
321
322        cosa = cos(radians(alpha))
323        sina = sin(radians(alpha))
324
325        xr = ((x-x0) * cosa - (y-y0) * sina) + x0
326        yr = ((x-x0) * sina + (y-y0) * cosa) + y0
327
328        z = zeros(N, Float)
329
330        for i in range(N):
331            try:
332                z[i] =  -am / ((cosh(kappa*(yr[i]-y0)/(wi+wa)))**2) \
333                            * (exp(-((xr[i]-x0)/wa)**2) - \
334                                kappad*exp(-((xr[i]-dx-x0)/wa)**2))
335            except OverflowError:
336                pass
337
338        return z
339
340    def determineDX(self, zsmall):
341        """Determine a suitable offset for the second Gaussian function.
342
343        A suitable offset for the second Gaussian function is taken to
344        be some fraction of the 'width' of the first Gaussian function.
345
346        The 'width' of the first Gaussian is obtained from the range of
347        the x coordinates over which the function takes values from
348        'near zero', through 1, and back to 'near zero'.
349
350        The parameter zsmall passed to this function specifies how much
351        'near zero' is.
352        """
353
354        from math import sqrt, log, e
355
356        a = self.a3D
357        c = self.wavelength
358
359        self.dx = 2.0 * (c * sqrt(-log((zsmall/a),e))) / 5.0
Note: See TracBrowser for help on using the repository browser.