[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
stephane.popinet at paradise.net.nz
Fri May 15 02:51:34 UTC 2009
The following commit has been merged in the upstream branch:
commit 9f6098ce540df619dc64c7bb937321105c2f1923
Author: Stephane Popinet <stephane.popinet at paradise.net.nz>
Date: Sun Jan 30 14:28:09 2005 +1100
Timestep is computed using minimum CFL of all variables
darcs-hash:20050130032809-fa380-9bbd952dca74e21bc37dbde7199248f1fbaa0e1f.gz
diff --git a/src/simulation.c b/src/simulation.c
index df06124..0f01d51 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -831,6 +831,20 @@ void gfs_simulation_write (GfsSimulation * sim,
domain->max_depth_write = depth;
}
+static gdouble min_cfl (GfsSimulation * sim)
+{
+ gdouble cfl = sim->advection_params.cfl;
+ GfsVariable * v = GFS_DOMAIN (sim)->variables;
+
+ while (v) {
+ if (GFS_IS_VARIABLE_TRACER (v) && GFS_VARIABLE_TRACER (v)->advection.cfl < cfl)
+ cfl = GFS_VARIABLE_TRACER (v)->advection.cfl;
+ v = v->next;
+ }
+
+ return cfl;
+}
+
/**
* gfs_simulation_set_timestep:
* @sim: a #GfsSimulation.
@@ -852,7 +866,7 @@ void gfs_simulation_set_timestep (GfsSimulation * sim)
t = sim->time.t;
sim->advection_params.dt =
- sim->advection_params.cfl*gfs_domain_cfl (GFS_DOMAIN (sim), FTT_TRAVERSE_LEAFS, -1);
+ min_cfl (sim)*gfs_domain_cfl (GFS_DOMAIN (sim), FTT_TRAVERSE_LEAFS, -1);
if (sim->advection_params.dt > sim->time.dtmax)
sim->advection_params.dt = sim->time.dtmax;
sim->tnext = t + sim->advection_params.dt;
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list