Changeset 3588


Ignore:
Timestamp:
Sep 14, 2006, 9:47:59 AM (18 years ago)
Author:
ole
Message:

Work on simple parallel test

Location:
anuga_core/source/anuga_parallel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga_parallel/parallel_api.py

    r3586 r3588  
    5050              extract_hostmesh(submesh, triangles_per_proc)
    5151
    52     # Return stuff
     52    # Return structures necessary for building the parallel domain
    5353    return points, vertices, boundary, quantities, \
    5454           ghost_recv_dict, full_send_dict
  • anuga_core/source/anuga_parallel/test_parallel_sw_runup.py

    r3587 r3588  
    1919from anuga.shallow_water import Transmissive_boundary
    2020
     21from parallel_api import *
     22
    2123
    2224#------------------------------------------------------------------------------
    23 # Setup computational domain
     25# Initialise
    2426#------------------------------------------------------------------------------
    2527
    26 points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh
     28if myid == 0:
     29    #--------------------------------------------------------------------------
     30    # Setup computational domain
     31    #--------------------------------------------------------------------------
    2732
    28 domain = Domain(points, vertices, boundary) # Create domain
    29 domain.set_name('runup')                    # Output to bedslope.sww
     33    points, vertices, boundary = rectangular_cross(20, 20) # Basic mesh
     34
     35    domain = Domain(points, vertices, boundary) # Create domain
     36    domain.set_name('runup')                    # Set sww filename
     37   
     38
     39    #------------ -------------------------------------------------------------
     40    # Setup initial conditions
     41    #--------------------------------------------------------------------------
     42
     43    def topography(x,y):
     44        return -x/2                              # linear bed slope
     45
     46    domain.set_quantity('elevation', topography) # Use function for elevation
     47    domain.set_quantity('friction', 0.1)         # Constant friction
     48    domain.set_quantity('stage', -.4)            # Constant initial stage
     49
     50
     51    #--------------------------------------------------------------------------
     52    # Setup boundary conditions
     53    #--------------------------------------------------------------------------
     54
     55    Br = Reflective_boundary(domain)      # Solid reflective wall
     56    Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values
     57
     58    # Associate boundary tags with boundary objects
     59    domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br})
     60
     61
     62#------------------------------------------------------------------------------
     63# Parallel stuff
     64#------------------------------------------------------------------------------
     65
     66if myid == 0:
     67    # Distribute the domain
     68    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict,\
     69            = distribute_mesh(domain)
     70    print 'Communication done'       
     71   
     72else:
     73    # Read in the mesh partition that belongs to this
     74    # processor (note that the information is in the
     75    # correct form for the GA data structure)
     76
     77    points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict, \
     78            = rec_submesh(0)
     79
     80
     81
     82#------------------------------------------------------------------------------
     83# Start the computations on each subpartion
     84#------------------------------------------------------------------------------
     85
     86# Build the domain for this processor
     87domain = Parallel_Domain(points, vertices, boundary,
     88                         full_send_dict  = full_send_dict,
     89                         ghost_recv_dict = ghost_recv_dict)
     90
     91
     92# Name and dir, etc currently has to be set here as they are not
     93# transferred from the original domain
     94domain.set_name('runup')                    # Set sww filename
    3095
    3196
     
    3398# Setup initial conditions
    3499#------------------------------------------------------------------------------
    35 
    36 def topography(x,y):
    37     return -x/2                             # linear bed slope
    38     #return x*(-(2.0-x)*.5)                  # curved bed slope
    39 
    40 domain.set_quantity('elevation', topography) # Use function for elevation
    41 domain.set_quantity('friction', 0.1)         # Constant friction
    42 domain.set_quantity('stage', -.4)            # Constant negative initial stage
     100for q in quantities:
     101    domain.set_quantity(q, quantities[q]) # Distribute all quantities   
    43102
    44103
    45104#------------------------------------------------------------------------------
    46 # Setup boundary conditions
     105# Setup parallel boundary conditions
    47106#------------------------------------------------------------------------------
    48107
    49 from math import sin, pi, exp
    50108Br = Reflective_boundary(domain)      # Solid reflective wall
    51 Bt = Transmissive_boundary(domain)    # Continue all values on boundary
    52109Bd = Dirichlet_boundary([-0.2,0.,0.]) # Constant boundary values
    53 Bw = Time_boundary(domain=domain,     # Time dependent boundary 
    54                    f=lambda t: [(.1*sin(t*2*pi)-0.3) * exp(-2*t), 0.0, 0.0])
    55110
    56111# Associate boundary tags with boundary objects
    57 domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br})
     112domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br,
     113                     'ghost': None, 'exterior': Bd})
     114
    58115
    59116
Note: See TracChangeset for help on using the changeset viewer.