Changeset 1931
- Timestamp:
- Oct 14, 2005, 6:16:39 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/analytical solutions/Analytical solution_oblique_shock_01.py
r1913 r1931 73 73 74 74 def shock_hb(t): 75 return 2.575 return 1.5 76 76 77 77 def shock_hh(t): 78 return 2.578 return 1.5 79 79 80 80 def shock_pb(t): 81 return 1081 return 5 82 82 83 83 def shock_pp(t): 84 return 1084 return 5 85 85 86 86 … … 126 126 domain.set_quantity('xmomentum',shock_p ) 127 127 128 class SetValueWhere: 128 129 130 def __init__(self,quantity,value=0,xrange=0.0): 131 self.quantity = quantity 132 self.value = value 133 self.xrange = xrange 134 135 def __call__(self,x,y): 136 n = x.shape[0] 137 w = self.quantity.centroid_values 138 for i in range(n): 139 if x[i]<self.xrange: 140 w[i] = self.value 141 return w 142 143 144 Stage = domain.quantities['stage'] 145 Xmom = domain.quantities['xmomentum'] 146 Ymom = domain.quantities['ymomentum'] 129 147 130 148 #for id, face in domain.boundary: … … 135 153 import time 136 154 t0 = time.time() 137 for t in domain.evolve(yieldstep = 0. 5, finaltime = 5.0):155 for t in domain.evolve(yieldstep = 0.1, finaltime = 6.0): 138 156 domain.write_time() 139 157 id = 3399 140 print domain.quantities['stage'].get_values(location='centroids',indices=[id]) 141 print domain.quantities['xmomentum'].get_values(location='centroids',indices=[id]) 142 print domain.quantities['ymomentum'].get_values(location='centroids',indices=[id]) 158 print Stage.get_values(location='centroids',indices=[id]) 159 print Xmom.get_values(location='centroids',indices=[id]) 160 print Ymom.get_values(location='centroids',indices=[id]) 161 vstage = Stage.get_values(location='centroids',indices=[id]) 162 vxmom = Xmom.get_values(location='centroids',indices=[id]) 143 163 id = 12719 144 print domain.quantities['stage'].get_values(location='centroids',indices=[id]) 145 print domain.quantities['xmomentum'].get_values(location='centroids',indices=[id]) 146 print domain.quantities['ymomentum'].get_values(location='centroids',indices=[id]) 164 print Stage.get_values(location='centroids',indices=[id]) 165 print Xmom.get_values(location='centroids',indices=[id]) 166 print Ymom.get_values(location='centroids',indices=[id]) 167 tclean = 2.0 168 # if t > tclean-0.09 and t < tclean+0.01: 169 # print 'Cleaning up Initial profile' 170 # setstage = SetValueWhere(quantity=Stage,value=vstage[0],xrange=10) 171 # setxmom = SetValueWhere(quantity=Xmom,value=vxmom[0],xrange=10) 172 # Stage.set_values(setstage,location='centroids') 173 # Xmom.set_values(setxmom,location='centroids') 174 # Dnew = Dirichlet_boundary([vstage[0] , vxmom[0], 0.0]) 175 # domain.set_boundary({'left': Dnew, 'right': T, 'top': R, 'bottom': R}) 147 176 148 177 print 'That took %.2f seconds' %(time.time()-t0) … … 155 184 #im = ImageGrab.grab() 156 185 #im.save("ccube.eps") 186
Note: See TracChangeset
for help on using the changeset viewer.