Changeset 2814
- Timestamp:
- May 5, 2006, 9:26:06 PM (19 years ago)
- Location:
- inundation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/parallel/run_parallel_sw_rectangle.py
r2813 r2814 39 39 processor_name = pypar.Get_processor_name() 40 40 41 M = 2 041 M = 22 42 42 N = M*numprocs 43 43 -
inundation/pyvolution/domain.py
r2813 r2814 21 21 22 22 23 def __init__(self, source=None, 23 def __init__(self, 24 source=None, 24 25 triangles=None, 25 26 boundary=None, 26 conserved_quantities=None, other_quantities=None, 27 tagged_elements=None, geo_reference=None, 27 conserved_quantities=None, 28 other_quantities=None, 29 tagged_elements=None, 30 geo_reference=None, 28 31 use_inscribed_circle=False, 29 32 mesh_filename=None, 30 33 use_cache=False, 31 verbose=False 32 ): 33 34 verbose=False, 35 full_send_dict=None, 36 ghost_recv_dict=None, 37 processor=0, 38 numproc=1): 39 40 34 41 """Instantiate generic computational Domain. 35 42 36 43 Input: 37 44 source: Either a mesh filename or coordinates of mesh vertices. … … 48 55 ... 49 56 50 57 51 58 """ 52 59 … … 58 65 59 66 60 # In case a filename has been specified, extract content 67 # In case a filename has been specified, extract content 61 68 if mesh_filename is not None: 62 69 coordinates, triangles, boundary, vertex_quantity_dict, \ … … 66 73 verbose=verbose) 67 74 68 69 # Initialise underlying mesh structure 75 76 # Initialise underlying mesh structure 70 77 Mesh.__init__(self, coordinates, triangles, boundary, 71 78 tagged_elements, geo_reference, use_inscribed_circle) … … 100 107 self.forcing_terms = [] 101 108 109 #Setup the ghost cell communication 110 if full_send_dict is None: 111 self.full_send_dict = {} 112 else: 113 self.full_send_dict = full_send_dict 114 115 # List of other quantity names 116 if ghost_recv_dict is None: 117 self.ghost_recv_dict = [] 118 else: 119 self.ghost_recv_dict = ghost_recv_dict 120 121 self.processor = processor 122 self.numproc = numproc 123 124 # Setup Communication Buffers 125 self.nsys = len(self.conserved_quantities) 126 for key in self.full_send_dict: 127 buffer_shape = self.full_send_dict[key][0].shape[0] 128 self.full_send_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float)) 129 130 131 for key in self.ghost_recv_dict: 132 buffer_shape = self.ghost_recv_dict[key][0].shape[0] 133 self.ghost_recv_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float)) 102 134 103 135 #Defaults … … 247 279 #Assign values 248 280 self.quantities[name].set_values(*args, **kwargs) 249 281 250 282 251 283 def get_quantity(self, name, location='vertices', indices = None): … … 662 694 #Yield results 663 695 if finaltime is not None and abs(self.time - finaltime) < epsilon: 664 #FIXME (Ole): I don't like the the epsilon test, finaltime may not 696 #FIXME (Ole): I don't like the the epsilon test, finaltime may not 665 697 #be reached, as evolve will stop within one epsilon from finaltime 666 698 #if finaltime is not None and self.time >= finaltime: 667 699 668 700 #FIXME: There is a rare situation where the 669 701 #final time step is stored twice. Can we make a test? 670 702 #FIXME (Ole, 30 April 2006): This is an attempt to fix that 671 703 672 704 #if self.time > finaltime: 673 705 # #FIXME (Ole, 30 April 2006): Do we need this check? 674 706 # print 'WARNING (domain.py): time overshot finaltime' 675 707 # self.time = finaltime 676 708 677 709 # Yield final time and stop 678 710 #print 'finaltime %.18f' %self.time … … 684 716 #if self.yieldtime >= yieldstep: 685 717 # Yield (intermediate) time and allow inspection of domain 686 718 687 719 #if self.yieldtime > yieldstep: 688 720 # #FIXME (Ole, 30 April 2006): Do we need this check? 689 721 # print 'WARNING (domain.py): yieldtime overshot yielstep' 690 # self.yieldtime = yieldstep 722 # self.yieldtime = yieldstep 691 723 692 724 if self.checkpoint is True: … … 695 727 696 728 #Pass control on to outer loop for more specific actions 697 #print 'yieldtime %.18f' %self.time 729 #print 'yieldtime %.18f' %self.time 698 730 yield(self.time) 699 700 if finaltime is not None and abs(self.time - finaltime) < epsilon: 701 # FIXME (Ole, 30 April 2006): Maybe this will remove 702 # duplicate final timesteps? 731 732 if finaltime is not None and abs(self.time - finaltime) < epsilon: 733 # FIXME (Ole, 30 April 2006): Maybe this will remove 734 # duplicate final timesteps? 703 735 # What we really need is to go back to conditions like 704 736 # if finaltime is not None and self.time >= finaltime: 705 # as above and then understand fully 737 # as above and then understand fully 706 738 # the two tests that break as a consequence 707 739 break 708 740 709 741 # Reinitialise 710 742 self.yieldtime = 0.0 -
inundation/pyvolution/shallow_water.py
r2812 r2814 69 69 class Domain(Generic_Domain): 70 70 71 def __init__(self, coordinates=None, vertices=None, boundary=None, 72 tagged_elements=None, geo_reference=None, 71 def __init__(self, 72 coordinates=None, 73 vertices=None, 74 boundary=None, 75 tagged_elements=None, 76 geo_reference=None, 73 77 use_inscribed_circle=False, 74 78 mesh_filename=None, 75 79 use_cache=False, 76 verbose=False): 80 verbose=False, 81 full_send_dict=None, 82 ghost_recv_dict=None, 83 processor=0, 84 numproc=1): 85 77 86 78 87 conserved_quantities = ['stage', 'xmomentum', 'ymomentum'] 79 88 other_quantities = ['elevation', 'friction'] 80 Generic_Domain.__init__(self, coordinates, vertices, boundary, 81 conserved_quantities, other_quantities, 82 tagged_elements, geo_reference, 83 use_inscribed_circle, mesh_filename, 84 use_cache, verbose) 89 Generic_Domain.__init__(self, 90 coordinates, 91 vertices, 92 boundary, 93 conserved_quantities, 94 other_quantities, 95 tagged_elements, 96 geo_reference, 97 use_inscribed_circle, 98 mesh_filename, 99 use_cache, 100 verbose, 101 full_send_dict, 102 ghost_recv_dict, 103 processor, 104 numproc) 105 85 106 86 107 from config import minimum_allowed_height, maximum_allowed_speed, g … … 107 128 108 129 self.quantities_to_be_stored = ['stage','xmomentum','ymomentum'] 109 130 110 131 111 132 def set_store_vertices_uniquely(self, flag, reduction=None): 112 133 """Decide whether vertex values should be stored uniquely as 113 134 computed in the model or whether they should be reduced to one 114 value per vertex using self.reduction. 135 value per vertex using self.reduction. 115 136 """ 116 137 self.smooth = not flag … … 120 141 self.reduction = mean 121 142 #self.reduction = min #Looks better near steep slopes 122 123 124 143 144 145 125 146 126 147 def set_quantities_to_be_stored(self, q):
Note: See TracChangeset
for help on using the changeset viewer.