Changeset 4730
 Timestamp:
 Sep 12, 2007, 10:59:02 AM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/shallow_water/shallow_water_ext.c
r4729 r4730 1259 1259 1260 1260 PyObject *extrapolate_second_order_sw(PyObject *self, PyObject *args) { 1261 /*Compute the vertex values based on a linear reconstruction on each triangle 1261 /*Compute the vertex values based on a linear reconstruction 1262 on each triangle 1263 1262 1264 These values are calculated as follows: 1263 1) For each triangle not adjacent to a boundary, we consider the auxiliary triangle 1264 formed by the centroids of its three neighbours. 1265 2) For each conserved quantity, we integrate around the auxiliary triangle's boundary the product 1266 of the quantity and the outward normal vector. Dividing by the triangle area gives (a,b), the average 1267 of the vector (q_x,q_y) on the auxiliary triangle. We suppose that the linear reconstruction on the 1268 original triangle has gradient (a,b). 1269 3) Provisional vertex jumps dqv[0,1,2] are computed and these are then limited by calling the functions 1270 find_qmin_and_qmax and limit_gradient 1265 1) For each triangle not adjacent to a boundary, we consider the 1266 auxiliary triangle formed by the centroids of its three 1267 neighbours. 1268 2) For each conserved quantity, we integrate around the auxiliary 1269 triangle's boundary the product of the quantity and the outward 1270 normal vector. Dividing by the triangle area gives (a,b), the 1271 average of the vector (q_x,q_y) on the auxiliary triangle. 1272 We suppose that the linear reconstruction on the original 1273 triangle has gradient (a,b). 1274 3) Provisional vertex jumps dqv[0,1,2] are computed and these are 1275 then limited by calling the functions find_qmin_and_qmax and 1276 limit_gradient 1271 1277 1272 1278 Python call: … … 1283 1289 1284 1290 Post conditions: 1285 The vertices of each triangle have values from a limited linear reconstruction 1291 The vertices of each triangle have values from a 1292 limited linear reconstruction 1286 1293 based on centroid values 1287 1294 … … 1325 1332 &optimise_dry_cells)) { 1326 1333 1327 PyErr_SetString(PyExc_RuntimeError, "Input arguments to extrapolate_second_order_sw failed"); 1334 PyErr_SetString(PyExc_RuntimeError, 1335 "Input arguments to extrapolate_second_order_sw failed"); 1328 1336 return NULL; 1329 1337 } 1330 1338 1331 // FIXME (Ole): Investigate if it is quicker to obtain all input arguments using GetAttrString rather than ParseTuple.1332 // It certainly looked as if passing domain.epsilon is slowed things down1333 1334 // Get the safety factor beta_w, set in the config.py file. This is used in the limiting process1339 // Get the safety factor beta_w, set in the config.py file. 1340 // This is used in the limiting process 1341 1342 1335 1343 Tmp = PyObject_GetAttrString(domain, "beta_w"); 1336 1344 if (!Tmp) { … … 1396 1404 epsilon = PyFloat_AsDouble(Tmp); 1397 1405 Py_DECREF(Tmp); 1398 1406 1407 1399 1408 // Call underlying computational routine 1400 1409 number_of_elements = stage_centroid_values > dimensions[0]; … … 1511 1520 } 1512 1521 1513 // FIXME (Ole): Investigate if it is quicker to obtain all input arguments using GetAttrString rather than ParseTuple.1514 // It certainly looked as if passing domain.epsilon is slowed things down1515 1522 1516 1523 // Get the safety factor beta_w, set in the config.py file. This is used in the limiting process … … 2253 2260 H0, 2254 2261 g, 2255 (long*) neighbours > data, 2262 (long*) neighbours > data, 2256 2263 (long*) neighbour_edges > data, 2257 2264 (double*) normals > data, 2258 2265 (double*) edgelengths > data, 2259 (double*) radii 2260 (double*) areas 2266 (double*) radii > data, 2267 (double*) areas > data, 2261 2268 (long*) tri_full_flag > data, 2262 2269 (double*) stage_edge_values > data, … … 2267 2274 (double*) xmom_boundary_values > data, 2268 2275 (double*) ymom_boundary_values > data, 2269 (double*) stage_explicit_update > data, 2276 (double*) stage_explicit_update > data, 2270 2277 (double*) xmom_explicit_update > data, 2271 2278 (double*) ymom_explicit_update > data, … … 2782 2789 } 2783 2790 2791 2792 // FIXME (Ole): I tested this without GetAttrString and got time down 2793 // marginally from 4.0s to 3.8s. Consider passing everything in 2794 // through ParseTuple and profile. 2795 2784 2796 // Pull out parameters 2785 2797 Tmp = PyObject_GetAttrString(domain, "alpha_balance"); … … 2808 2820 tight_slope_limiters = PyInt_AsLong(Tmp); 2809 2821 Py_DECREF(Tmp); 2810 2811 2812 2822 2823 2824 2825 //alpha_balance = 2.0; 2826 //H0 = 0.001; 2827 //tight_slope_limiters = 1; 2813 2828 2814 2829 N = wc > dimensions[0];
Note: See TracChangeset
for help on using the changeset viewer.