[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sf.net
Fri May 15 02:53:03 UTC 2009
The following commit has been merged in the upstream branch:
commit 12017b589080647cd0da3f0d0be2aa68e056c5bb
Author: Stephane Popinet <popinet at users.sf.net>
Date: Sat Jan 28 08:33:58 2006 +1100
MAC pressure is saved
Both the MAC and approximate projections thus have better initial guesses. When
looking for stationary solutions this makes a big difference.
darcs-hash:20060127213358-d4795-3f247307f69264f3421a573f6d06aada5f4fd72a.gz
diff --git a/src/simulation.c b/src/simulation.c
index da66b75..0c2daed 100644
--- a/src/simulation.c
+++ b/src/simulation.c
@@ -495,7 +495,7 @@ static void simulation_read (GtsObject ** object, GtsFile * fp)
static void simulation_run (GfsSimulation * sim)
{
- GfsVariable * p, * res = NULL;
+ GfsVariable * p, * pmac, * res = NULL;
GfsDomain * domain;
GSList * i;
@@ -503,6 +503,7 @@ static void simulation_run (GfsSimulation * sim)
p = gfs_variable_from_name (domain->variables, "P");
g_assert (p);
+ pmac = gfs_temporary_variable (domain);
gfs_simulation_refine (sim);
@@ -541,10 +542,12 @@ static void simulation_run (GfsSimulation * sim)
gfs_predicted_face_velocities (domain, FTT_DIMENSION, &sim->advection_params);
+ gfs_variables_swap (p, pmac);
gfs_mac_projection (domain,
&sim->projection_params,
&sim->advection_params,
p, sim->physical_params.alpha, g);
+ gfs_variables_swap (p, pmac);
i = domain->variables;
while (i) {
@@ -590,6 +593,7 @@ static void simulation_run (GfsSimulation * sim)
gts_container_foreach (GTS_CONTAINER (sim->events), (GtsFunc) gfs_event_do, sim);
gts_container_foreach (GTS_CONTAINER (sim->events),
(GtsFunc) gts_object_destroy, NULL);
+ gts_object_destroy (GTS_OBJECT (pmac));
}
static void gfs_simulation_class_init (GfsSimulationClass * klass)
diff --git a/src/variable.c b/src/variable.c
index f4b1479..cc6c342 100644
--- a/src/variable.c
+++ b/src/variable.c
@@ -202,6 +202,24 @@ GSList * gfs_variables_from_list (GSList * i,
return var;
}
+/**
+ * gfs_variables_swap:
+ * @v1: a #GfsVariable.
+ * @v2: a #GfsVariable.
+ *
+ * Swaps the values of @v1 and @v2, belonging to the same #GfsDomain.
+ */
+void gfs_variables_swap (GfsVariable * v1, GfsVariable * v2)
+{
+ guint i;
+
+ g_return_if_fail (v1 != NULL);
+ g_return_if_fail (v2 != NULL);
+ g_return_if_fail (v1->domain == v2->domain);
+
+ i = v1->i; v1->i = v2->i; v2->i = i;
+}
+
/* GfsVariableTracer: object */
static void variable_tracer_read (GtsObject ** o, GtsFile * fp)
diff --git a/src/variable.h b/src/variable.h
index 338df7c..4d25b08 100644
--- a/src/variable.h
+++ b/src/variable.h
@@ -77,6 +77,8 @@ GfsVariable * gfs_variable_from_name (GSList * i,
GSList * gfs_variables_from_list (GSList * i,
gchar * list,
gchar ** error);
+void gfs_variables_swap (GfsVariable * v1,
+ GfsVariable * v2);
#define gfs_variable_set_vector(v, c) ((v)->component = (c))
/* GfsVariableTracer: header */
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list