Changeset 2418


Ignore:
Timestamp:
Feb 16, 2006, 4:26:43 PM (18 years ago)
Author:
nicholas
Message:

Crude comparison file CCS.py working fine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • development/momentum_sink/CCS.py

    r2417 r2418  
    1212   
    1313
    14 swwfile_B = project.outputdir + sep  + 'friction_n=10_3135.sww'
    15 swwfile_F = project.outputdir + sep  + 'friction_n=20_3135.sww'
     14swwfile_B = project.outputdir + sep  + 'Buildings_3662.sww'
     15
    1616
    1717gauge_depth = Numeric.arrayrange(0, 2.5*WidtH, 5)
     
    2727quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum']
    2828
     29
     30
    2931f_B = file_function(swwfile_B,
    3032                  quantities = quantities,
     
    3234                  verbose = True,
    3335                  use_cache = True)
     36fric_OK=[]
     37Friction = [1,2,3,5,7,10,20,30,50]
     38for fric in Friction:
     39    swwfile_F = project.outputdir + sep  + 'friction_n=' + repr(fric) + '_3135.sww'
     40    f_F = file_function(swwfile_F,
     41                      quantities = quantities,
     42                      interpolation_points = gauge_locations,
     43                      verbose = True,
     44                      use_cache = True)
    3445
    35 f_F = file_function(swwfile_F,
    36                   quantities = quantities,
    37                   interpolation_points = gauge_locations,
    38                   verbose = True,
    39                   use_cache = True)
    40 
    41 
    42 T = Numeric.arrayrange(0,500,20)
    43 #T = [ 20, 50, 100, 150, 200 ]
    44 
    45 for t in T:
    46     model_time = []
     46    t=500
     47   
    4748    stages_B = []
    4849    stages_F = []
     
    6465        velB = sqrt(uhB*uhB + vhB*vhB) / (wB + 1.e-30) #Absolute velocity
    6566        velF = sqrt(uhF*uhF + vhF*vhF) / (wF + 1.e-30) #Absolute velocity                   
    66         #print velB, "buiding velocity"
    67         #print velF, "friction velocity"
    6867
    6968        stages_B.append(wB)
    7069        stages_F.append(wF)
    71         #elevations.append(zB)  #Should be constant over time
    72         #momenta.append(mB)
    73         #velocityB.append(velB)
    74         #velocityF.append(velF)
    7570       
    76     #print len(stages), "stages"
     71       
     72   
    7773    diff = abs(Numeric.array(stages_B) - Numeric.array(stages_F))
    78     #print diff, "difference"
     74
     75    if max(diff) < 1.2:
     76        print "_-_-_-_-_-_-_-_-_-_-_-_"
     77        print fric, " this file is OK"
     78        print "-_-_-_-_-_-_-_-_-_-_-_-"
     79        fric_OK.append(fric)
     80        #print swwfile_F, "this file OK"
     81    else:
     82        print fric, " this file is definelty NOT OK"
     83print fric_OK, "THESE FRICTION VALUES ARE OK"
     84
     85   
    7986
    8087
    81     ion()
    82     hold(True)
    83     subplot(211)
    84    
    85     plot(gauge_depth, stages_B, '-b',gauge_depth,stages_F,'-r')
    86     title('Time_%d_ vs water depth (n=%f, BP=%f)' %(t, fric, porosity))
    87     xlabel('gauge length(m)')
    88     ylabel('water depths (m)')
    89     #savefig('Comp_Time%d_B_vs_F' %t)
    90     hold(False)
    91 #savefig('Final_comp_n=%s' %fric)
    92 subplot(212)
    93 subplots_adjust(hspace = 0.4)
    94 plot(gauge_depth, diff, 'g')
    95 title('Final Differences in water levels')
    96 xlabel('gauge length(m)')
    97 ylabel('water differences (m)')
    98 savefig('Final_Water_diff_n=%s' %fric)
    99 print "finished"
    100 
    101 
Note: See TracChangeset for help on using the changeset viewer.