Changeset 232 for inundation/ga/storm_surge
- Timestamp:
- Aug 27, 2004, 1:35:01 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/HUSK.txt
r222 r232 1 Test friction term! 1 2 2 3 -
inundation/ga/storm_surge/pyvolution/domain.py
r229 r232 294 294 #for name in self.conserved_quantities: 295 295 # Q = self.quantities[name] 296 # print 'Vertices (%s):' %name, Q.vertex_values[:4] 296 # #print 'Vertices (%s):' %name, Q.vertex_values[:] 297 # print 'B_val (%s):' %name, Q.boundary_values[:] 298 297 299 298 300 #print -
inundation/ga/storm_surge/pyvolution/flatbed.py
r229 r232 36 36 ###################### 37 37 #Evolution 38 for t in domain.evolve(yieldstep = 0.05, finaltime = 1.):39 domain.write_time()38 #for t in domain.evolve(yieldstep = 0.05, finaltime = 1.): 39 # domain.write_time() 40 40 41 41 42 import sys; sys.exit()42 #import sys; sys.exit() 43 43 44 44 ###################### -
inundation/ga/storm_surge/pyvolution/generic_boundary_conditions.py
r195 r232 86 86 try: 87 87 q = f(0.0) 88 except: 89 raise 'Function for time boundary could not be executed' 88 except Exception, e: 89 msg = 'Function for time boundary could not be executed:\n%s' %e 90 raise msg 91 90 92 91 93 from Numeric import array, Float -
inundation/ga/storm_surge/pyvolution/shallow_water.py
r229 r232 98 98 """ 99 99 100 from config import g 100 from config import g, epsilon 101 101 from math import sqrt 102 102 from Numeric import array … … 114 114 uh_left = q_left[1] 115 115 116 try: 116 if h_left < epsilon: 117 u_left = 0.0 #Could have been negative 118 h_left = 0.0 119 else: 117 120 u_left = uh_left/h_left 118 except:119 u_left = 0.0120 h_left = 0.0121 121 122 122 … … 126 126 127 127 128 try: 128 if h_right < epsilon: 129 u_right = 0.0 #Could have been negative 130 h_right = 0.0 131 else: 129 132 u_right = uh_right/h_right 130 except: 131 u_right = 0.0 132 h_right = 0.0 133 134 133 135 134 vh_left = q_left[2] 136 135 vh_right = q_right[2] … … 146 145 147 146 #Flux computation 148 flux_left = array([u h_left,149 u_left* *2*h_left + 0.5*g*h_left**2,150 vh_left*u_left])151 flux_right = array([u h_right,152 u_right* *2*h_right + 0.5*g*h_right**2,153 vh_right*u_right])147 flux_left = array([u_left*h_left, 148 u_left*uh_left + 0.5*g*h_left**2, 149 u_left*vh_left]) 150 flux_right = array([u_right*h_right, 151 u_right*uh_right + 0.5*g*h_right**2, 152 u_right*vh_right]) 154 153 155 154 denom = s_max-s_min 156 155 if denom == 0.0: 157 flux = array([0.0, 0.0, 0.0])156 edgeflux = array([0.0, 0.0, 0.0]) 158 157 max_speed = 0.0 159 158 else: 160 flux = (s_max*flux_left - s_min*flux_right)/denom161 flux += s_max*s_min*(q_right-q_left)/denom162 163 flux = rotate(flux, normal, direction=-1)159 edgeflux = (s_max*flux_left - s_min*flux_right)/denom 160 edgeflux += s_max*s_min*(q_right-q_left)/denom 161 162 edgeflux = rotate(edgeflux, normal, direction=-1) 164 163 max_speed = max(abs(s_max), abs(s_min)) 165 164 166 return flux, max_speed165 return edgeflux, max_speed 167 166 168 167 -
inundation/ga/storm_surge/pyvolution/test_shallow_water.py
r229 r232 1771 1771 1772 1772 1773 1773 def test_complex_bed(self): 1774 #No friction is tested here 1775 1776 from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\ 1777 Transmissive_boundary, Time_boundary,\ 1778 Weir_simple as Weir, Constant_height 1779 1780 from mesh_factory import rectangular 1781 from Numeric import array 1782 1783 N = 12 1784 points, vertices, boundary = rectangular(N, N/2, len1=1.2,len2=0.6, 1785 origin=(-0.07, 0)) 1786 1787 1788 domain = Domain(points, vertices, boundary) 1789 domain.smooth = False 1790 domain.visualise = False 1791 domain.default_order=2 1792 1793 1794 inflow_stage = 0.1 1795 Z = Weir(inflow_stage) 1796 domain.set_quantity('elevation', Z) 1797 1798 Br = Reflective_boundary(domain) 1799 Bd = Dirichlet_boundary([inflow_stage, 0.0, 0.0]) 1800 domain.set_boundary({'left': Bd, 'right': Br, 'bottom': Br, 'top': Br}) 1801 1802 domain.set_quantity('level', Constant_height(Z, 0.)) 1803 1804 for t in domain.evolve(yieldstep = 0.02, finaltime = 0.2): 1805 pass 1806 1807 assert allclose(domain.quantities['level'].centroid_values, 1808 [3.96042007e-002, 5.61081828e-002, 4.66578380e-002, 5.73165329e-002, 1809 4.72542001e-002, 5.74770060e-002, 4.74459150e-002, 5.77550805e-002, 1810 4.80791695e-002, 5.85754074e-002, 4.90681598e-002, 6.02682664e-002, 1811 1.16686827e-002, 1.75422685e-002, 1.17014731e-002, 2.15810992e-002, 1812 1.30549421e-002, 2.14416681e-002, 1.31212934e-002, 2.15486277e-002, 1813 1.34996488e-002, 2.24053139e-002, 1.50195194e-002, 2.22306851e-002, 1814 -7.26762170e-003, -1.35071582e-003, -7.88143638e-003, 1815 -2.18165245e-003, -7.81749271e-003, -1.06732807e-003, 1816 -7.76399231e-003, -1.00580353e-003, -7.81877765e-003, 1817 -9.81086203e-004, -7.42500800e-003, -2.41412070e-004, 1.86244453e-001, 1818 8.79324341e-002, 1.86232625e-001, 8.78313615e-002, 6.12537452e-002, 1819 -3.73125664e-002, -6.37550753e-002, -3.73269705e-002, 6.12145063e-002, 1820 8.77700677e-002, 1.86257693e-001, 8.79121535e-002, -4.83328632e-002, 1821 1.18336527e-001, -4.83328400e-002, 1.18337005e-001, -4.83328850e-002, 1822 -6.65776472e-003, -1.73331646e-001, -1.31654218e-001, 1823 -1.73332232e-001, -6.66097985e-003, -4.83323869e-002, 1.18339536e-001, 1824 -2.48333331e-001, -2.31666623e-001, -2.48333332e-001, 1825 -2.31666628e-001, -2.48333332e-001, -2.31666627e-001, 1826 -2.48333330e-001, -2.31666575e-001, -2.48333330e-001, 1827 -2.31666597e-001, -2.48333329e-001, -2.31666584e-001, 1828 -4.65000000e-001, -3.65000000e-001, -4.65000000e-001, 1829 -3.65000000e-001, -4.65000000e-001, -3.65000000e-001, 1830 -4.65000000e-001, -3.65000000e-001, -4.65000000e-001, 1831 -3.65000000e-001, -4.65000000e-001, -3.65000000e-001, 1832 -5.98333333e-001, -5.81666667e-001, -5.98333333e-001, 1833 -5.81666667e-001, -5.98333333e-001, -5.81666667e-001, 1834 -5.98333333e-001, -5.81666667e-001, -5.98333333e-001, 1835 -5.81666667e-001, -5.98333333e-001, -5.81666667e-001, 1836 -6.48333333e-001, -6.31666667e-001, -6.48333333e-001, 1837 -6.31666667e-001, -6.48333333e-001, -6.31666667e-001, 1838 -6.48333333e-001, -6.31666667e-001, -6.48333333e-001, 1839 -6.31666667e-001, -6.48333333e-001, -6.31666667e-001, 1840 -5.31666667e-001, -5.98333333e-001, -5.31666667e-001, 1841 -5.98333333e-001, -5.31666667e-001, -5.98333333e-001, 1842 -5.31666667e-001, -5.98333333e-001, -5.31666667e-001, 1843 -5.98333333e-001, -5.31666667e-001, -5.98333333e-001, 1844 -4.98333333e-001, -4.81666667e-001, -4.98333333e-001, 1845 -4.81666667e-001, -4.98333333e-001, -4.81666667e-001, 1846 -4.98333333e-001, -4.81666667e-001, -4.98333333e-001, 1847 -4.81666667e-001, -4.98333333e-001, -4.81666667e-001, 1848 -5.48333333e-001, -5.31666667e-001, -5.48333333e-001, 1849 -5.31666667e-001, -5.48333333e-001, -5.31666667e-001, 1850 -5.48333333e-001, -5.31666667e-001, -5.48333333e-001, 1851 -5.31666667e-001, -5.48333333e-001, -5.31666667e-001]) 1852 1853 1774 1854 1775 1855
Note: See TracChangeset
for help on using the changeset viewer.