Changeset 3877


Ignore:
Timestamp:
Oct 27, 2006, 2:29:02 PM (16 years ago)
Author:
nick
Message:

build_dampier works... run might needs some changes

Location:
anuga_work/production/dampier_2006
Files:
3 edited

Legend:

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

    r3871 r3877  
    152152if access(project.boundaries_time_dir,F_OK) == 0:
    153153    mkdir (project.boundaries_time_dir)
    154 #urs2sww(boundaries_in_dir_name,basename_out= project.boundaries_time_dir_name,
    155 #        minlat=project.south_boundary, maxlat=project.north_boundary,
    156 #        minlon= project.west_boundary, maxlon=project.east_boundary,
    157 #        mint=0, maxt= 35000,
    158 #        verbose='true')
    159        
     154urs2sww(boundaries_in_dir_name,basename_out= project.boundaries_time_dir_name,
     155        minlat=project.south_boundary, maxlat=project.north_boundary,
     156        minlon= project.west_boundary, maxlon=project.east_boundary,
     157        mint=0, maxt= 35000,
     158        verbose='true')
     159'''
     160from caching import cache
    160161cache(urs2sww,
    161162      (boundaries_in_dir_name,
    162        basename_out= project.boundaries_time_dir_name),
     163       project.boundaries_time_dir_name),
    163164      {'verbose': True,
    164165       'minlat': project.south_boundary,
     
    167168       'maxlon': project.east_boundary,
    168169       'mint': 0, 'maxt': 35000,
    169        'origin': domain.geo_reference.get_origin(),
     170#       'origin': domain.geo_reference.get_origin(),
    170171       'mean_stage': project.tide,
    171172#       'zscale': 1,                 #Enhance tsunami
    172        'fail_on_NaN': False,
    173        'inverted_bathymetry': True},
     173       'fail_on_NaN': False},
    174174       verbose = True,
    175175       )
    176176#       dependencies = source_dir + project.boundary_basename + '.sww')
    177        
     177'''       
    178178
    179179
  • anuga_work/production/dampier_2006/project.py

    r3871 r3877  
    3636#mesh_name = 'elevation50m'
    3737boundaries_name = 'dampier'
    38 boundaries_source = 'test'
    39 
    40 tide = 0.0
     38boundaries_source = 'mag_9_corrected'
     39
     40tide = 2.4
    4141
    4242# topography file names
     
    133133
    134134#only used to clip boundary condition
    135 north_boundary = north + 0.04
    136 south_boundary = south - 0.04
    137 west_boundary = west - 0.04
    138 east_boundary = east + 0.04
     135north_boundary = north + 0.02
     136south_boundary = south - 0.02
     137west_boundary = west - 0.02
     138east_boundary = east + 0.02
    139139
    140140
  • anuga_work/production/dampier_2006/run_dampier.py

    r3871 r3877  
    3434from anuga.geospatial_data.geospatial_data import *
    3535from anuga.abstract_2d_finite_volumes.util import Screen_Catcher
     36from anuga_parallel.parallel_api import distribute, numprocs, myid
    3637
    3738# Application specific imports
     
    5354boundaries_time_dir_name = project.boundaries_dir + build_time + sep + boundaries_name
    5455
    55 #from anuga.shallow_water.data_manager import urs2sww
    56 
    57 # creates copy of code in output dir if dir doesn't exist
    58 if access(project.output_run_time_dir,F_OK) == 0:
    59     print 'project.output_run_time_dir',dirname(project.output_run_time_dir)
    60     mkdir (project.output_run_time_dir,0777)
    61 copy (dirname(project.__file__) +sep+ project.__name__+'.py',
    62       project.output_run_time_dir + project.__name__+'.py')
    63 copy (__file__, project.output_run_time_dir + basename(__file__))
    64 print 'project.output_run_time_dir',project.output_run_time_dir
    65 
    66 #normal screen output is stored in
    67 screen_output_name = project.output_run_time_dir + "screen_output.txt"
    68 screen_error_name = project.output_run_time_dir + "screen_error.txt"
    69 
    70 #used to catch screen output to file
    71 sys.stdout = Screen_Catcher(screen_output_name)
    72 sys.stderr = Screen_Catcher(screen_error_name)
    73 
    74 print 'USER:    ', project.user
    75 
    76 #--------------------------------------------------------------------------
    77 # Create the triangular mesh based on overall clipping polygon with a
    78 # tagged
    79 # boundary and interior regions defined in project.py along with
    80 # resolutions (maximal area of per triangle) for each polygon
    81 #--------------------------------------------------------------------------
    82 
    83 interior_regions = [#[project.karratha_polygon, 25000],
    84                     #[project.dampier_polygon, 2000],
    85                     #[project.refinery_polygon, 2000],
    86                     #[project.point_polygon, 2000]]
    87                     #[project.cipma_polygon, 20000]]
    88                     [project.cipma_polygon, 50000]]    # Caused memory error?
    89 
    90 #---------------------------
    91 # this is check that no interior polygon is outside the bounding poly
    92 #------------------------------
    93 
    94 """
    95 count = 0
    96 for i in range(len(interior_regions)):
    97     region = interior_regions[i]
    98     interior_polygon = region[0]
    99     if len(inside_polygon(interior_polygon, bounding_polygon,
    100                    closed = True, verbose = False)) <> len(interior_polygon):
    101         print 'WARNING: interior polygon %d is outside bounding polygon' %(i)
    102         count += 1
    103 
    104 if count == 0:
    105     print 'interior regions OK'
    106 else:
    107     print 'check out your interior polygons'
    108     print 'check %s in production directory' %figname
    109     import sys; sys.exit()
    110 """
    111 #-------------------------------------
    112 
    113 print 'start create mesh from regions'
    114 meshes_dir_name = project.meshes_dir_name + '.msh'
    115 create_mesh_from_regions(project.bounding_polygon,
    116                          boundary_tags={'back': [7, 8], 'side': [0, 6],
    117                                         'ocean': [1, 2, 3, 4, 5]},
    118                          maximum_triangle_area=300000,
    119                          interior_regions=interior_regions,
    120                          filename=meshes_dir_name,
    121                          use_cache=True,
    122                          verbose=True)
    12356
    12457#-------------------------------------------------------------------------
     
    12861domain = Domain(meshes_dir_name, use_cache=True, verbose=True)
    12962print domain.statistics()
    130 domain.set_name(project.scenario_name)
    131 domain.set_datadir(project.output_run_time_dir)
    132 domain.set_default_order(2)
    133 domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm
    134 
    13563
    13664
     
    14977
    15078
     79#------------------------------------------------------
     80# Distribute domain to implement parallelism !!!
     81#------------------------------------------------------
     82
     83if numprocs > 1:
     84    domain=distribute(domain)
     85
     86
     87#------------------------------------------------------
     88# Set domain parameters
     89#------------------------------------------------------
     90
     91domain.set_name(project.scenario_name)
     92domain.set_datadir(project.output_run_time_dir)
     93domain.set_default_order(2) #associate to the spatial order of the triangle
     94domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm
     95
     96
    15197#-------------------------------------------------------------------------
    15298# Setup boundary conditions
     
    159105Bf = File_boundary(boundaries_time_dir_name + '.sww',
    160106                   domain, verbose = True)
    161 #Bf = File_boundary(source_dir + project.boundary_scenario_name + '.sww',
    162 #                   domain, verbose = True)
    163107Br = Reflective_boundary(domain)
    164108Bd = Dirichlet_boundary([tide,0,0])
Note: See TracChangeset for help on using the changeset viewer.