From a5de5341c55b768b1bf562d903b6f86852d3cc34 Mon Sep 17 00:00:00 2001 From: Xavier Raynaud Date: Wed, 13 Jun 2012 15:31:49 +0200 Subject: [PATCH] Make compatible with incomptpfa interface. --- opm/polymer/TransportModelPolymer.cpp | 27 ++++++++++++++------------- opm/polymer/TransportModelPolymer.hpp | 11 ++++------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/opm/polymer/TransportModelPolymer.cpp b/opm/polymer/TransportModelPolymer.cpp index e921a8632..9711fbec8 100644 --- a/opm/polymer/TransportModelPolymer.cpp +++ b/opm/polymer/TransportModelPolymer.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -172,16 +173,14 @@ namespace namespace Opm { TransportModelPolymer::TransportModelPolymer(const UnstructuredGrid& grid, - const double* porosity, - const double* porevolume, const IncompPropertiesInterface& props, const PolymerProperties& polyprops, const SingleCellMethod method, const double tol, const int maxit) : grid_(grid), - porosity_(porosity), - porevolume_(porevolume), + porosity_(props.porosity()), + porevolume_(NULL), props_(props), polyprops_(polyprops), tol_(tol), @@ -190,7 +189,6 @@ namespace Opm source_(0), dt_(0.0), inflow_c_(0.0), - saturation_(0), concentration_(0), cmax_(0), fractionalflow_(grid.number_of_cells, -1.0), @@ -223,20 +221,21 @@ namespace Opm const double* source, const double dt, const double inflow_c, - double* saturation, - double* concentration, - double* cmax) + std::vector& saturation, + std::vector& concentration, + std::vector& cmax) { darcyflux_ = darcyflux; porevolume_ = porevolume; source_ = source; dt_ = dt; inflow_c_ = inflow_c; - saturation_ = saturation; - concentration_ = concentration; - cmax_ = cmax; + toWaterSat(saturation, saturation_); + concentration_ = &concentration[0]; + cmax_ = &cmax[0]; res_counts.clear(); reorderAndTransport(grid_, darcyflux); + toBothSat(saturation_, saturation); } @@ -1335,7 +1334,7 @@ namespace Opm // initialize variables. porevolume_ = porevolume; dt_ = dt; - saturation_ = &saturation[0]; + toWaterSat(saturation, saturation_); concentration_ = &concentration[0]; cmax_ = &cmax[0]; const int nc = grid_.number_of_cells; @@ -1346,7 +1345,7 @@ namespace Opm mob_.resize(2*nc); for (int cell = 0; cell < nc; ++cell) { - mobility(saturation[cell], concentration[cell], cell, &mob_[2*cell]); + mobility(saturation_[cell], concentration_[cell], cell, &mob_[2*cell]); } @@ -1358,6 +1357,8 @@ 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/polymer/TransportModelPolymer.hpp b/opm/polymer/TransportModelPolymer.hpp index 7d1d5418b..52757eebe 100644 --- a/opm/polymer/TransportModelPolymer.hpp +++ b/opm/polymer/TransportModelPolymer.hpp @@ -45,8 +45,6 @@ namespace Opm /// \TODO document me, especially method. TransportModelPolymer(const UnstructuredGrid& grid, - const double* porosity, - const double* porevolume, const IncompPropertiesInterface& props, const PolymerProperties& polyprops, const SingleCellMethod method, @@ -61,9 +59,9 @@ namespace Opm const double* source, const double dt, const double inflow_c, - double* saturation, - double* concentration, - double* cmax); + std::vector& saturation, + std::vector& concentration, + std::vector& cmax); virtual void solveSingleCell(const int cell); virtual void solveMultiCell(const int num_cells, const int* cells); @@ -118,7 +116,7 @@ namespace Opm const double* source_; // one source per cell double dt_; double inflow_c_; - double* saturation_; // one per cell + std::vector saturation_; // one per cell, only water saturation! double* concentration_; double* cmax_; std::vector fractionalflow_; // one per cell @@ -149,7 +147,6 @@ namespace Opm void computeMc(double c, double& mc) const; void computeMcWithDer(double c, double& mc, double& dmc_dc) const; void mobility(double s, double c, int cell, double* mob) const; - }; } // namespace Opm