Add support for combination of multi-segmented wells and WTEST

This commit is contained in:
Tor Harald Sandve 2018-06-21 14:40:04 +02:00
parent 3e53ed6386
commit 22755cc257
5 changed files with 53 additions and 61 deletions

View File

@ -244,6 +244,8 @@ namespace Opm {
const double well_efficiency_factor = well_node.getAccumulativeEfficiencyFactor();
well->setWellEfficiencyFactor(well_efficiency_factor);
well->setVFPProperties(vfp_properties_.get());
well->updatePrimaryVariables(well_state_);
well->initPrimaryVariablesEvaluation();
well->solveWellEq(ebosSimulator_, well_state_, /*dt (not relevant for well test) =*/ 1.0, B_avg, terminal_output_);
well->updateListEconLimited(well_state_, simulationTime, wellTestStateForTheWellTest);
// update wellTestState if the well test succeeds

View File

@ -340,8 +340,6 @@ namespace Opm
// handle the non reasonable fractions due to numerical overshoot
void processFractions() const;
SimulatorReport solveWellEq(Simulator& ebosSimulator, WellState& well_state, const double dt, const std::vector<double>& B_avg, bool terminal_output);
};
}

View File

@ -2230,57 +2230,4 @@ namespace Opm
}
}
}
template<typename TypeTag>
SimulatorReport
StandardWell<TypeTag>::solveWellEq(Simulator& ebosSimulator, WellState& well_state, const double dt, const std::vector<double>& B_avg, bool terminal_output)
{
const int max_iter = param_.max_welleq_iter_;
int it = 0;
bool converged;
WellState well_state0 = well_state;
do {
assembleWellEq(ebosSimulator, dt, well_state, true);
ConvergenceReport report;
report = getWellConvergence(B_avg);
converged = report.converged;
if (converged) {
break;
}
++it;
solveEqAndUpdateWellState(well_state);
wellhelpers::WellSwitchingLogger logger;
updateWellControl(well_state, logger);
initPrimaryVariablesEvaluation();
} while (it < max_iter);
if (converged) {
if ( terminal_output ) {
OpmLog::debug("Well equation solution gets converged with " + std::to_string(it) + " iterations");
}
} else {
if ( terminal_output ) {
OpmLog::debug("Well equation solution failed in getting converged with " + std::to_string(it) + " iterations");
well_state = well_state0;
updatePrimaryVariables(well_state);
// also recover the old well controls
//WellControls* wc = wellControls();
//well_controls_set_current(wc, well_state.currentControls()[indexOfWell()]);
}
//#warning need the unconverged solution in the wtest. Either add a flag or always use the unconverged solution?
}
SimulatorReport report;
report.converged = converged;
report.total_well_iterations = it;
return report;
}
}

View File

@ -224,12 +224,7 @@ namespace Opm
virtual void addWellContributions(Mat&) const
{}
virtual SimulatorReport solveWellEq(Simulator& ebosSimulator, WellState& well_state, const double dt, const std::vector<double>& B_avg, bool terminal_output)
{
#warning need to add this to multisegment wells
SimulatorReport report;
return report;
}
SimulatorReport solveWellEq(Simulator& ebosSimulator, WellState& well_state, const double dt, const std::vector<double>& B_avg, bool terminal_output);
void closeWellsAndCompletions(WellTestState& wellTestState);

View File

@ -902,4 +902,54 @@ namespace Opm
}
}
template<typename TypeTag>
SimulatorReport
WellInterface<TypeTag>::solveWellEq(Simulator& ebosSimulator, WellState& well_state, const double dt, const std::vector<double>& B_avg, bool terminal_output)
{
const int max_iter = param_.max_welleq_iter_;
int it = 0;
bool converged;
WellState well_state0 = well_state;
do {
assembleWellEq(ebosSimulator, dt, well_state, true);
ConvergenceReport report;
report = getWellConvergence(B_avg);
converged = report.converged;
if (converged) {
break;
}
++it;
solveEqAndUpdateWellState(well_state);
wellhelpers::WellSwitchingLogger logger;
updateWellControl(well_state, logger);
initPrimaryVariablesEvaluation();
} while (it < max_iter);
if (converged) {
if ( terminal_output ) {
OpmLog::debug("Well equation solution gets converged with " + std::to_string(it) + " iterations");
}
} else {
if ( terminal_output ) {
OpmLog::debug("Well equation solution failed in getting converged with " + std::to_string(it) + " iterations");
well_state = well_state0;
updatePrimaryVariables(well_state);
// also recover the old well controls
//WellControls* wc = wellControls();
//well_controls_set_current(wc, well_state.currentControls()[indexOfWell()]);
}
}
SimulatorReport report;
report.converged = converged;
report.total_well_iterations = it;
return report;
}
}