Changeset 4751


Ignore:
Timestamp:
Oct 24, 2007, 11:34:30 AM (17 years ago)
Author:
duncan
Message:

automating validation

Location:
anuga_validation/automated_validation_tests/UQ_runup_2006
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • anuga_validation/automated_validation_tests/UQ_runup_2006/project.py

    r4750 r4751  
    33"""
    44basename = "uq"
     5
    56depth_filename = "depth.csv"
    67velocity_x_filename =  "velocity_x.csv"
    78velocity_y_filename =  "velocity_y.csv"
    89
    9 
    1010mesh_filename = 'uq-mesh.tsh'
    1111
     12actual_filename = 'actual.csv'
  • anuga_validation/automated_validation_tests/UQ_runup_2006/run_dam.py

    r4750 r4751  
    2020                            Dirichlet_boundary, Time_boundary, File_boundary
    2121from anuga.abstract_2d_finite_volumes.region import Set_region
    22 from anuga.fit_interpolate.interpolate import interpolate_sww2csv
     22from anuga.fit_interpolate.interpolate import interpolate_sww2csv, \
     23     file_function
    2324from anuga.abstract_2d_finite_volumes.util import start_screen_catcher, \
    2425     copy_code_files
    25 import create_mesh
    26 
    27 import project
    28 
     26from anuga.shallow_water.data_manager import csv2dict
     27from numerical_tools import  err   # norm, corr, 
    2928
    3029# Application specific imports
    31 
    32 
     30import create_mesh
     31import project
    3332def main():
    3433     
     
    10099        print 'That took %.2f seconds' %(time.time()-t0)
    101100        print 'finished'
    102        
    103     points = [[0.4,0.2]]
    104     #-------------------------------------------------------------------------
    105     # Calculate gauge info
    106     #-------------------------------------------------------------------------
    107     print "name",project.basename +".sww"
    108     interpolate_sww2csv( project.basename +".sww",
    109                         points,
    110                         project.depth_filename + '.csv',
    111                         project.velocity_x_filename + '.csv',
    112                         project.velocity_y_filename + '.csv')
    113101
    114 
     102    # Load actual experimental results
     103    actual,title_index_dic = csv2dict(project.actual_filename)
     104   
     105    gauge_locations = [[0.4,0.2]]
     106    quantities = ['stage', 'elevation']
     107    file_instance = file_function( project.basename +".sww",
     108                                      quantities = quantities,
     109                                      interpolation_points = gauge_locations,
     110                                      verbose = True,
     111                                      use_cache = False)
     112    # create a list of the simulated_depths at the actual data times.
     113    simulated_depths = []
     114    for atime in actual['time']:
     115        quantities_slice = file_instance(float(atime),
     116                                         point_id=0)
     117        depth = quantities_slice[0] - quantities_slice[1]
     118        simulated_depths.append(depth)
     119    flume_depths = actual["0.4:0.2"]
     120    flume_depths = [float(i) for i in flume_depths]
     121    # calc the norm
     122    #print "map(None, simulated_depths, flume_depths)", \
     123    #      map(None, simulated_depths, flume_depths)
     124    normmax = 0
     125    norm = err(simulated_depths,
     126               flume_depths, 2, relative = True)  # 2nd norm (rel. RMS
     127    if norm > normmax:
     128        normmax = norm
     129    print norm
     130    print "norm", norm
    115131#-------------------------------------------------------------
    116132if __name__ == "__main__":
Note: See TracChangeset for help on using the changeset viewer.