diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index d2e122a791d..fc2999ff155 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -96,8 +96,8 @@ namespace Opm { this->alternative_well_rate_init_ = Parameters::Get(); - using SourceDataSpan = typename - PAvgDynamicSourceData::template SourceDataSpan; + using SourceDataSpan = + typename PAvgDynamicSourceData::template SourceDataSpan; this->wbpCalculationService_ .localCellIndex([this](const std::size_t globalIndex) @@ -1270,7 +1270,7 @@ namespace Opm { } // This function is to be used for well groups in an extended network that act as a subsea manifold - // The wells of such group should have a common THP and total phase rate(s) obeying (if possible) + // The wells of such group should have a common THP and total phase rate(s) obeying (if possible) // the well group constraint set by GCONPROD template void @@ -1299,7 +1299,7 @@ namespace Opm { const auto pu = this->phase_usage_; //TODO: Auto choke combined with RESV control is not supported std::vector resv_coeff(pu.num_phases, 1.0); - Scalar gratTargetFromSales = 0.0; + Scalar gratTargetFromSales = 0.0; if (group_state.has_grat_sales_target(group.name())) gratTargetFromSales = group_state.grat_sales_target(group.name()); @@ -2356,7 +2356,7 @@ namespace Opm { this->groupState(), this->wellState(), deferred_logger); - + if (changed_individual) { changed = true; updateAndCommunicate(reportStepIdx, iterationIdx, deferred_logger); @@ -2734,14 +2734,18 @@ namespace Opm { const int nw = this->numLocalWells(); for (auto wellID = 0*nw; wellID < nw; ++wellID) { const Well& well = this->wells_ecl_[wellID]; - if (well.isInjector()) - continue; + auto& ws = this->wellState().well(wellID); + if (well.isInjector()){ + if( !(ws.status == WellStatus::STOP)){ + this->wellState().well(wellID).temperature = well.inj_temperature(); + continue; + } + } std::array weighted{0.0,0.0}; auto& [weighted_temperature, total_weight] = weighted; auto& well_info = this->local_parallel_well_info_[wellID].get(); - auto& ws = this->wellState().well(wellID); auto& perf_data = ws.perf_data; auto& perf_phase_rate = perf_data.phase_rates; @@ -2766,6 +2770,7 @@ namespace Opm { perfPhaseRate = perf_phase_rate[ perf*np + phaseIdx ]; weight_factor += cellDensity * perfPhaseRate/cellBinv * cellInternalEnergy/cellTemperatures; } + weight_factor = std::abs(weight_factor)+1e-13; total_weight += weight_factor; weighted_temperature += weight_factor * cellTemperatures; }