Changeset 3829


Ignore:
Timestamp:
Oct 19, 2006, 6:21:11 PM (18 years ago)
Author:
ole
Message:

Retired modify_boundary (now rolled into set_boundary).
Got okushiri_parallel to run correctly and timed the speedup (6.5 on 8 procs)

Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/documentation/user_manual/anuga_user_manual.tex

    r3764 r3829  
    772772    if domain.get_quantity('stage').get_values(interpolation_points=[[10, 2.5]]) > 0:       
    773773        print 'Stage > 0: Changing to outflow boundary'
    774         domain.modify_boundary({'right': Bo})
     774        domain.set_boundary({'right': Bo})
    775775\end{verbatim}}
    776776
     
    781781replaced by the outflow boundary using the method
    782782{\small \begin{verbatim}
    783     domain.modify_boundary({'right': Bo})
     783    domain.set_boundary({'right': Bo})
    784784\end{verbatim}}
    785785This type of dynamically varying boundary could for example be used to model the
  • anuga_core/documentation/user_manual/examples/channel2.py

    r3754 r3829  
    5858           get_values(interpolation_points=[[10, 2.5]]) > 0:       
    5959        print 'Stage > 0: Changing to outflow boundary'
    60         domain.modify_boundary({'right': Bo})
     60        domain.set_boundary({'right': Bo})
    6161
    6262
  • anuga_core/documentation/user_manual/examples/channel3.py

    r3754 r3829  
    8181           get_values(interpolation_points=[[10, 2.5]]) > 0:       
    8282        print 'Stage > 0: Changing to outflow boundary'
    83         domain.modify_boundary({'right': Bo})
     83        domain.set_boundary({'right': Bo})
  • anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py

    r3817 r3829  
    359359        """
    360360
    361         from anuga.abstract_2d_finite_volumes.util import apply_expression_to_dictionary
     361        from anuga.abstract_2d_finite_volumes.util import\
     362             apply_expression_to_dictionary
     363       
    362364        return apply_expression_to_dictionary(expression, self.quantities)
    363365
    364366
    365367
    366     def modify_boundary(self, boundary_map):
    367         """Modify existing boundary by elements in boundary map
    368 
    369         Input:
    370 
    371         boundary_map: Dictionary mapping tags to boundary objects
    372 
    373         See set_boundary for more details on how this works
    374         """
    375 
    376         for key in boundary_map.keys():
    377             self.boundary_map[key] = boundary_map[key]
    378 
    379         self.set_boundary(self.boundary_map)
     368    #def modify_boundary(self, boundary_map):
     369    #    """Modify existing boundary by elements in boundary map#
     370    #
     371    #    Input:#
     372    #
     373    #    boundary_map: Dictionary mapping tags to boundary objects
     374    #
     375    #    See set_boundary for more details on how this works
     376    #
     377    #      OBSOLETE
     378    #    """
     379    #
     380    #    for key in boundary_map.keys():
     381    #        self.boundary_map[key] = boundary_map[key]
     382    #
     383    #    self.set_boundary(self.boundary_map)
    380384       
    381385       
     
    421425        Boundary objects that are None will be skipped.
    422426
     427        If a boundary_map has already been set
     428        (i.e. set_boundary has been called before), the old boundary map
     429        will be updated with new values. The new map need not define all
     430        boundary tags, and can thus change only those that are needed.
     431
    423432        FIXME: If set_boundary is called multiple times and if Boundary
    424433        object is changed into None, the neighbour structure will not be
     
    428437        """
    429438
    430         self.boundary_objects = []
    431         self.boundary_map = boundary_map  #Store for use with eg. boundary_stats.
    432 
     439        if self.boundary_map is None:
     440            # This the first call to set_boundary. Store
     441            # map for later updates and for use with boundary_stats.
     442            self.boundary_map = boundary_map
     443        else:   
     444            # This is a modification of an already existing map
     445            # Update map an proceed normally
     446
     447            for key in boundary_map.keys():
     448                self.boundary_map[key] = boundary_map[key]
     449               
     450       
    433451        #FIXME: Try to remove the sorting and fix test_mesh.py
    434452        x = self.boundary.keys()
     
    437455        #Loop through edges that lie on the boundary and associate them with
    438456        #callable boundary objects depending on their tags
     457        self.boundary_objects = []       
    439458        for k, (vol_id, edge_id) in enumerate(x):
    440459            tag = self.boundary[ (vol_id, edge_id) ]
    441460
    442             if boundary_map.has_key(tag):
    443                 B = boundary_map[tag]  #Get callable boundary object
     461            if self.boundary_map.has_key(tag):
     462                B = self.boundary_map[tag]  #Get callable boundary object
    444463
    445464                if B is not None:
    446465                    self.boundary_objects.append( ((vol_id, edge_id), B) )
    447                     self.neighbours[vol_id, edge_id] = -len(self.boundary_objects)
     466                    self.neighbours[vol_id, edge_id] = \
     467                                            -len(self.boundary_objects)
    448468                else:
    449469                    pass
  • anuga_core/source/anuga/examples/beach_parallel.py

    r3773 r3829  
    131131
    132132Bt = Time_boundary(domain, lambda t: [ 4.0*(1+sin(2*pi*t/50)), -1.0, 0.0])
    133 domain.modify_boundary({'ocean': Bt})
     133domain.set_boundary({'ocean': Bt})
    134134
    135135#----------------------
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r3819 r3829  
    909909        # Update boundary to allow inflow
    910910        #--------------------------------------------------------------
    911         domain.modify_boundary({'right': Bd})
     911        domain.set_boundary({'right': Bd})
    912912
    913913       
  • anuga_core/source/anuga_parallel/test_parallel_sw_runup.py

    r3818 r3829  
    2828from anuga.shallow_water import Transmissive_boundary
    2929
    30 from parallel_api import distribute, myid
     30from parallel_api import distribute, myid, numprocs
    3131
    3232
     
    3636points, vertices, boundary = rectangular_cross(10, 10) # Basic mesh
    3737domain = Domain(points, vertices, boundary) # Create domain
    38 domain.set_name('runup')                    # Set sww filename
    39 domain.set_datadir('.')                     # Set output dir
    40 
    4138
    4239#--------------------------------------------------------------------------
     
    5855domain = distribute(domain, verbose=True)
    5956
     57domain.set_name('runup')                    # Set sww filename
     58domain.set_datadir('.')                     # Set output dir
     59domain.set_maximum_allowed_speed(100)       #
     60
    6061
    6162#------------------------------------------------------------------------------
    62 # Setup boundary conditions (MUST currently happen after domain has been distributed)
     63# Setup boundary conditions
     64# This must currently happen *after* domain has been distributed
    6365#------------------------------------------------------------------------------
    6466
     
    6769
    6870# Associate boundary tags with boundary objects
    69 domain.modify_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br})
     71domain.set_boundary({'left': Br, 'right': Bd, 'top': Br, 'bottom': Br})
     72
    7073
    7174
     
    8588        # Need to get true boundary somehow
    8689       
    87         print 'P%d: point=[%f,%f]' %(myid, point[0], point[1])
     90        #print 'P%d: point=[%f,%f]' %(myid, point[0], point[1])
    8891        local_interpolation_points.append(i)
     92
     93# Hack
     94if numprocs == 2:
     95    if myid == 0:
     96        del local_interpolation_points[0]               
     97        #local_interpolation_points = [1,2,3]
     98
     99if numprocs == 3:
     100    if myid == 1:
     101        del local_interpolation_points[0]
     102
     103
     104if numprocs == 4:
     105    if myid == 0:
     106        del local_interpolation_points[1] #2
     107        del local_interpolation_points[1] #3               
     108    if myid == 3:
     109        del local_interpolation_points[1]
     110
     111
     112
     113print 'P%d has points = %s' %(myid, local_interpolation_points)
    89114
    90115
  • anuga_validation/okushiri_2005/okushiri_parallel.py

    r3785 r3829  
    2929#-------------------------
    3030domain = Domain(project.mesh_filename, use_cache=True, verbose=True)
    31 domain.set_name('okushiri_parallel')
    32 domain.set_minimum_storable_height(0.001)
    33 domain.set_default_order(2)
    34 print domain.statistics()
    35 
    3631
    3732#-------------------------
     
    4641                    use_cache = True)
    4742
    48 #-------------------------
    49 # Boundary Conditions
    50 #-------------------------
    51 Br = Reflective_boundary(domain)
    52 
    53 domain.set_boundary({'wave': None,  # Bind this one later
    54                      'wall': Br})
    55 
    5643
    5744#-------------------------
     
    6047domain = distribute(domain)
    6148
     49# Parameters
     50domain.set_name('okushiri_parallel')
     51domain.set_minimum_storable_height(0.001)
     52domain.set_default_order(2)
     53domain.set_maximum_allowed_speed(0.1) # Allow a little runoff (0.1 is OK)
    6254
    63 # Bind boundary, that cannot be fully specified before distribution.
     55# Set old (pre Sep 2006) defaults for limiters
     56domain.beta_w      = 0.9
     57domain.beta_w_dry  = 0.9
     58domain.beta_uh     = 0.9
     59domain.beta_uh_dry = 0.9
     60domain.beta_vh     = 0.9
     61domain.beta_vh_dry = 0.9
     62
     63
     64#------------------------------------------------------------------------------
     65# Setup boundary conditions
     66# (MUST currently happen after domain has been distributed)
     67#------------------------------------------------------------------------------
     68
     69Br = Reflective_boundary(domain)      # Solid reflective wall
     70
    6471function = file_function(project.boundary_filename[:-4] + '.tms',
    6572                         domain,
     
    6774
    6875Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function)
    69 domain.modify_boundary({'wave': Bts})
     76
     77domain.set_boundary({'wave': Bts,  # Bind this one later
     78                     'wall': Br})
    7079
    7180
  • anuga_work/production/dampier_2006/run_dampier_parallel.py

    r3802 r3829  
    174174Bf = File_boundary(source_dir + project.boundary_basename + '.sww',
    175175                   domain, verbose = True)
    176 domain.modify_boundary({'ocean': Bf})
     176domain.set_boundary({'ocean': Bf})
    177177
    178178
  • anuga_work/production/wollongong_2006/run_flagstaff_parallel_api.py

    r3631 r3829  
    105105                  f=lambda t: [project.initial_sealevel + (60<t<480)*6, 0, 0])
    106106
    107 domain.modify_boundary({'ocean': W})
     107domain.set_boundary({'ocean': W})
    108108
    109109
Note: See TracChangeset for help on using the changeset viewer.