From 1b63e27899735c34850fa0c54b0cef522fc34e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Tue, 16 Oct 2012 13:55:07 +0200 Subject: [PATCH] Rename CompletionData::gpot -> wdp . This is in preparation of implementing actual gravity support in (compressible) well-pressure solution. --- opm/core/newwells.h | 2 +- opm/core/pressure/CompressibleTpfa.cpp | 14 +++++------ opm/core/pressure/CompressibleTpfa.hpp | 2 +- opm/core/pressure/tpfa/cfs_tpfa_residual.c | 27 +++++++++++----------- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/opm/core/newwells.h b/opm/core/newwells.h index f9a61c54..f950cdb2 100644 --- a/opm/core/newwells.h +++ b/opm/core/newwells.h @@ -192,7 +192,7 @@ struct CompletionData /** * Gravity potentials. */ - double *gpot; + double *wdp; /** * Volumes to surface-components matrix, A = RB^{-1}. diff --git a/opm/core/pressure/CompressibleTpfa.cpp b/opm/core/pressure/CompressibleTpfa.cpp index 8edb41a0..16738532 100644 --- a/opm/core/pressure/CompressibleTpfa.cpp +++ b/opm/core/pressure/CompressibleTpfa.cpp @@ -216,8 +216,8 @@ namespace Opm const int nperf = wells_->well_connpos[nw]; const int dim = grid_.dimensions; const double grav = gravity_ ? gravity_[dim - 1] : 0.0; - wellperf_gpot_.clear(); - wellperf_gpot_.resize(np*nperf, 0.0); + wellperf_wdp_.clear(); + wellperf_wdp_.resize(np*nperf, 0.0); if (grav == 0.0) { return; } @@ -239,7 +239,7 @@ namespace Opm props_.matrix(1, &state.pressure()[cell], &state.surfacevol()[np*cell], &cell, &A[0], 0); props_.density(1, &A[0], &rho[0]); for (int phase = 0; phase < np; ++phase) { - wellperf_gpot_[np*j + phase] = rho[phase]*grav*(cell_depth - ref_depth); + wellperf_wdp_[np*j + phase] = rho[phase]*grav*(cell_depth - ref_depth); } } } @@ -480,7 +480,7 @@ namespace Opm const double bhp = well_state.bhp()[w]; double perf_p = bhp; for (int phase = 0; phase < np; ++phase) { - perf_p += wellperf_gpot_[np*j + phase]*comp_frac[phase]; + perf_p += wellperf_wdp_[np*j + phase]*comp_frac[phase]; } // Hack warning: comp_frac is used as a component // surface-volume variable in calls to matrix() and @@ -512,7 +512,7 @@ namespace Opm const double* z = &state.surfacevol()[0]; UnstructuredGrid* gg = const_cast(&grid_); CompletionData completion_data; - completion_data.gpot = ! wellperf_gpot_.empty() ? &wellperf_gpot_[0] : 0; + completion_data.wdp = ! wellperf_wdp_.empty() ? &wellperf_wdp_[0] : 0; completion_data.A = ! wellperf_A_.empty() ? &wellperf_A_[0] : 0; completion_data.phasemob = ! wellperf_phasemob_.empty() ? &wellperf_phasemob_[0] : 0; cfs_tpfa_res_wells wells_tmp; @@ -599,7 +599,7 @@ namespace Opm { UnstructuredGrid* gg = const_cast(&grid_); CompletionData completion_data; - completion_data.gpot = ! wellperf_gpot_.empty() ? const_cast(&wellperf_gpot_[0]) : 0; + completion_data.wdp = ! wellperf_wdp_.empty() ? const_cast(&wellperf_wdp_[0]) : 0; completion_data.A = ! wellperf_A_.empty() ? const_cast(&wellperf_A_[0]) : 0; completion_data.phasemob = ! wellperf_phasemob_.empty() ? const_cast(&wellperf_phasemob_[0]) : 0; cfs_tpfa_res_wells wells_tmp; @@ -643,7 +643,7 @@ namespace Opm const double bhp = well_state.bhp()[w]; double perf_p = bhp; for (int phase = 0; phase < np; ++phase) { - perf_p += wellperf_gpot_[np*j + phase]*comp_frac[phase]; + perf_p += wellperf_wdp_[np*j + phase]*comp_frac[phase]; } well_state.perfPress()[j] = perf_p; } diff --git a/opm/core/pressure/CompressibleTpfa.hpp b/opm/core/pressure/CompressibleTpfa.hpp index 0b54178e..bf9e2901 100644 --- a/opm/core/pressure/CompressibleTpfa.hpp +++ b/opm/core/pressure/CompressibleTpfa.hpp @@ -134,7 +134,7 @@ namespace Opm struct cfs_tpfa_res_data* h_; // ------ Data that will be modified for every solve. ------ - std::vector wellperf_gpot_; + std::vector wellperf_wdp_; std::vector initial_porevol_; // ------ Data that will be modified for every solver iteration. ------ diff --git a/opm/core/pressure/tpfa/cfs_tpfa_residual.c b/opm/core/pressure/tpfa/cfs_tpfa_residual.c index bcbacec2..02c6d254 100644 --- a/opm/core/pressure/tpfa/cfs_tpfa_residual.c +++ b/opm/core/pressure/tpfa/cfs_tpfa_residual.c @@ -420,15 +420,15 @@ compute_well_compflux_and_deriv(struct cfs_tpfa_res_wells *wells , const double *wpress, struct cfs_tpfa_res_impl *pimpl ) { - int c, i, w, np2; - double pw, dp; - double *WI, *gpot, *Ap, *pmobp; - - double *pflux, *dpflux; + int c, i, w, np2; + double pw, dp; + const double *WI, *wdp, *Ap, *pmobp; + double *pflux, *dpflux, gpot[3] = { 0.0 }; struct Wells *W; assert (wells->W != NULL); + assert (wells->W->number_of_phases <= 3); W = wells->W; @@ -436,7 +436,7 @@ compute_well_compflux_and_deriv(struct cfs_tpfa_res_wells *wells , assert (W->data != NULL); WI = W->WI; - gpot = wells->data->gpot; + wdp = wells->data->wdp; Ap = wells->data->A; pmobp = wells->data->phasemob; @@ -449,11 +449,11 @@ compute_well_compflux_and_deriv(struct cfs_tpfa_res_wells *wells , pw = wpress[w]; for (; i < W->well_connpos[w + 1]; i++, - gpot += np, Ap += np2, pmobp += np, + Ap += np2, pmobp += np, pflux += np, dpflux += 2 * np) { c = W->well_cells[i]; - dp = pw - cpress[c]; + dp = pw + wdp[i]- cpress[c]; compute_darcyflux_and_deriv(np, WI[i], dp, pmobp, gpot, pimpl->flux_work, @@ -909,8 +909,8 @@ assemble_well_contrib(struct cfs_tpfa_res_wells *wells , { int w, i, c, np, np2, nc; int is_neumann, is_open; - double pw, dp; - double *WI, *gpot, *pmobp; + double pw, dp, gpot[3] = { 0.0 }; + const double *WI, *wdp, *pmobp; const double *Ac, *dAc; struct Wells *W; @@ -923,7 +923,7 @@ assemble_well_contrib(struct cfs_tpfa_res_wells *wells , W = wells->W; WI = W->WI; - gpot = wells->data->gpot; + wdp = wells->data->wdp; pmobp = wells->data->phasemob; is_neumann = 1; @@ -932,14 +932,13 @@ assemble_well_contrib(struct cfs_tpfa_res_wells *wells , pw = wpress[ w ]; is_open = W->ctrls[w]->current >= 0; - for (; i < W->well_connpos[w + 1]; - i++, gpot += np, pmobp += np) { + for (; i < W->well_connpos[w + 1]; i++, pmobp += np) { c = W->well_cells[ i ]; Ac = cq->Ac + (c * np2); dAc = cq->dAc + (c * np2); - dp = pw - cpress[ c ]; + dp = pw + wdp[i] - cpress[ c ]; init_completion_contrib(i, np, Ac, dAc, h->pimpl);