Opm flow job - well updates for field testing (#12946)

* Opm flow job improvements:
-  Automatic adjustment of WELLDIMS
-  Enable provided test file to run
-  Improve job progress

* Bump dev version
This commit is contained in:
JJ authored and GitHub committed 2025-09-24 16:46:48 +02:00
1 parent 0f339a6ab2
commit af64e541f4
7 files changed
+152 -38

No files matched your search

@@ -63,8 +63,19 @@ QString RimGenericJob::workingDirectory() const
//--------------------------------------------------------------------------------------------------
bool RimGenericJob::execute()
{
if ( !onPrepare() ) return false;
// job preparations
{
caf::ProgressInfo prepProgress( 1, title(), false );
auto prepRun = prepProgress.task( "Preparing for run, please wait..." );
if ( !onPrepare() ) return false;
}
// check if we should run
if ( !onRun() ) return false;
// run job
bool runOk = false;
{
caf::ProgressInfo runProgress( 1, title() );
@@ -44,5 +44,6 @@ protected:
virtual QStringList command() = 0;
virtual QString workingDirectory() const;
virtual bool onPrepare() = 0;
virtual bool onRun() = 0;
virtual void onCompleted( bool success ) = 0;
};
@@ -54,6 +54,7 @@
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafProgressInfo.h"
#include <QFile>
#include <QFileInfo>
@@ -192,7 +193,14 @@ void RimOpmFlowJob::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
genGrp->add( nameField() );
genGrp->add( &m_deckFileName );
genGrp->add( &m_workDir );
genGrp->add( &m_addNewWell );
if ( m_eclipseCase() == nullptr )
{
m_addNewWell = false;
}
else
{
genGrp->add( &m_addNewWell );
}
if ( m_addNewWell() )
{
@@ -600,8 +608,10 @@ bool RimOpmFlowJob::onPrepare()
return false;
}
int fallbackPosition = ( m_fileDeckHasDates && m_wellOpenType == WellOpenType::OPEN_AT_DATE ) ? -1 : m_openWellDeckPosition() - 1;
// merge new well settings from resinsight into DATA deck
if ( !m_deckFile->mergeWellDeck( m_openTimeStep(), wellTempFile().toStdString() ) )
if ( !m_deckFile->mergeWellDeck( m_openTimeStep(), wellTempFile().toStdString(), fallbackPosition ) )
{
RiaLogging::error( "Unable to merge new well data into DATA file. Are there WELSPECS and COMPDAT keywords?" );
return false;
@@ -645,10 +655,20 @@ bool RimOpmFlowJob::onPrepare()
}
}
caf::ProgressInfo saveProgress( 1, "Saving updated information to DATA file.", false );
// save DATA file to working folder
bool saveOk = m_deckFile->saveDeck( workingDirectory().toStdString(), deckName().toStdString() + deckExtension().toStdString() );
m_deckFile.reset();
return saveOk;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimOpmFlowJob::onRun()
{
if ( m_pauseBeforeRun() )
{
QString infoText = "Input parameter files can now be found in the working folder:";
@@ -659,8 +679,7 @@ bool RimOpmFlowJob::onPrepare()
if ( reply != QMessageBox::Ok ) return false;
}
return saveOk;
return true;
}
//--------------------------------------------------------------------------------------------------
@@ -738,6 +757,11 @@ void RimOpmFlowJob::onCompleted( bool success )
{
newCase->setCustomCaseName( name() );
newCase->updateConnectedEditors();
if ( m_eclipseCase() == nullptr )
{
m_eclipseCase = newCase;
}
Riu3DMainWindowTools::selectAsCurrentItem( newCase );
Riu3DMainWindowTools::setExpanded( newCase, true );
}
@@ -66,6 +66,7 @@ protected:
QStringList command() override;
QString workingDirectory() const override;
bool onPrepare() override;
bool onRun() override;
void onCompleted( bool success ) override;
bool openDeckFile();