Changeset 2966
- Timestamp:
- May 25, 2006, 11:45:56 AM (19 years ago)
- Location:
- development/stochastic_study
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
development/stochastic_study/create_realisations.py
r2959 r2966 7 7 """ 8 8 9 from RandomArray import normal 9 from RandomArray import normal, seed 10 10 from Numeric import concatenate, NewAxis 11 11 import cPickle … … 33 33 elevation = base_bathymetry['attributelist']['elevation'] 34 34 N = len(elevation) 35 print 'read', N, 'points' 35 print 'read', N, 'points:' + 'z in [%f, %f]' %(min(elevation), 36 max(elevation)) 36 37 37 38 # Create different bathymetries based on sampling (Suresh to fill this in) … … 39 40 Z = None 40 41 block_number = 0 41 for n in range(project.number_of_samples): 42 seed(13,17) 43 for n in range(project.number_of_realisations): 42 44 43 45 print 'Creating sample #%d' %n … … 47 49 N) 48 50 49 50 51 #Concatenate into array with each realisation a column 51 52 if Z is None: … … 54 55 Z = concatenate((Z, z[:, NewAxis]), axis=1) 55 56 56 if (n+1)%project.blocksize == 0 or n == project.number_of_ samples:57 if (n+1)%project.blocksize == 0 or n == project.number_of_realisations-1: 57 58 #Fit all of them to computational mesh 58 59 print 'fit block %d to the mesh' %block_number … … 67 68 use_cache = False) 68 69 69 70 print V.shape 71 print V[:2,:] 70 72 Z = None 71 73 -
development/stochastic_study/project.py
r2957 r2966 15 15 gauge_names = ['ch5', 'ch7', 'ch9'] 16 16 17 # Constants 18 number_of_timesteps = 451 # Known from problem description 17 19 18 20 # Stats (Suresh ?) 19 number_of_samples = 300 20 std_dev = 0.01 21 number_of_realisations = 4 22 #std_dev = 0.0026 #Range is 26.035 cm 23 std_dev = 0.0013 #Range is 26.035 cm 21 24 mean = 0.0 22 25 blocksize = 100 #How many realisations to fit at a time -
development/stochastic_study/run_model.py
r2959 r2966 44 44 print 'Creating domain from', project.mesh_filename 45 45 46 #domain = pmesh_to_domain_instance(project.mesh_filename, Domain,47 # use_cache=True,48 # verbose=True)49 50 46 domain = Domain(project.mesh_filename, 51 use_cache= True,47 use_cache=False, 52 48 verbose=True) 53 49 54 50 55 51 print 'Number of triangles = ', len(domain) 56 print 'The extent is ', domain.get_extent()57 52 print domain.statistics() 58 53 … … 60 55 domain.set_datadir('.') 61 56 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) 62 63 #domain.check_integrity()64 57 65 58 … … 100 93 domain.set_name(project.basename) #Output name 101 94 domain.set_quantity('elevation', V[:,i]) #Assign bathymetry 102 domain.s tarttime = 0.0#Reset time95 domain.set_time(0.0) #Reset time 103 96 104 97 #--------------------------------------------------- … … 107 100 print 'Running realisation %d of %d in block %s'\ 108 101 %(i, V.shape[1], filename) 102 print 'Z Range:', min(V[:,i]), max(V[:,i]) 103 109 104 t0 = time.time() 110 105 for t in domain.evolve(yieldstep = timestep, … … 113 108 114 109 115 print ' Realisation %d took %.2f seconds'\110 print 'Simulation of realisation %d took %.2f seconds'\ 116 111 %(realisation, time.time()-t0) 117 112
Note: See TracChangeset
for help on using the changeset viewer.