Changeset 2058


Ignore:
Timestamp:
Nov 24, 2005, 10:41:14 AM (19 years ago)
Author:
duncan
Message:

creating a mesh and points file.

Location:
production/gippsland_2005
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • production/gippsland_2005/project.py

    r2044 r2058  
    44
    55from os import sep
     6from os import environ
    67from os.path import expanduser
    78import sys
    89
    910#Making assumptions about the location of scenario data
     11# Assumes the INUNDATIONHOME environ variable exists
    1012scenario_dir_name = 'gippsland_storm_surge_scenario_2005'
    1113
     
    1517
    1618if sys.platform == 'win32':
    17     home = '..\..\..\..\..\..'     #Sandpit's parent dir
     19    home = environ["INUNDATIONHOME"]     #Sandpit's parent dir
    1820else:   
    1921    home = expanduser('~')
  • production/gippsland_2005/run_small_gippsland.py

    r2044 r2058  
    2020from pyvolution.data_manager import convert_dem_from_ascii2netcdf,\
    2121     dem2pts, asc_csiro2sww
    22 from pyvolution.pmesh2domain import pmesh_to_domain_instance
     22#from pyvolution.pmesh2domain import pmesh_to_domain_instance
     23from pyvolution.pmesh2domain import pmesh_instance_to_domain_instance
    2324from caching import cache
    2425import project
     26from create_mesh import create_mesh
    2527
    2628#Data preparation
    2729#Convert ASC 2 DEM 2 PTS using source data and store result in source data
    2830demname = project.demname
    29 
     31demname = project.datadir + 'lakes_100'
    3032# just interested in the boundary/ mesh intereaction first off.
    3133#cache(convert_dem_from_ascii2netcdf, demname, {'verbose': True},
     
    3436#      #evaluate = True)
    3537
    36 #cache(dem2pts, demname, {'verbose': True},
    37 #      dependencies = [demname + '.dem'],     
    38 #      verbose = True)
     38cache(dem2pts, demname, {'verbose': True},
     39      dependencies = [demname + '.dem'],     
     40      verbose = True)
    3941
    4042
    41 #Convert CSIRO boundary
    42 cache(ferret2sww,
    43       (source_dir+project.boundary_basename,
    44        project.boundary_basename),
    45       {'bath_dir':project.bath_dir,
    46        'elevation_dir':project.elevation_dir,
    47        'ucur_dir':project.ucur_dir,
    48        'vcur_dir':project.vcur_dir,
    49        'sww_file':project.boundaryname + '.sww',
    50        'verbose': True,
     43# Convert CSIRO boundary
     44# NOTE: This function is dependent on a lot of files, and I haven't listed
     45# them, since there is so many and I don't think they will be changing.
     46cache(asc_csiro2sww,
     47      (project.bath_dir,
     48       project.elevation_dir,
     49       project.ucur_dir,
     50       project.vcur_dir,
     51       project.boundaryname + '.sww'),
     52       {'verbose': True,
    5153       'minlat': -38.25,
    5254       'maxlat': -37.7,
     
    5557       'mean_stage': project.tide,
    5658       'zscale': 1,                 #Enhance tsunami
    57        'fail_on_NaN': False,
    58        'inverted_bathymetry': True},
     59       'fail_on_NaN': False},
    5960       #evaluate = True,
    6061      verbose = True)
     62
     63
     64#Create the mesh ..
     65
     66#cache this, with dependancy on create_mesh.py
     67mesh, triagle_count = create_mesh(10000000)
     68
     69
     70#meshname = project.meshname + '_%d.msh' %resolution
     71#meshname = project.meshdir + 'lakes_small_100.msh'
     72
     73
     74#Setup domain
     75
     76domain = cache(pmesh_instance_to_domain_instance, (mesh, Domain),
     77               #dependencies = [meshname],                     
     78               verbose = True)               
     79
     80
     81domain.set_name(project.basename) # + '_%d' %resolution)
     82domain.set_datadir(project.outputdir)
     83domain.store = True
     84#domain.smooth = False
     85
     86
     87#domain.quantities_to_be_stored = ['stage', 'xmomentum', 'ymomentum']
     88domain.quantities_to_be_stored = ['stage']
     89       
     90print 'Number of triangles = ', len(domain)
     91print 'The extent is ', domain.get_extent()
     92
     93
     94
     95#Setup Initial Conditions
     96domain.set_quantity('friction', 0)
     97domain.set_quantity('stage', project.tide)
     98domain.set_quantity('elevation',
     99                    filename = demname + '.pts',
     100                    use_cache = True,
     101                    verbose = True)
     102
     103
     104
     105#Setup Boundary Conditions
     106print domain.get_boundary_tags()
     107
     108Bf = File_boundary(project.boundary_basename + '.sww', domain, verbose = True)
     109#domain.starttime = 3000  #Obtained from MOST
     110domain.starttime = 0  #Obtained from MOST
     111
     112Br = Reflective_boundary(domain)
     113Bt = Transmissive_boundary(domain)
     114Bd = Dirichlet_boundary([tide,0,0])
     115Bw = Time_boundary(domain=domain,
     116                   f=lambda t: [(60<t<660)*4, 0, 0])
     117
     118
     119domain.set_boundary( {'back': Br,'side': Bd, 'ocean': Bf} ) #MOST tsunami
     120
     121#domain.set_boundary( {'back': Bd,'side': Bd, 'ocean': Bd} )  #Nothing
     122
     123
     124#Evolve
     125import time
     126t0 = time.time()
     127
     128for t in domain.evolve(yieldstep = 60, finaltime = 40000):
     129#                       skip_initial_step = True):
     130    domain.write_time()
     131    domain.write_boundary_statistics(tags = 'ocean') #quantities = 'stage')       
     132
     133print 'That took %.2f seconds' %(time.time()-t0)
Note: See TracChangeset for help on using the changeset viewer.