mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move checkMaxRatioLimitCompletions to WellTest
This commit is contained in:
parent
d56eb16837
commit
37f51420f6
@ -103,7 +103,6 @@ public:
|
||||
using WellInterfaceFluidSystem<FluidSystem>::Gas;
|
||||
using WellInterfaceFluidSystem<FluidSystem>::Oil;
|
||||
using WellInterfaceFluidSystem<FluidSystem>::Water;
|
||||
using RatioLimitCheckReport = typename WellInterfaceFluidSystem<FluidSystem>::RatioLimitCheckReport;
|
||||
|
||||
static constexpr bool has_solvent = getPropValue<TypeTag, Properties::EnableSolvent>();
|
||||
static constexpr bool has_zFraction = getPropValue<TypeTag, Properties::EnableExtbo>();
|
||||
|
@ -585,7 +585,8 @@ checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
|
||||
if (watercut_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
checkMaxRatioLimitCompletions(ws, max_water_cut_limit, waterCut, report);
|
||||
WellTest(*this).checkMaxRatioLimitCompletions(ws, max_water_cut_limit,
|
||||
waterCut, report);
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,7 +620,7 @@ checkMaxGORLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
|
||||
if (gor_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
checkMaxRatioLimitCompletions(ws, max_gor_limit, gor, report);
|
||||
WellTest(*this).checkMaxRatioLimitCompletions(ws, max_gor_limit, gor, report);
|
||||
}
|
||||
}
|
||||
|
||||
@ -654,7 +655,7 @@ checkMaxWGRLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
|
||||
if (wgr_limit_violated) {
|
||||
report.ratio_limit_violated = true;
|
||||
checkMaxRatioLimitCompletions(ws, max_wgr_limit, wgr, report);
|
||||
WellTest(*this).checkMaxRatioLimitCompletions(ws, max_wgr_limit, wgr, report);
|
||||
}
|
||||
}
|
||||
|
||||
@ -877,53 +878,6 @@ updateWellTestState(const SingleWellState& ws,
|
||||
// TODO: well can be shut/closed due to other reasons
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
template <typename RatioFunc>
|
||||
void WellInterfaceFluidSystem<FluidSystem>::
|
||||
checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
int worst_offending_completion = INVALIDCOMPLETION;
|
||||
|
||||
// the maximum water cut value of the completions
|
||||
// it is used to identify the most offending completion
|
||||
double max_ratio_completion = 0;
|
||||
const int np = number_of_phases_;
|
||||
|
||||
const auto& perf_data = ws.perf_data;
|
||||
const auto& perf_phase_rates = perf_data.phase_rates;
|
||||
// look for the worst_offending_completion
|
||||
for (const auto& completion : completions_) {
|
||||
std::vector<double> completion_rates(np, 0.0);
|
||||
|
||||
// looping through the connections associated with the completion
|
||||
const std::vector<int>& conns = completion.second;
|
||||
for (const int c : conns) {
|
||||
for (int p = 0; p < np; ++p) {
|
||||
const double connection_rate = perf_phase_rates[c * np + p];
|
||||
completion_rates[p] += connection_rate;
|
||||
}
|
||||
} // end of for (const int c : conns)
|
||||
|
||||
parallel_well_info_.communication().sum(completion_rates.data(), completion_rates.size());
|
||||
const double ratio_completion = ratioFunc(completion_rates, phaseUsage());
|
||||
|
||||
if (ratio_completion > max_ratio_completion) {
|
||||
worst_offending_completion = completion.first;
|
||||
max_ratio_completion = ratio_completion;
|
||||
}
|
||||
} // end of for (const auto& completion : completions_)
|
||||
|
||||
const double violation_extent = max_ratio_completion / max_ratio_limit;
|
||||
|
||||
if (violation_extent > report.violation_extent) {
|
||||
report.worst_offending_completion = worst_offending_completion;
|
||||
report.violation_extent = violation_extent;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FluidSystem>
|
||||
int
|
||||
WellInterfaceFluidSystem<FluidSystem>::
|
||||
|
@ -39,8 +39,9 @@ namespace RateConverter
|
||||
class Group;
|
||||
class GroupState;
|
||||
class Schedule;
|
||||
class WellState;
|
||||
struct RatioLimitCheckReport;
|
||||
class SingleWellState;
|
||||
class WellState;
|
||||
|
||||
template<class FluidSystem>
|
||||
class WellInterfaceFluidSystem : public WellInterfaceGeneric {
|
||||
@ -126,12 +127,6 @@ protected:
|
||||
const double* rates_or_potentials,
|
||||
Opm::DeferredLogger& deferred_logger) const;
|
||||
|
||||
struct RatioLimitCheckReport{
|
||||
bool ratio_limit_violated = false;
|
||||
int worst_offending_completion = INVALIDCOMPLETION;
|
||||
double violation_extent = 0.0;
|
||||
};
|
||||
|
||||
void checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||
const SingleWellState& ws,
|
||||
RatioLimitCheckReport& report) const;
|
||||
@ -175,13 +170,6 @@ protected:
|
||||
|
||||
// For the conversion between the surface volume rate and reservoir voidage rate
|
||||
const RateConverterType& rateConverter_;
|
||||
|
||||
private:
|
||||
template <typename RatioFunc>
|
||||
void checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -43,4 +43,48 @@ bool WellTest::checkMaxRatioLimitWell(const SingleWellState& ws,
|
||||
return (well_ratio > max_ratio_limit);
|
||||
}
|
||||
|
||||
void WellTest::checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const
|
||||
{
|
||||
int worst_offending_completion = RatioLimitCheckReport::INVALIDCOMPLETION;
|
||||
|
||||
// the maximum water cut value of the completions
|
||||
// it is used to identify the most offending completion
|
||||
double max_ratio_completion = 0;
|
||||
const int np = well_.numPhases();
|
||||
|
||||
const auto& perf_data = ws.perf_data;
|
||||
const auto& perf_phase_rates = perf_data.phase_rates;
|
||||
// look for the worst_offending_completion
|
||||
for (const auto& completion : well_.getCompletions()) {
|
||||
std::vector<double> completion_rates(np, 0.0);
|
||||
|
||||
// looping through the connections associated with the completion
|
||||
const std::vector<int>& conns = completion.second;
|
||||
for (const int c : conns) {
|
||||
for (int p = 0; p < np; ++p) {
|
||||
const double connection_rate = perf_phase_rates[c * np + p];
|
||||
completion_rates[p] += connection_rate;
|
||||
}
|
||||
} // end of for (const int c : conns)
|
||||
|
||||
well_.parallelWellInfo().communication().sum(completion_rates.data(), completion_rates.size());
|
||||
const double ratio_completion = ratioFunc(completion_rates, well_.phaseUsage());
|
||||
|
||||
if (ratio_completion > max_ratio_completion) {
|
||||
worst_offending_completion = completion.first;
|
||||
max_ratio_completion = ratio_completion;
|
||||
}
|
||||
} // end of for (const auto& completion : completions_)
|
||||
|
||||
const double violation_extent = max_ratio_completion / max_ratio_limit;
|
||||
|
||||
if (violation_extent > report.violation_extent) {
|
||||
report.worst_offending_completion = worst_offending_completion;
|
||||
report.violation_extent = violation_extent;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define OPM_WELL_TEST_HEADER_INCLUDED
|
||||
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
namespace Opm
|
||||
@ -34,6 +35,13 @@ class PhaseUsage;
|
||||
class SingleWellState;
|
||||
class WellInterfaceGeneric;
|
||||
|
||||
struct RatioLimitCheckReport {
|
||||
static constexpr int INVALIDCOMPLETION = std::numeric_limits<int>::max();
|
||||
bool ratio_limit_violated = false;
|
||||
int worst_offending_completion = INVALIDCOMPLETION;
|
||||
double violation_extent = 0.0;
|
||||
};
|
||||
|
||||
//! \brief Class for performing well tests.
|
||||
class WellTest {
|
||||
public:
|
||||
@ -47,6 +55,10 @@ public:
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc) const;
|
||||
|
||||
void checkMaxRatioLimitCompletions(const SingleWellState& ws,
|
||||
const double max_ratio_limit,
|
||||
const RatioFunc& ratioFunc,
|
||||
RatioLimitCheckReport& report) const;
|
||||
private:
|
||||
const WellInterfaceGeneric& well_; //!< Reference to well interface
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user