[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
s.popinet at niwa.co.nz
Fri May 15 02:51:41 UTC 2009
The following commit has been merged in the upstream branch:
commit c106d45da03dd8340c4fc505c9eda3888452d5a8
Author: Stephane Popinet <s.popinet at niwa.co.nz>
Date: Tue Feb 22 10:13:39 2005 +1100
Mixed cell refinement fixes in 3D
The advection fix could be improved (it does not currently take into account
the solid fractions, unlike the 2D version of the fix).
darcs-hash:20050221231339-fbd8f-c5a7d61bceb49c60c1857d00783331ba48cb21b1.gz
diff --git a/src/advection.c b/src/advection.c
index 4ed245d..6cfc6f5 100644
--- a/src/advection.c
+++ b/src/advection.c
@@ -236,7 +236,8 @@ static gdouble interpolate_2D1 (const FttCell * cell,
FttDirection dleft;
g_return_val_if_fail (cell != NULL, 0.);
- g_return_val_if_fail (!GFS_IS_MIXED (cell), 0.);
+ /* fixme: this routine does not take into account mixed cells
+ fractions (in contrast to interpolate_1D1 above) */
dleft = FTT_OPPOSITE_DIRECTION (dright);
v0 = GFS_STATE (cell)->f[dleft].v;
@@ -252,13 +253,16 @@ static gdouble interpolate_2D1 (const FttCell * cell,
d[0] = FTT_OPPOSITE_DIRECTION (dright);
d[1] = FTT_OPPOSITE_DIRECTION (d1);
d[2] = d2;
- n1 = ftt_cell_child_corner (n1, d);
- /* check for mixed cell refinement violation */
- g_assert (n1);
- x1 = 1./4.;
- y1 = 3./4.;
+ if ((n1 = ftt_cell_child_corner (n1, d))) {
+ v1 = GFS_STATE (n1)->f[dleft].v;
+ x1 = 1./4.;
+ y1 = 3./4.;
+ }
+ else
+ v1 = v0;
}
- v1 = GFS_STATE (n1)->f[dleft].v;
+ else
+ v1 = GFS_STATE (n1)->f[dleft].v;
}
else
v1 = v0;
@@ -274,13 +278,16 @@ static gdouble interpolate_2D1 (const FttCell * cell,
d[0] = FTT_OPPOSITE_DIRECTION (dright);
d[1] = FTT_OPPOSITE_DIRECTION (d2);
d[2] = d1;
- n2 = ftt_cell_child_corner (n2, d);
- /* check for mixed cell refinement violation */
- g_assert (n2);
- x2 = 3./4.;
- y2 = 1./4.;
+ if ((n2 = ftt_cell_child_corner (n2, d))) {
+ v2 = GFS_STATE (n2)->f[dleft].v;
+ x2 = 3./4.;
+ y2 = 1./4.;
+ }
+ else
+ v2 = v0;
}
- v2 = GFS_STATE (n2)->f[dleft].v;
+ else
+ v2 = GFS_STATE (n2)->f[dleft].v;
}
else
v2 = v0;
diff --git a/src/fluid.c b/src/fluid.c
index 74a18aa..6e3bfa9 100644
--- a/src/fluid.c
+++ b/src/fluid.c
@@ -158,9 +158,9 @@ static GfsGradient interpolate_1D1 (FttCell * cell,
* First order 2D interpolation.
*/
static GfsGradient interpolate_2D1 (FttCell * cell,
- FttDirection d1, FttDirection d2,
- gdouble x, gdouble y,
- guint v)
+ FttDirection d1, FttDirection d2,
+ gdouble x, gdouble y,
+ guint v)
{
GfsGradient p;
gdouble y1 = 1.;
@@ -170,7 +170,6 @@ static GfsGradient interpolate_2D1 (FttCell * cell,
FttCellFace f1, f2;
g_return_val_if_fail (cell != NULL, p);
- g_return_val_if_fail (!GFS_IS_MIXED (cell), p);
f1 = ftt_cell_face (cell, d1);
if (f1.neighbor)
@@ -1067,22 +1066,18 @@ void gfs_face_gradient_flux (const FttCellFace * face,
f.d = FTT_OPPOSITE_DIRECTION (face->d);
n = ftt_cell_children_direction (face->neighbor, f.d, &children);
f.neighbor = face->cell;
- for (i = 0; i < n; i++) {
- f.cell = children.c[i];
- w = GFS_STATE (f.cell)->f[f.d].v;
-
- /* check for mixed cell refinement violation (topology.fig) */
- g_assert (f.cell);
-
- if (GFS_IS_MIXED (f.cell) || GFS_IS_MIXED (f.neighbor)) {
- if (!mixed_face_gradient (&f, &gcf, v, max_level))
+ for (i = 0; i < n; i++)
+ if ((f.cell = children.c[i])) {
+ w = GFS_STATE (f.cell)->f[f.d].v;
+ if (GFS_IS_MIXED (f.cell) || GFS_IS_MIXED (f.neighbor)) {
+ if (!mixed_face_gradient (&f, &gcf, v, max_level))
+ gcf = gradient_fine_coarse (&f, v, max_level);
+ }
+ else
gcf = gradient_fine_coarse (&f, v, max_level);
+ g->a += w*gcf.b;
+ g->b += w*(gcf.a*GFS_VARIABLE (f.cell, v) - gcf.c);
}
- else
- gcf = gradient_fine_coarse (&f, v, max_level);
- g->a += w*gcf.b;
- g->b += w*(gcf.a*GFS_VARIABLE (f.cell, v) - gcf.c);
- }
}
}
}
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list