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

Stephane Popinet popinet at users.sf.net
Fri May 15 02:56:28 UTC 2009


The following commit has been merged in the upstream branch:
commit 09050a7a36a8120ea8c2c3115a2fcec97cc150c8
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Tue May 12 09:18:31 2009 +1000

    Diffusion now works with moving boundaries
    
    darcs-hash:20090511231831-d4795-7b86135b4af6e88d12bf53ef3867194f1590e4b8.gz

diff --git a/src/advection.h b/src/advection.h
index 0bf3e34..a8ce14e 100644
--- a/src/advection.h
+++ b/src/advection.h
@@ -48,7 +48,7 @@ typedef void (* GfsMergedTraverseFunc)       (GSList * merged,
 
 struct _GfsAdvectionParams {
   gdouble cfl, dt;
-  GfsVariable * v, * fv, ** u, ** g, * vn;
+  GfsVariable * v, * fv, ** u, ** g;
   GfsCenterGradient gradient;
   gboolean use_centered_velocity;
   GfsUpwinding upwinding;
diff --git a/src/moving.c b/src/moving.c
index 6cdd57e..40713f7 100644
--- a/src/moving.c
+++ b/src/moving.c
@@ -1012,7 +1012,7 @@ static void moving_advection_update (GSList * merged, const GfsAdvectionParams *
     if (GFS_IS_MIXED (cell))
       g_assert (!gfs_cell_is_small (cell));
 
-    GFS_VALUE (cell, par->v) = (olda*GFS_VALUE (cell, par->vn) + GFS_VALUE (cell, par->fv))/a;
+    GFS_VALUE (cell, par->v) = (olda*GFS_VALUE (cell, par->v) + GFS_VALUE (cell, par->fv))/a;
   }
   else if (1 /* par->average */) {
     /* average value */
@@ -1026,7 +1026,7 @@ static void moving_advection_update (GSList * merged, const GfsAdvectionParams *
       gdouble olda = OLD_SOLID (cell) ? OLD_SOLID (cell)->a : 1.;
       
       total_vol += vol*a;
-      w += vol*(olda*GFS_VALUE (cell, par->vn) + GFS_VALUE (cell, par->fv));
+      w += vol*(olda*GFS_VALUE (cell, par->v) + GFS_VALUE (cell, par->fv));
       i = i->next;
     }
     w /= total_vol;
@@ -1050,12 +1050,12 @@ static void moving_advection_update (GSList * merged, const GfsAdvectionParams *
 
       total_vol += vol*a;
       if (a < GFS_SMALL) {
-	GFS_VALUE (cell, par->v) = olda*GFS_VALUE (cell, par->vn)/a + 
+	GFS_VALUE (cell, par->v) = olda*GFS_VALUE (cell, par->v)/a + 
 	  GFS_VALUE (cell, par->fv)/GFS_SMALL;
 	w += vol*GFS_VALUE (cell, par->fv)*(1. - a/GFS_SMALL);   
       }
       else
-	GFS_VALUE (cell, par->v) = (olda*GFS_VALUE (cell, par->vn) + GFS_VALUE (cell, par->fv))/a;
+	GFS_VALUE (cell, par->v) = (olda*GFS_VALUE (cell, par->v) + GFS_VALUE (cell, par->fv))/a;
       i = i->next;
     }
     w /= total_vol;
diff --git a/src/poisson.c b/src/poisson.c
index 07ee92c..d03b68c 100644
--- a/src/poisson.c
+++ b/src/poisson.c
@@ -881,7 +881,7 @@ static void diffusion_rhs (FttCell * cell, RelaxParams * p)
     }
     f += g.b - g.a*val;
   }
-  GFS_VARIABLE (cell, p->rhs) += val + p->beta*f/(h*h*GFS_VARIABLE (cell, p->dia));
+  GFS_VARIABLE (cell, p->rhs) += p->beta*f/(h*h*GFS_VARIABLE (cell, p->dia));
   if (p->axi)
     GFS_VARIABLE (cell, p->rhs) -= val*p->beta*GFS_VARIABLE (cell, p->axi);
 }
diff --git a/src/timestep.c b/src/timestep.c
index 27c6e45..b29179c 100644
--- a/src/timestep.c
+++ b/src/timestep.c
@@ -702,9 +702,7 @@ static void variable_sources (GfsDomain * domain,
 			      FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
 			      (FttFaceTraverseFunc) par->flux, par);
     par->v = sv;
-    par->vn = v;
     gfs_domain_traverse_merged (domain, par->update, par);
-    par->vn = NULL;
     par->v = v;
     par->u = par->g = NULL;
     gts_object_destroy (GTS_OBJECT (par->fv));
@@ -724,6 +722,7 @@ static void variable_sources (GfsDomain * domain,
   if (par->fv) {
     GfsVariable * v = par->v;
     par->v = sv;
+    /* fixme: for axi and moving should this be par->update? */
     gfs_domain_traverse_merged (domain, (GfsMergedTraverseFunc) gfs_advection_update, par);
     par->v = v;
     gts_object_destroy (GTS_OBJECT (par->fv));
@@ -756,11 +755,16 @@ static void variable_diffusion (GfsDomain * domain,
   gts_object_destroy (GTS_OBJECT (rhoc));
 }
 
+static void copy_v_rhs (FttCell * cell, GfsAdvectionParams * apar)
+{
+  GFS_VALUE (cell, apar->fv) = GFS_VALUE (cell, apar->v);
+}
+
 /**
  * gfs_centered_velocity_advection_diffusion:
  * @domain: a #GfsDomain.
  * @dimension: the number of dimensions (2 or 3).
- * @apar: the advection parameters.
+ * @par: the advection parameters.
  * @gmac: the MAC pressure gradient.
  * @g: the pressure gradient.
  * @alpha: the inverse of density or %NULL.
@@ -780,7 +784,7 @@ static void variable_diffusion (GfsDomain * domain,
  */
 void gfs_centered_velocity_advection_diffusion (GfsDomain * domain,
 						guint dimension,
-						GfsAdvectionParams * apar,
+						GfsAdvectionParams * par,
 						GfsVariable ** gmac,
 						GfsVariable ** g,
 						GfsFunction * alpha)
@@ -789,30 +793,30 @@ void gfs_centered_velocity_advection_diffusion (GfsDomain * domain,
   GfsVariable ** v;
 
   g_return_if_fail (domain != NULL);
-  g_return_if_fail (apar != NULL);
+  g_return_if_fail (par != NULL);
   g_return_if_fail (gmac != NULL);
 
   gfs_domain_timer_start (domain, "centered_velocity_advection_diffusion");
 
-  apar->use_centered_velocity = FALSE;
+  par->use_centered_velocity = FALSE;
   v = gfs_domain_velocity (domain);
   for (c = 0; c < dimension; c++) {
     GfsSourceDiffusion * d = source_diffusion (v[c]);
 
-    apar->v = v[c];
+    par->v = v[c];
     if (d) {
       GfsVariable * rhs;
 
-      rhs = gfs_temporary_variable (domain);
+      par->fv = rhs = gfs_temporary_variable (domain);
       gfs_domain_cell_traverse (domain, FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
-				(FttCellTraverseFunc) gfs_cell_reset, rhs);
-      variable_sources (domain, apar, rhs, gmac, g);
-      variable_diffusion (domain, d, apar, rhs, alpha);
+				(FttCellTraverseFunc) copy_v_rhs, par);
+      variable_sources (domain, par, rhs, gmac, g);
+      variable_diffusion (domain, d, par, rhs, alpha);
       gts_object_destroy (GTS_OBJECT (rhs));
     }
     else {
-      variable_sources (domain, apar, apar->v, gmac, g);
-      gfs_domain_bc (domain, FTT_TRAVERSE_LEAFS, -1, apar->v);
+      variable_sources (domain, par, par->v, gmac, g);
+      gfs_domain_bc (domain, FTT_TRAVERSE_LEAFS, -1, par->v);
     }
   }
   gfs_domain_timer_stop (domain, "centered_velocity_advection_diffusion");
@@ -839,9 +843,9 @@ void gfs_tracer_advection_diffusion (GfsDomain * domain,
   if ((d = source_diffusion (par->v))) {
     GfsVariable * rhs;
 
-    rhs = gfs_temporary_variable (domain);
+    par->fv = rhs = gfs_temporary_variable (domain);
     gfs_domain_cell_traverse (domain, FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
-			      (FttCellTraverseFunc) gfs_cell_reset, rhs);
+			      (FttCellTraverseFunc) copy_v_rhs, par);
     variable_sources (domain, par, rhs, NULL, NULL);
     variable_diffusion (domain, d, par, rhs, NULL);
     gts_object_destroy (GTS_OBJECT (rhs));

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list