Reset wellcontrols from well_state

This commit is contained in:
Tor Harald Sandve 2016-08-19 13:50:27 +02:00
parent cd76816ea5
commit b023cb15a5
2 changed files with 11 additions and 0 deletions

View File

@ -283,8 +283,10 @@ namespace Opm {
{ {
using namespace Opm::AutoDiffGrid; using namespace Opm::AutoDiffGrid;
//wellModel().assembleAndUpdate<FluidSystem>(well_state);
// Possibly switch well controls and updating well state to // Possibly switch well controls and updating well state to
// get reasonable initial conditions for the wells // get reasonable initial conditions for the wells
wellModel().resetWellControlFromState(well_state);
wellModel().updateWellControls(well_state); wellModel().updateWellControls(well_state);
// Set the primary variables for the wells // Set the primary variables for the wells

View File

@ -86,6 +86,15 @@ namespace Opm {
int numPhases() const { return wells().number_of_phases; }; int numPhases() const { return wells().number_of_phases; };
template<class WellState>
void resetWellControlFromState(WellState xw) {
const int nw = wells_->number_of_wells;
for (int w = 0; w < nw; ++w) {
WellControls* wc = wells_->ctrls[w];
well_controls_set_current( wc, xw.currentControls()[w]);
}
}
const Wells& wells() const; const Wells& wells() const;
const Wells* wellsPointer() const; const Wells* wellsPointer() const;