Changeset 4200
- Timestamp:
- Jan 31, 2007, 12:07:32 PM (18 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py
r4020 r4200 4 4 5 5 Copyright 2004 6 Ole Nielsen, Stephen Roberts, Duncan Gray , Christopher Zoppou6 Ole Nielsen, Stephen Roberts, Duncan Gray 7 7 Geoscience Australia 8 8 """ 9 9 10 from Numeric import allclose 10 from Numeric import allclose, argmax 11 11 from anuga.config import epsilon 12 12 … … 216 216 self.already_computed_flux = zeros((N, 3), Int) 217 217 218 # Storage for maximal speeds computed for each triangle by compute_fluxes 219 # This is used for diagnostics only 220 self.max_speed = zeros(N, Float) 221 218 222 if mesh_filename is not None: 219 223 # If the mesh file passed any quantity values … … 546 550 ##assert hasattr(self, 'boundary_objects') 547 551 548 def write_time(self ):549 print self.timestepping_statistics( )550 551 552 def timestepping_statistics(self ):552 def write_time(self, track_location=False): 553 print self.timestepping_statistics(track_location) 554 555 556 def timestepping_statistics(self, track_location=False): 553 557 """Return string with time stepping statistics for printing or logging 558 559 Optional boolean keyword track_location decides whether to report location of smallest timestep. 554 560 """ 555 561 … … 568 574 self.max_timestep, self.number_of_steps, 569 575 self.number_of_first_order_steps) 576 577 if track_location is True: 578 msg += '\n' 579 # Find index of largest computed flux speed 580 i = argmax(self.max_speed) 581 582 x, y = self.get_centroid_coordinates()[i] 583 584 s = 'Triangle #%d with centroid (%.4f, %.4f) ' %(i, x, y) 585 s += 'had the largest computed speed: %.4f m/s' %(self.max_speed[i]) 586 587 # FIXME (Ole): Maybe add all quantity values at vertices 588 589 msg += s 570 590 571 591 return msg -
anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py
r3945 r4200 616 616 v1 = [x2-x1, y2-y1] 617 617 v2 = [x0-x2, y0-y2] 618 619 618 a0 = anglediff(v1, v0) 620 619 a1 = anglediff(v2, v1) -
anuga_core/source/anuga/abstract_2d_finite_volumes/show_balanced_limiters.py
r4026 r4200 82 82 #Evolve 83 83 for t in domain.evolve(yieldstep = 0.1, finaltime = 30): 84 domain.write_time( )84 domain.write_time(track_location=True) 85 85 domain.write_boundary_statistics(['stage'],'left') 86 86 -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r4085 r4200 780 780 Xmom.explicit_update[k] = flux[1] 781 781 Ymom.explicit_update[k] = flux[2] 782 domain.max_speed[k] = max_speed 782 783 783 784 … … 832 833 833 834 domain.timestep = compute_fluxes_ext(timestep, domain.epsilon, domain.g, 834 domain.neighbours, 835 domain.neighbour_edges, 836 domain.normals, 837 domain.edgelengths, 838 domain.radii, 839 domain.areas, 840 domain.tri_full_flag, 841 Stage.edge_values, 842 Xmom.edge_values, 843 Ymom.edge_values, 844 Bed.edge_values, 845 Stage.boundary_values, 846 Xmom.boundary_values, 847 Ymom.boundary_values, 848 Stage.explicit_update, 849 Xmom.explicit_update, 850 Ymom.explicit_update, 851 domain.already_computed_flux) 835 domain.neighbours, 836 domain.neighbour_edges, 837 domain.normals, 838 domain.edgelengths, 839 domain.radii, 840 domain.areas, 841 domain.tri_full_flag, 842 Stage.edge_values, 843 Xmom.edge_values, 844 Ymom.edge_values, 845 Bed.edge_values, 846 Stage.boundary_values, 847 Xmom.boundary_values, 848 Ymom.boundary_values, 849 Stage.explicit_update, 850 Xmom.explicit_update, 851 Ymom.explicit_update, 852 domain.already_computed_flux, 853 domain.max_speed) 852 854 853 855 -
anuga_core/source/anuga/shallow_water/shallow_water_ext.c
r4191 r4200 1217 1217 *xmom_explicit_update, 1218 1218 *ymom_explicit_update, 1219 *already_computed_flux ;//tracks whether the flux across an edge has already been computed1220 1219 *already_computed_flux,//tracks whether the flux across an edge has already been computed 1220 *max_speed_array; //Keeps track of max speeds for each triangle 1221 1221 1222 1222 //Local variables … … 1231 1231 1232 1232 // Convert Python arguments to C 1233 if (!PyArg_ParseTuple(args, "dddOOOOOOOOOOOOOOOOOO ",1233 if (!PyArg_ParseTuple(args, "dddOOOOOOOOOOOOOOOOOOO", 1234 1234 ×tep, 1235 1235 &epsilon, … … 1250 1250 &xmom_explicit_update, 1251 1251 &ymom_explicit_update, 1252 &already_computed_flux)) { 1252 &already_computed_flux, 1253 &max_speed_array)) { 1253 1254 PyErr_SetString(PyExc_RuntimeError, "Input arguments failed"); 1254 1255 return NULL; … … 1261 1262 ((double *) stage_explicit_update -> data)[k]=0.0; 1262 1263 ((double *) xmom_explicit_update -> data)[k]=0.0; 1263 ((double *) ymom_explicit_update -> data)[k]=0.0; 1264 } 1264 ((double *) ymom_explicit_update -> data)[k]=0.0; 1265 } 1266 1265 1267 //Loop through neighbours and compute edge flux for each 1266 1268 for (k=0; k<number_of_elements; k++) { … … 1327 1329 } 1328 1330 } // end for i 1331 1329 1332 //Normalise by area and store for when all conserved 1330 1333 //quantities get updated … … 1332 1335 ((double *) xmom_explicit_update -> data)[k] /= ((double *) areas -> data)[k]; 1333 1336 ((double *) ymom_explicit_update -> data)[k] /= ((double *) areas -> data)[k]; 1337 1338 1339 //Keep track of maximal speeds 1340 ((double *) max_speed_array -> data)[k] = max_speed; 1341 1334 1342 } //end for k 1335 1343 return Py_BuildValue("d", timestep);
Note: See TracChangeset
for help on using the changeset viewer.