adding prepareTimeStep() to the StandardWellsDense

to handle the well potential related calculation
This commit is contained in:
Kai Bao
2017-03-16 16:39:05 +01:00
parent 57f7650228
commit 819aa90d84
4 changed files with 52 additions and 4 deletions

View File

@@ -213,8 +213,9 @@ namespace Opm {
/// \param[in, out] well_state well state variables
void prepareStep(const SimulatorTimerInterface& /*timer*/,
const ReservoirState& /*reservoir_state*/,
const WellState& /* well_state */)
WellState& well_state)
{
well_model_.prepareTimeStep(ebosSimulator_, well_state);
}

View File

@@ -127,7 +127,11 @@ namespace Opm
failureReport_ = SimulatorReport();
// Do model-specific once-per-step calculations.
model_->prepareStep(timer, initial_reservoir_state, initial_well_state);
// TODO: this is not the correct fix, possibly breaking the sequential solver
// TODO: the only reason to do this is that the wellPotentials() is part of the well_state, which will be modified
// during the well_potential calculation
model_->prepareStep(timer, initial_reservoir_state, well_state);
// model_->prepareStep(timer, initial_reservoir_state, initial_reservoir_state);
int iteration = 0;

View File

@@ -251,11 +251,16 @@ enum WellVariablePositions {
computeWellPotentials(const Simulator& ebosSimulator,
WellState& well_state) const;
// TODO: temporary function name for now before changing the simulator and also WellsMananger
void computeWellPotentials(const WellState& well_state,
std::vector<double>& well_potentials) const;
// TODO: some preparation work, mostly related to group control and RESV,
// at the beginning of each time step (Not report step)
template<typename Simulator>
void prepareTimeStep(const Simulator& ebos_simulator,
WellState& well_state);
WellCollection* wellCollection() const;
const std::vector<double>&

View File

@@ -1834,7 +1834,45 @@ namespace Opm {
template<typename FluidSystem, typename BlackoilIndices, typename ElementContext, typename MaterialLaw>
template<typename FluidSystem, typename BlackoilIndices, typename ElementContext>
template<typename Simulator>
void
StandardWellsDense<FluidSystem, BlackoilIndices>::
prepareTimeStep(const Simulator& ebos_simulator,
WellState& well_state)
{
// TODO: we should remove the wellPotentials() from the well_state.
if (well_collection_->groupControlActive()) {
// calculate the well potentials
// two functions will probably be merged in the final version
// and also the well potentials related parts in well state.
if (param_.compute_well_potentials_) {
setWellVariables(well_state);
computeWellConnectionPressures(ebos_simulator, well_state);
computeWellPotentials(ebos_simulator, well_state);
// To store well potentials for each well
std::vector<double> well_potentials;
computeWellPotentials(well_state, well_potentials);
// update/setup guide rates for each well based on the well_potentials
well_collection_->setGuideRates(wellsPointer(), phase_usage_, well_potentials);
}
applyVREPGroupControl(well_state);
wellCollection()->updateWellTargets(well_state.wellRates());
}
}
template<typename FluidSystem, typename BlackoilIndices, typename ElementContext>
WellCollection*
StandardWellsDense<FluidSystem, BlackoilIndices, ElementContext, MaterialLaw>::
wellCollection() const