Take gravity into effect when assembling Dirichlet boundary conditions.

This commit is contained in:
Bård Skaflestad 2012-03-13 14:42:38 +01:00
parent 29ba859a80
commit 427a2e6712

View File

@ -158,10 +158,11 @@ assemble_bc_contrib(struct UnstructuredGrid *G ,
struct ifs_tpfa_data *h )
/* ---------------------------------------------------------------------- */
{
int is_neumann;
int is_neumann, is_inflow;
int f, c1, c2;
size_t i, j, ix;
double s;
is_neumann = 1;
@ -176,11 +177,15 @@ assemble_bc_contrib(struct UnstructuredGrid *G ,
assert ((c1 < 0) ^ (c2 < 0)); /* BCs on ext. faces only */
c1 = (c1 >= 0) ? c1 : c2;
is_inflow = c1 >= 0;
s = 2.0*is_inflow - 1.0;
c1 = is_inflow ? c1 : c2;
ix = csrmatrix_elm_index(c1, c1, h->A);
h->A->sa[ ix ] += trans[ f ];
h->b [ c1 ] += trans[ f ] * bc->value[ i ];
h->b [ c1 ] -= s * trans[f] * h->pimpl->fgrav[f];
}
}