[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:54:23 UTC 2009
The following commit has been merged in the upstream branch:
commit 0f067a1f7199be7992d0102ecc6d5a4229241962
Author: Stephane Popinet <popinet at users.sf.net>
Date: Fri Apr 27 08:35:25 2007 +1000
Fix for inconsistent momentum diffusion
When using SourceDiffusion for variable density flows
(thanks to Shahriar Afkhami for reporting this).
darcs-hash:20070426223525-d4795-21fdb863e4c9c54cb6522c346acabb24575429eb.gz
diff --git a/src/source.c b/src/source.c
index 9cb28f4..85b0399 100644
--- a/src/source.c
+++ b/src/source.c
@@ -562,6 +562,14 @@ static void source_diffusion_read (GtsObject ** o, GtsFile * fp)
gfs_object_simulation_set (d->D, gfs_object_simulation (d));
(* GTS_OBJECT (d->D)->klass->read) ((GtsObject **) &d->D, fp);
+ if (fp->type == GTS_ERROR)
+ return;
+
+ if (GFS_SOURCE_SCALAR (d)->v->component < FTT_DIMENSION &&
+ gfs_function_get_constant_value (d->D->val) == G_MAXDOUBLE)
+ g_warning ("%d:%d: Terms may be missing when using variable diffusion\n"
+ "on vector quantities",
+ fp->line, fp->pos);
}
static void source_diffusion_write (GtsObject * o, FILE * fp)
@@ -591,14 +599,11 @@ static gdouble source_diffusion_value (GfsSourceGeneric * s,
FttCellFace f;
FttCellNeighbors n;
GfsGradient g = { 0., 0. };
- FttComponent c;
gdouble v0, h;
if (GFS_IS_MIXED (cell)) /* this improves results for channel test */
return 0.;
- c = v->component;
-
v0 = GFS_VARIABLE (cell, v->i);
f.cell = cell;
ftt_cell_neighbors (cell, &n);
@@ -614,13 +619,16 @@ static gdouble source_diffusion_value (GfsSourceGeneric * s,
g.a += D*e.a;
g.b += D*e.b;
}
- else if (f.d/2 == c) {
+ else if (f.d/2 == v->component) {
g.a += D;
g.b -= D*v0;
}
}
h = ftt_cell_size (cell);
- return (g.b - g.a*v0)/(h*h);
+
+ GfsFunction * alpha = v->component < FTT_DIMENSION ?
+ gfs_object_simulation (s)->physical_params.alpha : NULL;
+ return (alpha ? gfs_function_value (alpha, cell) : 1.)*(g.b - g.a*v0)/(h*h);
}
static void source_diffusion_class_init (GfsSourceGenericClass * klass)
@@ -816,9 +824,7 @@ static gdouble source_viscosity_value (GfsSourceGeneric * s,
FttCell * cell,
GfsVariable * v)
{
- GfsFunction * alpha = gfs_object_simulation (s)->physical_params.alpha;
-
- return (source_diffusion_value (s, cell, v)*(alpha ? gfs_function_value (alpha, cell) : 1.) +
+ return (source_diffusion_value (s, cell, v) +
source_viscosity_non_diffusion_value (s, cell, v));
}
diff --git a/test/capwave/density/convergence.ref b/test/capwave/density/convergence.ref
index 14ceae0..6914822 100644
--- a/test/capwave/density/convergence.ref
+++ b/test/capwave/density/convergence.ref
@@ -1,4 +1,4 @@
-3 0.136923
-4 0.0340786
-5 0.00570455
-6 0.00368735
+3 0.136915
+4 0.034064
+5 0.00570098
+6 0.00368321
diff --git a/test/capwave/gravity/convergence.ref b/test/capwave/gravity/convergence.ref
index 9d44609..ea9c822 100644
--- a/test/capwave/gravity/convergence.ref
+++ b/test/capwave/gravity/convergence.ref
@@ -1,4 +1,4 @@
-3 0.126981
-4 0.0257372
-5 0.00469025
-6 0.00642058
+3 0.12697
+4 0.0257208
+5 0.00468919
+6 0.00642964
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list