Changeset 4885


Ignore:
Timestamp:
Dec 12, 2007, 3:53:24 PM (17 years ago)
Author:
ole
Message:

Work on Shark Bay embayment

Location:
anuga_work/production/shark_bay_2007
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/shark_bay_2007/project.py

    r4884 r4885  
    1313from anuga.utilities.system_tools import get_user_name, get_host_name
    1414
    15 codename = 'project.py' # FIXME can be obtained automatically as __file__
     15#codename = 'project.py' # FIXME can be obtained automatically as __file__
    1616
    1717home = join(getenv('INUNDATIONHOME'), 'data') # Location of Data   
    1818user = get_user_name()
    1919host = get_host_name()
     20
    2021#needed when running using mpirun, mpirun doesn't inherit umask from .bashrc
    2122umask(002)
     
    3738# For frequency response study
    3839amplitude = 0.5
    39 period = 3000
     40period = 1800
    4041
    4142#momentum_scale=50 # Experiment
     
    4445#Maybe will try to make project a class to allow these parameters to be passed in.
    4546alpha = 0.1
    46 friction=0.01
    47 finaltime=40000
    48 starttime=8000 # Action starts around 9000
     47friction = 0.01
     48finaltime = 40000
     49starttime = 8000 # Action starts around 9000
    4950setup='final'
    5051#setup='trial'
  • anuga_work/production/shark_bay_2007/run_shark_bay_embayment_study.py

    r4884 r4885  
    5252
    5353
    54 def run_model(**kwargs):
    5554   
    56     alpha = kwargs['alpha']
    57     friction = kwargs['friction']
    58     time_thinning = kwargs['time_thinning']
    59     scenario_name = kwargs['aa_scenario_name']
    6055   
    61     #-----------------------------------------------------------------
    62     # Copy scripts to time stamped output directory and capture screen
    63     # output to file
    64     #-----------------------------------------------------------------
     56#-----------------------------------------------------------------
     57# Copy scripts to time stamped output directory and capture screen
     58# output to file
     59#-----------------------------------------------------------------
    6560
    66     #copy_code_files(project.output_run_time_dir,
    67     #                __file__,
    68     #                dirname(project.__file__)+sep+project.__name__+'.py' )
     61copy_code_files(project.output_run_time_dir,
     62                __file__,
     63                dirname(project.__file__)+sep+project.__name__+'.py' )
    6964
    7065
    71     #start_screen_catcher(project.output_run_time_dir)
     66start_screen_catcher(project.output_run_time_dir)
    7267
    7368
    74     #--------------------------------------------------------------------------
    75     # Create the triangular mesh based on overall clipping polygon with a
    76     # tagged
    77     # boundary and interior regions defined in project.py along with
    78     # resolutions (maximal area of per triangle) for each polygon
    79     #--------------------------------------------------------------------------
     69#--------------------------------------------------------------------------
     70# Create the triangular mesh based on overall clipping polygon with a
     71# tagged
     72# boundary and interior regions defined in project.py along with
     73# resolutions (maximal area of per triangle) for each polygon
     74#--------------------------------------------------------------------------
    8075
    81     print 'Create mesh from regions'
    82     create_mesh_from_regions(project.small_bounding_polygon,
    83                              boundary_tags=project.boundary_tags_small,
    84                              maximum_triangle_area=project.res_bounding_polygon,
    85                              interior_regions=project.interior_regions,
    86                              filename=project.mesh_name+'.msh',
    87                              fail_if_polygons_outside=False,
    88                              use_cache=False,
    89                              verbose=True)
     76print 'Create mesh from regions'
     77create_mesh_from_regions(project.small_bounding_polygon,
     78                         boundary_tags=project.boundary_tags_small,
     79                         maximum_triangle_area=project.res_bounding_polygon,
     80                         interior_regions=project.interior_regions,
     81                         filename=project.mesh_name+'.msh',
     82                         fail_if_polygons_outside=False,
     83                         use_cache=False,
     84                         verbose=True)
    9085
    91     #-------------------------------------------------------------------------
    92     # Setup computational domain
    93     #-------------------------------------------------------------------------
    94     print 'Setup computational domain'
    95     domain = Domain(project.mesh_name+'.msh',
    96                     use_cache=False, verbose=True)
    97        
    98     print domain.statistics()
     86#-------------------------------------------------------------------------
     87# Setup computational domain
     88#-------------------------------------------------------------------------
     89print 'Setup computational domain'
     90domain = Domain(project.mesh_name+'.msh',
     91                use_cache=False, verbose=True)
     92
     93print domain.statistics()
    9994   
    10095
    101     #-------------------------------------------------------------------------
    102     # Setup initial conditions
    103     #-------------------------------------------------------------------------
     96#-------------------------------------------------------------------------
     97# Setup initial conditions
     98#-------------------------------------------------------------------------
    10499
    105     print 'Set initial conditions'
    106     domain.set_quantity('stage', project.tide)
    107     domain.set_quantity('friction', friction)
    108     domain.set_quantity('elevation',
    109                         filename = project.combined_dir_name + '.pts',
    110                         use_cache = True,
    111                         verbose = True,
    112                         alpha = project.alpha)
     100print 'Set initial conditions'
     101domain.set_quantity('stage', project.tide)
     102domain.set_quantity('friction', project.friction)
     103domain.set_quantity('elevation',
     104                    filename = project.combined_dir_name + '.pts',
     105                    use_cache = True,
     106                    verbose = True,
     107                    alpha = project.alpha)
    113108       
    114109
    115     #------------------------------------------------------
    116     # Set domain parameters
    117     #------------------------------------------------------
    118     domain.set_name(scenario_name)
    119     domain.set_datadir(project.output_run_time_dir)
    120     domain.set_default_order(2)              # Apply second order scheme
    121     domain.set_minimum_storable_height(0.01) # Don't store anything < 1cm
    122     domain.set_store_vertices_uniquely(False)
    123     domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
     110#------------------------------------------------------
     111# Set domain parameters
     112#------------------------------------------------------
     113domain.set_name(project.scenario_name)
     114domain.set_datadir(project.output_run_time_dir)
     115domain.set_default_order(2)              # Apply second order scheme
     116domain.set_minimum_storable_height(0.01) # Don't store anything < 1cm
     117domain.set_store_vertices_uniquely(False)
     118domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
    124119
    125     domain.beta_h = 0
    126     domain.tight_slope_limiters = 1
     120domain.beta_h = 0
     121domain.tight_slope_limiters = 1
    127122   
    128123
    129     #-------------------------------------------------------------------------
    130     # Setup boundary conditions
    131     #-------------------------------------------------------------------------
    132     print 'Available boundary tags', domain.get_boundary_tags()
    133     print 'domain id', id(domain)
     124#-------------------------------------------------------------------------
     125# Setup boundary conditions
     126#-------------------------------------------------------------------------
     127print 'Available boundary tags', domain.get_boundary_tags()
     128print 'domain id', id(domain)
    134129
    135     def waveform(t):
    136         delay = 900
    137         A = project.amplitude
    138         T = project.period
    139         if t < delay:
    140             # Let things settle
    141             return project.tide
    142         else:
    143             return project.tide + A*sin(2*pi*(t-delay)/T)
     130def waveform(t):
     131    delay = 900
     132    A = project.amplitude
     133    T = project.period
     134    if t < delay:
     135        # Let things settle
     136        return project.tide
     137    else:
     138        return project.tide + A*sin(2*pi*(t-delay)/T)
    144139
    145     Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
    146     Br = Reflective_boundary(domain)
    147     Bd = Dirichlet_boundary([project.tide,0,0])
     140Bf = Transmissive_Momentum_Set_Stage_boundary(domain, waveform)
     141Br = Reflective_boundary(domain)
     142Bd = Dirichlet_boundary([project.tide,0,0])
    148143
    149144
    150     print 'Set boundary'
    151     domain.set_boundary({'tide': Bd,
    152                          'ocean': Bf})
     145print 'Set boundary'
     146domain.set_boundary({'tide': Bd,
     147                     'ocean': Bf})
    153148
    154149
    155     #------------------------------
    156     # Evolve system through time
    157     #------------------------------
    158     t0 = time.time()
    159     for t in domain.evolve(yieldstep = 5,
    160                            finaltime = 10000):
    161         domain.write_time()
    162         domain.write_boundary_statistics(tags = 'ocean')     
     150#------------------------------
     151# Evolve system through time
     152#------------------------------
     153t0 = time.time()
     154for t in domain.evolve(yieldstep = 5,
     155                       finaltime = 10000):
     156    domain.write_time()
     157    domain.write_boundary_statistics(tags='ocean')     
    163158
    164159
    165     #------------------------------
    166     # Post processing
    167     #------------------------------
    168     x, y = domain.get_maximum_inundation_location()
    169     q = domain.get_maximum_inundation_elevation()
     160#------------------------------
     161# Post processing
     162#------------------------------
     163x, y = domain.get_maximum_inundation_location()
     164q = domain.get_maximum_inundation_elevation()
    170165
    171     print 'Maximum runup observed at (%.2f, %.2f) with elevation %.2f' %(x,y,q)
     166print 'Maximum runup observed at (%.2f, %.2f) with elevation %.2f' %(x,y,q)
    172167
    173     print 'That took %.2f seconds' %(time.time()-t0)
     168print 'That took %.2f seconds' %(time.time()-t0)
    174169   
    175170
    176 #-------------------------------------------------------------
    177 if __name__ == "__main__":
    178171
    179     run_model(file_name=project.home+'detail.csv',
    180               aa_scenario_name=project.scenario_name,
    181               ab_time=project.time,
    182               res_factor= project.res_factor,
    183               tide=project.tide,
    184               user=project.user,
    185               alpha = project.alpha,
    186               friction=project.friction,
    187               time_thinning = project.time_thinning,
    188               dir_comment=project.dir_comment)
    189 
    190 
Note: See TracChangeset for help on using the changeset viewer.