Changeset 1688
- Timestamp:
- Aug 7, 2005, 10:24:22 PM (19 years ago)
- Location:
- inundation/ga/storm_surge
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/netherlands.py
r1636 r1688 83 83 N = 130 #size = 33800 84 84 N = 600 #Size = 720000 85 N = 6085 N = 100 86 86 87 87 … … 121 121 else: 122 122 domain.initialise_visualiser(rect=[0.0,0.0,1.0,1.0]) 123 domain.visualiser.coloring['stage'] = True 123 #domain.initialise_visualiser() 124 #domain.visualiser.coloring['stage'] = False 124 125 domain.visualise_timer = True 125 126 domain.checkpoint = False … … 161 162 162 163 164 #from realtime_visualisation_new import Visualiser 165 #V = Visualiser(domain,title='netherlands') 166 #V.update_quantity('stage') 167 #V.update_quantity('elevation') 163 168 164 for t in domain.evolve(yieldstep = 0. 1, finaltime = 15.0):169 for t in domain.evolve(yieldstep = 0.02, finaltime = 15.0): 165 170 domain.write_time() 171 #V.update_quantity('stage') 166 172 #rpdb.set_active() 167 173 #domain.visualiser.scale_z = 1.0 -
inundation/ga/storm_surge/pyvolution/realtime_visualisation_new.py
r1639 r1688 68 68 self.coloring = {} 69 69 self.updating = {} 70 self.setup = {} 70 71 71 72 self.qcolor['stage'] = self.stage_color … … 73 74 self.coloring['stage'] = False 74 75 self.updating['stage'] = True 76 self.setup['stage'] = True 75 77 76 78 self.qcolor['elevation'] = self.elevation_color … … 78 80 self.coloring['elevation'] = False 79 81 self.updating['elevation'] = False 82 self.setup['elevation'] = False 80 83 81 84 #print self.max_x, self.min_x, self.max_y, self.min_y, … … 146 149 self.scene.select() 147 150 148 self.update_quantity('elevation') 149 self.update_quantity('stage') 151 for key in ['elevation','stage']: 152 if self.setup[key] | self.updating[key]: 153 self.update_quantity(key) 154 155 150 156 151 157 def update_all(self): … … 153 159 self.scene.select() 154 160 155 if self.updating['elevation']: 156 self.update_quantity('elevation') 157 158 if self.updating['stage']: 159 self.update_quantity('stage') 160 161 161 for key in ['elevation','stage']: 162 if self.updating[key]: 163 self.update_quantity(key) 162 164 163 165 … … 203 205 204 206 #print 'update bed image' 205 self.vpython_z_models[qname].pos = self.pos 207 if qname=='elevation': 208 self.vpython_z_models[qname].pos = self.pos+1.0e-3 209 else: 210 self.vpython_z_models[qname].pos = self.pos 211 206 212 self.vpython_z_models[qname].color = self.colour 207 213 self.vpython_z_models[qname].normal = self.normals … … 608 614 from advection import Domain as A_Domain 609 615 from shallow_water import Domain as SW_Domain 616 from shallow_water import Constant_height, Constant_stage 610 617 from mesh_factory import rectangular 611 618 612 points, vertices, boundary = rectangular( 20, 20, len1=200, len2=200)619 points, vertices, boundary = rectangular(60, 60, len1=200, len2=200) 613 620 a_domain = A_Domain(points, vertices, boundary) 614 sw_domain = SW_Domain(points, vertices, boundary) 621 print 'No of Elements' , a_domain.number_of_elements 622 #sw_domain = SW_Domain(points, vertices, boundary) 623 #sw_domain.set_quantity('elevation', Constant_stage(0.0)) 624 #sw_domain.set_quantity('stage', Constant_stage(0.0)) 615 625 616 626 a_domain.initialise_visualiser() 617 a_domain.visualiser.update_all() 618 619 620 sw_domain.initialise_visualiser() 621 sw_domain.visualiser.update_all() 627 a_domain.visualiser.setup_all() 628 629 630 #sw_domain.initialise_visualiser() 631 #sw_domain.visualiser.setup['elevation']=True 632 #sw_domain.visualiser.setup_all() 633 634 time = 0.0 635 while (True): 636 time = time+0.001 637 #print 'Time = ',time 638 #sw_domain.set_quantity('stage', time) 639 a_domain.set_quantity('stage',time) 640 641 #sw_domain.visualiser.update_quantity('stage') 642 a_domain.visualiser.update_quantity('stage') 643 644 if time>1.0 : 645 break 622 646 623 647 #a_v = Visualiser(domain=a_domain, title='advection') -
inundation/ga/storm_surge/pyvolution/shallow_water.py
r1671 r1688 113 113 from realtime_visualisation_new import Visualiser 114 114 self.visualiser = Visualiser(self,scale_z,rect) 115 self.visualiser.updating['elevation']=True 115 116 self.visualise = True 116 117 … … 203 204 #Initialise real time viz if requested 204 205 if self.visualise is True and self.time == 0.0: 205 #import realtime_visualisation_new as visualise 206 #pass 207 import realtime_visualisation_new as visualise 206 208 #visualise.create_surface(self) 207 209 self.initialise_visualiser() … … 214 216 #print 'Storing results in ' + self.writer.filename 215 217 else: 218 pass 216 219 #print 'Results will not be stored.' 217 220 #print 'To store results set domain.store = True' 218 pass219 221 #FIXME: Diagnostic output should be controlled by 220 222 # a 'verbose' flag living in domain (or in a parent class) … … 224 226 #Real time viz 225 227 if self.visualise is True: 226 #visualise.update(self) 227 if self.visualise is True: 228 self.visualiser.update_all() 229 self.visualiser.update_timer() 228 #pass 229 self.visualiser.update_all() 230 self.visualiser.update_timer() 230 231 231 232 #Store model data, e.g. for subsequent visualisation … … 233 234 self.store_timestep(self.quantities_to_be_stored) 234 235 235 236 236 #FIXME: Could maybe be taken from specified list 237 #of 'store every step' quantities 237 238 238 239 #Pass control on to outer loop for more specific actions … … 603 604 #perform the extrapolation and limiting on 604 605 #all of the conserved quantitie 605 606 606 607 if (domain.order == 1): 607 608 for name in domain.conserved_quantities: … … 612 613 else: 613 614 raise 'Unknown order' 614 else: 615 else: 615 616 #old code: 616 617 for name in domain.conserved_quantities: … … 623 624 else: 624 625 raise 'Unknown order' 625 626 626 627 627 628 #Take bed elevation into account when water heights are small -
inundation/ga/storm_surge/validation/LWRU2/lwru2.py
r1674 r1688 8 8 9 9 """ 10 11 import sys 12 from os import sep 13 sys.path.append('..'+sep+'..'+sep) 10 14 11 15 def prepare_timeboundary(filename): … … 27 31 N = len(lines) 28 32 29 T = zeros(N, Float) 33 T = zeros(N, Float) #Time 30 34 Q = zeros(N, Float) #Values 31 35 32 36 for i, line in enumerate(lines): 33 37 fields = line.split() 34 38 35 39 T[i] = float(fields[0]) 36 40 Q[i] = float(fields[1]) … … 39 43 from Scientific.IO.NetCDF import NetCDFFile 40 44 41 fid = NetCDFFile(filename[-4:] + '.sww', 'w') 45 print filename[:-4] + '.sww' 46 47 fid = NetCDFFile(filename[:-4] + '.sww', 'w') 42 48 43 49 fid.institution = 'Geoscience Australia' … … 47 53 fid.createVariable('time', Float, ('number_of_timesteps',)) 48 54 fid.variables['time'][:] = T 49 55 50 56 fid.createVariable('stage', Float, ('number_of_timesteps',)) 51 57 fid.variables['stage'][:] = Q[:] … … 55 61 56 62 fid.createVariable('ymomentum', Float, ('number_of_timesteps',)) 57 fid.variables['ymomentum'][:] = 0.0 63 fid.variables['ymomentum'][:] = 0.0 58 64 59 65 … … 72 78 73 79 try: 80 print 'Read pickled domain' 74 81 fid = open(picklefile) 75 82 domain = load(fid) 76 print 'Read pickled domain' 83 77 84 except: 78 85 79 86 #Preparing time boundary 80 87 prepare_timeboundary('Benchmark_2_input.txt') 81 88 82 89 #Preparing points 83 90 from pyvolution.data_manager import xya2pts … … 104 111 #LS code to be included in set_quantity 105 112 from pyvolution import util, least_squares 106 points, attributes = util.read_xya(' bathymetry.pts')107 113 points, attributes = util.read_xya('Benchmark_2_Bathymetry.pts') 114 108 115 #Fit attributes to mesh 109 116 vertex_attributes = least_squares.fit_to_mesh(domain.coordinates, … … 125 132 126 133 127 128 134 ###################### 129 135 # Boundary conditions … … 140 146 import time 141 147 t0 = time.time() 148 domain.visualise = True 142 149 143 for t in domain.evolve(yieldstep = 0.1, finaltime = 22.5):150 for t in domain.evolve(yieldstep = 1.0, finaltime = 22.5): 144 151 domain.write_time() 145 152 146 153 147 154 print 'That took %.2f seconds' %(time.time()-t0) 148
Note: See TracChangeset
for help on using the changeset viewer.