2016-10-10 10:23:03 -05:00
|
|
|
#include <opm/parser/eclipse/Units/Units.hpp>
|
2014-02-25 10:52:51 -06:00
|
|
|
#include <opm/core/grid/GridHelpers.hpp>
|
|
|
|
|
2015-10-08 04:42:15 -05:00
|
|
|
#include <opm/common/ErrorMacros.hpp>
|
2016-05-20 03:14:16 -05:00
|
|
|
#include <opm/common/OpmLog/OpmLog.hpp>
|
2015-09-15 07:23:10 -05:00
|
|
|
#include <opm/core/utility/compressedToCartesian.hpp>
|
2016-02-26 04:49:40 -06:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
2016-01-20 07:12:04 -06:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
2014-08-29 04:39:24 -05:00
|
|
|
|
|
|
|
#include <algorithm>
|
2014-02-25 10:52:51 -06:00
|
|
|
#include <array>
|
2014-08-29 04:39:24 -05:00
|
|
|
#include <cstddef>
|
|
|
|
#include <exception>
|
|
|
|
#include <iterator>
|
2015-05-08 09:29:05 -05:00
|
|
|
#include <numeric>
|
2014-02-25 10:52:51 -06:00
|
|
|
|
|
|
|
namespace WellsManagerDetail
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
namespace ProductionControl
|
|
|
|
{
|
|
|
|
enum Mode { ORAT, WRAT, GRAT,
|
|
|
|
LRAT, CRAT, RESV,
|
|
|
|
BHP , THP , GRUP };
|
|
|
|
/*
|
|
|
|
namespace Details {
|
|
|
|
std::map<std::string, Mode>
|
|
|
|
init_mode_map();
|
|
|
|
} // namespace Details
|
|
|
|
*/
|
|
|
|
Mode mode(const std::string& control);
|
|
|
|
|
|
|
|
|
|
|
|
Mode mode(Opm::WellProducer::ControlModeEnum controlMode);
|
|
|
|
} // namespace ProductionControl
|
|
|
|
|
|
|
|
|
|
|
|
namespace InjectionControl
|
|
|
|
{
|
|
|
|
enum Mode { RATE, RESV, BHP,
|
|
|
|
THP, GRUP };
|
|
|
|
/*
|
|
|
|
namespace Details {
|
|
|
|
std::map<std::string, Mode>
|
|
|
|
init_mode_map();
|
|
|
|
} // namespace Details
|
|
|
|
*/
|
|
|
|
Mode mode(const std::string& control);
|
|
|
|
|
|
|
|
Mode mode(Opm::WellInjector::ControlModeEnum controlMode);
|
|
|
|
|
|
|
|
} // namespace InjectionControl
|
|
|
|
|
|
|
|
double computeWellIndex(const double radius,
|
|
|
|
const std::array<double, 3>& cubical,
|
|
|
|
const double* cell_permeability,
|
2014-08-29 09:57:10 -05:00
|
|
|
const double skin_factor,
|
2015-01-12 05:41:56 -06:00
|
|
|
const Opm::WellCompletion::DirectionEnum direction,
|
2014-08-29 09:57:10 -05:00
|
|
|
const double ntg);
|
2014-02-25 10:52:51 -06:00
|
|
|
|
2014-08-29 04:39:24 -05:00
|
|
|
template <int dim, class C2F, class FC>
|
|
|
|
std::array<double, dim>
|
|
|
|
getCubeDim(const C2F& c2f,
|
|
|
|
FC begin_face_centroids,
|
|
|
|
int cell)
|
2014-02-25 10:52:51 -06:00
|
|
|
{
|
2014-08-29 04:39:24 -05:00
|
|
|
std::array< std::vector<double>, dim > X;
|
|
|
|
{
|
|
|
|
const std::vector<double>::size_type
|
|
|
|
nf = std::distance(c2f[cell].begin(),
|
|
|
|
c2f[cell].end ());
|
|
|
|
|
|
|
|
for (int d = 0; d < dim; ++d) {
|
|
|
|
X[d].reserve(nf);
|
|
|
|
}
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
2014-08-29 04:39:24 -05:00
|
|
|
|
|
|
|
typedef typename C2F::row_type::const_iterator FI;
|
|
|
|
|
|
|
|
for (FI f = c2f[cell].begin(), e = c2f[cell].end(); f != e; ++f) {
|
|
|
|
using Opm::UgGridHelpers::increment;
|
|
|
|
using Opm::UgGridHelpers::getCoordinate;
|
|
|
|
|
|
|
|
const FC& fc = increment(begin_face_centroids, *f, dim);
|
|
|
|
|
|
|
|
for (int d = 0; d < dim; ++d) {
|
|
|
|
X[d].push_back(getCoordinate(fc, d));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::array<double, dim> cube;
|
|
|
|
for (int d = 0; d < dim; ++d) {
|
|
|
|
typedef std::vector<double>::iterator VI;
|
|
|
|
typedef std::pair<VI,VI> PVI;
|
|
|
|
|
|
|
|
const PVI m = std::minmax_element(X[d].begin(), X[d].end());
|
|
|
|
|
|
|
|
cube[d] = *m.second - *m.first;
|
|
|
|
}
|
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
return cube;
|
|
|
|
}
|
2014-08-29 05:31:35 -05:00
|
|
|
} // end namespace WellsManagerDetail
|
2014-02-25 10:52:51 -06:00
|
|
|
|
|
|
|
namespace Opm
|
|
|
|
{
|
2015-02-17 03:28:11 -06:00
|
|
|
template<class C2F, class FC, class NTG>
|
2016-06-16 02:33:43 -05:00
|
|
|
void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t timeStep,
|
2015-01-12 05:13:53 -06:00
|
|
|
const C2F& c2f,
|
2014-02-25 10:52:51 -06:00
|
|
|
const int* cart_dims,
|
2015-01-12 05:13:53 -06:00
|
|
|
FC begin_face_centroids,
|
2014-02-25 10:52:51 -06:00
|
|
|
int dimensions,
|
2015-09-15 03:44:07 -05:00
|
|
|
std::vector<double>& dz,
|
2014-02-25 10:52:51 -06:00
|
|
|
std::vector<std::string>& well_names,
|
|
|
|
std::vector<WellData>& well_data,
|
|
|
|
std::map<std::string, int>& well_names_to_index,
|
|
|
|
const PhaseUsage& phaseUsage,
|
2014-08-29 05:13:38 -05:00
|
|
|
const std::map<int,int>& cartesian_to_compressed,
|
2014-08-29 09:57:10 -05:00
|
|
|
const double* permeability,
|
2015-05-26 13:45:08 -05:00
|
|
|
const NTG& ntg,
|
2016-06-24 09:01:12 -05:00
|
|
|
std::vector<int>& wells_on_proc,
|
2016-09-12 05:03:39 -05:00
|
|
|
const std::unordered_set<std::string>& ignored_wells,
|
2016-06-24 09:01:12 -05:00
|
|
|
const DynamicListEconLimited& list_econ_limited)
|
2014-02-25 10:52:51 -06:00
|
|
|
{
|
2014-08-29 05:18:59 -05:00
|
|
|
if (dimensions != 3) {
|
|
|
|
OPM_THROW(std::domain_error,
|
|
|
|
"WellsManager::createWellsFromSpecs() only "
|
|
|
|
"supported in three space dimensions");
|
|
|
|
}
|
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
std::vector<std::vector<PerfData> > wellperf_data;
|
|
|
|
wellperf_data.resize(wells.size());
|
2015-05-26 13:45:08 -05:00
|
|
|
wells_on_proc.resize(wells.size(), 1);
|
2014-02-25 10:52:51 -06:00
|
|
|
|
2015-10-28 07:09:12 -05:00
|
|
|
// The well index on the current process.
|
|
|
|
// Note that some wells are deactivated as they live on the interior
|
|
|
|
// domain of another proccess. Therefore this might different from
|
|
|
|
// the index of the well according to the eclipse state
|
2016-09-08 14:18:53 -05:00
|
|
|
int active_well_index = 0;
|
2014-02-25 10:52:51 -06:00
|
|
|
for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) {
|
2016-06-16 02:33:43 -05:00
|
|
|
const auto* well = (*wellIter);
|
2014-10-22 05:20:16 -05:00
|
|
|
|
2016-09-12 05:02:20 -05:00
|
|
|
if (well->getStatus(timeStep) == WellCommon::SHUT) {
|
2016-09-08 14:18:53 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-09-12 05:02:20 -05:00
|
|
|
if ( ignored_wells.find(well->name()) != ignored_wells.end() ) {
|
|
|
|
wells_on_proc[ wellIter - wells.begin() ] = 0;
|
2014-10-22 05:20:16 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-06-30 09:20:38 -05:00
|
|
|
if (list_econ_limited.wellShutEconLimited(well->name())) {
|
2016-06-24 09:01:12 -05:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-06-28 08:12:24 -05:00
|
|
|
std::vector<int> cells_connection_closed;
|
2016-06-30 09:20:38 -05:00
|
|
|
if (list_econ_limited.anyConnectionClosedForWell(well->name())) {
|
2016-06-28 08:12:24 -05:00
|
|
|
cells_connection_closed = list_econ_limited.getClosedConnectionsForWell(well->name());
|
|
|
|
}
|
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
{ // COMPDAT handling
|
2015-09-07 09:55:08 -05:00
|
|
|
// shut completions and open ones stored in this process will have 1 others 0.
|
2016-09-08 14:18:53 -05:00
|
|
|
|
2016-10-13 09:03:35 -05:00
|
|
|
for(const auto& completion : well->getCompletions(timeStep)) {
|
|
|
|
if (completion.getState() == WellCompletion::OPEN) {
|
|
|
|
int i = completion.getI();
|
|
|
|
int j = completion.getJ();
|
|
|
|
int k = completion.getK();
|
2015-01-12 05:20:33 -06:00
|
|
|
|
|
|
|
const int* cpgdim = cart_dims;
|
|
|
|
int cart_grid_indx = i + cpgdim[0]*(j + cpgdim[1]*k);
|
|
|
|
std::map<int, int>::const_iterator cgit = cartesian_to_compressed.find(cart_grid_indx);
|
|
|
|
if (cgit == cartesian_to_compressed.end()) {
|
2016-09-08 14:18:53 -05:00
|
|
|
OPM_MESSAGE("****Warning: Cell with i,j,k indices " << i << ' ' << j << ' '
|
|
|
|
<< k << " not found in grid. The completion will be igored (well = "
|
|
|
|
<< well->name() << ')');
|
2015-01-12 05:20:33 -06:00
|
|
|
}
|
2015-05-12 08:30:20 -05:00
|
|
|
else
|
2015-02-03 06:10:38 -06:00
|
|
|
{
|
2015-05-12 08:30:20 -05:00
|
|
|
int cell = cgit->second;
|
2016-06-28 08:12:24 -05:00
|
|
|
// check if the connection is closed due to economic limits
|
|
|
|
if (!cells_connection_closed.empty()) {
|
2016-06-30 09:20:38 -05:00
|
|
|
const bool connection_found = std::find(cells_connection_closed.begin(),
|
|
|
|
cells_connection_closed.end(), cell)
|
2016-06-28 08:12:24 -05:00
|
|
|
!= cells_connection_closed.end();
|
|
|
|
if (connection_found) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-12 08:30:20 -05:00
|
|
|
PerfData pd;
|
|
|
|
pd.cell = cell;
|
|
|
|
{
|
2016-10-13 09:03:35 -05:00
|
|
|
const Value<double>& transmissibilityFactor = completion.getConnectionTransmissibilityFactorAsValueObject();
|
|
|
|
const double wellPi = completion.getWellPi();
|
2015-05-12 08:30:20 -05:00
|
|
|
if (transmissibilityFactor.hasValue()) {
|
|
|
|
pd.well_index = transmissibilityFactor.getValue();
|
|
|
|
} else {
|
2016-10-13 09:03:35 -05:00
|
|
|
double radius = 0.5*completion.getDiameter();
|
2015-05-12 08:30:20 -05:00
|
|
|
if (radius <= 0.0) {
|
|
|
|
radius = 0.5*unit::feet;
|
|
|
|
OPM_MESSAGE("**** Warning: Well bore internal radius set to " << radius);
|
|
|
|
}
|
|
|
|
|
2015-09-15 03:44:07 -05:00
|
|
|
std::array<double, 3> cubical =
|
2015-05-12 08:30:20 -05:00
|
|
|
WellsManagerDetail::getCubeDim<3>(c2f, begin_face_centroids, cell);
|
|
|
|
|
2015-09-15 03:44:07 -05:00
|
|
|
// overwrite dz values calculated in getCubeDim.
|
|
|
|
if (dz.size() > 0) {
|
|
|
|
cubical[2] = dz[cell];
|
|
|
|
}
|
|
|
|
|
2015-05-12 08:30:20 -05:00
|
|
|
const double* cell_perm = &permeability[dimensions*dimensions*cell];
|
|
|
|
pd.well_index =
|
|
|
|
WellsManagerDetail::computeWellIndex(radius, cubical, cell_perm,
|
2016-10-13 09:03:35 -05:00
|
|
|
completion.getSkinFactor(),
|
|
|
|
completion.getDirection(),
|
2015-05-12 08:30:20 -05:00
|
|
|
ntg[cell]);
|
2015-02-03 06:10:38 -06:00
|
|
|
}
|
2015-06-02 06:24:37 -05:00
|
|
|
pd.well_index *= wellPi;
|
2015-01-12 05:20:33 -06:00
|
|
|
}
|
2016-09-08 14:18:53 -05:00
|
|
|
wellperf_data[active_well_index].push_back(pd);
|
2015-01-12 05:20:33 -06:00
|
|
|
}
|
2014-02-25 10:52:51 -06:00
|
|
|
} else {
|
2016-10-13 09:03:35 -05:00
|
|
|
if (completion.getState() != WellCompletion::SHUT) {
|
|
|
|
OPM_THROW(std::runtime_error, "Completion state: " << WellCompletion::StateEnum2String( completion.getState() ) << " not handled");
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-05-08 09:29:05 -05:00
|
|
|
{ // WELSPECS handling
|
2016-09-08 14:18:53 -05:00
|
|
|
well_names_to_index[well->name()] = active_well_index;
|
2015-05-08 09:29:05 -05:00
|
|
|
well_names.push_back(well->name());
|
|
|
|
{
|
|
|
|
WellData wd;
|
|
|
|
wd.reference_bhp_depth = well->getRefDepth();
|
|
|
|
wd.welspecsline = -1;
|
|
|
|
if (well->isInjector( timeStep ))
|
|
|
|
wd.type = INJECTOR;
|
|
|
|
else
|
|
|
|
wd.type = PRODUCER;
|
2015-10-06 08:54:20 -05:00
|
|
|
|
2015-10-07 05:50:00 -05:00
|
|
|
wd.allowCrossFlow = well->getAllowCrossFlow();
|
2015-05-08 09:29:05 -05:00
|
|
|
well_data.push_back(wd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-09-08 14:18:53 -05:00
|
|
|
active_well_index++;
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
|
|
|
// Set up reference depths that were defaulted. Count perfs.
|
|
|
|
|
|
|
|
const int num_wells = well_data.size();
|
|
|
|
|
|
|
|
int num_perfs = 0;
|
2014-08-29 05:22:26 -05:00
|
|
|
assert (dimensions == 3);
|
2014-02-25 10:52:51 -06:00
|
|
|
for (int w = 0; w < num_wells; ++w) {
|
|
|
|
num_perfs += wellperf_data[w].size();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the well data structures.
|
|
|
|
w_ = create_wells(phaseUsage.num_phases, num_wells, num_perfs);
|
|
|
|
if (!w_) {
|
|
|
|
OPM_THROW(std::runtime_error, "Failed creating Wells struct.");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add wells.
|
|
|
|
for (int w = 0; w < num_wells; ++w) {
|
2014-08-29 05:22:26 -05:00
|
|
|
const int w_num_perf = wellperf_data[w].size();
|
|
|
|
std::vector<int> perf_cells (w_num_perf);
|
2014-02-25 10:52:51 -06:00
|
|
|
std::vector<double> perf_prodind(w_num_perf);
|
2014-08-29 05:22:26 -05:00
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
for (int perf = 0; perf < w_num_perf; ++perf) {
|
2014-08-29 05:22:26 -05:00
|
|
|
perf_cells [perf] = wellperf_data[w][perf].cell;
|
2014-02-25 10:52:51 -06:00
|
|
|
perf_prodind[perf] = wellperf_data[w][perf].well_index;
|
|
|
|
}
|
2014-08-29 05:22:26 -05:00
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
const double* comp_frac = NULL;
|
2014-08-29 05:22:26 -05:00
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
// We initialize all wells with a null component fraction,
|
|
|
|
// and must (for injection wells) overwrite it later.
|
2014-08-29 05:22:26 -05:00
|
|
|
const int ok =
|
|
|
|
add_well(well_data[w].type,
|
|
|
|
well_data[w].reference_bhp_depth,
|
|
|
|
w_num_perf,
|
|
|
|
comp_frac,
|
2015-09-23 02:25:48 -05:00
|
|
|
perf_cells.data(),
|
|
|
|
perf_prodind.data(),
|
2014-08-29 05:22:26 -05:00
|
|
|
well_names[w].c_str(),
|
2015-10-06 08:54:20 -05:00
|
|
|
well_data[w].allowCrossFlow,
|
2014-08-29 05:22:26 -05:00
|
|
|
w_);
|
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
if (!ok) {
|
2014-08-29 05:22:26 -05:00
|
|
|
OPM_THROW(std::runtime_error,
|
|
|
|
"Failed adding well "
|
|
|
|
<< well_names[w]
|
|
|
|
<< " to Wells data structure.");
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-17 06:56:02 -06:00
|
|
|
template <class C2F, class FC>
|
2014-08-29 05:22:26 -05:00
|
|
|
WellsManager::
|
2016-10-13 09:03:35 -05:00
|
|
|
WellsManager(const Opm::EclipseState& eclipseState,
|
2014-08-29 05:22:26 -05:00
|
|
|
const size_t timeStep,
|
|
|
|
int number_of_cells,
|
|
|
|
const int* global_cell,
|
|
|
|
const int* cart_dims,
|
|
|
|
int dimensions,
|
|
|
|
const C2F& cell_to_faces,
|
|
|
|
FC begin_face_centroids,
|
2015-05-08 09:29:05 -05:00
|
|
|
const double* permeability,
|
2016-06-24 09:01:12 -05:00
|
|
|
const DynamicListEconLimited& list_econ_limited,
|
2016-04-01 07:08:48 -05:00
|
|
|
bool is_parallel_run,
|
2016-09-08 14:18:53 -05:00
|
|
|
const std::vector<double>& well_potentials,
|
2016-09-12 05:03:39 -05:00
|
|
|
const std::unordered_set<std::string>& deactivated_wells)
|
2015-05-08 09:29:05 -05:00
|
|
|
: w_(0), is_parallel_run_(is_parallel_run)
|
2014-02-25 10:52:51 -06:00
|
|
|
{
|
2014-08-29 05:22:26 -05:00
|
|
|
init(eclipseState, timeStep, number_of_cells, global_cell,
|
2015-02-17 06:56:02 -06:00
|
|
|
cart_dims, dimensions,
|
2016-09-08 14:18:53 -05:00
|
|
|
cell_to_faces, begin_face_centroids, permeability, list_econ_limited, well_potentials, deactivated_wells);
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
|
|
|
|
2014-03-27 09:27:11 -05:00
|
|
|
/// Construct wells from deck.
|
2015-02-17 03:28:11 -06:00
|
|
|
template <class C2F, class FC>
|
2014-08-29 05:22:26 -05:00
|
|
|
void
|
2016-10-13 09:03:35 -05:00
|
|
|
WellsManager::init(const Opm::EclipseState& eclipseState,
|
2014-08-29 05:22:26 -05:00
|
|
|
const size_t timeStep,
|
|
|
|
int number_of_cells,
|
|
|
|
const int* global_cell,
|
|
|
|
const int* cart_dims,
|
|
|
|
int dimensions,
|
|
|
|
const C2F& cell_to_faces,
|
|
|
|
FC begin_face_centroids,
|
2016-04-01 07:08:48 -05:00
|
|
|
const double* permeability,
|
2016-06-24 09:01:12 -05:00
|
|
|
const DynamicListEconLimited& list_econ_limited,
|
2016-09-08 14:18:53 -05:00
|
|
|
const std::vector<double>& well_potentials,
|
2016-09-12 05:03:39 -05:00
|
|
|
const std::unordered_set<std::string>& deactivated_wells)
|
2014-02-25 10:52:51 -06:00
|
|
|
{
|
|
|
|
if (dimensions != 3) {
|
2014-08-29 05:22:26 -05:00
|
|
|
OPM_THROW(std::runtime_error,
|
|
|
|
"We cannot initialize wells from a deck unless "
|
|
|
|
"the corresponding grid is 3-dimensional.");
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
2014-03-27 09:27:11 -05:00
|
|
|
|
2016-10-13 09:03:35 -05:00
|
|
|
if (eclipseState.getSchedule().numWells() == 0) {
|
2014-08-29 05:22:26 -05:00
|
|
|
OPM_MESSAGE("No wells specified in Schedule section, "
|
|
|
|
"initializing no wells");
|
2014-02-25 10:52:51 -06:00
|
|
|
return;
|
|
|
|
}
|
2014-03-27 09:27:11 -05:00
|
|
|
|
|
|
|
std::map<int,int> cartesian_to_compressed;
|
2014-08-29 05:22:26 -05:00
|
|
|
setupCompressedToCartesian(global_cell, number_of_cells,
|
|
|
|
cartesian_to_compressed);
|
2014-02-25 10:52:51 -06:00
|
|
|
|
|
|
|
// Obtain phase usage data.
|
2014-03-27 09:27:11 -05:00
|
|
|
PhaseUsage pu = phaseUsageFromDeck(eclipseState);
|
2014-02-25 10:52:51 -06:00
|
|
|
|
|
|
|
// These data structures will be filled in this constructor,
|
|
|
|
// then used to initialize the Wells struct.
|
|
|
|
std::vector<std::string> well_names;
|
|
|
|
std::vector<WellData> well_data;
|
2014-03-27 09:27:11 -05:00
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
|
|
|
|
// For easy lookup:
|
|
|
|
std::map<std::string, int> well_names_to_index;
|
|
|
|
|
2016-10-13 09:03:35 -05:00
|
|
|
const auto& schedule = eclipseState.getSchedule();
|
|
|
|
auto wells = schedule.getWells(timeStep);
|
2016-06-16 02:33:43 -05:00
|
|
|
std::vector<int> wells_on_proc;
|
2014-02-25 10:52:51 -06:00
|
|
|
|
2014-03-27 09:27:11 -05:00
|
|
|
well_names.reserve(wells.size());
|
|
|
|
well_data.reserve(wells.size());
|
2014-02-25 10:52:51 -06:00
|
|
|
|
2014-08-29 09:57:10 -05:00
|
|
|
typedef GridPropertyAccess::ArrayPolicy::ExtractFromDeck<double> DoubleArray;
|
|
|
|
typedef GridPropertyAccess::Compressed<DoubleArray, GridPropertyAccess::Tag::NTG> NTGArray;
|
|
|
|
|
|
|
|
DoubleArray ntg_glob(eclipseState, "NTG", 1.0);
|
|
|
|
NTGArray ntg(ntg_glob, global_cell);
|
|
|
|
|
2016-10-13 09:03:35 -05:00
|
|
|
const auto& eclGrid = eclipseState.getInputGrid();
|
2015-09-15 03:44:07 -05:00
|
|
|
|
|
|
|
// use cell thickness (dz) from eclGrid
|
|
|
|
// dz overwrites values calculated by WellDetails::getCubeDim
|
|
|
|
std::vector<double> dz(number_of_cells);
|
2015-09-15 07:23:10 -05:00
|
|
|
{
|
|
|
|
std::vector<int> gc = compressedToCartesian(number_of_cells, global_cell);
|
|
|
|
for (int cell = 0; cell < number_of_cells; ++cell) {
|
2016-10-13 09:03:35 -05:00
|
|
|
dz[cell] = eclGrid.getCellThicknes(gc[cell]);
|
2015-09-15 07:23:10 -05:00
|
|
|
}
|
2015-09-15 03:44:07 -05:00
|
|
|
}
|
|
|
|
|
2014-03-27 09:27:11 -05:00
|
|
|
createWellsFromSpecs(wells, timeStep, cell_to_faces,
|
|
|
|
cart_dims,
|
|
|
|
begin_face_centroids,
|
|
|
|
dimensions,
|
2015-09-15 03:44:07 -05:00
|
|
|
dz,
|
2014-08-29 05:22:26 -05:00
|
|
|
well_names, well_data, well_names_to_index,
|
2015-05-26 13:45:08 -05:00
|
|
|
pu, cartesian_to_compressed, permeability, ntg,
|
2016-09-08 14:18:53 -05:00
|
|
|
wells_on_proc, deactivated_wells, list_econ_limited);
|
2014-08-29 05:22:26 -05:00
|
|
|
|
2016-06-28 02:08:37 -05:00
|
|
|
setupWellControls(wells, timeStep, well_names, pu, wells_on_proc, list_econ_limited);
|
2014-02-25 10:52:51 -06:00
|
|
|
|
2014-03-27 09:27:11 -05:00
|
|
|
{
|
2016-10-13 09:03:35 -05:00
|
|
|
const auto& fieldNode =
|
|
|
|
schedule.getGroupTree(timeStep).getNode("FIELD");
|
2014-08-29 05:22:26 -05:00
|
|
|
|
2016-10-13 09:03:35 -05:00
|
|
|
const auto& fieldGroup = schedule.getGroup(fieldNode->name());
|
2014-08-29 05:22:26 -05:00
|
|
|
|
2016-10-21 10:39:31 -05:00
|
|
|
well_collection_.setHavingVREPGroups(false);
|
2014-03-27 09:27:11 -05:00
|
|
|
well_collection_.addField(fieldGroup, timeStep, pu);
|
2016-10-13 09:03:35 -05:00
|
|
|
addChildGroups(*fieldNode, schedule, timeStep, pu);
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
|
|
|
|
2014-08-29 05:22:26 -05:00
|
|
|
for (auto w = wells.begin(), e = wells.end(); w != e; ++w) {
|
|
|
|
well_collection_.addWell(*w, timeStep, pu);
|
2014-02-25 10:52:51 -06:00
|
|
|
}
|
|
|
|
|
2014-03-27 09:27:11 -05:00
|
|
|
well_collection_.setWellsPointer(w_);
|
2014-02-25 10:52:51 -06:00
|
|
|
|
2016-04-01 07:08:48 -05:00
|
|
|
setupGuideRates(wells, timeStep, well_data, well_names_to_index, pu, well_potentials);
|
2014-02-25 10:52:51 -06:00
|
|
|
|
2016-03-31 02:31:05 -05:00
|
|
|
well_collection_.applyGroupControls();
|
|
|
|
|
2014-02-25 10:52:51 -06:00
|
|
|
// Debug output.
|
|
|
|
#define EXTRA_OUTPUT
|
|
|
|
#ifdef EXTRA_OUTPUT
|
|
|
|
/*
|
|
|
|
std::cout << "\t WELL DATA" << std::endl;
|
|
|
|
for(int i = 0; i< num_wells; ++i) {
|
|
|
|
std::cout << i << ": " << well_data[i].type << " "
|
|
|
|
<< well_data[i].control << " " << well_data[i].target
|
|
|
|
<< std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::cout << "\n\t PERF DATA" << std::endl;
|
|
|
|
for(int i=0; i< int(wellperf_data.size()); ++i) {
|
|
|
|
for(int j=0; j< int(wellperf_data[i].size()); ++j) {
|
|
|
|
std::cout << i << ": " << wellperf_data[i][j].cell << " "
|
|
|
|
<< wellperf_data[i][j].well_index << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace Opm
|