# Setup Sequential Domain
#--------------------------------------------------------------------------
if myid == 0:
    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)
else:
    domain = None

#--------------------------------------------------------------------------
# Distribute sequential domain on processor 0 to other processors
#--------------------------------------------------------------------------
if verbose: print 'DISTRIBUTING DOMAIN'
domain = distribute(domain)

#--------------------------------------------------------------------------
# On all processors, setup evolve parameters for domains on all processors
# (all called "domain"
#--------------------------------------------------------------------------

domain.set_flow_algorithm('DE0')

#------------------------------------------------------------------------------
# Setup boundary conditions
# This must currently happen *after* domain has been distributed
#------------------------------------------------------------------------------
Br = Reflective_boundary(domain)  # Solid reflective wall

domain.set_boundary({
コード例 #2
0
#--------------------------------------------------------------------------
# Setup Domain only on processor 0
#--------------------------------------------------------------------------
if myid == 0:
    domain = create_domain_from_file(mesh_filename)
    domain.set_quantity('stage', Set_Stage(x0, x1, 2.0))
else:
    domain = None

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

if myid == 0 and verbose: print 'DISTRIBUTING DOMAIN'
domain = distribute(domain)

#domain.smooth = False
barrier()
for p in range(numprocs):
    if myid == p:
        print 'Process ID %g' %myid
        print 'Number of triangles %g ' %domain.get_number_of_triangles()

    barrier()


domain.set_flow_algorithm(2.0)

if myid == 0:
    domain.print_algorithm_parameters()
コード例 #3
0
    domain.set_store_vertices_smoothly(True)
    #domain.set_quantity('elevation', Set_Elevation(500.0))

    #print domain.statistics()
    #print domain.get_extent()
    #print domain.get_extent(absolute=True)
    #print domain.geo_reference
else:
    domain = None

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

if myid == 0 and verbose: print 'DISTRIBUTING DOMAIN'
domain = distribute(domain, verbose=True)

#--------------------------------------------------------------------------
# On all processors, setup evolve parameters for domains on all processors
# (all called "domain"
#--------------------------------------------------------------------------

domain.set_flow_algorithm('2_0')
#domain.set_store_vertices_smoothly(True)

#domain.smooth = False
#domain.set_default_order(2)
#domain.set_timestepping_method('rk2')
#domain.set_CFL(0.7)
#domain.set_beta(1.5)
コード例 #4
0
t1 = time.time()

if myid == 0 :
    print 'Create sequential domain ',t1-t0

if myid == 0 and verbose: 
    print 'DISTRIBUTING DOMAIN'
    sys.stdout.flush()
    
barrier()

#-------------------------------------------------------------------------
# Distribute domain
#-------------------------------------------------------------------------
domain = distribute(domain,verbose=verbose)


t2 = time.time()

if myid == 0 :
    print 'Distribute domain ',t2-t1
    
if myid == 0 : print 'after parallel domain'


#Boundaries
T = anuga.Transmissive_boundary(domain)
R = anuga.Reflective_boundary(domain)
D = anuga.Dirichlet_boundary([-0.1*scale_me,0.,0.])
コード例 #5
0
def evolution_test(parallel=False):

    domain = create_domain_from_file(mesh_filename)
    domain.set_quantity('stage', Set_Stage(756000.0, 756500.0, 2.0))

    #--------------------------------------------------------------------------
    # Create parallel domain if requested
    #--------------------------------------------------------------------------

    if parallel:
        if par.myid == 0 and verbose: print 'DISTRIBUTING PARALLEL DOMAIN'
        domain = distribute(domain)

    #------------------------------------------------------------------------------
    # Setup boundary conditions
    # This must currently happen *after* domain has been distributed
    #------------------------------------------------------------------------------
    domain.store = False
    Br = Reflective_boundary(domain)  # Solid reflective wall

    domain.set_boundary({
        'outflow': Br,
        'inflow': Br,
        'inner': Br,
        'exterior': Br,
        'open': Br
    })

    #------------------------------------------------------------------------------
    # Setup diagnostic arrays
    #------------------------------------------------------------------------------
    l1list = []
    l2list = []
    linflist = []
    l1norm = num.zeros(3, num.float)
    l2norm = num.zeros(3, num.float)
    linfnorm = num.zeros(3, num.float)
    recv_norm = num.zeros(3, num.float)

    #------------------------------------------------------------------------------
    # Evolution
    #------------------------------------------------------------------------------
    if parallel:
        if par.myid == 0 and verbose: print 'PARALLEL EVOLVE'
    else:
        if verbose: print 'SEQUENTIAL EVOLVE'

    for t in domain.evolve(yieldstep=yieldstep, finaltime=finaltime):
        edges = domain.quantities[quantity].edge_values.take(num.flatnonzero(
            domain.tri_full_flag),
                                                             axis=0)
        l1norm[0] = l1_norm(edges[:, 0])
        l1norm[1] = l1_norm(edges[:, 1])
        l1norm[2] = l1_norm(edges[:, 2])
        l2norm[0] = l2_norm(edges[:, 0])
        l2norm[1] = l2_norm(edges[:, 1])
        l2norm[2] = l2_norm(edges[:, 2])
        linfnorm[0] = linf_norm(edges[:, 0])
        linfnorm[1] = linf_norm(edges[:, 1])
        linfnorm[2] = linf_norm(edges[:, 2])
        if parallel:
            l2norm[0] = pow(l2norm[0], 2)
            l2norm[1] = pow(l2norm[1], 2)
            l2norm[2] = pow(l2norm[2], 2)
            if par.myid == 0:
                #domain.write_time()

                #print edges[:,1]
                for p in range(1, par.numprocs):
                    recv_norm = par.receive(p)
                    l1norm += recv_norm
                    recv_norm = par.receive(p)
                    l2norm += recv_norm
                    recv_norm = par.receive(p)
                    linfnorm[0] = max(linfnorm[0], recv_norm[0])
                    linfnorm[1] = max(linfnorm[1], recv_norm[1])
                    linfnorm[2] = max(linfnorm[2], recv_norm[2])

                l2norm[0] = pow(l2norm[0], 0.5)
                l2norm[1] = pow(l2norm[1], 0.5)
                l2norm[2] = pow(l2norm[2], 0.5)

                l1list.append(l1norm)
                l2list.append(l2norm)
                linflist.append(linfnorm)
            else:
                par.send(l1norm, 0)
                par.send(l2norm, 0)
                par.send(linfnorm, 0)
        else:
            #domain.write_time()
            l1list.append(l1norm)
            l2list.append(l2norm)
            linflist.append(linfnorm)

    return (l1list, l2list, linflist)
コード例 #6
0
t1 = time.time()

if myid == 0 :
    print 'Create sequential domain: Time',t1-t0

if myid == 0 and verbose: 
    print 'DISTRIBUTING DOMAIN'
    sys.stdout.flush()
    
barrier()

#-------------------------------------------------------------------------
# Distribute domain
#-------------------------------------------------------------------------
domain = distribute(domain,verbose=verbose)


t2 = time.time()

if myid == 0 :
    print 'Distribute domain: Time ',t2-t1
    
if myid == 0 : print 'after parallel domain'



domain.set_name('sw_rectangle')

#Boundaries
T = Transmissive_boundary(domain)