Changeset 3021
- Timestamp:
- May 30, 2006, 4:17:18 PM (19 years ago)
- Location:
- inundation/pyvolution
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/advection.py
r2813 r3021 218 218 219 219 #Update optimal_timestep 220 try: 221 optimal_timestep = min(optimal_timestep, radii[k]/max_speed) 222 except ZeroDivisionError: 223 pass 220 if self.tri_full_flag == 1 : 221 try: 222 optimal_timestep = min(optimal_timestep, radii[k]/max_speed) 223 except ZeroDivisionError: 224 pass 224 225 225 226 #Normalise by area and store for when all conserved … … 275 276 radii = self.radii 276 277 edgelengths = self.edgelengths 278 tri_full_flag = self.tri_full_flag 277 279 278 280 stage_edge = Stage.edge_values … … 333 335 334 336 //Update optimal_timestep 335 if (max_speed != 0.0) { 336 optimal_timestep = (optimal_timestep>radii(k)/max_speed) ? radii(k)/max_speed : optimal_timestep; 337 if (tri_full_flag(k) == 1) { 338 if (max_speed != 0.0) { 339 optimal_timestep = (optimal_timestep>radii(k)/max_speed) ? radii(k)/max_speed : optimal_timestep; 340 } 337 341 } 338 342 … … 351 355 weave.inline(code, ['stage_edge','stage_bdry','stage_update', 352 356 'neighbours','neighbour_edges','normals', 353 'areas','radii','edgelengths','huge_timestep', 357 'areas','radii','edgelengths','tri_full_flag', 358 'huge_timestep', 354 359 'timestep','v1','v2','N'], 355 360 type_converters = converters.blitz, compiler='gcc'); -
inundation/pyvolution/domain.py
r2866 r3021 79 79 verbose=verbose) 80 80 81 if verbose: print 'Initialising Domain' 82 from Numeric import zeros, Float, Int 81 if verbose: print 'Initialising Domain' 82 from Numeric import zeros, Float, Int, ones 83 83 from quantity import Quantity, Conserved_quantity 84 84 … … 117 117 # List of other quantity names 118 118 if ghost_recv_dict is None: 119 self.ghost_recv_dict = []119 self.ghost_recv_dict = {} 120 120 else: 121 121 self.ghost_recv_dict = ghost_recv_dict … … 125 125 126 126 # Setup Communication Buffers 127 127 128 128 if verbose: print 'Domain: Set up communication buffers (parallel)' 129 129 self.nsys = len(self.conserved_quantities) … … 136 136 buffer_shape = self.ghost_recv_dict[key][0].shape[0] 137 137 self.ghost_recv_dict[key].append(zeros( (buffer_shape,self.nsys) ,Float)) 138 139 140 # Setup cell full flag 141 # =1 for full 142 # =0 for ghost 143 N=self.number_of_elements 144 self.tri_full_flag = ones(N, Int) 145 for i in self.ghost_recv_dict.keys(): 146 for id in self.ghost_recv_dict[i][0]: 147 self.tri_full_flag[id] = 0 148 138 149 139 150 #Defaults … … 186 197 self.set_quantity_vertices_dict(vertex_quantity_dict) 187 198 188 199 189 200 if verbose: print 'Domain: Done' 190 201 191 202 192 203 193 204 … … 730 741 self.number_of_steps = 0 731 742 self.number_of_first_order_steps = 0 732 743 733 744 734 745 def evolve_to_end(self, finaltime = 1.0): -
inundation/pyvolution/shallow_water.py
r2814 r3021 549 549 flux -= edgeflux * domain.edgelengths[k,i] 550 550 551 #Update optimal_timestep 552 try: 553 timestep = min(timestep, 0.5*domain.radii[k]/max_speed) 554 except ZeroDivisionError: 555 pass 551 #Update optimal_timestep on full cells 552 if domain.tri_full_flag[k] == 1: 553 try: 554 timestep = min(timestep, 0.5*domain.radii[k]/max_speed) 555 except ZeroDivisionError: 556 pass 556 557 557 558 #Normalise by area and store for when all conserved … … 615 616 domain.radii, 616 617 domain.areas, 618 domain.tri_full_flag, 617 619 Stage.edge_values, 618 620 Xmom.edge_values, -
inundation/pyvolution/shallow_water_ext.c
r2731 r3021 980 980 PyArrayObject *neighbours, *neighbour_edges, 981 981 *normals, *edgelengths, *radii, *areas, 982 *tri_full_flag, 982 983 *stage_edge_values, 983 984 *xmom_edge_values, … … 1004 1005 1005 1006 // Convert Python arguments to C 1006 if (!PyArg_ParseTuple(args, "dddOOOOOOOOOOOOOOOOO ",1007 if (!PyArg_ParseTuple(args, "dddOOOOOOOOOOOOOOOOOO", 1007 1008 ×tep, 1008 1009 &epsilon, … … 1012 1013 &normals, 1013 1014 &edgelengths, &radii, &areas, 1015 &tri_full_flag, 1014 1016 &stage_edge_values, 1015 1017 &xmom_edge_values, … … 1090 1092 //timestep = min(timestep, domain.radii[k]/max_speed) 1091 1093 //FIXME: SR Add parameter for CFL condition 1092 if (max_speed > epsilon) { 1093 timestep = min(timestep, ((double *) radii -> data)[k]/max_speed); 1094 //maxspeed in flux_function is calculated as max(|u+a|,|u-a|) 1095 if (n>=0) 1096 timestep = min(timestep, ((double *) radii -> data)[n]/max_speed); 1097 } 1094 if ( ((long *) tri_full_flag -> data)[k] == 1) { 1095 if (max_speed > epsilon) { 1096 timestep = min(timestep, ((double *) radii -> data)[k]/max_speed); 1097 //maxspeed in flux_function is calculated as max(|u+a|,|u-a|) 1098 if (n>=0) 1099 timestep = min(timestep, ((double *) radii -> data)[n]/max_speed); 1100 } 1101 } 1098 1102 } // end for i 1099 1103 //Normalise by area and store for when all conserved
Note: See TracChangeset
for help on using the changeset viewer.