Changeset 1586
- Timestamp:
- Jul 7, 2005, 12:04:36 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/analytical solutions/Analytical_solution_contracting_channel.py
r1558 r1586 28 28 from shallow_water import Constant_height, Domain 29 29 from pmesh2domain import pmesh_to_domain_instance 30 from mesh_factory import contracting_channel 30 from mesh_factory import contracting_channel_cross 31 31 32 32 #------- … … 43 43 W_downstream = 2.5 44 44 L_1 = 5. 45 L_2 = 1 0.45 L_2 = 11 46 46 L_3 = Total_length - L_1 - L_2 47 47 n = 20 … … 49 49 50 50 points, elements, boundary = \ 51 contracting_channel (m, n, W_upstream, W_downstream, L_1, L_2, L_3)51 contracting_channel_cross(m, n, W_upstream, W_downstream, L_1, L_2, L_3) 52 52 domain = Domain(points, elements, boundary) 53 53 … … 66 66 domain.filename = 'contracting_channel_second-order' 67 67 68 68 69 #---------------------------------------------------------- 69 70 # Decide which quantities are to be stored at each timestep 70 71 domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum'] 71 72 73 #------------------------------------------------ 72 74 # This is for Visual Python 73 domain.visualise = True75 #domain.visualise = True 74 76 75 77 #------------------------------------------ … … 93 95 94 96 # Use the inscribed circle with safety factor of 0.9 to establish the time step 95 #domain.set_to_inscribed_circle(safety_factor=0.9) 96 97 ### List all triangles that exist in region x > 35 98 ##n_triangle = [] 99 ##for n in range(len(domain.triangles)): 100 ## t = domain.triangles[n] 101 ## tri = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]] 102 ## 103 ## for i in range(n_points): 104 ## if inside_polygon(points(i),tri): 105 ## print 'Point is within triangle with vertices '+'%s'%tri 106 ## n_triangle[i] = n 107 ## t = domain.triangles[n_triangle[i]] 108 ## tri[i] = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]] 97 # domain.set_to_inscribed_circle(safety_factor=0.9) 109 98 110 99 #---------- … … 112 101 import time 113 102 t0 = time.time() 114 for t in domain.evolve(yieldstep = 0.2, finaltime = 50.0):103 for t in domain.evolve(yieldstep = 5.0, finaltime = 50.0): 115 104 domain.write_time() 116 105 … … 131 120 n_points = n_points + 1 132 121 133 134 122 average_stage = average_stage/n_points 135 123 136 124 #Standard Deviation 137 125 sigma = 0.0 126 max_stage = -999999. 127 min_stage = 999999 138 128 for n in range(N): 139 129 if XY[n,0] > 35.0: 140 130 sigma = sigma + (average_stage - stage[n])**2 131 if stage[n] > max_stage: 132 max_stage = stage[n] 133 if stage[n] < min_stage: 134 min_stage = stage[n] 141 135 142 136 import math 143 137 sigma = math.sqrt(sigma/(n_points-1)) 144 138 145 print average_stage, sigma139 print L_2, average_stage, sigma, max_stage, min_stage, n_points 146 140 147 148 149 150 151 ##average_stage = 0. 152 ##t_array = asarray([[0,1,2]]) 153 ##for i in range(n_points): 154 ## tri_array = asarray(tri(i)) 155 ## stage = domain.get_quantity('stage')[n_triangle(i)] 156 ## average_triangle_stage[i] = (stage[0]+stage[1]+stage[2])/3. 157 ## average_stage = average_stage + average_triangle_stage[i] 158 ## 159 ##average_stage = average_stage/n_points 160 ##sigma = 0. 161 ##for i in range(n_points): 162 ## sigma = sigma + average_triangle_stage[i] - average_stage 163 ## 164 ##sigma = sqrt(sigma/n_points) 165 ##print sigma 166 ## 167 168 141 domain.initialise_visualiser() 142 domain.visualiser.update_all()
Note: See TracChangeset
for help on using the changeset viewer.