mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'master' into nonuniform_fluid_tables
Conflicts: Makefile.am opm/core/fluid/BlackoilPropertiesFromDeck.hpp opm/core/fluid/SaturationPropsFromDeck.cpp opm/core/fluid/SaturationPropsFromDeck.hpp opm/core/fluid/blackoil/BlackoilPvtProperties.cpp opm/core/fluid/blackoil/BlackoilPvtProperties.hpp opm/core/fluid/blackoil/SinglePvtDead.cpp This merge combines three more-or-less orthogonal features for saturation tables: the option to use StoneII or Simple three-phase behaviour, the option to fit a spline or not, and finally setting the number of samples used (if spline fitting). Interfaces have changed, the most top-level one being that BlackoilPropertiesFromDeck::init() now also takes a ParameterGroup argument.
This commit is contained in:
commit
03f6f43160
@ -18,29 +18,67 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <opm/core/fluid/BlackoilPropertiesFromDeck.hpp>
|
#include <opm/core/fluid/BlackoilPropertiesFromDeck.hpp>
|
||||||
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||||
const UnstructuredGrid& grid,
|
const UnstructuredGrid& grid)
|
||||||
const bool use_spline)
|
|
||||||
{
|
{
|
||||||
rock_.init(deck, grid);
|
rock_.init(deck, grid);
|
||||||
pvt_.init(deck, use_spline);
|
pvt_.init(deck, 1025);
|
||||||
// Unfortunate lack of pointer smartness here...
|
SaturationPropsFromDeck<SatFuncStone2Uniform>* ptr
|
||||||
if (use_spline) {
|
= new SaturationPropsFromDeck<SatFuncStone2Uniform>();
|
||||||
SaturationPropsFromDeck<>* ptr = new SaturationPropsFromDeck<>();
|
|
||||||
ptr->init(deck, grid);
|
|
||||||
satprops_.reset(ptr);
|
satprops_.reset(ptr);
|
||||||
} else {
|
ptr->init(deck, grid, 200);
|
||||||
SaturationPropsFromDeck<SatFuncSetNonuniform>* ptr
|
|
||||||
= new SaturationPropsFromDeck<SatFuncSetNonuniform>();
|
|
||||||
ptr->init(deck, grid);
|
|
||||||
satprops_.reset(ptr);
|
|
||||||
}
|
|
||||||
if (pvt_.numPhases() != satprops_->numPhases()) {
|
if (pvt_.numPhases() != satprops_->numPhases()) {
|
||||||
THROW("BlackoilPropertiesBasic::BlackoilPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
THROW("BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||||
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||||
|
const UnstructuredGrid& grid,
|
||||||
|
const parameter::ParameterGroup& param)
|
||||||
|
{
|
||||||
|
rock_.init(deck, grid);
|
||||||
|
const int pvt_samples = param.getDefault("pvt_tab_size", 200);
|
||||||
|
pvt_.init(deck, pvt_samples);
|
||||||
|
|
||||||
|
// Unfortunate lack of pointer smartness here...
|
||||||
|
const int sat_samples = param.getDefault("sat_tab_size", 200);
|
||||||
|
std::string threephase_model = param.getDefault<std::string>("threephase_model", "simple");
|
||||||
|
bool use_stone2 = (threephase_model == "stone2");
|
||||||
|
if (sat_samples > 1) {
|
||||||
|
if (use_stone2) {
|
||||||
|
SaturationPropsFromDeck<SatFuncStone2Uniform>* ptr
|
||||||
|
= new SaturationPropsFromDeck<SatFuncStone2Uniform>();
|
||||||
|
satprops_.reset(ptr);
|
||||||
|
ptr->init(deck, grid, sat_samples);
|
||||||
|
} else {
|
||||||
|
SaturationPropsFromDeck<SatFuncSimpleUniform>* ptr
|
||||||
|
= new SaturationPropsFromDeck<SatFuncSimpleUniform>();
|
||||||
|
satprops_.reset(ptr);
|
||||||
|
ptr->init(deck, grid, sat_samples);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (use_stone2) {
|
||||||
|
SaturationPropsFromDeck<SatFuncStone2Nonuniform>* ptr
|
||||||
|
= new SaturationPropsFromDeck<SatFuncStone2Nonuniform>();
|
||||||
|
satprops_.reset(ptr);
|
||||||
|
ptr->init(deck, grid, sat_samples);
|
||||||
|
} else {
|
||||||
|
SaturationPropsFromDeck<SatFuncSimpleNonuniform>* ptr
|
||||||
|
= new SaturationPropsFromDeck<SatFuncSimpleNonuniform>();
|
||||||
|
satprops_.reset(ptr);
|
||||||
|
ptr->init(deck, grid, sat_samples);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pvt_.numPhases() != satprops_->numPhases()) {
|
||||||
|
THROW("BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <opm/core/fluid/blackoil/BlackoilPvtProperties.hpp>
|
#include <opm/core/fluid/blackoil/BlackoilPvtProperties.hpp>
|
||||||
#include <opm/core/fluid/SaturationPropsFromDeck.hpp>
|
#include <opm/core/fluid/SaturationPropsFromDeck.hpp>
|
||||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||||
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
struct UnstructuredGrid;
|
struct UnstructuredGrid;
|
||||||
@ -39,13 +40,26 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Initialize from deck and grid.
|
/// Initialize from deck and grid.
|
||||||
/// \param deck Deck input parser
|
/// \param[in] deck Deck input parser
|
||||||
/// \param grid Grid to which property object applies, needed for the
|
/// \param[in] grid Grid to which property object applies, needed for the
|
||||||
/// mapping from cell indices (typically from a processed grid)
|
/// mapping from cell indices (typically from a processed grid)
|
||||||
/// to logical cartesian indices consistent with the deck.
|
/// to logical cartesian indices consistent with the deck.
|
||||||
|
BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||||
|
const UnstructuredGrid& grid);
|
||||||
|
|
||||||
|
/// Initialize from deck, grid and parameters.
|
||||||
|
/// \param[in] deck Deck input parser
|
||||||
|
/// \param[in] grid Grid to which property object applies, needed for the
|
||||||
|
/// mapping from cell indices (typically from a processed grid)
|
||||||
|
/// to logical cartesian indices consistent with the deck.
|
||||||
|
/// \param[in] param Parameters. Accepted parameters include:
|
||||||
|
/// dead_tab_size (1025) number of uniform sample points for dead-oil pvt tables.
|
||||||
|
/// tab_size_kr (200) number of uniform sample points for saturation tables.
|
||||||
|
/// For both parameters, a 0 or negative value indicates that no spline fitting is to
|
||||||
|
/// be done, and the input fluid data used directly for linear interpolation.
|
||||||
BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||||
const UnstructuredGrid& grid,
|
const UnstructuredGrid& grid,
|
||||||
const bool use_spline);
|
const parameter::ParameterGroup& param);
|
||||||
|
|
||||||
/// Destructor.
|
/// Destructor.
|
||||||
virtual ~BlackoilPropertiesFromDeck();
|
virtual ~BlackoilPropertiesFromDeck();
|
||||||
|
@ -31,7 +31,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
rock_.init(deck, grid);
|
rock_.init(deck, grid);
|
||||||
pvt_.init(deck);
|
pvt_.init(deck);
|
||||||
satprops_.init(deck, grid);
|
satprops_.init(deck, grid, 200);
|
||||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||||
THROW("IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
THROW("IncompPropertiesFromDeck::IncompPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
|
||||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||||
|
@ -135,7 +135,7 @@ namespace Opm
|
|||||||
private:
|
private:
|
||||||
RockFromDeck rock_;
|
RockFromDeck rock_;
|
||||||
PvtPropertiesIncompFromDeck pvt_;
|
PvtPropertiesIncompFromDeck pvt_;
|
||||||
SaturationPropsFromDeck<> satprops_;
|
SaturationPropsFromDeck<SatFuncStone2Uniform> satprops_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,11 @@
|
|||||||
#define OPM_SATURATIONPROPSFROMDECK_HEADER_INCLUDED
|
#define OPM_SATURATIONPROPSFROMDECK_HEADER_INCLUDED
|
||||||
|
|
||||||
#include <opm/core/fluid/SaturationPropsInterface.hpp>
|
#include <opm/core/fluid/SaturationPropsInterface.hpp>
|
||||||
|
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||||
#include <opm/core/fluid/blackoil/BlackoilPhases.hpp>
|
#include <opm/core/fluid/blackoil/BlackoilPhases.hpp>
|
||||||
|
#include <opm/core/fluid/SatFuncStone2.hpp>
|
||||||
|
#include <opm/core/fluid/SatFuncSimple.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct UnstructuredGrid;
|
struct UnstructuredGrid;
|
||||||
@ -31,21 +34,14 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/// Class storing saturation functions in a uniform table,
|
|
||||||
/// densely sampled from a monotone spline,
|
|
||||||
/// using linear interpolation.
|
|
||||||
class SatFuncSetUniform;
|
|
||||||
|
|
||||||
/// Class storing saturation functions in a nonuniform table
|
|
||||||
/// using linear interpolation.
|
|
||||||
class SatFuncSetNonuniform;
|
|
||||||
|
|
||||||
|
|
||||||
/// Interface to saturation functions from deck.
|
/// Interface to saturation functions from deck.
|
||||||
/// Possible values for template argument:
|
/// Possible values for template argument (for now):
|
||||||
/// SatFuncSetNonuniform,
|
/// SatFuncSetStone2Nonuniform,
|
||||||
/// SatFuncSetUniform (default).
|
/// SatFuncSetStone2Uniform.
|
||||||
template <class SatFuncSet = SatFuncSetUniform>
|
/// SatFuncSetSimpleNonuniform,
|
||||||
|
/// SatFuncSetSimpleUniform.
|
||||||
|
template <class SatFuncSet>
|
||||||
class SaturationPropsFromDeck : public SaturationPropsInterface
|
class SaturationPropsFromDeck : public SaturationPropsInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -53,12 +49,15 @@ namespace Opm
|
|||||||
SaturationPropsFromDeck();
|
SaturationPropsFromDeck();
|
||||||
|
|
||||||
/// Initialize from deck and grid.
|
/// Initialize from deck and grid.
|
||||||
/// \param deck Deck input parser
|
/// \param[in] deck Deck input parser
|
||||||
/// \param grid Grid to which property object applies, needed for the
|
/// \param[in] grid Grid to which property object applies, needed for the
|
||||||
/// mapping from cell indices (typically from a processed grid)
|
/// mapping from cell indices (typically from a processed grid)
|
||||||
/// to logical cartesian indices consistent with the deck.
|
/// to logical cartesian indices consistent with the deck.
|
||||||
|
/// \param[in] samples Number of uniform sample points for saturation tables.
|
||||||
|
/// NOTE: samples will only be used with the SatFuncSetUniform template argument.
|
||||||
void init(const EclipseGridParser& deck,
|
void init(const EclipseGridParser& deck,
|
||||||
const UnstructuredGrid& grid);
|
const UnstructuredGrid& grid,
|
||||||
|
const int samples);
|
||||||
|
|
||||||
/// \return P, the number of phases.
|
/// \return P, the number of phases.
|
||||||
int numPhases() const;
|
int numPhases() const;
|
||||||
|
@ -29,57 +29,6 @@
|
|||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
/// Class storing saturation functions in a uniform table,
|
|
||||||
/// densely sampled from a monotone spline,
|
|
||||||
/// using linear interpolation.
|
|
||||||
class SatFuncSetUniform : public BlackoilPhases
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void init(const EclipseGridParser& deck, const int table_num, PhaseUsage phase_usg);
|
|
||||||
void evalKr(const double* s, double* kr) const;
|
|
||||||
void evalKrDeriv(const double* s, double* kr, double* dkrds) const;
|
|
||||||
void evalPc(const double* s, double* pc) const;
|
|
||||||
void evalPcDeriv(const double* s, double* pc, double* dpcds) const;
|
|
||||||
double smin_[PhaseUsage::MaxNumPhases];
|
|
||||||
double smax_[PhaseUsage::MaxNumPhases];
|
|
||||||
private:
|
|
||||||
PhaseUsage phase_usage; // A copy of the outer class' phase_usage_.
|
|
||||||
UniformTableLinear<double> krw_;
|
|
||||||
UniformTableLinear<double> krow_;
|
|
||||||
UniformTableLinear<double> pcow_;
|
|
||||||
UniformTableLinear<double> krg_;
|
|
||||||
UniformTableLinear<double> krog_;
|
|
||||||
UniformTableLinear<double> pcog_;
|
|
||||||
double krocw_; // = krow_(s_wc)
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Class storing saturation functions in a nonuniform table
|
|
||||||
/// using linear interpolation.
|
|
||||||
class SatFuncSetNonuniform : public BlackoilPhases
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void init(const EclipseGridParser& deck, const int table_num, PhaseUsage phase_usg);
|
|
||||||
void evalKr(const double* s, double* kr) const;
|
|
||||||
void evalKrDeriv(const double* s, double* kr, double* dkrds) const;
|
|
||||||
void evalPc(const double* s, double* pc) const;
|
|
||||||
void evalPcDeriv(const double* s, double* pc, double* dpcds) const;
|
|
||||||
double smin_[PhaseUsage::MaxNumPhases];
|
|
||||||
double smax_[PhaseUsage::MaxNumPhases];
|
|
||||||
private:
|
|
||||||
PhaseUsage phase_usage; // A copy of the outer class' phase_usage_.
|
|
||||||
NonuniformTableLinear<double> krw_;
|
|
||||||
NonuniformTableLinear<double> krow_;
|
|
||||||
NonuniformTableLinear<double> pcow_;
|
|
||||||
NonuniformTableLinear<double> krg_;
|
|
||||||
NonuniformTableLinear<double> krog_;
|
|
||||||
NonuniformTableLinear<double> pcog_;
|
|
||||||
double krocw_; // = krow_(s_wc)
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------- Methods of SaturationPropsFromDeck ---------
|
// ----------- Methods of SaturationPropsFromDeck ---------
|
||||||
|
|
||||||
@ -93,7 +42,8 @@ namespace Opm
|
|||||||
/// Initialize from deck.
|
/// Initialize from deck.
|
||||||
template <class SatFuncSet>
|
template <class SatFuncSet>
|
||||||
void SaturationPropsFromDeck<SatFuncSet>::init(const EclipseGridParser& deck,
|
void SaturationPropsFromDeck<SatFuncSet>::init(const EclipseGridParser& deck,
|
||||||
const UnstructuredGrid& grid)
|
const UnstructuredGrid& grid,
|
||||||
|
const int samples)
|
||||||
{
|
{
|
||||||
phase_usage_ = phaseUsageFromDeck(deck);
|
phase_usage_ = phaseUsageFromDeck(deck);
|
||||||
|
|
||||||
@ -144,7 +94,7 @@ namespace Opm
|
|||||||
// Initialize tables.
|
// Initialize tables.
|
||||||
satfuncset_.resize(num_tables);
|
satfuncset_.resize(num_tables);
|
||||||
for (int table = 0; table < num_tables; ++table) {
|
for (int table = 0; table < num_tables; ++table) {
|
||||||
satfuncset_[table].init(deck, table, phase_usage_);
|
satfuncset_[table].init(deck, table, phase_usage_, samples);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,13 @@ namespace Opm
|
|||||||
BlackoilPvtProperties();
|
BlackoilPvtProperties();
|
||||||
|
|
||||||
/// Initialize from deck.
|
/// Initialize from deck.
|
||||||
void init(const EclipseGridParser& deck, const bool use_spline);
|
/// \param deck An input deck.
|
||||||
|
/// \param samples If greater than zero, indicates the number of
|
||||||
|
/// uniform samples to be taken from monotone spline
|
||||||
|
/// curves interpolating the fluid data.
|
||||||
|
/// Otherwise, interpolate linearly in the original
|
||||||
|
/// data without fitting a spline.
|
||||||
|
void init(const EclipseGridParser& deck, const int samples);
|
||||||
|
|
||||||
/// Number of active phases.
|
/// Number of active phases.
|
||||||
int numPhases() const;
|
int numPhases() const;
|
||||||
|
@ -512,11 +512,11 @@ namespace Opm
|
|||||||
State& state)
|
State& state)
|
||||||
{
|
{
|
||||||
const int num_phases = props.numPhases();
|
const int num_phases = props.numPhases();
|
||||||
if (num_phases != 2) {
|
|
||||||
THROW("initStateFromDeck(): currently handling only two-phase scenarios.");
|
|
||||||
}
|
|
||||||
state.init(grid, num_phases);
|
state.init(grid, num_phases);
|
||||||
if (deck.hasField("EQUIL")) {
|
if (deck.hasField("EQUIL")) {
|
||||||
|
if (num_phases != 2) {
|
||||||
|
THROW("initStateFromDeck(): EQUIL-based init currently handling only two-phase scenarios.");
|
||||||
|
}
|
||||||
// Set saturations depending on oil-water contact.
|
// Set saturations depending on oil-water contact.
|
||||||
const EQUIL& equil= deck.getEQUIL();
|
const EQUIL& equil= deck.getEQUIL();
|
||||||
if (equil.equil.size() != 1) {
|
if (equil.equil.size() != 1) {
|
||||||
@ -535,12 +535,28 @@ namespace Opm
|
|||||||
const std::vector<double>& sw_deck = deck.getFloatingPointValue("SWAT");
|
const std::vector<double>& sw_deck = deck.getFloatingPointValue("SWAT");
|
||||||
const std::vector<double>& p_deck = deck.getFloatingPointValue("PRESSURE");
|
const std::vector<double>& p_deck = deck.getFloatingPointValue("PRESSURE");
|
||||||
const int num_cells = grid.number_of_cells;
|
const int num_cells = grid.number_of_cells;
|
||||||
|
if (num_phases == 2) {
|
||||||
for (int c = 0; c < num_cells; ++c) {
|
for (int c = 0; c < num_cells; ++c) {
|
||||||
int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c];
|
int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c];
|
||||||
s[2*c] = sw_deck[c_deck];
|
s[2*c] = sw_deck[c_deck];
|
||||||
s[2*c + 1] = 1.0 - s[2*c];
|
s[2*c + 1] = 1.0 - s[2*c];
|
||||||
p[c] = p_deck[c_deck];
|
p[c] = p_deck[c_deck];
|
||||||
}
|
}
|
||||||
|
} else if (num_phases == 3) {
|
||||||
|
if (!deck.hasField("SGAS")) {
|
||||||
|
THROW("initStateFromDeck(): missing SGAS keyword in 3-phase init (only SWAT and PRESSURE found).");
|
||||||
|
}
|
||||||
|
const std::vector<double>& sg_deck = deck.getFloatingPointValue("SGAS");
|
||||||
|
for (int c = 0; c < num_cells; ++c) {
|
||||||
|
int c_deck = (grid.global_cell == NULL) ? c : grid.global_cell[c];
|
||||||
|
s[2*c] = sw_deck[c_deck];
|
||||||
|
s[2*c + 1] = 1.0 - (sw_deck[c_deck] + sg_deck[c_deck]);
|
||||||
|
s[2*c + 2] = sg_deck[c_deck];
|
||||||
|
p[c] = p_deck[c_deck];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
THROW("initStateFromDeck(): init with SWAT etc. only available with 2 or 3 phases.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
THROW("initStateFromDeck(): we must either have EQUIL, or both SWAT and PRESSURE.");
|
THROW("initStateFromDeck(): we must either have EQUIL, or both SWAT and PRESSURE.");
|
||||||
}
|
}
|
||||||
|
@ -593,8 +593,10 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
int nw = well_bhp.size();
|
int nw = well_bhp.size();
|
||||||
ASSERT(nw == wells.number_of_wells);
|
ASSERT(nw == wells.number_of_wells);
|
||||||
if (props.numPhases() != 2) {
|
int np = props.numPhases();
|
||||||
THROW("WellReport for now assumes two phase flow.");
|
const int max_np = 3;
|
||||||
|
if (np > max_np) {
|
||||||
|
THROW("WellReport for now assumes #phases <= " << max_np);
|
||||||
}
|
}
|
||||||
const double* visc = props.viscosity();
|
const double* visc = props.viscosity();
|
||||||
std::vector<double> data_now;
|
std::vector<double> data_now;
|
||||||
@ -605,7 +607,8 @@ namespace Opm
|
|||||||
double well_rate_total = 0.0;
|
double well_rate_total = 0.0;
|
||||||
double well_rate_water = 0.0;
|
double well_rate_water = 0.0;
|
||||||
for (int perf = wells.well_connpos[w]; perf < wells.well_connpos[w + 1]; ++perf) {
|
for (int perf = wells.well_connpos[w]; perf < wells.well_connpos[w + 1]; ++perf) {
|
||||||
const double perf_rate = well_perfrates[perf]*(unit::day/unit::second);
|
const double perf_rate = unit::convert::to(well_perfrates[perf],
|
||||||
|
unit::cubic(unit::meter)/unit::day);
|
||||||
well_rate_total += perf_rate;
|
well_rate_total += perf_rate;
|
||||||
if (perf_rate > 0.0) {
|
if (perf_rate > 0.0) {
|
||||||
// Injection.
|
// Injection.
|
||||||
@ -613,11 +616,14 @@ namespace Opm
|
|||||||
} else {
|
} else {
|
||||||
// Production.
|
// Production.
|
||||||
const int cell = wells.well_cells[perf];
|
const int cell = wells.well_cells[perf];
|
||||||
double mob[2];
|
double mob[max_np];
|
||||||
props.relperm(1, &saturation[2*cell], &cell, mob, 0);
|
props.relperm(1, &saturation[2*cell], &cell, mob, 0);
|
||||||
mob[0] /= visc[0];
|
double tmob = 0;
|
||||||
mob[1] /= visc[1];
|
for(int i = 0; i < np; ++i) {
|
||||||
const double fracflow = mob[0]/(mob[0] + mob[1]);
|
mob[i] /= visc[i];
|
||||||
|
tmob += mob[i];
|
||||||
|
}
|
||||||
|
const double fracflow = mob[0]/tmob;
|
||||||
well_rate_water += perf_rate*fracflow;
|
well_rate_water += perf_rate*fracflow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -646,8 +652,10 @@ namespace Opm
|
|||||||
// TODO: refactor, since this is almost identical to the other push().
|
// TODO: refactor, since this is almost identical to the other push().
|
||||||
int nw = well_bhp.size();
|
int nw = well_bhp.size();
|
||||||
ASSERT(nw == wells.number_of_wells);
|
ASSERT(nw == wells.number_of_wells);
|
||||||
if (props.numPhases() != 2) {
|
int np = props.numPhases();
|
||||||
THROW("WellReport for now assumes two phase flow.");
|
const int max_np = 3;
|
||||||
|
if (np > max_np) {
|
||||||
|
THROW("WellReport for now assumes #phases <= " << max_np);
|
||||||
}
|
}
|
||||||
std::vector<double> data_now;
|
std::vector<double> data_now;
|
||||||
data_now.reserve(1 + 3*nw);
|
data_now.reserve(1 + 3*nw);
|
||||||
@ -665,13 +673,16 @@ namespace Opm
|
|||||||
} else {
|
} else {
|
||||||
// Production.
|
// Production.
|
||||||
const int cell = wells.well_cells[perf];
|
const int cell = wells.well_cells[perf];
|
||||||
double mob[2];
|
double mob[max_np];
|
||||||
props.relperm(1, &s[2*cell], &cell, mob, 0);
|
props.relperm(1, &s[2*cell], &cell, mob, 0);
|
||||||
double visc[2];
|
double visc[max_np];
|
||||||
props.viscosity(1, &p[cell], &z[2*cell], &cell, visc, 0);
|
props.viscosity(1, &p[cell], &z[2*cell], &cell, visc, 0);
|
||||||
mob[0] /= visc[0];
|
double tmob = 0;
|
||||||
mob[1] /= visc[1];
|
for(int i = 0; i < np; ++i) {
|
||||||
const double fracflow = mob[0]/(mob[0] + mob[1]);
|
mob[i] /= visc[i];
|
||||||
|
tmob += mob[i];
|
||||||
|
}
|
||||||
|
const double fracflow = mob[0]/(tmob);
|
||||||
well_rate_water += perf_rate*fracflow;
|
well_rate_water += perf_rate*fracflow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user