Skip to content

Commit

Permalink
Restore tracer cumulatives WTIT and WTPT
Browse files Browse the repository at this point in the history
  • Loading branch information
joakim-hove committed Nov 30, 2021
1 parent bdd933f commit b950198
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/opm/output/eclipse/LoadRestart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <opm/output/eclipse/RestartValue.hpp>

#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/TracerConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
Expand All @@ -70,6 +71,7 @@
#include <unordered_set>
#include <utility>
#include <vector>
#include <fmt/format.h>

#include <boost/range.hpp>

Expand Down Expand Up @@ -1434,6 +1436,8 @@ namespace {

void assign_well_cumulatives(const std::string& well,
const std::size_t wellID,
const Opm::Tracers& tracer_dims,
const Opm::TracerConfig& tracer_config,
const WellVectors& wellData,
Opm::SummaryState& smry)
{
Expand Down Expand Up @@ -1466,6 +1470,15 @@ namespace {

smry.update_well_var(well, "WWITH", xwel[VI::XWell::index::HistWatInjTotal]);
smry.update_well_var(well, "WGITH", xwel[VI::XWell::index::HistGasInjTotal]);

for (std::size_t tracer_index = 0; tracer_index < tracer_config.size(); tracer_index++) {
const auto& tracer_name = tracer_config[tracer_index].name;
auto wtpt_offset = VI::XWell::index::TracerOffset + tracer_dims.water_tracers();
auto wtit_offset = VI::XWell::index::TracerOffset + 2*tracer_dims.water_tracers();

smry.update_well_var(well, fmt::format("WTPT{}", tracer_name), xwel[wtpt_offset + tracer_index]);
smry.update_well_var(well, fmt::format("WTIT{}", tracer_name), xwel[wtit_offset + tracer_index]);
}
}

void assign_group_cumulatives(const std::string& group,
Expand Down Expand Up @@ -1558,6 +1571,7 @@ namespace {

void restore_cumulative(::Opm::SummaryState& smry,
const ::Opm::Schedule& schedule,
const Opm::TracerConfig& tracer_config,
std::shared_ptr<Opm::EclIO::RestartFileView> rst_view)
{
const auto sim_step = rst_view->simStep();
Expand All @@ -1573,7 +1587,7 @@ namespace {
for (auto nWells = wells.size(), wellID = 0*nWells;
wellID < nWells; ++wellID)
{
assign_well_cumulatives(wells[wellID], wellID, wellData, smry);
assign_well_cumulatives(wells[wellID], wellID, schedule.runspec().tracers(), tracer_config, wellData, smry);
}
}

Expand Down Expand Up @@ -1645,7 +1659,7 @@ namespace Opm { namespace RestartIO {
}

restore_udq(summary_state, schedule, rst_view);
restore_cumulative(summary_state, schedule, std::move(rst_view));
restore_cumulative(summary_state, schedule, es.tracer(), std::move(rst_view));

return rst_value;
}
Expand Down

0 comments on commit b950198

Please sign in to comment.