mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-26 01:01:00 -06:00
Add guard around solve well equation.
This commit is contained in:
parent
62e485cbea
commit
36ba423d42
@ -406,18 +406,28 @@ namespace Opm {
|
||||
//compute well guideRates
|
||||
const auto& comm = ebosSimulator_.vanguard().grid().comm();
|
||||
WellGroupHelpers::updateGuideRatesForWells(schedule(), phase_usage_, reportStepIdx, simulationTime, well_state_, comm, guideRate_.get());
|
||||
updateAndCommunicateGroupData();
|
||||
// Compute initial well solution for new wells
|
||||
for (auto& well : well_container_) {
|
||||
const uint64_t effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
|
||||
+ ScheduleEvents::NEW_WELL;
|
||||
try {
|
||||
updateAndCommunicateGroupData();
|
||||
// Compute initial well solution for new wells
|
||||
for (auto& well : well_container_) {
|
||||
const uint64_t effective_events_mask = ScheduleEvents::WELL_STATUS_CHANGE
|
||||
+ ScheduleEvents::NEW_WELL;
|
||||
|
||||
const auto& events = schedule()[reportStepIdx].wellgroup_events();
|
||||
const bool event = report_step_starts_ && events.hasEvent(well->name(), effective_events_mask);
|
||||
if (event) {
|
||||
well->calculateExplicitQuantities(ebosSimulator_, well_state_, local_deferredLogger);
|
||||
well->solveWellEquation(ebosSimulator_, well_state_, local_deferredLogger);
|
||||
const auto& events = schedule()[reportStepIdx].wellgroup_events();
|
||||
const bool event = report_step_starts_ && events.hasEvent(well->name(), effective_events_mask);
|
||||
if (event) {
|
||||
try {
|
||||
well->calculateExplicitQuantities(ebosSimulator_, well_state_, local_deferredLogger);
|
||||
well->solveWellEquation(ebosSimulator_, well_state_, local_deferredLogger);
|
||||
} catch (std::exception& e) {
|
||||
const std::string msg = "Compute initial well solution for new well " + well->name() + " failed. Continue with zero initial rates";
|
||||
local_deferredLogger.warning("WELL_INITIAL_SOLVE_FAILED", msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
const std::string msg = "Compute initial well solution for new wells failed. Continue with zero initial rates";
|
||||
local_deferredLogger.warning("WELL_INITIAL_SOLVE_FAILED", msg);
|
||||
}
|
||||
|
||||
logAndCheckForExceptionsAndThrow(local_deferredLogger,
|
||||
|
@ -1392,6 +1392,9 @@ namespace Opm
|
||||
WellState& well_state,
|
||||
Opm::DeferredLogger& deferred_logger)
|
||||
{
|
||||
if (!this->isOperable())
|
||||
return;
|
||||
|
||||
// keep a copy of the original well state
|
||||
const WellState well_state0 = well_state;
|
||||
const double dt = ebosSimulator.timeStepSize();
|
||||
|
Loading…
Reference in New Issue
Block a user