Ignore:
Timestamp:
Oct 9, 2008, 12:54:08 PM (16 years ago)
Author:
sudi
Message:

Adding new versions of shallow_water_domain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/anuga_1d/dry_dam_sudi.py

    r5587 r5827  
    11import os
    22from math import sqrt, pi
    3 from shallow_water_domain import *
     3from shallow_water_domain_suggestion1 import *
    44from Numeric import allclose, array, zeros, ones, Float, take, sqrt
    55from config import g, epsilon
     
    88   
    99    #t  = 0.0     # time (s)
    10     g  = 9.81    # gravity (m/s^2)
     10    # gravity (m/s^2)
    1111    h1 = 10.0    # depth upstream (m)
    1212    h0 = 0.0     # depth downstream (m)
     
    4343            h[i] = h0
    4444
    45     return h , u*h
     45    return h , u*h, u
    4646
    4747#def newLinePlot(title='Simple Plot'):
     
    6565print "TEST 1D-SOLUTION III -- DRY BED"
    6666
    67 L = 2000.0     # Length of channel (m)
    68 N = 800        # Number of computational cells
    69 cell_len = L/N # Origin = 0.0
    70 
    71 points = zeros(N+1,Float)
    72 for i in range(N+1):
    73     points[i] = i*cell_len
    74 
    75 domain = Domain(points)
    76 
    7767def stage(x):
    7868    h1 = 10.0
     
    9282
    9383finaltime = 20.0
    94 yieldstep = 1.0
     84yieldstep = 20.0
    9585L = 2000.0     # Length of channel (m)
    96 number_of_cells = [200]#,200,500,1000,2000,5000,10000,20000]
     86number_of_cells = [810]#,200,500,1000,2000,5000,10000,20000]
    9787h_error = zeros(len(number_of_cells),Float)
    9888uh_error = zeros(len(number_of_cells),Float)
     
    110100    domain.set_quantity('stage', stage)
    111101    domain.set_boundary({'exterior': Reflective_boundary(domain)})
    112     domain.default_order = 2
    113     domain.default_time_order = 2
     102    domain.order = 2
     103    domain.set_timestepping_method('rk2')
    114104    domain.cfl = 1.0
    115     domain.limiter = "minmod"
     105    domain.limiter = "vanleer"
    116106
    117107    t0 = time.time()
     
    124114    XmomC = domain.quantities['xmomentum'].centroid_values
    125115    C = domain.centroids
    126     h, uh = analytical_sol(C,domain.time)
     116    h, uh, u = analytical_sol(C,domain.time)
    127117    h_error[k] = 1.0/(N)*sum(abs(h-StageC))
    128118    uh_error[k] = 1.0/(N)*sum(abs(uh-XmomC))
     
    134124    StageQ = domain.quantities['stage'].vertex_values
    135125    XmomQ = domain.quantities['xmomentum'].vertex_values
    136     h, uh = analytical_sol(X.flat,domain.time)
     126    velQ = domain.quantities['velocity'].vertex_values
     127   
     128    h, uh, u = analytical_sol(X.flat,domain.time)
    137129    x = X.flat
    138130   
     
    151143           'upper right', shadow=True)
    152144    plot2 = subplot(212)
    153     plot(x,uh,x,XmomQ.flat)
     145    plot(x,u,x,velQ.flat)
    154146    plot2.set_ylim([-35,35])
    155147   
    156148    xlabel('Position')
    157     ylabel('Xmomentum')
     149    ylabel('Velocity')
    158150   
    159151    file = "dry_bed_"
Note: See TracChangeset for help on using the changeset viewer.