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

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


The following commit has been merged in the upstream branch:
commit c94b52899c6523a42627eb883556ebf49295b999
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Thu Aug 21 11:20:26 2008 +1000

    New user function "correctness()" for complexity of VOF interfaces
    
    darcs-hash:20080821012026-d4795-2936c5fcb8e50d43f113ad1262c3dc329b5ef183.gz

diff --git a/src/function.h b/src/function.h
index e8c4eaf..e9b8466 100644
--- a/src/function.h
+++ b/src/function.h
@@ -55,4 +55,13 @@ static double area (const gchar * name)
     (_sim->physical_params.L*ftt_cell_size (_cell));
 }
 
+static double correctness (const gchar * name)
+{
+  GfsVariable * v = gfs_variable_from_name (GFS_DOMAIN (_sim)->variables, name);
+  if (v == NULL || !GFS_IS_VARIABLE_TRACER_VOF (v))
+    return 0.;
+  g_return_val_if_fail (_cell != NULL, 0.);
+  return gfs_vof_correctness (_cell, GFS_VARIABLE_TRACER_VOF (v));
+}
+
 #endif /* __FUNCTION_H__ */
diff --git a/src/vof.c b/src/vof.c
index ff38920..61cc6f6 100644
--- a/src/vof.c
+++ b/src/vof.c
@@ -2257,3 +2257,43 @@ gdouble gfs_height_curvature (FttCell * cell, GfsVariableTracerVOF * t, gdouble
   parabola_fit_destroy (&fit);
   return kappa;
 }
+
+/**
+ * gfs_vof_correctness:
+ * @cell: a #FttCell.
+ * @t: a #GfsVariableTracerVOF.
+ *
+ * An implementation of the criterion of Cerne et al (2002), to
+ * measure how well an interface is represented by a local VOF field.
+ *
+ * Returns: the "correctness" of the interface representation.
+ */
+gdouble gfs_vof_correctness (FttCell * cell, GfsVariableTracerVOF * t)
+{
+  GfsVariable * v = GFS_VARIABLE1 (t);
+  gdouble F(3,3,3);
+  
+  g_return_val_if_fail (cell != NULL, 0.);
+  g_return_val_if_fail (t != NULL, 0.);
+
+  if (GFS_VALUE (cell, v) <= 0. || GFS_VALUE (cell, v) >= 1.)
+    return 1.;
+
+  stencil (cell, v, f);
+#if FTT_2D
+  gdouble dx = f[2][0] + f[2][1] + f[2][2] - f[0][0] - f[0][1] - f[0][2];
+  gdouble dy = f[0][2] + f[1][2] + f[2][2] - f[0][0] - f[1][0] - f[2][0];
+  return sqrt ((dx*dx + dy*dy)/9.);
+#else
+  gdouble dx = (f[2][0][0] + f[2][1][0] + f[2][2][0] - f[0][0][0] - f[0][1][0] - f[0][2][0] +
+		f[2][0][1] + f[2][1][1] + f[2][2][1] - f[0][0][1] - f[0][1][1] - f[0][2][1] +
+		f[2][0][2] + f[2][1][2] + f[2][2][2] - f[0][0][2] - f[0][1][2] - f[0][2][2]);
+  gdouble dy = (f[0][2][0] + f[1][2][0] + f[2][2][0] - f[0][0][0] - f[1][0][0] - f[2][0][0] +
+		f[0][2][1] + f[1][2][1] + f[2][2][1] - f[0][0][1] - f[1][0][1] - f[2][0][1] +
+		f[0][2][2] + f[1][2][2] + f[2][2][2] - f[0][0][2] - f[1][0][2] - f[2][0][2]);
+  gdouble dz = (f[0][0][2] + f[1][0][2] + f[2][0][2] - f[0][0][0] - f[1][0][0] - f[2][0][0] +
+		f[0][1][2] + f[1][1][2] + f[2][1][2] - f[0][1][0] - f[1][1][0] - f[2][1][0] +
+		f[0][2][2] + f[1][2][2] + f[2][2][2] - f[0][2][0] - f[1][2][0] - f[2][2][0]);  
+  return sqrt ((dx*dx + dy*dy + dz*dz)/27.);
+#endif
+}
diff --git a/src/vof.h b/src/vof.h
index 194f396..aa33102 100644
--- a/src/vof.h
+++ b/src/vof.h
@@ -108,6 +108,8 @@ gdouble  gfs_height_curvature      (FttCell * cell,
 gdouble  gfs_fit_curvature         (FttCell * cell,
 				    GfsVariableTracerVOF * t,
 				    gdouble * kmax);
+gdouble  gfs_vof_correctness       (FttCell * cell, 
+				    GfsVariableTracerVOF * t);
 
 #ifdef __cplusplus
 }

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list