///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2025 Equinor ASA // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RimSingleJob.h" #include "RimJobWellSettings.h" #include "cafPdmPtrField.h" #include "cafSignal.h" #include class RimEclipseCase; class RimWellPath; class RifOpmFlowDeckFile; class RimEclipseCaseEnsemble; class RimSummaryEnsemble; class RimKeywordWconprod; class RimKeywordWconinje; class RimOpmFlowJobSettings; //================================================================================================== /// /// //================================================================================================== class RimOpmFlowJob : public RimSingleJob { CAF_PDM_HEADER_INIT; public: enum class DateAppendType { ADD_DAYS, ADD_MONTHS }; caf::Signal jobCompleted; caf::Signal progressUpdate; public: RimOpmFlowJob(); ~RimOpmFlowJob() override; void setWorkingDirectory( QString workDir ); void setEclipseCase( RimEclipseCase* eCase ); void setInputDataFile( QString filename ); void setJobSettings( RimOpmFlowJobSettings* jobSettings ); void setJobWellSettings( RimJobWellSettings* jobWellSettings ); void setIsChildJob( bool isChildJob ); void initAfterCopy(); void setAutoLoadResults( bool autoLoad ); QString deckName(); QString mainWorkingDirectory() const; static QString jobInputFileKey(); protected: void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; bool matchesKeyValue( const QString& key, const QString& value ) const override; void processLogOutput( const QString& logLine ) override; QStringList command() override; std::map environment() override; QString workingDirectory() const override; bool onPrepare() override; bool onRun() override; void onCompleted( bool success ) override; void onProgress( double percentageDone ) override; bool openDeckFile(); void closeDeckFile(); bool copyUnrstFileToWorkDir(); void loadResults(); private: RimEclipseCase* findExistingCase( QString filename ); QString deckExtension() const; QString baseDeckName(); QString restartDeckName(); QString inputDeckName() const; std::vector datesInFileDeck(); std::vector wellgroupsInFileDeck(); std::vector dateStrings(); std::vector dateTimes(); std::vector addedDateTimes(); int mergeBasicWellSettings(); int mergeMswData( int mergePosition ); void selectOpenWellPosition(); void resetEnsembleRunId(); private: caf::PdmField m_deckFileName; caf::PdmField m_workDir; caf::PdmField m_openWellDeckPosition; caf::PdmField m_pauseBeforeRun; caf::PdmField m_addToEnsemble; caf::PdmField m_currentRunId; caf::PdmField m_useRestart; caf::PdmField m_isChildJob; caf::PdmPtrField m_wellPath; caf::PdmPtrField m_eclipseCase; caf::PdmPtrField m_gridEnsemble; caf::PdmPtrField m_summaryEnsemble; caf::PdmField m_openTimeStep; caf::PdmField m_endTimeStepEnabled; caf::PdmField m_endTimeStep; caf::PdmField m_addNewWell; caf::PdmField> m_wellOpenType; caf::PdmField m_includeMSWData; caf::PdmField m_wellGroupName; caf::PdmField m_appendNewDates; caf::PdmField m_newDatesInterval; caf::PdmField m_numberOfNewDates; caf::PdmField> m_dateAppendType; caf::PdmChildField m_wconprodKeyword; caf::PdmChildField m_wconinjeKeyword; caf::PdmChildField m_jobSettings; caf::PdmField m_autoLoadResults; caf::PdmField m_wellOpenKeyword; std::unique_ptr m_deckFile; bool m_fileDeckHasDates; bool m_fileDeckIsRestart; int m_startStepForProgress; };