recovering the interface of function createWellContainer

in BlackoilWellModel, which makes its usage easier.
This commit is contained in:
Kai Bao 2019-07-31 16:15:41 +02:00
parent 4d8afb8539
commit fec9d1feee
2 changed files with 42 additions and 44 deletions

View File

@ -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;

View File

@ -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,7 +542,6 @@ 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
@ -577,21 +576,20 @@ namespace Opm {
continue; continue;
} else { } else {
// close wells are added to the container but marked as closed // close wells are added to the container but marked as closed
struct WellControls* well_controls = wells->ctrls[w]; struct WellControls* well_controls = wells()->ctrls[w];
well_controls_stop_well(well_controls); 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 {