Remove zero eigenval. Prepare for adding gravity.

This commit is contained in:
Bård Skaflestad 2010-10-25 20:28:34 +02:00
parent f486eb01fe
commit db0517f794
2 changed files with 12 additions and 2 deletions

View File

@ -8,6 +8,8 @@
struct ifs_tpfa_impl { struct ifs_tpfa_impl {
double *fgrav; /* Accumulated grav contrib/face */
/* Linear storage */ /* Linear storage */
double *ddata; double *ddata;
}; };
@ -36,6 +38,7 @@ impl_allocate(grid_t *G)
size_t ddata_sz; size_t ddata_sz;
ddata_sz = 2 * G->number_of_cells; /* b, x */ ddata_sz = 2 * G->number_of_cells; /* b, x */
ddata_sz += 1 * G->number_of_faces; /* fgrav */
new = malloc(1 * sizeof *new); new = malloc(1 * sizeof *new);
@ -142,6 +145,8 @@ ifs_tpfa_construct(grid_t *G)
if (new != NULL) { if (new != NULL) {
new->b = new->pimpl->ddata; new->b = new->pimpl->ddata;
new->x = new->b + new->A->m; new->x = new->b + new->A->m;
new->pimpl->fgrav = new->x + new->A->m;
} }
return new; return new;
@ -153,13 +158,15 @@ void
ifs_tpfa_assemble(grid_t *G, ifs_tpfa_assemble(grid_t *G,
const double *trans, const double *trans,
const double *src, const double *src,
const double *gpress,
struct ifs_tpfa_data *h) struct ifs_tpfa_data *h)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
{ {
int c1, c2, c, i, f, j1, j2; int c1, c2, c, i, f, j1, j2;
csrmatrix_zero( h->A); csrmatrix_zero( h->A);
vector_zero (h->A->m, h->b); 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++) { for (c = i = 0; c < G->number_of_cells; c++) {
j1 = csrmatrix_elm_index(c, c, h->A); j1 = csrmatrix_elm_index(c, c, h->A);
@ -182,6 +189,8 @@ ifs_tpfa_assemble(grid_t *G,
h->b[c] += src[c]; h->b[c] += src[c];
} }
h->A->sa[0] *= 2;
} }

View File

@ -41,6 +41,7 @@ void
ifs_tpfa_assemble(grid_t *G, ifs_tpfa_assemble(grid_t *G,
const double *trans, const double *trans,
const double *src, const double *src,
const double *gpress,
struct ifs_tpfa_data *h); struct ifs_tpfa_data *h);
void void