Changeset 5350
- Timestamp:
- May 21, 2008, 11:02:27 AM (16 years ago)
- Location:
- anuga_work/development/Hinwood_2008
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/Hinwood_2008/boundary.csv
r5092 r5350 1 time sec,stage m,X velocity m/s ,Y velocity m/s2 0,0.4,0 ,0.013 0.1,0.401996668,0.005990005 ,0.014 0.2,0.403973387,0.01192016 ,0.015 0.3,0.405910404,0.017731212 ,0.016 0.4,0.407788367,0.023365101 ,0.017 0.5,0.409588511,0.028765532 ,0.018 0.6,0.411292849,0.033878548 ,0.019 0.7,0.412884354,0.038653061 ,0.0110 0.8,0.414347122,0.043041365 ,0.0111 0.9,0.415666538,0.046999615 ,0.0112 1,0.41682942,0.050488259 ,0.0113 1.1,0.417824147,0.053472442 ,0.0114 1.2,0.418640782,0.055922345 ,0.0115 1.3,0.419271164,0.057813491 ,0.0116 1.4,0.419708995,0.059126984 ,0.0117 1.5,0.4199499,0.059849699 ,0.0118 1.6,0.419991472,0.059974416 ,0.0119 1.7,0.419833296,0.059499889 ,0.0120 1.8,0.419476953,0.058430858 ,0.0121 1.9,0.418926002,0.056778005 ,0.0122 2,0.418185949,0.054557846 ,0.0123 2.1,0.417264187,0.051792562 ,0.0124 2.2,0.416169928,0.048509784 ,0.0125 2.3,0.414914104,0.044742313 ,0.0126 2.4,0.413509264,0.040527791 ,0.0127 2.5,0.411969443,0.035908329 ,0.0128 2.6,0.410310027,0.030930082 ,0.0129 2.7,0.408547598,0.025642793 ,0.0130 2.8,0.406699763,0.020099289 ,0.0131 2.9,0.404784987,0.01435496 ,0.0132 3,0.4028224,0.0084672 ,0.0133 3.1,0.400831613,0.00249484 ,0.0134 3.2,0.398832517,-0.003502449 ,0.0135 3.3,0.396845086,-0.009464742 ,0.0136 3.4,0.394889178,-0.015332466 ,0.0137 3.5,0.392984335,-0.021046994 ,0.0138 3.6,0.391149591,-0.026551227 ,0.0139 3.7,0.389403277,-0.031790168 ,0.0140 3.8,0.387762842,-0.036711473 ,0.0141 3.9,0.386244677,-0.04126597 ,0.0142 4,0.38486395,-0.04540815 ,0.0143 4.1,0.383634458,-0.049096627 ,0.0144 4.2,0.382568485,-0.052294546 ,0.0145 4.3,0.381676681,-0.054969956 ,0.0146 4.4,0.380967959,-0.057096124 ,0.0147 4.5,0.380449398,-0.058651807 ,0.0148 4.6,0.38012618,-0.05962146 ,0.0149 4.7,0.380001535,-0.059995395 ,0.0150 4.8,0.380076708,-0.059769877 ,0.0151 4.9,0.380350948,-0.058947157 ,0.0152 5,0.380821515,-0.057535456 ,0.0153 5.1,0.381483706,-0.055548881 ,0.0154 5.2,0.382330907,-0.053007279 ,0.0155 5.3,0.383354651,-0.049936047 ,0.0156 5.4,0.38454471,-0.046365869 ,0.0157 5.5,0.385889193,-0.04233242 ,0.0158 5.6,0.387374667,-0.037875998 ,0.0159 5.7,0.388986289,-0.033041133 ,0.0160 5.8,0.390707956,-0.027876131 ,0.0161 5.9,0.392522467,-0.0224326 ,0.0162 6,0.39441169,-0.01676493 ,0.0163 6.1,0.39635675,-0.01092975 ,0.0164 6.2,0.398338212,-0.004985364 ,0.0165 6.3,0.400336278,0.001008834 ,0.0166 6.4,0.402330984,0.006992952 ,0.0167 6.5,0.4043024,0.012907199 ,0.0168 6.6,0.406230827,0.018692482 ,0.0169 6.7,0.408096998,0.024290995 ,0.0170 6.8,0.409882267,0.029646801 ,0.0171 6.9,0.411568795,0.034706386 ,0.0172 7,0.413139732,0.039419196 ,0.0173 7.1,0.414579381,0.043738142 ,0.0174 7.2,0.415873357,0.047620072 ,0.0175 7.3,0.417008732,0.051026197 ,0.0176 7.4,0.417974162,0.053922486 ,0.0177 7.5,0.41876,0.056279999 ,0.0178 7.6,0.419358393,0.05807518 ,0.0179 7.7,0.419763365,0.059290094 ,0.0180 7.8,0.419970867,0.059912601 ,0.0181 7.9,0.419978827,0.059936481 ,0.0182 8,0.419787165,0.059361495 ,0.0183 8.1,0.419397796,0.058193389 ,0.0184 8.2,0.418814611,0.056443833 ,0.0185 8.3,0.418043437,0.05413031 ,0.0186 8.4,0.417091978,0.051275934 ,0.0187 8.5,0.415969742,0.047909227 ,0.0188 8.6,0.414687942,0.044063826 ,0.0189 8.7,0.413259385,0.039778154 ,0.0190 8.8,0.411698344,0.035095032 ,0.0191 8.9,0.410020417,0.030061251 ,0.0192 9,0.40824237,0.024727109 ,0.0193 9.1,0.406381967,0.019145902 ,0.0194 9.2,0.404457798,0.013373395 ,0.0195 9.3,0.402489088,0.007467265 ,0.0196 9.4,0.400495509,0.001486526 ,0.0197 9.5,0.398496978,-0.004509067 ,0.0198 9.6,0.396513464,-0.010459607 ,0.0199 9.7,0.394564787,-0.016305638 ,0.01100 9.8,0.392670417,-0.021988748 ,0.01101 9.9,0.390849282,-0.027452154 ,0.01102 10,0.389119578,-0.032641267 ,0.01103 10.1,0.387498587,-0.037504239 ,0.01104 10.2,0.386002506,-0.041992481 ,0.01105 10.3,0.384646284,-0.046061149 ,0.01106 10.4,0.383443471,-0.049669588 ,0.01107 10.5,0.382406085,-0.052781746 ,0.01108 10.6,0.381544492,-0.055366525 ,0.01109 10.7,0.3808673,-0.057398101 ,0.01110 10.8,0.380381275,-0.058856174 ,0.01111 10.9,0.380091275,-0.059726175 ,0.01112 11,0.380000196,-0.059999412 ,0.01113 11.1,0.380108948,-0.059673155 ,0.01114 11.2,0.380416445,-0.058750664 ,0.01115 11.3,0.380919615,-0.057241155 ,0.01116 11.4,0.381613429,-0.055159712 ,0.01117 11.5,0.382490957,-0.05252713 ,0.01118 11.6,0.383543428,-0.049369716 ,0.01119 11.7,0.384760328,-0.045719015 ,0.01120 11.8,0.386129498,-0.041611505 ,0.01121 11.9,0.387637258,-0.037088227 ,0.01122 12,0.389268542,-0.032194375 ,0.01123 12.1,0.391007051,-0.026978848 ,0.01124 12.2,0.392835414,-0.021493757 ,0.01125 12.3,0.394735364,-0.015793907 ,0.01126 12.4,0.396687916,-0.009936251 ,0.01127 12.5,0.398673562,-0.003979314 ,0.01128 12.6,0.400672461,0.002017383 ,0.01129 12.7,0.402664641,0.007993922 ,0.01130 12.8,0.404630197,0.01389059 ,0.01131 12.9,0.406549489,0.019648466 ,0.01132 13,0.408403341,0.025210022 ,0.01133 13.1,0.410173229,0.030519688 ,0.01134 13.2,0.41184147,0.035524411 ,0.01135 13.3,0.413391395,0.040174186 ,0.01136 13.4,0.414807518,0.044422553 ,0.01137 13.5,0.416075689,0.048227066 ,0.01138 13.6,0.417183236,0.051549709 ,0.01139 13.7,0.418119095,0.054357285 ,0.01140 13.8,0.418873913,0.05662174 ,0.01141 13.9,0.41944015,0.05832045 ,0.01142 14,0.419812147,0.059436441 ,0.01143 14.1,0.419986188,0.059958563 ,0.01144 14.2,0.419960533,0.059881599 ,0.01145 14.3,0.419735439,0.059206318 ,0.01146 14.4,0.419313156,0.057939467 ,0.01147 14.5,0.418697901,0.056093703 ,0.01148 14.6,0.417895823,0.05368747 ,0.01149 14.7,0.416914937,0.05074481 ,0.01150 14.8,0.415765041,0.047295124 ,0.01151 14.9,0.414457627,0.043372881 ,0.01152 15,0.413005757,0.03901727 ,0.011 time sec,stage m,X velocity m/s 2 0,0.4,0 3 0.1,0.401996668,0.005990005 4 0.2,0.403973387,0.01192016 5 0.3,0.405910404,0.017731212 6 0.4,0.407788367,0.023365101 7 0.5,0.409588511,0.028765532 8 0.6,0.411292849,0.033878548 9 0.7,0.412884354,0.038653061 10 0.8,0.414347122,0.043041365 11 0.9,0.415666538,0.046999615 12 1,0.41682942,0.050488259 13 1.1,0.417824147,0.053472442 14 1.2,0.418640782,0.055922345 15 1.3,0.419271164,0.057813491 16 1.4,0.419708995,0.059126984 17 1.5,0.4199499,0.059849699 18 1.6,0.419991472,0.059974416 19 1.7,0.419833296,0.059499889 20 1.8,0.419476953,0.058430858 21 1.9,0.418926002,0.056778005 22 2,0.418185949,0.054557846 23 2.1,0.417264187,0.051792562 24 2.2,0.416169928,0.048509784 25 2.3,0.414914104,0.044742313 26 2.4,0.413509264,0.040527791 27 2.5,0.411969443,0.035908329 28 2.6,0.410310027,0.030930082 29 2.7,0.408547598,0.025642793 30 2.8,0.406699763,0.020099289 31 2.9,0.404784987,0.01435496 32 3,0.4028224,0.0084672 33 3.1,0.400831613,0.00249484 34 3.2,0.398832517,-0.003502449 35 3.3,0.396845086,-0.009464742 36 3.4,0.394889178,-0.015332466 37 3.5,0.392984335,-0.021046994 38 3.6,0.391149591,-0.026551227 39 3.7,0.389403277,-0.031790168 40 3.8,0.387762842,-0.036711473 41 3.9,0.386244677,-0.04126597 42 4,0.38486395,-0.04540815 43 4.1,0.383634458,-0.049096627 44 4.2,0.382568485,-0.052294546 45 4.3,0.381676681,-0.054969956 46 4.4,0.380967959,-0.057096124 47 4.5,0.380449398,-0.058651807 48 4.6,0.38012618,-0.05962146 49 4.7,0.380001535,-0.059995395 50 4.8,0.380076708,-0.059769877 51 4.9,0.380350948,-0.058947157 52 5,0.380821515,-0.057535456 53 5.1,0.381483706,-0.055548881 54 5.2,0.382330907,-0.053007279 55 5.3,0.383354651,-0.049936047 56 5.4,0.38454471,-0.046365869 57 5.5,0.385889193,-0.04233242 58 5.6,0.387374667,-0.037875998 59 5.7,0.388986289,-0.033041133 60 5.8,0.390707956,-0.027876131 61 5.9,0.392522467,-0.0224326 62 6,0.39441169,-0.01676493 63 6.1,0.39635675,-0.01092975 64 6.2,0.398338212,-0.004985364 65 6.3,0.400336278,0.001008834 66 6.4,0.402330984,0.006992952 67 6.5,0.4043024,0.012907199 68 6.6,0.406230827,0.018692482 69 6.7,0.408096998,0.024290995 70 6.8,0.409882267,0.029646801 71 6.9,0.411568795,0.034706386 72 7,0.413139732,0.039419196 73 7.1,0.414579381,0.043738142 74 7.2,0.415873357,0.047620072 75 7.3,0.417008732,0.051026197 76 7.4,0.417974162,0.053922486 77 7.5,0.41876,0.056279999 78 7.6,0.419358393,0.05807518 79 7.7,0.419763365,0.059290094 80 7.8,0.419970867,0.059912601 81 7.9,0.419978827,0.059936481 82 8,0.419787165,0.059361495 83 8.1,0.419397796,0.058193389 84 8.2,0.418814611,0.056443833 85 8.3,0.418043437,0.05413031 86 8.4,0.417091978,0.051275934 87 8.5,0.415969742,0.047909227 88 8.6,0.414687942,0.044063826 89 8.7,0.413259385,0.039778154 90 8.8,0.411698344,0.035095032 91 8.9,0.410020417,0.030061251 92 9,0.40824237,0.024727109 93 9.1,0.406381967,0.019145902 94 9.2,0.404457798,0.013373395 95 9.3,0.402489088,0.007467265 96 9.4,0.400495509,0.001486526 97 9.5,0.398496978,-0.004509067 98 9.6,0.396513464,-0.010459607 99 9.7,0.394564787,-0.016305638 100 9.8,0.392670417,-0.021988748 101 9.9,0.390849282,-0.027452154 102 10,0.389119578,-0.032641267 103 10.1,0.387498587,-0.037504239 104 10.2,0.386002506,-0.041992481 105 10.3,0.384646284,-0.046061149 106 10.4,0.383443471,-0.049669588 107 10.5,0.382406085,-0.052781746 108 10.6,0.381544492,-0.055366525 109 10.7,0.3808673,-0.057398101 110 10.8,0.380381275,-0.058856174 111 10.9,0.380091275,-0.059726175 112 11,0.380000196,-0.059999412 113 11.1,0.380108948,-0.059673155 114 11.2,0.380416445,-0.058750664 115 11.3,0.380919615,-0.057241155 116 11.4,0.381613429,-0.055159712 117 11.5,0.382490957,-0.05252713 118 11.6,0.383543428,-0.049369716 119 11.7,0.384760328,-0.045719015 120 11.8,0.386129498,-0.041611505 121 11.9,0.387637258,-0.037088227 122 12,0.389268542,-0.032194375 123 12.1,0.391007051,-0.026978848 124 12.2,0.392835414,-0.021493757 125 12.3,0.394735364,-0.015793907 126 12.4,0.396687916,-0.009936251 127 12.5,0.398673562,-0.003979314 128 12.6,0.400672461,0.002017383 129 12.7,0.402664641,0.007993922 130 12.8,0.404630197,0.01389059 131 12.9,0.406549489,0.019648466 132 13,0.408403341,0.025210022 133 13.1,0.410173229,0.030519688 134 13.2,0.41184147,0.035524411 135 13.3,0.413391395,0.040174186 136 13.4,0.414807518,0.044422553 137 13.5,0.416075689,0.048227066 138 13.6,0.417183236,0.051549709 139 13.7,0.418119095,0.054357285 140 13.8,0.418873913,0.05662174 141 13.9,0.41944015,0.05832045 142 14,0.419812147,0.059436441 143 14.1,0.419986188,0.059958563 144 14.2,0.419960533,0.059881599 145 14.3,0.419735439,0.059206318 146 14.4,0.419313156,0.057939467 147 14.5,0.418697901,0.056093703 148 14.6,0.417895823,0.05368747 149 14.7,0.416914937,0.05074481 150 14.8,0.415765041,0.047295124 151 14.9,0.414457627,0.043372881 152 15,0.413005757,0.03901727 -
anuga_work/development/Hinwood_2008/prepare_time_boundary.py
r5076 r5350 18 18 from Scientific.IO.NetCDF import NetCDFFile 19 19 from Numeric import array, zeros, Float 20 21 from anuga.utilities.numerical_tools import ensure_numeric 20 22 21 from project import boundary_file23 from interp import interp 22 24 23 def prepare_time boundary(filename):25 def prepare_time_boundary(filename): 24 26 """Convert benchmark 2 time series to NetCDF tms file. 25 27 This is a 'throw-away' code taylor made for files like … … 54 56 Q[i] = depth = float(fields[1]) 55 57 X[i] = float(fields[2]) * depth 56 Y[i] = float(fields[3]) * depth 58 try: 59 Y[i] = float(fields[3]) * depth 60 except: 61 pass 57 62 58 63 … … 78 83 fid.close() 79 84 80 #------------------------------------------------------------- 85 86 def combine_velocity_depth(velocity_file, depth_file, out_file): 87 """ 88 89 Convert the rawish velocity and depth values, which have values at 90 different times to a csv file, with values at the same time, with 91 SI units. 92 93 The format for the velocity file is; 94 [time, sec], [x-velocity +ve is towards the wave generator, m/sec], 95 [y-velocity], [z-velocity] 96 97 The format for the pressure file is 98 [time, sec], [mm above SWL for sensor A], many other sensors... 99 """ 100 101 # Read velocity file 102 vfid = open(velocity_file) 103 lines = vfid.readlines() 104 vfid.close() 105 106 107 n_velocity = len(lines) 108 vtimes = zeros(n_velocity, Float) #Time 109 velocities = zeros(n_velocity, Float) # 110 111 for i, line in enumerate(lines): 112 fields = line.split(',') 113 114 vtimes[i] = float(fields[0]) 115 velocities[i] = float(fields[1]) 116 117 # Read the depth file 118 dfid = open(depth_file) 119 lines = dfid.readlines() 120 dfid.close() 121 122 123 n_depth = len(lines) 124 dtimes = zeros(n_depth, Float) #Time 125 depths = zeros(n_depth, Float) # 126 127 for i, line in enumerate(lines): 128 fields = line.split(',') 129 130 dtimes[i] = float(fields[0]) 131 depths[i] = float(fields[1]) 132 133 depths_at_vtimes = interp(dtimes, depths, vtimes, missing=1e+20) 134 depths_at_vtimes = ensure_numeric(depths_at_vtimes) 135 depths_at_vtimes = depths_at_vtimes/1000.00 # convert from mm to m 136 velocities = ensure_numeric(velocities) 137 velocities = velocities * -1.0 # Swap axis around 138 139 fid = open(out_file,'w') 140 141 assert len(depths_at_vtimes) == len(vtimes) 142 143 #for vtime, depth_at_vtime, velocity in map(vtimes, depths_at_vtimes, 144 # velocities): 145 for i in xrange(len(vtimes)): 146 fid.write(str(vtimes[i]) + ',' + str(depths_at_vtimes[i]) \ 147 + ',' + str(velocities[i])+'\n') 148 149 fid.close() 150 151 152 #------------------------------------------------------------------- 81 153 if __name__ == "__main__": 82 prepare_timeboundary(boundary_file) 154 combine_velocity_depth('T2R7velfilt.csv','T2R7pressfilt.csv', 'cyeah.csv') 155 -
anuga_work/development/Hinwood_2008/project.py
r5076 r5350 12 12 from anuga.utilities.system_tools import get_user_name 13 13 14 boundary_file = 'boundary.tsm'15 14 16 15 class Project: … … 22 21 self.user = get_user_name() 23 22 if home is None: 24 home = getenv('INUNDATIONHOME') #Sandpit's parent dir 23 try: 24 home = getenv('INUNDATIONHOME') #Sandpit's parent dir 25 except: 26 home = '.' 25 27 self.home = home 26 28 # Create the structure of where the output directories will go … … 30 32 if outputdir_name is None: 31 33 #gets time for dir 32 outputdir_name = strftime('%Y%m%d_%H%M%S',localtime()) 34 outputdir_name = strftime('%Y%m%d_%H%M%S',localtime()) 35 33 36 general_outputdir = scenariodir+sep+'output'+sep 34 37 self.outputdir = general_outputdir+outputdir_name+sep 35 38 self.meshdir = scenariodir+sep+'meshes'+sep 39 self.scenariodir = scenariodir+sep 40 self.boundary_file = self.scenariodir + 'boundary.tsm' 36 41 37 42 # creates copy of output dir structure, if it doesn't exist -
anuga_work/development/Hinwood_2008/run_dam.py
r5236 r5350 39 39 import project # Definition of file names and polygons 40 40 import create_mesh 41 from prepare_time_boundary import prepare_time_boundary 42 43 41 44 42 45 def elevation_function(x,y): … … 55 58 56 59 def main(friction=0.01, outputdir_name=None, is_trial_run=False): 60 61 57 62 basename = 'zz' + str(friction) 58 63 if is_trial_run is True: … … 69 74 70 75 pro_instance = project.Project(['data','flumes','Hinwood_2008'], 71 outputdir_name=outputdir_name, 72 home='.') 76 outputdir_name=outputdir_name) 73 77 print "The output dir is", pro_instance.outputdir 74 78 copy_code_files(pro_instance.outputdir,__file__, … … 79 83 copy (pro_instance.codedir + 'create_mesh.py', 80 84 pro_instance.outputdir + 'create_mesh.py') 85 86 87 # Convert the boundary file, .csv to .tsm 88 try: 89 temp = open(pro_instance.boundary_file) 90 temp.close() 91 except IOError: 92 prepare_time_boundary(pro_instance.boundary_file) 81 93 82 94 mesh_filename = pro_instance.meshdir + basename + '.msh' … … 135 147 #function = file_function(project.boundary_file, domain, verbose=True) 136 148 #Bts = Transmissive_Momentum_Set_Stage_boundary(domain, function) 137 138 function = file_function(project.boundary_file, domain, verbose=True) 149 try: 150 function = file_function(pro_instance.boundary_file, domain, 151 verbose=True) 152 except IOError: 153 msg = 'Run prepare_time_boundary.py. File "%s" could not be opened.'\ 154 %(pro_instance.boundary_file) 155 raise msg 156 139 157 Br = Reflective_boundary(domain) 140 158 #Bd = Dirichlet_boundary([0.3,0,0])
Note: See TracChangeset
for help on using the changeset viewer.