- Timestamp:
- Nov 22, 2004, 5:29:10 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/wind_example_variable.py
r610 r612 13 13 #Create basic mesh 14 14 N = 80 15 len = 10016 points, vertices, boundary = rectangular(N, N, len , len)15 length = 100 16 points, vertices, boundary = rectangular(N, N, length, length) 17 17 18 18 #Create shallow water domain … … 35 35 Low speeds at center and edges 36 36 """ 37 38 from math import sqrt, exp, cos, pi 39 40 N = len(x) 41 s = 0*x #New array 42 43 c = (length/2, length/2) 37 44 38 from math import sqrt, exp, cos, pi 39 40 c = (len1/2, len2/2) 41 r = sqrt((x - c[0])**2 + (y - c[1])**2) 45 for k in range(N): 46 r = sqrt((x[k] - c[0])**2 + (y[k] - c[1])**2) 42 47 43 r /= max(len1,len2)48 r /= max(length,length) 44 49 45 factor = exp( -(r-0.15)**2 )50 factor = exp( -(r-0.15)**2 ) 46 51 47 #print x,y,factor52 s[k] = 4000 * factor * (cos(t*2*pi/150) + 2) 48 53 49 return 4000 * factor * (cos(t*2*pi/150) + 2)54 return s 50 55 51 56 … … 55 60 from math import sqrt, atan, pi 56 61 57 c = (len1/2, len2/2) 58 r = sqrt((x - c[0])**2 + (y - c[1])**2) 62 N = len(x) 63 a = 0*x #New array 64 65 c = (length/2, length/2) 66 for k in range(N): 67 r = sqrt((x[k] - c[0])**2 + (y[k] - c[1])**2) 68 69 xx = (x[k] - c[0])/length 70 yy = (y[k] - c[1])/length 71 72 angle = atan(yy/xx) 73 74 if xx < 0: 75 angle+=pi #atan in ]-pi/2; pi/2[ 76 77 #Take normal direction 78 angle -= pi/2 59 79 60 xx = (x - c[0])/len1 61 yy = (y - c[1])/len2 80 #Ensure positive radians 81 if angle < 0: 82 angle += 2*pi 62 83 63 angle = atan(yy/xx) 64 65 if xx < 0: 66 angle+=pi #atan in ]-pi/2; pi/2[ 67 68 #Take normal direction 69 angle -= pi/2 70 71 #Ensure positive radians 72 if angle < 0: 73 angle += 2*pi 74 75 return angle/pi*180 84 a[k] = angle/pi*180 85 86 return a 76 87 77 88 … … 82 93 def gust(x,y,t): 83 94 from math import sin, pi 95 from Numeric import zeros, ones, Float 96 97 N = len(x) 84 98 85 99 tt = sin(2*pi*t/200) 86 100 87 101 if tt > 0.9: 88 return 6000*tt 102 return 6000*tt*ones(N, Float) 89 103 else: 90 return 0104 return zeros(N, Float) 91 105 92 106 domain.forcing_terms.append(Wind_stress(gust, 25))
Note: See TracChangeset
for help on using the changeset viewer.