Changeset 5496


Ignore:
Timestamp:
Jul 11, 2008, 4:38:08 PM (16 years ago)
Author:
duncan
Message:

adding froude number to interpolate_sww2csv

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/fit_interpolate/interpolate.py

    r5482 r5496  
    429429                        velocity_y_file,
    430430                        stage_file=None,
     431                        froude_file=None,
    431432                        #quantities = ['depth', 'velocity'],
    432433                        time_thinning=1,
     
    477478    if stage_file is not None:
    478479        stage_writer = writer(file(stage_file, "wb"))
     480    if froude_file is not None:
     481        froude_writer = writer(file(froude_file, "wb"))
    479482    # Write heading
    480483    heading = [str(x[0])+ ':' + str(x[1]) for x in points]
     
    484487    velocity_y_writer.writerow(heading)
    485488    if stage_file is not None:
    486         stage_writer.writerow(heading)   
     489        stage_writer.writerow(heading)
     490    if froude_file is not None:
     491        froude_writer.writerow(heading)     
    487492   
    488493    for time in callable_sww.get_time():
     
    492497        if stage_file is not None: 
    493498            stages = [time] 
     499        if froude_file is not None: 
     500            froudes = [time] 
    494501        for point_i, point in enumerate(points):
    495502            quantities = callable_sww(time,point_i)
     
    516523                else:
    517524                    velocity_y = 0
     525            if depth < 1.e-30: # use epsilon
     526                froude = NAN
     527            else:
     528                froude = sqrt(velocity_x*velocity_x + velocity_y*velocity_y)/ \
     529                         sqrt(depth * 9.8066) # gravity m/s/s
    518530            depths.append(depth)
    519531            velocity_xs.append(velocity_x)
     
    521533            if stage_file is not None:
    522534                stages.append(w)
     535            if froude_file is not None:
     536                froudes.append(froude)
    523537        depth_writer.writerow(depths)
    524538        velocity_x_writer.writerow(velocity_xs)
    525539        velocity_y_writer.writerow(velocity_ys)
    526540        if stage_file is not None:
    527             stage_writer.writerow(stages)       
     541            stage_writer.writerow(stages)   
     542        if froude_file is not None:
     543            froude_writer.writerow(froudes)           
    528544
    529545
Note: See TracChangeset for help on using the changeset viewer.