Changeset 9085


Ignore:
Timestamp:
Apr 11, 2014, 10:06:44 AM (11 years ago)
Author:
steve
Message:

Adding anuga_1d to test all

Location:
trunk/anuga_core
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/compile_all.py

    r8871 r9085  
    66buildroot = os.getcwd()
    77
     8
     9#--------------------------------------------------
     10# Compiling anuga code
     11#--------------------------------------------------
    812os.chdir('source')
    913os.chdir('anuga')
     
    2024
    2125
    22 os.chdir(buildroot)   
     26os.chdir(buildroot)
     27
     28#--------------------------------------------------
     29# Compiling anuga_1d code
     30#--------------------------------------------------
     31os.chdir('source')
     32os.chdir('anuga_1d')
     33
     34
     35print 'Changing to', os.getcwd()       
     36
     37#entries = listdir('.')
     38
     39t0 = time.time()
     40
     41# Attempt to compile all ANUGA_1D extensions
     42execfile('compile_all.py')
     43
     44
     45os.chdir(buildroot)
     46
     47#--------------------------------------------------
     48# Compiling anuga_parallel code
     49#--------------------------------------------------
    2350
    2451try:
  • trunk/anuga_core/source/anuga/utilities/compile.py

    r8923 r9085  
    490490              msg = 'Could not compile C extension %s\n' %filename
    491491              msg += str(e)
    492               raise Exception(msg)
     492f.              raise Exception(msg)
    493493          else:
    494494              print 'C extension %s OK' %filename
  • trunk/anuga_core/source/anuga_1d/base/generic_domain.py

    r9076 r9085  
    13761376                Q = self.quantities[name]
    13771377                Q.explicit_update[:] = 0.0
     1378               
     1379        #for name in self.conserved_quantities:
     1380        #    Q = self.quantities[name]
     1381        #    Q.semi_implicit_update[:] = 0.0
    13781382
    13791383        for f in self.forcing_terms:
  • trunk/anuga_core/source/anuga_1d/sqpipe/culvert.py

    r9081 r9085  
    3636def top(x):
    3737
    38     t = numpy.ones_like(x)
     38    t = numpy.ones_like(x)*4
    3939
    4040    t = numpy.where(x<-40, 20, t)
     
    4545    return height(x)*width(x)
    4646
     47def friction(x):
     48    return numpy.ones_like(x)*0.01
     49
    4750
    4851#===============================================================================
    4952
    5053def get_domain():
    51     N = 100
     54    N = 20
    5255    print "Evaluating domain with %d cells" %N
    5356
     
    5760
    5861    domain.set_spatial_order(2)
    59     domain.set_timestepping_method('euler')
     62    domain.set_timestepping_method('rk2')
    6063    domain.set_CFL(0.5)
    6164    domain.set_limiter("vanleer")
     
    6871    domain.set_quantity('width',width)
    6972    domain.set_quantity('top',top)
     73    domain.set_quantity('friction',friction)
    7074
    7175    Br = dom.Reflective_boundary(domain)
    7276    Bt = dom.Transmissive_boundary(domain)
    7377
    74     domain.set_boundary({'left': Br, 'right' : Bt})
     78    domain.set_boundary({'left': Br, 'right' : Br})
    7579
    7680    return domain
  • trunk/anuga_core/source/anuga_1d/sqpipe/run_culvert.py

    r9081 r9085  
    88
    99finaltime = 100.0
    10 yieldstep = 0.001
     10yieldstep = 0.1
    1111
    1212model.animate_domain(domain, yieldstep, finaltime)
  • trunk/anuga_core/source/anuga_1d/sqpipe/sqpipe_domain.py

    r9076 r9085  
    8181        self.epsilon = epsilon
    8282
     83        #setup manning's friction
     84        f = manning_friction
     85        self.forcing_terms.append(f)
     86       
    8387        #forcing terms
    8488        for f in forcing_terms:
     
    171175
    172176        self.state = new_state
    173         self.state = numpy.where(h>=t, 1, 0)
     177        #self.state = numpy.where(h>=t, 1, 0)
    174178
    175179    def distribute_to_vertices_and_edges(self):
  • trunk/anuga_core/source/anuga_1d/sqpipe/sqpipe_forcing_terms.py

    r9076 r9085  
    101101    """
    102102
    103     from math import sqrt
    104 
    105     w = domain.quantities['stage'].centroid_values
    106     z = domain.quantities['elevation'].centroid_values
    107     h = w-z
    108 
    109     uh = domain.quantities['xmomentum'].centroid_values
    110     #vh = domain.quantities['ymomentum'].centroid_values
     103    from math import sqrt, fabs
     104
    111105    eta = domain.quantities['friction'].centroid_values
    112106
    113     xmom_update = domain.quantities['xmomentum'].semi_implicit_update
     107    hw = domain.quantities['area'].centroid_values
     108    w  = domain.quantities['width'].centroid_values
     109    uhw = domain.quantities['discharge'].centroid_values
     110   
     111    h = hw/w
     112   
     113    uhw_update = domain.quantities['discharge'].semi_implicit_update
    114114    #ymom_update = domain.quantities['ymomentum'].semi_implicit_update
    115115
    116116    N = domain.number_of_elements
    117     eps = domain.minimum_allowed_height
    118     g = domain.g
    119 
     117    eps = 1.0e-10
     118    g = domain.g
     119
     120    #print 'mannings'
    120121    for k in range(N):
    121122        if eta[k] >= eps:
    122123            if h[k] >= eps:
    123124                #S = -g * eta[k]**2 * sqrt((uh[k]**2 + vh[k]**2))
    124                 S = -g * eta[k]**2 * uh[k]
     125                S = -g * eta[k]**2 * fabs(uhw[k])
    125126                S /= h[k]**(7.0/3)
     127                S /= w[k]
    126128
    127129                #Update momentum
    128                 xmom_update[k] += S*uh[k]
     130                uhw_update[k] += S*uhw[k]
    129131                #ymom_update[k] += S*vh[k]
    130132
  • trunk/anuga_core/test_all.py

    r8949 r9085  
    1010print
    1111print '======================= anuga tests ================================='   
     12print 'Changing to', os.getcwd() # This is now different from buildroot   
     13execfile('test_all.py')
     14
     15
     16os.chdir(buildroot)
     17os.chdir('source')
     18os.chdir('anuga_1d')
     19print
     20print '======================= anuga_1d tests ================================='   
    1221print 'Changing to', os.getcwd() # This is now different from buildroot   
    1322execfile('test_all.py')
Note: See TracChangeset for help on using the changeset viewer.