Changeset 7555


Ignore:
Timestamp:
Nov 11, 2009, 9:53:07 AM (13 years ago)
Author:
jgriffin
Message:
 
Location:
misc/tools/event_selection/wave_energy
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • misc/tools/event_selection/wave_energy/wave_energy.py

    r7549 r7555  
    1919import glob
    2020import numpy
     21import run_up
    2122
    2223# Change path here!!!
     
    4243max_energy_list = []
    4344max_energy_inst_list = []
     45run_up_list = []
    4446counter = 0
    4547
     
    6971    max_energy = 0
    7072    max_energy_inst = 0
     73    max_stage = 0
     74    temp_max_stage = 0
    7175   
    7276    ###############################################################
     
    8589        x_vel = x_momentum[i]/(100+stage[i])
    8690        y_vel = y_momentum[i]/(100+stage[i])
     91        velocity = numpy.sqrt(x_vel*x_vel,y_vel*y_vel)
    8792        # Kinetic energy KE = 1/2 roh h u^2
    8893        KE = (1./2.)*(numpy.power(x_vel,2)+numpy.power(y_vel,2))*(1000)*(100+stage[i])
     
    105110            if temp_max_energy > max_energy:
    106111                max_energy = temp_max_energy
    107                
     112            if temp_max_stage > max_stage:
     113                max_stage = temp_max_stage
     114                max_time = time[i] - start_time   
    108115            energy_sum = energy
    109116            start_time = time[i]
     117            max_stage_temp = 0
    110118           
    111119        elif stage[i] < 0 and sign != -1:
     
    114122            if temp_max_energy > max_energy:
    115123                max_energy = temp_max_energy
    116                
     124            if temp_max_stage > max_stage:
     125                max_stage = temp_max_stage
     126                max_time = time[i] - start_time                 
    117127            energy_sum = energy
    118128            start_time = time[i]
     
    120130        elif stage[i] == 0 and sign != 0:
    121131            sign = 0
     132            if temp_max_stage > max_stage:
     133                max_stage = temp_max_stage
     134                max_time = time[i] - start_time
    122135            energy_sum = energy
    123136            start_time = time[i]
    124            
     137                     
    125138        else:
    126139            energy_sum += energy
     140            temp_max_stage = max(temp_max_stage,stage[i])
    127141           
    128142    # Add maximum values to list       
     
    130144    max_energy_list.append( max_energy)
    131145
     146    # Account for both halves of the wave
     147    max_time = max_time*2
     148    print 'max stage',max_stage
     149    print 'max time',max_time
     150    #####################################################################
     151    # call run-up module
     152    #####################################################################
     153    Run_up = run_up.Madsen(100,0.01,max_stage,max_time)
     154    print 'runup', Run_up
     155    run_up_list.append(Run_up)
     156
     157   
    132158    counter += 1
     159   
     160
    133161
    134162   
     
    137165total_max_inst_energy = 0
    138166
     167
     168
     169
     170
    139171# Print results for each file and calculate maximum value across all events
    140172for filename in filepathlist:
     
    142174    print 'max crest-integrated energy:', max_energy_list[counter],'J.s/m^2'
    143175    print 'max instantatneous energy:', max_energy_inst_list[counter],'J/m^2'
    144 
     176    print 'Run_up:', run_up_list[counter], 'm'
     177   
    145178    if max_energy_list[counter] > total_max_energy:
    146179        total_max_energy = max_energy_list[counter]
     
    156189print '\n File with maximum instantaneous energy is:', filepathlist[max_energy_inst_index]
    157190print 'Energy is', max_energy_inst_list[max_energy_inst_index], 'J/m^2'
     191
     192
Note: See TracChangeset for help on using the changeset viewer.