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

Stephane Popinet popinet at users.sf.net
Fri May 15 02:53:32 UTC 2009


The following commit has been merged in the upstream branch:
commit b4ecb3222b230e9b667b623da43ba9fbc85cfed8
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Sat Jan 28 22:36:29 2006 +1100

    Source terms have a new generic stability() method
    
    darcs-hash:20060128113629-d4795-1b419dec76fba368632f6c7f9db7645d3f3931a0.gz

diff --git a/src/simulation.c b/src/simulation.c
index f0faf3e..cae8657 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -993,8 +993,9 @@ static gdouble min_cfl (GfsSimulation * sim)
  * @sim: a #GfsSimulation.
  *
  * Sets the time step for the next iteration of @sim using the CFL
- * (computed using gfs_domain_cfl()) and taking into account the
- * timings of the various #GfsEvent associated to @sim.
+ * (computed using gfs_domain_cfl()), the stability conditions for
+ * source terms and taking into account the timings of the various
+ * #GfsEvent associated to @sim.
  *
  * More precisely, the time step is adjusted (if necessary) so that
  * the time of the closest event is exactly reached after the
@@ -1011,6 +1012,25 @@ void gfs_simulation_set_timestep (GfsSimulation * sim)
     sim->advection_params.dt = cfl*gfs_domain_cfl (GFS_DOMAIN (sim), FTT_TRAVERSE_LEAFS, -1);
   else
     sim->advection_params.dt = G_MAXDOUBLE;
+
+  i = GFS_DOMAIN (sim)->variables;
+  while (i) {
+    GfsVariable * v = i->data;
+    if (v->sources) {
+      GSList * j = GTS_SLIST_CONTAINER (v->sources)->items;
+      while (j) {
+	GfsSourceGeneric * s = j->data;
+	if (GFS_SOURCE_GENERIC_CLASS (GTS_OBJECT (s)->klass)->stability) {
+	  gdouble dt = (* GFS_SOURCE_GENERIC_CLASS (GTS_OBJECT (s)->klass)->stability) (s, sim);
+	  if (dt < sim->advection_params.dt)
+	    sim->advection_params.dt = dt;
+	}
+	j = j->next;
+      }
+    }
+    i = i->next;
+  }
+  
   if (sim->advection_params.dt > sim->time.dtmax)
     sim->advection_params.dt = sim->time.dtmax;
 
diff --git a/src/source.h b/src/source.h
index a2ecead..49f6996 100644
--- a/src/source.h
+++ b/src/source.h
@@ -52,9 +52,8 @@ struct _GfsSourceGenericClass {
 
   /*< public >*/
   gdouble (* mac_value)      (GfsSourceGeneric *, FttCell *, GfsVariable *);
-  gdouble (* centered_value) (GfsSourceGeneric *, 
-			      FttCell *, 
-			      GfsVariable *);
+  gdouble (* centered_value) (GfsSourceGeneric *, FttCell *, GfsVariable *);
+  gdouble (* stability)      (GfsSourceGeneric *, GfsSimulation *);
 };
 
 #define GFS_SOURCE_GENERIC(obj)            GTS_OBJECT_CAST (obj,\

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list