Changeset 1691


Ignore:
Timestamp:
Aug 8, 2005, 2:37:37 PM (18 years ago)
Author:
ole
Message:

minor clean up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/validation/LWRU2/lwru2.py

    r1688 r1691  
    77http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2
    88
     9Depth at western boundary is d = 13.5 cm
    910"""
    1011
     
    4344    from Scientific.IO.NetCDF import NetCDFFile
    4445
    45     print filename[:-4] + '.sww'
    46 
    47     fid = NetCDFFile(filename[:-4] + '.sww', 'w')
     46    outfile = filename[:-4] + '.sww'
     47    print 'Writing to', outfile
     48    fid = NetCDFFile(outfile, 'w')
    4849
    4950    fid.institution = 'Geoscience Australia'
     
    5859
    5960    fid.createVariable('xmomentum', Float, ('number_of_timesteps',))
    60     fid.variables['xmomentum'][:] = 0.0
    61 
     61    fid.variables['xmomentum'][:] = 0.0 #0.04
    6262    fid.createVariable('ymomentum', Float, ('number_of_timesteps',))
    6363    fid.variables['ymomentum'][:] = 0.0
    6464
     65    fid.close()
    6566
    6667
    67     fid.close()
    6868
    6969
     
    7777from cPickle import dump, load
    7878
     79
     80boundary_file_name = 'Benchmark_2_input.txt'
     81bathymetry_file_name = 'Benchmark_2_Bathymetry.txt'
     82
     83   
    7984try:
     85    raise Exception
    8086    print 'Read pickled domain'
    8187    fid = open(picklefile)
     
    8591
    8692    #Preparing time boundary
    87     prepare_timeboundary('Benchmark_2_input.txt')
     93    prepare_timeboundary(boundary_file_name)
    8894
    8995    #Preparing points
    9096    from pyvolution.data_manager import xya2pts
    91     xya2pts('Benchmark_2_Bathymetry.txt', verbose = True)
     97    xya2pts(bathymetry_file_name, verbose = True,
     98            z_func = lambda z: -z)
    9299
    93100
     
    95102    # Domain
    96103    print 'Creating domain'
    97     points, vertices, boundary = rectangular(200, 200/5*3,
     104    points, vertices, boundary = rectangular(100, 100/5*3,
    98105                                             len1=5.448, len2=3.402)
    99106    domain = Domain(points, vertices, boundary)
     
    111118    #LS code to be included in set_quantity
    112119    from pyvolution import util, least_squares
    113     points, attributes = util.read_xya('Benchmark_2_Bathymetry.pts')
    114 
     120    points, attributes = util.read_xya(bathymetry_file_name[:-4] + '.pts')
     121   
    115122    #Fit attributes to mesh
    116123    vertex_attributes = least_squares.fit_to_mesh(domain.coordinates,
     
    118125                                                  points,
    119126                                                  attributes['elevation'],
     127                                                  alpha = 0,
    120128                                                  verbose=True)
    121129
    122130    print 'Initial values'
    123131    domain.set_quantity('elevation', vertex_attributes)
     132    #domain.set_quantity('elevation', bathymetry_file_name[:-4] + '.pts')   
    124133    domain.set_quantity('friction', 0.0)
    125134    domain.set_quantity('stage', 0.0)
     
    137146print 'Boundaries'
    138147Br = Reflective_boundary(domain)
    139 Bf = File_boundary('Benchmark_2_input.sww', domain, verbose=True)
     148Bf = File_boundary(boundary_file_name[:-4] + '.sww', domain, verbose=True)
    140149
    141150#Set boundary conditions
    142151domain.set_boundary({'left': Bf, 'right': Br, 'bottom': Br, 'top': Br})
     152
     153
    143154
    144155
     
    148159domain.visualise = True
    149160
    150 for t in domain.evolve(yieldstep = 1.0, finaltime = 22.5):
     161for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):
    151162    domain.write_time()
    152163
Note: See TracChangeset for help on using the changeset viewer.