mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Assemble_rate_well(): Don't look up wdof diagonal element multiple times.
This commit is contained in:
parent
de44295f32
commit
af80492ff3
@ -236,7 +236,7 @@ assemble_rate_well(int nc, int w,
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
int c, i, wdof;
|
int c, i, wdof;
|
||||||
size_t jc, jw;
|
size_t jcc, jcw, jwc, jww;
|
||||||
double trans, resv;
|
double trans, resv;
|
||||||
|
|
||||||
struct WellControls *ctrls;
|
struct WellControls *ctrls;
|
||||||
@ -245,25 +245,27 @@ assemble_rate_well(int nc, int w,
|
|||||||
wdof = nc + w;
|
wdof = nc + w;
|
||||||
resv = ctrls->target[ ctrls->current ];
|
resv = ctrls->target[ ctrls->current ];
|
||||||
|
|
||||||
|
jww = csrmatrix_elm_index(wdof, wdof, h->A);
|
||||||
|
|
||||||
for (i = W->well_connpos[w]; i < W->well_connpos[w + 1]; i++) {
|
for (i = W->well_connpos[w]; i < W->well_connpos[w + 1]; i++) {
|
||||||
|
|
||||||
c = W->well_cells [ i ];
|
c = W->well_cells[ i ];
|
||||||
|
|
||||||
|
jcc = csrmatrix_elm_index(c , c , h->A);
|
||||||
|
jcw = csrmatrix_elm_index(c , wdof, h->A);
|
||||||
|
jwc = csrmatrix_elm_index(wdof, c , h->A);
|
||||||
|
|
||||||
|
/* Connection transmissibility */
|
||||||
trans = mt[ c ] * W->WI[ i ];
|
trans = mt[ c ] * W->WI[ i ];
|
||||||
|
|
||||||
/* c->w connection */
|
/* c->w connection */
|
||||||
jc = csrmatrix_elm_index(c, c , h->A);
|
h->A->sa[ jcc ] += trans;
|
||||||
jw = csrmatrix_elm_index(c, wdof, h->A);
|
h->A->sa[ jcw ] -= trans;
|
||||||
|
|
||||||
h->A->sa[ jc ] += trans;
|
|
||||||
h->A->sa[ jw ] -= trans;
|
|
||||||
h->b [ c ] += trans * wdp[ i ];
|
h->b [ c ] += trans * wdp[ i ];
|
||||||
|
|
||||||
/* w->c connection */
|
/* w->c connection */
|
||||||
jc = csrmatrix_elm_index(wdof, c , h->A);
|
h->A->sa[ jwc ] -= trans;
|
||||||
jw = csrmatrix_elm_index(wdof, wdof, h->A);
|
h->A->sa[ jww ] += trans;
|
||||||
|
|
||||||
h->A->sa[ jc ] -= trans;
|
|
||||||
h->A->sa[ jw ] += trans;
|
|
||||||
h->b [ wdof ] -= trans * wdp[ i ];
|
h->b [ wdof ] -= trans * wdp[ i ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user