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

Stephane Popinet s.popinet at niwa.co.nz
Fri May 15 02:51:37 UTC 2009


The following commit has been merged in the upstream branch:
commit 58921dda2171e94106cff1c36899df51406c73de
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Wed Feb 9 10:05:18 2005 +1100

    gfs_cell_corner_interpolator now works for periodic BCs
    
    But only when the periodic BCs are not cut by a solid boundary.
    
    darcs-hash:20050208230518-fbd8f-c2ec7628e35b10e052a75e634a1cfc528f61c987.gz

diff --git a/src/fluid.c b/src/fluid.c
index 8855342..38b9a90 100644
--- a/src/fluid.c
+++ b/src/fluid.c
@@ -2322,6 +2322,28 @@ static gboolean do_path (FttCell * cell, gint i,
   return FALSE;
 }
 
+static gdouble distance (FttVector * c, FttCell * cell, gboolean centered)
+{
+  if (centered || !GFS_IS_MIXED (cell))
+    return ftt_cell_size (cell)*
+#if FTT_2D
+      0.707106781185
+#else  /* 3D */
+      0.866025403785
+#endif /* 3D */
+      ;
+  else {
+    FttVector cm;
+    gfs_cell_cm (cell, &cm);
+    /* fixme: what about periodic boundaries? */
+    return sqrt ((cm.x - c->x)*(cm.x - c->x) + (cm.y - c->y)*(cm.y - c->y)
+#if (!FTT_2D)
+      + (cm.z - c->z)*(cm.z - c->z)
+#endif /* 3D */
+		 );
+  }
+}
+
 /**
  * gfs_cell_corner_interpolator:
  * @cell: a #FttCell.
@@ -2357,7 +2379,6 @@ void gfs_cell_corner_interpolator (FttCell * cell,
     return;
 
   {
-    void (*cell_pos) (const FttCell *, FttVector *) = centered ? ftt_cell_pos : gfs_cell_cm;
     FttVector c;
     gdouble w = 0.;
 
@@ -2366,14 +2387,7 @@ void gfs_cell_corner_interpolator (FttCell * cell,
     for (i = 0; i < N_CELLS; i++)
       if (n[i]) {
 	gdouble a;
-	FttVector cm;
-	(*cell_pos) (n[i], &cm);
-	/* fixme: what about periodic boundaries? */
-	a = 1./((cm.x - c.x)*(cm.x - c.x) + (cm.y - c.y)*(cm.y - c.y)
-#if (!FTT_2D)
-		+ (cm.z - c.z)*(cm.z - c.z)
-#endif /* 3D */
-		+ 1e-6);
+	a = 1./(distance (&c, n[i], centered) + 1e-12);
 	inter->c[inter->n] = n[i];
 	inter->w[inter->n++] = a;
 	w += a;

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list