Slight normalisation and clean-up of coding style.

Notably:
  * Replace all remaining <tab>s with (8) spaces.
  * Use post-increment for all counters.
  * Insert a number of blank lines to highlight important groups.
This commit is contained in:
Bård Skaflestad
2012-06-19 18:37:26 +02:00
parent f31bbf5b48
commit 3383100690

View File

@@ -378,7 +378,7 @@ assemble_well_contrib(int nc ,
break; break;
case RESERVOIR_RATE: case RESERVOIR_RATE:
for (p = 0; p < np; ++p) { for (p = 0; p < np; p++) {
if (ctrls->distr[np * ctrls->current + p] != 1.0) { if (ctrls->distr[np * ctrls->current + p] != 1.0) {
*ok = 0; *ok = 0;
break; break;
@@ -539,7 +539,7 @@ well_solution(const struct UnstructuredGrid *G ,
if (soln->well_press != NULL) { if (soln->well_press != NULL) {
/* Extract BHP directly from solution vector for non-shut wells */ /* Extract BHP directly from solution vector for non-shut wells */
for (w = 0; w < F->W->number_of_wells; ++w) { for (w = 0; w < F->W->number_of_wells; w++) {
if (F->W->ctrls[w]->current >= 0) { if (F->W->ctrls[w]->current >= 0) {
soln->well_press[w] = h->x[G->number_of_cells + w]; soln->well_press[w] = h->x[G->number_of_cells + w];
} }
@@ -585,7 +585,8 @@ assemble_incompressible(struct UnstructuredGrid *G ,
int res_is_neumann, wells_are_rate; int res_is_neumann, wells_are_rate;
double s; double s;
*ok=1;
*ok = 1;
csrmatrix_zero( h->A); csrmatrix_zero( h->A);
vector_zero (h->A->m, h->b); vector_zero (h->A->m, h->b);
@@ -733,9 +734,11 @@ ifs_tpfa_assemble_comprock(struct UnstructuredGrid *G ,
* after it will always be nonsingular. * after it will always be nonsingular.
*/ */
if (ok) { if (ok) {
for (c = 0; c < G->number_of_cells; ++c) { for (c = 0; c < G->number_of_cells; c++) {
j = csrmatrix_elm_index(c, c, h->A); j = csrmatrix_elm_index(c, c, h->A);
d = porevol[c] * rock_comp[c] / dt; d = porevol[c] * rock_comp[c] / dt;
h->A->sa[j] += d; h->A->sa[j] += d;
h->b[c] += d * pressure[c]; h->b[c] += d * pressure[c];
} }
@@ -761,7 +764,7 @@ ifs_tpfa_assemble_comprock_increment(struct UnstructuredGrid *G ,
{ {
int c, w, wdof, system_singular, ok; int c, w, wdof, system_singular, ok;
size_t j; size_t j;
double *v; double *v, dpvdt;
ok = 1; ok = 1;
assemble_incompressible(G, F, trans, gpress, h, &system_singular, &ok); assemble_incompressible(G, F, trans, gpress, h, &system_singular, &ok);
@@ -775,17 +778,22 @@ ifs_tpfa_assemble_comprock_increment(struct UnstructuredGrid *G ,
v = h->pimpl->work; v = h->pimpl->work;
mult_csr_matrix(h->A, prev_pressure, v); mult_csr_matrix(h->A, prev_pressure, v);
for (c = 0; c < G->number_of_cells; ++c) { for (c = 0; c < G->number_of_cells; c++) {
j = csrmatrix_elm_index(c, c, h->A); j = csrmatrix_elm_index(c, c, h->A);
dpvdt = (porevol[c] - initial_porevolume[c]) / dt;
h->A->sa[j] += porevol[c] * rock_comp[c] / dt; h->A->sa[j] += porevol[c] * rock_comp[c] / dt;
h->b[c] += -(porevol[c] - initial_porevolume[c])/dt - v[c]; h->b[c] -= dpvdt + v[c];
}
if (F->W != NULL) {
wdof = G->number_of_cells;
for (w = 0; w < F->W->number_of_wells; w++, wdof++) {
h->b[wdof] -= v[wdof];
}
} }
if (F->W != NULL) {
for (w = 0; w < F->W->number_of_wells; ++w) {
wdof = G->number_of_cells + w;
h->b[wdof] += -v[wdof];
}
}
} }
return ok; return ok;