Changeset 5763


Ignore:
Timestamp:
Sep 15, 2008, 2:04:22 PM (16 years ago)
Author:
steve
Message:

Fixed a few bugs in the parallel shallow water code. Seems to
be working for low level code. Need to check Ole' parallel api

Location:
anuga_core/source/anuga_parallel
Files:
4 edited

Legend:

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

    r5242 r5763  
    7979        # hence we need to create some dummy arrays for communication
    8080        ltimestep = ones( 1, Float )
    81         ltimestep[0] = self.timestep
     81        ltimestep[0] = self.flux_timestep
    8282        gtimestep = zeros( 1, Float) # Buffer for results
    8383       
     
    8585        pypar.broadcast(gtimestep,0)
    8686
    87         self.timestep = gtimestep[0]
     87        self.flux_timestep = gtimestep[0]
    8888       
    8989        self.communication_reduce_time += time.time()-t0
  • anuga_core/source/anuga_parallel/parallel_shallow_water.py

    r4884 r5763  
    118118        for pid in range(self.numproc):
    119119            #print 'P%d calling broadcast from %d' %(self.processor, pid)
    120             self.local_timestep[0] = self.timestep
     120            self.local_timestep[0] = self.flux_timestep
    121121            pypar.broadcast(self.local_timestep, pid, bypass=True)
    122122            self.local_timesteps[pid] = self.local_timestep[0]
    123123
    124         self.timestep = min(self.local_timesteps)
     124        self.flux_timestep = min(self.local_timesteps)
     125
     126        #print 'Flux Timestep %d P%d_%d' %(self.flux_timestep, self.processor, self.numproc)
    125127
    126128        pypar.barrier()
     
    147149        import time
    148150        #Compute minimal timestep across all processes
    149         self.local_timestep[0] = self.timestep
     151        self.local_timestep[0] = self.flux_timestep
    150152        use_reduce_broadcast = True
    151153        if use_reduce_broadcast:
     
    158160            #Alternative: Try using straight send and receives
    159161            t0 = time.time()
    160             self.global_timestep[0] = self.timestep
     162            self.global_timestep[0] = self.flux_timestep
    161163
    162164            if self.processor == 0:
     
    183185        self.communication_broadcast_time += time.time()-t0
    184186
    185 
    186         self.timestep = self.global_timestep[0]
     187        #old_timestep = self.flux_timestep
     188        self.flux_timestep = self.global_timestep[0]
     189        #print 'Flux Timestep %15.5e %15.5e P%d_%d' %(self.flux_timestep, old_timestep, self.processor, self.numproc)
    187190       
    188191        # LINDA:
  • anuga_core/source/anuga_parallel/run_parallel_advection.py

    r5762 r5763  
    5050processor_name = pypar.Get_processor_name()
    5151
    52 N = 80
    53 M = 80
     52N = 100
     53M = 100
    5454
    5555#######################
     
    7676                         full_send_dict, ghost_recv_dict, velocity=[1.0, 0.0])
    7777
    78 # Turn on the visualisation
     78# Boundaries
     79
     80T = Transmissive_boundary(domain)
    7981
    8082
    8183
    8284
    83 # rect = [0.0, 0.0, 1.0, 1.0]
    84 # domain.initialise_visualiser(rect=rect)
    85 
    86 # Boundaries
    87 
    88 T = Transmissive_boundary(domain)
    89 domain.default_order = 2
    9085domain.set_boundary( {'left': T, 'right': T, 'bottom': T, 'top': T, \
    9186                      'ghost': None} )
     87
     88
     89# Set Evolve parameters
     90domain.set_default_order(2)
     91domain.set_timestepping_method('rk2')
     92
     93print domain.get_timestepping_method()
     94
     95#domain.use_edge_limiter = True
     96#domain.tight_slope_limiters = True
     97#domain.use_centroid_velocities = False
     98
     99domain.CFL = 1.0
     100
     101domain.set_beta(0.8)
     102
    92103
    93104# Ensure that the domain definitions make sense
     
    105116    from anuga.visualiser import RealtimeVisualiser
    106117    vis = RealtimeVisualiser(domain)
    107     vis.render_quantity_height("elevation", offset=0.01, dynamic=False)
     118    #vis.render_quantity_height("elevation", offset=0.01, dynamic=False)
    108119    vis.render_quantity_height("stage", dynamic=True)
    109120    vis.colour_height_quantity('stage', (0.2, 0.2, 0.8))
     
    140151       
    141152 
    142 vis.join()     
     153if visualise: vis.join()
  • anuga_core/source/anuga_parallel/run_parallel_sw_rectangle.py

    r3876 r5763  
    3030from parallel_meshes import parallel_rectangle
    3131
    32 
     32###############################
     33# Read in processor information
     34###############################
    3335numprocs = pypar.size()
    3436myid = pypar.rank()
     
    3840N = M*numprocs
    3941
     42
    4043if myid == 0:
    4144    print 'N == %d' %N
     
    4447        parallel_rectangle(N, M, len1_g=1.0*numprocs, len2_g = 1.0)
    4548
     49print "Myid = ", myid, "no points = ", len(points), \
     50      "no vertices = ", len(vertices), "no boundaries = ", len(boundary)
    4651
     52###########################################
     53# Start the computations on each subpartion
     54###########################################
    4755
    4856domain = Parallel_Domain(points, vertices, boundary,
    4957                         full_send_dict  = full_send_dict,
    5058                         ghost_recv_dict = ghost_recv_dict)
    51 
    52 # Make a notes of which triangles are full and which are ghost
    53 
    54 tri_full_flag = build_full_flag(domain, ghost_recv_dict)
    55 
    56 print 'number of triangles = ', domain.number_of_elements
    57 
    58 
    59 rect = [ 0.0, 0.0, 1.0*numprocs, 1.0]
    60 ## try:
    61 ##     domain.initialise_visualiser(rect=rect)
    62 ##     domain.visualiser.qcolor['stage'] = (0.0, 0.0, 0.8)
    63 ##     domain.visualiser.scale_z['stage'] = 1.0
    64 ##     domain.visualiser.scale_z['elevation'] = 0.05
    65 ## except:
    66 ##     print 'No visualiser'
    67 
    68 
    69 
    70 
    71 
    7259
    7360
     
    8067
    8168domain.set_boundary( {'left': R, 'right': R, 'bottom': R, 'top': R, 'ghost': None} )
     69
     70
     71
     72
    8273domain.check_integrity()
    8374
     
    9990domain.set_quantity('stage', Set_Stage(0.2, 0.4, 0.25, 0.75, 1.0, 0.00))
    10091
     92
     93# Set Evolve parameters
     94domain.set_default_order(2)
     95domain.set_timestepping_method('rk2')
     96
     97print domain.get_timestepping_method()
     98
     99#domain.use_edge_limiter = True
     100#domain.tight_slope_limiters = True
     101#domain.use_centroid_velocities = False
     102
     103domain.CFL = 1.0
     104
     105domain.set_beta(0.8)
     106
     107
     108
    101109if myid == 0:
    102110    import time
     
    105113
    106114# Turn on the visualisation
     115visualise = True
     116if visualise:
     117    from anuga.visualiser import RealtimeVisualiser
     118    vis = RealtimeVisualiser(domain)
     119    vis.render_quantity_height("elevation", offset=0.001, dynamic=False)
     120    vis.render_quantity_height("stage", dynamic=True)
     121    vis.colour_height_quantity('stage', (0.2, 0.2, 0.8))
     122    vis.start()
     123    import time
     124    time.sleep(2.0)
    107125
    108 rect = [0.0, 0.0, 1.0, 1.0]
    109 domain.initialise_visualiser()
    110126
    111 domain.default_order = 2
    112 domain.beta_w      = 1.0
    113 domain.beta_w_dry  = 0.2
    114 domain.beta_uh     = 1.0
    115 domain.beta_uh_dry = 0.2
    116 domain.beta_vh     = 1.0
    117 domain.beta_vh_dry = 0.2
    118127
    119 #domain.beta_w      = 0.9
    120 #domain.beta_w_dry  = 0.9
    121 #domain.beta_uh     = 0.9
    122 #domain.beta_uh_dry = 0.9
    123 #domain.beta_vh     = 0.9
    124 #domain.beta_vh_dry = 0.9
    125 
    126 yieldstep = 0.005
     128yieldstep = 0.01
    127129finaltime = 1.0
    128130
     
    132134        domain.write_time()
    133135    #print_test_stats(domain, tri_full_flag)
     136    if visualise:
     137        vis.update()                                           
     138
     139
     140
     141if visualise: vis.evolveFinished()
    134142
    135143if myid == 0:
     
    140148
    141149
     150if visualise: vis.join()
    142151pypar.finalize()
Note: See TracChangeset for help on using the changeset viewer.