# Changeset 4889

Ignore:
Timestamp:
Dec 17, 2007, 5:20:12 PM (16 years ago)
Message:

green's law function (describes wave height approximation based on ratio of depths and wave height at one of those depths)

Location:
anuga_core/source/anuga/abstract_2d_finite_volumes
Files:
2 edited

Unmodified
Removed
• ## anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py

 r4876 assert min1==1 assert max1==9 def test_get_min_max_values1(self): os.remove(point1_filename) os.remove(point2_filename) def test_greens_law(self): from math import sqrt d1 = 80.0 d2 = 20.0 h1 = 1.0 h2 = greens_law(d1,d2,h1) assert h2==sqrt(2.0) #------------------------------------------------------------- if __name__ == "__main__":
• ## anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

 r4878 def greens_law(d1,d2,h1,verbose=False): """ Green's Law allows an approximation of wave amplitude at a given depth based on the fourh root of the ratio of two depths and the amplitude at another given depth. Note, wave amplitude is equal to stage. Inputs: d1, d2 - the two depths h1     - the wave amplitude at d1 h2     - the derived amplitude at d2 h2 = h1 (d1/d2)^(1/4), where d2 cannot equal 0. """ d1 = ensure_numeric(d1) d2 = ensure_numeric(d2) h1 = ensure_numeric(h1) if d1 <= 0.0: msg = 'the first depth, d1 (%f), must be strictly positive' %(d1) raise Exception(msg) if d2 <= 0.0: msg = 'the second depth, d2 (%f), must be strictly positive' %(d2) raise Exception(msg) if h1 <= 0.0: msg = 'the wave amplitude, h1 (%f), must be strictly positive' %(h1) raise Exception(msg) h2 = h1*(d1/d2)**0.25 assert h2 > 0 return h2
Note: See TracChangeset for help on using the changeset viewer.