mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
making the computeWellPotentials calculate potential for each well
Not store the well potentials to WellState anymore.
This commit is contained in:
parent
4b5e1dfadc
commit
653baae039
@ -199,8 +199,6 @@ public:
|
|||||||
desiredRestoreStep );
|
desiredRestoreStep );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_well_potentials_computed = param_.getDefault("compute_well_potentials", false );
|
|
||||||
std::vector<double> well_potentials;
|
|
||||||
DynamicListEconLimited dynamic_list_econ_limited;
|
DynamicListEconLimited dynamic_list_econ_limited;
|
||||||
SimulatorReport report;
|
SimulatorReport report;
|
||||||
SimulatorReport stepReport;
|
SimulatorReport stepReport;
|
||||||
@ -229,6 +227,9 @@ public:
|
|||||||
OpmLog::note(ss.str());
|
OpmLog::note(ss.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: not used at all, keeping it for interface purpose.
|
||||||
|
|
||||||
|
std::vector<double> well_potentials;
|
||||||
// Create wells and well state.
|
// Create wells and well state.
|
||||||
WellsManager wells_manager(eclState(),
|
WellsManager wells_manager(eclState(),
|
||||||
timer.currentStepNum(),
|
timer.currentStepNum(),
|
||||||
@ -395,11 +396,6 @@ public:
|
|||||||
report.output_write_time += perfTimer.stop();
|
report.output_write_time += perfTimer.stop();
|
||||||
|
|
||||||
prev_well_state = well_state;
|
prev_well_state = well_state;
|
||||||
// The well potentials are only computed if they are needed
|
|
||||||
// For now thay are only used to determine default guide rates for group controlled wells
|
|
||||||
if ( is_well_potentials_computed ) {
|
|
||||||
computeWellPotentials(wells, well_state, well_potentials);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateListEconLimited(solver, eclState().getSchedule(), timer.currentStepNum(), wells,
|
updateListEconLimited(solver, eclState().getSchedule(), timer.currentStepNum(), wells,
|
||||||
well_state, dynamic_list_econ_limited);
|
well_state, dynamic_list_econ_limited);
|
||||||
@ -605,23 +601,6 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void computeWellPotentials(const Wells* wells,
|
|
||||||
const WellState& xw,
|
|
||||||
std::vector<double>& well_potentials)
|
|
||||||
{
|
|
||||||
const int nw = wells->number_of_wells;
|
|
||||||
const int np = wells->number_of_phases;
|
|
||||||
well_potentials.clear();
|
|
||||||
well_potentials.resize(nw*np,0.0);
|
|
||||||
for (int w = 0; w < nw; ++w) {
|
|
||||||
for (int perf = wells->well_connpos[w]; perf < wells->well_connpos[w + 1]; ++perf) {
|
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
|
||||||
well_potentials[w*np + phase] += xw.wellPotentials()[perf*np + phase];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void updateListEconLimited(const std::unique_ptr<Solver>& solver,
|
void updateListEconLimited(const std::unique_ptr<Solver>& solver,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
|
@ -243,16 +243,12 @@ enum WellVariablePositions {
|
|||||||
const double grav);
|
const double grav);
|
||||||
|
|
||||||
|
|
||||||
// TODO: Later we might want to change the function to only handle one well,
|
// Calculating well potentials for each well
|
||||||
// the requirement for well potential calculation can be based on individual wells.
|
// TODO: getBhp() will be refactored to reduce the duplication of the code calculating the bhp from THP.
|
||||||
// getBhp() will be refactored to reduce the duplication of the code calculating the bhp from THP.
|
|
||||||
template<typename Simulator>
|
template<typename Simulator>
|
||||||
void
|
void
|
||||||
computeWellPotentials(const Simulator& ebosSimulator,
|
computeWellPotentials(const Simulator& ebosSimulator,
|
||||||
WellState& well_state) const;
|
const WellState& well_state,
|
||||||
|
|
||||||
// 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;
|
std::vector<double>& well_potentials) const;
|
||||||
|
|
||||||
// TODO: some preparation work, mostly related to group control and RESV,
|
// TODO: some preparation work, mostly related to group control and RESV,
|
||||||
|
@ -134,10 +134,6 @@ namespace Opm {
|
|||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param_.compute_well_potentials_) {
|
|
||||||
computeWellPotentials(ebosSimulator, well_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
resetWellControlFromState(well_state);
|
resetWellControlFromState(well_state);
|
||||||
updateWellControls(well_state);
|
updateWellControls(well_state);
|
||||||
// Set the primary variables for the wells
|
// Set the primary variables for the wells
|
||||||
@ -1703,13 +1699,16 @@ namespace Opm {
|
|||||||
void
|
void
|
||||||
StandardWellsDense<FluidSystem, BlackoilIndices, ElementContext, MaterialLaw>::
|
StandardWellsDense<FluidSystem, BlackoilIndices, ElementContext, MaterialLaw>::
|
||||||
computeWellPotentials(const Simulator& ebosSimulator,
|
computeWellPotentials(const Simulator& ebosSimulator,
|
||||||
WellState& well_state) const
|
const WellState& well_state,
|
||||||
|
std::vector<double>& well_potentials) const
|
||||||
{
|
{
|
||||||
|
|
||||||
// number of wells and phases
|
// number of wells and phases
|
||||||
const int nw = wells().number_of_wells;
|
const int nw = wells().number_of_wells;
|
||||||
const int np = wells().number_of_phases;
|
const int np = wells().number_of_phases;
|
||||||
|
|
||||||
|
well_potentials.resize(nw * np, 0.0);
|
||||||
|
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
// bhp needs to be determined for the well potential calculation
|
// bhp needs to be determined for the well potential calculation
|
||||||
// There can be more than one BHP/THP constraints.
|
// There can be more than one BHP/THP constraints.
|
||||||
@ -1783,7 +1782,6 @@ namespace Opm {
|
|||||||
const double& alq = well_controls_iget_alq(well_control, ctrl_index);
|
const double& alq = well_controls_iget_alq(well_control, ctrl_index);
|
||||||
|
|
||||||
// Calculating the BHP value based on THP
|
// Calculating the BHP value based on THP
|
||||||
const WellType& well_type = wells().type[w];
|
|
||||||
const int first_perf = wells().well_connpos[w]; //first perforation
|
const int first_perf = wells().well_connpos[w]; //first perforation
|
||||||
|
|
||||||
if (well_type == INJECTOR) {
|
if (well_type == INJECTOR) {
|
||||||
@ -1819,12 +1817,12 @@ namespace Opm {
|
|||||||
for (int perf = wells().well_connpos[w]; perf < wells().well_connpos[w+1]; ++perf) {
|
for (int perf = wells().well_connpos[w]; perf < wells().well_connpos[w+1]; ++perf) {
|
||||||
const int cell_index = wells().well_cells[perf];
|
const int cell_index = wells().well_cells[perf];
|
||||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_index, /*timeIdx=*/ 0));
|
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_index, /*timeIdx=*/ 0));
|
||||||
std::vector<EvalWell> well_potentials(np, 0.0);
|
std::vector<EvalWell> well_potentials_perf(np, 0.0);
|
||||||
std::vector<EvalWell> mob(np, 0.0);
|
std::vector<EvalWell> mob(np, 0.0);
|
||||||
getMobility(ebosSimulator, perf, cell_index, mob);
|
getMobility(ebosSimulator, perf, cell_index, mob);
|
||||||
computeWellFlux(w, wells().WI[perf], intQuants.fluidState(), mob, bhp, wellPerforationPressureDiffs()[perf], allow_cf, well_potentials);
|
computeWellFlux(w, wells().WI[perf], intQuants.fluidState(), mob, bhp, wellPerforationPressureDiffs()[perf], allow_cf, well_potentials_perf);
|
||||||
for(int p = 0; p < np; ++p) {
|
for(int p = 0; p < np; ++p) {
|
||||||
well_state.wellPotentials()[perf * np + p] = well_potentials[p].value();
|
well_potentials[w * np + p] += std::abs(well_potentials_perf[p].value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end of for (int w = 0; w < nw; ++w)
|
} // end of for (int w = 0; w < nw; ++w)
|
||||||
@ -1852,12 +1850,10 @@ namespace Opm {
|
|||||||
setWellVariables(well_state);
|
setWellVariables(well_state);
|
||||||
computeWellConnectionPressures(ebos_simulator, well_state);
|
computeWellConnectionPressures(ebos_simulator, well_state);
|
||||||
|
|
||||||
computeWellPotentials(ebos_simulator, well_state);
|
|
||||||
|
|
||||||
// To store well potentials for each well
|
// To store well potentials for each well
|
||||||
std::vector<double> well_potentials;
|
std::vector<double> well_potentials;
|
||||||
|
|
||||||
computeWellPotentials(well_state, well_potentials);
|
computeWellPotentials(ebos_simulator, well_state, well_potentials);
|
||||||
|
|
||||||
// update/setup guide rates for each well based on the well_potentials
|
// update/setup guide rates for each well based on the well_potentials
|
||||||
well_collection_->setGuideRates(wellsPointer(), phase_usage_, well_potentials);
|
well_collection_->setGuideRates(wellsPointer(), phase_usage_, well_potentials);
|
||||||
|
Loading…
Reference in New Issue
Block a user