#!/usr/bin/env python ######################################################### # # Main file for parallel mesh testing. # # This is a modification of the run_parallel_advection.py # file. # # # Authors: Linda Stals, Steve Roberts and Matthew Hardy, # June 2005 # # # ######################################################### import pypar # The Python-MPI interface import time from Numeric import array # pmesh from print_stats import print_test_stats, build_full_flag from anuga.shallow_water import Domain from parallel_shallow_water import Parallel_Domain # mesh partition routines from parallel_meshes import parallel_rectangle numprocs = pypar.size() myid = pypar.rank() processor_name = pypar.Get_processor_name() M = 50 N = M*numprocs if myid == 0: print 'N == %d' %N points, vertices, boundary, full_send_dict, ghost_recv_dict =\ parallel_rectangle(N, M, len1_g=1.0*numprocs, len2_g = 1.0) domain = Parallel_Domain(points, vertices, boundary, full_send_dict = full_send_dict, ghost_recv_dict = ghost_recv_dict) # Make a notes of which triangles are full and which are ghost tri_full_flag = build_full_flag(domain, ghost_recv_dict) print 'number of triangles = ', domain.number_of_elements rect = [ 0.0, 0.0, 1.0*numprocs, 1.0] ## try: ## domain.initialise_visualiser(rect=rect) ## domain.visualiser.qcolor['stage'] = (0.0, 0.0, 0.8) ## domain.visualiser.scale_z['stage'] = 1.0 ## domain.visualiser.scale_z['elevation'] = 0.05 ## except: ## print 'No visualiser' #Boundaries from parallel_shallow_water import Transmissive_boundary, Reflective_boundary T = Transmissive_boundary(domain) R = Reflective_boundary(domain) domain.set_boundary( {'left': R, 'right': R, 'bottom': R, 'top': R, 'ghost': None} ) domain.check_integrity() class Set_Stage: """Set an initial condition with constant water height, for xself.x0)&(xself.y0)&(y