Changeset 2484
- Timestamp:
- Mar 3, 2006, 3:01:35 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
development/stochastic_study/run_model.py
r2448 r2484 31 31 from pyvolution.data_manager import xya2pts 32 32 from pyvolution.util import file_function 33 from caching.caching import cache 33 34 34 35 # Application specific imports … … 75 76 76 77 # Get prefitted realisations 78 79 finaltime = 22.5 80 timestep = 0.05 81 82 83 77 84 realisation = 0 78 85 for filename in os.listdir('.'): … … 85 92 # For each column (each realisation) 86 93 for i in range(V.shape[1]): 87 name = project.basename + '_realisation_%d' %realisation 88 domain.set_name(name) #Output name 94 domain.set_name(project.basename) #Output name 89 95 domain.set_quantity('elevation', V[:,i]) #Assign bathymetry 96 domain.starttime = 0.0 #Reset time 90 97 91 98 #--------------------------------------------------- … … 95 102 %(i, V.shape[1], filename) 96 103 t0 = time.time() 97 for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5):104 for t in domain.evolve(yieldstep = timestep, finaltime = finaltime): 98 105 domain.write_time() 99 #domain.write_boundary_statistics(tags = 'wave')106 100 107 101 108 print 'Realisation %d took %.2f seconds'\ 102 109 %(realisation, time.time()-t0) 103 110 104 realisation += 1 111 112 113 114 #--------------------------------------------------- 115 # Now extract the 3 timeseries (Ch 5-7-9) and store them 116 # in three files for this realisation 117 gauges = [[4.521, 1.196], [4.521, 1.696], [4.521, 2.196]] 118 gauge_names = ['ch5', 'ch7', 'ch9'] 119 120 121 f = file_function(domain.filename + '.sww', 122 quantities='stage', 123 interpolation_points=gauges, 124 verbose = True) 125 126 127 simulation_name = domain.filename + '_realisation_%d' %realisation 128 129 for k, name in enumerate(gauge_names): 130 fid = open(simulation_name + '_' + name + '.txt', 'w') 131 for t in f.T: 132 #For all precomputed timesteps 133 val = f(t, point_id = k)[0] 134 fid.write('%f %f\n' %(t, val)) 135 136 fid.close() 137 138 139 140 realisation += 1
Note: See TracChangeset
for help on using the changeset viewer.