- Timestamp:
- Aug 28, 2007, 2:23:35 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/shallow_water_ext.c
r4682 r4685 245 245 soundspeed_right = sqrt(g*h_right); 246 246 247 248 247 s_max = max(u_left+soundspeed_left, u_right+soundspeed_right); 249 248 if (s_max < 0.0) s_max = 0.0; 250 249 251 250 s_min = min(u_left-soundspeed_left, u_right-soundspeed_right); 252 if (s_min > 0.0) s_min = 0.0; 253 251 if (s_min > 0.0) s_min = 0.0; 252 253 254 254 //Flux formulas 255 255 flux_left[0] = u_left*h_left; … … 261 261 flux_right[2] = u_right*vh_right; 262 262 263 263 264 264 265 //Flux computation 265 266 denom = s_max-s_min; … … 1281 1282 Xmom.explicit_update, 1282 1283 Ymom.explicit_update, 1283 already_computed_flux) 1284 already_computed_flux, 1285 optimise_dry_cells) 1284 1286 1285 1287 … … 1308 1310 *max_speed_array; //Keeps track of max speeds for each triangle 1309 1311 1312 1310 1313 // Local variables 1311 1314 double timestep, max_speed, epsilon, g, H0, length, area; 1315 int optimise_dry_cells=0; // Optimisation flag 1312 1316 double normal[2], ql[3], qr[3], zl, zr; 1313 1317 double edgeflux[3]; // Work array for summing up fluxes 1314 1318 1315 int number_of_elements, k, i, j, m, n, computation_needed; 1319 int number_of_elements, k, i, m, n; //, j, computation_needed; 1320 1316 1321 int ki, nm=0, ki2; // Index shorthands 1317 1322 static long call=1; // Static local variable flagging already computed flux … … 1319 1324 1320 1325 // Convert Python arguments to C 1321 if (!PyArg_ParseTuple(args, "ddddOOOOOOOOOOOOOOOOOOO ",1326 if (!PyArg_ParseTuple(args, "ddddOOOOOOOOOOOOOOOOOOOi", 1322 1327 ×tep, 1323 1328 &epsilon, … … 1340 1345 &ymom_explicit_update, 1341 1346 &already_computed_flux, 1342 &max_speed_array)) { 1347 &max_speed_array, 1348 &optimise_dry_cells)) { 1343 1349 PyErr_SetString(PyExc_RuntimeError, "Input arguments failed"); 1344 1350 return NULL; 1345 1351 } 1352 1346 1353 1347 1354 number_of_elements = stage_edge_values -> dimensions[0]; … … 1367 1374 // We've already computed the flux across this edge 1368 1375 continue; 1376 1369 1377 1370 1378 ql[0] = ((double *) stage_edge_values -> data)[ki]; … … 1393 1401 1394 1402 1395 // Check if flux calculation is necessary across this edge 1396 // FIXME (Ole): Work in progress! 1397 computation_needed = 0; 1398 //for (j=0; j<3; j++) { 1399 //if (ql[j] != qr[j]) computation_needed = 1; 1400 //} 1401 1402 //if (computation_needed == 0) { 1403 //printf("flux exemption identified\n"); 1403 if (optimise_dry_cells) { 1404 // Check if flux calculation is necessary across this edge 1405 // This check will exclude dry cells. 1406 // This will also optimise cases where zl != zr as 1407 // long as both are dry 1408 1409 if ( fabs(ql[0] - zl) < epsilon && 1410 fabs(qr[0] - zr) < epsilon ) { 1411 // Cell boundary is dry 1412 1413 ((long *) already_computed_flux -> data)[ki] = call; // #k Done 1414 if (n>=0) 1415 ((long *) already_computed_flux -> data)[nm] = call; // #n Done 1404 1416 1405 //((long *) already_computed_flux -> data)[ki] = call; // #k Done 1406 //if (n>=0) 1407 // ((long *) already_computed_flux -> data)[nm] = call; // #n Done 1408 1409 //max_speed = 0.0; 1410 //continue; 1411 //} 1417 max_speed = 0.0; 1418 continue; 1419 } 1420 } 1412 1421 1413 1422 … … 1459 1468 } 1460 1469 } 1470 1461 1471 } // End edge i 1462 1472
Note: See TracChangeset
for help on using the changeset viewer.