Changeset 7584


Ignore:
Timestamp:
Dec 9, 2009, 8:37:58 AM (9 years ago)
Author:
jgriffin
Message:

Added energy run-up calculations and breaking criteria to Madsen run-up

Location:
misc/tools/event_selection/wave_energy
Files:
3 edited

Legend:

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

    r7554 r7584  
    11""" This code implements run up solutions to the shallow water wave
    22equations.
     3
     4References:
     5Madsen and Fuhrman 2008. Run-up of tsunamis and long waves
     6in terms of surf-similarity. Coastal Engineering, 55, p209.
    37
    48Creator: Jonathan Griffin, Geoscience Australia
     
    812def Madsen(depth, slope, height, period, gravity = 9.81):
    913
    10     freq = (2*np.pi)/period
    11     a = (depth*np.power(freq,2.0))/(gravity*np.power(slope,2.0))
    12     print 'a',a
    13     b = np.power(a,0.25)
    14     print 'b',b
    15     run_up =  2*np.power(np.pi,0.5)*b*height
     14    freq = (2*pi)/period
     15    a = (depth*power(freq,2.0))/(gravity*power(slope,2.0))
     16    #print 'a',a
     17    b = power(a,0.25)
     18    #print 'b',b
     19    run_up_madsen =  2*power(np.pi,0.5)*b*height
    1620
     21    R_break = gravity*(power(slope,2.0))/(power(freq,2.0))
     22    run_up = np.min(run_up_madsen, R_break)
    1723    return run_up
    1824
    19 def surf_sim(depth, slope, height, wavelength, gravity = 9.81):
     25#def surf_sim(depth, slope, height, wavelength, gravity = 9.81):
     26# Add Madsen's surf similarity here
    2027
    21    
     28
     29
     30def energy_conserv(crest_integrated_energy,theta = 3.,alpha = 2.,gravity = 9.81):
     31    E = crest_integrated_energy
     32    print 'crest_integrated_energy', crest_integrated_energy
     33    a = 1/tan(alpha*pi/180.)
     34    b = 1/tan(theta*pi/180.)                               
     35 
     36    F = a-b
     37#    print 'F',F
     38    R3 = 6.*E/(1000.*gravity*F)
     39#    print 'R3', R3
     40    R = power(R3,(1./3.))
     41
     42    return R
    2243
    2344import numpy as np
     45from numpy import tan, sin, cos, power,pi
    2446if __name__ == '__main__':
    2547    sys.exit(main())
  • misc/tools/event_selection/wave_energy/wave_energy.py

    r7555 r7584  
    2525index = 2872
    2626filebasename = 'sts_gauge_' + str(index) +'.csv'
    27 filename = join(filepath, filebasename)
     27#filename = join(filepath, filebasename)
    2828
    2929filepathlist = []
     
    4444max_energy_inst_list = []
    4545run_up_list = []
     46energy_run_up_list = []
     47max_stage_list = []
    4648counter = 0
    4749
     
    8991        x_vel = x_momentum[i]/(100+stage[i])
    9092        y_vel = y_momentum[i]/(100+stage[i])
    91         velocity = numpy.sqrt(x_vel*x_vel,y_vel*y_vel)
     93        velocity = numpy.sqrt(x_vel*x_vel+y_vel*y_vel)
    9294        # Kinetic energy KE = 1/2 roh h u^2
    9395        KE = (1./2.)*(numpy.power(x_vel,2)+numpy.power(y_vel,2))*(1000)*(100+stage[i])
     
    110112            if temp_max_energy > max_energy:
    111113                max_energy = temp_max_energy
     114                max_energy_time = time[i] - start_time
    112115            if temp_max_stage > max_stage:
    113116                max_stage = temp_max_stage
     
    122125            if temp_max_energy > max_energy:
    123126                max_energy = temp_max_energy
     127                max_energy_time = time[i] - start_time
    124128            if temp_max_stage > max_stage:
    125129                max_stage = temp_max_stage
     
    142146    # Add maximum values to list       
    143147    max_energy_inst_list.append(max_energy_inst)
    144     max_energy_list.append( max_energy)
     148    max_energy_list.append(max_energy)
     149
     150    # get wave period from max time
     151##    locator = time.index(max_time)
     152##    time_count = 0
     153##    for i in range(locator,len(time)):
     154       
    145155
    146156    # Account for both halves of the wave
     
    151161    # call run-up module
    152162    #####################################################################
    153     Run_up = run_up.Madsen(100,0.01,max_stage,max_time)
    154     print 'runup', Run_up
     163    Run_up = run_up.Madsen(100,0.017,max_stage,max_time)
     164    print 'Madsen runup', Run_up
    155165    run_up_list.append(Run_up)
     166   
     167    energy_run_up  = run_up.energy_conserv(max_energy,1.0,0.8,9.81)
     168    energy_run_up_list.append(energy_run_up)
     169    print 'energy run up', energy_run_up
     170    max_stage_list.append(max_stage)
    156171
    157172   
     
    170185
    171186# Print results for each file and calculate maximum value across all events
     187outFilename= filepath +'/wave_energy_summary.csv'
     188outFile = file(outFilename,'w')
     189outFile.write('filename, max crest-integrated energy (J.s/m^2), max instantatneous energy J/m^2, Run up (Madsen), Energy run up , max stage (m)\n')
    172190for filename in filepathlist:
     191    outFile.write(filename+',')
     192    outFile.write(str(max_energy_list[counter])+',')
     193    outFile.write(str(max_energy_inst_list[counter])+',')
     194    outFile.write(str(run_up_list[counter])+',')
     195    outFile.write(str(energy_run_up_list[counter])+',')
     196    outFile.write(str(max_stage_list[counter])+'\n')
    173197    print filename
    174     print 'max crest-integrated energy:', max_energy_list[counter],'J.s/m^2'
    175     print 'max instantatneous energy:', max_energy_inst_list[counter],'J/m^2'
    176     print 'Run_up:', run_up_list[counter], 'm'
     198    print 'max crest-integrated energy:', max_energy_list[counter],'J/m^2'
     199    print 'max instantatneous energy:', max_energy_inst_list[counter],'J/s*m^2'
     200    print 'Run_up (Madsen 2009):', run_up_list[counter], 'm'
     201    print 'Run_up (Energy 2009):', energy_run_up_list[counter], 'm'
    177202   
    178203    if max_energy_list[counter] > total_max_energy:
Note: See TracChangeset for help on using the changeset viewer.