# Changeset 613

Ignore:
Timestamp:
Nov 22, 2004, 5:34:47 PM (19 years ago)
Message:

ready for c-extension to be written

Location:
inundation/ga/storm_surge/pyvolution
Files:
2 edited

Unmodified
Removed
• ## inundation/ga/storm_surge/pyvolution/shallow_water.py

 r612 raise msg #This is the bit that should be written in C for k in range(N): s = s_vec[k] phi = phi_vec[k] #Convert to radians phi = phi*pi/180 #Compute velocity vector (u, v) u = s*cos(phi) v = s*sin(phi) #Compute wind stress S = self.const * sqrt(u**2 + v**2) xmom_update[k] += S*u ymom_update[k] += S*v assign_windfield_values(xmom_update, ymom_update, s_vec, phi_vec, self.const) def assign_windfield_values(xmom_update, ymom_update, s_vec, phi_vec, const): """Python version of assigning wind field to update vectors. A c version also exists for speed """ from math import pi, cos, sin, sqrt N = len(s_vec) for k in range(N): s = s_vec[k] phi = phi_vec[k] #Convert to radians phi = phi*pi/180 #Compute velocity vector (u, v) u = s*cos(phi) v = s*sin(phi) #Compute wind stress S = const * sqrt(u**2 + v**2) xmom_update[k] += S*u ymom_update[k] += S*v
• ## inundation/ga/storm_surge/pyvolution/wind_example_variable.py

 r612 domain.set_quantity('elevation', 0.0) domain.set_quantity('level', 2.0) domain.set_quantity('friction', 0.0) domain.set_quantity('friction', 0.07)
Note: See TracChangeset for help on using the changeset viewer.