Changeset 1363
- Timestamp:
- May 10, 2005, 4:40:06 PM (20 years ago)
- Location:
- inundation/ga/storm_surge
- Files:
-
- 13 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/Merimbula/run_merimbula_lake.py
r1358 r1363 90 90 # Evolution 91 91 t0 = time.time() 92 domain.visualise = False93 yieldstep = 90092 domain.visualise = True 93 yieldstep = 10 94 94 finaltime = 588000*3 95 95 for t in domain.evolve(yieldstep = yieldstep, finaltime = finaltime): -
inundation/ga/storm_surge/parallel/advection.py
r1280 r1363 45 45 #Realtime visualisation 46 46 self.visualise = False 47 self.visualise_color_stage = False 48 self.visualise_timer = True 49 self.visualise_range_z = None 47 50 self.smooth = True 48 self.range_z = None 51 49 52 50 53 … … 177 180 if self.visualise is True and self.time == 0.0: 178 181 import realtime_visualisation_new as visualise 179 visualise.create_surface(self ,range_z = self.range_z)182 visualise.create_surface(self) 180 183 181 184 #Call basic machinery from parent class -
inundation/ga/storm_surge/parallel/run_advection.py
r1280 r1363 19 19 20 20 domain.visualise = True 21 domain.range_z = 1.0 21 #domain.visualise_range_z = 1.0 22 domain.visualise_color_stage = True 23 22 24 23 25 #Boundaries 24 26 T = Transmissive_boundary(domain) 25 D = Dirichlet_boundary(array([ 0.5]))27 D = Dirichlet_boundary(array([1.0])) 26 28 27 29 domain.default_order = 2 -
inundation/ga/storm_surge/pyvolution/advection.py
r773 r1363 1 import sys 2 from os import sep 3 sys.path.append('..'+sep+'pyvolution') 4 1 5 """Class Domain - 2 6 2D triangular domains for finite-volume computations of … … 17 21 18 22 Ole Nielsen, Stephen Roberts, Duncan Gray, Christopher Zoppou 19 Geoscience Australia, 2004 23 Geoscience Australia, 2004 20 24 """ 21 25 … … 27 31 def __init__(self, coordinates, vertices, boundary = None, velocity = None): 28 32 29 33 30 34 Generic_domain.__init__(self, coordinates, vertices, boundary, 31 35 ['stage']) … … 36 40 self.velocity = velocity 37 41 38 #Only first is implemented for advection 39 self.default_order = self.order = 1 42 #Only first is implemented for advection 43 self.default_order = self.order = 1 40 44 41 45 #Realtime visualisation 42 46 self.visualise = False 47 self.visualise_color_stage = False 48 self.visualise_timer = True 49 self.visualise_range_z = None 43 50 self.smooth = True 51 44 52 45 53 … … 49 57 msg = 'Conserved quantity must be "stage"' 50 58 assert self.conserved_quantities[0] == 'stage', msg 51 59 52 60 53 61 def flux_function(self, normal, ql, qr, zl=None, zr=None): 54 62 """Compute outward flux as inner product between velocity 55 63 vector v=(v_1, v_2) and normal vector n. 56 64 57 65 if <n,v> > 0 flux direction is outward bound and its magnitude is 58 66 determined by the quantity inside volume: ql. … … 60 68 quantity outside the volume: qr. 61 69 """ 62 70 63 71 v1 = self.velocity[0] 64 72 v2 = self.velocity[1] … … 71 79 else: 72 80 flux = ql * normal_velocity 73 81 74 82 max_speed = abs(normal_velocity) 75 return flux, max_speed 83 return flux, max_speed 76 84 77 85 78 86 def compute_fluxes(self): 79 87 """Compute all fluxes and the timestep suitable for all volumes 80 88 in domain. 81 89 82 90 Compute total flux for each conserved quantity using "flux_function" 83 91 84 92 Fluxes across each edge are scaled by edgelengths and summed up 85 93 Resulting flux is then scaled by area and stored in … … 93 101 Post conditions: 94 102 domain.explicit_update is reset to computed flux values 95 domain.timestep is set to the largest step satisfying all volumes. 103 domain.timestep is set to the largest step satisfying all volumes. 96 104 """ 97 105 … … 101 109 102 110 N = self.number_of_elements 103 111 104 112 neighbours = self.neighbours 105 113 neighbour_edges = self.neighbour_edges … … 109 117 radii = self.radii 110 118 edgelengths = self.edgelengths 111 119 112 120 timestep = max_timestep #FIXME: Get rid of this 113 121 … … 119 127 120 128 stage_bdry = Stage.boundary_values 121 129 122 130 flux = zeros(1, Float) #Work array for summing up fluxes 123 131 … … 132 140 133 141 #Quantities at neighbour on nearest face 134 n = neighbours[k,i] 142 n = neighbours[k,i] 135 143 if n < 0: 136 144 m = -n-1 #Convert neg flag to index 137 145 qr = stage_bdry[m] 138 else: 146 else: 139 147 m = neighbour_edges[k,i] 140 148 qr = stage[n, m] 141 149 142 143 #Outward pointing normal vector 150 151 #Outward pointing normal vector 144 152 normal = normals[k, 2*i:2*i+2] 145 153 … … 147 155 edgeflux, max_speed = self.flux_function(normal, ql, qr) 148 156 flux -= edgeflux * edgelengths[k,i] 149 157 150 158 #Update optimal_timestep 151 159 try: … … 158 166 flux /= areas[k] 159 167 Stage.explicit_update[k] = flux[0] 160 168 161 169 timestep = min(timestep, optimal_timestep) 162 170 163 self.timestep = timestep 164 171 self.timestep = timestep 172 165 173 166 174 … … 168 176 """Specialisation of basic evolve method from parent class 169 177 """ 170 178 171 179 #Initialise real time viz if requested 172 180 if self.visualise is True and self.time == 0.0: 173 import realtime_visualisation as visualise181 import realtime_visualisation_new as visualise 174 182 visualise.create_surface(self) 175 183 … … 180 188 visualise.update(self) 181 189 182 #Pass control on to outer loop for more specific actions 190 #Pass control on to outer loop for more specific actions 183 191 yield(t) 184 -
inundation/ga/storm_surge/pyvolution/data_manager.py
r1360 r1363 29 29 Manually created files: 30 30 ASC, PRJ: Digital elevation models (gridded) 31 TSH: Triangular meshes (e.g. dreated from pmesh)31 TSH: Triangular meshes (e.g. created from pmesh) 32 32 NC Model outputs for use as boundary conditions (e.g from MOST) 33 33 … … 267 267 if domain.geo_reference is not None: 268 268 domain.geo_reference.write_NetCDF(fid) 269 270 271 269 #FIXME: Backwards compatibility 270 fid.createVariable('z', self.precision, ('number_of_points',)) 271 ################################# 272 272 273 273 fid.createVariable('volumes', Int, ('number_of_volumes', … … 317 317 318 318 # Get X, Y and bed elevation Z 319 319 Q = domain.quantities['elevation'] 320 320 X,Y,Z,V = Q.get_vertex_values(xy=True, 321 321 precision = self.precision) … … 327 327 z[:] = Z.astype(self.precision) 328 328 329 329 #FIXME: Backwards compatibility 330 330 z = fid.variables['z'] 331 331 z[:] = Z.astype(self.precision) 332 332 ################################ 333 333 334 334 volumes[:] = V.astype(volumes.typecode()) -
inundation/ga/storm_surge/pyvolution/realtime_visualisation_new.py
r1295 r1363 4 4 stage_color = (0.1,0.4,0.99) 5 5 6 class Surface:7 def __init__(self,domain,scale_z=1.0 ,range_z=None):6 class Visualiser: 7 def __init__(self,domain,scale_z=1.0): 8 8 """Create visualisation of domain 9 9 """ … … 14 14 self.scale_z = scale_z 15 15 self.vertices = domain.vertex_coordinates 16 16 17 17 18 # models for each quantity … … 39 40 # print 'range_y',self.range_y 40 41 41 self.range_z = 1.0 42 self.max_z = self.range_z/2.0 43 self.min_z = -self.range_z/2.0 44 self.range_z = max(self.max_z - self.min_z, 1.0e-10) 42 45 43 46 44 … … 59 57 self.border_model = curve(frame = self.frame, 60 58 pos=[(0,0),(0,1),(1,1),(1,0),(0,0)]) 61 self.timer=label(pos=(0.75,0.75,0.5),text='Time=%10.5e'%self.domain.time) 62 63 #scene.autoscale=0 59 self.timer=label(pos=(0.75,0.75,0.5),text='Time=%10.5e'%self.domain.time, 60 visible=False) 61 62 63 scene.autoscale=1 64 64 #self.update_all() 65 65 #scene.uniform=0 66 self.setup_range_z() 66 self.range_z = 1.0 67 if domain.visualise_range_z == None: 68 self.setup_range_z() 69 else: 70 self.range_z = domain.visualise_range_z 71 72 self.max_z = self.range_z/2.0 73 self.min_z = -self.range_z/2.0 74 self.range_z = max(self.max_z - self.min_z, 1.0e-10) 75 76 print self.range_z 77 print self.max_z 78 print self.min_z 67 79 68 80 def setup_range_z(self,qname1='elevation',qname2='stage'): … … 70 82 #print qname1 71 83 #print qname2 72 self.range_z = 1.0e-1084 range_z = 1.0e-10 73 85 try: 74 86 q1 = self.domain.quantities[qname1].vertex_values … … 76 88 min_z = min(min(q1)) 77 89 print max_z, min_z 78 self.range_z = max(self.range_z, max_z - min_z)90 range_z = max(range_z, max_z - min_z) 79 91 except: 80 print ' could not find range of '+qname192 print 'Visualisation: could not find range of '+qname1 81 93 pass 82 94 … … 86 98 min_z = min(min(q2)) 87 99 print max_z, min_z 88 self.range_z = max(self.range_z, max_z - min_z)100 range_z = max(range_z, max_z - min_z) 89 101 except: 90 102 print 'Visualisation: could not find range of '+qname2 91 103 pass 92 104 105 self.range_z = max(range_z,self.range_z) 106 93 107 def update_all(self): 94 108 … … 97 111 98 112 def update_timer(self): 99 self.timer.text='Time=%10.5e'%self.domain.time 113 114 if self.domain.visualise_timer == True: 115 self.timer.visible = True 116 self.timer.text='Time=%10.5e'%self.domain.time 100 117 101 118 … … 489 506 490 507 491 def create_surface(domain,scale_z=0.5 ,range_z=None):492 493 surface = Surface(domain,scale_z=0.5,range_z=range_z)494 domain. surface = surface495 496 surface.update_quantity('elevation')497 surface.update_quantity('stage')498 surface.update_timer()508 def create_surface(domain,scale_z=0.5): 509 510 visualiser = Visualiser(domain,scale_z=0.5) 511 domain.visualiser = visualiser 512 513 visualiser.update_quantity('elevation') 514 visualiser.update_quantity('stage') 515 visualiser.update_timer() 499 516 500 517 def update(domain): 501 518 502 surface = domain.surface519 visualiser = domain.visualiser 503 520 if domain.visualise_color_stage: 504 surface.update_quantity_color('stage')521 visualiser.update_quantity_color('stage') 505 522 else: 506 surface.update_quantity('stage')523 visualiser.update_quantity('stage') 507 524 508 525 if domain.visualise_timer: 509 surface.update_timer()526 visualiser.update_timer() -
inundation/ga/storm_surge/pyvolution/shallow_water.py
r1360 r1363 83 83 self.visualise_color_stage = False 84 84 self.visualise_stage_range = 1.0 85 self.visualise_timer = False 85 self.visualise_timer = True 86 self.visualise_range_z = None 86 87 87 88 #Stored output -
inundation/ga/storm_surge/pyvolution/view_tsh.py
r1358 r1363 43 43 print "Number of triangles = ", len(domain) 44 44 45 surface = Surface(domain, scale_z = scale_z) 46 surface.update_quantity('stage') 47 45 visualiser = Visualiser(domain, scale_z = scale_z) 46 visualiser.update_quantity('stage') -
inundation/ga/storm_surge/zeus/anuga-workspace.zwi
r1358 r1363 2 2 <workspace name="anuga-workspace"> 3 3 <mode>Debug</mode> 4 <active> Merimbula</active>4 <active>parallel</active> 5 5 <project name="Merimbula">Merimbula.zpi</project> 6 6 <project name="parallel">parallel.zpi</project> -
inundation/ga/storm_surge/zeus/parallel.zpi
r1282 r1363 74 74 <ReleaseProjectReload>Off</ReleaseProjectReload> 75 75 <file>..\parallel\advection.py</file> 76 <file>..\parallel\parallel_advection.py</file> 76 77 <file>..\parallel\run_advection.py</file> 78 <file>..\parallel\run_parallel_advection.py</file> 77 79 <file>..\parallel\test_advection.py</file> 78 80 <folder name="Header Files" />
Note: See TracChangeset
for help on using the changeset viewer.