Ignore:
Timestamp:
Mar 21, 2006, 2:34:42 PM (18 years ago)
Author:
ole
Message:

Cleanup and comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/shallow_water_ext.c

    r2566 r2567  
    365365  int k;
    366366  double hc;
    367   double u, v, tmp_speed; 
     367  double u, v, reduced_speed; 
    368368
    369369  //Protect against initesimal and negative heights
    370 
    371370  for (k=0; k<N; k++) {
    372371    hc = wc[k] - zc[k];
    373372
    374373    if (hc < minimum_allowed_height) {
    375     //if (1) {
    376       //if (hc < epsilon) {
    377374      if (hc <= 0.0) {
    378375        wc[k] = zc[k]; //Contain 'lost mass' error
     
    380377        ymomc[k] = 0.0;
    381378      } else {
    382         //Try to see if calculated speeds would blow up
     379        //Reduce excessive speeds derived from division by small hc
    383380        //FIXME (Ole): This has not been written in Python
    384381        u = xmomc[k]/hc;
    385382        if (fabs(u) > maximum_allowed_speed) {
    386           tmp_speed = maximum_allowed_speed * u/fabs(u);
    387           //printf("WARNING: Speed (u) has been reduced from %.3f to %.3f\n",
    388           //     u, tmp_speed);
    389           xmomc[k] = tmp_speed * hc;
     383          reduced_speed = maximum_allowed_speed * u/fabs(u);
     384          //printf("Speed (u) has been reduced from %.3f to %.3f\n",
     385          //        u, reduced_speed); 
     386          xmomc[k] = reduced_speed * hc;
    390387        }
    391388       
    392389        v = ymomc[k]/hc;       
    393390        if (fabs(v) > maximum_allowed_speed) {
    394           tmp_speed = maximum_allowed_speed * v/fabs(v);       
    395           //printf("WARNING: Speed (v) has been reduced from %.3f to %.3f\n",   
    396           //     v, maximum_allowed_speed);     
    397           ymomc[k] = tmp_speed * hc;     
     391          reduced_speed = maximum_allowed_speed * v/fabs(v);   
     392          //printf("Speed (v) has been reduced from %.3f to %.3f\n",   
     393          //        v, reduced_speed); 
     394          ymomc[k] = reduced_speed * hc;         
    398395        }       
    399        
    400 
    401396      }
    402397    }
    403 
    404398  }
    405399  return 0;
Note: See TracChangeset for help on using the changeset viewer.