mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-28 16:04:23 -06:00
Add support for FIP*
This commit is contained in:
parent
ceb8d996aa
commit
f2ea6ce844
@ -348,7 +348,7 @@ namespace Opm {
|
||||
bool alternative_well_rate_init_{};
|
||||
|
||||
std::unique_ptr<RateConverterType> rateConverter_{};
|
||||
std::unique_ptr<AverageRegionalPressureType> regionalAveragePressureCalculator_{};
|
||||
std::map<std::string, std::unique_ptr<AverageRegionalPressureType>> regionalAveragePressureCalculator_{};
|
||||
|
||||
|
||||
SimulatorReportSingle last_report_{};
|
||||
|
@ -220,9 +220,8 @@ namespace Opm {
|
||||
|
||||
// Compute regional average pressures used by gpmaint
|
||||
if (schedule_[timeStepIdx].has_gpmaint()) {
|
||||
const auto& fp = this->eclState_.fieldProps();
|
||||
const auto& fipnum = fp.get_int("FIPNUM");
|
||||
regionalAveragePressureCalculator_.reset(new AverageRegionalPressureType (phase_usage_,fipnum));
|
||||
WellGroupHelpers::setRegionAveragePressureCalculator(fieldGroup, schedule(),
|
||||
timeStepIdx, this->eclState_.fieldProps(), phase_usage_, regionalAveragePressureCalculator_);
|
||||
}
|
||||
|
||||
{
|
||||
@ -342,10 +341,12 @@ namespace Opm {
|
||||
auto exc_type = ExceptionType::NONE;
|
||||
// update gpmaint targets
|
||||
if (schedule_[reportStepIdx].has_gpmaint()) {
|
||||
regionalAveragePressureCalculator_->template defineState<ElementContext>(ebosSimulator_);
|
||||
for (auto& calculator : regionalAveragePressureCalculator_) {
|
||||
calculator.second->template defineState<ElementContext>(ebosSimulator_);
|
||||
}
|
||||
const double dt = ebosSimulator_.timeStepSize();
|
||||
WellGroupHelpers::updateGpMaintTargetForGroups(fieldGroup,
|
||||
schedule_, *regionalAveragePressureCalculator_, reportStepIdx, dt, this->wellState(), this->groupState());
|
||||
schedule_, regionalAveragePressureCalculator_, reportStepIdx, dt, this->wellState(), this->groupState());
|
||||
}
|
||||
try {
|
||||
// Compute initial well solution for new wells and injectors that change injection type i.e. WAG.
|
||||
|
@ -687,7 +687,7 @@ namespace WellGroupHelpers
|
||||
return;
|
||||
|
||||
const auto [name, number] = *region;
|
||||
const double error = gpm->pressure_target() - regional_values.pressure(number);
|
||||
const double error = gpm->pressure_target() - regional_values.at(name)->pressure(number);
|
||||
double current_rate = 0.0;
|
||||
const auto& pu = well_state.phaseUsage();
|
||||
double sign = 1.0;
|
||||
@ -1484,6 +1484,32 @@ namespace WellGroupHelpers
|
||||
return std::make_pair(current_rate > target_rate, scale);
|
||||
}
|
||||
|
||||
template <class AverageRegionalPressureType>
|
||||
void setRegionAveragePressureCalculator(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const FieldPropsManager& fp,
|
||||
const PhaseUsage& pu,
|
||||
std::map<std::string, std::unique_ptr<AverageRegionalPressureType>>& regionalAveragePressureCalculator)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
setRegionAveragePressureCalculator( schedule.getGroup(groupName, reportStepIdx), schedule,
|
||||
reportStepIdx, fp, pu, regionalAveragePressureCalculator);
|
||||
}
|
||||
const auto& gpm = group.gpmaint();
|
||||
if (!gpm)
|
||||
return;
|
||||
|
||||
const auto& reg = gpm->region();
|
||||
if (!reg)
|
||||
return;
|
||||
|
||||
if (regionalAveragePressureCalculator.count(reg->first) == 0) {
|
||||
const std::string name = (reg->first.rfind("FIP", 0) == 0) ? reg->first : "FIP" + reg->first;
|
||||
const auto& fipnum = fp.get_int(name);
|
||||
regionalAveragePressureCalculator[reg->first] = std::make_unique<AverageRegionalPressureType>(pu,fipnum);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Comm>
|
||||
void updateGuideRates(const Group& group,
|
||||
@ -1622,13 +1648,20 @@ namespace WellGroupHelpers
|
||||
}
|
||||
|
||||
using AvgP = RegionAverageCalculator::AverageRegionalPressure<BlackOilFluidSystem<double>,std::vector<int>>;
|
||||
template void WellGroupHelpers::updateGpMaintTargetForGroups<AvgP>(const Group&,
|
||||
using AvgPMap = std::map<std::string, std::unique_ptr<AvgP>>;
|
||||
template void WellGroupHelpers::updateGpMaintTargetForGroups<AvgPMap>(const Group&,
|
||||
const Schedule&,
|
||||
const AvgP&,
|
||||
const AvgPMap&,
|
||||
int,
|
||||
double,
|
||||
const WellState&,
|
||||
GroupState&);
|
||||
template void WellGroupHelpers::setRegionAveragePressureCalculator<AvgP>(const Group&,
|
||||
const Schedule&,
|
||||
const int,
|
||||
const FieldPropsManager&,
|
||||
const PhaseUsage&,
|
||||
AvgPMap&);
|
||||
|
||||
template
|
||||
void updateGuideRateForProductionGroups<Parallel::Communication>(const Group& group,
|
||||
|
@ -22,6 +22,8 @@
|
||||
#define OPM_WELLGROUPHELPERS_HEADER_INCLUDED
|
||||
|
||||
#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
|
||||
#include <opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@ -38,6 +40,7 @@ struct PhaseUsage;
|
||||
class Schedule;
|
||||
class VFPProdProperties;
|
||||
class WellState;
|
||||
class FieldPropsManager;
|
||||
|
||||
namespace Network { class ExtNetwork; }
|
||||
|
||||
@ -309,6 +312,14 @@ namespace WellGroupHelpers
|
||||
const std::vector<double>& resv_coeff,
|
||||
DeferredLogger& deferred_logger);
|
||||
|
||||
template <class AverageRegionalPressureType>
|
||||
void setRegionAveragePressureCalculator(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const FieldPropsManager& fp,
|
||||
const PhaseUsage& pu,
|
||||
std::map<std::string, std::unique_ptr<AverageRegionalPressureType>>& regionalAveragePressureCalculator);
|
||||
|
||||
|
||||
} // namespace WellGroupHelpers
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user