Print all well switching in parallel.

As for each well only one process is responsible, the output process
does not see all wells. Ergo some well switching information was never
printed in a parallel run.

Therefore with this commit the well switching
message is printed regardless on which process it appears.
This commit is contained in:
Markus Blatt 2016-06-07 16:56:37 +00:00 committed by Liu Ming
parent ad01934670
commit 4c9d359638
7 changed files with 19 additions and 26 deletions

View File

@ -747,7 +747,7 @@ namespace detail {
// Possibly switch well controls and updating well state to
// get reasonable initial conditions for the wells
asImpl().wellModel().updateWellControls(terminal_output_, well_state);
asImpl().wellModel().updateWellControls(well_state);
// Create the primary variables.
SolutionState state = asImpl().variableState(reservoir_state, well_state);
@ -1036,7 +1036,7 @@ namespace detail {
const Eigen::VectorXd& dx = solver.solve(total_residual_v.matrix());
assert(dx.size() == total_residual_v.size());
asImpl().wellModel().updateWellState(dx.array(), dpMaxRel(), well_state);
asImpl().wellModel().updateWellControls(terminal_output_, well_state);
asImpl().wellModel().updateWellControls(well_state);
}
} while (it < 15);

View File

@ -147,7 +147,7 @@ namespace Opm {
// Possibly switch well controls and updating well state to
// get reasonable initial conditions for the wells
wellModel().updateWellControls(terminal_output_, well_state);
wellModel().updateWellControls(well_state);
// Create the primary variables.
SolutionState state = asImpl().variableState(reservoir_state, well_state);

View File

@ -193,8 +193,7 @@ namespace Opm {
template <class WellState>
void
updateWellControls(const bool terminal_output,
WellState& xw) const;
updateWellControls(WellState& xw) const;
// TODO: these code are same with the StandardWells
// to find a better solution later.

View File

@ -822,8 +822,7 @@ namespace Opm
template <class WellState>
void
MultisegmentWells::
updateWellControls(const bool terminal_output,
WellState& xw) const
updateWellControls(WellState& xw) const
{
if( msWells().empty() ) return ;
@ -860,12 +859,10 @@ namespace Opm
if (ctrl_index != nwc) {
// Constraint number ctrl_index was broken, switch to it.
if (terminal_output)
{
std::cout << "Switching control mode for well " << msWells()[w]->name()
<< " from " << modestring[well_controls_iget_type(wc, current)]
<< " to " << modestring[well_controls_iget_type(wc, ctrl_index)] << std::endl;
}
// Each well is only active on one process. Therefore we always print the sitch info.
std::cout << "Switching control mode for well " << msWells()[w]->name()
<< " from " << modestring[well_controls_iget_type(wc, current)]
<< " to " << modestring[well_controls_iget_type(wc, ctrl_index)] << std::endl;
xw.currentControls()[w] = ctrl_index;
current = xw.currentControls()[w];
}

View File

@ -114,8 +114,7 @@ namespace Opm {
WellState& well_state);
template <class WellState>
void updateWellControls(const bool terminal_output,
WellState& xw) const;
void updateWellControls(WellState& xw) const;
// TODO: should LinearisedBlackoilResidual also be a template class?
template <class SolutionState>

View File

@ -694,8 +694,7 @@ namespace Opm
template <class WellState>
void
StandardWells::
updateWellControls(const bool terminal_output,
WellState& xw) const
updateWellControls(WellState& xw) const
{
if( !localWellsActive() ) return ;
@ -732,14 +731,13 @@ namespace Opm
}
if (ctrl_index != nwc) {
// Constraint number ctrl_index was broken, switch to it.
if (terminal_output)
{
std::ostringstream ss;
ss << "Switching control mode for well " << wells().name[w]
<< " from " << modestring[well_controls_iget_type(wc, current)]
<< " to " << modestring[well_controls_iget_type(wc, ctrl_index)] << std::endl;
OpmLog::info(ss.str());
}
// We disregard terminal_ouput here as with it only messages
// for wells on one process will be printed.
std::ostringstream ss;
ss << "Switching control mode for well " << wells().name[w]
<< " from " << modestring[well_controls_iget_type(wc, current)]
<< " to " << modestring[well_controls_iget_type(wc, ctrl_index)] << std::endl;
OpmLog::info(ss.str());
xw.currentControls()[w] = ctrl_index;
current = xw.currentControls()[w];
}

View File

@ -499,7 +499,7 @@ namespace Opm {
// Possibly switch well controls and updating well state to
// get reasonable initial conditions for the wells
// updateWellControls(well_state);
wellModel().updateWellControls(terminal_output_, well_state);
wellModel().updateWellControls(well_state);
// Create the primary variables.
SolutionState state = variableState(reservoir_state, well_state);