Changeset 8990
- Timestamp:
- Sep 26, 2013, 11:27:01 AM (11 years ago)
- Location:
- trunk/anuga_work/development/gareth
- Files:
-
- 5 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_work/development/gareth/tests/channel_floodplain/channel_floodplain1.py
r8751 r8990 14 14 #from anuga import * 15 15 #from balanced_basic import * 16 from balanced_dev import * 16 #from balanced_dev import * 17 from bal_and import * 17 18 #from anuga_tsunami import * 18 19 #from balanced_basic.swb2_domain import * -
trunk/anuga_work/development/gareth/tests/channel_floodplain/plotme.py
r8867 r8990 1 import util 1 #import util 2 from bal_and import plot_utils as util 2 3 from matplotlib import pyplot as pyplot 3 4 #import pylab 4 5 5 6 # Time-index to plot outputs from 6 index=900 7 index=150 8 #index=900 7 9 8 10 #p2 = util.get_output('channel_floodplain1_bal_dev.sww', minimum_allowed_height=0.01) … … 28 30 29 31 # Numerical results along a central channel 'slice' 30 V1 = p.stage[index,v] - p.elev[ v]32 V1 = p.stage[index,v] - p.elev[index,v] 31 33 V2 = p.yvel[index,v] 32 34 V3 = p.xvel[index,v] … … 90 92 91 93 pyplot.clf() 92 analytical_stage = min(p.elev[ v1]) + dc_analytical93 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[ v1])**(4./3.)*(1./0.03)**2.)**0.594 analytic_vel = analytic_vel*(analytical_stage>p.elev[ v1])94 analytical_stage = min(p.elev[index,v1]) + dc_analytical 95 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[index,v1])**(4./3.)*(1./0.03)**2.)**0.5 96 analytic_vel = analytic_vel*(analytical_stage>p.elev[index,v1]) 95 97 pyplot.figure(figsize=(12.,8.)) 96 98 pyplot.plot(p.x[v1], p.yvel[index,v1],'o', label='computed velocity (m/s)') 97 99 pyplot.plot(p.x[v1], analytic_vel,'o', label='analytical velocity (m/s)') 98 pyplot.plot(p.x[v1],p.elev[ v1],'o', label='bed elevation (m)')100 pyplot.plot(p.x[v1],p.elev[index,v1],'o', label='bed elevation (m)') 99 101 pyplot.plot(p.x[v1],p.stage[index,v1],'o', label='computed stage (m)') 100 102 pyplot.plot(p.x[v1],p.stage[index,v1]*0. + analytical_stage,'o', label='analytical stage (m)') … … 109 111 110 112 pyplot.clf() 111 analytical_stage = min(p.elev[ v1]) + dc_analytical112 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[ v1])**(4./3.)*(1./0.03)**2.)**0.5113 analytic_vel = analytic_vel*(analytical_stage>p.elev[ v1])113 analytical_stage = min(p.elev[index,v1]) + dc_analytical 114 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[index,v1])**(4./3.)*(1./0.03)**2.)**0.5 115 analytic_vel = analytic_vel*(analytical_stage>p.elev[index,v1]) 114 116 pyplot.figure(figsize=(12.,8.)) 115 117 pyplot.plot(p.x[v1], p.yvel[index,v1],'o', label='computed velocity (m/s)') 116 118 pyplot.plot(p.x[v1], analytic_vel,'o', label='analytical velocity (m/s)') 117 pyplot.plot(p.x[v1],p.elev[ v1],'o', label='bed elevation (m)')119 pyplot.plot(p.x[v1],p.elev[index,v1],'o', label='bed elevation (m)') 118 120 pyplot.plot(p.x[v1],p.stage[index,v1],'o', label='computed stage (m)') 119 121 pyplot.plot(p.x[v1],p.stage[index,v1]*0. + analytical_stage,'o', label='analytical stage (m)') … … 127 129 128 130 pyplot.clf() 129 analytical_stage = min(p.elev[ v1]) + dc_analytical130 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[ v1])**(4./3.)*(1./0.03)**2.)**0.5131 analytic_vel = analytic_vel*(analytical_stage>p.elev[ v1])131 analytical_stage = min(p.elev[index,v1]) + dc_analytical 132 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[index,v1])**(4./3.)*(1./0.03)**2.)**0.5 133 analytic_vel = analytic_vel*(analytical_stage>p.elev[index,v1]) 132 134 pyplot.figure(figsize=(12.,8.)) 133 135 pyplot.plot(p.x[v1], p.yvel[index,v1],'o', label='computed velocity (m/s)') 134 136 pyplot.plot(p.x[v1], analytic_vel,'o', label='analytical velocity (m/s)') 135 pyplot.plot(p.x[v1],p.elev[ v1],'o', label='bed elevation (m)')137 pyplot.plot(p.x[v1],p.elev[index,v1],'o', label='bed elevation (m)') 136 138 pyplot.plot(p.x[v1],p.stage[index,v1],'o', label='computed stage (m)') 137 139 pyplot.plot(p.x[v1],p.stage[index,v1]*0. + analytical_stage,'o', label='analytical stage (m)') -
trunk/anuga_work/development/gareth/tests/parabolic/parabolic.py
r8880 r8990 8 8 import numpy 9 9 10 from bal_and import * 11 10 12 #from balanced_dev import * 11 13 #from anuga_tsunami import * 12 14 #from balanced_basic import * 13 15 #from anuga.shallow_water_balanced2.swb2_domain import Domain as Domain 14 from anuga.shallow_water.shallow_water_domain import Domain as Domain16 #from anuga.shallow_water.shallow_water_domain import Domain as Domain 15 17 #--------- 16 18 #Setup computational domain … … 21 23 domain.set_name('parabola_v2') # Output to file runup.sww 22 24 domain.set_datadir('.') # Use current folder 23 domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1})24 25 domain.set_minimum_allowed_height(0.001) 25 domain.set_flow_algorithm('tsunami') 26 27 #domain.set_flow_algorithm('tsunami') 26 28 # Time stepping 27 29 #domain.set_timestepping_method('euler') # Default -
trunk/anuga_work/development/gareth/tests/runup/runup.py
r8865 r8990 18 18 #path.append('/home/gareth/storage/anuga_clean/anuga_jan12/trunk/anuga_work/development/gareth/balanced_basic') 19 19 #from balanced_basic import * 20 from bal anced_devimport *20 from bal_and import * 21 21 #from anuga_tsunami import * 22 22 #--------- … … 28 28 domain.set_name('runup_v2') # Output to file runup.sww 29 29 domain.set_datadir('.') # Use current folder 30 domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1})30 #domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1}) 31 31 #domain.set_store_vertices_uniquely(True) 32 32 #------------------ … … 34 34 #------------------ 35 35 36 scale_me=1 00.036 scale_me=1.0 37 37 38 38 def topography(x,y): … … 57 57 Br=anuga.Reflective_boundary(domain) # Solid reflective wall 58 58 Bt=anuga.Transmissive_boundary(domain) # Continue all values of boundary -- not used in this example 59 Bd=anuga.Dirichlet_boundary([-0. 2*scale_me,0.,0.]) # Constant boundary values -- not used in this example59 Bd=anuga.Dirichlet_boundary([-0.18*scale_me,0.,0.]) # Constant boundary values -- not used in this example 60 60 #Bw=anuga.Time_boundary(domain=domain, 61 61 # f=lambda t: [(0.0*sin(t*2*pi)-0.1)*exp(-t)-0.1,0.0,0.0]) # Time varying boundary -- get rid of the 0.0 to do a runup. … … 64 64 # Associate boundary tags with boundary objects 65 65 #---------------------------------------------- 66 domain.set_boundary({'left': Br, 'right': B r, 'top': Br, 'bottom':Br})66 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom':Br}) 67 67 68 68 #------------------------------ … … 70 70 #------------------------------ 71 71 72 for t in domain.evolve(yieldstep=0.2,finaltime= 60.0):72 for t in domain.evolve(yieldstep=0.2,finaltime=10.0): 73 73 print domain.timestepping_statistics() 74 74 uh=domain.quantities['xmomentum'].centroid_values 75 75 vh=domain.quantities['ymomentum'].centroid_values 76 depth=domain.quantities[' stage'].centroid_values - domain.quantities['elevation'].centroid_values76 depth=domain.quantities['height'].centroid_values#domain.quantities['stage'].centroid_values - domain.quantities['elevation'].centroid_values 77 77 depth=depth*(depth>1.0e-06) + 1.0e-06 78 78 vel=((uh/depth)**2 + (vh/depth)**2)**0.5 -
trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoid.py
r8884 r8990 14 14 #from swb2_domain import * 15 15 #from balanced_basic import * 16 from balanced_dev import * 16 #from balanced_dev import * 17 from bal_and import * 17 18 #from anuga_tsunami import * 18 19 -
trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoidplot.py
r8751 r8990 4 4 # Import Modules 5 5 #--------------- 6 import util 6 #import util 7 from bal_and import plot_utils as util 7 8 from matplotlib import pyplot as pyplot 8 9 import numpy -
trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_sparse.py
r8893 r8990 21 21 from anuga.structures.inlet_operator import Inlet_operator 22 22 from anuga.shallow_water.shallow_water_domain import Domain as Domain 23 from bal anced_devimport *23 from bal_and import * 24 24 #from balanced_dev import Domain as Domain 25 25 #from anuga_tsunami import * -
trunk/anuga_work/development/gareth/tests/wave/run_wave.py
r8547 r8990 15 15 16 16 #from balanced_dev import * 17 from anuga_tsunami import * 17 #from anuga_tsunami import * 18 from bal_and import * 18 19 #from balanced_dev import Domain as Domain 19 20 … … 89 90 amplitude = 1 90 91 wave_length = 300.0 91 Bw = anuga.Time_boundary(domain=domain, # Time dependent boundary92 ## Sine wave93 f=lambda t: [(-amplitude*sin((1./wave_length)*t*2*pi)), 0.0, 0.0])92 #Bw = anuga.Time_boundary(domain=domain, # Time dependent boundary 93 ### Sine wave 94 # f=lambda t: [(-amplitude*sin((1./wave_length)*t*2*pi)), 0.0, 0.0]) 94 95 ## Sawtooth? 95 96 # f=lambda t: [(-8.0*(sin((1./180.)*t*2*pi))+(1./2.)*sin((2./180.)*t*2*pi)+(1./3.)*sin((3./180.)*t*2*pi)), 0.0, 0.0]) … … 129 130 #------------------------------------------------------------------------------ 130 131 131 for t in domain.evolve(yieldstep = 10.0, finaltime = 60*60.*3.):132 for t in domain.evolve(yieldstep = 10.0, finaltime = 5*10*60.*3.): 132 133 domain.write_time() 133 134 if interactive_visualisation:
Note: See TracChangeset
for help on using the changeset viewer.