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

Stephane Popinet popinet at users.sf.net
Fri May 15 02:55:04 UTC 2009


The following commit has been merged in the upstream branch:
commit aebb5dc9c4e8439192454f180fad11e5c3f7dda7
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Wed Mar 5 13:51:18 2008 +1100

    Optimised temporary variables usage for "gc" option
    
    darcs-hash:20080305025118-d4795-4cecf39b2caeb6741ddcc0064cf961d2c9ce8a39.gz

diff --git a/src/simulation.c b/src/simulation.c
index 5c8c6c4..f70d13e 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -345,10 +345,14 @@ static void simulation_run (GfsSimulation * sim)
   g_assert (pmac);
   FttComponent c;
   for (c = 0; c < FTT_DIMENSION; c++) {
-    g[c] = gfs_temporary_variable (domain);
     gmac[c] = gfs_temporary_variable (domain);
-    gfs_variable_set_vector (g[c], c);
     gfs_variable_set_vector (gmac[c], c);
+    if (sim->advection_params.gc) {
+      g[c] = gfs_temporary_variable (domain);
+      gfs_variable_set_vector (g[c], c);
+    }
+    else
+      g[c] = gmac[c];
   }
 
   gfs_simulation_refine (sim);
@@ -370,7 +374,7 @@ static void simulation_run (GfsSimulation * sim)
     gfs_simulation_set_timestep (sim);
     advance_tracers (domain, sim->advection_params.dt/2.);
   }
-  else
+  else if (sim->advection_params.gc)
     gfs_update_gradients (domain, p, sim->physical_params.alpha, g);
 
   while (sim->time.t < sim->time.end &&
@@ -402,11 +406,9 @@ static void simulation_run (GfsSimulation * sim)
 				       -sim->advection_params.dt);
     }
     else if (gfs_has_source_coriolis (domain)) {
-      gfs_correct_centered_velocities (domain, FTT_DIMENSION, sim->time.i > 0 ? g : gmac,
-				       sim->advection_params.dt);
+      gfs_correct_centered_velocities (domain, FTT_DIMENSION, gmac, sim->advection_params.dt);
       gfs_source_coriolis_implicit (domain, sim->advection_params.dt);
-      gfs_correct_centered_velocities (domain, FTT_DIMENSION, sim->time.i > 0 ? g : gmac, 
-				       -sim->advection_params.dt);
+      gfs_correct_centered_velocities (domain, FTT_DIMENSION, gmac, -sim->advection_params.dt);
     }
 
     gfs_domain_cell_traverse (domain,
@@ -433,8 +435,9 @@ static void simulation_run (GfsSimulation * sim)
   gts_container_foreach (GTS_CONTAINER (sim->events), (GtsFunc) gts_object_destroy, NULL);
 
   for (c = 0; c < FTT_DIMENSION; c++) {
-    gts_object_destroy (GTS_OBJECT (g[c]));
     gts_object_destroy (GTS_OBJECT (gmac[c]));
+    if (sim->advection_params.gc)
+      gts_object_destroy (GTS_OBJECT (g[c]));
   }
 }
 

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list