mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-28 20:13:49 -06:00
recovering the interface of function createWellContainer
in BlackoilWellModel, which makes its usage easier.
This commit is contained in:
parent
4d8afb8539
commit
fec9d1feee
@ -251,7 +251,7 @@ namespace Opm {
|
|||||||
std::vector<bool> is_cell_perforated_;
|
std::vector<bool> is_cell_perforated_;
|
||||||
|
|
||||||
// create the well container
|
// create the well container
|
||||||
std::vector<WellInterfacePtr > createWellContainer(const int time_step, const Wells* wells, const bool allow_closing_opening_wells, Opm::DeferredLogger& deferred_logger);
|
std::vector<WellInterfacePtr > createWellContainer(const int time_step, Opm::DeferredLogger& deferred_logger);
|
||||||
|
|
||||||
WellInterfacePtr createWellForWellTest(const std::string& well_name, const int report_step, Opm::DeferredLogger& deferred_logger) const;
|
WellInterfacePtr createWellForWellTest(const std::string& well_name, const int report_step, Opm::DeferredLogger& deferred_logger) const;
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ namespace Opm {
|
|||||||
wellTesting(reportStepIdx, simulationTime, local_deferredLogger);
|
wellTesting(reportStepIdx, simulationTime, local_deferredLogger);
|
||||||
|
|
||||||
// create the well container
|
// create the well container
|
||||||
well_container_ = createWellContainer(reportStepIdx, wells(), /*allow_closing_opening_wells=*/true, local_deferredLogger);
|
well_container_ = createWellContainer(reportStepIdx, local_deferredLogger);
|
||||||
|
|
||||||
// do the initialization for all the wells
|
// do the initialization for all the wells
|
||||||
// TODO: to see whether we can postpone of the intialization of the well containers to
|
// TODO: to see whether we can postpone of the intialization of the well containers to
|
||||||
@ -512,7 +512,7 @@ namespace Opm {
|
|||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::vector<typename BlackoilWellModel<TypeTag>::WellInterfacePtr >
|
std::vector<typename BlackoilWellModel<TypeTag>::WellInterfacePtr >
|
||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
createWellContainer(const int time_step, const Wells* wells, const bool allow_closing_opening_wells, Opm::DeferredLogger& deferred_logger)
|
createWellContainer(const int time_step, Opm::DeferredLogger& deferred_logger)
|
||||||
{
|
{
|
||||||
std::vector<WellInterfacePtr> well_container;
|
std::vector<WellInterfacePtr> well_container;
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ namespace Opm {
|
|||||||
// With the following way, it will have the same order with wells struct
|
// With the following way, it will have the same order with wells struct
|
||||||
// Hopefully, it can generate the same residual history with master branch
|
// Hopefully, it can generate the same residual history with master branch
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
const std::string well_name = std::string(wells->name[w]);
|
const std::string well_name = std::string(wells()->name[w]);
|
||||||
|
|
||||||
// finding the location of the well in wells_ecl
|
// finding the location of the well in wells_ecl
|
||||||
const int nw_wells_ecl = wells_ecl_.size();
|
const int nw_wells_ecl = wells_ecl_.size();
|
||||||
@ -542,56 +542,54 @@ namespace Opm {
|
|||||||
|
|
||||||
const Well2& well_ecl = wells_ecl_[index_well];
|
const Well2& well_ecl = wells_ecl_[index_well];
|
||||||
|
|
||||||
if (allow_closing_opening_wells) {
|
// A new WCON keywords can re-open a well that was closed/shut due to Physical limit
|
||||||
// A new WCON keywords can re-open a well that was closed/shut due to Physical limit
|
if ( wellTestState_.hasWellClosed(well_name)) {
|
||||||
if ( wellTestState_.hasWellClosed(well_name)) {
|
// TODO: more checking here, to make sure this standard more specific and complete
|
||||||
// TODO: more checking here, to make sure this standard more specific and complete
|
// maybe there is some WCON keywords will not open the well
|
||||||
// maybe there is some WCON keywords will not open the well
|
if (well_state_.effectiveEventsOccurred(w)) {
|
||||||
if (well_state_.effectiveEventsOccurred(w)) {
|
if (wellTestState_.lastTestTime(well_name) == ebosSimulator_.time()) {
|
||||||
if (wellTestState_.lastTestTime(well_name) == ebosSimulator_.time()) {
|
// The well was shut this timestep, we are most likely retrying
|
||||||
// The well was shut this timestep, we are most likely retrying
|
// a timestep without the well in question, after it caused
|
||||||
// a timestep without the well in question, after it caused
|
// repeated timestep cuts. It should therefore not be opened,
|
||||||
// repeated timestep cuts. It should therefore not be opened,
|
// even if it was new or received new targets this report step.
|
||||||
// even if it was new or received new targets this report step.
|
well_state_.setEffectiveEventsOccurred(w, false);
|
||||||
well_state_.setEffectiveEventsOccurred(w, false);
|
|
||||||
} else {
|
|
||||||
wellTestState_.openWell(well_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: should we do this for all kinds of closing reasons?
|
|
||||||
// something like wellTestState_.hasWell(well_name)?
|
|
||||||
if ( wellTestState_.hasWellClosed(well_name, WellTestConfig::Reason::ECONOMIC) ||
|
|
||||||
wellTestState_.hasWellClosed(well_name, WellTestConfig::Reason::PHYSICAL) ) {
|
|
||||||
if( well_ecl.getAutomaticShutIn() ) {
|
|
||||||
// shut wells are not added to the well container
|
|
||||||
// TODO: make a function from well_state side to handle the following
|
|
||||||
well_state_.thp()[w] = 0.;
|
|
||||||
well_state_.bhp()[w] = 0.;
|
|
||||||
const int np = numPhases();
|
|
||||||
for (int p = 0; p < np; ++p) {
|
|
||||||
well_state_.wellRates()[np * w + p] = 0.;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
} else {
|
} else {
|
||||||
// close wells are added to the container but marked as closed
|
wellTestState_.openWell(well_name);
|
||||||
struct WellControls* well_controls = wells->ctrls[w];
|
|
||||||
well_controls_stop_well(well_controls);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: should we do this for all kinds of closing reasons?
|
||||||
|
// something like wellTestState_.hasWell(well_name)?
|
||||||
|
if ( wellTestState_.hasWellClosed(well_name, WellTestConfig::Reason::ECONOMIC) ||
|
||||||
|
wellTestState_.hasWellClosed(well_name, WellTestConfig::Reason::PHYSICAL) ) {
|
||||||
|
if( well_ecl.getAutomaticShutIn() ) {
|
||||||
|
// shut wells are not added to the well container
|
||||||
|
// TODO: make a function from well_state side to handle the following
|
||||||
|
well_state_.thp()[w] = 0.;
|
||||||
|
well_state_.bhp()[w] = 0.;
|
||||||
|
const int np = numPhases();
|
||||||
|
for (int p = 0; p < np; ++p) {
|
||||||
|
well_state_.wellRates()[np * w + p] = 0.;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
// close wells are added to the container but marked as closed
|
||||||
|
struct WellControls* well_controls = wells()->ctrls[w];
|
||||||
|
well_controls_stop_well(well_controls);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Use the pvtRegionIdx from the top cell
|
// Use the pvtRegionIdx from the top cell
|
||||||
const int well_cell_top = wells->well_cells[wells->well_connpos[w]];
|
const int well_cell_top = wells()->well_cells[wells()->well_connpos[w]];
|
||||||
const int pvtreg = pvt_region_idx_[well_cell_top];
|
const int pvtreg = pvt_region_idx_[well_cell_top];
|
||||||
|
|
||||||
if ( !well_ecl.isMultiSegment() || !param_.use_multisegment_well_) {
|
if ( !well_ecl.isMultiSegment() || !param_.use_multisegment_well_) {
|
||||||
well_container.emplace_back(new StandardWell<TypeTag>(well_ecl, time_step, wells,
|
well_container.emplace_back(new StandardWell<TypeTag>(well_ecl, time_step, wells(),
|
||||||
param_, *rateConverter_, pvtreg, numComponents() ) );
|
param_, *rateConverter_, pvtreg, numComponents() ) );
|
||||||
} else {
|
} else {
|
||||||
well_container.emplace_back(new MultisegmentWell<TypeTag>(well_ecl, time_step, wells,
|
well_container.emplace_back(new MultisegmentWell<TypeTag>(well_ecl, time_step, wells(),
|
||||||
param_, *rateConverter_, pvtreg, numComponents() ) );
|
param_, *rateConverter_, pvtreg, numComponents() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1076,8 +1074,8 @@ namespace Opm {
|
|||||||
std::vector< Scalar > B_avg(numComponents(), Scalar() );
|
std::vector< Scalar > B_avg(numComponents(), Scalar() );
|
||||||
computeAverageFormationFactor(B_avg);
|
computeAverageFormationFactor(B_avg);
|
||||||
|
|
||||||
|
const int reportStepIdx = ebosSimulator_.episodeIndex();
|
||||||
const Opm::SummaryConfig& summaryConfig = ebosSimulator_.vanguard().summaryConfig();
|
const Opm::SummaryConfig& summaryConfig = ebosSimulator_.vanguard().summaryConfig();
|
||||||
const auto& summaryState = ebosSimulator_.vanguard().summaryState();
|
|
||||||
const bool write_restart_file = ebosSimulator_.vanguard().eclState().getRestartConfig().getWriteRestartFile(reportStepIdx);
|
const bool write_restart_file = ebosSimulator_.vanguard().eclState().getRestartConfig().getWriteRestartFile(reportStepIdx);
|
||||||
int exception_thrown = 0;
|
int exception_thrown = 0;
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user