Changeset 1407
- Timestamp:
- May 17, 2005, 12:02:50 PM (19 years ago)
- Location:
- inundation/ga/storm_surge
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/parallel/advection.py
r1363 r1407 24 24 """ 25 25 26 from realtime_visualisation_new import Visualiser 26 27 from domain import * 27 28 Generic_domain = Domain #Rename … … 48 49 self.visualise_timer = True 49 50 self.visualise_range_z = None 51 50 52 self.smooth = True 51 53 54 55 56 def initialise_visualiser(self,scale_z=1.0): 57 #Realtime visualisation 58 self.visualiser = Visualiser(self,scale_z) 59 self.visualise = True 52 60 53 61 … … 180 188 if self.visualise is True and self.time == 0.0: 181 189 import realtime_visualisation_new as visualise 182 visualise.create_surface(self) 190 self.visualiser.update_quantity('stage') 191 self.visualiser.update_timer() 183 192 184 193 #Call basic machinery from parent class … … 186 195 #Real time viz 187 196 if self.visualise is True: 188 visualise.update(self) 197 self.visualiser.update_quantity('stage') 198 self.visualiser.update_timer() 189 199 190 200 #Pass control on to outer loop for more specific actions -
inundation/ga/storm_surge/parallel/parallel_advection.py
r1402 r1407 17 17 Advection_Domain = Domain 18 18 from Numeric import zeros, Float, Int, ones 19 import pypar 20 19 21 20 22 class Parallel_Domain(Advection_Domain): 21 23 22 def __init__(self, coordinates, vertices, boundary = None, ghosts = None, velocity = None ):24 def __init__(self, coordinates, vertices, boundary = None, ghosts = None, velocity = None, processor=0): 23 25 24 26 Advection_Domain.__init__(self, coordinates, vertices, boundary, velocity) 25 27 26 28 N = self.number_of_elements 29 30 self.processor = processor 27 31 28 32 if ghosts == None: … … 36 40 self.full[key] = -1 37 41 42 43 44 38 45 def check_integrity(self): 39 46 Advection_Domain.check_integrity(self) … … 41 48 msg = 'Will need to check global and local numbering' 42 49 assert self.conserved_quantities[0] == 'stage', msg 50 51 52 53 def update_timestep(self, yieldstep, finaltime): 54 Advection_Domain.update_timestep(self, yieldstep, finaltime) 55 56 timestep = 0.0 57 pypar.raw_reduce(self.timestep,timestep,pypar.MIN,0) 58 print 'Processor %d, Timestep %.4f'%(self.processor,timestep) 59 60 43 61 44 62 … … 49 67 stage_cv[triangle] = stage_cv[self.ghosts[triangle]] 50 68 69 70 def write_time(self): 71 if self.min_timestep == self.max_timestep: 72 print 'Processor %d, Time = %.4f, delta t = %.8f, steps=%d (%d)'\ 73 %(self.processor, self.time, self.min_timestep, self.number_of_steps, 74 self.number_of_first_order_steps) 75 elif self.min_timestep > self.max_timestep: 76 print 'Processor %d, Time = %.4f, steps=%d (%d)'\ 77 %(self.processor, self.time, self.number_of_steps, 78 self.number_of_first_order_steps) 79 else: 80 print 'Processor %d, Time = %.4f, delta t in [%.8f, %.8f], steps=%d (%d)'\ 81 %(self.processor, self.time, self.min_timestep, 82 self.max_timestep, self.number_of_steps, 83 self.number_of_first_order_steps) 84 85 86 51 87 def evolve(self, yieldstep = None, finaltime = None): 52 88 """Specialisation of basic evolve method from parent class … … 54 90 55 91 #Initialise real time viz if requested 56 if self.visualise is True and self.time == 0.0: 57 import realtime_visualisation_new as visualise 58 self.visualiser = visualise.Visualiser(self) 92 if self.time == 0.0: 93 pass 59 94 60 95 #Call basic machinery from parent class 61 96 for t in Advection_Domain.evolve(self, yieldstep, finaltime): 62 #Real time viz63 if self.visualise is True:64 self.visualiser.update_quantity('stage')65 97 66 98 #Pass control on to outer loop for more specific actions -
inundation/ga/storm_surge/parallel/run_parallel_advection.py
r1404 r1407 9 9 from Numeric import array 10 10 11 import pypar 12 13 numprocs = pypar.size() 14 myid = pypar.rank() 15 processor_name = pypar.Get_processor_name() 16 11 17 N = 30 12 18 M = 30 … … 15 21 16 22 #Create advection domain with direction (1,-1) 17 domain = Parallel_Domain(points, vertices, boundary, ghosts, velocity=[1.0, 0.0] )23 domain = Parallel_Domain(points, vertices, boundary, ghosts, velocity=[1.0, 0.0],processor = myid) 18 24 19 25 # Initial condition is zero by default 20 26 21 domain.visualise = True 22 #domain.visualise_range_z = 1.0 23 27 domain.initialise_visualiser() 24 28 25 29 #Boundaries -
inundation/ga/storm_surge/pyvolution/realtime_visualisation_new.py
r1387 r1407 6 6 7 7 class Visualiser: 8 8 9 def __init__(self,domain,scale_z=1.0): 9 10 """Create visualisation of domain … … 20 21 self.z_models = {} 21 22 keys = self.domain.quantities.keys() 22 #print keys23 print keys 23 24 for key in keys: 24 25 self.z_models[key] = faces(frame= self.frame) 25 26 26 27 print self.z_models 27 28 28 29 self.max_x = max(max(self.vertices[:,0]),max(self.vertices[:,2]),max(self.vertices[:,4])) … … 55 56 #print 'keys',self.domain.quantities.keys() 56 57 #print 'shape of stage',shape(self.stage) 58 59 setup_scene() 57 60 58 61 self.border_model = curve(frame = self.frame, … … 486 489 type_converters = converters.blitz, compiler='gcc'); 487 490 488 scene.width = 1000 489 scene.height = 800 490 491 #Original 492 scene.center = (0.5,0.5,0.0) 493 scene.forward = vector(-0.0, 0.5, -0.8) 494 495 #Temporary (for bedslope) 496 #scene.forward = vector(0.0006, 0.7, -0.03) 497 498 499 #Temporary for hackett - begin 500 #scene.autoscale = 0 501 #scene.scale = (0.002, 0.002, 0.01) #Scale z so that countours stand out more 502 #scene.center = (300.0,500.0,-10) 503 #Temporary for hackett - end 504 505 506 scene.ambient = 0.4 507 #scene.lights = [(0.6, 0.3, 0.2), (0.1, -0.5, 0.4), (-0.1, 0.1, -0.4), 508 # (-0.2, 0.2, 0.1)] 509 510 scene.lights = [(0.6, 0.3, 0.2), (0.1, -0.5, 0.4)] 511 512 513 514 def create_surface(domain,scale_z=0.5): 515 516 visualiser = Visualiser(domain,scale_z=0.5) 491 492 def setup_scene(): 493 494 from visual import * 495 #scene.width = 1000 496 #scene.height = 800 497 498 #Original 499 scene.center = (0.5,0.5,0.0) 500 scene.forward = vector(-0.0, 0.5, -0.8) 501 502 #Temporary (for bedslope) 503 #scene.forward = vector(0.0006, 0.7, -0.03) 504 505 506 #Temporary for hackett - begin 507 #scene.autoscale = 0 508 #scene.scale = (0.002, 0.002, 0.01) #Scale z so that countours stand out more 509 #scene.center = (300.0,500.0,-10) 510 #Temporary for hackett - end 511 512 513 scene.ambient = 0.4 514 #scene.lights = [(0.6, 0.3, 0.2), (0.1, -0.5, 0.4), (-0.1, 0.1, -0.4), 515 # (-0.2, 0.2, 0.1)] 516 517 scene.lights = [(0.6, 0.3, 0.2), (0.1, -0.5, 0.4)] 518 519 520 521 def create_surface(domain,scale_z=1.0): 522 523 visualiser = Visualiser(domain,scale_z) 517 524 domain.visualiser = visualiser 518 525 … … 529 536 visualiser.update_quantity('stage') 530 537 531 if domain.visualise_timer: 532 visualiser.update_timer() 538 visualiser.update_timer()
Note: See TracChangeset
for help on using the changeset viewer.