Changeset 8990


Ignore:
Timestamp:
Sep 26, 2013, 11:27:01 AM (11 years ago)
Author:
davies
Message:

First-draft Audusse-type solver in anuga_work/gareth/development/experimental/bal_and

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  
    1414#from anuga import *
    1515#from balanced_basic import *
    16 from balanced_dev import *
     16#from balanced_dev import *
     17from bal_and import *
    1718#from anuga_tsunami import *
    1819#from balanced_basic.swb2_domain import *
  • trunk/anuga_work/development/gareth/tests/channel_floodplain/plotme.py

    r8867 r8990  
    1 import util
     1#import util
     2from bal_and import plot_utils as util
    23from matplotlib import pyplot as pyplot
    34#import pylab
    45
    56# Time-index to plot outputs from
    6 index=900
     7index=150
     8#index=900
    79
    810#p2 = util.get_output('channel_floodplain1_bal_dev.sww', minimum_allowed_height=0.01)
     
    2830
    2931# Numerical results along a central channel 'slice'
    30 V1 = p.stage[index,v] - p.elev[v]
     32V1 = p.stage[index,v] - p.elev[index,v]
    3133V2 = p.yvel[index,v]
    3234V3 = p.xvel[index,v]
     
    9092
    9193pyplot.clf()
    92 analytical_stage = min(p.elev[v1]) + dc_analytical
    93 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[v1])**(4./3.)*(1./0.03)**2.)**0.5
    94 analytic_vel = analytic_vel*(analytical_stage>p.elev[v1])
     94analytical_stage = min(p.elev[index,v1]) + dc_analytical
     95analytic_vel = ( (1./300.)*(analytical_stage-p.elev[index,v1])**(4./3.)*(1./0.03)**2.)**0.5
     96analytic_vel = analytic_vel*(analytical_stage>p.elev[index,v1])
    9597pyplot.figure(figsize=(12.,8.))
    9698pyplot.plot(p.x[v1], p.yvel[index,v1],'o', label='computed velocity (m/s)')
    9799pyplot.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)')
     100pyplot.plot(p.x[v1],p.elev[index,v1],'o', label='bed elevation (m)')
    99101pyplot.plot(p.x[v1],p.stage[index,v1],'o', label='computed stage (m)')
    100102pyplot.plot(p.x[v1],p.stage[index,v1]*0. + analytical_stage,'o', label='analytical stage (m)')
     
    109111
    110112pyplot.clf()
    111 analytical_stage = min(p.elev[v1]) + dc_analytical
    112 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[v1])**(4./3.)*(1./0.03)**2.)**0.5
    113 analytic_vel = analytic_vel*(analytical_stage>p.elev[v1])
     113analytical_stage = min(p.elev[index,v1]) + dc_analytical
     114analytic_vel = ( (1./300.)*(analytical_stage-p.elev[index,v1])**(4./3.)*(1./0.03)**2.)**0.5
     115analytic_vel = analytic_vel*(analytical_stage>p.elev[index,v1])
    114116pyplot.figure(figsize=(12.,8.))
    115117pyplot.plot(p.x[v1], p.yvel[index,v1],'o', label='computed velocity (m/s)')
    116118pyplot.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)')
     119pyplot.plot(p.x[v1],p.elev[index,v1],'o', label='bed elevation (m)')
    118120pyplot.plot(p.x[v1],p.stage[index,v1],'o', label='computed stage (m)')
    119121pyplot.plot(p.x[v1],p.stage[index,v1]*0. + analytical_stage,'o', label='analytical stage (m)')
     
    127129
    128130pyplot.clf()
    129 analytical_stage = min(p.elev[v1]) + dc_analytical
    130 analytic_vel = ( (1./300.)*(analytical_stage-p.elev[v1])**(4./3.)*(1./0.03)**2.)**0.5
    131 analytic_vel = analytic_vel*(analytical_stage>p.elev[v1])
     131analytical_stage = min(p.elev[index,v1]) + dc_analytical
     132analytic_vel = ( (1./300.)*(analytical_stage-p.elev[index,v1])**(4./3.)*(1./0.03)**2.)**0.5
     133analytic_vel = analytic_vel*(analytical_stage>p.elev[index,v1])
    132134pyplot.figure(figsize=(12.,8.))
    133135pyplot.plot(p.x[v1], p.yvel[index,v1],'o', label='computed velocity (m/s)')
    134136pyplot.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)')
     137pyplot.plot(p.x[v1],p.elev[index,v1],'o', label='bed elevation (m)')
    136138pyplot.plot(p.x[v1],p.stage[index,v1],'o', label='computed stage (m)')
    137139pyplot.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  
    88import numpy
    99
     10from bal_and import *
     11
    1012#from balanced_dev import *
    1113#from anuga_tsunami import *
    1214#from balanced_basic import *
    1315#from anuga.shallow_water_balanced2.swb2_domain import Domain as Domain
    14 from anuga.shallow_water.shallow_water_domain import Domain as Domain
     16#from anuga.shallow_water.shallow_water_domain import Domain as Domain
    1517#---------
    1618#Setup computational domain
     
    2123domain.set_name('parabola_v2')                         # Output to file runup.sww
    2224domain.set_datadir('.')                          # Use current folder
    23 domain.set_quantities_to_be_stored({'stage': 2, 'xmomentum': 2, 'ymomentum': 2, 'elevation': 1})
    2425domain.set_minimum_allowed_height(0.001)
    25 domain.set_flow_algorithm('tsunami')
     26
     27#domain.set_flow_algorithm('tsunami')
    2628# Time stepping
    2729#domain.set_timestepping_method('euler') # Default
  • trunk/anuga_work/development/gareth/tests/runup/runup.py

    r8865 r8990  
    1818#path.append('/home/gareth/storage/anuga_clean/anuga_jan12/trunk/anuga_work/development/gareth/balanced_basic')
    1919#from balanced_basic import *
    20 from balanced_dev import *
     20from bal_and import *
    2121#from anuga_tsunami import *
    2222#---------
     
    2828domain.set_name('runup_v2')                         # Output to file runup.sww
    2929domain.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})
    3131#domain.set_store_vertices_uniquely(True)
    3232#------------------
     
    3434#------------------
    3535
    36 scale_me=100.0
     36scale_me=1.0
    3737
    3838def topography(x,y):
     
    5757Br=anuga.Reflective_boundary(domain)            # Solid reflective wall
    5858Bt=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 example
     59Bd=anuga.Dirichlet_boundary([-0.18*scale_me,0.,0.])       # Constant boundary values -- not used in this example
    6060#Bw=anuga.Time_boundary(domain=domain,
    6161#       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.
     
    6464# Associate boundary tags with boundary objects
    6565#----------------------------------------------
    66 domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom':Br})
     66domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom':Br})
    6767
    6868#------------------------------
     
    7070#------------------------------
    7171
    72 for t in domain.evolve(yieldstep=0.2,finaltime=60.0):
     72for t in domain.evolve(yieldstep=0.2,finaltime=10.0):
    7373    print domain.timestepping_statistics()
    7474    uh=domain.quantities['xmomentum'].centroid_values
    7575    vh=domain.quantities['ymomentum'].centroid_values
    76     depth=domain.quantities['stage'].centroid_values - domain.quantities['elevation'].centroid_values
     76    depth=domain.quantities['height'].centroid_values#domain.quantities['stage'].centroid_values - domain.quantities['elevation'].centroid_values
    7777    depth=depth*(depth>1.0e-06) + 1.0e-06
    7878    vel=((uh/depth)**2 + (vh/depth)**2)**0.5
  • trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoid.py

    r8884 r8990  
    1414#from swb2_domain import *
    1515#from balanced_basic import *
    16 from balanced_dev import *
     16#from balanced_dev import *
     17from bal_and import *
    1718#from anuga_tsunami import *
    1819
  • trunk/anuga_work/development/gareth/tests/runup_sinusoid/runup_sinusoidplot.py

    r8751 r8990  
    44# Import Modules
    55#---------------
    6 import util
     6#import util
     7from bal_and import plot_utils as util
    78from matplotlib import pyplot as pyplot
    89import numpy
  • trunk/anuga_work/development/gareth/tests/shallow_steep_slope/channel_SU_sparse.py

    r8893 r8990  
    2121from anuga.structures.inlet_operator import Inlet_operator
    2222from anuga.shallow_water.shallow_water_domain import Domain as Domain
    23 from balanced_dev import *
     23from bal_and import *
    2424#from balanced_dev import Domain as Domain
    2525#from anuga_tsunami import *
  • trunk/anuga_work/development/gareth/tests/wave/run_wave.py

    r8547 r8990  
    1515
    1616#from balanced_dev import *
    17 from anuga_tsunami import *
     17#from anuga_tsunami import *
     18from bal_and import *
    1819#from balanced_dev import Domain as Domain
    1920
     
    8990amplitude = 1
    9091wave_length = 300.0
    91 Bw = anuga.Time_boundary(domain=domain,     # Time dependent boundary
    92 ## Sine wave
    93                   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])
    9495## Sawtooth?
    9596#                   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])
     
    129130#------------------------------------------------------------------------------
    130131
    131 for t in domain.evolve(yieldstep = 10.0, finaltime = 60*60.*3.):
     132for t in domain.evolve(yieldstep = 10.0, finaltime = 5*10*60.*3.):
    132133    domain.write_time()
    133134    if interactive_visualisation:
Note: See TracChangeset for help on using the changeset viewer.