Changeset 4889
- Timestamp:
- Dec 17, 2007, 5:20:12 PM (17 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
r4876 r4889 1311 1311 assert min1==1 1312 1312 assert max1==9 1313 1313 1314 1314 def test_get_min_max_values1(self): 1315 1315 … … 1625 1625 os.remove(point1_filename) 1626 1626 os.remove(point2_filename) 1627 1627 1628 def test_greens_law(self): 1629 1630 from math import sqrt 1631 1632 d1 = 80.0 1633 d2 = 20.0 1634 h1 = 1.0 1635 h2 = greens_law(d1,d2,h1) 1636 1637 assert h2==sqrt(2.0) 1638 1639 1628 1640 #------------------------------------------------------------- 1629 1641 if __name__ == "__main__": -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r4878 r4889 2453 2453 2454 2454 2455 2456 2457 2458 2459 2455 def greens_law(d1,d2,h1,verbose=False): 2456 """ 2457 2458 Green's Law allows an approximation of wave amplitude at 2459 a given depth based on the fourh root of the ratio of two depths 2460 and the amplitude at another given depth. 2461 2462 Note, wave amplitude is equal to stage. 2463 2464 Inputs: 2465 2466 d1, d2 - the two depths 2467 h1 - the wave amplitude at d1 2468 h2 - the derived amplitude at d2 2469 2470 h2 = h1 (d1/d2)^(1/4), where d2 cannot equal 0. 2471 2472 """ 2473 2474 d1 = ensure_numeric(d1) 2475 d2 = ensure_numeric(d2) 2476 h1 = ensure_numeric(h1) 2477 2478 if d1 <= 0.0: 2479 msg = 'the first depth, d1 (%f), must be strictly positive' %(d1) 2480 raise Exception(msg) 2481 2482 if d2 <= 0.0: 2483 msg = 'the second depth, d2 (%f), must be strictly positive' %(d2) 2484 raise Exception(msg) 2485 2486 if h1 <= 0.0: 2487 msg = 'the wave amplitude, h1 (%f), must be strictly positive' %(h1) 2488 raise Exception(msg) 2489 2490 h2 = h1*(d1/d2)**0.25 2491 2492 assert h2 > 0 2493 2494 return h2 2495
Note: See TracChangeset
for help on using the changeset viewer.