mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 02:30:18 -06:00
Add support for combination of multi-segmented wells and WTEST
This commit is contained in:
parent
3e53ed6386
commit
22755cc257
@ -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
|
||||
|
@ -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);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user