2020-05-20 04:27:28 -05:00
|
|
|
/*
|
|
|
|
Copyright 2020 Equinor.
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2021-12-14 01:30:15 -06:00
|
|
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
|
|
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
|
|
|
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
|
|
|
#include <opm/input/eclipse/Schedule/SummaryState.hpp>
|
|
|
|
#include <opm/input/eclipse/Deck/Deck.hpp>
|
|
|
|
#include <opm/input/eclipse/Python/Python.hpp>
|
|
|
|
#include <opm/input/eclipse/Units/Units.hpp>
|
2020-05-20 04:27:28 -05:00
|
|
|
#include <opm/simulators/wells/VFPProperties.hpp>
|
|
|
|
#include <opm/simulators/wells/VFPInjProperties.hpp>
|
|
|
|
#include <opm/simulators/wells/VFPProdProperties.hpp>
|
2022-03-11 04:03:34 -06:00
|
|
|
#include <opm/simulators/wells/WellState.hpp>
|
2021-02-25 13:46:51 -06:00
|
|
|
#include <opm/common/utility/TimeService.hpp>
|
2020-05-20 04:27:28 -05:00
|
|
|
|
2021-05-28 06:29:59 -05:00
|
|
|
#include <opm/simulators/wells/VFPHelpers.hpp>
|
2022-04-08 03:15:13 -05:00
|
|
|
#include <opm/core/props/phaseUsageFromDeck.hpp>
|
2021-05-28 06:29:59 -05:00
|
|
|
|
2020-05-20 04:27:28 -05:00
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
using namespace Opm;
|
|
|
|
|
|
|
|
struct Setup
|
|
|
|
{
|
|
|
|
std::unique_ptr<const EclipseState> ecl_state;
|
|
|
|
std::shared_ptr<Python> python;
|
|
|
|
std::unique_ptr<const Schedule> schedule;
|
|
|
|
std::unique_ptr<SummaryState> summary_state;
|
2021-01-14 12:22:34 -06:00
|
|
|
std::unique_ptr<VFPProperties> vfp_properties;
|
2020-05-20 04:27:28 -05:00
|
|
|
|
|
|
|
Setup(const std::string& file)
|
|
|
|
{
|
|
|
|
Parser parser;
|
|
|
|
auto deck = parser.parseFile(file);
|
|
|
|
ecl_state.reset(new EclipseState(deck) );
|
2022-04-08 03:15:13 -05:00
|
|
|
|
|
|
|
const TableManager table( deck );
|
|
|
|
const Runspec runspec(deck);
|
|
|
|
python = std::make_shared<Python>();
|
|
|
|
schedule.reset( new Schedule(deck, *ecl_state, python));
|
|
|
|
summary_state.reset( new SummaryState(TimeService::from_time_t(schedule->getStartTime())));
|
|
|
|
|
2020-05-20 04:27:28 -05:00
|
|
|
const int step = 0;
|
2021-01-14 12:22:34 -06:00
|
|
|
const auto& sched_state = schedule->operator[](step);
|
2022-04-08 03:15:13 -05:00
|
|
|
WellState well_state(phaseUsage(runspec.phases()));
|
|
|
|
vfp_properties = std::make_unique<VFPProperties>(sched_state.vfpinj(), sched_state.vfpprod(), well_state);
|
2020-05-20 04:27:28 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double computeBhp(const VFPProdTable& table,
|
|
|
|
const double flo,
|
|
|
|
const double thp,
|
|
|
|
const double wfr,
|
|
|
|
const double gfr,
|
|
|
|
const double alq)
|
|
|
|
{
|
|
|
|
|
|
|
|
// First, find the values to interpolate between.
|
|
|
|
// Assuming positive flo here!
|
|
|
|
assert(flo > 0.0);
|
|
|
|
auto flo_i = detail::findInterpData(flo, table.getFloAxis());
|
|
|
|
auto thp_i = detail::findInterpData(thp, table.getTHPAxis()); // assume constant
|
|
|
|
auto wfr_i = detail::findInterpData(wfr, table.getWFRAxis());
|
|
|
|
auto gfr_i = detail::findInterpData(gfr, table.getGFRAxis());
|
|
|
|
auto alq_i = detail::findInterpData(alq, table.getALQAxis()); //assume constant
|
|
|
|
|
|
|
|
return detail::interpolate(table, flo_i, thp_i, wfr_i, gfr_i, alq_i).value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
if (argc < 2) {
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
Setup setup(argv[1]);
|
|
|
|
|
2020-05-15 04:21:32 -05:00
|
|
|
// const int table_id = 1;
|
2020-05-20 04:27:28 -05:00
|
|
|
const int table_id = 4;
|
|
|
|
const double wct = 0.0;
|
2020-05-15 04:21:32 -05:00
|
|
|
// const double gor = 35.2743;
|
|
|
|
const double gor = 0.0;
|
2020-05-20 04:27:28 -05:00
|
|
|
const double alq = 0.0;
|
|
|
|
const int n = 51;
|
|
|
|
const double m3pd = unit::cubic(unit::meter)/unit::day;
|
|
|
|
const double rate_min = 20.0 * m3pd;
|
|
|
|
const double rate_max = 2000.0 * m3pd;
|
|
|
|
// const double thp = 32.1744 * unit::barsa;
|
|
|
|
// const double thp = 10.0 * unit::barsa;
|
|
|
|
const double thp_min = 10.0 * unit::barsa;
|
|
|
|
const double thp_max = 35.0 * unit::barsa;
|
|
|
|
std::vector<double> rates(n);
|
|
|
|
std::vector<double> thps(n);
|
|
|
|
for (int ii = 0; ii < n; ++ii) {
|
|
|
|
const double q = double(ii) / double(n-1);
|
|
|
|
rates[ii] = (1.0 - q) * rate_min + q * rate_max;
|
|
|
|
thps[ii] = (1.0 - q) * thp_min + q * thp_max;
|
|
|
|
}
|
|
|
|
|
2021-01-25 03:08:31 -06:00
|
|
|
const VFPProdTable& table = setup.vfp_properties->getProd()->getTable(table_id);
|
2020-05-20 04:27:28 -05:00
|
|
|
std::cout.precision(12);
|
|
|
|
for (double rate : rates) {
|
|
|
|
for (double thp : thps) {
|
|
|
|
const double bhp = computeBhp(table, rate, thp, wct, gor, alq);
|
|
|
|
std::cout //<< std::setw(18) << unit::convert::to(rate, m3pd)
|
|
|
|
//<< std::setw(18) << unit::convert::to(thp, unit::barsa)
|
|
|
|
<< std::setw(18) << unit::convert::to(bhp, unit::barsa) << '\n';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|