[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:53:42 UTC 2009
The following commit has been merged in the upstream branch:
commit 5b3b051ba59b3364f94620c739988337885be5e4
Author: Stephane Popinet <popinet at users.sf.net>
Date: Sun Oct 8 18:26:16 2006 +1000
New function gfs_vof_interpolate()
darcs-hash:20061008082616-d4795-2274f35560d2cc1efafd6a4c2b49e6326454a7be.gz
diff --git a/src/vof.c b/src/vof.c
index 53f3a4e..9cb5db2 100644
--- a/src/vof.c
+++ b/src/vof.c
@@ -1016,3 +1016,43 @@ gdouble gfs_shahriar_curvature (FttCell * cell, GfsVariable * v)
/(ftt_cell_size (cell)*sqrt (dnm*dnm*dnm));
#endif
}
+
+/**
+ * gfs_vof_interpolate:
+ * @cell: a #FttCell containing location @p.
+ * @p: the center of the virtual cell.
+ * @level: the level of the virtual cell.
+ * @v: a #GfsVariable (volume fraction).
+ *
+ * Computes the volume fraction of a virtual cell at @level centered
+ * on @p.
+ *
+ * Returns: the volume fraction of the virtual cell.
+ */
+gdouble gfs_vof_interpolate (FttCell * cell,
+ FttVector p,
+ guint level,
+ GfsVariable * v)
+{
+ FttVector m;
+ gdouble alpha;
+
+ g_return_val_if_fail (cell != NULL, 0.);
+ g_return_val_if_fail (ftt_cell_level (cell) < level, 0.);
+ g_return_val_if_fail (v != NULL, 0.);
+
+ if (!gfs_vof_plane (cell, v, &m, &alpha))
+ return GFS_VARIABLE (cell, v->i);
+ else {
+ gdouble h = ftt_level_size (level);
+ gdouble H = ftt_cell_size (cell);
+ FttComponent c;
+ FttVector q;
+
+ ftt_cell_pos (cell, &q);
+ alpha *= H;
+ for (c = 0; c < FTT_DIMENSION; c++)
+ alpha -= (&m.x)[c]*((&q.x)[c] + H/2 - (&p.x)[c] - h/2.);
+ return gfs_plane_volume (&m, alpha/h);
+ }
+}
diff --git a/src/vof.h b/src/vof.h
index 2b56b73..7cd9ea9 100644
--- a/src/vof.h
+++ b/src/vof.h
@@ -65,6 +65,10 @@ gboolean gfs_vof_plane (FttCell * cell,
gdouble * alpha);
GSList * gfs_vof_facet (FttCell * cell,
GfsVariable * v);
+gdouble gfs_vof_interpolate (FttCell * cell,
+ FttVector p,
+ guint level,
+ GfsVariable * v);
gdouble gfs_height_curvature (FttCell * cell,
GfsVariable * v);
gdouble gfs_fit_curvature (FttCell * cell,
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list