mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00:59 -06:00
improve initialization msw new wells
This commit is contained in:
parent
519b5dd8cc
commit
32dfdc6198
@ -297,17 +297,6 @@ namespace Opm {
|
||||
well->closeCompletions(wellTestState());
|
||||
}
|
||||
|
||||
// calculate the well potentials
|
||||
try {
|
||||
updateWellPotentials(reportStepIdx,
|
||||
/*onlyAfterEvent*/true,
|
||||
ebosSimulator_.vanguard().summaryConfig(),
|
||||
local_deferredLogger);
|
||||
} catch ( std::runtime_error& e ) {
|
||||
const std::string msg = "A zero well potential is returned for output purposes. ";
|
||||
local_deferredLogger.warning("WELL_POTENTIAL_CALCULATION_FAILED", msg);
|
||||
}
|
||||
|
||||
if (alternative_well_rate_init_) {
|
||||
// Update the well rates of well_state_, if only single-phase rates, to
|
||||
// have proper multi-phase rates proportional to rates at bhp zero.
|
||||
@ -320,6 +309,17 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the well potentials
|
||||
try {
|
||||
updateWellPotentials(reportStepIdx,
|
||||
/*onlyAfterEvent*/true,
|
||||
ebosSimulator_.vanguard().summaryConfig(),
|
||||
local_deferredLogger);
|
||||
} catch ( std::runtime_error& e ) {
|
||||
const std::string msg = "A zero well potential is returned for output purposes. ";
|
||||
local_deferredLogger.warning("WELL_POTENTIAL_CALCULATION_FAILED", msg);
|
||||
}
|
||||
|
||||
//update guide rates
|
||||
const auto& comm = ebosSimulator_.vanguard().grid().comm();
|
||||
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
||||
|
@ -422,9 +422,15 @@ namespace Opm
|
||||
|
||||
// initialized the well rates with the potentials i.e. the well rates based on bhp
|
||||
const int np = this->number_of_phases_;
|
||||
const double sign = well_copy.well_ecl_.isInjector() ? 1.0 : -1.0;
|
||||
bool trivial = true;
|
||||
for (int phase = 0; phase < np; ++phase){
|
||||
ws.surface_rates[phase] = sign * ws.well_potentials[phase];
|
||||
trivial = trivial && (ws.well_potentials[phase] == 0.0) ;
|
||||
}
|
||||
if (!trivial) {
|
||||
const double sign = well_copy.well_ecl_.isInjector() ? 1.0 : -1.0;
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
ws.surface_rates[phase] = sign * ws.well_potentials[phase];
|
||||
}
|
||||
}
|
||||
well_copy.scaleSegmentRatesWithWellRates(well_state_copy);
|
||||
|
||||
|
@ -1013,14 +1013,19 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nonzero_rate_index == -1) {
|
||||
// No nonzero rates.
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate the rates that follow from the current primary variables.
|
||||
std::vector<double> well_q_s = computeCurrentWellRates(ebosSimulator, deferred_logger);
|
||||
|
||||
if (nonzero_rate_index == -1) {
|
||||
// No nonzero rates.
|
||||
// Use the computed rate directly
|
||||
for (int p = 0; p < this->number_of_phases_; ++p) {
|
||||
ws.surface_rates[p] = well_q_s[this->flowPhaseToEbosCompIdx(p)];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the currently-zero phase flows to be nonzero in proportion to well_q_s.
|
||||
const double initial_nonzero_rate = ws.surface_rates[nonzero_rate_index];
|
||||
const int comp_idx_nz = this->flowPhaseToEbosCompIdx(nonzero_rate_index);
|
||||
|
Loading…
Reference in New Issue
Block a user