[SCM] Gerris Flow Solver branch, upstream, updated. b3aa46814a06c9cb2912790b23916ffb44f1f203
Stephane Popinet
popinet at users.sourceforge.net
Fri May 15 02:51:29 UTC 2009
The following commit has been merged in the upstream branch:
commit 6f27eb25f2b528f9b0d82f4d85f5240e5551161d
Author: Stephane Popinet <popinet at users.sourceforge.net>
Date: Tue Dec 7 14:33:05 2004 +1100
Important bug fix for GfsEventHarmonic (gerris--ocean--0.7--patch-26)
gerris--ocean--0.7--patch-26
Keywords:
The right-hand-side for the least-mean-square of the offset was not
properly computed.
darcs-hash:20041207033305-aabb8-acc591e8940f75b56c31737c3ed5231631c805d2.gz
diff --git a/src/event.c b/src/event.c
index 8eef5ed..ea1da94 100644
--- a/src/event.c
+++ b/src/event.c
@@ -911,9 +911,12 @@ static void gfs_event_harmonic_destroy (GtsObject * o)
{
GfsEventHarmonic * s = GFS_EVENT_HARMONIC (o);
- gfs_matrix_free (s->Mn);
- gfs_matrix_free (s->M);
- gfs_matrix_free (s->iM);
+ if (s->Mn)
+ gfs_matrix_free (s->Mn);
+ if (s->M)
+ gfs_matrix_free (s->M);
+ if (s->iM)
+ gfs_matrix_free (s->iM);
g_free (s->A);
g_free (s->B);
@@ -1071,16 +1074,19 @@ static void gfs_event_harmonic_read (GtsObject ** o, GtsFile * fp)
static void add_xsin_xcos (FttCell * cell, GfsEventHarmonic * h)
{
+ gdouble x = GFS_VARIABLE (cell, h->v->i);
guint i;
for (i = 0; i < h->omega->len; i++) {
- GFS_VARIABLE (cell, h->A[i]->i) += GFS_VARIABLE (cell, h->v->i)*h->vcos[i];
- GFS_VARIABLE (cell, h->B[i]->i) += GFS_VARIABLE (cell, h->v->i)*h->vsin[i];
+ GFS_VARIABLE (cell, h->A[i]->i) += x*h->vcos[i];
+ GFS_VARIABLE (cell, h->B[i]->i) += x*h->vsin[i];
}
+ GFS_VARIABLE (cell, h->z->i) += x;
}
static void update_A_B_Z (FttCell * cell, GfsEventHarmonic * h)
{
+ gdouble x = GFS_VARIABLE (cell, h->v->i);
guint n = h->omega->len;
guint i, j;
@@ -1092,7 +1098,7 @@ static void update_A_B_Z (FttCell * cell, GfsEventHarmonic * h)
h->a[2*n] = GFS_VARIABLE (cell, h->z->i);
/* X^n = M^n.A^n */
- for (i = 0; i < 2*n; i++) {
+ for (i = 0; i < 2*n + 1; i++) {
h->x[i] = 0.;
for (j = 0; j < 2*n + 1; j++)
h->x[i] += h->Mn[i][j]*h->a[j];
@@ -1100,10 +1106,10 @@ static void update_A_B_Z (FttCell * cell, GfsEventHarmonic * h)
/* X^n+1 = X^n + Delta^n */
for (i = 0; i < n; i++) {
- h->x[i] += GFS_VARIABLE (cell, h->v->i)*h->vcos[i];
- h->x[i + n] += GFS_VARIABLE (cell, h->v->i)*h->vsin[i];
+ h->x[i] += x*h->vcos[i];
+ h->x[i + n] += x*h->vsin[i];
}
- h->x[2*n] = 0.;
+ h->x[2*n] += x;
/* A^n+1 = (M^n+1)^-1.X^n+1 */
for (i = 0; i < 2*n + 1; i++) {
--
Gerris Flow Solver
More information about the debian-science-commits
mailing list