Ignore:
Timestamp:
Jul 25, 2005, 4:48:54 PM (20 years ago)
Author:
ole
Message:

Fixed 'lost mass' conservation problem and added unit test, that reveals it.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/shallow_water_ext.c

    r1594 r1636  
    279279int _protect(int N,
    280280             double minimum_allowed_height,
     281             double epsilon,
    281282             double* wc,
    282283             double* zc,
     
    293294
    294295    if (hc < minimum_allowed_height) {
    295       wc[k] = zc[k];
     296      if (hc < epsilon) wc[k] = zc[k]; //Contain 'lost mass' error
    296297      xmomc[k] = 0.0;
    297298      ymomc[k] = 0.0;
     
    301302  return 0;
    302303}
    303 
    304 
    305 
    306 
    307304
    308305
     
    670667
    671668  int N;
    672   double minimum_allowed_height;
     669  double minimum_allowed_height, epsilon;
    673670
    674671  // Convert Python arguments to C
    675   if (!PyArg_ParseTuple(args, "dOOOO",
     672  if (!PyArg_ParseTuple(args, "ddOOOO",
    676673                        &minimum_allowed_height,
     674                        &epsilon,
    677675                        &wc, &zc, &xmomc, &ymomc))
    678676    return NULL;
     
    682680  _protect(N,
    683681           minimum_allowed_height,
     682           epsilon,
    684683           (double*) wc -> data,
    685684           (double*) zc -> data,
Note: See TracChangeset for help on using the changeset viewer.