mirror of
				https://github.com/OPM/opm-simulators.git
				synced 2025-02-25 18:55:30 -06:00 
			
		
		
		
	Avoid expensive schedule.getWells() call and also update BlackoilWellModel_impl.hpp to use new signature of updateWellsDefaultALQ
This commit is contained in:
		| @@ -451,7 +451,7 @@ namespace Opm { | ||||
|         this->updateAndCommunicateGroupData(reportStepIdx, | ||||
|                                             simulator_.model().newtonMethod().numIterations()); | ||||
|  | ||||
|         this->wellState().updateWellsDefaultALQ(this->wells_ecl_, this->summaryState()); | ||||
|         this->wellState().updateWellsDefaultALQ(this->schedule(), reportStepIdx, this->summaryState()); | ||||
|         this->wellState().gliftTimeStepInit(); | ||||
|  | ||||
|         const double simulationTime = simulator_.time(); | ||||
|   | ||||
| @@ -424,9 +424,7 @@ void WellState<Scalar>::init(const std::vector<Scalar>& cellPressures, | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // ALQ state needs to be defined for all wells, otherwise alqstate.packSize() will be different | ||||
|     // on each process, and the comm.sum call in communicateGroupRates will fail. | ||||
|     updateWellsDefaultALQ(schedule.getWells(report_step), summary_state); | ||||
|     updateWellsDefaultALQ(schedule, report_step, summary_state); | ||||
| } | ||||
|  | ||||
| template<class Scalar> | ||||
| @@ -1030,19 +1028,19 @@ bool WellState<Scalar>::wellIsOwned(const std::string& wellName) const | ||||
|     return wellIsOwned(well_index.value(), wellName); | ||||
| } | ||||
|  | ||||
| template<class Scalar> | ||||
| void WellState<Scalar>:: | ||||
| updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, | ||||
|                       const SummaryState& summary_state) | ||||
| template <typename Scalar> | ||||
| void WellState<Scalar>::updateWellsDefaultALQ(const Schedule& schedule, | ||||
|                                               const int report_step, | ||||
|                                               const SummaryState& summary_state) | ||||
| { | ||||
|     const int nw = wells_ecl.size(); | ||||
|     for (int i = 0; i<nw; i++) { | ||||
|         const Well &well = wells_ecl[i]; | ||||
|         if (well.isProducer()) { | ||||
|             // NOTE: This is the value set in item 12 of WCONPROD, or with WELTARG | ||||
|             auto alq = well.alq_value(summary_state); | ||||
|             this->alq_state.update_default(well.name(), alq); | ||||
|     const auto wells = schedule.wellNames(report_step); | ||||
|     for (const auto& wname : wells) { | ||||
|         const auto& well = schedule.getWell(wname, report_step); | ||||
|         if (! well.isProducer()) { | ||||
|             continue; | ||||
|         } | ||||
|         const auto alq = well.alq_value(summary_state); | ||||
|         this->alq_state.update_default(wname, alq); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -227,8 +227,9 @@ public: | ||||
|     // reset current_alq and update default_alq. ALQ is used for | ||||
|     // constant lift gas injection and for gas lift optimization | ||||
|     // (THP controlled wells). | ||||
|     void updateWellsDefaultALQ(const std::vector<Well>& wells_ecl, | ||||
|                                const SummaryState& summary_state); | ||||
|     void updateWellsDefaultALQ(const Schedule& schedule, | ||||
|                               const int report_step, | ||||
|                               const SummaryState& summary_state); | ||||
|  | ||||
|     int wellNameToGlobalIdx(const std::string& name) | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user