Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import of restart data using opm-common #11045

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions ApplicationLibCode/FileInterface/RifReaderOpmCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
#include "opm/io/eclipse/ERst.hpp"
#include "opm/io/eclipse/RestartFileView.hpp"
#include "opm/io/eclipse/rst/state.hpp"
#include "opm/output/eclipse/VectorItems/doubhead.hpp"
#include "opm/output/eclipse/VectorItems/group.hpp"
#include "opm/output/eclipse/VectorItems/intehead.hpp"
#include "opm/output/eclipse/VectorItems/well.hpp"

using namespace Opm;
Expand Down Expand Up @@ -434,28 +436,24 @@ void RifReaderOpmCommon::readWellCells( std::shared_ptr<EclIO::ERst> restartFil
//--------------------------------------------------------------------------------------------------
std::vector<RifReaderOpmCommon::TimeDataFile> RifReaderOpmCommon::readTimeSteps( std::shared_ptr<EclIO::ERst> restartFile )
{
// It is required to create a deck as the input parameter to runspec. The default() initialization of the runspec keyword does not
// initialize the object as expected.

Deck deck;
Runspec runspec( deck );
Parser parser( false );

std::vector<RifReaderOpmCommon::TimeDataFile> reportTimeData;
try
{
namespace VI = Opm::RestartIO::Helpers::VectorItems;

for ( auto seqNumber : restartFile->listOfReportStepNumbers() )
{
auto fileView = std::make_shared<EclIO::RestartFileView>( restartFile, seqNumber );

auto state = RestartIO::RstState::load( fileView, runspec, parser );
auto header = state.header;
auto intehead = fileView->intehead();

auto year = intehead[VI::intehead::YEAR];
auto month = intehead[VI::intehead::MONTH];
auto day = intehead[VI::intehead::DAY];

int year = header.year;
int month = header.month;
int day = header.mday;
auto doubhead = fileView->doubhead();

double daySinceSimStart = header.next_timestep1;
auto daySinceSimStart = doubhead[VI::doubhead::TsInit];

reportTimeData.emplace_back(
TimeDataFile{ .sequenceNumber = seqNumber, .year = year, .month = month, .day = day, .simulationTimeFromStart = daySinceSimStart } );
Expand Down
2 changes: 1 addition & 1 deletion ThirdParty/custom-opm-common/opm-common