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

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


The following commit has been merged in the upstream branch:
commit 77d8a668d3690cc2828b65e195d1c14f11b7c793
Author: Stephane Popinet <popinet at users.sf.net>
Date:   Thu Oct 30 15:26:06 2008 +1100

    Dimensioning for AdaptGradient
    
    darcs-hash:20081030042606-d4795-ac5f334bab7dfcbf6d99ff18a200d6f6a9977af9.gz

diff --git a/src/adaptive.c b/src/adaptive.c
index 48840d7..a76d3f8 100644
--- a/src/adaptive.c
+++ b/src/adaptive.c
@@ -458,9 +458,11 @@ static void gfs_adapt_gradient_read (GtsObject ** o, GtsFile * fp)
   if (fp->type == GTS_ERROR)
     return;
 
-  GFS_ADAPT_GRADIENT (*o)->v = gfs_function_get_variable (GFS_ADAPT_FUNCTION (*o)->f);
-  if (GFS_ADAPT_GRADIENT (*o)->v == NULL)
-    GFS_ADAPT_GRADIENT (*o)->v = gfs_temporary_variable (GFS_DOMAIN (gfs_object_simulation (*o)));
+  GfsAdaptGradient * a = GFS_ADAPT_GRADIENT (*o);
+  a->v = gfs_function_get_variable (GFS_ADAPT_FUNCTION (a)->f);
+  if (a->v == NULL)
+    a->v = gfs_temporary_variable (GFS_DOMAIN (gfs_object_simulation (a)));
+  a->dimension = pow (gfs_object_simulation (a)->physical_params.L, a->v->units);
 }
 
 static void update_f (FttCell * cell, GfsAdaptFunction * a)
@@ -499,7 +501,6 @@ static gdouble gradient_cost (FttCell * cell, GfsAdaptGradient * a)
   FttComponent c;
   gdouble sum2 = 0;
   gdouble * lambda;
-  GfsSimulation * sim = gfs_object_simulation (a);
 
   lambda = (gdouble *) &GFS_DOMAIN (gfs_object_simulation (a))->lambda;
   for (c = 0; c < FTT_DIMENSION; c++) {
@@ -507,12 +508,13 @@ static gdouble gradient_cost (FttCell * cell, GfsAdaptGradient * a)
 
     sum2 += g*g;
   }
-  return sqrt (sum2);
+  return sqrt (sum2)*a->dimension;
 }
 
 static void gfs_adapt_gradient_init (GfsAdaptGradient * object)
 {
   GFS_ADAPT (object)->cost = (GtsKeyFunc) gradient_cost;
+  GFS_ADAPT_GRADIENT (object)->dimension = 1.;
 }
 
 GfsEventClass * gfs_adapt_gradient_class (void)
diff --git a/src/adaptive.h b/src/adaptive.h
index 840e30c..57bd55a 100644
--- a/src/adaptive.h
+++ b/src/adaptive.h
@@ -115,6 +115,7 @@ typedef struct _GfsAdaptGradient         GfsAdaptGradient;
 struct _GfsAdaptGradient {
   /*< private >*/
   GfsAdaptFunction parent;
+  gdouble dimension;
 
   /*< public >*/
   GfsVariable * v;
diff --git a/test/axi/viscous/viscous.gfs b/test/axi/viscous/viscous.gfs
index 236997e..10fc40c 100644
--- a/test/axi/viscous/viscous.gfs
+++ b/test/axi/viscous/viscous.gfs
@@ -66,8 +66,8 @@ Define U0 1.
     Solid (ellipse (0., 0., A0, A0))
     SourceViscosity 1./RE
     Init {} { U = U0 }
-    AdaptGradient { istep = 1 } { cmax = 1e-3 maxlevel = LEVEL } U
-    AdaptGradient { istep = 1 } { cmax = 1e-3 maxlevel = LEVEL } V
+    AdaptGradient { istep = 1 } { cmax = 5e-2 maxlevel = LEVEL } U
+    AdaptGradient { istep = 1 } { cmax = 5e-2 maxlevel = LEVEL } V
     AdaptFunction { istep = 1 } { cmax = 1e-2 maxlevel = LEVEL } {
 	return (fabs(dx("U"))+fabs(dy("U")))/fabs(U)*ftt_cell_size (cell);
     }

-- 
Gerris Flow Solver



More information about the debian-science-commits mailing list