From af254a8f4d18923a8719c3ab0c93dbef8e7d84f5 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Wed, 26 Jul 2017 15:27:39 +0200 Subject: [PATCH] removing some of the using of Wells in StandardWellsDense --- opm/autodiff/StandardWellsDense.hpp | 1 - opm/autodiff/StandardWellsDense_impl.hpp | 31 ++++++++++++------------ opm/autodiff/WellInterface_impl.hpp | 2 -- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/opm/autodiff/StandardWellsDense.hpp b/opm/autodiff/StandardWellsDense.hpp index 4d26eb4bb..b0cf3e28c 100644 --- a/opm/autodiff/StandardWellsDense.hpp +++ b/opm/autodiff/StandardWellsDense.hpp @@ -83,7 +83,6 @@ namespace Opm { typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; static const int numEq = BlackoilIndices::numEq; - static const int numWellEq = GET_PROP_VALUE(TypeTag, EnablePolymer)? numEq-1 : numEq; // //numEq; //number of wellEq is only numEq for polymer static const int solventSaturationIdx = BlackoilIndices::solventSaturationIdx; // TODO: where we should put these types, WellInterface or Well Model? diff --git a/opm/autodiff/StandardWellsDense_impl.hpp b/opm/autodiff/StandardWellsDense_impl.hpp index 7f670407a..ef70793c9 100644 --- a/opm/autodiff/StandardWellsDense_impl.hpp +++ b/opm/autodiff/StandardWellsDense_impl.hpp @@ -61,12 +61,11 @@ namespace Opm { calculateEfficiencyFactors(); - const int nw = wells().number_of_wells; - const int nperf = wells().well_connpos[nw]; + const int nw = number_of_wells_; const int nc = numCells(); #ifndef NDEBUG - const auto pu = phase_usage_; + const auto& pu = phase_usage_; const int np = pu.num_phases; // assumes the gas fractions are stored after water fractions @@ -331,7 +330,7 @@ namespace Opm { StandardWellsDense:: numPhases() const { - return wells().number_of_phases; + return number_of_phases_; } @@ -420,7 +419,7 @@ namespace Opm { StandardWellsDense:: localWellsActive() const { - return wells_ ? (wells_->number_of_wells > 0 ) : false; + return number_of_wells_ > 0; } @@ -462,7 +461,7 @@ namespace Opm { const double dt, WellState& well_state) { - const int nw = wells().number_of_wells; + const int nw = number_of_wells_; WellState well_state0 = well_state; const int numComp = numComponents(); @@ -507,7 +506,7 @@ namespace Opm { well_state = well_state0; // also recover the old well controls for (int w = 0; w < nw; ++w) { - WellControls* wc = wells().ctrls[w]; + WellControls* wc = well_container_[w]->wellControls(); well_controls_set_current(wc, well_state.currentControls()[w]); } } @@ -549,7 +548,7 @@ namespace Opm { return std::vector(); } - const int nw = wells().number_of_wells; + const int nw = number_of_wells_; const int numComp = numComponents(); std::vector res(numEq*nw, 0.0); for( int compIdx = 0; compIdx < numComp; ++compIdx) { @@ -706,7 +705,7 @@ namespace Opm { prepareTimeStep(const Simulator& ebos_simulator, WellState& well_state) { - const int nw = wells().number_of_wells; + const int nw = number_of_wells_; for (int w = 0; w < nw; ++w) { // after restarting, the well_controls can be modified while // the well_state still uses the old control index @@ -714,8 +713,8 @@ namespace Opm { resetWellControlFromState(well_state); if (wellCollection()->groupControlActive()) { - WellControls* wc = wells().ctrls[w]; - WellNode& well_node = well_collection_->findWellNode(std::string(wells().name[w])); + WellControls* wc = well_container_[w]->wellControls(); + WellNode& well_node = well_collection_->findWellNode(well_container_[w]->name()); // handling the situation that wells do not have a valid control // it happens the well specified with GRUP and restarting due to non-convergencing @@ -768,7 +767,7 @@ namespace Opm { // since the controls are all updated, we should update well_state accordingly for (int w = 0; w < nw; ++w) { - WellControls* wc = wells().ctrls[w]; + WellControls* wc = well_container_[w]->wellControls(); const int control = well_controls_get_current(wc); well_state.currentControls()[w] = control; well_container_[w]->updateWellStateWithTarget(control, well_state); @@ -806,7 +805,7 @@ namespace Opm { return; } - const int nw = wells().number_of_wells; + const int nw = number_of_wells_; for (int w = 0; w < nw; ++w) { const std::string well_name = well_container_[w]->name(); @@ -849,7 +848,7 @@ namespace Opm { std::vector convert_coeff(np, 1.0); for (int w = 0; w < nw; ++w) { - const bool is_producer = wells().type[w] == PRODUCER; + const bool is_producer = well_container_[w]->wellType() == PRODUCER; // not sure necessary to change all the value to be positive if (is_producer) { @@ -899,7 +898,7 @@ namespace Opm { const int well_index = well_node->selfIndex(); well_state.currentControls()[well_index] = well_node->groupControlIndex(); - WellControls* wc = wells().ctrls[well_index]; + WellControls* wc = well_container_[well_index]->wellControls(); well_controls_set_current(wc, well_node->groupControlIndex()); } } @@ -975,7 +974,7 @@ namespace Opm { return; } - const int nw = wells().number_of_wells; + const int nw = number_of_wells_; const int nperf = wells().well_connpos[nw]; const size_t timeStep = current_timeIdx_; diff --git a/opm/autodiff/WellInterface_impl.hpp b/opm/autodiff/WellInterface_impl.hpp index 961961ce5..82564377d 100644 --- a/opm/autodiff/WellInterface_impl.hpp +++ b/opm/autodiff/WellInterface_impl.hpp @@ -30,8 +30,6 @@ namespace Opm , current_step_(time_step) { - // TODO: trying to use wells struct as little as possible here, be prepared to - // remove the wells struct in future const std::string& well_name = well->name(); // looking for the location of the well in the wells struct