[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:53:05 UTC 2009
The following commit has been merged in the upstream branch:
commit 2f1fcff07767fe98ac0df2347fa744a83d339827
Author: Stephane Popinet <popinet at users.sf.net>
Date: Mon Jan 30 12:47:49 2006 +1100
New functions gfs_vof_plane() and gfs_vof_facet()
darcs-hash:20060130014749-d4795-f781924ad94cfea656193c531752d0ee434627ce.gz
diff --git a/src/vof.c b/src/vof.c
index 83aeb32..602539a 100644
--- a/src/vof.c
+++ b/src/vof.c
@@ -671,3 +671,105 @@ void gfs_vof_coarse_fine (FttCell * parent, GfsVariable * v)
}
}
}
+
+/**
+ * gfs_vof_plane:
+ * @cell: a #FttCell.
+ * @v: a #GfsVariable.
+ * @m: a #FttVector.
+ * @alpha: a double.
+ *
+ * If @cell is cut by the interface defined by @v, fills @m and @alpha
+ * with the equation of the VOF-reconstructed interface.
+ *
+ * Returns: %TRUE if @cell is cut by the interface, %FALSE otherwise.
+ */
+gboolean gfs_vof_plane (FttCell * cell, GfsVariable * v,
+ FttVector * m, gdouble * alpha)
+{
+ gdouble f;
+
+ g_return_val_if_fail (cell != NULL, FALSE);
+ g_return_val_if_fail (v != NULL, FALSE);
+ g_return_val_if_fail (m != NULL, FALSE);
+ g_return_val_if_fail (alpha != NULL, FALSE);
+
+ f = GFS_VARIABLE (cell, v->i);
+ THRESHOLD (f);
+
+ if (f < 1e-6 || 1. - f < 1.e-6)
+ return FALSE;
+ else {
+ FttVector m1;
+ FttComponent c;
+ gdouble n = 0.;
+
+ gfs_youngs_normal (cell, v, m);
+ for (c = 0; c < FTT_DIMENSION; c++) {
+ (&m1.x)[c] = fabs ((&m->x)[c]);
+ n += (&m1.x)[c];
+ }
+ for (c = 0; c < FTT_DIMENSION; c++) {
+ (&m1.x)[c] /= n;
+ (&m->x)[c] /= n;
+ }
+ *alpha = gfs_plane_alpha (&m1, f);
+
+ for (c = 0; c < FTT_DIMENSION; c++)
+ if ((&m->x)[c] < 0.)
+ *alpha += (&m->x)[c];
+ return TRUE;
+ }
+}
+
+/**
+ * gfs_vof_facet:
+ * @cell: a #FttCell.
+ * @v: a #GfsVariable.
+ *
+ * Returns: a list of newly allocated #GtsPoint defining the
+ * VOF-reconstructed interface facet defined by @v, or %NULL if @cell
+ * is not cut by the interface.
+ */
+GSList * gfs_vof_facet (FttCell * cell, GfsVariable * v)
+{
+ FttVector m;
+ gdouble alpha;
+
+ g_return_val_if_fail (cell != NULL, NULL);
+ g_return_val_if_fail (v != NULL, NULL);
+
+#if FTT_3D
+ g_assert_not_implemented ();
+#endif
+
+ if (!gfs_vof_plane (cell, v, &m, &alpha))
+ return NULL;
+ else {
+ GSList * l = NULL;
+ gdouble x, y;
+
+ if (m.y != 0.) {
+ y = alpha/m.y;
+ if (y >= 0. && y <= 1.)
+ l = g_slist_prepend (l, gts_point_new (gts_point_class (), 0.5, 0.5 - y, 0.));
+ }
+ if (m.x != 0.) {
+ x = alpha/m.x;
+ if (x >= 0. && x <= 1.)
+ l = g_slist_prepend (l, gts_point_new (gts_point_class (), 0.5 - x, 0.5, 0.));
+ }
+ if (m.y != 0.) {
+ y = (alpha - m.x)/m.y;
+ if (y >= 0. && y <= 1.)
+ l = g_slist_prepend (l, gts_point_new (gts_point_class (), -0.5, 0.5 - y, 0.));
+ }
+ if (m.x != 0.) {
+ x = (alpha - m.y)/m.x;
+ if (x >= 0. && x <= 1.)
+ l = g_slist_prepend (l, gts_point_new (gts_point_class (), 0.5 - x, -0.5, 0.));
+ }
+ g_assert (g_slist_length (l) == 2);
+ return l;
+ }
+}
diff --git a/src/vof.h b/src/vof.h
index 87605f7..1d8dd71 100644
--- a/src/vof.h
+++ b/src/vof.h
@@ -60,6 +60,12 @@ void gfs_tracer_vof_advection (GfsDomain * domain,
GfsVariable * half);
void gfs_vof_coarse_fine (FttCell * parent,
GfsVariable * v);
+gboolean gfs_vof_plane (FttCell * cell,
+ GfsVariable * v,
+ FttVector * m,
+ gdouble * alpha);
+GSList * gfs_vof_facet (FttCell * cell,
+ GfsVariable * v);
#ifdef __cplusplus
}
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list