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

Stephane Popinet popinet at users.sf.net
Fri May 15 02:53:01 UTC 2009


The following commit has been merged in the upstream branch:
commit 43300223930b8a987ad6671e0c0988d4e7c97dbc
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Sat Jan 21 10:29:32 2006 +1100

    VOF tracers are adaptively refined consistently
    
    darcs-hash:20060120232932-d4795-c7848a3359f4a90741ffe037102fabb4c09d8857.gz

diff --git a/src/variable.c b/src/variable.c
index 95d8b87..f4b1479 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -19,6 +19,7 @@
 
 #include <stdlib.h>
 #include "variable.h"
+#include "vof.h"
 
 /* GfsVariable: Object */
 
@@ -211,9 +212,13 @@ static void variable_tracer_read (GtsObject ** o, GtsFile * fp)
 
   if (fp->type == '{')
     gfs_advection_params_read (&GFS_VARIABLE_TRACER (*o)->advection, fp);
-  if (fp->type == '{')
-    g_warning ("%d:%d: specifying diffusion parameters is not done here anymore!",
-	       fp->line, fp->pos);
+  if (fp->type != GTS_ERROR) {
+    if (GFS_VARIABLE_TRACER (*o)->advection.scheme == GFS_VOF)
+      GFS_VARIABLE1 (*o)->coarse_fine = gfs_vof_coarse_fine;
+    if (fp->type == '{')
+      g_warning ("%d:%d: specifying diffusion parameters is not done here anymore!",
+		 fp->line, fp->pos);
+  }
 }
 
 static void variable_tracer_write (GtsObject * o, FILE * fp)
diff --git a/src/vof.c b/src/vof.c
index ac9680c..83aeb32 100644
--- a/src/vof.c
+++ b/src/vof.c
@@ -617,3 +617,57 @@ void gfs_tracer_vof_advection (GfsDomain * domain,
 
   gfs_domain_timer_stop (domain, "tracer_vof_advection");
 }
+
+/**
+ * gfs_vof_coarse_fine:
+ * @parent: a #FttCell.
+ * @v: a #GfsVariable.
+ *
+ * Fills the @v variable of the children of @parent with
+ * VOF-interpolated values.
+ */
+void gfs_vof_coarse_fine (FttCell * parent, GfsVariable * v)
+{
+  gdouble f;
+  FttCellChildren child;
+  guint i;
+
+  g_return_if_fail (parent != NULL);
+  g_return_if_fail (!FTT_CELL_IS_LEAF (parent));
+  g_return_if_fail (v != NULL);
+
+  ftt_cell_children (parent, &child);
+
+  f = GFS_VARIABLE (parent, v->i);
+  THRESHOLD (f);
+
+  if (f < 1e-6 || 1. - f < 1.e-6)
+    for (i = 0; i < FTT_CELLS; i++)
+      GFS_VARIABLE (child.c[i], v->i) = f;
+  else {
+    FttVector m, m1;
+    FttComponent c;
+    gdouble n = 0., alpha;
+
+    gfs_youngs_normal (parent, 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;
+    alpha = gfs_plane_alpha (&m1, f);
+
+    for (i = 0; i < FTT_CELLS; i++) {
+      gdouble alpha1 = alpha;
+      FttVector p;
+
+      ftt_cell_relative_pos (child.c[i], &p);
+      for (c = 0; c < FTT_DIMENSION; c++) {
+	(&p.x)[c] = (&m.x)[c] < 0. ? (&p.x)[c] + 0.25 : 0.25 - (&p.x)[c];
+	alpha1 -= (&m1.x)[c]*(&p.x)[c];
+      }
+      GFS_VARIABLE (child.c[i], v->i) = gfs_plane_volume (&m1, 2.*alpha1, 1.);
+    }
+  }
+}
diff --git a/src/vof.h b/src/vof.h
index 041314e..87605f7 100644
--- a/src/vof.h
+++ b/src/vof.h
@@ -58,6 +58,8 @@ void    gfs_cell_vof_advection     (FttCell * cell,
 void    gfs_tracer_vof_advection   (GfsDomain * domain,
 				    GfsAdvectionParams * par,
 				    GfsVariable * half);
+void    gfs_vof_coarse_fine        (FttCell * parent, 
+				    GfsVariable * v);
 
 #ifdef __cplusplus
 }

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list