Adapt to inj prefix and cleanup

This commit is contained in:
Tor Harald Sandve 2024-08-01 11:20:00 +02:00
parent 5f8916c0c3
commit f678c082de
3 changed files with 10 additions and 9 deletions

View File

@ -2587,7 +2587,7 @@ namespace Opm
if (this->isInjector() && cq_s[activeCompIdx] > 0.0){ if (this->isInjector() && cq_s[activeCompIdx] > 0.0){
// only handles single phase injection now // only handles single phase injection now
assert(this->well_ecl_.injectorType() != InjectorType::MULTI); assert(this->well_ecl_.injectorType() != InjectorType::MULTI);
fs.setTemperature(this->well_ecl_.temperature()); fs.setTemperature(this->well_ecl_.inj_temperature());
typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar; typedef typename std::decay<decltype(fs)>::type::Scalar FsScalar;
typename FluidSystem::template ParameterCache<FsScalar> paramCache; typename FluidSystem::template ParameterCache<FsScalar> paramCache;
const unsigned pvtRegionIdx = intQuants.pvtRegionIndex(); const unsigned pvtRegionIdx = intQuants.pvtRegionIndex();

View File

@ -208,10 +208,7 @@ void WellState<Scalar>::initSingleInjector(const Well& well,
const SummaryState& summary_state) const SummaryState& summary_state)
{ {
const auto& pu = this->phase_usage_; const auto& pu = this->phase_usage_;
Scalar temp = temperature_first_connection; const Scalar temp = well.hasInjTemperature() ? well.inj_temperature() : temperature_first_connection;
if (well.hasTemperature()) {
temp = well.temperature();
}
auto& ws = this->wells_.add(well.name(), SingleWellState<Scalar>{well.name(), auto& ws = this->wells_.add(well.name(), SingleWellState<Scalar>{well.name(),
well_info, well_info,
false, false,
@ -239,15 +236,17 @@ void WellState<Scalar>::initSingleWell(const std::vector<Scalar>& cellPressures,
const SummaryState& summary_state) const SummaryState& summary_state)
{ {
Scalar pressure_first_connection = -1; Scalar pressure_first_connection = -1;
Scalar temperature_first_connection = -1;
if (!well_perf_data.empty()) { if (!well_perf_data.empty()) {
pressure_first_connection = cellPressures[well_perf_data[0].cell_index]; 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); pressure_first_connection = well_info.broadcastFirstPerforationValue(pressure_first_connection);
temperature_first_connection = well_info.broadcastFirstPerforationValue(temperature_first_connection);
if (well.isInjector()) { 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, this->initSingleInjector(well, well_info, pressure_first_connection, temperature_first_connection,
well_perf_data, summary_state); well_perf_data, summary_state);
} else { } else {

View File

@ -158,9 +158,11 @@ namespace {
std::vector<double>(setup.grid.c_grid()->number_of_cells, std::vector<double>(setup.grid.c_grid()->number_of_cells,
100.0*Opm::unit::barsa); 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 = const auto ctemp =
std::vector<double>(setup.grid.c_grid()->number_of_cells, std::vector<double>(setup.grid.c_grid()->number_of_cells,
25+Opm::unit::degCelsiusOffset); temp);
auto wells = setup.sched.getWells(timeStep); auto wells = setup.sched.getWells(timeStep);
pinfos.resize(wells.size()); pinfos.resize(wells.size());