[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:56:02 UTC 2009
The following commit has been merged in the upstream branch:
commit f30feaec46da7c98f6e5ed577c799addb8e06b7c
Author: Stephane Popinet <popinet at users.sf.net>
Date: Thu Jan 22 09:33:18 2009 +1100
Friction for the River model is implemented using SourceCoriolis
darcs-hash:20090121223318-d4795-c7d1da28b5cca6cfa92310147f37c4de8bce472a.gz
diff --git a/src/river.c b/src/river.c
index 133cd37..76f6405 100644
--- a/src/river.c
+++ b/src/river.c
@@ -1,5 +1,25 @@
+/* Gerris - The GNU Flow Solver
+ * Copyright (C) 2001-2009 National Institute of Water and Atmospheric Research
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
#include "river.h"
#include "adaptive.h"
+#include "source.h"
#define DRY 1e-6
@@ -163,17 +183,17 @@ static void sources (FttCell * cell, GfsRiver * r)
gdouble etaR = GFS_VALUE (cell, r->v1[0]) + GFS_VALUE (cell, r->dv[0][0]);
gdouble zbR = GFS_VALUE (cell, r->v[3]) + GFS_VALUE (cell, r->dv[0][3]);
- GFS_VALUE (cell, r->vc[1]) += r->dt*r->g/2.*(etaL + etaR)*(zbL - zbR)/delta;
+ GFS_VALUE (cell, r->v[1]) += r->dt*r->g/2.*(etaL + etaR)*(zbL - zbR)/delta;
etaL = GFS_VALUE (cell, r->v1[0]) - GFS_VALUE (cell, r->dv[1][0]);
zbL = GFS_VALUE (cell, r->v[3]) - GFS_VALUE (cell, r->dv[1][3]);
etaR = GFS_VALUE (cell, r->v1[0]) + GFS_VALUE (cell, r->dv[1][0]);
zbR = GFS_VALUE (cell, r->v[3]) + GFS_VALUE (cell, r->dv[1][3]);
- GFS_VALUE (cell, r->vc[2]) += r->dt*r->g/2.*(etaL + etaR)*(zbL - zbR)/delta;
+ GFS_VALUE (cell, r->v[2]) += r->dt*r->g/2.*(etaL + etaR)*(zbL - zbR)/delta;
}
-static void advance (GfsRiver * r, GfsVariable ** v, gdouble dt)
+static void advance (GfsRiver * r, gdouble dt)
{
GfsDomain * domain = GFS_DOMAIN (r);
guint i;
@@ -183,16 +203,18 @@ static void advance (GfsRiver * r, GfsVariable ** v, gdouble dt)
gfs_domain_face_traverse (domain, FTT_XYZ,
FTT_PRE_ORDER, FTT_TRAVERSE_LEAFS, -1,
(FttFaceTraverseFunc) face_fluxes, r);
- r->vc = v;
gfs_domain_traverse_leaves (domain, (FttCellTraverseFunc) sources, r);
for (i = 0; i < GFS_RIVER_NVAR; i++) {
GfsAdvectionParams par;
- par.v = v[i];
+ par.v = r->v[i];
par.fv = r->flux[i];
par.average = FALSE;
gfs_domain_traverse_merged (domain, (GfsMergedTraverseFunc) gfs_advection_update, &par);
- gfs_domain_copy_bc (domain, FTT_TRAVERSE_LEAFS, -1, r->v[i], par.v);
+ gfs_domain_variable_centered_sources (domain, par.v, par.v, dt);
}
+ gfs_source_coriolis_implicit (domain, dt);
+ for (i = 0; i < GFS_RIVER_NVAR; i++)
+ gfs_domain_bc (domain, FTT_TRAVERSE_LEAFS, -1, r->v[i]);
}
static void copy (FttCell * cell, const GfsRiver * r)
@@ -287,12 +309,16 @@ static void river_run (GfsSimulation * sim)
/* predictor */
gfs_domain_timer_start (domain, "predictor");
domain_traverse_all_leaves (domain, (FttCellTraverseFunc) copy, r);
- advance (r, r->v1, sim->advection_params.dt/2.);
+ for (v = 0; v < GFS_RIVER_NVAR; v++)
+ gfs_variables_swap (r->v[v], r->v1[v]);
+ advance (r, sim->advection_params.dt/2.);
+ for (v = 0; v < GFS_RIVER_NVAR; v++)
+ gfs_variables_swap (r->v[v], r->v1[v]);
gfs_domain_timer_stop (domain, "predictor");
/* corrector */
gfs_domain_timer_start (domain, "corrector");
- advance (r, r->v, sim->advection_params.dt);
+ advance (r, sim->advection_params.dt);
gfs_domain_timer_stop (domain, "corrector");
gfs_domain_cell_traverse (domain,
diff --git a/src/river.h b/src/river.h
index 08b852c..4106bdc 100644
--- a/src/river.h
+++ b/src/river.h
@@ -9,7 +9,6 @@ typedef struct _GfsRiver GfsRiver;
struct _GfsRiver {
/*< private >*/
GfsSimulation parent;
- GfsVariable ** vc;
gdouble cfl;
/*< public >*/
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list