Changeset 4985


Ignore:
Timestamp:
Jan 30, 2008, 11:39:28 AM (16 years ago)
Author:
nick
Message:
 
Location:
anuga_validation/conical_island
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_validation/conical_island/run_circular.py

    r4980 r4985  
    1111from anuga.shallow_water import Dirichlet_boundary, Time_boundary
    1212from anuga.shallow_water.data_manager import get_maximum_inundation_data
    13 from anuga.abstract_2d_finite_volumes.util import file_function, sww2csv_gauges,square_root
     13from anuga.abstract_2d_finite_volumes.util import file_function, sww2csv_gauges
    1414from anuga.pmesh.mesh_interface import create_mesh_from_regions
    1515from anuga.utilities.polygon import read_polygon, plot_polygons
     
    1919from anuga.shallow_water.data_manager import csv2dict
    2020
    21 #import project
    22 
    2321#-------------------------
    2422# Create Domain from mesh
     
    9997d=0.75
    10098res=.05
    101 res=1.
     99#res=1.
    102100
    103101#create polygons (circles) to have higher resolution
     
    166164domain.set_quantity('stage', water_height)
    167165
    168 #def square_root():
    169 #    fileName1 = "square_root_table.csv"
    170 #    file1 = open(fileName1,"w")
    171 ##    file1.write("number,square_root \n")
    172 #    for i in range (0,37):
    173 #        for j in range (0,10):
    174 #            number = i+(j/10.)
    175 #            print "%s,%s, %s, %s" %(i,j, number, sqrt(number))
    176 #           
    177 #            file1.write("%s, %s\n" %(i, sqrt(number)))
    178 #    file1.close()
    179 #
    180 ##    return sqrt(s)
    181 #
    182 #def test():               
    183 #    fileName = "test.csv"
    184 #    file = open(fileName,"w")
    185 #    file.write("easting,northing,elevation \n")
    186 #   
    187 #   # csv2dict()
    188 #   
    189 #    x = 12.96
    190 #    y = 13.80
    191 #    res=1
    192 #    for i in range(0,30*res):
    193 #        for j in range(0,25*res):
    194 ##            a = (x-i)**2
    195 ##            b = (y-j)**2
    196 #
    197 #          #  z = -sqrt((x-(i/res))**2+(y-(j/res))**2)
    198 #            du = (x-(i/res))**2+(y-(j/res))**2
    199 #            z = -sqrt(du)*.25+(0.8975)
    200 #            if z <0:
    201 #                z=0
    202 #            if z > .625:
    203 #                z=0.625
    204 #
    205 #            #print 'x,y,f',du,i,j,z
    206 #            file.write("%s, %s, %s\n" %(i/res, j/res, z))
    207 #    file.close()
    208 #
    209 ##square_root()
    210 ##test()
    211 #
    212 #square_root_data=array([],typecode=Float)
    213 #
    214 #square_root_data=resize(square_root_data,(400,2))
    215 #
    216 #
    217 #for i in range (0,37):
    218 #    for j in range (0,10):
    219 #        number = i+(j/10.)
    220 #        print "%s,%s, %s, %s" %(i,j, number, sqrt(number))
    221 #       
    222 #        square_root_data[i*10+j]= number, sqrt(number)
    223 #           
    224 ##        file1.write("%s, %s\n" %(i, sqrt(number)))
    225 
    226 attribute_dic, title_index_dic = csv2dict('sqrt_table.csv')
     166
     167#attribute_dic, title_index_dic = csv2dict('sqrt_table.csv')
     168attribute_dic, title_index_dic = csv2dict('sqrt_table_new.csv')
    227169#print attribute_dic
    228170print attribute_dic['number'][10]
     
    243185    z1=[]
    244186    for d in du:
    245         n1a = round(d,0)
    246         n1=int(n1a)*10
    247         n2=int(round(d - int(round(d,0)),1)*10)
    248         nn=n1+n2
    249         #print d,n1a,n1,n2,nn
     187#        n1=int(round(d,0))*10
     188#        n2=int(round(d - int(round(d,0)),1)*10)
     189##        n3=int(round(d - int(round(d,1)),2)*100)
     190#        nn=n1+n2#+n3
     191
     192     
     193#        n1=int(round(d,0))*100
     194#        n2=int(round(d - n1,1)*10)*10
     195#        n3=int(round(d - n2,2)*100)
     196#        nn=n1+n2+n3
     197        nn=int(round(d,2)*100)
     198#        print d,n1,n2,n3,nn
    250199#    zz=square_root_data[nn]
    251200        zz=-float(attribute_dic['sqrt'][nn])
    252         print nn,zz
     201#        print nn,zz
    253202
    254203#    z = -square_root((center_x-x)**2+(center_y-y)**2)
     
    259208        if z > .625:
    260209            z=0.625
    261         print 'hello',z
     210        print 'hello',d,nn,zz,z
     211#        print 'hello',d,n1,n2,n3,nn,zz,z
    262212        z1.append(z)
    263213    return z1
     
    265215#domain.set_quantity('elevation',filename = "test.csv", alpha=0.1)
    266216#domain.set_quantity('elevation',filename = "test.csv", alpha=1.,verbose=True)
    267 domain.set_quantity('elevation',test, verbose=True)
     217domain.set_quantity('elevation',test, alpha=1., verbose=True)
    268218
    269219
     
    272222#-------------------------
    273223domain.set_name('test1')  # Name of output sww file
    274 domain.set_default_order(1)               # Apply second order scheme
    275 domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
    276 domain.set_minimum_storable_height(0.01) # Don't store w < 0.001m
    277 domain.set_maximum_allowed_speed(0.1)     # Allow a little runoff (0.1 is OK)
     224#domain.set_default_order(1)               # Apply second order scheme
     225#domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
     226#domain.set_minimum_storable_height(0.01) # Don't store w < 0.001m
     227#domain.set_maximum_allowed_speed(0.1)     # Allow a little runoff (0.1 is OK)
     228domain.set_default_order(2)               # Apply second order scheme
     229#domain.set_all_limiters(0.9)              # Max second order scheme (old lim)
     230domain.set_minimum_storable_height(0.001) # Don't store w < 0.001m
     231domain.set_maximum_allowed_speed(1)     # Allow a little runoff (0.1 is OK)
    278232domain.tight_slope_limiters = 1
    279233domain.beta_h = 0.0
     
    320274t0 = time.time()
    321275
    322 for t in domain.evolve(yieldstep = 1, finaltime = 32):
     276for t in domain.evolve(yieldstep = 1, finaltime = 30):
    323277    domain.write_time()
    324278#    domain.write_time(track_speeds=False)
     
    329283    domain.write_time()
    330284   
    331 for t in domain.evolve(yieldstep = 1, finaltime = 50
     285for t in domain.evolve(yieldstep = 1, finaltime = 45
    332286                       ,skip_initial_step = True):
    333287    domain.write_time()
Note: See TracChangeset for help on using the changeset viewer.