Skip to content

Commit

Permalink
Merge pull request OPM#5305 from hnil/shut_inj_temp
Browse files Browse the repository at this point in the history
fixing some of output
  • Loading branch information
atgeirr authored Sep 17, 2024
2 parents 7ae70ef + c000678 commit 9c74c4d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions opm/simulators/wells/BlackoilWellModel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ namespace Opm {
this->alternative_well_rate_init_ =
Parameters::Get<Parameters::AlternativeWellRateInit>();

using SourceDataSpan = typename
PAvgDynamicSourceData<Scalar>::template SourceDataSpan<Scalar>;
using SourceDataSpan =
typename PAvgDynamicSourceData<Scalar>::template SourceDataSpan<Scalar>;

this->wbpCalculationService_
.localCellIndex([this](const std::size_t globalIndex)
Expand Down Expand Up @@ -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 <typename TypeTag>
void
Expand Down Expand Up @@ -1299,7 +1299,7 @@ namespace Opm {
const auto pu = this->phase_usage_;
//TODO: Auto choke combined with RESV control is not supported
std::vector<Scalar> 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());

Expand Down Expand Up @@ -2356,7 +2356,7 @@ namespace Opm {
this->groupState(),
this->wellState(),
deferred_logger);

if (changed_individual) {
changed = true;
updateAndCommunicate(reportStepIdx, iterationIdx, deferred_logger);
Expand Down Expand Up @@ -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<Scalar,2> 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;

Expand All @@ -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;
}
Expand Down

0 comments on commit 9c74c4d

Please sign in to comment.