Changeset 2446


Ignore:
Timestamp:
Feb 24, 2006, 4:09:02 PM (19 years ago)
Author:
nicholas
Message:

Attempted loop_buildings.py did not work.

Location:
development/momentum_sink
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • development/momentum_sink/CCS.py

    r2429 r2446  
    1212from numerical_tools import norm, corr, err 
    1313
    14 swwfile_B = project.outputdir + sep  + 'Buildings_3260.sww'
    1514
    1615
    17 gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 20)
     16
     17gauge_depth = Numeric.arrayrange(46, 1.5*WidtH, 25)
    1818print len(gauge_depth),"gauge_depth length"
    1919gauge_breadth = 100
     
    2424    gauge_locations.append(gauge_location)
    2525
     26
     27swwfile_B = project.outputdir + sep  + 'Straight_offset_11.sww'
    2628
    2729#Read model output
     
    3840least_norm=[1]
    3941norm_OK=[]
    40 Friction = Numeric.arrayrange(1,51,1)
     42Friction = Numeric.arrayrange(1,80,1)
    4143for fric in Friction:
    4244    swwfile_F = project.outputdir + sep  + 'friction_n=' + repr(fric) + '_3135.sww'
     
    4749                      use_cache = True)
    4850
    49     t=500
     51    t=1000 # specifies times to look at cross sections
    5052   
    5153    stages_B = []
     
    5456
    5557        # mines data from specified time values in sww file
     58        # Building file
    5659        wB = f_B(t, point_id = i)[0]
    5760        zB = f_B(t, point_id = i)[1]
    5861        uhB = f_B(t, point_id = i)[2]
    5962        vhB = f_B(t, point_id = i)[3]
    60 
     63        # Friction file
    6164        wF = f_F(t, point_id = i)[0]       
    6265        uhF = f_B(t, point_id = i)[2]
    6366        vhF = f_B(t, point_id = i)[3]
     67
    6468        #m = sqrt(uh*uh + vh*vh)   #Absolute momentum
    6569        velB = sqrt(uhB*uhB + vhB*vhB) / (wB + 1.e-30) #Absolute velocity
    6670        velF = sqrt(uhF*uhF + vhF*vhF) / (wF + 1.e-30) #Absolute velocity                   
    67 
    6871        stages_B.append(wB)
    6972        stages_F.append(wF)
     
    7376    Ar_F = Numeric.array(stages_F)
    7477    diff = abs(Ar_B - Ar_F)
    75     norm_F = err(Ar_B, Ar_F, 2, relative = True)
     78    norm_F = err(Ar_B, Ar_F, 2, relative = True)# 2nd norm (RMS) test
    7679     
    7780    print " "
    7881    print norm_F, "norm N_F"
    7982    print " "
    80     G = corr(Ar_F, Ar_B)
    8183    norm_OK.append(norm_F)
    8284
     
    9193print " "
    9294print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_"
    93 print fric_OK, " <- This Manning's n is OK"
     95print fric_OK, " <- This Manning's n is best fit from 2nd norm test"
    9496print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_"
    9597print least_norm, "2nd normal of Friction vs Buildings  "
  • development/momentum_sink/PCS.py

    r2429 r2446  
    1111from pylab import *
    1212
    13 fric = 40   
     13fric = 25   
    1414#swwfile = project.newoutputname + '.sww'
    1515#swwfile = project.outputname
    1616
    1717#swwfile_B = project.outputdir + sep  + 'Buildings_3790.sww'
    18 swwfile_B = project.outputdir + sep  + 'Buildings_3662.sww'
     18swwfile_B = project.outputdir + sep  + 'Straight_offset.sww'
    1919#swwfile_B = project.outputdir + sep  + 'friction_n=10_3135.sww'
    20 swwfile_F = project.outputdir + sep  + 'friction_n=40_3135.sww'
     20swwfile_F = project.outputdir + sep  + 'friction_n=51_3135.sww'
    2121
    22 gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 5)
     22gauge_depth = Numeric.arrayrange(46, 1.5*WidtH, 25) # Random special
     23#gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 25)
    2324gauge_breadth = 100
    2425gauge_locations = []
     
    4546
    4647
    47 T = Numeric.arrayrange(0,1000,20)
     48T = Numeric.arrayrange(0,1000,10)
    4849#T = [ 20, 50, 100, 150, 200 ]
    4950
  • development/momentum_sink/create_buildings.py

    r2429 r2446  
    22import Numeric
    33import math
     4import random
    45# add inundation dir to your pythonpath
    56from pmesh.mesh import Mesh
    67from coordinate_transforms.geo_reference import Geo_reference
    78
     9depth = 11 # depth of building side to oncoming wave
     10breadth = 11 # breadth of building, width of building to oncoming wave
     11#from loop_buildings import depth
    812
    913WidtH = 200 # width of boudary in metres
    10 depth = 15 # depth of building side to oncoming wave
    11 breadth = 15 # breadth of building
     14#breadth = depth
     15
    1216print "building footprint"
    1317print depth * breadth , "m^2"
     
    1519BL = block**0.5
    1620
    17 porosity = breadth/BL
     21porosity = breadth/BL                           
    1822print porosity, " Building porosity"
     23
     24#random.uniform(0,1) #proper implemantation of random generator
    1925
    2026def create_mesh(maximum_triangle_area,
     
    2531    triangles in the mesh to the mesh file name.
    2632    """
     33
     34   
    2735    # create a mesh instance of class Mesh
    2836    m = Mesh()
     37
    2938    # Boundary of problem
    30    
    31     #W = WidtH/8
    32     #L = W
    3339    outer_polygon = [[0,0],[5*WidtH,0],[5*WidtH,WidtH],[0,WidtH]]
    34     print outer_polygon
    3540    m.add_region_from_polygon(outer_polygon, tags={'wall':[0,2], 'wave':[3], 'back':[1]})
    3641
     
    4146    #Th = (45 *(3.142/180)) # sets an initial rotation     
    4247    Th = 0
    43     ForDep = (0.2*WidtH) + (BL/2)
     48    ForDep = (0.2*WidtH) + (BL-whs)
    4449    RearDep = 1.2*WidtH
    4550       
     
    6166            lh4 = (+lhs) * math.cos(Th) - (-whs) * math.sin(Th)
    6267            polygon = [[D+wh1,B+lh1],[D+wh2,B+lh2],[D+wh3,B+lh3],[D+wh4,B+lh4]]
    63             #polygon = [[D-wh,B-lh],[D+wh,B-lh],[D+wh,B+lh],[D-wh,B+lh]]
    64             m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]})# Adds holes with reflective boundaries.       
    65             Th = Th + (37.3 *(3.142/180)) # keeps rotating individual buildings.
     68            m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]})       
     69            #Th = Th + (90 *(3.14159/180)) # keeps rotating individual buildings.
    6670
    67             #print polygon
    6871    m.generate_mesh(maximum_triangle_area=maximum_triangle_area)
    6972    triangle_count = m.get_triangle_count()
     
    7376    else:
    7477        if triangles_in_name is True:
    75             mesh_file = mesh_file[:-4] + '_' + str(triangle_count) \
     78            mesh_file = mesh_file[:-4] + '_Ran_' + str(depth) + '_' + str(triangle_count) \
    7679                        + mesh_file[-4:]
    7780        m.export_mesh_file(mesh_file)
  • development/momentum_sink/loop_friction.py

    r2429 r2446  
    2424from pmesh.mesh import importMeshFromFile
    2525
    26 Friction = Numeric.arrayrange(1,50,1)
     26Friction = Numeric.arrayrange(50,80,1)
    2727for fric in Friction:
    2828    meshname = project_friction.meshname
  • development/momentum_sink/run_buildings.py

    r2415 r2446  
    1515
    1616
    17 from create_buildings import create_mesh
     17from create_buildings import create_mesh, depth
    1818#from building_generator import create_mesh
    1919
     
    4646
    4747
    48 domain.set_name(project.basename + '_%d' %triagle_count)
     48domain.set_name(project.basename + '_Br=%d_%d' %(depth, triagle_count))
    4949domain.set_datadir(project.outputdir)
    5050domain.store = True
     
    7575t0 = time.time()
    7676
    77 for t in domain.evolve(yieldstep = 10, finaltime = 500):
     77for t in domain.evolve(yieldstep = 10, finaltime = 1000):
    7878    domain.write_time()     
    7979
Note: See TracChangeset for help on using the changeset viewer.