mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
clean-up
This commit is contained in:
parent
f497fa0fd7
commit
adda160098
@ -322,7 +322,7 @@ namespace Opm {
|
||||
bool alternative_well_rate_init_{};
|
||||
|
||||
std::unique_ptr<RateConverterType> rateConverter_{};
|
||||
std::unique_ptr<AverageRegionalPressureType> gpmaint_{};
|
||||
std::unique_ptr<AverageRegionalPressureType> regionalAveragePressureCalculator_{};
|
||||
|
||||
|
||||
SimulatorReportSingle last_report_{};
|
||||
|
@ -1535,7 +1535,7 @@ updateAndCommunicateGroupData(const int reportStepIdx,
|
||||
WellGroupHelpers::updateVREPForGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, well_state, this->groupState());
|
||||
|
||||
WellGroupHelpers::updateReservoirRatesInjectionGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, well_state, this->groupState());
|
||||
WellGroupHelpers::updateSurfaceRatesInjectionGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, well_state, this->groupState());
|
||||
WellGroupHelpers::updateSurfaceRatesInjectionGroups(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, this->groupState());
|
||||
|
||||
WellGroupHelpers::updateGroupProductionRates(fieldGroup, schedule(), reportStepIdx, well_state_nupcol, well_state, this->groupState());
|
||||
|
||||
|
@ -203,16 +203,14 @@ namespace Opm {
|
||||
WellGroupHelpers::setCmodeGroup(fieldGroup, schedule(), summaryState, timeStepIdx, this->wellState(), this->groupState());
|
||||
|
||||
// Compute reservoir volumes for RESV controls.
|
||||
rateConverter_.reset(new RateConverterType (phase_usage_,
|
||||
std::vector<int>(local_num_cells_, 0)));
|
||||
rateConverter_.reset(new RateConverterType (phase_usage_, std::vector<int>(local_num_cells_, 0)));
|
||||
rateConverter_->template defineState<ElementContext>(ebosSimulator_);
|
||||
|
||||
// Compute reservoir volumes for RESV controls.
|
||||
// Compute regional average pressures used by gpmaint
|
||||
const auto& fp = this->eclState_.fieldProps();
|
||||
const auto fipnum = fp.get_int("FIPNUM");
|
||||
gpmaint_.reset(new AverageRegionalPressureType (phase_usage_,
|
||||
fipnum));
|
||||
gpmaint_->template defineState<ElementContext>(ebosSimulator_);
|
||||
const auto& fipnum = fp.get_int("FIPNUM");
|
||||
regionalAveragePressureCalculator_.reset(new AverageRegionalPressureType (phase_usage_,fipnum));
|
||||
regionalAveragePressureCalculator_->template defineState<ElementContext>(ebosSimulator_);
|
||||
|
||||
{
|
||||
const auto& sched_state = this->schedule()[timeStepIdx];
|
||||
@ -465,10 +463,10 @@ namespace Opm {
|
||||
// update the rate converter with current averages pressures etc in
|
||||
rateConverter_->template defineState<ElementContext>(ebosSimulator_);
|
||||
|
||||
gpmaint_->template defineState<ElementContext>(ebosSimulator_);
|
||||
regionalAveragePressureCalculator_->template defineState<ElementContext>(ebosSimulator_);
|
||||
const Group& fieldGroup = schedule_.getGroup("FIELD", reportStepIdx);
|
||||
WellGroupHelpers::updateGpMaintTargetForGroups(fieldGroup,
|
||||
schedule_, *gpmaint_, reportStepIdx, dt, this->wellState(), this->groupState());
|
||||
schedule_, *regionalAveragePressureCalculator_, reportStepIdx, dt, this->wellState(), this->groupState());
|
||||
|
||||
|
||||
// calculate the well potentials
|
||||
|
@ -211,26 +211,14 @@ namespace Opm {
|
||||
|
||||
bool has(const RegionID reg) const
|
||||
{
|
||||
const auto& i = attr_.find(reg);
|
||||
|
||||
if (i == attr_.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return this->attr_.find(reg) != this->attr_.end();
|
||||
}
|
||||
|
||||
void insert(const RegionID r, const Attributes& attr)
|
||||
{
|
||||
using VT = typename AttributeMap::value_type;
|
||||
|
||||
auto v = std::make_unique<Value>(attr);
|
||||
|
||||
const auto stat = attr_.insert(VT(r, std::move(v)));
|
||||
|
||||
if (stat.second) {
|
||||
// Region's representative cell.
|
||||
stat.first->second->cell_ = -1.0;
|
||||
auto [pos, inserted] = this->attr_.try_emplace(r, std::make_unique<Value>(attr));
|
||||
if (inserted) {
|
||||
pos->second->cell_ = -1; // NOT -1.0 -- "cell_" is 'int'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace Opm {
|
||||
* deck.
|
||||
*/
|
||||
AverageRegionalPressure(const PhaseUsage& phaseUsage,
|
||||
const Region& region)
|
||||
const Region& region)
|
||||
: phaseUsage_(phaseUsage)
|
||||
, rmap_ (region)
|
||||
, attr_ (rmap_, Attributes())
|
||||
@ -91,13 +91,13 @@ namespace Opm {
|
||||
numRegions = std::max(numRegions, reg);
|
||||
}
|
||||
numRegions = comm.max(numRegions);
|
||||
for (int reg = 0; reg < numRegions; ++ reg) {
|
||||
for (int reg = 1; reg <= numRegions ; ++ reg) {
|
||||
if(!attr_.has(reg))
|
||||
attr_.insert(reg, Attributes());
|
||||
}
|
||||
// create map from cell to region
|
||||
// and set all attributes to zero
|
||||
for (int reg = 0; reg < numRegions; ++ reg) {
|
||||
for (int reg = 1; reg <= numRegions ; ++ reg) {
|
||||
auto& ra = attr_.attributes(reg);
|
||||
ra.pressure = 0.0;
|
||||
ra.pv = 0.0;
|
||||
@ -110,22 +110,11 @@ namespace Opm {
|
||||
// quantities for hydrocarbon volume average
|
||||
std::unordered_map<RegionId, Attributes> attributes_hpv;
|
||||
|
||||
for (int reg = 0; reg < numRegions; ++ reg) {
|
||||
for (int reg = 1; reg <= numRegions ; ++ reg) {
|
||||
attributes_pv.insert({reg, Attributes()});
|
||||
attributes_hpv.insert({reg, Attributes()});
|
||||
}
|
||||
|
||||
for (int reg = 0; reg < numRegions; ++ reg) {
|
||||
auto& ra = attributes_pv[reg];
|
||||
ra.pressure = 0.0;
|
||||
ra.pv = 0.0;
|
||||
}
|
||||
for (int reg = 0; reg < numRegions; ++ reg) {
|
||||
auto& ra = attributes_hpv[reg];
|
||||
ra.pressure = 0.0;
|
||||
ra.pv = 0.0;
|
||||
}
|
||||
|
||||
ElementContext elemCtx( simulator );
|
||||
const auto& elemEndIt = gridView.template end</*codim=*/0>();
|
||||
for (auto elemIt = gridView.template begin</*codim=*/0>();
|
||||
@ -184,7 +173,7 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
for (int reg = 0; reg < numRegions; ++ reg) {
|
||||
for (int reg = 1; reg <= numRegions ; ++ reg) {
|
||||
auto& ra = attr_.attributes(reg);
|
||||
const double hpv_sum = comm.sum(attributes_hpv[reg].pv);
|
||||
// TODO: should we have some epsilon here instead of zero?
|
||||
|
@ -555,17 +555,16 @@ namespace WellGroupHelpers
|
||||
}
|
||||
|
||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
WellState& wellState,
|
||||
GroupState& group_state)
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
GroupState& group_state)
|
||||
{
|
||||
for (const std::string& groupName : group.groups()) {
|
||||
const Group& groupTmp = schedule.getGroup(groupName, reportStepIdx);
|
||||
updateSurfaceRatesInjectionGroups(groupTmp, schedule, reportStepIdx, wellStateNupcol, wellState, group_state);
|
||||
updateSurfaceRatesInjectionGroups(groupTmp, schedule, reportStepIdx, wellStateNupcol, group_state);
|
||||
}
|
||||
const int np = wellState.numPhases();
|
||||
const int np = wellStateNupcol.numPhases();
|
||||
std::vector<double> rates(np, 0.0);
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
rates[phase] = sumWellPhaseRates(false,
|
||||
|
@ -157,11 +157,10 @@ namespace WellGroupHelpers
|
||||
GroupState& group_state);
|
||||
|
||||
void updateSurfaceRatesInjectionGroups(const Group& group,
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
WellState& wellState,
|
||||
GroupState& group_state);
|
||||
const Schedule& schedule,
|
||||
const int reportStepIdx,
|
||||
const WellState& wellStateNupcol,
|
||||
GroupState& group_state);
|
||||
|
||||
void updateWellRates(const Group& group,
|
||||
const Schedule& schedule,
|
||||
|
Loading…
Reference in New Issue
Block a user