Changeset 8466
- Timestamp:
- Jul 11, 2012, 9:42:10 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/shallow_water/eqf.py
r6157 r8466 2 2 # earthquake_tsunami function 3 3 # 4 4 #import okada 5 5 """This function returns a callable object representing an initial water 6 6 displacement generated by a submarine earthqauke. -
trunk/anuga_core/source/anuga/shallow_water/eqf_v2.py
r7769 r8466 37 37 from math import sin, radians 38 38 39 raise Exception, 'WARNING: (GD, 11/07/2012) there seem to be bugs in eqf_v2.py\ 40 , I suggest you use okada_tsunami' 41 39 42 if domain is not None: 40 43 xllcorner = domain.geo_reference.get_xllcorner() … … 156 159 157 160 for i in range(N-1): 158 self.SRECTF(alp, xr[i]*.001, yr[i]*.001, depth*.001, zero, length,\ 161 # GD CHANGE 162 self.SRECTF(alp, xr[i]*.001, yr[i]*.001, depth, zero, length,\ 159 163 zero, width, sd, cd, disl1, disl2, disl3) 164 #self.SRECTF(alp, xr[i]*.001, yr[i]*.001, depth*0.001, zero, length,\ 165 # zero, width, sd, cd, disl1, disl2, disl3) 160 166 161 167 z2[i] = self.U3 … … 281 287 282 288 if Q != F0: 283 TT = atan( radians( XI*ET/(Q*R) )) 289 #TT = atan( radians( XI*ET/(Q*R) )) 290 # GD CHANGE 291 TT = atan( XI*ET/(Q*R) ) 284 292 else: 285 293 TT = F0 … … 299 307 if CD == 0: 300 308 #C============================== 301 #C===== INCLINEDFAULT =====309 #C===== VERTICAL FAULT ===== 302 310 #C============================== 303 311 RD2=RD*RD … … 312 320 else: 313 321 #C============================== 314 #C===== VERTICALFAULT =====322 #C===== INCLINED FAULT ===== 315 323 #C============================== 316 324 TD=SD/CD … … 319 327 A5=F0 320 328 else: 321 A5= ALP*F2/CD*atan( radians((ET*(X+Q*CD)+X*(R+X)*SD) / \ 329 #A5= ALP*F2/CD*atan( radians((ET*(X+Q*CD)+X*(R+X)*SD) / \ 330 # (XI*(R+X)*CD) )) 331 # GD CHANGE 332 A5= ALP*F2/CD*atan( ((ET*(X+Q*CD)+X*(R+X)*SD) / \ 322 333 (XI*(R+X)*CD) )) 323 334 A4= ALP/CD*( log(RD) - SD*DLE ) -
trunk/anuga_work/development/gareth/experimental/balanced_dev/swb2_domain_ext.c
r8450 r8466 493 493 //Bedslope approx 1: 494 494 //bedslope_work = g*hc*(ql[0])*length-0.5*g*max(ql[0]-zl,0.)*(ql[0]-zl)*length; 495 bedslope_work = g*length*( hc*(ql[0])-0.5*max(ql[0]-zl,0.)*(ql[0]-zl) ); 495 496 // 496 497 // Bedslope approx 2 … … 505 506 506 507 // Bedslope approx 3 507 bedslope_work = -0.5*g*max(stage_centroid_values[k]-zl,0.)*(stage_centroid_values[k]-zl)*length;508 //bedslope_work = -0.5*g*max(stage_centroid_values[k]-zl,0.)*(stage_centroid_values[k]-zl)*length; 508 509 // 509 510 xmom_explicit_update[k] -= normals[ki2]*bedslope_work; … … 535 536 // Bedslope approx 1: 536 537 //bedslope_work = g*hc_n*(qr[0])*length-0.5*g*max(qr[0]-zr,0.)*(qr[0]-zr)*length; 538 bedslope_work = g*length*(hc_n*(qr[0])-0.5*max(qr[0]-zr,0.)*(qr[0]-zr)); 537 539 // 538 540 // Bedslope approx 2: … … 547 549 // 548 550 // Bedslope approx 3 549 bedslope_work = -0.5*g*max(stage_centroid_values[n]-zr,0.)*(stage_centroid_values[n]-zr)*length;551 //bedslope_work = -0.5*g*max(stage_centroid_values[n]-zr,0.)*(stage_centroid_values[n]-zr)*length; 550 552 // 551 553 xmom_explicit_update[n] += normals[ki2]*bedslope_work; … … 1079 1081 dqv[1] = a*dxv1 + b*dyv1; 1080 1082 dqv[2] = a*dxv2 + b*dyv2; 1081 1083 1084 // Idea: New limiter, computed using only neighbouring centroid values and local centroid value 1085 // Step1: Compute the value of stage at the centroid of triangle k , 1086 // using only the neighbouring centroid stage values 1087 //tmp = a*(x-x0) + b*(y-y0) + stage_centroid_values[k0]; 1088 // Step2: Now, compute a limiting factor, so that if gradients are multiplied by this, 1089 // then for a triangle with these limited gradients, based at the local centroid value 1090 // ,the re-constructed neighbour centroid values will not over shoot (if larger) or undershoot (if smaller) 1091 //limiting_factor=1 - max_all_k0((tmp - stage_centroid_values[k])/(tmp - stage_centroid_values[k0])) 1092 //limiting_factor=min(max(limiting_factor,0),1) 1093 // Advantages: No limiting for linear problem. Worth a look anyway 1094 1082 1095 // Now we want to find min and max of the centroid and the 1083 1096 // vertices of the auxiliary triangle and compute jumps … … 1088 1101 1089 1102 // Limit the gradient 1103 //if(hmin/hc<0.5){ 1090 1104 limit_gradient(dqv, qmin, qmax, beta_tmp); 1105 //} 1091 1106 //limit_gradient2(dqv, qmin, qmax, beta_tmp,r0scale); 1092 1107 -
trunk/anuga_work/development/gareth/tests/dam_break/plotme.py
r8446 r8466 9 9 p2_st=util.get_centroids(p_st) 10 10 11 p_dev = util.get_output('dam_break_20120 517_003225/dam_break.sww', 0.001)11 p_dev = util.get_output('dam_break_20120627_231618/dam_break.sww', 0.001) 12 12 p2_dev=util.get_centroids(p_dev, velocity_extrapolation=True) 13 13 -
trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoid.py
r8446 r8466 74 74 # Associate boundary tags with boundary objects 75 75 #---------------------------------------------- 76 domain.set_boundary({'left': Br, 'right': B r, 'top': Br, 'bottom':Br})76 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom':Br}) 77 77 78 78 #------------------------------ -
trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_2plot.py
r8354 r8466 8 8 import numpy 9 9 import scipy 10 import pylab 11 12 import util 10 from matplotlib import pyplot as pyplot 11 from anuga.utilities import plot_utils as util 13 12 #-------------- 14 13 # Get variables … … 26 25 # Define variables of case study 27 26 #------------------------------- 28 #mann=0.01# Manning's coef29 #bedslope=-0.0130 #fluxin=0.1 #The momentum flux at the upstream boundary 27 mann=0.03 # Manning's coef 28 bedslope=-0.1 29 fluxin=20./100. #The momentum flux at the upstream boundary ( = discharge / width) 31 30 32 31 #--------------------------------------------- … … 36 35 # 1) Friction_slope=bedslope , and 37 36 # 2) flux = depth*velocity = flux_in 38 #uana= ( mann**(-2.)*abs(bedslope)*fluxin**(4./3.) )**(3./10.) # Velocity39 #dana= fluxin/uana # Depth37 uana= ( mann**(-2.)*abs(bedslope)*fluxin**(4./3.) )**(3./10.) # Velocity 38 dana= fluxin/uana # Depth 40 39 41 40 #-------------------- 42 41 # Make plot animation 43 42 #-------------------- 44 py lab.close() #If the plot is open, there will be problems45 py lab.ion()43 pyplot.close() #If the plot is open, there will be problems 44 pyplot.ion() 46 45 47 line, = py lab.plot( (p2.x[v].min(),p2.x[v].max()) ,( (p2.stage[:,v]-p2.elev[:,v]).max(),(p2.stage[:,v]-p2.elev[v]).min() ) )48 #line.set_label('Numerical')49 #pylab.plot( (0,100),(dana,dana), 'r',label='Analytical' )50 #pylab.legend()51 #py lab.plot(x[v],elev[v],'green')46 line, = pyplot.plot( (p2.x[v].min(),p2.x[v].max()) ,( (p2.stage[:,v]-p2.elev[:,v]).max(),(p2.stage[:,v]-p2.elev[v]).min() ) ) 47 line.set_label('Numerical') 48 pyplot.plot( (0,100),(dana,dana), 'r',label='Analytical' ) 49 pyplot.legend() 50 #pyplot.plot(x[v],elev[v],'green') 52 51 for i in range(p2.xmom.shape[0]): 53 52 line.set_xdata(p2.x[v]) 54 53 line.set_ydata(p2.stage[i,v]-p2.elev[v]) 55 py lab.draw()56 py lab.title('Flow depth: should be converging to steady uniform flow ' )57 py lab.xlabel('x')58 py lab.ylabel('depth (m)')54 pyplot.draw() 55 pyplot.title('Flow depth: should be converging to steady uniform flow ' ) 56 pyplot.xlabel('Distance down-slope (m)') 57 pyplot.ylabel('depth (m)') 59 58 60 py lab.title('Flow depth at 400s -- there should be a central region with steady uniform flow ' )61 py lab.savefig('final_depth_v2.png')59 pyplot.title('Flow depth at 400s -- there should be a central region with steady uniform flow ' ) 60 pyplot.savefig('final_depth_v2.png') 62 61 63 62 #-------------------------------------------- 64 63 # Compare x-velocity with analytical solution 65 64 #-------------------------------------------- 66 #py lab.clf()67 #py lab.plot(x[v],xvel[200,v], label='Numerical')68 #py lab.plot((0,100),(uana,uana),'r',label='Analytical')69 #py lab.legend()70 #py lab.xlabel('x')71 #py lab.ylabel('Velocity m/s')65 #pyplot.clf() 66 #pyplot.plot(x[v],xvel[200,v], label='Numerical') 67 #pyplot.plot((0,100),(uana,uana),'r',label='Analytical') 68 #pyplot.legend() 69 #pyplot.xlabel('x') 70 #pyplot.ylabel('Velocity m/s') 72 71 #plottitle = "Final velocity in the x-direction -- some wiggles. \n Can this be improved with\ 73 72 # a different downstream boundary condition?" #\n Setting depth only at the downstream boundary does not help " 74 #pylab.title(plottitle) 75 #pylab.savefig('SU_x_velocity.png') 73 #pyplot.title(plottitle) 74 #pyplot.savefig('SU_x_velocity.png') 75 76 77 # Find an x value close to x==50 78 tmp=(abs(p2.x-50.)).argmin() 79 v=(p2.x==p2.x[tmp]) 76 80 77 81 #-------------------------------------------------- 78 82 # Check if y velocity is zero everywhere (it should be) 79 83 #-------------------------------------------------- 80 pylab.clf() 81 #v=(x==50.) 82 #pylab.clf() 83 pylab.plot(p2.y[v],p2.yvel[100,v], 'rs-') 84 ##pylab.plot(y[v],yvel[200,v], 'bp--') 85 pylab.xlabel('y') 86 pylab.ylabel('Velocity m/s') 87 pylab.title('Final velocity in the y-direction (i.e. perpendicular to the channel cross-section) \n at x=50. (similar for other x) ') 88 pylab.savefig('y_velocity_v2.png') 84 pyplot.clf() 85 pyplot.plot(p2.y[v],p2.yvel[100,v],'o', label='Numerical') 86 pyplot.plot((0,100),(0.0, 0.0),label='Analytical') 87 pyplot.xlabel('Distance along the line x==50 (across the slope) (m)') 88 pyplot.ylabel('Velocity m/s') 89 pyplot.title('Final y-velocity near x=50.') 90 pyplot.legend() 91 pyplot.savefig('y_velocity_v2.png') 89 92 90 93 91 pylab.clf() 92 v=(p2.x==50.) 93 #pylab.clf() 94 pylab.plot(p2.y[v],p2.xvel[100,v], 'rs-') 95 ##pylab.plot(y[v],yvel[200,v], 'bp--') 96 pylab.xlabel('y') 97 pylab.ylabel('Velocity m/s') 98 pylab.title('Final velocity in the x-direction (downstream) \n at x=50. (similar for other x) ') 99 pylab.savefig('x_velocity_v2.png') 94 pyplot.clf() 95 pyplot.plot(p2.y[v],p2.xvel[100,v], 'o', label='Numerical') 96 pyplot.plot((0,100),(uana,uana),label='Analytical') 97 pyplot.ylim([1.0,3.0]) 98 pyplot.xlabel('Distance along the line x==50 (across the slope) (m)') 99 pyplot.ylabel('Velocity m/s') 100 pyplot.title('Final velocity in the x-direction (downstream) \n at x=50. (similar for other x) ') 101 pyplot.legend() 102 pyplot.savefig('x_velocity_v2.png') 103 pyplot.clf() 100 104 101 pylab.clf()102
Note: See TracChangeset
for help on using the changeset viewer.