diff --git a/src/cfs_tpfa.c b/src/cfs_tpfa.c index 6724f228..72126a56 100644 --- a/src/cfs_tpfa.c +++ b/src/cfs_tpfa.c @@ -681,6 +681,44 @@ cfs_tpfa_retrieve_gravtrans(grid_t *G, } +/* ---------------------------------------------------------------------- */ +void +cfs_tpfa_expl_mass_transport(grid_t *G, + int np, + double dt, + const double *porevol, + const double *masstrans_f, + const double *gravtrans_f, + const double *cpress, + double *surf_vol) +/* ---------------------------------------------------------------------- */ +{ + int c, i, f, c2, p; + double dp, dz; + + for (c = i = 0; c < G->number_of_cells; c++) { + for (; i < G->cell_facepos[c + 1]; i++) { + f = G->cell_faces[i]; + + if ((c2 = G->face_cells[2*f + 0]) == c) { + c2 = G->face_cells[2*f + 1]; + } + + if (c2 >= 0) { + dp = cpress[c] - cpress[c2]; + + for (p = 0; p < np; p++) { + dz = masstrans_f[f*np + p] * dp; + dz += gravtrans_f[f*np + p] ; + + surf_vol[c*np + p] -= dz * dt / porevol[c]; + } + } + } + } +} + + /* ---------------------------------------------------------------------- */ void cfs_tpfa_destroy(struct cfs_tpfa_data *h) diff --git a/src/cfs_tpfa.h b/src/cfs_tpfa.h index 7ac253b0..9b9cff2b 100644 --- a/src/cfs_tpfa.h +++ b/src/cfs_tpfa.h @@ -86,6 +86,16 @@ cfs_tpfa_retrieve_gravtrans(grid_t *G, struct cfs_tpfa_data *h, double *gravtrans_f); +void +cfs_tpfa_expl_mass_transport(grid_t *G, + int np, + double dt, + const double *porevol, + const double *masstrans_f, + const double *gravtrans_f, + const double *cpress, + double *surf_vol); + void cfs_tpfa_destroy(struct cfs_tpfa_data *h);