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

Stephane Popinet popinet at users.sourceforge.net
Fri May 15 02:51:29 UTC 2009


The following commit has been merged in the upstream branch:
commit c131d17c596cd41a0c2520ee53413628dbb37a6b
Author: Stephane Popinet <popinet at users.sourceforge.net>
Date:   Thu Dec 9 09:36:12 2004 +1100

    Matching of surface fractions for refined mixed cells (gerris--ocean--0.7--patch-27)
    
    gerris--ocean--0.7--patch-27
    Keywords:
    
    Also removal of obsolete gfs_refine_mixed() function and improvement
    in error reporting for check_area_fractions().
    
    darcs-hash:20041208223612-aabb8-121c6ef4444e9642e5f193d3dd5a4b91c9c855ec.gz

diff --git a/src/solid.c b/src/solid.c
index 2c14817..dbda478 100644
--- a/src/solid.c
+++ b/src/solid.c
@@ -525,12 +525,8 @@ void gfs_cell_init_solid_fractions_from_children (FttCell * cell)
       for (j = 0; j < n; j++) {
 	FttCell * c = child.c[j];
 
-	if (c) {
-	  if (GFS_IS_FLUID (c))
-	    w += 1.;
-	  else
-	    w += GFS_STATE (c)->solid->s[i];
-	}
+	if (c)
+	  w += GFS_IS_FLUID (c) ? 1. : GFS_STATE (c)->solid->s[i];
       }
       solid->s[i] = w/n;
     }
@@ -588,14 +584,27 @@ static void paint_mixed_leaf (FttCell * cell)
     GtsFifo * fifo;
     FttCell * n;
     FttDirection i;
-    
+
     fifo = gts_fifo_new ();
     for (i = 0; i < FTT_NEIGHBORS; i++)
-      if ((solid->s[i] == 0. || solid->s[i] == 1.) &&
-	  (n = ftt_cell_neighbor (cell, i)) &&
-	  !GFS_CELL_IS_BOUNDARY (n)) {
-	push_leaf (fifo, n, i, solid->s[i] + 1.);
-	paint_leaf (fifo, solid->s[i] + 1.);
+      if ((n = ftt_cell_neighbor (cell, i)) && !GFS_CELL_IS_BOUNDARY (n)) {
+	if (solid->s[i] == 0. || solid->s[i] == 1.) {
+	  push_leaf (fifo, n, i, solid->s[i] + 1.);
+	  paint_leaf (fifo, solid->s[i] + 1.);
+	}
+	else if (!FTT_CELL_IS_LEAF (n)) {
+	  FttCellChildren child;
+	  guint j, k;
+	  gdouble w = 0.;
+
+	  k = ftt_cell_children_direction (n, FTT_OPPOSITE_DIRECTION (i), &child);
+	  for (j = 0; j < k; j++)
+	    if (child.c[j])
+	      w += GFS_IS_FLUID (child.c[j]) ? 1. : 
+		GFS_STATE (child.c[j])->solid->s[FTT_OPPOSITE_DIRECTION (i)];
+	  solid->s[i] = w/k;
+	  g_assert (solid->s[i] > 0. && solid->s[i] < 1.);
+	}
       }
     gts_fifo_destroy (fifo);
   }
@@ -703,8 +712,11 @@ static gboolean check_area_fractions (const FttCell * root)
 	if (GFS_IS_FLUID (root)) {
 	  if (!GFS_IS_FLUID (neighbor.c[i]) && 
 	      1. - nsolid->s[FTT_OPPOSITE_DIRECTION (i)] >= 1e-10) {
-	    g_warning ("file %s: line %d (%s): s[%d]: %g",
+	    FttVector p;
+	    ftt_cell_pos (root, &p);
+	    g_warning ("file %s: line %d (%s): (%g,%g,%g): s[%d]: %g",		       
 		       __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+		       p.x, p.y, p.z,
 		       FTT_OPPOSITE_DIRECTION (i),
 		       nsolid->s[FTT_OPPOSITE_DIRECTION (i)]);
 	    ret = FALSE;
@@ -714,8 +726,11 @@ static gboolean check_area_fractions (const FttCell * root)
 	else if (GFS_IS_MIXED (neighbor.c[i])) {
 	  if (fabs (solid->s[i] - 
 		    nsolid->s[FTT_OPPOSITE_DIRECTION (i)]) >= 1e-10) {
-	    g_warning ("file %s: line %d (%s): s[%d]: %g neighbor->s[%d]: %g",
+	    FttVector p;
+	    ftt_cell_pos (root, &p);
+	    g_warning ("file %s: line %d (%s): (%g,%g,%g): s[%d]: %g neighbor->s[%d]: %g",
 		       __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+		       p.x, p.y, p.z,
 		       i, solid->s[i],		       
 		       FTT_OPPOSITE_DIRECTION (i),
 		       nsolid->s[FTT_OPPOSITE_DIRECTION (i)]);
@@ -724,8 +739,11 @@ static gboolean check_area_fractions (const FttCell * root)
 	  }
 	}
 	else if (1. - solid->s[i] >= 1e-10) {
-	  g_warning ("file %s: line %d (%s): s[%d]: %g",
+	  FttVector p;
+	  ftt_cell_pos (root, &p);
+	  g_warning ("file %s: line %d (%s): (%g,%g,%g): s[%d]: %g",		     
 		     __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+		     p.x, p.y, p.z,
 		     i, solid->s[i]);
 	  ret = FALSE;
 	  solid->s[i] = 1.;
@@ -734,8 +752,11 @@ static gboolean check_area_fractions (const FttCell * root)
       else { /* fine/coarse boundary */
 	g_assert (ftt_cell_level (neighbor.c[i]) == level - 1);
 	if (GFS_IS_FLUID (neighbor.c[i]) && GFS_IS_MIXED (root) && 1. - solid->s[i] >= 1e-10) {
-	  g_warning ("file %s: line %d (%s): s[%d]: %g",
+	  FttVector p;
+	  ftt_cell_pos (root, &p);
+	  g_warning ("file %s: line %d (%s): (%g,%g,%g): s[%d]: %g",
 		     __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+		     p.x, p.y, p.z,
 		     i, solid->s[i]);
 	  ret = FALSE;
 	  solid->s[i] = 1.;
@@ -811,32 +832,6 @@ gboolean gfs_cell_check_solid_fractions (FttCell * root)
   return ret & check_area_fractions (root);
 }
 
-/**
- * gfs_refine_mixed:
- * @cell: a #FttCell.
- *
- * Returns: %TRUE if @cell is a mixed leaf cell and any of its
- * neighbors is not a leaf cell, %FALSE otherwise (see figure
- * topology.fig).  
- */
-gboolean gfs_refine_mixed (const FttCell * cell)
-{
-  FttCellNeighbors neighbor;
-  guint i;
-
-  g_return_val_if_fail (cell != NULL, FALSE);
-
-  if (!GFS_IS_MIXED (cell) || !FTT_CELL_IS_LEAF (cell))
-    return FALSE;
-
-  ftt_cell_neighbors (cell, &neighbor);
-  for (i = 0; i < FTT_NEIGHBORS; i++)
-    if (neighbor.c[i] && !FTT_CELL_IS_LEAF (neighbor.c[i]))
-      return TRUE;
-  
-  return FALSE;
-}
-
 static void save_solid (FttCell * cell, GfsVariable * c)
 {
   GFS_DOUBLE_TO_POINTER (GFS_VARIABLE (cell, c->i)) = GFS_STATE (cell)->solid;
diff --git a/src/solid.h b/src/solid.h
index 8907a35..0aa9597 100644
--- a/src/solid.h
+++ b/src/solid.h
@@ -36,7 +36,6 @@ void         gfs_domain_init_solid_fractions             (GfsDomain * domain,
 							  gpointer data);
 void         gfs_cell_init_solid_fractions_from_children (FttCell * cell);
 gboolean     gfs_cell_check_solid_fractions              (FttCell * root);
-gboolean     gfs_refine_mixed                            (const FttCell * cell);
 void         gfs_domain_init_fraction                    (GfsDomain * domain,
 							  GtsSurface * s,
 							  GfsVariable * c);

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list