Changeset 3846


Ignore:
Timestamp:
Oct 24, 2006, 12:59:08 PM (16 years ago)
Author:
ole
Message:

Refactored references to domain.filename away.
Use

domain.set_name()
domain.get_name()

instead.

Files:
43 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py

    r3829 r3846  
    196196        from anuga.config import default_datadir
    197197        self.datadir = default_datadir
    198         self.filename = 'domain'
     198        self.simulation_name = 'domain'
    199199        self.checkpoint = False
    200200
     
    633633
    634634    def get_name(self):
    635         return self.filename
     635        return self.simulation_name
    636636
    637637    def set_name(self, name):
    638         self.filename = name
     638        """Assign a name to this simulation.
     639        This will be used to identify the output sww file.
     640
     641        """
     642        if name.endswith('.sww'):
     643            name = name[-4:]
     644           
     645        self.simulation_name = name
    639646
    640647    def get_datadir(self):
  • anuga_core/source/anuga/abstract_2d_finite_volumes/show_balanced_limiters.py

    r3655 r3846  
    3939#domain.visualise = True
    4040domain.default_order = 2
    41 domain.filename = 'show_balanced_limiters'
     41domain.set_name('show_balanced_limiters')
    4242domain.store = True
    4343domain.format = 'sww'   #Native netcdf visualisation format
  • anuga_core/source/anuga/damage_modelling/test_inundation_damage.py

    r3807 r3846  
    115115       
    116116        #sww_file = tempfile.mktemp("")
    117         self.domain.filename = 'datatest' + str(time.time())
    118         #self.domain.filename = sww_file
    119         #print "self.domain.filename",self.domain.filename
     117        self.domain.set_name('datatest' + str(time.time()))
    120118        self.domain.format = 'sww'
    121119        self.domain.smooth = True
     
    158156        # Note, this isn't testing the results,
    159157        # just that is all runs
    160         sww_file = self.domain.filename + "." + self.domain.format
     158        sww_file = self.domain.get_name() + "." + self.domain.format
    161159        #print "sww_file",sww_file
    162160        inundation_damage(sww_file, self.csv_file, verbose=False)
     
    197195
    198196        #sww_file = tempfile.mktemp("")
    199         domain.filename = 'datatest' + str(time.time())
    200         #domain.filename = sww_file
    201         #print "domain.filename",domain.filename
     197        domain.set_name('datatest' + str(time.time()))
    202198        domain.format = 'sww'
    203199        domain.smooth = True
     
    222218        fd.close()
    223219
    224         sww_file = domain.filename + "." + domain.format
     220        sww_file = domain.get_name() + "." + domain.format
    225221        #print "sww_file",sww_file
    226222        inundation_damage(sww_file, csv_file, verbose=False)
     
    239235       
    240236    def ztest_add_depth_and_momentum2csv(self):
    241         sww_file = self.domain.filename + "." + self.domain.format
     237        sww_file = self.domain.get_name() + "." + self.domain.format
    242238        #print "sww_file",sww_file
    243239       
  • anuga_core/source/anuga/examples/beach.py

    r3656 r3846  
    3737domain.default_order = 2
    3838print "Output being written to " + domain.get_datadir() + sep + \
    39       domain.filename + domain.format
     39      domain.get_name() + domain.format
    4040
    4141
  • anuga_core/source/anuga/examples/cornell_room.py

    r3565 r3846  
    7373else:
    7474    s = 'nonsmooth'       
    75 domain.filename = root + '_' + s
     75domain.set_name(root + '_' + s)
    7676
    7777#Set bed-slope and friction
  • anuga_core/source/anuga/examples/flatbed.py

    r3565 r3846  
    2525domain.set_name('polygons')
    2626print "Output being written to " + domain.get_datadir() + sep + \
    27               domain.filename + "_size%d." %len(domain) + domain.format
     27              domain.get_name() + "_size%d." %len(domain) + domain.format
    2828       
    2929
  • anuga_core/source/anuga/examples/netherlands.py

    r3842 r3846  
    126126    #FIXME: This was os.path.splitext but caused weird filenames based on root
    127127    base = os.path.basename(sys.argv[0])
    128     domain.filename, _ = os.path.splitext(base)
     128    basename, _ = os.path.splitext(base)
     129    domain.set_name(basename)
    129130else:
    130131    #domain.initialise_visualiser(rect=[0.0,0.0,1.0,1.0])
  • anuga_core/source/anuga/examples/pressure_force.py

    r3565 r3846  
    2424
    2525domain.store = True
    26 domain.filename = 'pressure'
     26domain.set_name('pressure')
    2727
    2828#######################
  • anuga_core/source/anuga/examples/run_gong.py

    r3535 r3846  
    6363        file_path, filename = path.split(filename)
    6464        filename, ext = path.splitext(filename)
    65         domain.filename = filename + '_' + '_ys'+ str(yieldstep) + \
    66                           '_ft' + str(finaltime)
     65        domain.set_name(filename + '_' + '_ys'+ str(yieldstep) + \
     66                        '_ft' + str(finaltime))
    6767        print "Output being written to " + domain.get_datadir() + sep + \
    68               domain.filename + "." + domain.format
     68              domain.get_name() + "." + domain.format
    6969
    7070
  • anuga_core/source/anuga/examples/run_tsh.py

    r3535 r3846  
    7676        else:
    7777            s = 'nonsmooth'       
    78         domain.filename = filename + '_' + s + '_ys'+ str(yieldstep) + \
    79                           '_ft' + str(finaltime)
     78        domain.set_name(filename + '_' + s + '_ys'+ str(yieldstep) + \
     79                        '_ft' + str(finaltime))
    8080        print "Output being written to " + domain.get_datadir() + sep + \
    81               domain.filename + "." + domain.format
     81              domain.get_name() + "." + domain.format
    8282
    8383
  • anuga_core/source/anuga/examples/run_tsh_weir.py

    r3565 r3846  
    4141domain.store = False #True
    4242domain.format = 'sww'
    43 domain.filename = 'weir'
     43domain.set_name('weir')
    4444domain.checkpoint = False #True
    4545domain.visualise = True #False
  • anuga_core/source/anuga/examples/twolevels.py

    r3567 r3846  
    2525domain.set_name('two_levels')
    2626print "Output being written to " + domain.get_datadir() + sep + \
    27               domain.filename + "_size%d." %len(domain) + domain.format
     27              domain.get_name() + "_size%d." %len(domain) + domain.format
    2828       
    2929
  • anuga_core/source/anuga/fit_interpolate/test_interpolate.py

    r3689 r3846  
    14931493        domain.set_quantity('stage', 1.0)
    14941494
    1495         #sww_file = tempfile.mktemp("")
    1496         domain.filename = 'datatest' + str(time.time())
    1497         #domain.filename = sww_file
    1498         #print "domain.filename",domain.filename
     1495
     1496        domain.set_name('datatest' + str(time.time()))
    14991497        domain.format = 'sww'
    15001498        domain.smooth = True
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r3830 r3846  
    212212
    213213        #Create filename
    214         #self.filename = create_filename(domain.get_datadir(),
    215         #domain.get_name(), extension, len(domain))
    216 
    217 
    218214        self.filename = create_filename(domain.get_datadir(),
    219215            domain.get_name(), extension)
     
    429425            #remember the old filename, then give domain a
    430426            #name with the extension
    431             old_domain_filename = self.domain.filename
     427            old_domain_filename = self.domain.get_name()
    432428            if not self.recursion:
    433                 self.domain.filename = self.domain.filename+filename_ext
     429                self.domain.set_name(old_domain_filename+filename_ext)
     430
    434431
    435432            #change the domain starttime to the current time
     
    456453            #restore the old starttime and filename
    457454            self.domain.starttime = old_domain_starttime
    458             self.domain.filename = old_domain_filename
     455            self.domain.set_name(old_domain_filename)           
    459456        else:
    460457            self.recursion = False
     
    35633560    file_path, filename = path.split(filename)
    35643561    filename, ext = path.splitext(filename)
    3565     domain.filename = filename
     3562    domain.set_name(filename)   
    35663563    domain.reduction = mean
    35673564    if verbose == True:print "file_path",file_path
     
    35713568    if verbose == True:
    35723569        print "Output written to " + domain.get_datadir() + sep + \
    3573               domain.filename + "." + domain.format
     3570              domain.get_name() + "." + domain.format
    35743571    sww = get_dataobject(domain)
    35753572    sww.store_connectivity()
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r3820 r3846  
    162162        from Scientific.IO.NetCDF import NetCDFFile
    163163
    164         self.domain.filename = 'datatest' + str(id(self))
    165         self.domain.format = 'sww'
     164        self.domain.set_name('datatest' + str(id(self)))
     165        self.domain.format = 'sww' #Remove??
    166166        self.domain.smooth = False
    167167
     
    209209        from Scientific.IO.NetCDF import NetCDFFile
    210210
    211         self.domain.filename = 'datatest' + str(id(self))
     211        self.domain.set_name('datatest' + str(id(self)))
    212212        self.domain.format = 'sww'
    213213        self.domain.smooth = True
     
    266266        from Scientific.IO.NetCDF import NetCDFFile
    267267
    268         self.domain.filename = 'datatest' + str(id(self))
     268        self.domain.set_name('datatest' + str(id(self)))
    269269        self.domain.format = 'sww'
    270270        self.domain.smooth = True
     
    321321        from Scientific.IO.NetCDF import NetCDFFile
    322322
    323         self.domain.filename = 'datatest' + str(id(self))
     323        self.domain.set_name('datatest' + str(id(self)))
    324324        self.domain.format = 'sww'
    325325        self.domain.smooth = True
     
    376376        from Scientific.IO.NetCDF import NetCDFFile
    377377
    378         self.domain.filename = 'datatest' + str(id(self))
     378        self.domain.set_name('datatest' + str(id(self)))
    379379        self.domain.format = 'sww'
    380380        self.domain.smooth = True
     
    432432        from Scientific.IO.NetCDF import NetCDFFile
    433433
    434         self.domain.filename = 'synctest'
     434        self.domain.set_name('synctest')
    435435        self.domain.format = 'sww'
    436436        self.domain.smooth = False
     
    467467        from Scientific.IO.NetCDF import NetCDFFile
    468468
    469         self.domain.filename = 'datatest' + str(id(self))
     469        self.domain.set_name('datatest' + str(id(self)))
    470470        self.domain.format = 'sww'
    471471        self.domain.smooth = True
     
    515515        from Scientific.IO.NetCDF import NetCDFFile
    516516
    517         self.domain.filename = 'datatest' + str(id(self))
     517        self.domain.set_name('datatest' + str(id(self)))
    518518        self.domain.format = 'sww'
    519519        self.domain.smooth = True
     
    11361136
    11371137        #Setup
    1138         self.domain.filename = 'datatest'
    1139 
    1140         prjfile = self.domain.filename + '_elevation.prj'
    1141         ascfile = self.domain.filename + '_elevation.asc'
    1142         swwfile = self.domain.filename + '.sww'
     1138        self.domain.set_name('datatest')
     1139
     1140        prjfile = self.domain.get_name() + '_elevation.prj'
     1141        ascfile = self.domain.get_name() + '_elevation.asc'
     1142        swwfile = self.domain.get_name() + '.sww'
    11431143
    11441144        self.domain.set_datadir('.')
     
    11711171
    11721172        #Export to ascii/prj files
    1173         sww2dem(self.domain.filename,
     1173        sww2dem(self.domain.get_name(),
    11741174                quantity = 'elevation',
    11751175                cellsize = cellsize,
     
    13031303        domain.default_order = 2
    13041304
    1305         domain.filename = 'datatest'
    1306 
    1307         prjfile = domain.filename + '_elevation.prj'
    1308         ascfile = domain.filename + '_elevation.asc'
    1309         swwfile = domain.filename + '.sww'
     1305        domain.set_name('datatest')
     1306
     1307        prjfile = domain.get_name() + '_elevation.prj'
     1308        ascfile = domain.get_name() + '_elevation.asc'
     1309        swwfile = domain.get_name() + '.sww'
    13101310
    13111311        domain.set_datadir('.')
     
    13471347
    13481348        #Export to ascii/prj files
    1349         sww2dem(domain.filename,
     1349        sww2dem(domain.get_name(),
    13501350                quantity = 'elevation',
    13511351                cellsize = cellsize,
     
    14871487        domain.default_order = 2
    14881488
    1489         domain.filename = 'datatest'
    1490 
    1491         prjfile = domain.filename + '_elevation.prj'
    1492         ascfile = domain.filename + '_elevation.asc'
    1493         swwfile = domain.filename + '.sww'
     1489        domain.set_name('datatest')
     1490
     1491        prjfile = domain.get_name() + '_elevation.prj'
     1492        ascfile = domain.get_name() + '_elevation.asc'
     1493        swwfile = domain.get_name() + '.sww'
    14941494
    14951495        domain.set_datadir('.')
     
    15311531
    15321532        #Export to ascii/prj files
    1533         sww2dem(domain.filename,
     1533        sww2dem(domain.get_name(),
    15341534                quantity = 'elevation',
    15351535                cellsize = cellsize,
     
    16411641
    16421642        #Setup
    1643         self.domain.filename = 'datatest'
    1644 
    1645         prjfile = self.domain.filename + '_stage.prj'
    1646         ascfile = self.domain.filename + '_stage.asc'
    1647         swwfile = self.domain.filename + '.sww'
     1643        self.domain.set_name('datatest')
     1644
     1645        prjfile = self.domain.get_name() + '_stage.prj'
     1646        ascfile = self.domain.get_name() + '_stage.asc'
     1647        swwfile = self.domain.get_name() + '.sww'
    16481648
    16491649        self.domain.set_datadir('.')
     
    16771677
    16781678        #Export to ascii/prj files
    1679         sww2dem(self.domain.filename,
     1679        sww2dem(self.domain.get_name(),
    16801680                quantity = 'stage',
    16811681                cellsize = cellsize,
    16821682                reduction = min,
    1683                 format = 'asc')
     1683                format = 'asc')
    16841684
    16851685
     
    17501750
    17511751        #Setup
    1752         self.domain.filename = 'datatest'
    1753 
    1754         prjfile = self.domain.filename + '_depth.prj'
    1755         ascfile = self.domain.filename + '_depth.asc'
    1756         swwfile = self.domain.filename + '.sww'
     1752        self.domain.set_name('datatest')
     1753
     1754        prjfile = self.domain.get_name() + '_depth.prj'
     1755        ascfile = self.domain.get_name() + '_depth.asc'
     1756        swwfile = self.domain.get_name() + '.sww'
    17571757
    17581758        self.domain.set_datadir('.')
     
    17871787
    17881788        #Export to ascii/prj files
    1789         sww2dem(self.domain.filename,
     1789        sww2dem(self.domain.get_name(),
    17901790                basename_out = 'datatest_depth',
    17911791                quantity = 'stage - elevation',
    17921792                cellsize = cellsize,
    17931793                reduction = min,
    1794                 format = 'asc',
     1794                format = 'asc',
    17951795                verbose = False)
    17961796
     
    19051905        domain.distribute_to_vertices_and_edges()
    19061906
    1907         domain.filename = 'datatest'
    1908 
    1909         prjfile = domain.filename + '_elevation.prj'
    1910         ascfile = domain.filename + '_elevation.asc'
    1911         swwfile = domain.filename + '.sww'
     1907        domain.set_name('datatest')
     1908
     1909        prjfile = domain.get_name() + '_elevation.prj'
     1910        ascfile = domain.get_name() + '_elevation.asc'
     1911        swwfile = domain.get_name() + '.sww'
    19121912
    19131913        domain.set_datadir('.')
     
    19391939
    19401940        #Export to ascii/prj files
    1941         sww2dem(domain.filename,
     1941        sww2dem(domain.get_name(),
    19421942                quantity = 'elevation',
    19431943                cellsize = cellsize,
    19441944                verbose = False,
    1945                 format = 'asc')
     1945                format = 'asc')
    19461946
    19471947
     
    20112011
    20122012        #Setup
    2013         self.domain.filename = 'datatest'
    2014 
    2015         headerfile = self.domain.filename + '.ers'
    2016         swwfile = self.domain.filename + '.sww'
     2013        self.domain.set_name('datatest')
     2014
     2015        headerfile = self.domain.get_name() + '.ers'
     2016        swwfile = self.domain.get_name() + '.sww'
    20172017
    20182018        self.domain.set_datadir('.')
     
    20452045
    20462046        #Export to ers files
    2047         sww2dem(self.domain.filename,
     2047        sww2dem(self.domain.get_name(),
    20482048                quantity = 'elevation',
    20492049                cellsize = cellsize,
    20502050                NODATA_value = NODATA_value,
    20512051                verbose = False,
    2052                 format = 'ers')
     2052                format = 'ers')
    20532053
    20542054        #Check header data
    2055         from ermapper_grids import read_ermapper_header, read_ermapper_data
    2056 
    2057         header = read_ermapper_header(self.domain.filename + '_elevation.ers')
     2055        from ermapper_grids import read_ermapper_header, read_ermapper_data
     2056
     2057        header = read_ermapper_header(self.domain.get_name() + '_elevation.ers')
    20582058        #print header
    20592059        assert header['projection'].lower() == '"utm-56"'
     
    20682068        assert int(header['nrofcellsperline']) == 5
    20692069        assert int(header['nullcellvalue']) == NODATA_value
    2070         #FIXME - there is more in the header
     2070        #FIXME - there is more in the header
    20712071
    20722072
    20732073        #Check grid data
    2074         grid = read_ermapper_data(self.domain.filename + '_elevation')
    2075 
    2076         #FIXME (Ole): Why is this the desired reference grid for -x-y?
    2077         ref_grid = [NODATA_value, NODATA_value, NODATA_value, NODATA_value, NODATA_value,
    2078                     -1,    -1.25, -1.5,  -1.75, -2.0,
    2079                     -0.75, -1.0,  -1.25, -1.5,  -1.75,
    2080                     -0.5,  -0.75, -1.0,  -1.25, -1.5,
    2081                     -0.25, -0.5,  -0.75, -1.0,  -1.25]
     2074        grid = read_ermapper_data(self.domain.get_name() + '_elevation')
     2075
     2076        #FIXME (Ole): Why is this the desired reference grid for -x-y?
     2077        ref_grid = [NODATA_value, NODATA_value, NODATA_value, NODATA_value, NODATA_value,
     2078                    -1,    -1.25, -1.5,  -1.75, -2.0,
     2079                    -0.75, -1.0,  -1.25, -1.5,  -1.75,
     2080                    -0.5,  -0.75, -1.0,  -1.25, -1.5,
     2081                    -0.25, -0.5,  -0.75, -1.0,  -1.25]
    20822082
    20832083
    20842084        #print grid
    2085         assert allclose(grid, ref_grid)
     2085        assert allclose(grid, ref_grid)
    20862086
    20872087        fid.close()
     
    20912091        #Done (Ole) - it was because sww2ers didn't close it's sww file
    20922092        os.remove(sww.filename)
    2093         os.remove(self.domain.filename + '_elevation')
    2094         os.remove(self.domain.filename + '_elevation.ers')
     2093        os.remove(self.domain.get_name() + '_elevation')
     2094        os.remove(self.domain.get_name() + '_elevation.ers')
    20952095
    20962096
     
    21102110
    21112111        # Setup
    2112         self.domain.filename = 'datatest'
    2113 
    2114         ptsfile = self.domain.filename + '_elevation.pts'
    2115         swwfile = self.domain.filename + '.sww'
     2112        self.domain.set_name('datatest')
     2113
     2114        ptsfile = self.domain.get_name() + '_elevation.pts'
     2115        swwfile = self.domain.get_name() + '.sww'
    21162116
    21172117        self.domain.set_datadir('.')
     
    21442144        # Invoke interpolation for vertex points       
    21452145        points = concatenate( (x[:,NewAxis],y[:,NewAxis]), axis=1 )
    2146         sww2pts(self.domain.filename,
     2146        sww2pts(self.domain.get_name(),
    21472147                quantity = 'elevation',
    21482148                data_points = points,
     
    21532153        #print 'P', point_values
    21542154        #print 'Ref', ref_point_values       
    2155         assert allclose(point_values, ref_point_values)       
     2155        assert allclose(point_values, ref_point_values)       
    21562156
    21572157
     
    21602160        points = self.domain.get_centroid_coordinates()
    21612161        #print points
    2162         sww2pts(self.domain.filename,
     2162        sww2pts(self.domain.get_name(),
    21632163                quantity = 'elevation',
    21642164                data_points = points,
     
    21712171        #print 'P', point_values
    21722172        #print 'Ref', ref_point_values       
    2173         assert allclose(point_values, ref_point_values)       
     2173        assert allclose(point_values, ref_point_values)       
    21742174
    21752175
     
    22332233        #Check first value
    22342234        stage = fid.variables['stage'][:]
    2235         xmomentum = fid.variables['xmomentum'][:]
    2236         ymomentum = fid.variables['ymomentum'][:]
    2237 
    2238         #print ymomentum
     2235        xmomentum = fid.variables['xmomentum'][:]
     2236        ymomentum = fid.variables['ymomentum'][:]
     2237
     2238        #print ymomentum
    22392239
    22402240        assert allclose(stage[0,0], first_value/100)  #Meters
     
    23512351
    23522352        for fid in [fid1,fid2,fid3]:
    2353             fid.createDimension(long_name,nx)
    2354             fid.createVariable(long_name,'d',(long_name,))
    2355             fid.variables[long_name].point_spacing='uneven'
    2356             fid.variables[long_name].units='degrees_east'
    2357             fid.variables[long_name].assignValue(h1_list)
    2358 
    2359             fid.createDimension(lat_name,ny)
    2360             fid.createVariable(lat_name,'d',(lat_name,))
    2361             fid.variables[lat_name].point_spacing='uneven'
    2362             fid.variables[lat_name].units='degrees_north'
    2363             fid.variables[lat_name].assignValue(h2_list)
    2364 
    2365             fid.createDimension(time_name,2)
    2366             fid.createVariable(time_name,'d',(time_name,))
    2367             fid.variables[time_name].point_spacing='uneven'
    2368             fid.variables[time_name].units='seconds'
    2369             fid.variables[time_name].assignValue([0.,1.])
    2370             if fid == fid3: break
     2353            fid.createDimension(long_name,nx)
     2354            fid.createVariable(long_name,'d',(long_name,))
     2355            fid.variables[long_name].point_spacing='uneven'
     2356            fid.variables[long_name].units='degrees_east'
     2357            fid.variables[long_name].assignValue(h1_list)
     2358
     2359            fid.createDimension(lat_name,ny)
     2360            fid.createVariable(lat_name,'d',(lat_name,))
     2361            fid.variables[lat_name].point_spacing='uneven'
     2362            fid.variables[lat_name].units='degrees_north'
     2363            fid.variables[lat_name].assignValue(h2_list)
     2364
     2365            fid.createDimension(time_name,2)
     2366            fid.createVariable(time_name,'d',(time_name,))
     2367            fid.variables[time_name].point_spacing='uneven'
     2368            fid.variables[time_name].units='seconds'
     2369            fid.variables[time_name].assignValue([0.,1.])
     2370            if fid == fid3: break
    23712371
    23722372
    23732373        for fid in [fid4]:
    2374             fid.createDimension(long_name,nx)
    2375             fid.createVariable(long_name,'d',(long_name,))
    2376             fid.variables[long_name].point_spacing='uneven'
    2377             fid.variables[long_name].units='degrees_east'
    2378             fid.variables[long_name].assignValue(h1_list)
    2379 
    2380             fid.createDimension(lat_name,ny)
    2381             fid.createVariable(lat_name,'d',(lat_name,))
    2382             fid.variables[lat_name].point_spacing='uneven'
    2383             fid.variables[lat_name].units='degrees_north'
    2384             fid.variables[lat_name].assignValue(h2_list)
     2374            fid.createDimension(long_name,nx)
     2375            fid.createVariable(long_name,'d',(long_name,))
     2376            fid.variables[long_name].point_spacing='uneven'
     2377            fid.variables[long_name].units='degrees_east'
     2378            fid.variables[long_name].assignValue(h1_list)
     2379
     2380            fid.createDimension(lat_name,ny)
     2381            fid.createVariable(lat_name,'d',(lat_name,))
     2382            fid.variables[lat_name].point_spacing='uneven'
     2383            fid.variables[lat_name].units='degrees_north'
     2384            fid.variables[lat_name].assignValue(h2_list)
    23852385
    23862386        name = {}
     
    25152515
    25162516        for fid in [fid1,fid2,fid3]:
    2517             fid.createDimension(long_name,nx)
    2518             fid.createVariable(long_name,'d',(long_name,))
    2519             fid.variables[long_name].point_spacing='uneven'
    2520             fid.variables[long_name].units='degrees_east'
    2521             fid.variables[long_name].assignValue(h1_list)
    2522 
    2523             fid.createDimension(lat_name,ny)
    2524             fid.createVariable(lat_name,'d',(lat_name,))
    2525             fid.variables[lat_name].point_spacing='uneven'
    2526             fid.variables[lat_name].units='degrees_north'
    2527             fid.variables[lat_name].assignValue(h2_list)
    2528 
    2529             fid.createDimension(time_name,2)
    2530             fid.createVariable(time_name,'d',(time_name,))
    2531             fid.variables[time_name].point_spacing='uneven'
    2532             fid.variables[time_name].units='seconds'
    2533             fid.variables[time_name].assignValue([0.,1.])
    2534             if fid == fid3: break
     2517            fid.createDimension(long_name,nx)
     2518            fid.createVariable(long_name,'d',(long_name,))
     2519            fid.variables[long_name].point_spacing='uneven'
     2520            fid.variables[long_name].units='degrees_east'
     2521            fid.variables[long_name].assignValue(h1_list)
     2522
     2523            fid.createDimension(lat_name,ny)
     2524            fid.createVariable(lat_name,'d',(lat_name,))
     2525            fid.variables[lat_name].point_spacing='uneven'
     2526            fid.variables[lat_name].units='degrees_north'
     2527            fid.variables[lat_name].assignValue(h2_list)
     2528
     2529            fid.createDimension(time_name,2)
     2530            fid.createVariable(time_name,'d',(time_name,))
     2531            fid.variables[time_name].point_spacing='uneven'
     2532            fid.variables[time_name].units='seconds'
     2533            fid.variables[time_name].assignValue([0.,1.])
     2534            if fid == fid3: break
    25352535
    25362536
    25372537        for fid in [fid4]:
    2538             fid.createDimension(long_name,nx)
    2539             fid.createVariable(long_name,'d',(long_name,))
    2540             fid.variables[long_name].point_spacing='uneven'
    2541             fid.variables[long_name].units='degrees_east'
    2542             fid.variables[long_name].assignValue(h1_list)
    2543 
    2544             fid.createDimension(lat_name,ny)
    2545             fid.createVariable(lat_name,'d',(lat_name,))
    2546             fid.variables[lat_name].point_spacing='uneven'
    2547             fid.variables[lat_name].units='degrees_north'
    2548             fid.variables[lat_name].assignValue(h2_list)
     2538            fid.createDimension(long_name,nx)
     2539            fid.createVariable(long_name,'d',(long_name,))
     2540            fid.variables[long_name].point_spacing='uneven'
     2541            fid.variables[long_name].units='degrees_east'
     2542            fid.variables[long_name].assignValue(h1_list)
     2543
     2544            fid.createDimension(lat_name,ny)
     2545            fid.createVariable(lat_name,'d',(lat_name,))
     2546            fid.variables[lat_name].point_spacing='uneven'
     2547            fid.variables[lat_name].units='degrees_north'
     2548            fid.variables[lat_name].assignValue(h2_list)
    25492549
    25502550        name = {}
     
    25752575
    25762576        for fid in [fid4]:
    2577             fid.createVariable(name[fid],'d',(lat_name,long_name))
     2577            fid.createVariable(name[fid],'d',(lat_name,long_name))
    25782578            fid.variables[name[fid]].point_spacing='uneven'
    25792579            fid.variables[name[fid]].units=units[fid]
     
    26772677        from Scientific.IO.NetCDF import NetCDFFile
    26782678
    2679         self.domain.filename = 'datatest' + str(id(self))
     2679        self.domain.set_name('datatest' + str(id(self)))
    26802680        self.domain.format = 'sww'
    26812681        self.domain.smooth = True
     
    26952695        sww.store_timestep('stage')
    26962696
    2697         file_and_extension_name = self.domain.filename + ".sww"
     2697        file_and_extension_name = self.domain.get_name() + ".sww"
    26982698        #print "file_and_extension_name",file_and_extension_name
    26992699        [xmin, xmax, ymin, ymax, stagemin, stagemax] = \
     
    27312731        domain.visualise = False
    27322732        domain.store = True
    2733         domain.filename = 'bedslope'
     2733        domain.set_name('bedslope')
    27342734        domain.default_order=2
    27352735        #Bed-slope and friction
     
    27662766        import os
    27672767
    2768         filename = domain.datadir+os.sep+domain.filename+'.sww'
     2768        filename = domain.datadir + os.sep + domain.get_name() + '.sww'
    27692769        domain2 = sww2domain(filename,None,fail_if_NaN=False,verbose = False)
    27702770        #points, vertices, boundary = rectangular(15,15)
     
    27742774        ###################
    27752775
    2776         #os.remove(domain.filename + '.sww')
     2776        #os.remove(domain.get_name() + '.sww')
    27772777        os.remove(filename)
    27782778
     
    28562856
    28572857    def test_sww2domain2(self):
    2858         ##################################################################
    2859         #Same as previous test, but this checks how NaNs are handled.
    2860         ##################################################################
    2861 
    2862 
    2863         from mesh_factory import rectangular
    2864         from Numeric import array
    2865 
    2866         #Create basic mesh
    2867         points, vertices, boundary = rectangular(2,2)
    2868 
    2869         #Create shallow water domain
    2870         domain = Domain(points, vertices, boundary)
    2871         domain.smooth = False
    2872         domain.visualise = False
    2873         domain.store = True
    2874         domain.set_name('test_file')
     2858        ##################################################################
     2859        #Same as previous test, but this checks how NaNs are handled.
     2860        ##################################################################
     2861
     2862
     2863        from mesh_factory import rectangular
     2864        from Numeric import array
     2865
     2866        #Create basic mesh
     2867        points, vertices, boundary = rectangular(2,2)
     2868
     2869        #Create shallow water domain
     2870        domain = Domain(points, vertices, boundary)
     2871        domain.smooth = False
     2872        domain.visualise = False
     2873        domain.store = True
     2874        domain.set_name('test_file')
    28752875        domain.set_datadir('.')
    2876         domain.default_order=2
    2877         domain.quantities_to_be_stored=['stage']
    2878 
    2879         domain.set_quantity('elevation', lambda x,y: -x/3)
    2880         domain.set_quantity('friction', 0.1)
    2881 
    2882         from math import sin, pi
    2883         Br = Reflective_boundary(domain)
    2884         Bt = Transmissive_boundary(domain)
    2885         Bd = Dirichlet_boundary([0.2,0.,0.])
    2886         Bw = Time_boundary(domain=domain,
    2887                            f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0])
    2888 
    2889         domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
    2890 
    2891         h = 0.05
    2892         elevation = domain.quantities['elevation'].vertex_values
    2893         domain.set_quantity('stage', elevation + h)
    2894 
    2895         domain.check_integrity()
    2896 
    2897         for t in domain.evolve(yieldstep = 1, finaltime = 2.0):
    2898             pass
    2899             #domain.write_time()
     2876        domain.default_order=2
     2877        domain.quantities_to_be_stored=['stage']
     2878
     2879        domain.set_quantity('elevation', lambda x,y: -x/3)
     2880        domain.set_quantity('friction', 0.1)
     2881
     2882        from math import sin, pi
     2883        Br = Reflective_boundary(domain)
     2884        Bt = Transmissive_boundary(domain)
     2885        Bd = Dirichlet_boundary([0.2,0.,0.])
     2886        Bw = Time_boundary(domain=domain,
     2887                           f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0])
     2888
     2889        domain.set_boundary({'left': Bd, 'right': Br, 'top': Br, 'bottom': Br})
     2890
     2891        h = 0.05
     2892        elevation = domain.quantities['elevation'].vertex_values
     2893        domain.set_quantity('stage', elevation + h)
     2894
     2895        domain.check_integrity()
     2896
     2897        for t in domain.evolve(yieldstep = 1, finaltime = 2.0):
     2898            pass
     2899            #domain.write_time()
    29002900
    29012901
    29022902
    29032903        ##################################
    2904         #Import the file as a new domain
     2904        #Import the file as a new domain
    29052905        ##################################
    2906         from data_manager import sww2domain
    2907         from Numeric import allclose
     2906        from data_manager import sww2domain
     2907        from Numeric import allclose
    29082908        import os
    29092909
    2910         filename = domain.datadir+os.sep+domain.filename+'.sww'
    2911 
    2912         #Fail because NaNs are present
    2913         try:
    2914             domain2 = sww2domain(filename,boundary,fail_if_NaN=True,verbose=False)
    2915         except:
    2916             #Now import it, filling NaNs to be 0
    2917             filler = 0
    2918             domain2 = sww2domain(filename,None,fail_if_NaN=False,NaN_filler = filler,verbose=False)
     2910        filename = domain.datadir + os.sep + domain.get_name() + '.sww'
     2911
     2912        #Fail because NaNs are present
     2913        try:
     2914            domain2 = sww2domain(filename,boundary,fail_if_NaN=True,verbose=False)
     2915        except:
     2916            #Now import it, filling NaNs to be 0
     2917            filler = 0
     2918            domain2 = sww2domain(filename,None,fail_if_NaN=False,NaN_filler = filler,verbose=False)
    29192919
    29202920        #Clean up
     
    29262926                'vertex_coordinates']
    29272927
    2928         for quantity in ['elevation']+domain.quantities_to_be_stored:
    2929             bits.append('get_quantity("%s").get_integral()' %quantity)
    2930             bits.append('get_quantity("%s").get_values()' %quantity)
    2931 
    2932         for bit in bits:
    2933         #    print 'testing that domain.'+bit+' has been restored'
    2934             assert allclose(eval('domain.'+bit),eval('domain2.'+bit))
    2935 
    2936         assert max(max(domain2.get_quantity('xmomentum').get_values()))==filler
    2937         assert min(min(domain2.get_quantity('xmomentum').get_values()))==filler
    2938         assert max(max(domain2.get_quantity('ymomentum').get_values()))==filler
    2939         assert min(min(domain2.get_quantity('ymomentum').get_values()))==filler
     2928        for quantity in ['elevation']+domain.quantities_to_be_stored:
     2929            bits.append('get_quantity("%s").get_integral()' %quantity)
     2930            bits.append('get_quantity("%s").get_values()' %quantity)
     2931
     2932        for bit in bits:
     2933        #    print 'testing that domain.'+bit+' has been restored'
     2934            assert allclose(eval('domain.'+bit),eval('domain2.'+bit))
     2935
     2936        assert max(max(domain2.get_quantity('xmomentum').get_values()))==filler
     2937        assert min(min(domain2.get_quantity('xmomentum').get_values()))==filler
     2938        assert max(max(domain2.get_quantity('ymomentum').get_values()))==filler
     2939        assert min(min(domain2.get_quantity('ymomentum').get_values()))==filler
    29402940
    29412941
    29422942
    29432943    #def test_weed(self):
    2944         from data_manager import weed
     2944        from data_manager import weed
    29452945
    29462946        coordinates1 = [[0.,0.],[1.,0.],[1.,1.],[1.,0.],[2.,0.],[1.,1.]]
     
    29652965    #FIXME This fails - smooth makes the comparism too hard for allclose
    29662966    def ztest_sww2domain3(self):
    2967         ################################################
    2968         #DOMAIN.SMOOTH = TRUE !!!!!!!!!!!!!!!!!!!!!!!!!!
    2969         ################################################
    2970         from mesh_factory import rectangular
    2971         from Numeric import array
    2972         #Create basic mesh
     2967        ################################################
     2968        #DOMAIN.SMOOTH = TRUE !!!!!!!!!!!!!!!!!!!!!!!!!!
     2969        ################################################
     2970        from mesh_factory import rectangular
     2971        from Numeric import array
     2972        #Create basic mesh
    29732973
    29742974        yiel=0.01
    2975         points, vertices, boundary = rectangular(10,10)
    2976 
    2977         #Create shallow water domain
    2978         domain = Domain(points, vertices, boundary)
     2975        points, vertices, boundary = rectangular(10,10)
     2976
     2977        #Create shallow water domain
     2978        domain = Domain(points, vertices, boundary)
    29792979        domain.geo_reference = Geo_reference(56,11,11)
    2980         domain.smooth = True
    2981         domain.visualise = False
    2982         domain.store = True
    2983         domain.filename = 'bedslope'
    2984         domain.default_order=2
    2985         #Bed-slope and friction
    2986         domain.set_quantity('elevation', lambda x,y: -x/3)
    2987         domain.set_quantity('friction', 0.1)
    2988         # Boundary conditions
    2989         from math import sin, pi
    2990         Br = Reflective_boundary(domain)
    2991         Bt = Transmissive_boundary(domain)
    2992         Bd = Dirichlet_boundary([0.2,0.,0.])
    2993         Bw = Time_boundary(domain=domain,
    2994                            f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0])
    2995 
    2996         domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Bd})
    2997 
    2998         domain.quantities_to_be_stored.extend(['xmomentum','ymomentum'])
    2999         #Initial condition
    3000         h = 0.05
    3001         elevation = domain.quantities['elevation'].vertex_values
    3002         domain.set_quantity('stage', elevation + h)
    3003 
    3004 
    3005         domain.check_integrity()
    3006         #Evolution
    3007         for t in domain.evolve(yieldstep = yiel, finaltime = 0.05):
    3008         #    domain.write_time()
    3009             pass
    3010 
    3011 
    3012         ##########################################
    3013         #Import the example's file as a new domain
    3014         ##########################################
    3015         from data_manager import sww2domain
    3016         from Numeric import allclose
     2980        domain.smooth = True
     2981        domain.visualise = False
     2982        domain.store = True
     2983        domain.set_name('bedslope')
     2984        domain.default_order=2
     2985        #Bed-slope and friction
     2986        domain.set_quantity('elevation', lambda x,y: -x/3)
     2987        domain.set_quantity('friction', 0.1)
     2988        # Boundary conditions
     2989        from math import sin, pi
     2990        Br = Reflective_boundary(domain)
     2991        Bt = Transmissive_boundary(domain)
     2992        Bd = Dirichlet_boundary([0.2,0.,0.])
     2993        Bw = Time_boundary(domain=domain,
     2994                           f=lambda t: [(0.1*sin(t*2*pi)), 0.0, 0.0])
     2995
     2996        domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Bd})
     2997
     2998        domain.quantities_to_be_stored.extend(['xmomentum','ymomentum'])
     2999        #Initial condition
     3000        h = 0.05
     3001        elevation = domain.quantities['elevation'].vertex_values
     3002        domain.set_quantity('stage', elevation + h)
     3003
     3004
     3005        domain.check_integrity()
     3006        #Evolution
     3007        for t in domain.evolve(yieldstep = yiel, finaltime = 0.05):
     3008        #    domain.write_time()
     3009            pass
     3010
     3011
     3012        ##########################################
     3013        #Import the example's file as a new domain
     3014        ##########################################
     3015        from data_manager import sww2domain
     3016        from Numeric import allclose
    30173017        import os
    30183018
    3019         filename = domain.datadir+os.sep+domain.filename+'.sww'
    3020         domain2 = sww2domain(filename,None,fail_if_NaN=False,verbose = False)
    3021         #points, vertices, boundary = rectangular(15,15)
     3019        filename = domain.datadir + os.sep + domain.get_name() + '.sww'
     3020        domain2 = sww2domain(filename,None,fail_if_NaN=False,verbose = False)
     3021        #points, vertices, boundary = rectangular(15,15)
    30223022        #domain2.boundary = boundary
    30233023        ###################
    3024         ##NOW TEST IT!!!
     3024        ##NOW TEST IT!!!
    30253025        ###################
    30263026
    3027         os.remove(domain.filename + '.sww')
     3027        os.remove(domain.get_name() + '.sww')
    30283028
    30293029        #FIXME smooth domain so that they can be compared
    30303030
    30313031
    3032         bits = []#'vertex_coordinates']
    3033         for quantity in ['elevation']+domain.quantities_to_be_stored:
    3034             bits.append('quantities["%s"].get_integral()'%quantity)
    3035 
    3036 
    3037         for bit in bits:
    3038             #print 'testing that domain.'+bit+' has been restored'
     3032        bits = []#'vertex_coordinates']
     3033        for quantity in ['elevation']+domain.quantities_to_be_stored:
     3034            bits.append('quantities["%s"].get_integral()'%quantity)
     3035
     3036
     3037        for bit in bits:
     3038            #print 'testing that domain.'+bit+' has been restored'
    30393039            #print bit
    30403040            #print 'done'
    30413041            #print ('domain.'+bit), eval('domain.'+bit)
    30423042            #print ('domain2.'+bit), eval('domain2.'+bit)
    3043             assert allclose(eval('domain.'+bit),eval('domain2.'+bit),rtol=1.0e-1,atol=1.e-3)
     3043            assert allclose(eval('domain.'+bit),eval('domain2.'+bit),rtol=1.0e-1,atol=1.e-3)
    30443044            pass
    30453045
     
    30493049        visualise = False
    30503050        visualise = True
    3051         domain.visualise = visualise
     3051        domain.visualise = visualise
    30523052        domain.time = 0.
    30533053        from time import sleep
     
    30553055        final = .5
    30563056        domain.set_quantity('friction', 0.1)
    3057         domain.store = False
    3058         domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Br})
    3059 
    3060         for t in domain.evolve(yieldstep = yiel, finaltime = final):
     3057        domain.store = False
     3058        domain.set_boundary({'left': Bd, 'right': Bd, 'top': Bd, 'bottom': Br})
     3059
     3060        for t in domain.evolve(yieldstep = yiel, finaltime = final):
    30613061            if visualise: sleep(.03)
    3062             #domain.write_time()
    3063             pass
    3064 
    3065         domain2.smooth = True
    3066         domain2.visualise = visualise
    3067         domain2.store = False
    3068         domain2.default_order=2
    3069         domain2.set_quantity('friction', 0.1)
    3070         #Bed-slope and friction
    3071         # Boundary conditions
     3062            #domain.write_time()
     3063            pass
     3064
     3065        domain2.smooth = True
     3066        domain2.visualise = visualise
     3067        domain2.store = False
     3068        domain2.default_order=2
     3069        domain2.set_quantity('friction', 0.1)
     3070        #Bed-slope and friction
     3071        # Boundary conditions
    30723072        Bd2=Dirichlet_boundary([0.2,0.,0.])
    3073         Br2 = Reflective_boundary(domain2)
     3073        Br2 = Reflective_boundary(domain2)
    30743074        domain2.boundary = domain.boundary
    30753075        #print 'domain2.boundary'
    30763076        #print domain2.boundary
    3077         domain2.set_boundary({'left': Bd2, 'right': Bd2, 'top': Bd2, 'bottom': Br2})
     3077        domain2.set_boundary({'left': Bd2, 'right': Bd2, 'top': Bd2, 'bottom': Br2})
    30783078        #domain2.boundary = domain.boundary
    3079         #domain2.set_boundary({'exterior': Bd})
    3080 
    3081         domain2.check_integrity()
    3082 
    3083         for t in domain2.evolve(yieldstep = yiel, finaltime = final):
     3079        #domain2.set_boundary({'exterior': Bd})
     3080
     3081        domain2.check_integrity()
     3082
     3083        for t in domain2.evolve(yieldstep = yiel, finaltime = final):
    30843084            if visualise: sleep(.03)
    3085             #domain2.write_time()
    3086             pass
     3085            #domain2.write_time()
     3086            pass
    30873087
    30883088        ###################
    3089         ##NOW TEST IT!!!
     3089        ##NOW TEST IT!!!
    30903090        ##################
    30913091
    30923092        print '><><><><>>'
    3093         bits = [ 'vertex_coordinates']
    3094 
    3095         for quantity in ['elevation','xmomentum','ymomentum']:#+domain.quantities_to_be_stored:
    3096             #bits.append('quantities["%s"].get_integral()'%quantity)
    3097             bits.append('get_quantity("%s").get_values()' %quantity)
    3098 
    3099         for bit in bits:
     3093        bits = [ 'vertex_coordinates']
     3094
     3095        for quantity in ['elevation','xmomentum','ymomentum']:#+domain.quantities_to_be_stored:
     3096            #bits.append('quantities["%s"].get_integral()'%quantity)
     3097            bits.append('get_quantity("%s").get_values()' %quantity)
     3098
     3099        for bit in bits:
    31003100            print bit
    3101             assert allclose(eval('domain.'+bit),eval('domain2.'+bit))
     3101            assert allclose(eval('domain.'+bit),eval('domain2.'+bit))
    31023102
    31033103
     
    32893289        from Scientific.IO.NetCDF import NetCDFFile
    32903290
    3291         # the memory optimised least squares
    3292         #  cellsize = 20,   # this one seems to hang
    3293         #  cellsize = 200000, # Ran 1 test in 269.703s
    3294                                 #Ran 1 test in 267.344s
    3295         #  cellsize = 20000,  # Ran 1 test in 460.922s
    3296         #  cellsize = 2000   #Ran 1 test in 5340.250s
    3297         #  cellsize = 200   #this one seems to hang, building matirx A
    3298 
    3299         # not optimised
    3300         # seems to hang
    3301         #  cellsize = 2000   # Ran 1 test in 5334.563s
     3291        # the memory optimised least squares
     3292        #  cellsize = 20,   # this one seems to hang
     3293        #  cellsize = 200000, # Ran 1 test in 269.703s
     3294                                #Ran 1 test in 267.344s
     3295        #  cellsize = 20000,  # Ran 1 test in 460.922s
     3296        #  cellsize = 2000   #Ran 1 test in 5340.250s
     3297        #  cellsize = 200   #this one seems to hang, building matirx A
     3298
     3299        # not optimised
     3300        # seems to hang
     3301        #  cellsize = 2000   # Ran 1 test in 5334.563s
    33023302        #Export to ascii/prj files
    33033303        sww2dem('karratha_100m',
     
    46754675        #Check first value
    46764676        stage = fid.variables['stage'][:]
    4677         xmomentum = fid.variables['xmomentum'][:]
    4678         ymomentum = fid.variables['ymomentum'][:]
    4679 
    4680         #print ymomentum
     4677        xmomentum = fid.variables['xmomentum'][:]
     4678        ymomentum = fid.variables['ymomentum'][:]
     4679
     4680        #print ymomentum
    46814681        assert allclose(stage[0,0], e +tide)  #Meters
    46824682
  • anuga_core/source/anuga/shallow_water/test_interpolate_sww.py

    r3564 r3846  
    8080        from Scientific.IO.NetCDF import NetCDFFile
    8181
    82         self.domain.filename = 'datatest' + str(time.time())
     82        #FIXME (Ole): This test still passes if commented out
     83        #self.domain.set_name('datatest' + str(time.time()))
     84       
     85       
    8386        self.domain.format = 'sww'
    8487        self.domain.smooth = True
     
    148151             concatinate_attributelist
    149152
    150         self.domain.filename = 'datatest' + str(time.time())
     153        self.domain.set_name('datatest' + str(time.time()))
    151154        self.domain.format = 'sww'
    152155        self.domain.smooth = True
     
    159162        sww.store_timestep('stage')
    160163
    161         #print "self.domain.filename",self.domain.filename
    162164        interp = Interpolate_sww(sww.filename, 'depth')
    163165
     
    267269             concatinate_attributelist
    268270
    269         self.domain.filename = 'datatest' + str(time.time())
     271        self.domain.set_name('datatest' + str(time.time()))
    270272        self.domain.format = 'sww'
    271273        self.domain.smooth = True
     
    279281       
    280282        try:
    281             interpolate_sww2xya(self.domain.filename,
     283            interpolate_sww2xya(self.domain.get_name(),
    282284                                'stage','yeah','yeah.x',
    283285                                verbose = False)
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r3829 r3846  
    11061106                assert not allclose(stage, initial_stage)
    11071107
    1108         os.remove(domain.filename + '.sww')
     1108        os.remove(domain.get_name() + '.sww')
    11091109
    11101110
     
    16261626        L = domain.quantities['stage'].vertex_values
    16271627
    1628         #First order
     1628        #First order
    16291629        domain._order_ = 1
    16301630        domain.distribute_to_vertices_and_edges()
    1631         assert allclose(L[1], val1)
    1632 
    1633         #Second order
     1631        assert allclose(L[1], val1)
     1632
     1633        #Second order
    16341634        domain._order_ = 2
    16351635        domain.beta_w      = 0.9
     
    16401640        domain.beta_vh_dry = 0.9
    16411641        domain.distribute_to_vertices_and_edges()
    1642         assert allclose(L[1], [2.2, 4.9, 4.9])
     1642        assert allclose(L[1], [2.2, 4.9, 4.9])
    16431643
    16441644
     
    16621662        L = domain.quantities['stage'].vertex_values
    16631663
    1664         def stage(x,y):
     1664        def stage(x,y):
    16651665            return x**2
    16661666
    1667         domain.set_quantity('stage', stage, location='centroids')
     1667        domain.set_quantity('stage', stage, location='centroids')
    16681668
    16691669        a, b = domain.quantities['stage'].compute_gradients()
    1670         assert allclose(a[1], 3.33333334)
    1671         assert allclose(b[1], 0.0)
     1670        assert allclose(a[1], 3.33333334)
     1671        assert allclose(b[1], 0.0)
    16721672
    16731673        domain._order_ = 1
     
    17051705        L = domain.quantities['stage'].vertex_values
    17061706
    1707         def stage(x,y):
     1707        def stage(x,y):
    17081708            return x**4+y**2
    17091709
    1710         domain.set_quantity('stage', stage, location='centroids')
     1710        domain.set_quantity('stage', stage, location='centroids')
    17111711        #print domain.quantities['stage'].centroid_values
    17121712
    17131713        a, b = domain.quantities['stage'].compute_gradients()
    1714         assert allclose(a[1], 25.18518519)
    1715         assert allclose(b[1], 3.33333333)
     1714        assert allclose(a[1], 25.18518519)
     1715        assert allclose(b[1], 3.33333333)
    17161716
    17171717        domain._order_ = 1
     
    17691769        domain._order_ = 1
    17701770        domain.distribute_to_vertices_and_edges()
    1771         ##assert allclose(L[1], [0.19999999, 20.05, 20.05])
    1772         assert allclose(L[1], [0.1, 20.1, 20.1])
     1771        ##assert allclose(L[1], [0.19999999, 20.05, 20.05])
     1772        assert allclose(L[1], [0.1, 20.1, 20.1])
    17731773
    17741774        domain._order_ = 2
    17751775        domain.distribute_to_vertices_and_edges()
    1776         assert allclose(L[1], [0.1, 20.1, 20.1])
     1776        assert allclose(L[1], [0.1, 20.1, 20.1])
    17771777
    17781778    def test_distribute_near_bed1(self):
     
    18141814        domain._order_ = 1
    18151815        domain.distribute_to_vertices_and_edges()
    1816         ##assert allclose(L[1], [4.19999999, 16.07142857, 20.02857143])
    1817         assert allclose(L[1], [4.1, 16.1, 20.1])
     1816        ##assert allclose(L[1], [4.19999999, 16.07142857, 20.02857143])
     1817        assert allclose(L[1], [4.1, 16.1, 20.1])
    18181818
    18191819        domain._order_ = 2
    18201820        domain.distribute_to_vertices_and_edges()
    1821         assert allclose(L[1], [4.1, 16.1, 20.1])
     1821        assert allclose(L[1], [4.1, 16.1, 20.1])
    18221822
    18231823
     
    18321832        d = [1.0/5, 0.0]
    18331833        e = [1.0/5, 1.0/5]
    1834         f = [1.0/5, 2.0/5]
     1834        f = [1.0/5, 2.0/5]
    18351835        g = [2.0/5, 2.0/5]
    18361836
     
    18461846        domain.set_quantity('elevation', slope)
    18471847        domain.set_quantity('stage',
    1848                             [0.01298164, 0.00365611,
     1848                            [0.01298164, 0.00365611,
    18491849                             0.01440365, -0.0381856437096],
    1850                             location='centroids')
     1850                            location='centroids')
    18511851        domain.set_quantity('xmomentum',
    1852                             [0.00670439, 0.01263789,
     1852                            [0.00670439, 0.01263789,
    18531853                             0.00647805, 0.0178180740668],
    1854                             location='centroids')
     1854                            location='centroids')
    18551855        domain.set_quantity('ymomentum',
    1856                             [-7.23510980e-004, -6.30413883e-005,
     1856                            [-7.23510980e-004, -6.30413883e-005,
    18571857                             6.30413883e-005, 0.000200907255866],
    1858                             location='centroids')
     1858                            location='centroids')
    18591859
    18601860        E = domain.quantities['elevation'].vertex_values
     
    18751875
    18761876        #print L[1,:]
    1877         #print X[1,:]
    1878         #print Y[1,:]
     1877        #print X[1,:]
     1878        #print Y[1,:]
    18791879
    18801880        assert allclose(L[1,:], [-0.00825735775384,
    18811881                                 -0.00801881482869,
    18821882                                 0.0272445025825])
    1883         assert allclose(X[1,:], [0.0143507718962,
     1883        assert allclose(X[1,:], [0.0143507718962,
    18841884                                 0.0142502147066,
    18851885                                 0.00931268339717])
    1886         assert allclose(Y[1,:], [-0.000117062180693,
     1886        assert allclose(Y[1,:], [-0.000117062180693,
    18871887                                 7.94434448109e-005,
    18881888                                 -0.000151505429018])
     
    18921892    def test_balance_deep_and_shallow(self):
    18931893        """Test that balanced limiters preserve conserved quantites.
    1894         """
     1894        """
    18951895        import copy
    18961896
     
    19131913        mesh.set_quantity('stage', [[3,0,3], [2,2,6], [5,3,8], [8,3,5]])
    19141914        mesh.set_quantity('elevation', 0) #Flat bed
    1915         stage = mesh.quantities['stage']
    1916 
    1917         ref_centroid_values = copy.copy(stage.centroid_values[:]) #Copy
     1915        stage = mesh.quantities['stage']
     1916
     1917        ref_centroid_values = copy.copy(stage.centroid_values[:]) #Copy
    19181918
    19191919        #Limit
    1920         mesh.distribute_to_vertices_and_edges()
     1920        mesh.distribute_to_vertices_and_edges()
    19211921
    19221922        #Assert that quantities are conserved
     
    19281928
    19291929        #Now try with a non-flat bed - closely hugging initial stage in places
    1930         #This will create alphas in the range [0, 0.478260, 1]
     1930        #This will create alphas in the range [0, 0.478260, 1]
    19311931        mesh.set_quantity('stage', [[3,0,3], [2,2,6], [5,3,8], [8,3,5]])
    19321932        mesh.set_quantity('elevation', [[0,0,0],
    1933                                         [1.8,1.9,5.9],
    1934                                         [4.6,0,0],
    1935                                         [0,2,4]])
    1936         stage = mesh.quantities['stage']
    1937 
    1938         ref_centroid_values = copy.copy(stage.centroid_values[:]) #Copy
    1939         ref_vertex_values = copy.copy(stage.vertex_values[:]) #Copy
     1933                                        [1.8,1.9,5.9],
     1934                                        [4.6,0,0],
     1935                                        [0,2,4]])
     1936        stage = mesh.quantities['stage']
     1937
     1938        ref_centroid_values = copy.copy(stage.centroid_values[:]) #Copy
     1939        ref_vertex_values = copy.copy(stage.vertex_values[:]) #Copy
    19401940
    19411941        #Limit
    1942         mesh.distribute_to_vertices_and_edges()
     1942        mesh.distribute_to_vertices_and_edges()
    19431943
    19441944
    19451945        #Assert that all vertex quantities have changed
    19461946        for k in range(mesh.number_of_elements):
    1947             #print ref_vertex_values[k,:], stage.vertex_values[k,:]
     1947            #print ref_vertex_values[k,:], stage.vertex_values[k,:]
    19481948            assert not allclose (ref_vertex_values[k,:], stage.vertex_values[k,:])
    19491949        #and assert that quantities are still conserved
     
    19561956        #Also check that Python and C version produce the same
    19571957        assert allclose (stage.vertex_values,
    1958                         [[2,2,2],
    1959                           [1.93333333, 2.03333333, 6.03333333],
    1960                           [6.93333333, 4.53333333, 4.53333333],
    1961                           [5.33333333, 5.33333333, 5.33333333]])
     1958                        [[2,2,2],
     1959                          [1.93333333, 2.03333333, 6.03333333],
     1960                          [6.93333333, 4.53333333, 4.53333333],
     1961                          [5.33333333, 5.33333333, 5.33333333]])
    19621962
    19631963
     
    19671967        """Test that stage is conserved globally
    19681968
    1969         This one uses a flat bed, reflective bdries and a suitable
    1970         initial condition
    1971         """
     1969        This one uses a flat bed, reflective bdries and a suitable
     1970        initial condition
     1971        """
    19721972        from mesh_factory import rectangular
    19731973        from Numeric import array
     
    19811981        domain.default_order=2
    19821982
    1983         #IC
     1983        #IC
    19841984        def x_slope(x, y):
    19851985            return x/3
     
    19951995        domain.check_integrity()
    19961996
    1997         #domain.visualise = True #If you want to take a sticky beak
    1998 
    1999         initial_volume = domain.quantities['stage'].get_integral()
    2000         initial_xmom = domain.quantities['xmomentum'].get_integral()
    2001 
    2002         #print initial_xmom
     1997        #domain.visualise = True #If you want to take a sticky beak
     1998
     1999        initial_volume = domain.quantities['stage'].get_integral()
     2000        initial_xmom = domain.quantities['xmomentum'].get_integral()
     2001
     2002        #print initial_xmom
    20032003
    20042004        #Evolution
    20052005        for t in domain.evolve(yieldstep = 0.05, finaltime = 5.0):
    20062006            volume =  domain.quantities['stage'].get_integral()
    2007             assert allclose (volume, initial_volume)
     2007            assert allclose (volume, initial_volume)
    20082008
    20092009            #I don't believe that the total momentum should be the same
    2010             #It starts with zero and ends with zero though
     2010            #It starts with zero and ends with zero though
    20112011            #xmom = domain.quantities['xmomentum'].get_integral()
    2012             #print xmom
    2013             #assert allclose (xmom, initial_xmom)
    2014 
    2015         os.remove(domain.filename + '.sww')
     2012            #print xmom
     2013            #assert allclose (xmom, initial_xmom)
     2014
     2015        os.remove(domain.get_name() + '.sww')
    20162016
    20172017
     
    20192019        """Test that stage is conserved globally
    20202020
    2021         This one uses a slopy bed, reflective bdries and a suitable
    2022         initial condition
    2023         """
     2021        This one uses a slopy bed, reflective bdries and a suitable
     2022        initial condition
     2023        """
    20242024        from mesh_factory import rectangular
    20252025        from Numeric import array
     
    20332033        domain.default_order=2
    20342034
    2035         #IC
     2035        #IC
    20362036        def x_slope(x, y):
    20372037            return x/3
     
    20472047        domain.check_integrity()
    20482048
    2049         #domain.visualise = True #If you want to take a sticky beak
    2050 
    2051         initial_volume = domain.quantities['stage'].get_integral()
    2052         initial_xmom = domain.quantities['xmomentum'].get_integral()
    2053 
    2054         #print initial_xmom
     2049        #domain.visualise = True #If you want to take a sticky beak
     2050
     2051        initial_volume = domain.quantities['stage'].get_integral()
     2052        initial_xmom = domain.quantities['xmomentum'].get_integral()
     2053
     2054        #print initial_xmom
    20552055
    20562056        #Evolution
    20572057        for t in domain.evolve(yieldstep = 0.05, finaltime = 5.0):
    20582058            volume =  domain.quantities['stage'].get_integral()
    2059             assert allclose (volume, initial_volume)
     2059            assert allclose (volume, initial_volume)
    20602060
    20612061            #FIXME: What would we expect from momentum
    20622062            #xmom = domain.quantities['xmomentum'].get_integral()
    2063             #print xmom
    2064             #assert allclose (xmom, initial_xmom)
    2065 
    2066         os.remove(domain.filename + '.sww')
     2063            #print xmom
     2064            #assert allclose (xmom, initial_xmom)
     2065
     2066        os.remove(domain.get_name() + '.sww')
    20672067
    20682068    def test_conservation_3(self):
    20692069        """Test that stage is conserved globally
    20702070
    2071         This one uses a larger grid, convoluted bed, reflective bdries and a suitable
    2072         initial condition
    2073         """
     2071        This one uses a larger grid, convoluted bed, reflective bdries and a suitable
     2072        initial condition
     2073        """
    20742074        from mesh_factory import rectangular
    20752075        from Numeric import array
     
    20822082        domain.smooth = False
    20832083        domain.default_order = 2
    2084         domain.beta_h = 0.2
    2085         domain.set_quantities_to_be_stored(['stage'])
    2086 
    2087         #IC
     2084        domain.beta_h = 0.2
     2085        domain.set_quantities_to_be_stored(['stage'])
     2086
     2087        #IC
    20882088        def x_slope(x, y):
    2089             z = 0*x
    2090             for i in range(len(x)):
     2089            z = 0*x
     2090            for i in range(len(x)):
    20912091                if x[i] < 0.3:
    20922092                    z[i] = x[i]/3
     
    21112111        domain.check_integrity()
    21122112
    2113         #domain.visualise = True #If you want to take a sticky beak
    2114 
    2115         initial_volume = domain.quantities['stage'].get_integral()
    2116         initial_xmom = domain.quantities['xmomentum'].get_integral()
    2117 
    2118         import copy
    2119         ref_centroid_values =\
    2120                 copy.copy(domain.quantities['stage'].centroid_values)
    2121 
    2122         #print 'ORG', domain.quantities['stage'].centroid_values
    2123         domain.distribute_to_vertices_and_edges()
    2124 
    2125 
    2126         #print domain.quantities['stage'].centroid_values
    2127         assert allclose(domain.quantities['stage'].centroid_values,
    2128                         ref_centroid_values)
    2129 
    2130 
    2131         #Check that initial limiter doesn't violate cons quan
    2132         assert allclose (domain.quantities['stage'].get_integral(),
    2133                          initial_volume)
     2113        #domain.visualise = True #If you want to take a sticky beak
     2114
     2115        initial_volume = domain.quantities['stage'].get_integral()
     2116        initial_xmom = domain.quantities['xmomentum'].get_integral()
     2117
     2118        import copy
     2119        ref_centroid_values =\
     2120                copy.copy(domain.quantities['stage'].centroid_values)
     2121
     2122        #print 'ORG', domain.quantities['stage'].centroid_values
     2123        domain.distribute_to_vertices_and_edges()
     2124
     2125
     2126        #print domain.quantities['stage'].centroid_values
     2127        assert allclose(domain.quantities['stage'].centroid_values,
     2128                        ref_centroid_values)
     2129
     2130
     2131        #Check that initial limiter doesn't violate cons quan
     2132        assert allclose (domain.quantities['stage'].get_integral(),
     2133                         initial_volume)
    21342134
    21352135        #Evolution
     
    21372137            volume =  domain.quantities['stage'].get_integral()
    21382138            #print t, volume, initial_volume
    2139             assert allclose (volume, initial_volume)
    2140 
    2141         os.remove(domain.filename + '.sww')
     2139            assert allclose (volume, initial_volume)
     2140
     2141        os.remove(domain.get_name() + '.sww')
    21422142
    21432143    def test_conservation_4(self):
    21442144        """Test that stage is conserved globally
    21452145
    2146         This one uses a larger grid, convoluted bed, reflective bdries and a suitable
    2147         initial condition
    2148         """
     2146        This one uses a larger grid, convoluted bed, reflective bdries and a suitable
     2147        initial condition
     2148        """
    21492149        from mesh_factory import rectangular
    21502150        from Numeric import array
     
    21572157        domain.smooth = False
    21582158        domain.default_order=2
    2159         domain.beta_h = 0.0
    2160 
    2161         #IC
     2159        domain.beta_h = 0.0
     2160
     2161        #IC
    21622162        def x_slope(x, y):
    2163             z = 0*x
    2164             for i in range(len(x)):
     2163            z = 0*x
     2164            for i in range(len(x)):
    21652165                if x[i] < 0.3:
    21662166                    z[i] = x[i]/3
     
    21712171                    z[i] = 0.34 #OK with beta == 0.0
    21722172                    #z[i] = 0.35#Fails after 80 timesteps with an error
    2173                                 #of the order 1.0e-5
     2173                                #of the order 1.0e-5
    21742174                if 0.7 <= x[i]:
    21752175                    z[i] = x[i]/3
     
    21882188        domain.check_integrity()
    21892189
    2190         #domain.visualise = True #If you want to take a sticky beak
    2191 
    2192         initial_volume = domain.quantities['stage'].get_integral()
    2193         initial_xmom = domain.quantities['xmomentum'].get_integral()
    2194 
    2195         import copy
    2196         ref_centroid_values =\
    2197                 copy.copy(domain.quantities['stage'].centroid_values)
    2198 
    2199         #Test limiter by itself
    2200         domain.distribute_to_vertices_and_edges()
    2201 
    2202         #Check that initial limiter doesn't violate cons quan
    2203         assert allclose (domain.quantities['stage'].get_integral(),
    2204                          initial_volume)
     2190        #domain.visualise = True #If you want to take a sticky beak
     2191
     2192        initial_volume = domain.quantities['stage'].get_integral()
     2193        initial_xmom = domain.quantities['xmomentum'].get_integral()
     2194
     2195        import copy
     2196        ref_centroid_values =\
     2197                copy.copy(domain.quantities['stage'].centroid_values)
     2198
     2199        #Test limiter by itself
     2200        domain.distribute_to_vertices_and_edges()
     2201
     2202        #Check that initial limiter doesn't violate cons quan
     2203        assert allclose (domain.quantities['stage'].get_integral(),
     2204                         initial_volume)
    22052205        #NOTE: This would fail if any initial stage was less than the
    2206         #corresponding bed elevation - but that is reasonable.
     2206        #corresponding bed elevation - but that is reasonable.
    22072207
    22082208
     
    22142214
    22152215
    2216             #if not allclose (volume, initial_volume):
    2217             #    print 't==4.05'
     2216            #if not allclose (volume, initial_volume):
     2217            #    print 't==4.05'
    22182218            #    for k in range(domain.number_of_elements):
    2219             #       pass
    2220             #       print domain.quantities['stage'].centroid_values[k] -\
     2219            #       pass
     2220            #       print domain.quantities['stage'].centroid_values[k] -\
    22212221            #             ref_centroid_values[k]
    22222222
    2223             assert allclose (volume, initial_volume)
    2224 
    2225 
    2226         os.remove(domain.filename + '.sww')
     2223            assert allclose (volume, initial_volume)
     2224
     2225
     2226        os.remove(domain.get_name() + '.sww')
    22272227
    22282228
    22292229    def test_conservation_5(self):
    22302230        """Test that momentum is conserved globally in
    2231         steady state scenario
    2232 
    2233         This one uses a slopy bed, dirichlet and reflective bdries
    2234         """
     2231        steady state scenario
     2232
     2233        This one uses a slopy bed, dirichlet and reflective bdries
     2234        """
    22352235        from mesh_factory import rectangular
    22362236        from Numeric import array
     
    22442244        domain.default_order=2
    22452245
    2246         #IC
     2246        #IC
    22472247        def x_slope(x, y):
    22482248            return x/3
     
    22572257        Bright = Dirichlet_boundary([0.1,0,0])
    22582258        domain.set_boundary({'left': Bleft, 'right': Bright,
    2259                              'top': Br, 'bottom': Br})
     2259                             'top': Br, 'bottom': Br})
    22602260
    22612261        domain.check_integrity()
    22622262
    2263         #domain.visualise = True #If you want to take a sticky beak
    2264 
    2265         initial_volume = domain.quantities['stage'].get_integral()
    2266         initial_xmom = domain.quantities['xmomentum'].get_integral()
     2263        #domain.visualise = True #If you want to take a sticky beak
     2264
     2265        initial_volume = domain.quantities['stage'].get_integral()
     2266        initial_xmom = domain.quantities['xmomentum'].get_integral()
    22672267
    22682268
     
    22732273            ymom = domain.quantities['ymomentum'].get_integral()
    22742274
    2275             if allclose(t, 6):  #Steady state reached
     2275            if allclose(t, 6):  #Steady state reached
    22762276                steady_xmom = domain.quantities['xmomentum'].get_integral()
    22772277                steady_ymom = domain.quantities['ymomentum'].get_integral()
    22782278                steady_stage = domain.quantities['stage'].get_integral()
    22792279
    2280             if t > 6:
     2280            if t > 6:
    22812281                #print '%.2f %14.8f %14.8f' %(t, ymom, steady_ymom)
    22822282                assert allclose(xmom, steady_xmom)
     
    22852285
    22862286
    2287         os.remove(domain.filename + '.sww')
     2287        os.remove(domain.get_name() + '.sww')
    22882288
    22892289
     
    22932293    def test_conservation_real(self):
    22942294        """Test that momentum is conserved globally
    2295        
     2295       
    22962296        Stephen finally made a test that revealed the problem.
    22972297        This test failed with code prior to 25 July 2005
    2298         """
     2298        """
    22992299
    23002300        yieldstep = 0.01
     
    23522352        assert allclose(ref, now), msg
    23532353
    2354         os.remove(domain.filename + '.sww')
     2354        os.remove(domain.get_name() + '.sww')
    23552355
    23562356    def test_second_order_flat_bed_onestep(self):
     
    24252425                         -1.22721531e-004, -4.57969873e-005])
    24262426
    2427         os.remove(domain.filename + '.sww')
     2427        os.remove(domain.get_name() + '.sww')
    24282428
    24292429
     
    24572457        #print domain.quantities['stage'].centroid_values
    24582458
    2459         os.remove(domain.filename + '.sww')       
     2459        os.remove(domain.get_name() + '.sww')       
    24602460
    24612461
     
    25022502
    25032503
    2504         os.remove(domain.filename + '.sww')           
     2504        os.remove(domain.get_name() + '.sww')           
    25052505
    25062506    def test_flatbed_second_order(self):
     
    25492549
    25502550        #FIXME: These numbers were from version before 21/3/6 -
    2551         #could be recreated by setting maximum_allowed_speed to 0 maybe
     2551        #could be recreated by setting maximum_allowed_speed to 0 maybe
    25522552        #assert allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
    25532553        #                [ 0.00064835, 0.03685719, 0.00085073, 0.03687313])
    2554        
     2554       
    25552555        assert allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
    25562556                        [ 0.00090581, 0.03685719, 0.00088303, 0.03687313])
    2557                        
    2558                        
     2557                       
     2558                       
    25592559
    25602560        #assert allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
     
    25652565
    25662566
    2567         os.remove(domain.filename + '.sww')
    2568 
    2569        
     2567        os.remove(domain.get_name() + '.sww')
     2568
     2569       
    25702570    def test_flatbed_second_order_vmax_0(self):
    25712571        from mesh_factory import rectangular
     
    26052605
    26062606        #FIXME: These numbers were from version before 21/3/6 -
    2607         #could be recreated by setting maximum_allowed_speed to 0 maybe
     2607        #could be recreated by setting maximum_allowed_speed to 0 maybe
    26082608        assert allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
    26092609                        [ 0.00064835, 0.03685719, 0.00085073, 0.03687313])
    2610        
     2610       
    26112611
    26122612        assert allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
     
    26142614
    26152615
    2616         os.remove(domain.filename + '.sww')
    2617 
    2618        
     2616        os.remove(domain.get_name() + '.sww')
     2617
     2618       
    26192619
    26202620    def test_flatbed_second_order_distribute(self):
     
    27242724            if not V:
    27252725                #FIXME: These numbers were from version before 21/3/6 -
    2726                 #could be recreated by setting maximum_allowed_speed to 0 maybe          
    2727                
    2728                 #assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.0)               
    2729                 assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                         
     2726                #could be recreated by setting maximum_allowed_speed to 0 maybe          
     2727               
     2728                #assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.0)               
     2729                assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                         
    27302730
    27312731            else:
     
    27422742            #assert allclose(domain.quantities['xmomentum'].centroid_values[17],
    27432743            #                0.0)
    2744             assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                                                 
     2744            assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                                                 
    27452745
    27462746
     
    27682768            #                [0.00090581,0.03685719,0.00088303,0.03687313])
    27692769
    2770         os.remove(domain.filename + '.sww')
     2770        os.remove(domain.get_name() + '.sww')
    27712771
    27722772
     
    28072807
    28082808
    2809         os.remove(domain.filename + '.sww')
     2809        os.remove(domain.get_name() + '.sww')
    28102810       
    28112811    def test_bedslope_problem_first_order_moresteps(self):
     
    28702870                        -0.14439383, -0.13924047, -0.14829043])
    28712871
    2872         os.remove(domain.filename + '.sww')
     2872        os.remove(domain.get_name() + '.sww')
    28732873       
    28742874    def test_bedslope_problem_second_order_one_step(self):
     
    29432943
    29442944        #print domain.quantities['stage'].centroid_values
    2945         assert allclose(domain.quantities['stage'].centroid_values,
    2946                 [0.01290985, 0.02356019, 0.01619096, 0.02356019, 0.01619096,
    2947                   0.02356019, 0.01619096, 0.02356019, 0.01619096, 0.02356019,
    2948                   0.01619096, 0.0268413, -0.04411074, -0.0248011, -0.04186556,
    2949                   -0.0248011, -0.04186556, -0.0248011, -0.04186556, -0.0248011,
    2950                   -0.04186556, -0.0248011, -0.04186556, -0.02255593,
    2951                   -0.09966629, -0.08035666, -0.09742112, -0.08035666,
    2952                   -0.09742112, -0.08035666, -0.09742112, -0.08035666,
    2953                   -0.09742112, -0.08035666, -0.09742112, -0.07811149,
    2954                   -0.15522185, -0.13591222, -0.15297667, -0.13591222,
    2955                   -0.15297667, -0.13591222, -0.15297667, -0.13591222,
    2956                   -0.15297667, -0.13591222, -0.15297667, -0.13366704,
    2957                   -0.2107774, -0.19146777, -0.20853223, -0.19146777,
    2958                   -0.20853223, -0.19146777, -0.20853223, -0.19146777,
    2959                   -0.20853223, -0.19146777, -0.20853223, -0.1892226,
    2960                   -0.26120669, -0.24776246, -0.25865535, -0.24776246,
    2961                   -0.25865535, -0.24776246, -0.25865535, -0.24776246,
    2962                   -0.25865535, -0.24776246, -0.25865535, -0.24521113])
    2963 
    2964         os.remove(domain.filename + '.sww')
     2945        assert allclose(domain.quantities['stage'].centroid_values,
     2946                [0.01290985, 0.02356019, 0.01619096, 0.02356019, 0.01619096,
     2947                  0.02356019, 0.01619096, 0.02356019, 0.01619096, 0.02356019,
     2948                  0.01619096, 0.0268413, -0.04411074, -0.0248011, -0.04186556,
     2949                  -0.0248011, -0.04186556, -0.0248011, -0.04186556, -0.0248011,
     2950                  -0.04186556, -0.0248011, -0.04186556, -0.02255593,
     2951                  -0.09966629, -0.08035666, -0.09742112, -0.08035666,
     2952                  -0.09742112, -0.08035666, -0.09742112, -0.08035666,
     2953                  -0.09742112, -0.08035666, -0.09742112, -0.07811149,
     2954                  -0.15522185, -0.13591222, -0.15297667, -0.13591222,
     2955                  -0.15297667, -0.13591222, -0.15297667, -0.13591222,
     2956                  -0.15297667, -0.13591222, -0.15297667, -0.13366704,
     2957                  -0.2107774, -0.19146777, -0.20853223, -0.19146777,
     2958                  -0.20853223, -0.19146777, -0.20853223, -0.19146777,
     2959                  -0.20853223, -0.19146777, -0.20853223, -0.1892226,
     2960                  -0.26120669, -0.24776246, -0.25865535, -0.24776246,
     2961                  -0.25865535, -0.24776246, -0.25865535, -0.24776246,
     2962                  -0.25865535, -0.24776246, -0.25865535, -0.24521113])
     2963
     2964        os.remove(domain.get_name() + '.sww')
    29652965
    29662966    def test_bedslope_problem_second_order_two_steps(self):
     
    30603060
    30613061
    3062         os.remove(domain.filename + '.sww')
     3062        os.remove(domain.get_name() + '.sww')
    30633063
    30643064    def test_bedslope_problem_second_order_two_yieldsteps(self):
     
    31343134
    31353135
    3136         assert allclose(domain.quantities['stage'].centroid_values,
    3137                 [0.00855788, 0.01575204, 0.00994606, 0.01717072, 0.01005985,
    3138                   0.01716362, 0.01005985, 0.01716299, 0.01007098, 0.01736248,
    3139                   0.01216452, 0.02026776, -0.04462374, -0.02479045, -0.04199789,
    3140                   -0.0229465, -0.04184033, -0.02295693, -0.04184013,
    3141                   -0.02295675, -0.04184486, -0.0228168, -0.04028876,
    3142                   -0.02036486, -0.10029444, -0.08170809, -0.09772846,
    3143                   -0.08021704, -0.09760006, -0.08022143, -0.09759984,
    3144                   -0.08022124, -0.09760261, -0.08008893, -0.09603914,
    3145                   -0.07758209, -0.15584152, -0.13723138, -0.15327266,
    3146                   -0.13572906, -0.15314427, -0.13573349, -0.15314405,
    3147                   -0.13573331, -0.15314679, -0.13560104, -0.15158523,
    3148                   -0.13310701, -0.21208605, -0.19283913, -0.20955631,
    3149                   -0.19134189, -0.20942821, -0.19134598, -0.20942799,
    3150                   -0.1913458, -0.20943005, -0.19120952, -0.20781177,
    3151                   -0.18869401, -0.25384082, -0.2463294, -0.25047649,
    3152                   -0.24464654, -0.25031159, -0.24464253, -0.25031112,
    3153                   -0.24464253, -0.25031463, -0.24454764, -0.24885323,
    3154                   -0.24286438])
    3155 
    3156         os.remove(domain.filename + '.sww')
     3136        assert allclose(domain.quantities['stage'].centroid_values,
     3137                [0.00855788, 0.01575204, 0.00994606, 0.01717072, 0.01005985,
     3138                  0.01716362, 0.01005985, 0.01716299, 0.01007098, 0.01736248,
     3139                  0.01216452, 0.02026776, -0.04462374, -0.02479045, -0.04199789,
     3140                  -0.0229465, -0.04184033, -0.02295693, -0.04184013,
     3141                  -0.02295675, -0.04184486, -0.0228168, -0.04028876,
     3142                  -0.02036486, -0.10029444, -0.08170809, -0.09772846,
     3143                  -0.08021704, -0.09760006, -0.08022143, -0.09759984,
     3144                  -0.08022124, -0.09760261, -0.08008893, -0.09603914,
     3145                  -0.07758209, -0.15584152, -0.13723138, -0.15327266,
     3146                  -0.13572906, -0.15314427, -0.13573349, -0.15314405,
     3147                  -0.13573331, -0.15314679, -0.13560104, -0.15158523,
     3148                  -0.13310701, -0.21208605, -0.19283913, -0.20955631,
     3149                  -0.19134189, -0.20942821, -0.19134598, -0.20942799,
     3150                  -0.1913458, -0.20943005, -0.19120952, -0.20781177,
     3151                  -0.18869401, -0.25384082, -0.2463294, -0.25047649,
     3152                  -0.24464654, -0.25031159, -0.24464253, -0.25031112,
     3153                  -0.24464253, -0.25031463, -0.24454764, -0.24885323,
     3154                  -0.24286438])
     3155
     3156        os.remove(domain.get_name() + '.sww')
    31573157
    31583158    def test_bedslope_problem_second_order_more_steps(self):
     
    32753275      -4.50964850e-003, -3.06319963e-003,  6.08950810e-004, -4.79537921e-004])
    32763276
    3277         os.remove(domain.filename + '.sww')
     3277        os.remove(domain.get_name() + '.sww')
    32783278
    32793279
     
    33163316            pass
    33173317
    3318         assert allclose(domain.quantities['stage'].centroid_values[:4],
    3319                         [0.00206836, 0.01296714, 0.00363415, 0.01438924])
     3318        assert allclose(domain.quantities['stage'].centroid_values[:4],
     3319                        [0.00206836, 0.01296714, 0.00363415, 0.01438924])
    33203320        #print domain.quantities['xmomentum'].centroid_values[:4]
    3321         assert allclose(domain.quantities['xmomentum'].centroid_values[:4],
    3322                         [0.01360154, 0.00671133, 0.01264578, 0.00648503])
    3323         assert allclose(domain.quantities['ymomentum'].centroid_values[:4],
    3324                         [-1.19201077e-003, -7.23647546e-004,
    3325                         -6.39083123e-005, 6.29815168e-005])
    3326 
    3327         os.remove(domain.filename + '.sww')
     3321        assert allclose(domain.quantities['xmomentum'].centroid_values[:4],
     3322                        [0.01360154, 0.00671133, 0.01264578, 0.00648503])
     3323        assert allclose(domain.quantities['ymomentum'].centroid_values[:4],
     3324                        [-1.19201077e-003, -7.23647546e-004,
     3325                        -6.39083123e-005, 6.29815168e-005])
     3326
     3327        os.remove(domain.get_name() + '.sww')
    33283328
    33293329    def test_complex_bed(self):
     
    33993399# -5.48333333e-001, -5.31666667e-001, -5.48333333e-001, -5.31666667e-001])
    34003400
    3401         os.remove(domain.filename + '.sww')
     3401        os.remove(domain.get_name() + '.sww')
    34023402
    34033403    def test_spatio_temporal_boundary_1(self):
     
    34723472
    34733473        boundary = { (0,1):'bottom', (1,1):'bottom', (4,1): 'bottom',
    3474                      (4,2):'right', (6,2):'right', (8,2):'right',
    3475                      (0,0):'diagonal', (3,0):'diagonal', (8,0):'diagonal'}
     3474                     (4,2):'right', (6,2):'right', (8,2):'right',
     3475                     (0,0):'diagonal', (3,0):'diagonal', (8,0):'diagonal'}
    34763476
    34773477        domain2 = Domain(points, vertices, boundary)
     
    34883488        # Boundary conditions
    34893489        Br = Reflective_boundary(domain2)
    3490         Bf = Spatio_temporal_boundary(domain1.filename + '.' + domain1.format,
    3491                                       domain2)
     3490        Bf = Spatio_temporal_boundary(domain1.get_name() + '.' +\
     3491                                      domain1.format, domain2)
    34923492        domain2.set_boundary({'right':Br, 'bottom':Br, 'diagonal':Bf})
    34933493        domain2.check_integrity()
     
    35173517
    35183518        #Cleanup
    3519         os.remove(domain1.filename + '.' + domain1.format)
    3520         os.remove(domain2.filename + '.' + domain2.format)       
     3519        os.remove(domain1.get_name() + '.' + domain1.format)
     3520        os.remove(domain2.get_name() + '.' + domain2.format)       
    35213521
    35223522
     
    35823582
    35833583        points = [ [0,0], [1.0/3,0], [1.0/3,1.0/3],
    3584                    [2.0/3,0], [2.0/3,1.0/3], [2.0/3,2.0/3],
    3585                    [1,0], [1,1.0/3], [1,2.0/3], [1,1]]
     3584                   [2.0/3,0], [2.0/3,1.0/3], [2.0/3,2.0/3],
     3585                   [1,0], [1,1.0/3], [1,2.0/3], [1,1]]
    35863586
    35873587        vertices = [ [1,2,0],
    3588                      [3,4,1], [2,1,4], [4,5,2],
    3589                      [6,7,3], [4,3,7], [7,8,4], [5,4,8], [8,9,5]]
     3588                     [3,4,1], [2,1,4], [4,5,2],
     3589                     [6,7,3], [4,3,7], [7,8,4], [5,4,8], [8,9,5]]
    35903590
    35913591        boundary = { (0,1):'bottom', (1,1):'bottom', (4,1): 'bottom',
    3592                      (4,2):'right', (6,2):'right', (8,2):'right',
    3593                      (0,0):'diagonal', (3,0):'diagonal', (8,0):'diagonal'}
     3592                     (4,2):'right', (6,2):'right', (8,2):'right',
     3593                     (0,0):'diagonal', (3,0):'diagonal', (8,0):'diagonal'}
    35943594
    35953595        domain2 = Domain(points, vertices, boundary)
     
    36073607        #Read results for specific timesteps t=1 and t=2
    36083608        from Scientific.IO.NetCDF import NetCDFFile
    3609         fid = NetCDFFile(domain1.filename + '.' + domain1.format)
     3609        fid = NetCDFFile(domain1.get_name() + '.' + domain1.format)
    36103610
    36113611        x = fid.variables['x'][:]
     
    36223622        #print points[0], points[5], points[10], points[15]
    36233623        assert allclose( take(points, [0,5,10,15]),
    3624                          [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
     3624                         [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
    36253625
    36263626
    36273627        # Boundary conditions
    36283628        Br = Reflective_boundary(domain2)
    3629         Bf = Spatio_temporal_boundary(domain1.filename + '.' + domain1.format,
    3630                                       domain2)
     3629        Bf = Spatio_temporal_boundary(domain1.get_name() + '.' + domain1.format,
     3630                                      domain2)
    36313631        domain2.set_boundary({'right':Br, 'bottom':Br, 'diagonal':Bf})
    36323632        domain2.check_integrity()
     
    36363636
    36373637        boundary_midpoints = [[1.0/6, 0], [1.0/2, 0], [5.0/6,0],
    3638                               [1.0, 1.0/6], [1.0, 1.0/2], [1.0, 5.0/6],
    3639                               [1.0/6, 1.0/6], [0.5, 0.5], [5.0/6, 5.0/6]]
     3638                              [1.0, 1.0/6], [1.0, 1.0/2], [1.0, 5.0/6],
     3639                              [1.0/6, 1.0/6], [0.5, 0.5], [5.0/6, 5.0/6]]
    36403640
    36413641        boundary_midpoints.sort()
     
    36943694
    36953695        #Cleanup
    3696         os.remove(domain1.filename + '.' + domain1.format)
     3696        os.remove(domain1.get_name() + '.' + domain1.format)
    36973697
    36983698
  • anuga_core/source/anuga/shallow_water/tsh2sww.py

    r3564 r3846  
    3636        file_path, filename = path.split(sww_file_name)
    3737        filename, ext = path.splitext(filename)
    38     domain.filename = filename
     38    domain.set_name(filename)
    3939       
    4040    domain.reduction = mean
     
    4545    if verbose == True:
    4646        print "Output written to " + domain.get_datadir() + sep + \
    47               domain.filename + "." + domain.format 
     47              domain.get_name() + "." + domain.format 
    4848    sww = get_dataobject(domain)
    4949    sww.store_connectivity()
  • anuga_core/source/anuga_parallel/run_parallel_sw_merimbula_test.py

    r3579 r3846  
    196196
    197197domain.store = False
    198 #domain.filename = 'merimbula-%d' %domain.processor
    199198
    200199#---------
  • anuga_core/source/anuga_parallel/run_sw_lost_mass.py

    r3579 r3846  
    9494
    9595
    96 #domain.set_quantity('stage', quantities['stage'])
    97 #domain.set_quantity('elevation', quantities['elevation'])
    98 
    99 #domain.store = True
    100 #domain.filename = 'merimbula-%d' %domain.processor
    10196
    10297#---------
  • anuga_validation/analytical solutions/Analytical solution_oblique_shock.py

    r2229 r3846  
    6161
    6262# Provide file name for storing output
    63 domain.filename="oblique"
     63domain.set_name('oblique')
    6464
    6565# Visualization smoothing
  • anuga_validation/analytical solutions/Analytical solution_oblique_shock_01.py

    r3657 r3846  
    5757
    5858# Provide file name for storing output
    59 domain.filename="oblique_cross_%g_%g_%g_%g_%g" % (n,m,theta,h_bc,p_bc)
    60 print domain.filename
     59domain.set_name('oblique_cross_%g_%g_%g_%g_%g' % (n,m,theta,h_bc,p_bc))
     60print domain.get_name()
    6161
    6262# Output format
  • anuga_validation/analytical solutions/Analytical solution_wave_runup.py

    r3514 r3846  
    5858domain.store = True
    5959domain.format = 'sww'
    60 domain.filename = 'run-up_second_order_again'
     60domain.set_name('run-up_second_order_again')
    6161
    6262print "Number of triangles = ", len(domain)
  • anuga_validation/analytical solutions/Analytical_solution_MacDonald_import_mesh.py

    r3514 r3846  
    4545domain.store = True     #Store for visualisation purposes
    4646domain.format = 'sww'   #Native netcdf visualisation format
    47 domain.filename = 'MacDonald_77541'
     47domain.set_name('MacDonald_77541')
    4848
    4949#-------------
  • anuga_validation/analytical solutions/Analytical_solution_MacDonald_import_mesh_wall.py

    r3514 r3846  
    4545domain.store = True     #Store for visualisation purposes
    4646domain.format = 'sww'   #Native netcdf visualisation format
    47 domain.filename = 'MacDonald_first_order_wall'
     47domain.set_name('MacDonald_first_order_wall')
    4848
    4949#-------------
  • anuga_validation/analytical solutions/Analytical_solution_MacDonald_import_mesh_wall0.py

    r3514 r3846  
    4141domain.store = True     #Store for visualisation purposes
    4242domain.format = 'sww'   #Native netcdf visualisation format
    43 domain.filename = 'MacDonald_first_order_wall'
     43domain.set_name('MacDonald_first_order_wall')
    4444
    4545#--------------
  • anuga_validation/analytical solutions/Analytical_solution_Sampson_cross_mesh.py

    r3514 r3846  
    6161domain.store = True
    6262domain.format = 'sww'
    63 domain.filename = 'sampson_first_order_cross'
     63domain.set_name('sampson_first_order_cross')
    6464
    6565print 'Number of triangles = ', len(domain)
     
    140140tri = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]]
    141141
    142 filename=domain.filename
     142filename=domain.get_name()
    143143file = open(filename,'w')
    144144
  • anuga_validation/analytical solutions/Analytical_solution_Sampson_import_mesh.py

    r3514 r3846  
    5353domain.store = True
    5454domain.format = 'sww'
    55 domain.filename = 'sampson_strang_second_order'
     55domain.set_name('sampson_strang_second_order')
    5656
    5757print 'Number of triangles = ', len(domain)
  • anuga_validation/analytical solutions/Analytical_solution_Yoon_cross_mesh.py

    r3514 r3846  
    4545domain.store = False
    4646domain.format = 'sww'
    47 domain.filename = 'yoon_mesh_second_order_cross'
     47domain.set_name('yoon_mesh_second_order_cross')
    4848print 'Number of triangles = ', len(domain)
    4949
     
    120120tri = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]]
    121121
    122 filename=domain.filename
     122filename=domain.get_name()
    123123file = open(filename,'w')
    124124
  • anuga_validation/analytical solutions/Analytical_solution_Yoon_import_mesh.py

    r3514 r3846  
    4242domain.store = False
    4343domain.format = 'sww'
    44 domain.filename = 'yoon_mesh_second_order.2'
     44domain.set_name('yoon_mesh_second_order.2')
    4545print 'Number of triangles = ', len(domain)
    4646
     
    114114tri = [domain.coordinates[t[0]],domain.coordinates[t[1]],domain.coordinates[t[2]]]
    115115
    116 filename=domain.filename
     116filename=domain.get_name()
    117117file = open(filename,'w')
    118118   
  • anuga_validation/analytical solutions/Analytical_solution_circular_hydraulic_jump.py

    r3678 r3846  
    5959domain.store = True
    6060domain.format = 'sww'
    61 domain.filename = 'circular_second_order'
     61domain.set_name('circular_second_order')
    6262
    6363#------------------------------------------
  • anuga_validation/analytical solutions/Analytical_solution_contracting_channel.py

    r3651 r3846  
    6060domain.store = True     #Store for visualisation purposes
    6161domain.format = 'sww'   #Native netcdf visualisation format
    62 domain.filename = 'contracting_channel_second-order'
     62domain.set_name('contracting_channel_second-order')
    6363
    6464
  • anuga_validation/analytical solutions/Analytical_solution_contracting_channel_import_mesh.py

    r3514 r3846  
    4545domain.store = True     #Store for visualisation purposes
    4646domain.format = 'sww'   #Native netcdf visualisation format
    47 domain.filename = 'contracting_channel_second-order'
     47domain.set_name('contracting_channel_second-order')
    4848
    4949#----------------------------------------------------------
  • anuga_validation/analytical solutions/Analytical_solution_oblique_shock.py

    r3653 r3846  
    4747domain.store = True
    4848domain.format = "sww" #"sww" for NET.CDF binary format or "dat" for ASCII
    49 domain.filename = "oblique_first_order"
     49domain.set_name('oblique_first_order')
    5050
    5151#------------------------
  • anuga_validation/analytical solutions/Malpasset_new.py

    r2229 r3846  
    5555domain.store = True
    5656domain.format = 'sww'
    57 domain.filename = 'Malpasset_second_order'
     57domain.set_name('Malpasset_second_order')
    5858
    5959#----------------------------
  • anuga_validation/analytical solutions/Non_symmetrical_dam_break.py

    r3514 r3846  
    140140domain.store = True
    141141domain.format = 'sww'
    142 domain.filename = 'Non_symetrical_Dam_Break_second_order'
     142domain.set_name('Non_symetrical_Dam_Break_second_order')
    143143
    144144
  • anuga_validation/analytical solutions/Sydney.py

    r3514 r3846  
    3434domain.store = True
    3535domain.format = 'sww'
    36 domain.filename = 'sydney_ubd_again'
     36domain.set_name('sydney_ubd_again')
    3737
    3838#Reduction operation for get_vertex_values
  • anuga_work/development/LWRU1/lwru1.py

    r3514 r3846  
    5858import sys, os
    5959base = os.path.basename(sys.argv[0])
    60 domain.filename, _ = os.path.splitext(base)
    61 
     60
     61basename, _ = os.path.splitext(base)
     62domain.set_name(basename)
    6263
    6364#Set initial values
  • anuga_work/development/cairns_2006/run_cairns.py

    r3514 r3846  
    108108
    109109base = os.path.basename(sys.argv[0])
    110 domain.filename, _ = os.path.splitext(base)
     110basename, _ = os.path.splitext(base)
     111domain.set_name(basename)
    111112domain.default_order = 2
    112113domain.store = True    #Store for visualisation purposes
  • anuga_work/development/pyvolution-1d/data_manager.py

    r3535 r3846  
    413413            #remember the old filename, then give domain a
    414414            #name with the extension
    415             old_domain_filename = self.domain.filename
     415            old_domain_filename = self.domain.get_name()
    416416            if not self.recursion:
    417                 self.domain.filename = self.domain.filename+filename_ext
     417                self.domain.set_name(old_domain_filename+filename_ext)
    418418
    419419            #change the domain starttime to the current time
     
    440440            #restore the old starttime and filename
    441441            self.domain.starttime = old_domain_starttime
    442             self.domain.filename = old_domain_filename
     442            self.domain.set_name(old_domain_filename)
    443443        else:
    444444            self.recursion = False
     
    33883388    file_path, filename = path.split(filename)
    33893389    filename, ext = path.splitext(filename)
    3390     domain.filename = filename
     3390    domain.set_name(filename)
    33913391    domain.reduction = mean
    33923392    if verbose == True:print "file_path",file_path
     
    33963396    if verbose == True:
    33973397        print "Output written to " + domain.get_datadir() + sep + \
    3398               domain.filename + "." + domain.format
     3398              domain.get_name() + "." + domain.format
    33993399    sww = get_dataobject(domain)
    34003400    sww.store_connectivity()
  • anuga_work/development/pyvolution-1d/test_shallow_water_1d.py

    r3295 r3846  
    632632                assert not allclose(stage, initial_stage)
    633633
    634         os.remove(domain.filename + '.sww')
     634        os.remove(domain.get_name() + '.sww')
    635635
    636636    #####################################################
  • anuga_work/development/stochastic_study/run_model.py

    r3514 r3846  
    148148
    149149                print 'P%d: Extracting time series for realisation %d from file %s'\
    150                       %(myid, realisation, project.working_dir + domain.filename + '.sww')
    151                 f = file_function(project.working_dir + domain.filename + '.sww',
     150                      %(myid, realisation, project.working_dir +\
     151                        domain.get_name() + '.sww')
     152                f = file_function(project.working_dir +\
     153                                  domain.get_name() + '.sww',
    152154                                  quantities='stage',
    153155                                  interpolation_points=project.gauges,
  • anuga_work/development/stochastic_study/run_simple_model.py

    r3514 r3846  
    150150
    151151        print 'P%d: Extracting time series for realisation %d from file %s'\
    152               %(myid, realisation, project.working_dir + domain.filename + '.sww')
    153         f = file_function(project.working_dir + domain.filename + '.sww',
     152              %(myid, realisation, project.working_dir +\
     153                domain.get_name() + '.sww')
     154        f = file_function(project.working_dir +\
     155                          domain.get_name() + '.sww',
    154156                          quantities='stage',
    155157                          interpolation_points=project.gauges,
Note: See TracChangeset for help on using the changeset viewer.