Changeset 613
- Timestamp:
- Nov 22, 2004, 5:34:47 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/shallow_water.py
r612 r613 1026 1026 raise msg 1027 1027 1028 1029 #This is the bit that should be written in C 1030 for k in range(N): 1031 s = s_vec[k] 1032 phi = phi_vec[k] 1033 1034 #Convert to radians 1035 phi = phi*pi/180 1036 1037 #Compute velocity vector (u, v) 1038 u = s*cos(phi) 1039 v = s*sin(phi) 1040 1041 #Compute wind stress 1042 S = self.const * sqrt(u**2 + v**2) 1043 xmom_update[k] += S*u 1044 ymom_update[k] += S*v 1028 assign_windfield_values(xmom_update, ymom_update, 1029 s_vec, phi_vec, self.const) 1030 1031 1032 def assign_windfield_values(xmom_update, ymom_update, 1033 s_vec, phi_vec, const): 1034 """Python version of assigning wind field to update vectors. 1035 A c version also exists for speed 1036 """ 1037 from math import pi, cos, sin, sqrt 1038 1039 N = len(s_vec) 1040 for k in range(N): 1041 s = s_vec[k] 1042 phi = phi_vec[k] 1043 1044 #Convert to radians 1045 phi = phi*pi/180 1046 1047 #Compute velocity vector (u, v) 1048 u = s*cos(phi) 1049 v = s*sin(phi) 1050 1051 #Compute wind stress 1052 S = const * sqrt(u**2 + v**2) 1053 xmom_update[k] += S*u 1054 ymom_update[k] += S*v 1045 1055 1046 1056 -
inundation/ga/storm_surge/pyvolution/wind_example_variable.py
r612 r613 27 27 domain.set_quantity('elevation', 0.0) 28 28 domain.set_quantity('level', 2.0) 29 domain.set_quantity('friction', 0.0 )29 domain.set_quantity('friction', 0.07) 30 30 31 31
Note: See TracChangeset
for help on using the changeset viewer.