[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203

Stephane Popinet s.popinet at niwa.co.nz
Fri May 15 02:52:35 UTC 2009


The following commit has been merged in the upstream branch:
commit 86eedb833ebbf8ccf606b5f2718686a4eb36a24a
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Wed Sep 14 11:25:43 2005 +1000

    EventFilter takes a time scale as extra argument
    
    Exponential filtering with the given timescale is used rather than
    discrete full filtering.
    
    darcs-hash:20050914012543-fbd8f-8ab67f1a415b5ff5f11ba05c196e23e875c20582.gz

diff --git a/src/event.c b/src/event.c
index abd2b3a..c406be6 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1821,7 +1821,9 @@ static void filter (FttCell * cell, GfsEventFilter * f)
 
 static void filtered (FttCell * cell, GfsEventFilter * f)
 {
-  GFS_VARIABLE (cell, f->v->i) = GFS_VARIABLE (cell, f->tmp->i);
+  gdouble dt = gfs_object_simulation (f)->advection_params.dt/f->scale;
+  GFS_VARIABLE (cell, f->v->i) = ((1. - dt)*GFS_VARIABLE (cell, f->v->i) +
+				  dt*GFS_VARIABLE (cell, f->tmp->i));
 }
 
 static gboolean gfs_event_filter_event (GfsEvent * event, GfsSimulation * sim)
@@ -1863,6 +1865,16 @@ static void gfs_event_filter_read (GtsObject ** o, GtsFile * fp)
     return;
   }
   gts_file_next_token (fp);
+  
+  if (fp->type != GTS_INT && fp->type != GTS_FLOAT) {
+    gts_file_error (fp, "expecting a number (time scale)");
+    return;
+  }
+  if ((GFS_EVENT_FILTER (*o)->scale = atof (fp->token->str)) <= 0.) {
+    gts_file_error (fp, "time scale must be strictly positive");
+    return;
+  }  
+  gts_file_next_token (fp);
 }
 
 static void gfs_event_filter_write (GtsObject * o, FILE * fp)
@@ -1870,7 +1882,7 @@ static void gfs_event_filter_write (GtsObject * o, FILE * fp)
   if (GTS_OBJECT_CLASS (gfs_event_filter_class ())->parent_class->write)
     (* GTS_OBJECT_CLASS (gfs_event_filter_class ())->parent_class->write) 
       (o, fp);
-  fprintf (fp, " %s", GFS_EVENT_FILTER (o)->v->name);
+  fprintf (fp, " %s %g", GFS_EVENT_FILTER (o)->v->name, GFS_EVENT_FILTER (o)->scale);
 }
 
 static void gfs_event_filter_class_init (GfsEventClass * klass)
diff --git a/src/event.h b/src/event.h
index 30d58df..82e4675 100644
--- a/src/event.h
+++ b/src/event.h
@@ -309,6 +309,7 @@ struct _GfsEventFilter {
 
   /*< public >*/
   GfsVariable * v;
+  gdouble scale;
 };
 
 #define GFS_EVENT_FILTER(obj)            GTS_OBJECT_CAST (obj,\
diff --git a/src/init.c b/src/init.c
index 0489c1e..dbdc788 100644
--- a/src/init.c
+++ b/src/init.c
@@ -200,6 +200,7 @@ void gfs_init (int * argc, char *** argv)
         gfs_source_hydrostatic_class ();
     gfs_remove_droplets_class ();
     gfs_remove_ponds_class ();
+    gfs_event_filter_class ();
    
     gfs_output_class ();
       gfs_output_time_class ();

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list