From db0517f794879f5c348058d2cf7ba2a612977f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Mon, 25 Oct 2010 20:28:34 +0200 Subject: [PATCH] Remove zero eigenval. Prepare for adding gravity. --- ifs_tpfa.c | 13 +++++++++++-- ifs_tpfa.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ifs_tpfa.c b/ifs_tpfa.c index 5a633fca..61608840 100644 --- a/ifs_tpfa.c +++ b/ifs_tpfa.c @@ -8,6 +8,8 @@ struct ifs_tpfa_impl { + double *fgrav; /* Accumulated grav contrib/face */ + /* Linear storage */ double *ddata; }; @@ -36,6 +38,7 @@ impl_allocate(grid_t *G) size_t ddata_sz; ddata_sz = 2 * G->number_of_cells; /* b, x */ + ddata_sz += 1 * G->number_of_faces; /* fgrav */ new = malloc(1 * sizeof *new); @@ -142,6 +145,8 @@ ifs_tpfa_construct(grid_t *G) if (new != NULL) { new->b = new->pimpl->ddata; new->x = new->b + new->A->m; + + new->pimpl->fgrav = new->x + new->A->m; } return new; @@ -153,13 +158,15 @@ void ifs_tpfa_assemble(grid_t *G, const double *trans, const double *src, + const double *gpress, struct ifs_tpfa_data *h) /* ---------------------------------------------------------------------- */ { int c1, c2, c, i, f, j1, j2; - csrmatrix_zero( h->A); - vector_zero (h->A->m, h->b); + csrmatrix_zero( h->A); + vector_zero (h->A->m, h->b); + vector_zero (G->number_of_faces, h->pimpl->fgrav); for (c = i = 0; c < G->number_of_cells; c++) { j1 = csrmatrix_elm_index(c, c, h->A); @@ -182,6 +189,8 @@ ifs_tpfa_assemble(grid_t *G, h->b[c] += src[c]; } + + h->A->sa[0] *= 2; } diff --git a/ifs_tpfa.h b/ifs_tpfa.h index 433e9bcf..4d4b08ca 100644 --- a/ifs_tpfa.h +++ b/ifs_tpfa.h @@ -41,6 +41,7 @@ void ifs_tpfa_assemble(grid_t *G, const double *trans, const double *src, + const double *gpress, struct ifs_tpfa_data *h); void