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

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


The following commit has been merged in the upstream branch:
commit bb222bb14b47e56ccb45633f9b73e531dc9ba812
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Thu May 1 10:04:43 2008 +1000

    Improved robustness of solid fraction checks
    
    darcs-hash:20080501000443-d4795-66b8aeba56b72924d8b25e1ad8bc48eaae29425d.gz

diff --git a/src/advection.c b/src/advection.c
index 25df4e5..0266330 100644
--- a/src/advection.c
+++ b/src/advection.c
@@ -548,7 +548,7 @@ void gfs_face_advected_normal_velocity (const FttCellFace * face,
   g_return_if_fail (face != NULL);
   g_return_if_fail (par != NULL);
 
-  if (GFS_FACE_FRACTION (face) == 0.)
+  if (GFS_FACE_FRACTION_RIGHT (face) == 0.)
     return;
 
   GFS_FACE_NORMAL_VELOCITY_LEFT (face) = u = 
@@ -583,7 +583,7 @@ void gfs_face_interpolated_normal_velocity (const FttCellFace * face, GfsVariabl
   g_return_if_fail (face != NULL);
   g_return_if_fail (v != NULL);
 
-  if (GFS_FACE_FRACTION (face) == 0.)
+  if (GFS_FACE_FRACTION_RIGHT (face) == 0.)
     return;
 
   GFS_FACE_NORMAL_VELOCITY_LEFT (face) = u = gfs_face_interpolated_value (face, v[face->d/2]->i);
diff --git a/src/ocean.c b/src/ocean.c
index c875443..be09036 100644
--- a/src/ocean.c
+++ b/src/ocean.c
@@ -50,7 +50,7 @@ static void correct_normal_velocity (FttCellFace * face,
   gdouble * dt = data[2];
   FttComponent c;
 
-  if (GFS_FACE_FRACTION (face) == 0.)
+  if (GFS_FACE_FRACTION_RIGHT (face) == 0.)
     return;
 
   type = ftt_face_type (face);
@@ -528,7 +528,7 @@ static void face_interpolated_normal_velocity (const FttCellFace * face, GfsVari
   g_return_if_fail (face != NULL);
   g_return_if_fail (v != NULL);
 
-  if (GFS_FACE_FRACTION (face) == 0.)
+  if (GFS_FACE_FRACTION_RIGHT (face) == 0.)
     return;
 
   guint i = v[face->d/2]->i;
diff --git a/src/solid.c b/src/solid.c
index 72e461a..bc2c631 100644
--- a/src/solid.c
+++ b/src/solid.c
@@ -464,8 +464,13 @@ static void set_solid_fractions_from_surface (FttCell * cell,
       s->n = 0;
   }
 
-  if (n1 == 0) /* no intersections */
+  if (n1 == 0) { /* no intersections */
+    if (solid) {
+      g_free (solid);
+      GFS_STATE (cell)->solid = NULL;      
+    }
     return;
+  }
 
   if (!solid)
     GFS_STATE (cell)->solid = solid = g_malloc0 (sizeof (GfsSolidVector));
@@ -943,8 +948,11 @@ static gboolean check_area_fractions (const FttCell * root)
       g_assert_not_reached ();
     }
     if (!gts_bbox_point_is_inside (&bb, &solid->ca)) {
-      g_warning ("file %s: line %d (%s): ca is not inside cell",
-		 __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION);
+      g_warning ("file %s: line %d (%s): ca (%g,%g,%g)/%d is not inside cell [(%g,%g,%g),(%g,%g,%g)]",
+		 __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+		 solid->ca.x, solid->ca.y, solid->ca.z, ftt_cell_level (root),
+		 bb.x1, bb.y1, bb.z1, 
+		 bb.x2, bb.y2, bb.z2);
       ret = FALSE;
       g_assert_not_reached ();
     }
@@ -957,14 +965,16 @@ static gboolean check_area_fractions (const FttCell * root)
 
       if (ftt_cell_level (neighbor.c[i]) == level) {
 	if (GFS_IS_FLUID (root)) {
-	  if (!GFS_IS_FLUID (neighbor.c[i]) && 1. - nsolid->s[oi] >= 1e-10) {
-	    FttVector p;
-	    ftt_cell_pos (root, &p);
-	    g_warning ("file %s: line %d (%s): (%g,%g,%g)/%d: s[%d]: %g",
-		       __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
-		       p.x, p.y, p.z, ftt_cell_level (root),
-		       oi, nsolid->s[oi]);
-	    ret = FALSE;
+	  if (!GFS_IS_FLUID (neighbor.c[i])) {
+	    if (1. - nsolid->s[oi] >= 1e-10) {
+	      FttVector p;
+	      ftt_cell_pos (root, &p);
+	      g_warning ("file %s: line %d (%s): (%g,%g,%g)/%d: s[%d]: %g",
+			 __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+			 p.x, p.y, p.z, ftt_cell_level (root),
+			 oi, nsolid->s[oi]);
+	      ret = FALSE;
+	    }
 	    nsolid->s[oi] = 1.;
 	  }
 	}
@@ -978,31 +988,50 @@ static gboolean check_area_fractions (const FttCell * root)
 		       i, solid->s[i],
 		       oi, nsolid->s[oi]);
 	    ret = FALSE;
-	    nsolid->s[oi] = solid->s[i];
 	  }
+	  nsolid->s[oi] = solid->s[i];
 	}
-	else if (1. - solid->s[i] >= 1e-10) {
-	  FttVector p;
-	  ftt_cell_pos (root, &p);
-	  g_warning ("file %s: line %d (%s): (%g,%g,%g)/%d: s[%d]: %g",
-		     __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
-		     p.x, p.y, p.z, ftt_cell_level (root),
-		     i, solid->s[i]);
-	  ret = FALSE;
+	else {
+	  if (1. - solid->s[i] >= 1e-10) {
+	    FttVector p;
+	    ftt_cell_pos (root, &p);
+	    g_warning ("file %s: line %d (%s): (%g,%g,%g)/%d: s[%d]: %g",
+		       __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+		       p.x, p.y, p.z, ftt_cell_level (root),
+		       i, solid->s[i]);
+	    ret = FALSE;
+	  }
 	  solid->s[i] = 1.;
 	}
       }
       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) {
-	  FttVector p;
-	  ftt_cell_pos (root, &p);
-	  g_warning ("file %s: line %d (%s): (%g,%g,%g)/%d: s[%d]: %g",
-		     __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
-		     p.x, p.y, p.z, ftt_cell_level (root),
-		     i, solid->s[i]);
-	  ret = FALSE;
-	  solid->s[i] = 1.;
+	if (GFS_IS_FLUID (neighbor.c[i])) {
+	  if (GFS_IS_MIXED (root)) {
+	    if (1. - solid->s[i] >= 1e-10) {
+	      FttVector p;
+	      ftt_cell_pos (root, &p);
+	      g_warning ("file %s: line %d (%s): (%g,%g,%g)/%d: s[%d]: %g",
+			 __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+			 p.x, p.y, p.z, ftt_cell_level (root),
+			 i, solid->s[i]);
+	      ret = FALSE;
+	    }
+	    solid->s[i] = 1.;
+	  }
+	}
+	else if (nsolid->s[oi] == 0.) {
+	  g_assert (GFS_IS_MIXED (root));
+	  if (solid->s[i] >= 1e-10) {
+	    FttVector p;
+	    ftt_cell_pos (root, &p);
+	    g_warning ("file %s: line %d (%s): (%g,%g,%g)/%d: s[%d]: %g",
+		       __FILE__, __LINE__, G_GNUC_PRETTY_FUNCTION,
+		       p.x, p.y, p.z, ftt_cell_level (root),
+		       i, solid->s[i]);
+	    ret = FALSE;
+	  }
+	  solid->s[i] = 0.;
 	}
       }
     }
diff --git a/src/timestep.c b/src/timestep.c
index c60d883..c0e1738 100644
--- a/src/timestep.c
+++ b/src/timestep.c
@@ -106,7 +106,7 @@ static void correct_normal_velocity (FttCellFace * face,
   gdouble * dt = data[2];
   FttComponent c;
 
-  if (GFS_FACE_FRACTION (face) == 0.)
+  if (GFS_FACE_FRACTION_RIGHT (face) == 0.)
     return;
 
   s = GFS_STATE (face->cell);
@@ -186,7 +186,7 @@ static void add_face_source (FttCellFace * face,
   gdouble dp;
   FttComponent c;
 
-  if (GFS_FACE_FRACTION (face) == 0.)
+  if (GFS_FACE_FRACTION_RIGHT (face) == 0.)
     return;
 
   c = face->d/2;

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list