From f678c082de2fb85053cf006b094cc7bcaf66810b Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 1 Aug 2024 11:20:00 +0200 Subject: [PATCH] Adapt to inj prefix and cleanup --- opm/simulators/wells/StandardWell_impl.hpp | 2 +- opm/simulators/wells/WellState.cpp | 13 ++++++------- tests/test_wellstate.cpp | 4 +++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 1711db775..78cfa60e9 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -2587,7 +2587,7 @@ namespace Opm if (this->isInjector() && cq_s[activeCompIdx] > 0.0){ // only handles single phase injection now assert(this->well_ecl_.injectorType() != InjectorType::MULTI); - fs.setTemperature(this->well_ecl_.temperature()); + fs.setTemperature(this->well_ecl_.inj_temperature()); typedef typename std::decay::type::Scalar FsScalar; typename FluidSystem::template ParameterCache paramCache; const unsigned pvtRegionIdx = intQuants.pvtRegionIndex(); diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index 34fcf808c..2e8cde496 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -208,10 +208,7 @@ void WellState::initSingleInjector(const Well& well, const SummaryState& summary_state) { const auto& pu = this->phase_usage_; - Scalar temp = temperature_first_connection; - if (well.hasTemperature()) { - temp = well.temperature(); - } + const Scalar temp = well.hasInjTemperature() ? well.inj_temperature() : temperature_first_connection; auto& ws = this->wells_.add(well.name(), SingleWellState{well.name(), well_info, false, @@ -239,15 +236,17 @@ void WellState::initSingleWell(const std::vector& cellPressures, const SummaryState& summary_state) { Scalar pressure_first_connection = -1; - Scalar temperature_first_connection = -1; if (!well_perf_data.empty()) { pressure_first_connection = cellPressures[well_perf_data[0].cell_index]; - temperature_first_connection = cellTemperatures[well_perf_data[0].cell_index]; } pressure_first_connection = well_info.broadcastFirstPerforationValue(pressure_first_connection); - temperature_first_connection = well_info.broadcastFirstPerforationValue(temperature_first_connection); if (well.isInjector()) { + Scalar temperature_first_connection = -1; + if (!well_perf_data.empty()) { + temperature_first_connection = cellTemperatures[well_perf_data[0].cell_index]; + } + temperature_first_connection = well_info.broadcastFirstPerforationValue(temperature_first_connection); this->initSingleInjector(well, well_info, pressure_first_connection, temperature_first_connection, well_perf_data, summary_state); } else { diff --git a/tests/test_wellstate.cpp b/tests/test_wellstate.cpp index 2a075769c..e2bdf947d 100644 --- a/tests/test_wellstate.cpp +++ b/tests/test_wellstate.cpp @@ -158,9 +158,11 @@ namespace { std::vector(setup.grid.c_grid()->number_of_cells, 100.0*Opm::unit::barsa); + const auto& unit_sytem = setup.es.getDeckUnitSystem(); + const double temp = unit_sytem.to_si(Opm::UnitSystem::measure::temperature, 25); const auto ctemp = std::vector(setup.grid.c_grid()->number_of_cells, - 25+Opm::unit::degCelsiusOffset); + temp); auto wells = setup.sched.getWells(timeStep); pinfos.resize(wells.size());