addressing the review comments

This commit is contained in:
Kai Bao 2023-06-27 13:59:10 +02:00
parent cacec2739c
commit f78f8e45f7
4 changed files with 20 additions and 19 deletions

View File

@ -1411,10 +1411,12 @@ void BlackoilWellModelGeneric::initInjMult() {
if (well->isInjector() && well->wellEcl().getInjMultMode() != Well::InjMultMode::NONE) {
const auto& ws = this->wellState().well(well->indexOfWell());
const auto& perf_data = ws.perf_data;
if ((this->prev_inj_multipliers_.count(well->name())) == 0 ) {
this->prev_inj_multipliers_[well->name()] = std::vector<double>(perf_data.size(), 1.0);
auto &values = this->prev_inj_multipliers_[well->name()];
if (values.empty()) {
values.assign(perf_data.size(), 1.0);
}
well->initInjMult(this->prev_inj_multipliers_.at(well->name()));
well->initInjMult(values);
}
}
}

View File

@ -220,7 +220,6 @@ namespace Opm
// get the mobility for specific perforation
template<class Value>
void getMobility(const Simulator& ebosSimulator,
const int seg,
const int perf,
std::vector<Value>& mob,
DeferredLogger& deferred_logger) const;

View File

@ -341,7 +341,7 @@ namespace Opm
const auto& intQuants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
// flux for each perforation
std::vector<Scalar> mob(this->num_components_, 0.);
getMobility(ebosSimulator, seg, perf, mob, deferred_logger);
getMobility(ebosSimulator, perf, mob, deferred_logger);
double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier<double>(intQuants, cell_idx);
const double Tw = this->well_index_[perf] * trans_mult;
@ -670,10 +670,7 @@ namespace Opm
};
std::vector<Scalar> mob(this->num_components_, 0.0);
const WellConnections& connections = this->wellEcl().getConnections();
const Connection& connection = connections.get(static_cast<int>(subsetPerfID));
const int seg = this->segmentNumberToIndex(connection.segment());
getMobility(ebosSimulator, seg, static_cast<int>(subsetPerfID), mob, deferred_logger);
getMobility(ebosSimulator, static_cast<int>(subsetPerfID), mob, deferred_logger);
const auto& fs = fluidState(subsetPerfID);
setToZero(connPI);
@ -986,7 +983,6 @@ namespace Opm
void
MultisegmentWell<TypeTag>::
getMobility(const Simulator& ebosSimulator,
const int seg,
const int perf,
std::vector<Value>& mob,
DeferredLogger& deferred_logger) const
@ -1000,16 +996,20 @@ namespace Opm
return this->extendEval(value);
}
};
WellInterface<TypeTag>::getMobility(ebosSimulator, perf, mob, obtain, deferred_logger);
if (this->isInjector() && this->well_ecl_.getInjMultMode() != Well::InjMultMode::NONE) {
const auto perf_ecl_index = this->perforationData()[perf].ecl_index;
const Connection& con = this->well_ecl_.getConnections()[perf_ecl_index];
const int seg = this->segmentNumberToIndex(con.segment());
// from the reference results, it looks like MSW uses segment pressure instead of BHP here
// Note: this is against the documented definition.
// we can change this depending on what we want
const double segment_pres = this->primary_variables_.getSegmentPressure(seg).value();
const double perf_seg_press_diff = this->gravity() * this->segments_.density(seg).value()
* this->segments_.perforation_depth_diff(perf);
const double perf_press = this->primary_variables_.getSegmentPressure(seg).value() + perf_seg_press_diff;
const double perf_press = segment_pres + perf_seg_press_diff;
const double multiplier = this->getInjMult(perf, segment_pres, perf_press);
for (size_t i = 0; i < mob.size(); ++i) {
mob[i] *= multiplier;
@ -1114,7 +1114,7 @@ namespace Opm
std::vector<Scalar> mob(this->num_components_, 0.0);
// TODO: maybe we should store the mobility somewhere, so that we only need to calculate it one per iteration
getMobility(ebos_simulator, seg, perf, mob, deferred_logger);
getMobility(ebos_simulator, perf, mob, deferred_logger);
const int cell_idx = this->well_cells_[perf];
const auto& int_quantities = ebos_simulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
@ -1472,7 +1472,7 @@ namespace Opm
const int cell_idx = this->well_cells_[perf];
const auto& int_quants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
std::vector<EvalWell> mob(this->num_components_, 0.0);
getMobility(ebosSimulator, seg, perf, mob, deferred_logger);
getMobility(ebosSimulator, perf, mob, deferred_logger);
const double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier<double>(int_quants, cell_idx);
const double Tw = this->well_index_[perf] * trans_mult;
std::vector<EvalWell> cq_s(this->num_components_, 0.0);
@ -1784,7 +1784,7 @@ namespace Opm
const int cell_idx = this->well_cells_[perf];
const auto& int_quants = ebosSimulator.model().intensiveQuantities(cell_idx, /*timeIdx=*/ 0);
std::vector<Scalar> mob(this->num_components_, 0.0);
getMobility(ebosSimulator, seg, perf, mob, deferred_logger);
getMobility(ebosSimulator, perf, mob, deferred_logger);
const double trans_mult = ebosSimulator.problem().template rockCompTransMultiplier<double>(int_quants, cell_idx);
const double Tw = this->well_index_[perf] * trans_mult;
std::vector<Scalar> cq_s(this->num_components_, 0.0);

View File

@ -219,7 +219,7 @@ double WellInterfaceGeneric::getInjMult(const int perf,
{
assert(!this->isProducer());
double multipler = 1.;
double multiplier = 1.;
const auto perf_ecl_index = this->perforationData()[perf].ecl_index;
const bool is_wrev = this->well_ecl_.getInjMultMode() == Well::InjMultMode::WREV;
@ -235,18 +235,18 @@ double WellInterfaceGeneric::getInjMult(const int perf,
const auto frac_press = injmult.fracture_pressure;
const auto gradient = injmult.multiplier_gradient;
if (pres > frac_press) {
multipler = 1. + (pres - frac_press) * gradient;
multiplier = 1. + (pres - frac_press) * gradient;
}
}
// for CIRR mode, if there is no active WINJMULT setup, we will use the previous injection multiplier,
// to mimic keeping the existing fracturing open
if (this->well_ecl_.getInjMultMode() == Well::InjMultMode::CIRR) {
multipler = std::max(multipler, this->prev_inj_multiplier_[perf_ecl_index]);
multiplier = std::max(multiplier, this->prev_inj_multiplier_[perf_ecl_index]);
}
this->inj_multiplier_[perf_ecl_index] = multipler;
return multipler;
this->inj_multiplier_[perf_ecl_index] = multiplier;
return multiplier;
}