Changeset 8950


Ignore:
Timestamp:
Aug 9, 2013, 4:30:31 PM (11 years ago)
Author:
steve
Message:

Some changes to bottineau files

Location:
trunk/anuga_core/source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/structures/structure_operator.py

    r8876 r8950  
    193193        # set outflow
    194194        if old_inflow_depth > 0.0 :
    195                 timestep_star = timestep*new_inflow_depth/old_inflow_depth
     195            timestep_star = timestep*new_inflow_depth/old_inflow_depth
    196196        else:
    197197            timestep_star = 0.0
  • trunk/anuga_core/source/anuga/utilities/plot_utils.py

    r8845 r8950  
    200200    """
    201201    def __init__(self,p, velocity_extrapolation=False):
     202       
    202203        self.time, self.x, self.y, self.stage, self.xmom,\
    203204             self.ymom, self.elev, self.xvel, \
     
    213214    # Make 3 arrays, each containing one index of a vertex of every triangle.
    214215    l=len(p.vols)
    215     vols0=numpy.zeros(l, dtype='int')
    216     vols1=numpy.zeros(l, dtype='int')
    217     vols2=numpy.zeros(l, dtype='int')
     216    #vols0=numpy.zeros(l, dtype='int')
     217    #vols1=numpy.zeros(l, dtype='int')
     218    #vols2=numpy.zeros(l, dtype='int')
    218219
    219220    # FIXME: 22/2/12/ - I think this loop is slow, should be able to do this
    220221    # another way
    221     for i in range(l):
    222         vols0[i]=p.vols[i][0]
    223         vols1[i]=p.vols[i][1]
    224         vols2[i]=p.vols[i][2]
     222#    for i in range(l):
     223#        vols0[i]=p.vols[i][0]
     224#        vols1[i]=p.vols[i][1]
     225#        vols2[i]=p.vols[i][2]
     226
     227
     228
     229    vols0=p.vols[:,0]
     230    vols1=p.vols[:,1]
     231    vols2=p.vols[:,2]
     232
     233    #print vols0.shape
     234    #print p.vols.shape
    225235
    226236    # Then use these to compute centroid averages
     
    262272            xvel_cent[i,:]=xmom_cent[i,:]/(stage_cent[i,:]-elev_cent+1.0e-06)*(stage_cent[i,:]>elev_cent+p.minimum_allowed_height)
    263273            yvel_cent[i,:]=ymom_cent[i,:]/(stage_cent[i,:]-elev_cent+1.0e-06)*(stage_cent[i,:]>elev_cent+p.minimum_allowed_height)
    264    
     274
     275
    265276
    266277    # Compute velocity
     
    378389########################
    379390# TRIANGLE AREAS, WATER VOLUME
    380 def triangle_areas(p, subset='null'):
     391def triangle_areas(p, subset=None):
    381392    # Compute areas of triangles in p -- assumes p contains vertex information
    382393    # subset = vector of centroid indices to include in the computation.
    383394
    384     if(subset=='null'):
     395    if(subset is None):
    385396        subset=range(len(p.vols[:,0]))
    386397   
     
    406417###
    407418
    408 def water_volume(p,p2, per_unit_area=False, subset='null'):
     419def water_volume(p,p2, per_unit_area=False, subset=None):
    409420    # Compute the water volume from p(vertex values) and p2(centroid values)
    410421
    411     if(subset=='null'):
     422    if(subset is None):
    412423        subset=range(len(p2.x))
    413424
     
    431442
    432443
    433 
     444def get_triangle_containing_point(p,point):
     445
     446    V = p.vols
     447
     448    x = p.x
     449    y = p.y
     450
     451    l = len(x)
     452
     453    from anuga.geometry.polygon import is_outside_polygon,is_inside_polygon
     454
     455    # FIXME: Horrible brute force
     456    for i in xrange(l):
     457        i0 = V[i,0]
     458        i1 = V[i,1]
     459        i2 = V[i,2]
     460        poly = [ [x[i0], y[i0]], [x[i1], y[i1]], [x[i2], y[i2]] ]
     461
     462        if is_inside_polygon(point, poly, closed=True):
     463            return i
     464
     465    msg = 'Point %s not found within a triangle' %str(point)
     466    raise Exception(msg)
     467
     468
     469def get_extent(p):
     470
     471    import numpy
     472
     473    x_min = numpy.min(p.x)
     474    x_max = numpy.max(p.x)
     475
     476    y_min = numpy.min(p.y)
     477    y_max = numpy.max(p.y)
     478
     479    return x_min, x_max, y_min, y_max
     480
     481
     482
     483
  • trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py

    r8875 r8950  
    191191        # Get attribute from outflow enquiry point
    192192        if self.myid == self.master_proc:
     193           
    193194            if self.myid == self.enquiry_proc[self.outflow_index]:
    194195                outflow_enq_depth = self.inlets[self.outflow_index].get_enquiry_depth()
  • trunk/anuga_core/source/anuga_parallel/parallel_shallow_water.py

    r8664 r8950  
    229229
    230230        if myid == 0:
     231
     232            fig = plt.figure()
    231233            fx = {}
    232234            fy = {}
     
    252254                triang = num.array(range(0,3*n))
    253255                triang.shape = (n, 3)
    254                 plt.triplot(fx[i], fy[i], triang, 'g-')
     256                plt.triplot(fx[i], fy[i], triang, 'g-', linewidth = 0.5)
    255257
    256258            # Plot ghost triangles
     
    260262                    triang = num.array(range(0,3*n))
    261263                    triang.shape = (n, 3)
    262                     plt.triplot(gx[i], gy[i], triang, 'b--')
     264                    plt.triplot(gx[i], gy[i], triang, 'b--', linewidth = 0.5)
    263265
    264266            # Save triangulation to location pointed by filename
    265             plt.savefig(filename)
     267            plt.savefig(filename, dpi=600)
    266268
    267269        else:
  • trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py

    r8877 r8950  
    308308            gain = outflow_extra_depth*outflow_area
    309309
    310         # Update Stats
     310            # Update Stats
    311311            self.discharge  = Q#outflow_extra_depth*self.outflow.get_area()/timestep
    312312            self.velocity = barrel_speed#self.discharge/outlet_depth/self.width
  • trunk/anuga_core/source/anuga_parallel/run_parallel_sw_merimbula.py

    r8871 r8950  
    4343#--------------------------------------------------------------------------
    4444
    45 mesh_filename = "merimbula_10785_1.tsh" ; x0 = 756000.0 ; x1 = 756500.0; yieldstep = 10; finaltime = 1000
     45mesh_filename = "merimbula_10785_1.tsh" ; x0 = 756000.0 ; x1 = 756500.0; yieldstep = 10; finaltime = 10
    4646#mesh_filename = "merimbula_17156.tsh"   ; x0 = 756000.0 ; x1 = 756500.0; yieldstep = 50; finaltime = 500
    4747#mesh_filename = "merimbula_43200_1.tsh"   ; x0 = 756000.0 ; x1 = 756500.0; yieldstep = 50; finaltime = 500
     
    113113
    114114domain.set_flow_algorithm('2_0')
    115 #domain.set_store_vertices_smoothly(True)
    116 
    117 #domain.smooth = False
    118 #domain.set_default_order(2)
    119 #domain.set_timestepping_method('rk2')
    120 #domain.set_CFL(0.7)
    121 #domain.set_beta(1.5)
    122115
    123116
     
    197190domain.sww_merge(delete_old=False)
    198191
     192
     193domain.dump_triangulation()
     194
    199195finalize()
    200196
  • trunk/anuga_core/source/anuga_validation_tests/analytical_exact/runup_on_sinusoid_beach

    • Property svn:ignore set to
      .deps
  • trunk/anuga_core/source/anuga_validation_tests/other_references/radial_dam_break_wet

    • Property svn:ignore set to
      .deps
Note: See TracChangeset for help on using the changeset viewer.