mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
abd8973382
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <opm/core/fluid/BlackoilPropertiesFromDeck.hpp>
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
@ -34,6 +34,21 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
|
||||
BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||
const UnstructuredGrid& grid,
|
||||
const parameter::ParameterGroup& param)
|
||||
{
|
||||
rock_.init(deck, grid);
|
||||
const int samples = param.getDefault("dead_tab_size", 1025);
|
||||
pvt_.init(deck, samples);
|
||||
satprops_.init(deck, grid, param);
|
||||
|
||||
if (pvt_.numPhases() != satprops_.numPhases()) {
|
||||
THROW("BlackoilPropertiesBasic::BlackoilPropertiesBasic() - Inconsistent number of phases in pvt data ("
|
||||
<< pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_.numPhases() << ").");
|
||||
}
|
||||
}
|
||||
|
||||
BlackoilPropertiesFromDeck::~BlackoilPropertiesFromDeck()
|
||||
{
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <opm/core/fluid/blackoil/BlackoilPvtProperties.hpp>
|
||||
#include <opm/core/fluid/SaturationPropsFromDeck.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
|
||||
@ -38,13 +39,25 @@ namespace Opm
|
||||
{
|
||||
public:
|
||||
/// Initialize from deck and grid.
|
||||
/// \param deck Deck input parser
|
||||
/// \param grid Grid to which property object applies, needed for the
|
||||
/// \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.
|
||||
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.
|
||||
BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
|
||||
const UnstructuredGrid& grid,
|
||||
const parameter::ParameterGroup& param);
|
||||
|
||||
/// Destructor.
|
||||
virtual ~BlackoilPropertiesFromDeck();
|
||||
|
||||
|
@ -19,10 +19,12 @@
|
||||
|
||||
#ifndef OPM_SATURATIONPROPSFROMDECK_HEADER_INCLUDED
|
||||
#define OPM_SATURATIONPROPSFROMDECK_HEADER_INCLUDED
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/utility/UniformTableLinear.hpp>
|
||||
#include <opm/core/fluid/blackoil/BlackoilPhases.hpp>
|
||||
#include <opm/core/fluid/SatFuncStone2.hpp>
|
||||
#include <opm/core/fluid/SatFuncSimple.hpp>
|
||||
#include <vector>
|
||||
|
||||
struct UnstructuredGrid;
|
||||
@ -44,6 +46,10 @@ namespace Opm
|
||||
void init(const EclipseGridParser& deck,
|
||||
const UnstructuredGrid& grid);
|
||||
|
||||
void init(const EclipseGridParser& deck,
|
||||
const UnstructuredGrid& grid,
|
||||
const parameter::ParameterGroup& param);
|
||||
|
||||
/// \return P, the number of phases.
|
||||
int numPhases() const;
|
||||
|
||||
@ -88,30 +94,11 @@ namespace Opm
|
||||
|
||||
private:
|
||||
PhaseUsage phase_usage_;
|
||||
class SatFuncSet
|
||||
{
|
||||
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)
|
||||
};
|
||||
std::vector<SatFuncSet> satfuncset_;
|
||||
typedef SatFuncSimple satfunc_t;
|
||||
std::vector<satfunc_t> satfuncset_;
|
||||
std::vector<int> cell_to_func_; // = SATNUM - 1
|
||||
|
||||
const SatFuncSet& funcForCell(const int cell) const;
|
||||
const satfunc_t& funcForCell(const int cell) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace Opm
|
||||
BlackoilPvtProperties();
|
||||
|
||||
/// Initialize from deck.
|
||||
void init(const EclipseGridParser& deck);
|
||||
void init(const EclipseGridParser& deck, const int samples = 16);
|
||||
|
||||
/// Number of active phases.
|
||||
int numPhases() const;
|
||||
|
@ -512,11 +512,11 @@ namespace Opm
|
||||
State& state)
|
||||
{
|
||||
const int num_phases = props.numPhases();
|
||||
if (num_phases != 2) {
|
||||
THROW("initStateFromDeck(): currently handling only two-phase scenarios.");
|
||||
}
|
||||
state.init(grid, num_phases);
|
||||
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.
|
||||
const EQUIL& equil= deck.getEQUIL();
|
||||
if (equil.equil.size() != 1) {
|
||||
@ -535,12 +535,28 @@ namespace Opm
|
||||
const std::vector<double>& sw_deck = deck.getFloatingPointValue("SWAT");
|
||||
const std::vector<double>& p_deck = deck.getFloatingPointValue("PRESSURE");
|
||||
const int num_cells = grid.number_of_cells;
|
||||
if (num_phases == 2) {
|
||||
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 - s[2*c];
|
||||
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[3*c] = sw_deck[c_deck];
|
||||
s[3*c + 1] = 1.0 - (sw_deck[c_deck] + sg_deck[c_deck]);
|
||||
s[3*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 {
|
||||
THROW("initStateFromDeck(): we must either have EQUIL, or both SWAT and PRESSURE.");
|
||||
}
|
||||
|
@ -593,8 +593,10 @@ namespace Opm
|
||||
{
|
||||
int nw = well_bhp.size();
|
||||
ASSERT(nw == wells.number_of_wells);
|
||||
if (props.numPhases() != 2) {
|
||||
THROW("WellReport for now assumes two phase flow.");
|
||||
int np = props.numPhases();
|
||||
const int max_np = 3;
|
||||
if (np > max_np) {
|
||||
THROW("WellReport for now assumes #phases <= " << max_np);
|
||||
}
|
||||
const double* visc = props.viscosity();
|
||||
std::vector<double> data_now;
|
||||
@ -605,7 +607,8 @@ namespace Opm
|
||||
double well_rate_total = 0.0;
|
||||
double well_rate_water = 0.0;
|
||||
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;
|
||||
if (perf_rate > 0.0) {
|
||||
// Injection.
|
||||
@ -613,11 +616,14 @@ namespace Opm
|
||||
} else {
|
||||
// Production.
|
||||
const int cell = wells.well_cells[perf];
|
||||
double mob[2];
|
||||
double mob[max_np];
|
||||
props.relperm(1, &saturation[2*cell], &cell, mob, 0);
|
||||
mob[0] /= visc[0];
|
||||
mob[1] /= visc[1];
|
||||
const double fracflow = mob[0]/(mob[0] + mob[1]);
|
||||
double tmob = 0;
|
||||
for(int i = 0; i < np; ++i) {
|
||||
mob[i] /= visc[i];
|
||||
tmob += mob[i];
|
||||
}
|
||||
const double fracflow = mob[0]/tmob;
|
||||
well_rate_water += perf_rate*fracflow;
|
||||
}
|
||||
}
|
||||
@ -646,8 +652,10 @@ namespace Opm
|
||||
// TODO: refactor, since this is almost identical to the other push().
|
||||
int nw = well_bhp.size();
|
||||
ASSERT(nw == wells.number_of_wells);
|
||||
if (props.numPhases() != 2) {
|
||||
THROW("WellReport for now assumes two phase flow.");
|
||||
int np = props.numPhases();
|
||||
const int max_np = 3;
|
||||
if (np > max_np) {
|
||||
THROW("WellReport for now assumes #phases <= " << max_np);
|
||||
}
|
||||
std::vector<double> data_now;
|
||||
data_now.reserve(1 + 3*nw);
|
||||
@ -657,7 +665,8 @@ namespace Opm
|
||||
double well_rate_total = 0.0;
|
||||
double well_rate_water = 0.0;
|
||||
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;
|
||||
if (perf_rate > 0.0) {
|
||||
// Injection.
|
||||
@ -665,13 +674,16 @@ namespace Opm
|
||||
} else {
|
||||
// Production.
|
||||
const int cell = wells.well_cells[perf];
|
||||
double mob[2];
|
||||
props.relperm(1, &s[2*cell], &cell, mob, 0);
|
||||
double visc[2];
|
||||
props.viscosity(1, &p[cell], &z[2*cell], &cell, visc, 0);
|
||||
mob[0] /= visc[0];
|
||||
mob[1] /= visc[1];
|
||||
const double fracflow = mob[0]/(mob[0] + mob[1]);
|
||||
double mob[max_np];
|
||||
props.relperm(1, &s[np*cell], &cell, mob, 0);
|
||||
double visc[max_np];
|
||||
props.viscosity(1, &p[cell], &z[np*cell], &cell, visc, 0);
|
||||
double tmob = 0;
|
||||
for(int i = 0; i < np; ++i) {
|
||||
mob[i] /= visc[i];
|
||||
tmob += mob[i];
|
||||
}
|
||||
const double fracflow = mob[0]/(tmob);
|
||||
well_rate_water += perf_rate*fracflow;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user