[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:55:16 UTC 2009
The following commit has been merged in the upstream branch:
commit 412aabee884ecdf1a5c6cba36e80ea0ad6473545
Author: Stephane Popinet <popinet at users.sf.net>
Date: Tue Apr 29 15:00:27 2008 +1000
Solid boundary generation changes for Terrain module
darcs-hash:20080429050027-d4795-4ceef41f9ce7b35724b6280f581b684c34de5eec.gz
diff --git a/src/solid.c b/src/solid.c
index de5d870..ee38648 100644
--- a/src/solid.c
+++ b/src/solid.c
@@ -552,17 +552,25 @@ static void set_solid_fractions_from_surface (FttCell * cell,
sym[c] = FALSE;
n += (&m.x)[c];
}
- if (n == 0.) { /* this is a fluid cell */
- for (c = 0; c < FTT_NEIGHBORS; c++)
- g_assert (solid->s[c] == 1.);
- g_free (solid);
- GFS_STATE (cell)->solid = NULL;
- return;
+ if (n == 0.) { /* this is a fluid or solid cell */
+ for (c = 1; c < FTT_NEIGHBORS; c++)
+ g_assert (solid->s[c] == solid->s[0]);
+ if (solid->s[0] == 1.) { /* fluid */
+ g_free (solid);
+ GFS_STATE (cell)->solid = NULL;
+ return;
+ }
+ else { /* solid */
+ solid->a = 0.;
+ solid->cm.x = solid->cm.y = solid->cm.z = 0.;
+ }
+ }
+ else {
+ m.x /= n; m.y /= n; m.z /= n;
+ alpha = m.x*ca.x + m.y*ca.y + m.z*ca.z;
+ solid->a = gfs_plane_volume (&m, alpha);
+ gfs_plane_center (&m, alpha, solid->a, &solid->cm);
}
- m.x /= n; m.y /= n; m.z /= n;
- alpha = m.x*ca.x + m.y*ca.y + m.z*ca.z;
- solid->a = gfs_plane_volume (&m, alpha);
- gfs_plane_center (&m, alpha, solid->a, &solid->cm);
for (c = 0; c < FTT_DIMENSION; c++)
(&solid->cm.x)[c] = (&o.x)[c] +
(sym[c] ? 1. - (&solid->cm.x)[c] : (&solid->cm.x)[c])*(&h.x)[c];
@@ -855,10 +863,8 @@ static void match_fractions (FttCell * cell, GfsVariable * status)
else if (neighbor.c[d]->flags & GFS_FLAG_THIN)
solid->s[d] = GFS_STATE (neighbor.c[d])->solid->s[FTT_OPPOSITE_DIRECTION (d)];
}
- else if (GFS_IS_MIXED (neighbor.c[d])) { /* this is a thin cell */
- g_assert (neighbor.c[d]->flags & GFS_FLAG_THIN);
+ else /* neighbor.c[d] is a solid cell */
solid->s[d] = 0.;
- }
}
}
}
diff --git a/src/vof.c b/src/vof.c
index 834f66f..f128ba6 100644
--- a/src/vof.c
+++ b/src/vof.c
@@ -408,6 +408,7 @@ void gfs_plane_center (FttVector * m, gdouble alpha, gdouble a, FttVector * p)
g_return_if_fail (m != NULL);
g_return_if_fail (p != NULL);
+ g_return_if_fail (a >= 0. && a <= 1.);
n = *m;
if (n.x < 0.) {
@@ -423,18 +424,16 @@ void gfs_plane_center (FttVector * m, gdouble alpha, gdouble a, FttVector * p)
n.z = - n.z;
}
- if (alpha <= 0.) {
+ if (alpha <= 0. || a == 0.) {
p->x = p->y = p->z = 0.;
return;
}
- if (alpha >= n.x + n.y + n.z) {
+ if (alpha >= n.x + n.y + n.z || a == 1.) {
p->x = p->y = p->z = 0.5;
return;
}
- g_return_if_fail (a > 0. && a < 1.);
-
n.x += 1e-4; n.y += 1e-4; n.z += 1e-4;
amax = n.x + n.y + n.z;
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list