From 61995b97be6c4141efd18260b8c3705956648085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Sat, 9 Jun 2012 14:56:29 +0200 Subject: [PATCH] Changed interface of solve() and solveGravity() to accept full saturation (both phases) input. --- .../reorder/TransportModelCompressibleTwophase.cpp | 11 +++++++---- .../reorder/TransportModelCompressibleTwophase.hpp | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp b/opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp index 77d5a6105..c04aac0a3 100644 --- a/opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp +++ b/opm/core/transport/reorder/TransportModelCompressibleTwophase.cpp @@ -49,7 +49,7 @@ namespace Opm darcyflux_(0), source_(0), dt_(0.0), - saturation_(0), + saturation_(grid.number_of_cells, -1.0), fractionalflow_(grid.number_of_cells, -1.0), mob_(2*grid.number_of_cells, -1.0), ia_upw_(grid.number_of_cells + 1, -1), @@ -79,14 +79,15 @@ namespace Opm const double* porevolume, const double* source, const double dt, - double* saturation) + std::vector& saturation) { darcyflux_ = darcyflux; surfacevol0_ = surfacevol0; porevolume_ = porevolume; source_ = source; dt_ = dt; - saturation_ = saturation; + toWaterSat(saturation, saturation_); + props_.viscosity(props_.numCells(), pressure, NULL, &allcells_[0], &visc_[0], NULL); props_.matrix(props_.numCells(), pressure, NULL, &allcells_[0], &A_[0], NULL); @@ -103,6 +104,7 @@ namespace Opm &seq[0], &comp[0], &ncomp, &ia_downw_[0], &ja_downw_[0]); reorderAndTransport(grid_, darcyflux); + toBothSat(saturation_, saturation); } // Residual function r(s) for a single-cell implicit Euler transport @@ -489,7 +491,7 @@ namespace Opm // Set up other variables. porevolume_ = porevolume; dt_ = dt; - saturation_ = &saturation[0]; + toWaterSat(saturation, saturation_); // Solve on all columns. int num_iters = 0; @@ -499,6 +501,7 @@ namespace Opm } std::cout << "Gauss-Seidel column solver average iterations: " << double(num_iters)/double(columns.size()) << std::endl; + toBothSat(saturation_, saturation); } } // namespace Opm diff --git a/opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp b/opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp index f1cec2406..8b1714d3b 100644 --- a/opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp +++ b/opm/core/transport/reorder/TransportModelCompressibleTwophase.hpp @@ -38,13 +38,14 @@ namespace Opm const double tol, const int maxit); + /// \param[in, out] saturation Phase saturations. void solve(const double* darcyflux, const double* pressure, const double* surfacevol0, const double* porevolume, const double* source, const double dt, - double* saturation); + std::vector& saturation); virtual void solveSingleCell(const int cell); virtual void solveMultiCell(const int num_cells, const int* cells); @@ -76,7 +77,7 @@ namespace Opm const double* porevolume_; // one volume per cell const double* source_; // one source per cell double dt_; - double* saturation_; // one per cell + std::vector saturation_; // one per cell std::vector fractionalflow_; // = m[0]/(m[0] + m[1]) per cell // For gravity segregation. std::vector gravflux_;