Changeset 2632 for inundation/pyvolution/shallow_water_ext.c
- Timestamp:
- Mar 29, 2006, 4:33:30 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/shallow_water_ext.c
r2621 r2632 246 246 if (h >= eps) { 247 247 S = -g * eta[k]*eta[k] * sqrt((uh[k]*uh[k] + vh[k]*vh[k])); 248 //S /= pow(h, 7.0/3); //Expensive (on Ole's home computer)249 S /= exp(7.0/3.0*log(h)); //seems to save about 15% over manning_friction248 S /= pow(h, 7.0/3); //Expensive (on Ole's home computer) 249 //S /= exp(7.0/3.0*log(h)); //seems to save about 15% over manning_friction 250 250 //S /= h*h*(1 + h/3.0 - h*h/9.0); //FIXME: Could use a Taylor expansion 251 251 … … 372 372 373 373 if (hc < minimum_allowed_height) { 374 375 //Old code: Set momentum to zero and ensure h is non negative 376 /* 377 xmomc[k] = 0.0; 378 ymomc[k] = 0.0; 379 //wc[k] = zc[k]; 380 if (hc <= 0.0) wc[k] = zc[k]; 381 */ 382 383 //New code: Adjust momentum to guarantee speeds are physical 384 // ensure h is non negative 385 374 386 if (hc <= 0.0) { 375 wc[k] = zc[k]; //Contain 'lost mass' error387 wc[k] = zc[k]; 376 388 xmomc[k] = 0.0; 377 389 ymomc[k] = 0.0; … … 383 395 reduced_speed = maximum_allowed_speed * u/fabs(u); 384 396 //printf("Speed (u) has been reduced from %.3f to %.3f\n", 385 // 397 // u, reduced_speed); 386 398 xmomc[k] = reduced_speed * hc; 387 399 } … … 391 403 reduced_speed = maximum_allowed_speed * v/fabs(v); 392 404 //printf("Speed (v) has been reduced from %.3f to %.3f\n", 393 // 405 // v, reduced_speed); 394 406 ymomc[k] = reduced_speed * hc; 395 407 } 396 408 } 397 398 //Old code399 //wc[k] = zc[k]; //Contain 'lost mass' error400 //printf("Speed has been reduced to %.3f\n", 0.0);401 //xmomc[k] = 0.0;402 //ymomc[k] = 0.0;403 409 } 404 410 }
Note: See TracChangeset
for help on using the changeset viewer.