Changeset 9230


Ignore:
Timestamp:
Jul 1, 2014, 11:51:49 AM (10 years ago)
Author:
steve
Message:

Updating supercritical overbump test

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  
    44args = anuga.get_args()
    55
    6 produce_report('numerical_subcritical.py', args=args)
     6produce_report('numerical_supercritical.py', args=args)
    77
    88
  • trunk/anuga_core/validation_tests/analytical_exact/supercritical_over_bump/analytical_supercritical.py

    r9229 r9230  
    11"""
    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
     2Supercritical flow over a bump.
    53
    6 Ref2: Delestre et al, 2012, SWASHES: a compilation of shallow water
    7 analytic solutions..., Int J Numer Meth Fluids, DOI:10.1002/fld.3741
    84
    9 Sudi Mungkasi, ANU 2012
     5Steve Roberts, ANU 2014
    106"""
    11 from numpy import zeros, linspace
     7from numpy import zeros
    128from scipy.optimize import fsolve
    13 from pylab import plot, ylim, show
    149from anuga import g
    1510
    16 qA = 4.42  # This is the imposed momentum
    17 hx = 2.0   # This is the water height downstream
     11
     12qA = 10.0  # This is the imposed momentum
     13hx = 0.5   # This is the water height downstream
    1814
    1915def analytic_sol(x):   
     16
    2017    def elevation(x):
    2118        z_b = zeros(len(x))
     
    2825    z = elevation(x)
    2926
     27 
    3028    def find_hL(h): #to find the water height at every spatial point
    3129        return h**3 + (zb-qA**2/(2*g*hx**2)-hx)*h**2 + qA**2/(2*g)
     
    3331    for i in range(len(x)):
    3432        zb = z[i]
    35         h[i] = fsolve(find_hL, 2.0)
     33        h[i] = fsolve(find_hL, 0.5)
     34
     35
    3636    return h,z
    3737
    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  
    11"""
    22Simple water flow example using ANUGA
    3 Subcritical flow over a bump.
     3Supercritical flow over a bump.
    44"""
    55
     
    2525#output_dir = 'subcritical_'+time
    2626output_dir = '.'
    27 output_file = 'subcritical'
     27output_file = 'supercritical'
    2828
    2929args = anuga.get_args()
     
    3535# Setup domain
    3636#------------------------------------------------------------------------------
    37 dx = 0.1
     37dx = 0.05
    3838dy = dx
    3939L = 25.
     
    8080# Setup boundary conditions
    8181#------------------------------------------------------------------------------
    82 from math import sin, pi, exp
    8382Br = anuga.Reflective_boundary(domain)      # Solid reflective wall
    8483#Bt = anuga.Transmissive_boundary(domain)    # Continue all values on boundary
    85 Bd = anuga.Dirichlet_boundary([2., 4.42, 0.]) # Constant boundary values
     84Bd = anuga.Dirichlet_boundary([0.5, 10.0, 0.]) # Constant boundary values
    8685
    8786# Associate boundary tags with boundary objects
     
    105104# Evolve system through time
    106105#------------------------------------------------------------------------------
    107 for t in domain.evolve(yieldstep = 1.0, finaltime = 100.):
     106for t in domain.evolve(yieldstep = 1.0, finaltime = 10.):
    108107    #print domain.timestepping_statistics(track_speeds=True)
    109108    if myid == 0 and verbose: print domain.timestepping_statistics()
  • trunk/anuga_core/validation_tests/analytical_exact/supercritical_over_bump/plot_results.py

    r9228 r9230  
    33
    44"""
     5
    56import anuga.utilities.plot_utils as util
    67from matplotlib import pyplot as pyplot
    7 from analytical_subcritical import *
     8from analytical_supercritical import analytic_sol
    89from numpy import ones, arange
    910
    10 p_st = util.get_output('subcritical.sww')
     11import anuga
     12parser = anuga.create_standard_parser()
     13
     14parser.add_argument('-tid', type=int, default=-1, help ='timestep id')
     15args = parser.parse_args()
     16tid = args.tid
     17verbose = args.verbose
     18
     19
     20if verbose: print 'Read in swwfile'
     21p_st = util.get_output('supercritical.sww')
    1122p2_st=util.get_centroids(p_st)
    1223
    13 v = p2_st.y[10]
     24#v = p2_st.y[10]
    1425#v2=(p2_st.y==v)
    15 v#2=(p2_st.y>-1.0)
     26#v2=(p2_st.y>-1.0)
    1627v2 = arange(len(p2_st.y))
    1728
     29if verbose: print 'Calculate analytical solution'
    1830h,z = analytic_sol(p2_st.x[v2])
     31qexact = 10
     32
     33
     34
    1935
    2036#Plot the stages##############################################################
     37if verbose: print 'Create Stage plot'
    2138pyplot.clf()
    22 pyplot.plot(p2_st.x[v2], p2_st.stage[-1,v2], 'b.-', label='numerical stage') # 0*T/6
     39pyplot.plot(p2_st.x[v2], p2_st.stage[tid,v2], 'b.-', label='numerical stage') # 0*T/6
    2340pyplot.plot(p2_st.x[v2], h+z,'r-', label='analytical stage')
    2441pyplot.plot(p2_st.x[v2], z,'k-', label='bed elevation')
    25 pyplot.title('Stage at time = %s secs'% p2_st.time[-1])
     42pyplot.title('Stage at time = %s secs'% p2_st.time[tid])
    2643##pyplot.ylim(-5.0,5.0)
    2744pyplot.legend(loc='best')
     
    3249
    3350#Plot the momentums##########################################################
     51if verbose: print 'Create Momentum plot'
    3452pyplot.clf()
    35 pyplot.plot(p2_st.x[v2], p2_st.xmom[-1,v2], 'b.-', label='numerical') # 0*T/6
    36 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])
     53pyplot.plot(p2_st.x[v2], p2_st.xmom[tid,v2], 'b.-', label='numerical') # 0*T/6
     54pyplot.plot(p2_st.x[v2], qexact*ones(len(p2_st.x[v2])),'r-', label='analytical')
     55pyplot.title('Xmomentum at time = %s secs'% p2_st.time[tid])
    3856pyplot.legend(loc='best')
    3957##pyplot.ylim([1.52,1.54])
     
    4563
    4664#Plot the velocities#########################################################
     65if verbose: print 'Create Velocity plot'
    4766pyplot.clf()
    48 pyplot.plot(p2_st.x[v2], p2_st.xvel[-1,v2], 'b.-', label='numerical') # 0*T/6
    49 pyplot.plot(p2_st.x[v2], 4.42/h,'r-', label='analytical')
    50 pyplot.title('Xvelocity at time = %s secs'% p2_st.time[-1])
     67pyplot.plot(p2_st.x[v2], p2_st.xvel[tid,v2], 'b.-', label='numerical') # 0*T/6
     68pyplot.plot(p2_st.x[v2], qexact/h,'r-', label='analytical')
     69pyplot.title('Xvelocity at time = %s secs'% p2_st.time[tid])
    5170pyplot.legend(loc='best')
    5271pyplot.xlabel('Xposition')
Note: See TracChangeset for help on using the changeset viewer.