From 1943978dbdacab63ec013d7af3e04b156d26aabe Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Mon, 5 Sep 2016 10:38:57 +0800 Subject: [PATCH] update PAV formulation. --- ...FullyImplicitCompressiblePolymerSolver.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.cpp b/opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.cpp index 75f541e0a..9da19afae 100644 --- a/opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.cpp +++ b/opm/polymer/fullyimplicit/FullyImplicitCompressiblePolymerSolver.cpp @@ -564,18 +564,28 @@ namespace { const int dims = *std::max_element(fipnum.begin(), fipnum.end()); - std::vector values(dims, V::Zero(5)); + std::vector values(dims, V::Zero(7)); - for (int d = 0; d < dims; ++d) { + for (int i = 0; i < 5; ++i) { for (int c = 0; c < nc; ++c) { - for (int i = 0; i < 5; ++i) { - if (fipnum[c] == d) { - values[d][i] += fip[c][i]; - } + if (fipnum[c] != 0) { + values[fipnum[c]-1][i] += fip[i][c]; } } } + // compute PAV and PORV or every regions. + for (int c = 0; c < nc; ++c) { + if (fipnum[c] != 0) { + values[fipnum[c]-1][5] += pv[c] * s.col(Oil)[c]; + values[fipnum[c]-1][6] += pv[c] * state.pressure.value()[c] * s.col(Oil)[c]; + } + } + + for (auto& val : values) { + val[6] = val[6] / val[5]; + } + return values; }