print domain.number_of_global_triangles

domain.set_store(True)
domain.set_flow_algorithm('DE0')
domain.set_minimum_allowed_height(0.01)
domain.set_quantity('elevation',topography)     # Use function for elevation
domain.get_quantity('elevation').smooth_vertex_values()
domain.set_quantity('friction',0.03)            # Constant friction
domain.set_quantity('stage', stagefun)          # Constant negative initial stage
domain.get_quantity('stage').smooth_vertex_values()

domain.set_name('sw_rectangle')


t1 = time.time()
print 'Create sequential domain: time ',t1-t0
    

#-------------------------------------------------------------------------
# Distribute domain
#----------------------------------------------------------------------
sequential_distribute_dump(domain, numprocs, verbose = True)


t2 = time.time()
print 'Sequential Distribute domain: time ',t2-t1
    



dx = dy = 0.05
domain = rectangular_cross_domain(int(length / dx),
                                  int(width / dy),
                                  len1=length,
                                  len2=width,
                                  verbose=verbose)

print domain.number_of_global_triangles

domain.set_store(True)
domain.set_flow_algorithm('DE0')
domain.set_minimum_allowed_height(0.01)
domain.set_quantity('elevation', topography)  # Use function for elevation
domain.get_quantity('elevation').smooth_vertex_values()
domain.set_quantity('friction', 0.03)  # Constant friction
domain.set_quantity('stage', stagefun)  # Constant negative initial stage
domain.get_quantity('stage').smooth_vertex_values()

domain.set_name('sw_rectangle')

t1 = time.time()
print 'Create sequential domain: time ', t1 - t0

#-------------------------------------------------------------------------
# Distribute domain
#----------------------------------------------------------------------
sequential_distribute_dump(domain, numprocs, verbose=True)

t2 = time.time()
print 'Sequential Distribute domain: time ', t2 - t1
예제 #3
0

class Set_Elevation:
    """Set an elevation
    """
    def __init__(self, h=1.0):
        self.x0 = x0
        self.x1 = x1
        self.h = h

    def __call__(self, x, y):
        return x / self.h


#--------------------------------------------------------------------------
# Setup Sequential Domain
#--------------------------------------------------------------------------
domain = create_domain_from_file(mesh_filename)
domain.set_quantity('stage', Set_Stage(x0, x1, 2.0))
#domain.set_datadir('.')
domain.set_name('merimbula_new')
domain.set_store(True)

#--------------------------------------------------------------------------
# Distribute sequential domain on processor 0 to other processors
#--------------------------------------------------------------------------

if verbose: print 'DISTRIBUTING DOMAIN'
#sequential_distribute_dump(domain, 4, verbose=True)
sequential_distribute_dump(domain, 20, verbose=True)
    def __init__(self, h=1.0):
        self.x0 = x0
        self.x1 = x1
        self.h  = h

    def __call__(self, x, y):
        return x/self.h
    

#--------------------------------------------------------------------------
# Setup Sequential Domain
#--------------------------------------------------------------------------
domain = create_domain_from_file(mesh_filename)
domain.set_quantity('stage', Set_Stage(x0, x1, 2.0))
#domain.set_datadir('.')
domain.set_name('merimbula_new')
domain.set_store(True)


#--------------------------------------------------------------------------
# Distribute sequential domain on processor 0 to other processors
#--------------------------------------------------------------------------

if verbose: print 'DISTRIBUTING DOMAIN'
sequential_distribute_dump(domain, 4, verbose=True)