Added well handling to cfs_tpfa_expl_mass_transport(), simplified interface.
This commit is contained in:
parent
a779a061cc
commit
a0c54cb6de
@ -344,7 +344,6 @@ public:
|
|||||||
/// @brief
|
/// @brief
|
||||||
/// Explicit IMPES transport.
|
/// Explicit IMPES transport.
|
||||||
void explicitTransport(const double dt,
|
void explicitTransport(const double dt,
|
||||||
const double* cell_pressures,
|
|
||||||
double* cell_surfvols)
|
double* cell_surfvols)
|
||||||
{
|
{
|
||||||
if (wells_.number_of_wells != 0) {
|
if (wells_.number_of_wells != 0) {
|
||||||
@ -352,13 +351,13 @@ public:
|
|||||||
"This function does not work with wells yet.");
|
"This function does not work with wells yet.");
|
||||||
}
|
}
|
||||||
int np = 3; // Number of phases.
|
int np = 3; // Number of phases.
|
||||||
std::vector<double> masstrans_f(np*grid_.c_grid()->number_of_faces);
|
|
||||||
std::vector<double> gravtrans_f(np*grid_.c_grid()->number_of_faces);
|
well_t* wells = NULL;
|
||||||
cfs_tpfa_retrieve_masstrans(grid_.c_grid(), np, data_, &masstrans_f[0]);
|
if (wells_.number_of_wells != 0) {
|
||||||
cfs_tpfa_retrieve_gravtrans(grid_.c_grid(), np, data_, &gravtrans_f[0]);
|
wells = &wells_;
|
||||||
cfs_tpfa_expl_mass_transport(grid_.c_grid(), np, dt, &porevol_[0],
|
}
|
||||||
&masstrans_f[0], &gravtrans_f[0],
|
cfs_tpfa_expl_mass_transport(grid_.c_grid(), wells, np, dt, &porevol_[0],
|
||||||
cell_pressures, cell_surfvols);
|
data_, cell_surfvols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1050,25 +1050,37 @@ cfs_tpfa_retrieve_gravtrans(grid_t *G,
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
cfs_tpfa_expl_mass_transport(grid_t *G,
|
cfs_tpfa_expl_mass_transport(grid_t *G,
|
||||||
int np,
|
well_t *W,
|
||||||
double dt,
|
int np,
|
||||||
const double *porevol,
|
double dt,
|
||||||
const double *masstrans_f,
|
const double *porevol,
|
||||||
const double *gravtrans_f,
|
struct cfs_tpfa_data *h,
|
||||||
const double *cpress,
|
double *surf_vol)
|
||||||
double *surf_vol)
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
int c, i, f, c2, p;
|
int c, i, f, c2, p, w;
|
||||||
double dp, dz;
|
double dp, dz, gsgn;
|
||||||
|
const double *masstrans_f, *gravtrans_f, *masstrans_p;
|
||||||
|
const double *cpress, *wpress;
|
||||||
|
|
||||||
|
/* Set up convenience pointers */
|
||||||
|
masstrans_f = h->pimpl->masstrans_f;
|
||||||
|
gravtrans_f = h->pimpl->gravtrans_f;
|
||||||
|
masstrans_p = h->pimpl->masstrans_p;
|
||||||
|
cpress = h->x;
|
||||||
|
wpress = h->x + G->number_of_cells;
|
||||||
|
|
||||||
|
/* Transport through interiour faces */
|
||||||
for (c = i = 0; c < G->number_of_cells; c++) {
|
for (c = i = 0; c < G->number_of_cells; c++) {
|
||||||
for (; i < G->cell_facepos[c + 1]; i++) {
|
for (; i < G->cell_facepos[c + 1]; i++) {
|
||||||
f = G->cell_faces[i];
|
f = G->cell_faces[i];
|
||||||
|
|
||||||
if ((c2 = G->face_cells[2*f + 0]) == c) {
|
if ((c2 = G->face_cells[2*f + 0]) == c) {
|
||||||
|
gsgn = 1.0;
|
||||||
c2 = G->face_cells[2*f + 1];
|
c2 = G->face_cells[2*f + 1];
|
||||||
|
} else {
|
||||||
|
gsgn = -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c2 >= 0) {
|
if (c2 >= 0) {
|
||||||
@ -1076,13 +1088,32 @@ cfs_tpfa_expl_mass_transport(grid_t *G,
|
|||||||
|
|
||||||
for (p = 0; p < np; p++) {
|
for (p = 0; p < np; p++) {
|
||||||
dz = masstrans_f[f*np + p] * dp;
|
dz = masstrans_f[f*np + p] * dp;
|
||||||
dz += gravtrans_f[f*np + p] ;
|
dz += gravtrans_f[f*np + p] * gsgn;
|
||||||
|
|
||||||
|
/* A positive dz means flow from the cell c into
|
||||||
|
the cell c2. */
|
||||||
surf_vol[c*np + p] -= dz * dt / porevol[c];
|
surf_vol[c*np + p] -= dz * dt / porevol[c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Transport through well perforations */
|
||||||
|
if (W != NULL) {
|
||||||
|
for (w = i = 0; w < W->number_of_wells; w++) {
|
||||||
|
for (; i < W->well_connpos[w + 1]; i++) {
|
||||||
|
c = W->well_cells[i];
|
||||||
|
/* Get pressure difference between cell and well perforation */
|
||||||
|
dp = wpress[i] - cpress[c];
|
||||||
|
for (p = 0; p < np; p++) {
|
||||||
|
dz = masstrans_p[i*np + p]* dp;
|
||||||
|
/* A positive dz means flow from the well perforation
|
||||||
|
i into the cell c */
|
||||||
|
surf_vol[c*np + p] += dz * dt / porevol[c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,14 +98,13 @@ cfs_tpfa_retrieve_gravtrans(grid_t *G,
|
|||||||
double *gravtrans_f);
|
double *gravtrans_f);
|
||||||
|
|
||||||
void
|
void
|
||||||
cfs_tpfa_expl_mass_transport(grid_t *G,
|
cfs_tpfa_expl_mass_transport(grid_t *G,
|
||||||
int np,
|
well_t *W,
|
||||||
double dt,
|
int np,
|
||||||
const double *porevol,
|
double dt,
|
||||||
const double *masstrans_f,
|
const double *porevol,
|
||||||
const double *gravtrans_f,
|
struct cfs_tpfa_data *h,
|
||||||
const double *cpress,
|
double *surf_vol);
|
||||||
double *surf_vol);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cfs_tpfa_destroy(struct cfs_tpfa_data *h);
|
cfs_tpfa_destroy(struct cfs_tpfa_data *h);
|
||||||
|
Loading…
Reference in New Issue
Block a user