add variants of all methods which take a deck of the new parser to the PVT properties
This commit is contained in:
parent
3e3542dabe
commit
4542a43dbf
@ -32,6 +32,9 @@
|
|||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/utility/linearInterpolation.hpp>
|
#include <opm/core/utility/linearInterpolation.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Utility/PvtwTable.hpp>
|
||||||
|
#include <opm/parser/eclipse/Utility/PvdcoTable.hpp>
|
||||||
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@ -40,7 +43,6 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BlackoilPvtProperties::init(const EclipseGridParser& deck, const int samples)
|
void BlackoilPvtProperties::init(const EclipseGridParser& deck, const int samples)
|
||||||
{
|
{
|
||||||
// If we need multiple regions, this class and the SinglePvt* classes must change.
|
// If we need multiple regions, this class and the SinglePvt* classes must change.
|
||||||
@ -113,6 +115,83 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BlackoilPvtProperties::init(Opm::DeckConstPtr newParserDeck, int samples)
|
||||||
|
{
|
||||||
|
// If we need multiple regions, this class and the SinglePvt* classes must change.
|
||||||
|
region_number_ = 0;
|
||||||
|
|
||||||
|
phase_usage_ = phaseUsageFromDeck(newParserDeck);
|
||||||
|
|
||||||
|
// Surface densities. Accounting for different orders in eclipse and our code.
|
||||||
|
if (newParserDeck->hasKeyword("DENSITY")) {
|
||||||
|
Opm::DeckKeywordConstPtr densityKeyword = newParserDeck->getKeyword("DENSITY");
|
||||||
|
const std::vector<double>& d = densityKeyword->getRecord(region_number_)->getItem(0)->getSIDoubleData();
|
||||||
|
enum { ECL_oil = 0, ECL_water = 1, ECL_gas = 2 };
|
||||||
|
if (phase_usage_.phase_used[Aqua]) {
|
||||||
|
densities_[phase_usage_.phase_pos[Aqua]] = d[ECL_water];
|
||||||
|
}
|
||||||
|
if (phase_usage_.phase_used[Vapour]) {
|
||||||
|
densities_[phase_usage_.phase_pos[Vapour]] = d[ECL_gas];
|
||||||
|
}
|
||||||
|
if (phase_usage_.phase_used[Liquid]) {
|
||||||
|
densities_[phase_usage_.phase_pos[Liquid]] = d[ECL_oil];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OPM_THROW(std::runtime_error, "Input is missing DENSITY\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the properties.
|
||||||
|
props_.resize(phase_usage_.num_phases);
|
||||||
|
// Water PVT
|
||||||
|
if (phase_usage_.phase_used[Aqua]) {
|
||||||
|
if (newParserDeck->hasKeyword("PVTW")) {
|
||||||
|
Opm::PvtwTable pvtwTable(newParserDeck->getKeyword("PVTW"));
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(pvtwTable));
|
||||||
|
} else {
|
||||||
|
// Eclipse 100 default.
|
||||||
|
props_[phase_usage_.phase_pos[Aqua]].reset(new SinglePvtConstCompr(0.5*Opm::prefix::centi*Opm::unit::Poise));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Oil PVT
|
||||||
|
if (phase_usage_.phase_used[Liquid]) {
|
||||||
|
if (newParserDeck->hasKeyword("PVDO")) {
|
||||||
|
Opm::PvdoTable pvdoTable(newParserDeck->getKeyword("PVDO"), region_number_);
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtDeadSpline(pvdoTable, samples));
|
||||||
|
} else if (newParserDeck->hasKeyword("PVTO")) {
|
||||||
|
Opm::PvtoTable pvtoTable(newParserDeck->getKeyword("PVTO"), /*tableIdx=*/0);
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtLiveOil(pvtoTable));
|
||||||
|
} else if (newParserDeck->hasKeyword("PVCDO")) {
|
||||||
|
Opm::PvdcoTable pvcdoTable(newParserDeck->getKeyword("PVCDO"));
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Liquid]].reset(new SinglePvtConstCompr(pvcdoTable));
|
||||||
|
} else {
|
||||||
|
OPM_THROW(std::runtime_error, "Input is missing PVDO or PVTO\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Gas PVT
|
||||||
|
if (phase_usage_.phase_used[Vapour]) {
|
||||||
|
if (newParserDeck->hasKeyword("PVDG")) {
|
||||||
|
Opm::PvdgTable pvdgTable(newParserDeck->getKeyword("PVDG"), region_number_);
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtDeadSpline(pvdgTable, samples));
|
||||||
|
} else if (newParserDeck->hasKeyword("PVTG")) {
|
||||||
|
Opm::PvtgTable pvtgTable(newParserDeck->getKeyword("PVTG"), /*tableIdx=*/0);
|
||||||
|
|
||||||
|
props_[phase_usage_.phase_pos[Vapour]].reset(new SinglePvtLiveGas(pvtgTable));
|
||||||
|
} else {
|
||||||
|
OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must inform pvt property objects of phase structure.
|
||||||
|
for (int i = 0; i < phase_usage_.num_phases; ++i) {
|
||||||
|
props_[i]->setPhaseConfiguration(phase_usage_.num_phases, phase_usage_.phase_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const double* BlackoilPvtProperties::surfaceDensities() const
|
const double* BlackoilPvtProperties::surfaceDensities() const
|
||||||
{
|
{
|
||||||
return densities_;
|
return densities_;
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
#ifndef OPM_BLACKOILPVTPROPERTIES_HEADER_INCLUDED
|
#ifndef OPM_BLACKOILPVTPROPERTIES_HEADER_INCLUDED
|
||||||
#define OPM_BLACKOILPVTPROPERTIES_HEADER_INCLUDED
|
#define OPM_BLACKOILPVTPROPERTIES_HEADER_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
||||||
#include <opm/core/props/BlackoilPhases.hpp>
|
#include <opm/core/props/BlackoilPhases.hpp>
|
||||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -55,6 +56,11 @@ namespace Opm
|
|||||||
/// data without fitting a spline.
|
/// data without fitting a spline.
|
||||||
void init(const EclipseGridParser& deck, const int samples);
|
void init(const EclipseGridParser& deck, const int samples);
|
||||||
|
|
||||||
|
|
||||||
|
/// Initialize from deck.
|
||||||
|
/// \param deck An input deck from the opm-parser module.
|
||||||
|
void init(Opm::DeckConstPtr deck, int samples);
|
||||||
|
|
||||||
/// \return Object describing the active phases.
|
/// \return Object describing the active phases.
|
||||||
PhaseUsage phaseUsage() const;
|
PhaseUsage phaseUsage() const;
|
||||||
|
|
||||||
|
@ -20,9 +20,12 @@
|
|||||||
#ifndef OPM_SINGLEPVTCONSTCOMPR_HEADER_INCLUDED
|
#ifndef OPM_SINGLEPVTCONSTCOMPR_HEADER_INCLUDED
|
||||||
#define OPM_SINGLEPVTCONSTCOMPR_HEADER_INCLUDED
|
#define OPM_SINGLEPVTCONSTCOMPR_HEADER_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Utility/PvtwTable.hpp>
|
||||||
|
#include <opm/parser/eclipse/Utility/PvdcoTable.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -55,6 +58,32 @@ namespace Opm
|
|||||||
visc_comp_ = pvtw[region_number][4];
|
visc_comp_ = pvtw[region_number][4];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SinglePvtConstCompr(const Opm::PvtwTable &pvtwTable)
|
||||||
|
{
|
||||||
|
if (pvtwTable.numRows() != 1)
|
||||||
|
OPM_THROW(std::runtime_error,
|
||||||
|
"The table specified by the PVTW keyword is required"
|
||||||
|
"to exhibit exactly one row.");
|
||||||
|
ref_press_ = pvtwTable.getPressureColumn()[0];
|
||||||
|
ref_B_ = pvtwTable.getFormationFactorColumn()[0];
|
||||||
|
comp_ = pvtwTable.getCompressibilityColumn()[0];
|
||||||
|
viscosity_ = pvtwTable.getViscosityColumn()[0];
|
||||||
|
visc_comp_ = pvtwTable.getViscosibilityColumn()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
SinglePvtConstCompr(const Opm::PvdcoTable &pvdcoTable)
|
||||||
|
{
|
||||||
|
if (pvdcoTable.numRows() != 1)
|
||||||
|
OPM_THROW(std::runtime_error,
|
||||||
|
"The table specified by the PVDCO keyword is required"
|
||||||
|
"to exhibit exactly one row.");
|
||||||
|
ref_press_ = pvdcoTable.getPressureColumn()[0];
|
||||||
|
ref_B_ = pvdcoTable.getFormationFactorColumn()[0];
|
||||||
|
comp_ = pvdcoTable.getCompressibilityColumn()[0];
|
||||||
|
viscosity_ = pvdcoTable.getViscosityColumn()[0];
|
||||||
|
visc_comp_ = pvdcoTable.getViscosibilityColumn()[0];
|
||||||
|
}
|
||||||
|
|
||||||
SinglePvtConstCompr(double visc)
|
SinglePvtConstCompr(double visc)
|
||||||
: ref_press_(0.0),
|
: ref_press_(0.0),
|
||||||
ref_B_(1.0),
|
ref_B_(1.0),
|
||||||
|
@ -62,6 +62,30 @@ namespace Opm
|
|||||||
// << "\n\nvisc\n\n" << viscosity_ << std::endl;
|
// << "\n\nvisc\n\n" << viscosity_ << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Constructor
|
||||||
|
SinglePvtDead::SinglePvtDead(const Opm::PvdoTable& pvdoTable)
|
||||||
|
{
|
||||||
|
// Copy data
|
||||||
|
const std::vector<double>& press = pvdoTable.getPressureColumn();
|
||||||
|
const std::vector<double>& b = pvdoTable.getFormationFactorColumn();
|
||||||
|
const std::vector<double>& visc = pvdoTable.getViscosityColumn();
|
||||||
|
|
||||||
|
const int sz = b.size();
|
||||||
|
std::vector<double> bInv(sz);
|
||||||
|
for (int i = 0; i < sz; ++i) {
|
||||||
|
bInv[i] = 1.0 / b[i];
|
||||||
|
}
|
||||||
|
b_ = NonuniformTableLinear<double>(press, bInv);
|
||||||
|
viscosity_ = NonuniformTableLinear<double>(press, visc);
|
||||||
|
|
||||||
|
// Dumping the created tables.
|
||||||
|
// static int count = 0;
|
||||||
|
// std::ofstream os((std::string("dump-") + boost::lexical_cast<std::string>(count++)).c_str());
|
||||||
|
// os.precision(15);
|
||||||
|
// os << "1/B\n\n" << one_over_B_
|
||||||
|
// << "\n\nvisc\n\n" << viscosity_ << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
SinglePvtDead::~SinglePvtDead()
|
SinglePvtDead::~SinglePvtDead()
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
|
|
||||||
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
||||||
#include <opm/core/utility/NonuniformTableLinear.hpp>
|
#include <opm/core/utility/NonuniformTableLinear.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Utility/PvdoTable.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@ -40,6 +43,7 @@ namespace Opm
|
|||||||
public:
|
public:
|
||||||
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
||||||
SinglePvtDead(const table_t& pvd_table);
|
SinglePvtDead(const table_t& pvd_table);
|
||||||
|
SinglePvtDead(const Opm::PvdoTable &pvdoTable);
|
||||||
virtual ~SinglePvtDead();
|
virtual ~SinglePvtDead();
|
||||||
|
|
||||||
/// Viscosity as a function of p and z.
|
/// Viscosity as a function of p and z.
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <opm/core/props/pvt/SinglePvtDeadSpline.hpp>
|
#include <opm/core/props/pvt/SinglePvtDeadSpline.hpp>
|
||||||
#include <opm/core/utility/buildUniformMonotoneTable.hpp>
|
#include <opm/core/utility/buildUniformMonotoneTable.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Utility/SimpleTable.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// Extra includes for debug dumping of tables.
|
// Extra includes for debug dumping of tables.
|
||||||
@ -29,7 +32,6 @@
|
|||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Member functions
|
// Member functions
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -54,13 +56,42 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
buildUniformMonotoneTable(press, B_inv, samples, b_);
|
buildUniformMonotoneTable(press, B_inv, samples, b_);
|
||||||
buildUniformMonotoneTable(press, visc, samples, viscosity_);
|
buildUniformMonotoneTable(press, visc, samples, viscosity_);
|
||||||
|
}
|
||||||
|
|
||||||
// Dumping the created tables.
|
SinglePvtDeadSpline::SinglePvtDeadSpline(const Opm::PvdoTable &pvdoTable, int samples)
|
||||||
// static int count = 0;
|
{
|
||||||
// std::ofstream os((std::string("dump-") + boost::lexical_cast<std::string>(count++)).c_str());
|
int numRows = pvdoTable.numRows();
|
||||||
// os.precision(15);
|
|
||||||
// os << "1/B\n\n" << one_over_B_
|
// Copy data
|
||||||
// << "\n\nvisc\n\n" << viscosity_ << std::endl;
|
const std::vector<double> &press = pvdoTable.getPressureColumn();
|
||||||
|
const std::vector<double> &B = pvdoTable.getFormationFactorColumn();
|
||||||
|
const std::vector<double> &visc = pvdoTable.getViscosityColumn();
|
||||||
|
|
||||||
|
std::vector<double> B_inv(numRows);
|
||||||
|
for (int i = 0; i < numRows; ++i) {
|
||||||
|
B_inv[i] = 1.0 / B[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
buildUniformMonotoneTable(press, B_inv, samples, b_);
|
||||||
|
buildUniformMonotoneTable(press, visc, samples, viscosity_);
|
||||||
|
}
|
||||||
|
|
||||||
|
SinglePvtDeadSpline::SinglePvtDeadSpline(const Opm::PvdgTable &pvdgTable, int samples)
|
||||||
|
{
|
||||||
|
int numRows = pvdgTable.numRows();
|
||||||
|
|
||||||
|
// Copy data
|
||||||
|
const std::vector<double> &press = pvdgTable.getPressureColumn();
|
||||||
|
const std::vector<double> &B = pvdgTable.getFormationFactorColumn();
|
||||||
|
const std::vector<double> &visc = pvdgTable.getViscosityColumn();
|
||||||
|
|
||||||
|
std::vector<double> B_inv(numRows);
|
||||||
|
for (int i = 0; i < numRows; ++i) {
|
||||||
|
B_inv[i] = 1.0 / B[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
buildUniformMonotoneTable(press, B_inv, samples, b_);
|
||||||
|
buildUniformMonotoneTable(press, visc, samples, viscosity_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
@ -20,9 +20,12 @@
|
|||||||
#ifndef OPM_SINGLEPVTDEADSPLINE_HEADER_INCLUDED
|
#ifndef OPM_SINGLEPVTDEADSPLINE_HEADER_INCLUDED
|
||||||
#define OPM_SINGLEPVTDEADSPLINE_HEADER_INCLUDED
|
#define OPM_SINGLEPVTDEADSPLINE_HEADER_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
||||||
#include <opm/core/utility/UniformTableLinear.hpp>
|
#include <opm/core/utility/UniformTableLinear.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Utility/PvdoTable.hpp>
|
||||||
|
#include <opm/parser/eclipse/Utility/PvdgTable.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@ -41,6 +44,8 @@ namespace Opm
|
|||||||
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
||||||
|
|
||||||
SinglePvtDeadSpline(const table_t& pvd_table, const int samples);
|
SinglePvtDeadSpline(const table_t& pvd_table, const int samples);
|
||||||
|
SinglePvtDeadSpline(const Opm::PvdoTable &pvdoTable, int samples);
|
||||||
|
SinglePvtDeadSpline(const Opm::PvdgTable &pvdgTable, int samples);
|
||||||
virtual ~SinglePvtDeadSpline();
|
virtual ~SinglePvtDeadSpline();
|
||||||
|
|
||||||
/// Viscosity as a function of p and z.
|
/// Viscosity as a function of p and z.
|
||||||
|
@ -32,8 +32,9 @@
|
|||||||
#include <opm/core/props/pvt/SinglePvtLiveGas.hpp>
|
#include <opm/core/props/pvt/SinglePvtLiveGas.hpp>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/utility/linearInterpolation.hpp>
|
#include <opm/core/utility/linearInterpolation.hpp>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@ -41,6 +42,7 @@ namespace Opm
|
|||||||
using Opm::linearInterpolation;
|
using Opm::linearInterpolation;
|
||||||
using Opm::linearInterpolationDerivative;
|
using Opm::linearInterpolationDerivative;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Member functions
|
// Member functions
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -81,6 +83,27 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SinglePvtLiveGas::SinglePvtLiveGas(const Opm::PvtgTable& pvtgTable)
|
||||||
|
{
|
||||||
|
// GAS, PVTG
|
||||||
|
saturated_gas_table_.resize(4);
|
||||||
|
saturated_gas_table_[0] = pvtgTable.getOuterTable()->getPressureColumn();
|
||||||
|
saturated_gas_table_[1] = pvtgTable.getOuterTable()->getGasFormationFactorColumn();
|
||||||
|
saturated_gas_table_[2] = pvtgTable.getOuterTable()->getGasViscosityColumn();
|
||||||
|
saturated_gas_table_[3] = pvtgTable.getOuterTable()->getOilSolubilityColumn();
|
||||||
|
|
||||||
|
int sz = pvtgTable.getOuterTable()->numRows();
|
||||||
|
undersat_gas_tables_.resize(sz);
|
||||||
|
for (int i=0; i<sz; ++i) {
|
||||||
|
const auto &undersatTable = *pvtgTable.getInnerTable(i);
|
||||||
|
|
||||||
|
undersat_gas_tables_[i].resize(3);
|
||||||
|
undersat_gas_tables_[i][0] = undersatTable.getOilSolubilityColumn();
|
||||||
|
undersat_gas_tables_[i][1] = undersatTable.getGasFormationFactorColumn();
|
||||||
|
undersat_gas_tables_[i][2] = pvtgTable.getOuterTable()->getGasViscosityColumn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
SinglePvtLiveGas::~SinglePvtLiveGas()
|
SinglePvtLiveGas::~SinglePvtLiveGas()
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#define OPM_SINGLEPVTLIVEGAS_HEADER_INCLUDED
|
#define OPM_SINGLEPVTLIVEGAS_HEADER_INCLUDED
|
||||||
|
|
||||||
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Utility/PvtgTable.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@ -38,6 +41,7 @@ namespace Opm
|
|||||||
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
||||||
|
|
||||||
SinglePvtLiveGas(const table_t& pvto);
|
SinglePvtLiveGas(const table_t& pvto);
|
||||||
|
SinglePvtLiveGas(const Opm::PvtgTable& pvtgTable);
|
||||||
virtual ~SinglePvtLiveGas();
|
virtual ~SinglePvtLiveGas();
|
||||||
|
|
||||||
/// Viscosity as a function of p and z.
|
/// Viscosity as a function of p and z.
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#include <opm/core/props/pvt/SinglePvtLiveOil.hpp>
|
#include <opm/core/props/pvt/SinglePvtLiveOil.hpp>
|
||||||
#include <opm/core/utility/ErrorMacros.hpp>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
#include <opm/core/utility/linearInterpolation.hpp>
|
#include <opm/core/utility/linearInterpolation.hpp>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
@ -31,7 +31,6 @@ namespace Opm
|
|||||||
using Opm::linearInterpolationDerivative;
|
using Opm::linearInterpolationDerivative;
|
||||||
using Opm::tableIndex;
|
using Opm::tableIndex;
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// Member functions
|
// Member functions
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -102,7 +101,73 @@ namespace Opm
|
|||||||
undersat_oil_tables_[i][2].push_back(mu);
|
undersat_oil_tables_[i][2].push_back(mu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SinglePvtLiveOil::SinglePvtLiveOil(const Opm::PvtoTable &pvtoTable)
|
||||||
|
{
|
||||||
|
const auto saturatedPvto = pvtoTable.getOuterTable();
|
||||||
|
|
||||||
|
// OIL, PVTO
|
||||||
|
saturated_oil_table_.resize(4);
|
||||||
|
const int sz = saturatedPvto->numRows();
|
||||||
|
for (int k=0; k<4; ++k) {
|
||||||
|
saturated_oil_table_[k].resize(sz);
|
||||||
|
}
|
||||||
|
for (int i=0; i<sz; ++i) {
|
||||||
|
saturated_oil_table_[0][i] = saturatedPvto->getPressureColumn()[i]; // p
|
||||||
|
saturated_oil_table_[1][i] = 1.0/saturatedPvto->getOilFormationFactorColumn()[i]; // 1/Bo
|
||||||
|
saturated_oil_table_[2][i] = saturatedPvto->getOilViscosityColumn()[i]; // mu_o
|
||||||
|
saturated_oil_table_[3][i] = saturatedPvto->getGasSolubilityColumn()[i]; // Rs
|
||||||
|
}
|
||||||
|
|
||||||
|
undersat_oil_tables_.resize(sz);
|
||||||
|
for (int i=0; i<sz; ++i) {
|
||||||
|
const auto undersaturatedPvto = pvtoTable.getInnerTable(i);
|
||||||
|
|
||||||
|
undersat_oil_tables_[i].resize(3);
|
||||||
|
int tsize = undersaturatedPvto->numRows();
|
||||||
|
undersat_oil_tables_[i][0].resize(tsize);
|
||||||
|
undersat_oil_tables_[i][1].resize(tsize);
|
||||||
|
undersat_oil_tables_[i][2].resize(tsize);
|
||||||
|
for (int j=0; j<tsize; ++j) {
|
||||||
|
undersat_oil_tables_[i][0][j] = undersaturatedPvto->getPressureColumn()[j]; // p
|
||||||
|
undersat_oil_tables_[i][1][j] = 1.0/undersaturatedPvto->getOilFormationFactorColumn()[j]; // 1/Bo
|
||||||
|
undersat_oil_tables_[i][2][j] = undersaturatedPvto->getOilViscosityColumn()[j]; // mu_o
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complete undersaturated tables by extrapolating from existing data
|
||||||
|
// as is done in Eclipse and Mrst
|
||||||
|
int iNext = -1;
|
||||||
|
for (int i=0; i<sz; ++i) {
|
||||||
|
// Skip records already containing undersaturated data
|
||||||
|
if (undersat_oil_tables_[i][0].size() > 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Look ahead for next record containing undersaturated data
|
||||||
|
if (iNext < i) {
|
||||||
|
iNext = i+1;
|
||||||
|
while (iNext<sz && undersat_oil_tables_[iNext][0].size() < 2) {
|
||||||
|
++iNext;
|
||||||
|
}
|
||||||
|
if (iNext == sz) OPM_THROW(std::runtime_error,"Unable to complete undersaturated table.");
|
||||||
|
}
|
||||||
|
// Add undersaturated data to current record while maintaining compressibility and viscosibility
|
||||||
|
typedef std::vector<std::vector<std::vector<double> > >::size_type sz_t;
|
||||||
|
for (sz_t j=1; j<undersat_oil_tables_[iNext][0].size(); ++j) {
|
||||||
|
double diffPressure = undersat_oil_tables_[iNext][0][j]-undersat_oil_tables_[iNext][0][j-1];
|
||||||
|
double pressure = undersat_oil_tables_[i][0].back()+diffPressure;
|
||||||
|
undersat_oil_tables_[i][0].push_back(pressure);
|
||||||
|
double compr = (1.0/undersat_oil_tables_[iNext][1][j]-1.0/undersat_oil_tables_[iNext][1][j-1])
|
||||||
|
/ (0.5*(1.0/undersat_oil_tables_[iNext][1][j]+1.0/undersat_oil_tables_[iNext][1][j-1]));
|
||||||
|
double B = (1.0/undersat_oil_tables_[i][1].back())*(1.0+0.5*compr)/(1.0-0.5*compr);
|
||||||
|
undersat_oil_tables_[i][1].push_back(1.0/B);
|
||||||
|
double visc = (undersat_oil_tables_[iNext][2][j]-undersat_oil_tables_[iNext][2][j-1])
|
||||||
|
/ (0.5*(undersat_oil_tables_[iNext][2][j]+undersat_oil_tables_[iNext][2][j-1]));
|
||||||
|
double mu = (undersat_oil_tables_[i][2].back())*(1.0+0.5*visc)/(1.0-0.5*visc);
|
||||||
|
undersat_oil_tables_[i][2].push_back(mu);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destructor.
|
/// Destructor.
|
||||||
|
@ -20,8 +20,10 @@
|
|||||||
#ifndef OPM_SINGLEPVTLIVEOIL_HEADER_INCLUDED
|
#ifndef OPM_SINGLEPVTLIVEOIL_HEADER_INCLUDED
|
||||||
#define OPM_SINGLEPVTLIVEOIL_HEADER_INCLUDED
|
#define OPM_SINGLEPVTLIVEOIL_HEADER_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
#include <opm/core/props/pvt/SinglePvtInterface.hpp>
|
||||||
|
|
||||||
|
#include <opm/parser/eclipse/Utility/PvtoTable.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@ -39,6 +41,7 @@ namespace Opm
|
|||||||
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
typedef std::vector<std::vector<std::vector<double> > > table_t;
|
||||||
|
|
||||||
SinglePvtLiveOil(const table_t& pvto);
|
SinglePvtLiveOil(const table_t& pvto);
|
||||||
|
SinglePvtLiveOil(const Opm::PvtoTable &pvtoTable);
|
||||||
virtual ~SinglePvtLiveOil();
|
virtual ~SinglePvtLiveOil();
|
||||||
|
|
||||||
/// Viscosity as a function of p and z.
|
/// Viscosity as a function of p and z.
|
||||||
|
Loading…
Reference in New Issue
Block a user