[SCM] Gerris Flow Solver branch, upstream, updated. e8f73a07832050124d2b8bf6c6f35b33180e65a8
Stephane Popinet
popinet at users.sf.net
Tue Nov 24 12:25:15 UTC 2009
The following commit has been merged in the upstream branch:
commit 620d232a0f9d85c97083aafc7fbe911f386a018e
Author: Stephane Popinet <popinet at users.sf.net>
Date: Wed Oct 7 13:43:27 2009 +1100
CFL calculation for GfsRiver takes metric into account
darcs-hash:20091007024327-d4795-f23679e0fd08ae9ef3b6060acec129f76bf1fcf1.gz
diff --git a/src/river.c b/src/river.c
index 0dbb33d..2401fdd 100644
--- a/src/river.c
+++ b/src/river.c
@@ -382,21 +382,37 @@ static void river_run (GfsSimulation * sim)
gts_container_foreach (GTS_CONTAINER (sim->events), (GtsFunc) gts_object_destroy, NULL);
}
+static gdouble maximum_face_metric (FttCell * cell, GfsDomain * domain, FttComponent c)
+{
+ if (domain->face_metric) {
+ FttCellFace f;
+ f.cell = cell; f.d = 2*c;
+ gdouble fm1 = (* domain->face_metric) (domain, &f, domain->metric_data);
+ f.d = 2*c + 1;
+ gdouble fm2 = (* domain->face_metric) (domain, &f, domain->metric_data);
+ return MAX (fm1, fm2);
+ }
+ else
+ return 1.;
+}
+
static void minimum_cfl (FttCell * cell, GfsRiver * r)
{
- gdouble size = ftt_cell_size (cell);
gdouble h = GFS_VALUE (cell, r->v[0]);
if (h > GFS_RIVER_DRY) {
- gdouble uh = fabs (GFS_VALUE (cell, r->v[1]));
- gdouble c = sqrt (r->g*h);
- gdouble cfl = size/(uh/h + c);
- if (cfl < r->cfl)
- r->cfl = cfl;
-
- gdouble vh = fabs (GFS_VALUE (cell, r->v[2]));
- cfl = size/(vh/h + c);
- if (cfl < r->cfl)
- r->cfl = cfl;
+ GfsDomain * domain = GFS_DOMAIN (r);
+ gdouble vol = ftt_cell_size (cell);
+ if (domain->cell_metric)
+ vol *= (* domain->cell_metric) (domain, cell, domain->metric_data);
+ gdouble cg = sqrt (r->g*h);
+ FttComponent c;
+ for (c = FTT_X; c <= FTT_Y; c++) {
+ gdouble uh = fabs (GFS_VALUE (cell, r->v[c + 1]));
+ gdouble fm = maximum_face_metric (cell, domain, c);
+ gdouble cfl = vol/(fm*(uh/h + cg));
+ if (cfl < r->cfl)
+ r->cfl = cfl;
+ }
}
}
diff --git a/test/lonlat/coriolis/coriolis.gfs b/test/lonlat/coriolis/coriolis.gfs
index c101df2..aa59a24 100644
--- a/test/lonlat/coriolis/coriolis.gfs
+++ b/test/lonlat/coriolis/coriolis.gfs
@@ -32,7 +32,6 @@ Define LENGTH (150./180.*M_PI)
1 0 GfsRiver GfsBox GfsGEdge {} {
PhysicalParams { L = LENGTH }
MetricLonLat 1.
- AdvectionParams { cfl = 0.4 }
Refine 8
InitFraction P (0.2 - acos(cos(x)*cos(y)))
Init {} { P = 0.2 + 1.8*P/LENGTH }
diff --git a/test/lonlat/lonlat.gfs b/test/lonlat/lonlat.gfs
index 920e726..0135b77 100644
--- a/test/lonlat/lonlat.gfs
+++ b/test/lonlat/lonlat.gfs
@@ -52,7 +52,6 @@ Define LENGTH (150./180.*M_PI)
1 0 GfsRiver GfsBox GfsGEdge {} {
PhysicalParams { L = LENGTH }
MetricLonLat 1.
- AdvectionParams { cfl = 0.4 }
Refine 8
InitFraction P (0.2 - acos(cos(x)*cos(y)))
Init {} { P = 0.2 + 1.8*P/LENGTH }
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list