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

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


The following commit has been merged in the upstream branch:
commit dcb832b5327b059a6872278424346af1f4f9ffe5
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Wed Sep 28 10:45:44 2005 +1000

    Solid fractions are matched at coarse/fine boundaries
    
    darcs-hash:20050928004544-fbd8f-39d9c2ec9ce4accbfe2a65554a150e9b2b52ac2d.gz

diff --git a/src/solid.c b/src/solid.c
index 864a5ca..9baca9e 100644
--- a/src/solid.c
+++ b/src/solid.c
@@ -714,6 +714,37 @@ static void foreach_box (GfsBox * box, InitSolidParams * p)
   solid_fractions_from_children (box->root, p);
 }
 
+static void match_fractions (FttCell * cell, GfsVariable * status)
+{
+  if (GFS_IS_MIXED (cell)) {
+    FttCellNeighbors neighbor;
+    guint level = ftt_cell_level (cell);
+    FttDirection d;
+
+    ftt_cell_neighbors (cell, &neighbor);
+    for (d = 0; d < FTT_NEIGHBORS; d++)
+      if (neighbor.c[d] &&
+	  !GFS_CELL_IS_BOUNDARY (neighbor.c[d]) &&
+	  GFS_VARIABLE (neighbor.c[d], status->i) != 1.) {
+	if (!FTT_CELL_IS_LEAF (neighbor.c[d])) {
+	  FttCellChildren child;
+	  FttDirection od = FTT_OPPOSITE_DIRECTION (d);
+	  guint i, n = ftt_cell_children_direction (neighbor.c[d], od, &child);
+	  gdouble s = 0.;
+
+	  for (i = 0; i < n; i++)
+	    if (child.c[i] && GFS_VARIABLE (child.c[i], status->i) != 1.)
+	      s += GFS_IS_MIXED (child.c[i]) ? GFS_STATE (child.c[i])->solid->s[od] : 1.;
+	  GFS_STATE (cell)->solid->s[d] = s/n;
+	}
+	else if (!GFS_IS_MIXED (neighbor.c[d]) && GFS_STATE (cell)->solid->s[d] < 1.) {
+	  g_assert (ftt_cell_level (neighbor.c[d]) == level - 1);
+	  GFS_STATE (cell)->solid->s[d] = 1.;
+	}
+      }
+  }
+}
+
 /**
  * gfs_domain_init_solid_fractions:
  * @domain: a #GfsDomain.
@@ -750,6 +781,8 @@ void gfs_domain_init_solid_fractions (GfsDomain * domain,
 			    (FttCellTraverseFunc) gfs_cell_reset, p.status);
   gfs_domain_cell_traverse (domain, FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
 			    (FttCellTraverseFunc) paint_mixed_leaf, p.status);
+  gfs_domain_cell_traverse (domain, FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
+			    (FttCellTraverseFunc) match_fractions, p.status);
   gts_container_foreach (GTS_CONTAINER (domain), (GtsFunc) foreach_box, &p);
   if (status == NULL)
     gts_object_destroy (GTS_OBJECT (p.status));

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list