Changeset 9230
- Timestamp:
- Jul 1, 2014, 11:51:49 AM (10 years ago)
- Location:
- trunk/anuga_core/validation_tests/analytical_exact
- Files:
-
- 2 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/validation_tests/analytical_exact/subcritical_over_bump/produce_results.py
r9223 r9230 4 4 args = anuga.get_args() 5 5 6 produce_report('numerical_su bcritical.py', args=args)6 produce_report('numerical_supercritical.py', args=args) 7 7 8 8 -
trunk/anuga_core/validation_tests/analytical_exact/supercritical_over_bump/analytical_supercritical.py
r9229 r9230 1 1 """ 2 Subcritical flow over a bump. 3 Ref1: Houghton & Kasahara, Nonlinear shallow fluid flow over an isolated ridge. 4 Comm. Pure and Applied Math. DOI:10.1002/cpa.3160210103 2 Supercritical flow over a bump. 5 3 6 Ref2: Delestre et al, 2012, SWASHES: a compilation of shallow water7 analytic solutions..., Int J Numer Meth Fluids, DOI:10.1002/fld.37418 4 9 S udi Mungkasi, ANU 20125 Steve Roberts, ANU 2014 10 6 """ 11 from numpy import zeros , linspace7 from numpy import zeros 12 8 from scipy.optimize import fsolve 13 from pylab import plot, ylim, show14 9 from anuga import g 15 10 16 qA = 4.42 # This is the imposed momentum 17 hx = 2.0 # This is the water height downstream 11 12 qA = 10.0 # This is the imposed momentum 13 hx = 0.5 # This is the water height downstream 18 14 19 15 def analytic_sol(x): 16 20 17 def elevation(x): 21 18 z_b = zeros(len(x)) … … 28 25 z = elevation(x) 29 26 27 30 28 def find_hL(h): #to find the water height at every spatial point 31 29 return h**3 + (zb-qA**2/(2*g*hx**2)-hx)*h**2 + qA**2/(2*g) … … 33 31 for i in range(len(x)): 34 32 zb = z[i] 35 h[i] = fsolve(find_hL, 2.0) 33 h[i] = fsolve(find_hL, 0.5) 34 35 36 36 return h,z 37 37 38 ##N = 401 39 ##L = 25. 40 ##x = linspace(0.0,L,N) 41 ##h,z = analytic_sol(x) 42 ##plot(x,h+z, x,z) 43 ##ylim([-0.1, 2.1]) 44 ##show() 38 -
trunk/anuga_core/validation_tests/analytical_exact/supercritical_over_bump/numerical_supercritical.py
r9228 r9230 1 1 """ 2 2 Simple water flow example using ANUGA 3 Su bcritical flow over a bump.3 Supercritical flow over a bump. 4 4 """ 5 5 … … 25 25 #output_dir = 'subcritical_'+time 26 26 output_dir = '.' 27 output_file = 'su bcritical'27 output_file = 'supercritical' 28 28 29 29 args = anuga.get_args() … … 35 35 # Setup domain 36 36 #------------------------------------------------------------------------------ 37 dx = 0. 137 dx = 0.05 38 38 dy = dx 39 39 L = 25. … … 80 80 # Setup boundary conditions 81 81 #------------------------------------------------------------------------------ 82 from math import sin, pi, exp83 82 Br = anuga.Reflective_boundary(domain) # Solid reflective wall 84 83 #Bt = anuga.Transmissive_boundary(domain) # Continue all values on boundary 85 Bd = anuga.Dirichlet_boundary([ 2., 4.42, 0.]) # Constant boundary values84 Bd = anuga.Dirichlet_boundary([0.5, 10.0, 0.]) # Constant boundary values 86 85 87 86 # Associate boundary tags with boundary objects … … 105 104 # Evolve system through time 106 105 #------------------------------------------------------------------------------ 107 for t in domain.evolve(yieldstep = 1.0, finaltime = 10 0.):106 for t in domain.evolve(yieldstep = 1.0, finaltime = 10.): 108 107 #print domain.timestepping_statistics(track_speeds=True) 109 108 if myid == 0 and verbose: print domain.timestepping_statistics() -
trunk/anuga_core/validation_tests/analytical_exact/supercritical_over_bump/plot_results.py
r9228 r9230 3 3 4 4 """ 5 5 6 import anuga.utilities.plot_utils as util 6 7 from matplotlib import pyplot as pyplot 7 from analytical_su bcritical import *8 from analytical_supercritical import analytic_sol 8 9 from numpy import ones, arange 9 10 10 p_st = util.get_output('subcritical.sww') 11 import anuga 12 parser = anuga.create_standard_parser() 13 14 parser.add_argument('-tid', type=int, default=-1, help ='timestep id') 15 args = parser.parse_args() 16 tid = args.tid 17 verbose = args.verbose 18 19 20 if verbose: print 'Read in swwfile' 21 p_st = util.get_output('supercritical.sww') 11 22 p2_st=util.get_centroids(p_st) 12 23 13 v = p2_st.y[10]24 #v = p2_st.y[10] 14 25 #v2=(p2_st.y==v) 15 v#2=(p2_st.y>-1.0)26 #v2=(p2_st.y>-1.0) 16 27 v2 = arange(len(p2_st.y)) 17 28 29 if verbose: print 'Calculate analytical solution' 18 30 h,z = analytic_sol(p2_st.x[v2]) 31 qexact = 10 32 33 34 19 35 20 36 #Plot the stages############################################################## 37 if verbose: print 'Create Stage plot' 21 38 pyplot.clf() 22 pyplot.plot(p2_st.x[v2], p2_st.stage[ -1,v2], 'b.-', label='numerical stage') # 0*T/639 pyplot.plot(p2_st.x[v2], p2_st.stage[tid,v2], 'b.-', label='numerical stage') # 0*T/6 23 40 pyplot.plot(p2_st.x[v2], h+z,'r-', label='analytical stage') 24 41 pyplot.plot(p2_st.x[v2], z,'k-', label='bed elevation') 25 pyplot.title('Stage at time = %s secs'% p2_st.time[ -1])42 pyplot.title('Stage at time = %s secs'% p2_st.time[tid]) 26 43 ##pyplot.ylim(-5.0,5.0) 27 44 pyplot.legend(loc='best') … … 32 49 33 50 #Plot the momentums########################################################## 51 if verbose: print 'Create Momentum plot' 34 52 pyplot.clf() 35 pyplot.plot(p2_st.x[v2], p2_st.xmom[ -1,v2], 'b.-', label='numerical') # 0*T/636 pyplot.plot(p2_st.x[v2], 4.42*ones(len(p2_st.x[v2])),'r-', label='analytical')37 pyplot.title('Xmomentum at time = %s secs'% p2_st.time[ -1])53 pyplot.plot(p2_st.x[v2], p2_st.xmom[tid,v2], 'b.-', label='numerical') # 0*T/6 54 pyplot.plot(p2_st.x[v2], qexact*ones(len(p2_st.x[v2])),'r-', label='analytical') 55 pyplot.title('Xmomentum at time = %s secs'% p2_st.time[tid]) 38 56 pyplot.legend(loc='best') 39 57 ##pyplot.ylim([1.52,1.54]) … … 45 63 46 64 #Plot the velocities######################################################### 65 if verbose: print 'Create Velocity plot' 47 66 pyplot.clf() 48 pyplot.plot(p2_st.x[v2], p2_st.xvel[ -1,v2], 'b.-', label='numerical') # 0*T/649 pyplot.plot(p2_st.x[v2], 4.42/h,'r-', label='analytical')50 pyplot.title('Xvelocity at time = %s secs'% p2_st.time[ -1])67 pyplot.plot(p2_st.x[v2], p2_st.xvel[tid,v2], 'b.-', label='numerical') # 0*T/6 68 pyplot.plot(p2_st.x[v2], qexact/h,'r-', label='analytical') 69 pyplot.title('Xvelocity at time = %s secs'% p2_st.time[tid]) 51 70 pyplot.legend(loc='best') 52 71 pyplot.xlabel('Xposition')
Note: See TracChangeset
for help on using the changeset viewer.