Changeset 3713


Ignore:
Timestamp:
Oct 9, 2006, 3:38:36 PM (18 years ago)
Author:
ole
Message:

Cleaned up Karratha and moved parallelism away for the time being

Location:
anuga_work/production/karratha_2006
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • anuga_work/production/karratha_2006/run_karratha.py

    r3635 r3713  
    1010Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006
    1111"""
     12
    1213#------------------------------------------------------------------------------
    1314# Import necessary modules
     
    3637import project                 # Definition of file names and polygons
    3738
    38 from anuga_parallel.parallel_api import distribute, myid, numprocs
     39
    3940
    4041#------------------------------------------------------------------------------
     
    4748source_dir = project.boundarydir
    4849
    49 if myid == 0:
    50     # creates copy of code in output dir if dir doesn't exist
    51     if access(project.outputtimedir,F_OK) == 0:
    52         mkdir (project.outputtimedir)
    53     copy (dirname(project.__file__) +sep+ project.__name__+'.py',
    54           project.outputtimedir + project.__name__+'.py')
    55     copy (__file__, project.outputtimedir + basename(__file__))
    56     print 'project.outputtimedir',project.outputtimedir
    5750
     51# creates copy of code in output dir if dir doesn't exist
     52if access(project.outputtimedir,F_OK) == 0:
     53    mkdir (project.outputtimedir)
     54copy (dirname(project.__file__) +sep+ project.__name__+'.py',
     55      project.outputtimedir + project.__name__+'.py')
     56copy (__file__, project.outputtimedir + basename(__file__))
     57print 'project.outputtimedir',project.outputtimedir
    5858
    59     #--------------------------------------------------------------------------
    60     # Create the triangular mesh based on overall clipping polygon with a
    61     # tagged
    62     # boundary and interior regions defined in project.py along with
    63     # resolutions (maximal area of per triangle) for each polygon
    64     #--------------------------------------------------------------------------
    65 
    66 
    67     print 'start create mesh from regions'
    68     from caching import cache
    69     meshname = project.meshname + '_%d.msh' %myid
    70     _ = cache(create_mesh_from_regions,
    71               project.bounding_polygon,
    72               {'boundary_tags': {'back': [7, 8], 'side': [0, 6],
    73                                  'ocean': [1, 2, 3, 4, 5]},
    74                'maximum_triangle_area': 200000,
    75                'filename': meshname},
    76               verbose = True,
    77               evaluate = False)
    78 
    79     #-------------------------------------------------------------------------
    80     # Setup computational domain
    81     #-------------------------------------------------------------------------
    82     domain = Domain(meshname, use_cache = True, verbose = True)
    83     print domain.statistics()
    84     domain.set_name(project.basename)
    85     domain.set_datadir(project.outputtimedir)
    86 
    87 
    88     #-------------------------------------------------------------------------
    89     # Setup initial conditions
    90     #-------------------------------------------------------------------------
    91     tide = 0.
    92     domain.set_quantity('stage', tide)
    93     domain.set_quantity('friction', 0.0)
    94     domain.set_quantity('elevation',
    95                         filename = project.datadir + project.basename + '.pts',
    96                         use_cache = False,
    97                         verbose = True,
    98                         alpha = 0.1)
    99    
    100     #-------------------------------------------------------------------------
    101     # Setup boundary conditions
    102     #-------------------------------------------------------------------------
    103 
    104     print 'Available boundary tags', domain.get_boundary_tags()
    105     #Bf = File_boundary(source_dir + project.boundary_basename + '.sww',
    106     #                   domain, verbose = True)
    107     Br = Reflective_boundary(domain)
    108     Bd = Dirichlet_boundary([tide,0,0])
    109     domain.set_boundary({'back': Br,
    110                          'side': Bd,
    111                          'ocean': None}) # Bind this one later
    112 else:
    113     domain = None
    11459
    11560
    11661#--------------------------------------------------------------------------
    117 # Create the parallel domain
     62# Create the triangular mesh based on overall clipping polygon with a
     63# tagged
     64# boundary and interior regions defined in project.py along with
     65# resolutions (maximal area of per triangle) for each polygon
    11866#--------------------------------------------------------------------------
    119 if numprocs > 1:
    120     domain = distribute(domain, verbose=True)
    12167
    122 # Set those boundaries that can't be communicated automatically
    123 # FIXME: There is a problem with the parallel domain.
    124 # It seems that boundaries are outside coverage.
    125 #
    126 # We get
    127 #
    128 #------------------------------------------------
    129 #Interpolation_function (spatio-temporal) statistics:
    130 #  Extent:
    131 #    x in [-60494.651593, 149593.652382], len(x) == 56
    132 #    y in [-74198.017534, 184623.446077], len(y) == 56
    133 #    t in [0.000000, 28610.000000], len(t) == 145
    134 #  Quantities:
    135 #    stage in [-1.797799, 1.644574]
    136 #    xmomentum in [-33.219473, 21.571094]
    137 #    ymomentum in [-32.775090, 73.761256]
    138 #  Interpolation points (xi, eta): number of points == 411
    139 #    xi in [-420467.297166, -368252.119852]
    140 #    eta in [-7652664.149808, -7605199.504709]
    141 #  Interpolated quantities (over all timesteps):
    142 #    stage at interpolation points in [inf, inf]
    143 #    xmomentum at interpolation points in [inf, inf]
    144 #    ymomentum at interpolation points in [inf, inf]
    145 #------------------------------------------------
    146 #
    147 #Instead of
    148 #
    149 #------------------------------------------------
    150 #Interpolation_function (spatio-temporal) statistics:
    151 #  Extent:
    152 #    x in [-60494.651593, 149593.652382], len(x) == 56
    153 #    y in [-74198.017534, 184623.446077], len(y) == 56
    154 #    t in [0.000000, 28610.000000], len(t) == 145
    155 #  Quantities:
    156 #    stage in [-1.797799, 1.644574]
    157 #    xmomentum in [-33.219473, 21.571094]
    158 #    ymomentum in [-32.775090, 73.761256]
    159 #  Interpolation points (xi, eta): number of points == 503
    160 #    xi in [4747.280215, 96909.729282]
    161 #    eta in [9240.613414, 83183.465791]
    162 #  Interpolated quantities (over all timesteps):
    163 #    stage at interpolation points in [-0.909515, 1.331521]
    164 #    xmomentum at interpolation points in [-17.054914, 17.110528]
    165 #    ymomentum at interpolation points in [-24.691402, 16.625063]
    166 #------------------------------------------------
    16768
     69print 'start create mesh from regions'
     70from caching import cache
     71meshname = project.meshname + '.msh'
     72_ = cache(create_mesh_from_regions,
     73          project.bounding_polygon,
     74          {'boundary_tags': {'back': [7, 8], 'side': [0, 6],
     75                             'ocean': [1, 2, 3, 4, 5]},
     76           'maximum_triangle_area': 200000,
     77           'filename': meshname},
     78          verbose = True,
     79          evaluate = False)
     80
     81
     82#-------------------------------------------------------------------------
     83# Setup computational domain
     84#-------------------------------------------------------------------------
     85domain = Domain(meshname, use_cache = True, verbose = True)
     86print domain.statistics()
     87domain.set_name(project.basename)
     88domain.set_datadir(project.outputtimedir)
     89
     90
     91#-------------------------------------------------------------------------
     92# Setup initial conditions
     93#-------------------------------------------------------------------------
     94tide = 0.
     95domain.set_quantity('stage', tide)
     96domain.set_quantity('friction', 0.0)
     97domain.set_quantity('elevation',
     98                    filename = project.datadir + project.basename + '.pts',
     99                    use_cache = False,
     100                    verbose = True,
     101                    alpha = 0.1)
     102
     103#-------------------------------------------------------------------------
     104# Setup boundary conditions
     105#-------------------------------------------------------------------------
     106
     107print 'Available boundary tags', domain.get_boundary_tags()
    168108
    169109Bf = File_boundary(source_dir + project.boundary_basename + '.sww',
    170110                   domain, verbose = True)
    171 domain.modify_boundary({'ocean': Bf})
     111Br = Reflective_boundary(domain)
     112Bd = Dirichlet_boundary([tide,0,0])
     113domain.set_boundary({'back': Br,
     114                     'side': Bd,
     115                     'ocean': Bf})
    172116
    173117
Note: See TracChangeset for help on using the changeset viewer.