Changeset 1703


Ignore:
Timestamp:
Aug 10, 2005, 4:56:41 PM (19 years ago)
Author:
ole
Message:

Added unstructured mesh

Location:
inundation/ga/storm_surge/validation/LWRU2
Files:
2 added
1 edited

Legend:

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

    r1697 r1703  
    5959
    6060    fid.createVariable('xmomentum', Float, ('number_of_timesteps',))
    61     #fid.variables['xmomentum'][:] = 0.005
    62     #fid.variables['xmomentum'][:-1] = Q[1:]-Q[:-1]/0.05 #Too high
    63     #fid.variables['xmomentum'][:-1] = Q[1:]-Q[:-1]/0.5   #Too low
    64     #fid.variables['xmomentum'][:-1] = Q[1:]-Q[:-1]/0.1   #Too high
    65     #fid.variables['xmomentum'][:-1] = Q[1:]-Q[:-1]/0.25   #Too high
    66     #fid.variables['xmomentum'][:-1] = Q[1:]-Q[:-1]/0.35 #Too low
    67     #fid.variables['xmomentum'][:-1] = Q[1:]-Q[:-1]/0.3  #Too low
    68     #fid.variables['xmomentum'][-1] = 0.0
    69 
    70 
    71     #fid.variables['xmomentum'][:] = 0.003
    7261    fid.variables['xmomentum'][:] = 0.0
    7362
     
    8271            File_boundary, Transmissive_Momentum_Set_Stage_boundary
    8372from pyvolution.mesh_factory import rectangular
     73from pyvolution.pmesh2domain import pmesh_to_domain_instance
    8474from Numeric import array, zeros, Float, allclose
     75import filenames
    8576
    8677picklefile = 'domain.pck'
    8778from cPickle import dump, load
    8879
    89 
    90 boundary_file_name = 'Benchmark_2_input.txt'
    91 bathymetry_file_name = 'Benchmark_2_Bathymetry.txt'
    92 N = 100
     80N = 50
    9381
    9482try:
    95     #raise Exception
     83    raise Exception
    9684    fid = open(picklefile)
    9785    print 'Read pickled domain'
     
    10189
    10290    #Preparing time boundary
    103     prepare_timeboundary(boundary_file_name)
     91    prepare_timeboundary(filenames.boundary_filename)
    10492
    10593    #Preparing points
    10694    from pyvolution.data_manager import xya2pts
    107     xya2pts(bathymetry_file_name, verbose = True,
     95    xya2pts(filenames.bathymetry_filename, verbose = True,
    10896            z_func = lambda z: -z)
    10997
     
    11199    #######################
    112100    # Domain
    113     print 'Creating domain'
    114     points, vertices, boundary = rectangular(N, N/5*3,
    115                                              len1=5.448, len2=3.402)
    116     domain = Domain(points, vertices, boundary)
     101    #print 'Creating domain'
     102    #points, vertices, boundary = rectangular(N, N/5*3,
     103    #                                         len1=5.448, len2=3.402)
     104    #domain = Domain(points, vertices, boundary)
     105
     106    print 'Creating domain from', filenames.mesh_filename
     107    domain = pmesh_to_domain_instance(filenames.mesh_filename, Domain)
     108
     109    print "Number of triangles = ", len(domain)
     110    print 'The extent is ', domain.get_extent()
     111
    117112
    118113    domain.check_integrity()
     
    128123    #LS code to be included in set_quantity
    129124    from pyvolution import util, least_squares
    130     points, attributes = util.read_xya(bathymetry_file_name[:-4] + '.pts')
     125    points, attributes = util.read_xya(filenames.bathymetry_filename[:-4] + '.pts')
    131126
    132127    #Fit attributes to mesh
     
    140135    print 'Initial values'
    141136    domain.set_quantity('elevation', vertex_attributes)
    142     #domain.set_quantity('elevation', bathymetry_file_name[:-4] + '.pts')
    143137    domain.set_quantity('friction', 0.0)
    144138    domain.set_quantity('stage', 0.0)
     
    155149print 'Boundaries'
    156150Br = Reflective_boundary(domain)
    157 #Bf = File_boundary(boundary_file_name[:-4] + '.sww', domain, verbose=True)
    158151
    159152#####################
     
    161154# stage and let the scheme set the momentum
    162155from pyvolution.util import file_function
    163 function = file_function(boundary_file_name[:-4] + '.sww', domain,verbose = True)
     156function = file_function(filenames.boundary_filename[:-4] + '.sww', domain,
     157                         verbose = True)
    164158Bts = Transmissive_Momentum_Set_Stage_boundary(domain,function)
    165159
Note: See TracChangeset for help on using the changeset viewer.