[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:53:51 UTC 2009
The following commit has been merged in the upstream branch:
commit 86787dffb2ce5f2b07ff38851defd58986c28bf2
Author: Stephane Popinet <popinet at users.sf.net>
Date: Fri Jan 19 07:28:36 2007 +1100
Tracers are now defined at time n+1/2
The resulting "leap-frog" time integration allows to recover second-order
accuracy for variable-density and surface-tension-driven flows.
darcs-hash:20070118202836-d4795-a9a1c50e20e3e44cc2c2bacc4d0d0b5229673f98.gz
diff --git a/src/simulation.c b/src/simulation.c
index 2bbc7a0..ce71360 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -442,6 +442,28 @@ static void simulation_read (GtsObject ** object, GtsFile * fp)
sim->modules = g_slist_reverse (sim->modules);
}
+static void advance_tracers (GfsDomain * domain, gdouble dt)
+{
+ GSList * i = domain->variables;
+ while (i) {
+ if (GFS_IS_VARIABLE_TRACER (i->data)) {
+ GfsVariableTracer * t = i->data;
+
+ t->advection.dt = dt;
+ switch (t->advection.scheme) {
+ case GFS_GODUNOV: case GFS_NONE:
+ gfs_tracer_advection_diffusion (domain, &t->advection);
+ break;
+ case GFS_VOF:
+ gfs_tracer_vof_advection (domain, &t->advection);
+ gfs_domain_variable_centered_sources (domain, i->data, i->data, t->advection.dt);
+ break;
+ }
+ }
+ i = i->next;
+ }
+}
+
static void simulation_run (GfsSimulation * sim)
{
GfsVariable * p, * pmac, * res = NULL;
@@ -474,6 +496,7 @@ static void simulation_run (GfsSimulation * sim)
&sim->approx_projection_params,
&sim->advection_params,
p, sim->physical_params.alpha, res);
+ advance_tracers (domain, sim->advection_params.dt/2.);
while (sim->time.t < sim->time.end &&
sim->time.i < sim->time.iend) {
@@ -496,26 +519,7 @@ static void simulation_run (GfsSimulation * sim)
p, sim->physical_params.alpha, g);
gfs_variables_swap (p, pmac);
- i = domain->variables;
- while (i) {
- if (GFS_IS_VARIABLE_TRACER (i->data)) {
- GfsVariableTracer * t = i->data;
-
- t->advection.dt = sim->advection_params.dt;
- switch (t->advection.scheme) {
- case GFS_GODUNOV: case GFS_NONE:
- gfs_tracer_advection_diffusion (domain, &t->advection);
- break;
- case GFS_VOF:
- gfs_tracer_vof_advection (domain, &t->advection);
- gfs_domain_variable_centered_sources (domain, i->data, i->data, t->advection.dt);
- break;
- }
- }
- i = i->next;
- }
-
- gts_container_foreach (GTS_CONTAINER (sim->events), (GtsFunc) gfs_event_half_do, sim);
+ gts_container_foreach (GTS_CONTAINER (sim->events), (GtsFunc) gfs_event_half_do, sim);
gfs_centered_velocity_advection_diffusion (domain,
FTT_DIMENSION,
@@ -537,6 +541,8 @@ static void simulation_run (GfsSimulation * sim)
&sim->approx_projection_params,
&sim->advection_params, p, sim->physical_params.alpha, res);
+ advance_tracers (domain, sim->advection_params.dt);
+
sim->time.t = sim->tnext;
sim->time.i++;
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list