Changeset 2379


Ignore:
Timestamp:
Feb 13, 2006, 12:12:04 PM (19 years ago)
Author:
nicholas
Message:
 
Location:
development/momentum_sink
Files:
14 added
5 edited

Legend:

Unmodified
Added
Removed
  • development/momentum_sink/compare_sww.py

    r2369 r2379  
    1111gauge_locations = [[10,10],[20,20]]
    1212
    13 quantities = ['stage']
     13quantities = ['stage','elevation']
    1414gauges = file_function(swwfile,
    1515                  quantities = quantities,
  • development/momentum_sink/create_buildings.py

    r2341 r2379  
    11
    2 
    3 
     2import Numeric
     3import math
    44# add inundation dir to your pythonpath
    55from pmesh.mesh import Mesh
     
    1818
    1919    # Boundary of problem
    20     WidtH = 200 # width of boudary in metres
     20    WidtH = 500 # width of boudary in metres
    2121    #W = WidtH/8
    2222    #L = W
    23     outer_polygon = [[0,0],[2*WidtH,0],[2*WidtH,WidtH],[0,WidtH]]
     23    outer_polygon = [[0,0],[1.5*WidtH,0],[1.5*WidtH,WidtH],[0,WidtH]]
    2424    print outer_polygon
    2525    m.add_region_from_polygon(outer_polygon, tags={'wall':[0,1,2], 'wave':[3]})
    2626
    2727    # inner polygons => building boundaries
    28     depth = 15 # depth of building side to oncoming wave
     28    depth = 18 # depth of building side to oncoming wave
    2929    wh = depth/2
    30     breadth = 15 # breadth of building
     30    breadth = 18 # breadth of building
    3131    lh = breadth/2
     32     
    3233    print "building footprint"
    3334    print depth * breadth , "m^2"
    3435    block = 625
    3536    BL = block**0.5
    36     print BL
    37     #[12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5]
    38     D = WidtH/2 + BL/2
    39     B = BL/2
    40     for D in [112.5,137.5,162.5,187.5]:
    41         for B in [12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5]:
     37    ForDep = (0.2*WidtH) + (BL/2)
     38    RearDep = 1.2*WidtH
     39    porosity = breadth/BL
     40    print porosity, " Building porosity"
     41   
     42    Breadths = Numeric.arrayrange( (BL/2), WidtH, (BL))
     43    print Breadths, "Breadths"
     44    Depths = Numeric.arrayrange( ForDep, RearDep, BL )
     45    print Depths, "Depths"
     46
     47    for D in Depths:
     48        Breadths = Breadths + BL/2
     49        for B in Breadths:
    4250            polygon = [[D-wh,B-lh],[D+wh,B-lh],[D+wh,B+lh],[D-wh,B+lh]]
    4351            m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]})# Adds holes with reflective boundaries.       
     52       
     53
    4454            #print polygon
    45            
    46             print B
    47 
    48         print D
    49 
    5055    m.generate_mesh(maximum_triangle_area=maximum_triangle_area)
    5156    triangle_count = m.get_triangle_count()
  • development/momentum_sink/friction_block.py

    r2341 r2379  
    1818
    1919    # Boundary of problem
    20     WidtH = 202 # width of boudary in metres
     20    WidtH = 200 # width of boudary in metres
    2121    #W = WidtH/8
    2222    #L = W
     
    2828    #Boundary
    2929    dict = {}
    30     dict['points'] = [[0,0],[0.5*WidtH,0],[1.5*WidtH,0],[2*WidtH,0],[2*WidtH,WidtH] \
    31                       ,[1.5*WidtH,WidtH],[0.5*WidtH,WidtH],[0,WidtH]]
     30    dict['points'] = [[0,0],[0.2*WidtH,0],[1.2*WidtH,0],[3.5*WidtH,0],[3.5*WidtH,WidtH] \
     31                      ,[1.2*WidtH,WidtH],[0.2*WidtH,WidtH],[0,WidtH]]
    3232   
    3333    dict['segments'] = [[0,1], [1,2], [2,3], [3,4],
  • development/momentum_sink/run_buildings.py

    r2341 r2379  
    2525t0 = time.time()
    2626
    27 meshname, triagle_count = cache(create_mesh,(10),
     27meshname, triagle_count = cache(create_mesh,(100),
    2828                                {'mesh_file':meshname,
    2929                                 'triangles_in_name':True}
     
    5555
    5656#Setup Initial Conditions
    57 domain.set_quantity('friction', 0)
     57domain.set_quantity('friction', 0.01)
    5858domain.set_quantity('stage', 0)
    5959
     
    6565Br = Reflective_boundary(domain)
    6666Bt = Transmissive_boundary(domain)
    67 Bd = Dirichlet_boundary([6,0,0])
     67Bd = Dirichlet_boundary([10,0,0])
    6868Bw = Time_boundary(domain=domain,
    6969                   f=lambda t: [(60<t<660)*4, 0, 0])
    7070
    7171domain.set_boundary( {'wall': Br,'wave': Bd, 'back': Bt, 'exterior':Bd} )
    72 domain.set_region(Set_region('mound', 'friction', 3, location='unique vertices'))
     72
    7373#Evolve
    7474t0 = time.time()
    7575
    76 for t in domain.evolve(yieldstep = 1, finaltime = 40):
     76for t in domain.evolve(yieldstep = 1, finaltime = 20):
    7777    domain.write_time()     
    7878
  • development/momentum_sink/run_friction.py

    r2341 r2379  
    66import time
    77
    8 import project
     8import project_friction
    99
    1010from pyvolution.pmesh2domain import pmesh_to_domain_instance
     
    2121from pmesh.mesh import importMeshFromFile
    2222
    23 meshname = project.meshname
    24 outputname = project.outputname
     23meshname = project_friction.meshname
     24outputname = project_friction.outputname
    2525
    2626t0 = time.time()
     
    4747
    4848
    49 domain.set_name(project.basename + '_%d' %triagle_count)
    50 domain.set_datadir(project.outputdir)
     49domain.set_name(project_friction.basename + '_%d' %triagle_count)
     50domain.set_datadir(project_friction.outputdir)
    5151domain.store = True
    5252domain.quantities_to_be_stored = ['stage']
     
    5656
    5757#Setup Initial Conditions
    58 domain.set_quantity('friction', 0)
     58domain.set_quantity('friction', 0.01)
    5959domain.set_quantity('stage', 0)
    60 domain.set_region(Set_region('mound', 'friction', 700, location='unique vertices'))
     60domain.set_region(Set_region('mound', 'friction', 0.8)) #, location='unique vertices'))
    6161#Setup Boundary Conditions
    6262print domain.get_boundary_tags()
     
    6666Br = Reflective_boundary(domain)
    6767Bt = Transmissive_boundary(domain)
    68 Bd = Dirichlet_boundary([6,0,0])
     68Bd = Dirichlet_boundary([36,0,0])
    6969Bw = Time_boundary(domain=domain,
    7070                   f=lambda t: [(60<t<660)*4, 0, 0])
     
    7575t0 = time.time()
    7676
    77 for t in domain.evolve(yieldstep = 1, finaltime = 40):
     77for t in domain.evolve(yieldstep = 1, finaltime = 80):
    7878    domain.write_time()     
    7979
Note: See TracChangeset for help on using the changeset viewer.