Changeset 4282 for anuga_work


Ignore:
Timestamp:
Feb 27, 2007, 9:39:30 AM (18 years ago)
Author:
nick
Message:

update to dampier

Location:
anuga_work/production/dampier_2006
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/dampier_2006/build_dampier.py

    r4246 r4282  
    3333from anuga.geospatial_data.geospatial_data import *
    3434from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, copy_code_files
     35from anuga_parallel.parallel_abstraction import get_processor_name
    3536
    3637# Application specific imports
     
    4546
    4647start_screen_catcher(project.output_build_time_dir)
     48print "Processor Name:",get_processor_name()
    4749
    4850print 'USER:    ', project.user
     
    128130G_other.export_points_file(project.combined_dir_name + '_other' + '.pts')
    129131
    130 print 'start reading:',project.combined_dir_name + '.pts'
    131 G = Geospatial_data(file_name = project.combined_dir_name + '.pts')
    132 print 'start export',project.combined_dir_name + '.txt'
    133 G.export_points_file(project.combined_dir_name + '.txt')
     132print 'start reading:',project.combined_smaller_dir_name + '.txt'
     133G = Geospatial_data(file_name = project.combined_smaller_dir_name + '.txt')
     134print 'start split'
     135G_smallest, G_other = G.split(0.1,True)
     136
     137print 'start export',project.combined_smallest_dir_name + '.txt'
     138#G.export_points_file(project.combined_smaller_dir_name + '.txt')
     139#G_smallest.export_points_file(project.combined_smallest_dir_name + '.txt')
    134140'''
    135141#-------------------------------------------------------------------------
     
    152158cache(urs2sww,
    153159      (boundaries_in_dir_name,
    154        project.boundaries_dir_name1),
     160       project.boundaries_dir_name+'2'),
    155161      {'verbose': True,
    156162       'minlat': project.south_boundary,
     
    158164       'minlon': project.west_boundary,
    159165       'maxlon': project.east_boundary,
    160        'mint': 0, 'maxt': 40000,
     166       'mint': 8500, 'maxt': 12000,
    161167#       'origin': domain.geo_reference.get_origin(),
    162168       'mean_stage': project.tide,
  • anuga_work/production/dampier_2006/get_timeseries.py

    r4247 r4282  
    2424# sww file created from URS boundary
    2525production_dirs = {#'20070206_005106_run': '10000 yr wave height'}
    26                    'boundaries': 'URS boundary condition'}
     26                   '20070223_031527_run': 'URS boundary condition'}
    2727
    2828is_parallel = False
     
    4242            if label_id == 'boundaries':
    4343                file_loc = project.boundaries_in_dir
    44                 swwfile = file_loc + sep + '20061102_221245_build' + sep + 'dampier.sww'
     44                swwfile = file_loc + sep + '20070223_031527_run' + sep + 'dampier.sww'
    4545                print 'hi'
    4646            #else:
     
    5151
    5252        texname, elev_output = sww2timeseries(swwfiles,
    53                                               project.gauges_dir_name,
     53                                              project.gauges_dir_name_test,
    5454                                              production_dirs,
    5555                                              report = False,
     
    7171        if label_id == 'boundaries':
    7272                file_loc = project.boundaries_in_dir
    73                 swwfile = file_loc + sep + '20061102_221245_build' + sep + 'dampier.sww'
     73                swwfile = file_loc + sep + '20070223_031527_run' + sep + 'dampier.sww'
    7474        else:
    7575            file_loc = project.output_dir + label_id + sep
     
    7878       
    7979    texname, elev_output = sww2timeseries(swwfiles,
    80                                           project.gauges_dir_name,
     80                                          project.gauges_dir_name_test,
    8181                                          production_dirs,
    8282                                          report = False,
  • anuga_work/production/dampier_2006/project.py

    r4246 r4282  
    66import sys
    77from time import localtime, strftime, gmtime
    8 from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon # number_mesh_triangles
     8from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles
    99from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_from_latlon_to_utm
    1010from anuga.utilities.system_tools import get_user_name
     
    2525build_time = time+'_build'
    2626run_time = time+'_run'
     27temp_time = time+'_temp'
    2728print 'gtime: ', gtime
    2829
     
    4546#final topo name
    4647combined_name ='dampier_combined_elevation'
    47 combined_smaller_name = 'dampier_combined_elevation_smaller'
     48combined_smaller_name = 'dampier_combined_elevation_small'
     49combined_smallest_name = 'dampier_combined_elevation_smallest'
    4850
    4951topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'070112'+sep+'points'+sep
    5052topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep
    5153topographies_time_dir = topographies_dir+build_time+sep
     54
     55temp_dir = home+sep+state+sep+scenario+sep+'anuga'+sep
     56temp_dir_name = temp_dir + temp_time+sep
    5257
    5358# input topo file location
     
    6772combined_dir_name = topographies_dir + combined_name
    6873combined_time_dir_name = topographies_time_dir + combined_name
    69 combined_smaller_name_dir = topographies_dir + combined_smaller_name
     74combined_smaller_dir_name = topographies_dir + combined_smaller_name
     75combined_smallest_dir_name = topographies_dir + combined_smallest_name
    7076#combined_time_dir_final_name = topographies_time_dir + combined_final_name
    7177
     
    7884boundaries_source = ''
    7985boundaries_name = 'o'
    80 boundaries_name1 = 'o_new'
     86boundaries_name1 = 'o_new1'
     87boundaries_name2 = 'o_test'
    8188
    8289#boundaries locations
    83 boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'
    84 #boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'1_10000'+sep
     90#boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep
     91boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'1_10000'+sep
    8592boundaries_in_dir_name = boundaries_in_dir + boundaries_name
    8693boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep
    8794boundaries_dir_name = boundaries_dir + boundaries_name
    8895boundaries_dir_name1 = boundaries_dir + boundaries_name1
     96boundaries_dir_name2 = boundaries_dir + boundaries_name2
     97boundaries_dir_name3 = boundaries_dir + boundaries_name+'_test_8500_12000'
     98boundaries_dir_name4 = boundaries_dir + boundaries_name+'_8500_12000_no_zone'
     99
    89100#boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep
    90101#boundaries_time_dir_name = boundaries_time_dir + boundaries_name  #Used by post processing
     
    98109#gauges
    99110gauge_name = 'dampier_gauges_up2.csv' #'dampier.csv'
     111gauge_name_test = 'dampier_gauges_up_test.csv' #'dampier.csv'
    100112gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
    101113gauges_dir_name = gauges_dir + gauge_name
     114gauges_dir_name_test = gauges_dir + gauge_name_test
     115
    102116
    103117#buildings_filename = gauges_dir + 'dampier_res_nexis.csv'
     
    109123refzone = 50
    110124south_boundary = degminsec2decimal_degrees(-20,58,0)
    111 north_boundary = degminsec2decimal_degrees(-20,13,0)
     125#north_boundary = degminsec2decimal_degrees(-20,13,0)
     126north_boundary = degminsec2decimal_degrees(-19,30,0)
    112127west_boundary = degminsec2decimal_degrees(116,15,0)
    113128east_boundary = degminsec2decimal_degrees(117,11,0)
     
    128143print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0
    129144
    130 res_poly_all = 100000
     145res_poly_all = 400000
    131146#res_poly_all = 500000
    132147
     
    139154
    140155poly_dampier = read_polygon(polygons_dir+'dampier_town.csv')
    141 res_dampier = 500
     156res_dampier = 1000
     157#res_dampier = 500
    142158#res_dampier = 5000
    143159
     
    146162
    147163poly_karratha_town = read_polygon(polygons_dir+'karratha_townv2.csv')
    148 res_karratha_town = 500
     164res_karratha_town = 1000
     165#res_karratha_town = 500
    149166#res_karratha_town = 5000
    150167
     
    226243                    [poly_ref_nw5,res_ref_nw5],[poly_ref_nw6,res_ref_nw6],
    227244                    [poly_ref_nw7,res_ref_nw7],[poly_ref_nw8,res_ref_nw8]]
    228                    
    229 #trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
    230 #
    231 #print 'min number triangles', trigs_min
     245
     246interior_regions_test = [[poly_dampier,res_dampier],
     247                    [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town]]
     248
     249trigs_min = number_mesh_triangles(interior_regions_test, poly_all, res_poly_all)
     250
     251print 'min number triangles', trigs_min
    232252
    233253###################################################################
  • anuga_work/production/dampier_2006/run_dampier.py

    r4246 r4282  
    3434from anuga_parallel.parallel_api import distribute, numprocs, myid, barrier
    3535from anuga_parallel.parallel_abstraction import get_processor_name
     36from anuga.caching import myhash
    3637# Application specific imports
    3738import project                 # Definition of file names and polygons
     
    8182
    8283sys.exit()
    83 '''
     84
    8485if myid == 0:
    8586   
    8687    print 'start create mesh from regions'
     88#    print 'project.res_poly_all',project.res_poly_all
     89#    print 'project.interior_regions_test',project.interior_regions_test
     90#    print 'meshes_dir_name',meshes_dir_name
    8791    create_mesh_from_regions(project.poly_all,
    8892                             boundary_tags={'back': [2,3], 'side': [0, 1, 4],
    8993                                            'ocean': [5]},
    9094                             maximum_triangle_area=project.res_poly_all,
    91                              interior_regions=project.interior_regions,
     95                             interior_regions=project.interior_regions_test,
    9296                             filename=meshes_dir_name,
    9397                             use_cache=True,
     
    96100# to sync all processors are ready
    97101barrier()
     102'''
     103create_mesh_from_regions(project.poly_all,
     104                             boundary_tags={'back': [2,3], 'side': [0, 1, 4],
     105                                            'ocean': [5]},
     106                             maximum_triangle_area=project.res_poly_all,
     107                             interior_regions=project.interior_regions_test,
     108                             filename=meshes_dir_name,
     109                             use_cache=True,
     110                             verbose=True)
    98111
    99112#-------------------------------------------------------------------------
     
    101114#-------------------------------------------------------------------------
    102115print 'Setup computational domain'
    103 domain = Domain(meshes_dir_name, use_cache=True, verbose=True)
     116from caching import cache
     117domain = cache(Domain, (meshes_dir_name), {'use_cache':True, 'verbose':True}, verbose=True)
     118print 'domain id', id(domain)
     119print 'myhash', myhash(domain)     
     120       
    104121print domain.statistics()
     122
    105123boundaries_dir_name=project.boundaries_dir_name
    106124
     
    108126
    109127from anuga.shallow_water.data_manager import urs2sww
    110 
     128'''
    111129# put above distribute
    112130print 'boundary file is: ',project.boundaries_dir_name
     
    129147           )
    130148barrier()
    131 
     149'''
    132150
    133151#-------------------------------------------------------------------------
     
    148166#                    filename = project.combined_dir_name + '.pts',
    149167# MUST USE TXT FILES FOR CACHING TO WORK!
    150                     filename = project.combined_dir_name + '.txt',
    151                     use_cache = False,
     168                    filename = project.combined_smaller_dir_name + '.txt',
     169                    use_cache = True,
    152170                    verbose = True,
    153171                    alpha = 0.1)
     
    166184# Set domain parameters
    167185#------------------------------------------------------
    168 
     186print 'domain id', id(domain)
    169187domain.set_name(project.scenario_name)
    170188domain.set_datadir(project.output_run_time_dir)
     
    174192domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    175193domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
     194print 'domain id', id(domain)
     195domain.beta_h = 0
     196domain.limit2007 = 1
    176197
    177198#-------------------------------------------------------------------------
     
    180201print 'Available boundary tags', domain.get_boundary_tags()
    181202print 'domain id', id(domain)
    182 print 'Reading Boundary file'
    183 Bf = File_boundary(boundaries_dir_name + '.sww',
     203print 'Reading Boundary file',project.boundaries_dir_name4 + '.sww'
     204#Bf = File_boundary(boundaries_dir_name + '.sww',
     205Bf = File_boundary(project.boundaries_dir_name4 + '.sww',
    184206                  domain, time_thinning=4, use_cache=True, verbose=True)
    185207
     
    204226t0 = time.time()
    205227
    206 for t in domain.evolve(yieldstep = 120, finaltime = 9000):
     228for t in domain.evolve(yieldstep = 60, finaltime = 9000):
    207229    domain.write_time()
    208230    domain.write_boundary_statistics(tags = 'ocean')
Note: See TracChangeset for help on using the changeset viewer.