diff --git a/opm/material/fluidmatrixinteractions/PiecewiseLinearTwoPhaseMaterialParams.hpp b/opm/material/fluidmatrixinteractions/PiecewiseLinearTwoPhaseMaterialParams.hpp index bd8f12044..172bad0ee 100644 --- a/opm/material/fluidmatrixinteractions/PiecewiseLinearTwoPhaseMaterialParams.hpp +++ b/opm/material/fluidmatrixinteractions/PiecewiseLinearTwoPhaseMaterialParams.hpp @@ -23,7 +23,8 @@ #ifndef OPM_PIECEWISE_LINEAR_TWO_PHASE_MATERIAL_PARAMS_HPP #define OPM_PIECEWISE_LINEAR_TWO_PHASE_MATERIAL_PARAMS_HPP -#include +#include +#include namespace Opm { /*! @@ -66,32 +67,48 @@ public: } /*! - * \brief Read the relevant curves from an ECLIPSE input file - * - * The relevant keywords for this are "SWOF" and "SGOF". + * \brief Read the relevant curves from the table specified by the + * SWOF keyword of an ECLIPSE input file */ - template - void readFromEclipse(const FieldType& table) + void readFromSwof(const Opm::SwofTable &swofTable) { - int numSamples = table[0].size(); - pcwnSamples_.resize(numSamples); - krwSamples_.resize(numSamples); - krnSamples_.resize(numSamples); + const std::vector &SwColumn = swofTable.getSwColumn(); + const std::vector &krwColumn = swofTable.getKrwColumn(); + const std::vector &krowColumn = swofTable.getKrowColumn(); + const std::vector &pcowColumn = swofTable.getPcowColumn(); + int numRows = swofTable.numRows(); + for (int rowIdx = 0; rowIdx < numRows; ++rowIdx) { + pcwnSamples_[rowIdx].first = SwColumn[rowIdx]; + pcwnSamples_[rowIdx].second = - pcowColumn[rowIdx]; - for (int sampleIdx = 0; sampleIdx < numSamples; ++sampleIdx) { - Scalar Sw = table[0][sampleIdx]; - Scalar krw = table[1][sampleIdx]; - Scalar krn = table[2][sampleIdx]; - Scalar pcnw = table[3][sampleIdx]; + krwSamples_[rowIdx].first = SwColumn[rowIdx]; + krwSamples_[rowIdx].second = krwColumn[rowIdx]; - pcwnSamples_[sampleIdx].first = Sw; - pcwnSamples_[sampleIdx].second = pcnw; + krnSamples_[rowIdx].first = SwColumn[rowIdx]; + krnSamples_[rowIdx].second = krowColumn[rowIdx]; + } + } - krwSamples_[sampleIdx].first = Sw; - krwSamples_[sampleIdx].second = krw; + /*! + * \brief Read the relevant curves from the table specified by the + * SGOF keyword of an ECLIPSE input file + */ + void readFromSgof(const Opm::SgofTable &sgofTable) + { + const std::vector &SgColumn = sgofTable.getSgColumn(); + const std::vector &krgColumn = sgofTable.getKrgColumn(); + const std::vector &krogColumn = sgofTable.getKrogColumn(); + const std::vector &pcogColumn = sgofTable.getPcogColumn(); + int numRows = sgofTable.numRows(); + for (int rowIdx = 0; rowIdx < numRows; ++rowIdx) { + pcwnSamples_[rowIdx].first = 1 - SgColumn[rowIdx]; + pcwnSamples_[rowIdx].second = pcogColumn[rowIdx]; - krnSamples_[sampleIdx].first = Sw; - krnSamples_[sampleIdx].second = krn; + krwSamples_[rowIdx].first = 1 - SgColumn[rowIdx]; + krwSamples_[rowIdx].second = krogColumn[rowIdx]; + + krnSamples_[rowIdx].first = 1 - SgColumn[rowIdx]; + krnSamples_[rowIdx].second = krgColumn[rowIdx]; } }