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

Stephane Popinet s.popinet at niwa.co.nz
Fri May 15 02:51:55 UTC 2009


The following commit has been merged in the upstream branch:
commit 65cf5aa056e715ffae9891e5056255a4bda9ae06
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date:   Thu Jun 2 16:05:49 2005 +1000

    New gfs_solid_normal() and gfs_pressure_force() functions
    
    darcs-hash:20050602060549-fbd8f-9c995058e95247e2b911bd682bc80b0983896957.gz

diff --git a/src/domain.c b/src/domain.c
index f03432d..6709490 100644
--- a/src/domain.c
+++ b/src/domain.c
@@ -2214,17 +2214,12 @@ GfsVariable * gfs_domain_add_variable (GfsDomain * domain,
 
 static void add_pressure_force (FttCell * cell, gdouble * f)
 {
-  GfsSolidVector * s = GFS_STATE (cell)->solid;
-  gdouble p = gfs_cell_dirichlet_value (cell, gfs_p, -1);
+  FttVector ff;
   FttComponent c;
-  gdouble size = ftt_cell_size (cell);
-
-#if (!FTT_2D)
-  size *= size;
-#endif /* 3D */
 
+  gfs_pressure_force (cell, &ff);
   for (c = 0; c < FTT_DIMENSION; c++)
-    f[c] += p*(s->s[2*c + 1] - s->s[2*c])*size;
+    f[c] += (&ff.x)[c];
 }
 
 static GfsSourceDiffusion * source_diffusion (GfsVariable * v)
diff --git a/src/fluid.c b/src/fluid.c
index cf8abca..1f02983 100644
--- a/src/fluid.c
+++ b/src/fluid.c
@@ -1777,6 +1777,34 @@ void gfs_velocity_lambda2 (FttCell * cell,
   GFS_VARIABLE (cell, v->i) = lambda[1]/2.;
 }
 
+/**
+ * gfs_pressure_force:
+ * @cell: a #FttCell.
+ * @f: a #FttVector.
+ *
+ * Fills @f with the pressure component of the force exerted by the
+ * fluid on the fraction of embedded boundary contained in @cell.
+ */
+void gfs_pressure_force (FttCell * cell,
+			 FttVector * f)
+{
+  GfsSolidVector * s;
+
+  g_return_if_fail (cell != NULL);
+  g_return_if_fail (f != NULL);
+
+  if ((s = GFS_STATE (cell)->solid)) {
+    gdouble p = gfs_cell_dirichlet_value (cell, gfs_p, -1);
+    FttComponent c;
+
+    gfs_solid_normal (cell, f);
+    for (c = 0; c < FTT_DIMENSION; c++)
+      (&f->x)[c] *= p;
+  }
+  else
+    f->x = f->y = f->z = 0.;
+}
+
 static void cell_traverse_mixed (FttCell * cell,
 				 FttTraverseType order,
 				 FttTraverseFlags flags,
diff --git a/src/fluid.h b/src/fluid.h
index fcc2537..79b2e9e 100644
--- a/src/fluid.h
+++ b/src/fluid.h
@@ -201,6 +201,8 @@ void                  gfs_velocity_norm2             (FttCell * cell,
 						      GfsVariable * v);
 void                  gfs_velocity_lambda2           (FttCell * cell,
 						      GfsVariable * v);
+void                  gfs_pressure_force             (FttCell * cell,
+						      FttVector * f);
 GtsRange              gfs_stats_variable             (FttCell * root, 
 						      GfsVariable * v, 
 						      FttTraverseFlags flags,
diff --git a/src/solid.c b/src/solid.c
index 2e5e019..fb3ba7b 100644
--- a/src/solid.c
+++ b/src/solid.c
@@ -909,6 +909,37 @@ void gfs_cell_cm (const FttCell * cell, FttVector * cm)
 }
 
 /**
+ * gfs_solid_normal:
+ * @cell: a #FttCell.
+ * @n: a #FttVector.
+ *
+ * Fills @n with the components of the average unit normal to the
+ * fraction of solid boundary contained in @cell, multiplied by the
+ * area of the fraction of solid boundary contained in @cell.
+ */
+void gfs_solid_normal (const FttCell * cell, FttVector * n)
+{
+  GfsSolidVector * s;
+
+  g_return_if_fail (cell != NULL);
+  g_return_if_fail (n != NULL);
+
+  if ((s = GFS_STATE (cell)->solid)) {
+    gdouble size = ftt_cell_size (cell);
+    FttComponent c;
+
+#if (!FTT_2D)
+    size *= size;
+#endif /* 3D */
+
+    for (c = 0; c < FTT_DIMENSION; c++)
+      (&n->x)[c] = (s->s[2*c + 1] - s->s[2*c])*size;
+  }
+  else
+    n->x = n->y = n->z = 0.;
+}
+
+/**
  * gfs_face_ca:
  * @face: a #FttCellFace.
  * @ca: a #FttVector.
diff --git a/src/solid.h b/src/solid.h
index 0aa9597..e00a028 100644
--- a/src/solid.h
+++ b/src/solid.h
@@ -41,6 +41,8 @@ void         gfs_domain_init_fraction                    (GfsDomain * domain,
 							  GfsVariable * c);
 void         gfs_cell_cm                                 (const FttCell * cell, 
 							  FttVector * cm);
+void         gfs_solid_normal                            (const FttCell * cell,
+							  FttVector * n);
 void         gfs_face_ca                                 (const FttCellFace * face, 
 							  FttVector * ca);
 

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list