Remove obsolete fault reactivation assessment feature

This commit is contained in:
Jon Jenssen 2022-11-16 17:33:52 +01:00 committed by jonjenssen
parent 6a859e0860
commit 10d5246644
31 changed files with 0 additions and 3189 deletions

View File

@ -34,28 +34,6 @@ CAF_PDM_SOURCE_INIT( RiaPreferencesGeoMech, "RiaPreferencesGeoMech" );
//--------------------------------------------------------------------------------------------------
RiaPreferencesGeoMech::RiaPreferencesGeoMech()
{
CAF_PDM_InitFieldNoDefault( &m_geomechFRAPreprocCommand, "geomechFRAPreprocCommand", "Pre-Processing Command" );
m_geomechFRAPreprocCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_geomechFRAPreprocCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitFieldNoDefault( &m_geomechFRAPostprocCommand, "geomechFRAPostprocCommand", "Post-Processing Command" );
m_geomechFRAPostprocCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_geomechFRAPostprocCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitFieldNoDefault( &m_geomechFRAMacrisCommand, "geomechFRAMacrisCommand", "Main Macris Command" );
m_geomechFRAMacrisCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_geomechFRAMacrisCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitFieldNoDefault( &m_geomechFRADefaultBasicXML, "geomechFRADefaultXML", "Basic Processing Parameter XML File" );
m_geomechFRADefaultBasicXML.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_geomechFRADefaultBasicXML.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitFieldNoDefault( &m_geomechFRADefaultAdvXML,
"geomechFRADefaultAdvXML",
"Advanced Processing Parameter XML File" );
m_geomechFRADefaultAdvXML.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_geomechFRADefaultAdvXML.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitFieldNoDefault( &m_geomechWIADefaultXML, "geomechWIADefaultXML", "Default Parameter XML File" );
m_geomechWIADefaultXML.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_geomechWIADefaultXML.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
@ -87,17 +65,6 @@ RiaPreferencesGeoMech* RiaPreferencesGeoMech::current()
//--------------------------------------------------------------------------------------------------
void RiaPreferencesGeoMech::appendItems( caf::PdmUiOrdering& uiOrdering ) const
{
caf::PdmUiGroup* faultRAGroup = uiOrdering.addNewGroup( "Fault Reactivation Assessment" );
caf::PdmUiGroup* cmdFRAGroup = faultRAGroup->addNewGroup( "Commands (without parameters)" );
cmdFRAGroup->add( &m_geomechFRAPreprocCommand );
cmdFRAGroup->add( &m_geomechFRAPostprocCommand );
cmdFRAGroup->add( &m_geomechFRAMacrisCommand );
caf::PdmUiGroup* paramFRAGroup = faultRAGroup->addNewGroup( "Parameters" );
paramFRAGroup->add( &m_geomechFRADefaultBasicXML );
paramFRAGroup->add( &m_geomechFRADefaultAdvXML );
caf::PdmUiGroup* wellIAGroup = uiOrdering.addNewGroup( "Well Integrity Analysis" );
wellIAGroup->add( &m_geomechWIACommand );
wellIAGroup->add( &m_geomechWIADefaultXML );
@ -114,46 +81,6 @@ void RiaPreferencesGeoMech::defineUiOrdering( QString uiConfigName, caf::PdmUiOr
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferencesGeoMech::geomechFRAPreprocCommand() const
{
return m_geomechFRAPreprocCommand;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferencesGeoMech::geomechFRAPostprocCommand() const
{
return m_geomechFRAPostprocCommand;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferencesGeoMech::geomechFRAMacrisCommand() const
{
return m_geomechFRAMacrisCommand;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferencesGeoMech::geomechFRADefaultBasicXML() const
{
return m_geomechFRADefaultBasicXML;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferencesGeoMech::geomechFRADefaultAdvXML() const
{
return m_geomechFRADefaultAdvXML;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -186,21 +113,6 @@ bool RiaPreferencesGeoMech::waitBeforeRunWIA() const
return m_waitForInputFileEdit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferencesGeoMech::validateFRASettings() const
{
QStringList files;
files << geomechFRAPreprocCommand();
files << geomechFRAPostprocCommand();
files << geomechFRAMacrisCommand();
files << geomechFRADefaultBasicXML();
files << geomechFRADefaultAdvXML();
return filesExists( files );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -36,16 +36,9 @@ public:
void appendItems( caf::PdmUiOrdering& uiOrdering ) const;
bool validateFRASettings() const;
bool validateWIASettings() const;
// geomech settings
QString geomechFRAPreprocCommand() const;
QString geomechFRAPostprocCommand() const;
QString geomechFRAMacrisCommand() const;
QString geomechFRADefaultBasicXML() const;
QString geomechFRADefaultAdvXML() const;
QString geomechWIADefaultXML() const;
QString geomechWIACommand() const;
bool waitBeforeRunWIA() const;
@ -58,12 +51,6 @@ protected:
private:
bool filesExists( QStringList& filelist ) const;
caf::PdmField<QString> m_geomechFRAPreprocCommand;
caf::PdmField<QString> m_geomechFRAPostprocCommand;
caf::PdmField<QString> m_geomechFRAMacrisCommand;
caf::PdmField<QString> m_geomechFRADefaultBasicXML;
caf::PdmField<QString> m_geomechFRADefaultAdvXML;
caf::PdmField<QString> m_geomechWIADefaultXML;
caf::PdmField<QString> m_geomechWIACommand;
caf::PdmField<bool> m_waitForInputFileEdit;

View File

@ -8,12 +8,6 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.h
${CMAKE_CURRENT_LIST_DIR}/RicImportGeoMechCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportGeoMechCaseTimeStepFilterFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewFaultReactAssessmentFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunBasicFaultReactAssessmentFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunAdvFaultReactAssessmentFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunBasicFaultReactAssessment3dFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunAdvFaultReactAssessment3dFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunFaultReactAssessmentFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellIntegrityAnalysisFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunWellIntegrityAnalysisFeature.h
)
@ -28,12 +22,6 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportGeoMechCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportGeoMechCaseTimeStepFilterFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewFaultReactAssessmentFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunAdvFaultReactAssessmentFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunAdvFaultReactAssessment3dFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunBasicFaultReactAssessmentFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunBasicFaultReactAssessment3dFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunFaultReactAssessmentFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellIntegrityAnalysisFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunWellIntegrityAnalysisFeature.cpp
)

View File

@ -1,308 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewFaultReactAssessmentFeature.h"
#include "RiaApplication.h"
#include "RiaEclipseFileNameTools.h"
#include "RiaImportEclipseCaseTools.h"
#include "RiaPreferencesGeoMech.h"
#include "RifFaultRAJsonWriter.h"
#include "RimEclipseInputCase.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
#include "RimFaultRAPreprocSettings.h"
#include "RimFaultRASettings.h"
#include "RimGeoMechCase.h"
#include "RimProcess.h"
#include "RimProject.h"
#include "Riu3DMainWindowTools.h"
#include "RiuFileDialogTools.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafSelectionManagerTools.h"
#include "cafUtils.h"
#include <QAction>
#include <QDebug>
#include <QDir>
#include <QMessageBox>
CAF_CMD_SOURCE_INIT( RicNewFaultReactAssessmentFeature, "RicNewFaultReactAssessmentFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewFaultReactAssessmentFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewFaultReactAssessmentFeature::onActionTriggered( bool isChecked )
{
RimFaultRAPreprocSettings frapSettings;
// make sure the user has set up geomech/FRA things in preferences
if ( !RiaPreferencesGeoMech::current()->validateFRASettings() )
{
QMessageBox::critical( nullptr,
"Fault Reactivation Assessment",
"Fault Reactivation Assessment has not been properly set up.\nPlease go to ResInsight "
"preferences and set/check the GeoMechanical settings." );
return;
}
// ask user for preprocessing settings
if ( !showSettingsGUI( frapSettings ) ) return;
if ( frapSettings.cleanBaseDirectory() )
{
auto reply = QMessageBox::question( nullptr,
QString( "Clean output directory" ),
QString( "Are you sure you want to delete all files and subfolders in the "
"selected output directory?\n%1 " )
.arg( frapSettings.outputBaseDirectory() ),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No );
if ( reply == QMessageBox::No )
{
frapSettings.setCleanBaseDirectory( false );
}
}
// make sure our work dir is there
prepareDirectory( frapSettings.outputBaseDirectory(), frapSettings.cleanBaseDirectory() );
// run the preproc steps needed
if ( !runPreProc( frapSettings ) ) return;
QStringList gridList;
gridList << frapSettings.outputEclipseFilename();
// load the new grid
bool createView = true;
int caseId = RiaImportEclipseCaseTools::openEclipseInputCaseFromFileNames( gridList, createView );
if ( caseId < 0 )
{
QMessageBox::critical( nullptr, "Fault Reactivation Assessment", "Unable to load generated Eclipse grid." );
return;
}
RimProject* project = RiaApplication::instance()->project();
RimEclipseInputCase* fraCase = dynamic_cast<RimEclipseInputCase*>( project->eclipseCaseFromCaseId( caseId ) );
if ( fraCase == nullptr )
{
QMessageBox::critical( nullptr, "Fault Reactivation Assessment", "Unable to find generated Eclipse grid." );
return;
}
RimEclipseView* view = getView( fraCase );
if ( view == nullptr )
{
QMessageBox::critical( nullptr, "Fault Reactivation Assessment", "Unable to find view for generated Eclipse grid." );
return;
}
if ( view->faultCollection() )
{
view->faultCollection()->enableFaultRA( true );
view->faultCollection()->faultRASettings()->initFromPreprocSettings( &frapSettings, fraCase );
}
cleanUpParameterFiles();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewFaultReactAssessmentFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/fault_react_24x24.png" ) );
actionToSetup->setText( "New Fault Reactivation Assessment" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewFaultReactAssessmentFeature::prepareDirectory( QString dirname, bool deleteExistingContent ) const
{
QDir dir( dirname );
if ( deleteExistingContent && dir.exists() )
{
dir.setFilter( QDir::Files | QDir::Dirs | QDir::NoSymLinks );
for ( auto& entry : dir.entryInfoList() )
{
if ( entry.isDir() && entry.fileName() != "." && entry.fileName() != ".." )
entry.dir().removeRecursively();
else if ( entry.isFile() )
QFile::remove( entry.absoluteFilePath() );
}
}
dir.mkpath( "." );
dir.mkpath( "Eclipse" );
dir.mkpath( "Abaqus" );
dir.mkpath( "tmp" );
dir.mkpath( "tsurf" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewFaultReactAssessmentFeature::showSettingsGUI( RimFaultRAPreprocSettings& settings )
{
// get the case we should be working with
std::vector<RimGeoMechCase*> geomechCases = caf::selectedObjectsByTypeStrict<RimGeoMechCase*>();
std::vector<RimEclipseResultCase*> eclipseCases = caf::selectedObjectsByTypeStrict<RimEclipseResultCase*>();
if ( geomechCases.empty() && eclipseCases.empty() ) return false;
// get base directory for our work, should be a new, empty folder somewhere
QString defaultDir =
RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "FAULT_REACT_ASSESSMENT" );
QString baseDir = RiuFileDialogTools::getExistingDirectory( nullptr, tr( "Select Working Directory" ), defaultDir );
if ( baseDir.isNull() ) return false;
RiaApplication::instance()->setLastUsedDialogDirectory( "FAULT_REACT_ASSESSMENT", baseDir );
// ask the user for the options we need in the preproc step
if ( !geomechCases.empty() ) settings.setGeoMechCase( geomechCases[0] );
if ( !eclipseCases.empty() ) settings.setEclipseCase( eclipseCases[0] );
settings.setOutputBaseDirectory( baseDir );
caf::PdmUiPropertyViewDialog propertyDialog( nullptr,
&settings,
"Fault Reactivation Assessment Preprocessing",
"",
QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
if ( settings.geoMechSelected() )
propertyDialog.resize( QSize( 520, 520 ) );
else
propertyDialog.resize( QSize( 520, 420 ) );
// make sure we always have an eclipse case selected
while ( true )
{
if ( propertyDialog.exec() != QDialog::Accepted ) break;
if ( settings.eclipseCase() != nullptr ) return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewFaultReactAssessmentFeature::runPreProc( RimFaultRAPreprocSettings& settings )
{
caf::ProgressInfo runProgress( 2, "Running preprocessing, please wait..." );
// is geomech enabled? If so, run preproc script to generate rpt files
if ( settings.geoMechSelected() )
{
QString errorText;
if ( !RifFaultRAJSonWriter::writeToPreprocFile( settings, errorText ) )
{
QMessageBox::warning( nullptr, "Fault Reactivation Assessment Preprocessing", errorText );
return false;
}
runProgress.setProgressDescription( "Preproc script." );
// run the python preprocessing script
QString command = RiaPreferencesGeoMech::current()->geomechFRAPreprocCommand();
QStringList parameters = settings.preprocParameterList();
addParameterFileForCleanUp( settings.preprocParameterFilename() );
RimProcess process;
process.setCommand( command );
process.setParameters( parameters );
if ( !process.execute() )
{
QMessageBox::critical( nullptr,
"Fault Reactivation Assessment Preprocessing",
"Failed to run preprocessing script. Check log window for additional information." );
return false;
}
}
runProgress.incrementProgress();
runProgress.setProgressDescription( "Macris prepare command." );
// run the java macris program in prepare mode
QString command = RiaPreferencesGeoMech::current()->geomechFRAMacrisCommand();
QStringList parameters = settings.macrisPrepareParameterList();
RimProcess process;
process.setCommand( command );
process.setParameters( parameters );
if ( !process.execute() )
{
QMessageBox::critical( nullptr,
"Fault Reactivation Assessment Preprocessing",
"Failed to run Macrix prepare command. Check log window for additional information." );
return false;
}
runProgress.incrementProgress();
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicNewFaultReactAssessmentFeature::getView( RimEclipseInputCase* eCase )
{
std::vector<RimEclipseView*> views;
eCase->descendantsOfType( views );
if ( views.size() > 0 ) return views[0];
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewFaultReactAssessmentFeature::addParameterFileForCleanUp( QString filename )
{
m_parameterFilesToCleanUp.push_back( filename );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewFaultReactAssessmentFeature::cleanUpParameterFiles()
{
if ( !RiaPreferencesGeoMech::current()->keepTemporaryFiles() )
{
for ( auto& filename : m_parameterFilesToCleanUp )
{
if ( QFile::exists( filename ) ) QFile::remove( filename );
}
}
m_parameterFilesToCleanUp.clear();
}

View File

@ -1,50 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimFaultRAPreprocSettings;
class RimEclipseView;
class RimEclipseInputCase;
//==================================================================================================
///
//==================================================================================================
class RicNewFaultReactAssessmentFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
private:
void prepareDirectory( QString dirname, bool deleteExistingContent ) const;
bool showSettingsGUI( RimFaultRAPreprocSettings& settings );
bool runPreProc( RimFaultRAPreprocSettings& settings );
void addParameterFileForCleanUp( QString filename );
void cleanUpParameterFiles();
RimEclipseView* getView( RimEclipseInputCase* eCase );
std::list<QString> m_parameterFilesToCleanUp;
};

View File

@ -1,46 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicRunAdvFaultReactAssessment3dFeature.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicRunAdvFaultReactAssessment3dFeature, "RicRunAdvFaultReactAssessment3dFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunAdvFaultReactAssessment3dFeature::onActionTriggered( bool isChecked )
{
QVariant userData = this->userData();
if ( userData.isNull() || userData.type() != QVariant::String ) return;
QString faultName = userData.toString();
int faultID = faultIDFromName( faultName );
if ( faultID >= 0 ) runAdvancedProcessing( faultID );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunAdvFaultReactAssessment3dFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/fault_react_24x24.png" ) );
actionToSetup->setText( "Run Advanced Processing" );
}

View File

@ -1,33 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicRunBasicFaultReactAssessment3dFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicRunAdvFaultReactAssessment3dFeature : public RicRunBasicFaultReactAssessment3dFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -1,58 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicRunAdvFaultReactAssessmentFeature.h"
#include "RimFaultInViewCollection.h"
#include "RimFaultRASettings.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicRunAdvFaultReactAssessmentFeature, "RicRunAdvFaultReactAssessmentFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRunAdvFaultReactAssessmentFeature::isCommandEnabled()
{
RimFaultInViewCollection* faultColl = faultCollection();
if ( faultColl )
{
return faultColl->faultRAAdvancedEnabled();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunAdvFaultReactAssessmentFeature::onActionTriggered( bool isChecked )
{
runAdvancedProcessing( selectedFaultID() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunAdvFaultReactAssessmentFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/fault_react_24x24.png" ) );
actionToSetup->setText( "Run Advanced Processing" );
}

View File

@ -1,34 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicRunFaultReactAssessmentFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicRunAdvFaultReactAssessmentFeature : public RicRunFaultReactAssessmentFeature
{
CAF_CMD_HEADER_INIT;
protected:
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
bool isCommandEnabled() override;
};

View File

@ -1,75 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicRunBasicFaultReactAssessment3dFeature.h"
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
#include "RimFaultRASettings.h"
#include "RimGridView.h"
#include "RiaApplication.h"
#include <QAction>
#include <QVariant>
CAF_CMD_SOURCE_INIT( RicRunBasicFaultReactAssessment3dFeature, "RicRunBasicFaultReactAssessment3dFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRunBasicFaultReactAssessment3dFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunBasicFaultReactAssessment3dFeature::onActionTriggered( bool isChecked )
{
QVariant userData = this->userData();
if ( userData.isNull() || userData.type() != QVariant::String ) return;
QString faultName = userData.toString();
int faultID = faultIDFromName( faultName );
if ( faultID >= 0 ) runBasicProcessing( faultID );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunBasicFaultReactAssessment3dFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/fault_react_24x24.png" ) );
actionToSetup->setText( "Run Basic Processing" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultInViewCollection* RicRunBasicFaultReactAssessment3dFeature::faultCollection()
{
RimGridView* viewOrComparisonView = RiaApplication::instance()->activeMainOrComparisonGridView();
RimEclipseView* theView = dynamic_cast<RimEclipseView*>( viewOrComparisonView );
CAF_ASSERT( theView );
return theView->faultCollection();
}

View File

@ -1,36 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicRunFaultReactAssessmentFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicRunBasicFaultReactAssessment3dFeature : public RicRunFaultReactAssessmentFeature
{
CAF_CMD_HEADER_INIT;
protected:
RimFaultInViewCollection* faultCollection() override;
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -1,57 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicRunBasicFaultReactAssessmentFeature.h"
#include "RimFaultInViewCollection.h"
#include "RimFaultRASettings.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicRunBasicFaultReactAssessmentFeature, "RicRunBasicFaultReactAssessmentFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRunBasicFaultReactAssessmentFeature::isCommandEnabled()
{
RimFaultInViewCollection* faultColl = faultCollection();
if ( faultColl )
{
return ( faultColl->faultRAEnabled() );
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunBasicFaultReactAssessmentFeature::onActionTriggered( bool isChecked )
{
runBasicProcessing( selectedFaultID() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunBasicFaultReactAssessmentFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setIcon( QIcon( ":/fault_react_24x24.png" ) );
actionToSetup->setText( "Run Basic Processing" );
}

View File

@ -1,34 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicRunFaultReactAssessmentFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicRunBasicFaultReactAssessmentFeature : public RicRunFaultReactAssessmentFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -1,391 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicRunFaultReactAssessmentFeature.h"
#include "RiaApplication.h"
#include "RiaEclipseFileNameTools.h"
#include "RiaImportEclipseCaseTools.h"
#include "RiaPreferencesGeoMech.h"
#include "RiaResultNames.h"
#include "RifFaultRAJsonWriter.h"
#include "RifFaultRAXmlWriter.h"
#include "RimEclipseInputCase.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFaultInView.h"
#include "RimFaultInViewCollection.h"
#include "RimFaultRAPostprocSettings.h"
#include "RimFaultRAPreprocSettings.h"
#include "RimFaultRASettings.h"
#include "RimFileSurface.h"
#include "RimGeoMechCase.h"
#include "RimOilField.h"
#include "RimProcess.h"
#include "RimProject.h"
#include "RimSurface.h"
#include "RimSurfaceCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RiuFileDialogTools.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafSelectionManagerTools.h"
#include "cafUtils.h"
#include <QAction>
#include <QDebug>
#include <QDir>
#include <QDirIterator>
#include <QMessageBox>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicRunFaultReactAssessmentFeature::RicRunFaultReactAssessmentFeature()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultInViewCollection* RicRunFaultReactAssessmentFeature::faultCollection()
{
RimFaultInViewCollection* faultColl =
dynamic_cast<RimFaultInViewCollection*>( caf::SelectionManager::instance()->selectedItem() );
if ( faultColl ) return faultColl;
RimFaultInView* selObj = dynamic_cast<RimFaultInView*>( caf::SelectionManager::instance()->selectedItem() );
if ( selObj )
{
if ( !selObj->name().startsWith( RiaResultNames::faultReactAssessmentPrefix() ) ) return nullptr;
selObj->firstAncestorOrThisOfType( faultColl );
}
return faultColl;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicRunFaultReactAssessmentFeature::faultIDFromName( QString faultName ) const
{
int retval = -1;
QString lookFor = RiaResultNames::faultReactAssessmentPrefix();
QString name = faultName;
if ( !name.startsWith( lookFor ) ) return retval;
name = name.mid( lookFor.length() );
if ( name.size() == 0 ) return retval;
bool bOK;
retval = name.toInt( &bOK );
if ( !bOK ) retval = -1;
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RicRunFaultReactAssessmentFeature::selectedFaultID()
{
int retval = -1;
RimFaultInView* selObj = dynamic_cast<RimFaultInView*>( caf::SelectionManager::instance()->selectedItem() );
if ( selObj )
{
return faultIDFromName( selObj->name() );
}
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRunFaultReactAssessmentFeature::runPostProcessing( int faultID, RimFaultRASettings* settings )
{
RimFaultRAPostprocSettings postproc_settings;
postproc_settings.initFromSettings( settings );
QString outErrorText;
if ( !RifFaultRAJSonWriter::writeToPostprocFile( faultID, &postproc_settings, outErrorText ) )
{
QMessageBox::warning( nullptr,
"Fault Reactivation Assessment Processing",
"Unable to write postproc parameter file! " + outErrorText );
return false;
}
QString command = RiaPreferencesGeoMech::current()->geomechFRAPostprocCommand();
QStringList parameters = postproc_settings.postprocCommandParameters( faultID );
RimProcess process;
process.setCommand( command );
process.setParameters( parameters );
addParameterFileForCleanUp( postproc_settings.postprocParameterFilename( faultID ) );
if ( !process.execute() )
{
QMessageBox::critical( nullptr,
"Fault Reactivation Assessment Processing",
"Failed to run post processing command. Check log window for additional "
"information." );
return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunFaultReactAssessmentFeature::addParameterFileForCleanUp( QString filename )
{
m_parameterFilesToCleanUp.push_back( filename );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunFaultReactAssessmentFeature::cleanUpParameterFiles()
{
if ( !RiaPreferencesGeoMech::current()->keepTemporaryFiles() )
{
for ( auto& filename : m_parameterFilesToCleanUp )
{
removeFile( filename );
}
}
m_parameterFilesToCleanUp.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunFaultReactAssessmentFeature::removeFile( QString filename )
{
if ( QFile::exists( filename ) ) QFile::remove( filename );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSurfaceCollection* RicRunFaultReactAssessmentFeature::surfaceCollection()
{
RimProject* proj = RimProject::current();
RimSurfaceCollection* surfColl = proj->activeOilField()->surfaceCollection();
if ( surfColl )
{
for ( auto& subColl : surfColl->subCollections() )
{
if ( subColl->collectionName() == "FaultRA" )
{
return subColl;
}
}
// No FaultRA collection found, make one
RimSurfaceCollection* fraCollection = new RimSurfaceCollection();
fraCollection->setCollectionName( "FaultRA" );
surfColl->addSubCollection( fraCollection );
return fraCollection;
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunFaultReactAssessmentFeature::reloadSurfaces( RimFaultRASettings* settings )
{
RimSurfaceCollection* surfColl = surfaceCollection();
if ( !surfColl ) return;
// get rid of any files removed by the processing
surfColl->removeMissingFileSurfaces();
bool showLegendInView = false;
// ask the collection to reload the existing files
surfColl->reloadSurfaces( surfColl->surfaces(), showLegendInView );
// get all the files in the folder, skip the ones we alreday have
QStringList newFiles;
QDirIterator tsurfIt( settings->tsurfOutputDirectory(), { "*.ts" }, QDir::Files );
while ( tsurfIt.hasNext() )
{
QString filename = tsurfIt.next();
if ( surfColl->containsFileSurface( filename ) ) continue;
newFiles << filename;
}
// import the new surfaces
surfColl->importSurfacesFromFiles( newFiles, showLegendInView );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunFaultReactAssessmentFeature::runBasicProcessing( int faultID )
{
RimFaultInViewCollection* coll = faultCollection();
if ( coll == nullptr ) return;
RimFaultRASettings* fraSettings = coll->faultRASettings();
if ( fraSettings == nullptr ) return;
caf::ProgressInfo runProgress( 3, "Running Basic Fault RA processing, please wait..." );
{
runProgress.setProgressDescription( "Macris calculate command." );
QString paramfilename = fraSettings->basicParameterXMLFilename( faultID );
RifFaultRAXmlWriter xmlwriter( fraSettings );
QString outErrorText;
if ( !xmlwriter.writeCalculateFile( paramfilename, faultID, outErrorText ) )
{
QMessageBox::warning( nullptr,
"Fault Reactivation Assessment Processing",
"Unable to write parameter file! " + outErrorText );
return;
}
addParameterFileForCleanUp( paramfilename );
// remove any existing database file
removeFile( fraSettings->basicMacrisDatabase() );
// run the java macris program in calculate mode
QString command = RiaPreferencesGeoMech::current()->geomechFRAMacrisCommand();
QStringList parameters = fraSettings->basicMacrisParameters( faultID );
RimProcess process;
process.setCommand( command );
process.setParameters( parameters );
if ( !process.execute() )
{
QMessageBox::critical( nullptr,
"Basic Fault Reactivation Assessment Processing",
"Failed to run Macris calculate command. Check log window for additional "
"information." );
cleanUpParameterFiles();
return;
}
runProgress.incrementProgress();
}
runProgress.setProgressDescription( "Generating surface results." );
if ( runPostProcessing( faultID, fraSettings ) )
{
runProgress.incrementProgress();
runProgress.setProgressDescription( "Importing surface results." );
// reload output surfaces
reloadSurfaces( fraSettings );
}
// delete parameter files
cleanUpParameterFiles();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunFaultReactAssessmentFeature::runAdvancedProcessing( int faultID )
{
RimFaultInViewCollection* coll = faultCollection();
if ( coll == nullptr ) return;
RimFaultRASettings* fraSettings = coll->faultRASettings();
if ( fraSettings == nullptr ) return;
caf::ProgressInfo runProgress( 3, "Running Advanced Fault RA processing, please wait..." );
runProgress.setProgressDescription( "Macris calibrate command." );
QString paramfilename = fraSettings->basicParameterXMLFilename( faultID );
RifFaultRAXmlWriter xmlwriter( fraSettings );
QString outErrorText;
if ( !xmlwriter.writeCalculateFile( paramfilename, faultID, outErrorText ) )
{
QMessageBox::warning( nullptr,
"Fault Reactivation Assessment Processing",
"Unable to write parameter file! " + outErrorText );
return;
}
QString paramfilename2 = fraSettings->advancedParameterXMLFilename( faultID );
if ( !xmlwriter.writeCalibrateFile( paramfilename2, faultID, outErrorText ) )
{
QMessageBox::warning( nullptr,
"Fault Reactivation Assessment Processing",
"Unable to write calibrate parameter file! " + outErrorText );
return;
}
addParameterFileForCleanUp( paramfilename );
addParameterFileForCleanUp( paramfilename2 );
// remove any existing database file
removeFile( fraSettings->advancedMacrisDatabase() );
// run the java macris program in calibrate mode
QString command = RiaPreferencesGeoMech::current()->geomechFRAMacrisCommand();
QStringList parameters = fraSettings->advancedMacrisParameters( faultID );
RimProcess process;
process.setCommand( command );
process.setParameters( parameters );
if ( !process.execute() )
{
QMessageBox::critical( nullptr,
"Advanced Fault Reactivation Assessment Processing",
"Failed to run Macris calibrate command. Check log window for additional information." );
cleanUpParameterFiles();
return;
}
runProgress.incrementProgress();
runProgress.setProgressDescription( "Generating surface results." );
if ( runPostProcessing( faultID, fraSettings ) )
{
runProgress.incrementProgress();
runProgress.setProgressDescription( "Importing surface results." );
// reload output surfaces
reloadSurfaces( fraSettings );
}
// delete parameter files
cleanUpParameterFiles();
}

View File

@ -1,57 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimFaultInViewCollection;
class RimFaultRASettings;
class RimSurfaceCollection;
#include <QString>
//==================================================================================================
///
//==================================================================================================
class RicRunFaultReactAssessmentFeature : public caf::CmdFeature
{
protected:
RicRunFaultReactAssessmentFeature();
virtual RimFaultInViewCollection* faultCollection();
int selectedFaultID();
int faultIDFromName( QString faultname ) const;
RimSurfaceCollection* surfaceCollection();
bool runPostProcessing( int faultID, RimFaultRASettings* settings );
void reloadSurfaces( RimFaultRASettings* settings );
void addParameterFileForCleanUp( QString filename );
void cleanUpParameterFiles();
void removeFile( QString filename );
void runBasicProcessing( int faultID );
void runAdvancedProcessing( int faultID );
private:
std::list<QString> m_parameterFilesToCleanUp;
};

View File

@ -61,8 +61,6 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelAsymmetricFrkExporter.h
${CMAKE_CURRENT_LIST_DIR}/RifThermalFractureTemplateSurfaceExporter.h
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.h
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAXmlWriter.h
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAJsonWriter.h
${CMAKE_CURRENT_LIST_DIR}/RifParameterXmlReader.h
${CMAKE_CURRENT_LIST_DIR}/RifOpmCommonSummary.h
${CMAKE_CURRENT_LIST_DIR}/RifEnsembleFractureStatisticsExporter.h
@ -138,8 +136,6 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RifStimPlanModelAsymmetricFrkExporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifThermalFractureTemplateSurfaceExporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifSurfaceExporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAXmlWriter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifFaultRAJsonWriter.cpp
${CMAKE_CURRENT_LIST_DIR}/RifParameterXmlReader.cpp
${CMAKE_CURRENT_LIST_DIR}/RifOpmCommonSummary.cpp
${CMAKE_CURRENT_LIST_DIR}/RifEnsembleFractureStatisticsExporter.cpp

View File

@ -1,109 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifFaultRAJsonWriter.h"
#include "RimFaultRAPostprocSettings.h"
#include "RimFaultRAPreprocSettings.h"
#include "RimGenericParameter.h"
#include "RimParameterGroup.h"
#include "caf.h"
#include <QFile>
#include <QTextStream>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifFaultRAJSonWriter::writeToPreprocFile( RimFaultRAPreprocSettings& settings, QString& outErrorText )
{
QString filename = settings.preprocParameterFilename();
outErrorText = "Unable to write to file \"" + filename + "\" - ";
QFile file( filename );
if ( file.open( QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text ) )
{
QTextStream stream( &file );
stream << "{" << caf::endl;
stream << "\"odb_path\": \"" + settings.geomechCaseFilename() + "\"," << caf::endl;
stream << "\"time_start\": \"" + settings.startTimeStepGeoMech() + "\"," << caf::endl;
stream << "\"time_end\": \"" + settings.endTimeStepGeoMech() + "\"," << caf::endl;
stream << "\"out_path\": \"" + settings.outputAbaqusDirectory() + "\"" << caf::endl;
stream << "}" << caf::endl;
file.close();
}
else
{
outErrorText += "Could not open file.";
return false;
}
outErrorText = "";
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifFaultRAJSonWriter::writeToPostprocFile( int faultID, RimFaultRAPostprocSettings* settings, QString& outErrorText )
{
QString filename = settings->postprocParameterFilename( faultID );
outErrorText = "Unable to write to file \"" + filename + "\" - ";
QFile file( filename );
if ( file.open( QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text ) )
{
QTextStream stream( &file );
stream << "{" << caf::endl;
if ( settings->geomechEnabled() )
{
if ( QFile::exists( settings->advancedMacrisDatabase() ) )
stream << "\"MacrisCalcCalibration_path\": \"" + settings->advancedMacrisDatabase() + "\"," << caf::endl;
}
if ( QFile::exists( settings->basicMacrisDatabase() ) )
stream << "\"MacrisCalc_path\": \"" + settings->basicMacrisDatabase() + "\"," << caf::endl;
stream << "\"base_directory_path\": \"" + settings->outputBaseDirectory() + "\"," << caf::endl;
for ( auto p : settings->parameters()->parameters() )
{
stream << "\"" + p->name() + "\" : " + p->stringValue() + "," << caf::endl;
}
stream << "\"tsurf_loadsteps\": [ " + settings->stepsToLoad().join( ',' ) + " ]" << caf::endl;
stream << "}" << caf::endl;
file.close();
}
else
{
outErrorText += "Could not open file.";
return false;
}
outErrorText = "";
return true;
}

View File

@ -1,34 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QString>
class RimFaultRAPreprocSettings;
class RimFaultRAPostprocSettings;
class RifFaultRAJSonWriter
{
public:
static bool writeToPreprocFile( RimFaultRAPreprocSettings& settings, QString& outErrorText );
static bool writeToPostprocFile( int faultID, RimFaultRAPostprocSettings* settings, QString& outErrorText );
private:
RifFaultRAJSonWriter(){};
};

View File

@ -1,81 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RifFaultRAXmlWriter.h"
#include "RimFaultRASettings.h"
#include "RimGenericParameter.h"
#include "caf.h"
#include <QFile>
#include <QXmlStreamReader>
RifFaultRAXmlWriter::RifFaultRAXmlWriter( RimFaultRASettings* settings )
: m_settings( settings )
{
}
RifFaultRAXmlWriter::~RifFaultRAXmlWriter()
{
}
bool RifFaultRAXmlWriter::writeCalculateFile( QString filename, int faultID, QString& outErrorText )
{
std::list<RimGenericParameter*> paramlist = m_settings->basicParameters( faultID );
return writeParametersToXML( filename, paramlist, outErrorText );
}
bool RifFaultRAXmlWriter::writeCalibrateFile( QString filename, int faultID, QString& outErrorText )
{
std::list<RimGenericParameter*> paramlist = m_settings->advancedParameters( faultID );
return writeParametersToXML( filename, paramlist, outErrorText );
}
bool RifFaultRAXmlWriter::writeParametersToXML( QString filename, std::list<RimGenericParameter*>& params, QString& outErrorText )
{
bool bResult = false;
outErrorText = "Unable to write to file \"" + filename + "\" - ";
QFile file( filename );
if ( file.open( QIODevice::ReadWrite ) )
{
QTextStream stream( &file );
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" << caf::endl;
stream << "<project type_id=\"0\">" << caf::endl;
for ( auto& p : params )
{
QString tmpStr = QString( "<%1>%2</%1>" ).arg( p->name(), p->stringValue() );
stream << tmpStr << caf::endl;
}
stream << "</project>" << caf::endl;
bResult = true;
}
else
{
outErrorText += "Could not open file.";
}
if ( bResult ) outErrorText = "";
return bResult;
}

View File

@ -1,41 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QString>
#include <list>
class RimFaultRASettings;
class RimGenericParameter;
class RifFaultRAXmlWriter
{
public:
RifFaultRAXmlWriter( RimFaultRASettings* settings );
~RifFaultRAXmlWriter();
bool writeCalculateFile( QString filename, int faultID, QString& outErrorText );
bool writeCalibrateFile( QString filename, int faultID, QString& outErrorText );
private:
bool writeParametersToXML( QString filename, std::list<RimGenericParameter*>& params, QString& outErrorText );
RimFaultRASettings* m_settings;
};

View File

@ -1,17 +1,11 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.h
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimFaultRASettings.h
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPreprocSettings.h
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPostprocSettings.h
)
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimFaultInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaultInViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaultRASettings.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPreprocSettings.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaultRAPostprocSettings.cpp
)
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})

View File

@ -31,7 +31,6 @@
#include "RimEclipseInputCase.h"
#include "RimEclipseView.h"
#include "RimFaultInView.h"
#include "RimFaultRASettings.h"
#include "RimIntersectionCollection.h"
#include "RiuMainWindow.h"
@ -101,15 +100,6 @@ RimFaultInViewCollection::RimFaultInViewCollection()
CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults" );
faults.uiCapability()->setUiTreeHidden( true );
CAF_PDM_InitField( &m_enableFaultRA, "EnableFaultRA", false, "Enable Fault RA" );
m_enableFaultRA.uiCapability()->setUiReadOnly( true );
m_enableFaultRA.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_faultRASettings, "FaultRASettings", "Reactivation Assessment Settings" );
m_faultRASettings = new RimFaultRASettings();
m_faultRASettings.uiCapability()->setUiHidden( true );
m_faultRASettings.uiCapability()->setUiTreeHidden( true );
}
//--------------------------------------------------------------------------------------------------
@ -328,13 +318,6 @@ void RimFaultInViewCollection::defineUiOrdering( QString uiConfigName, caf::PdmU
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
RimEclipseInputCase* inputCase = nullptr;
this->firstAncestorOrThisOfType( inputCase );
if ( ( inputCase != nullptr ) && m_enableFaultRA() )
{
uiTreeOrdering.add( &m_faultRASettings );
}
RimEclipseView* eclipseView = nullptr;
this->firstAncestorOfType( eclipseView );
if ( eclipseView )
@ -387,35 +370,3 @@ bool RimFaultInViewCollection::onlyShowFacesWithDefinedNeighbor() const
{
return m_onlyShowWithNeighbor;
}
//-------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRASettings* RimFaultInViewCollection::faultRASettings() const
{
return m_faultRASettings();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::faultRAEnabled() const
{
return m_enableFaultRA();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultInViewCollection::faultRAAdvancedEnabled() const
{
return m_enableFaultRA() && ( m_faultRASettings->geomechCase() != nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultInViewCollection::enableFaultRA( bool enable )
{
m_enableFaultRA = enable;
}

View File

@ -33,7 +33,6 @@
class RimEclipseView;
class RimFaultInView;
class RimFaultRASettings;
//==================================================================================================
///
@ -64,11 +63,6 @@ public:
bool onlyShowFacesWithDefinedNeighbor() const;
RimFaultRASettings* faultRASettings() const;
bool faultRAEnabled() const;
bool faultRAAdvancedEnabled() const;
void enableFaultRA( bool enable );
caf::PdmField<bool> showFaultFaces;
caf::PdmField<bool> showOppositeFaultFaces;
@ -98,7 +92,4 @@ private:
private:
caf::PdmField<bool> m_showFaultsOutsideFilters;
caf::PdmField<bool> m_onlyShowWithNeighbor;
caf::PdmChildField<RimFaultRASettings*> m_faultRASettings;
caf::PdmField<bool> m_enableFaultRA;
};

View File

@ -1,173 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFaultRAPostprocSettings.h"
#include "RimDoubleParameter.h"
#include "RimFaultRASettings.h"
#include "RimParameterGroup.h"
#define _USE_MATH_DEFINES
#include <cmath>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRAPostprocSettings::RimFaultRAPostprocSettings()
{
CAF_PDM_InitObject( "Reactivation Assessment Postproc Settings", ":/fault_react_24x24.png" );
CAF_PDM_InitField( &m_baseDir, "BaseDir", QString( "" ), "Working Directory" );
CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" );
CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step" );
CAF_PDM_InitField( &m_geomechEnabled, "GeomechEnabled", false, "GeoMechanical Input Available" );
CAF_PDM_InitField( &m_basicMacrisDatabase, "BasicMacrisDatabase", QString( "" ), "Basic Macris Database" );
CAF_PDM_InitField( &m_advancedMacrisDatabase, "AdvancedMacrisDatabase", QString( "" ), "Advanced Macris Database" );
CAF_PDM_InitFieldNoDefault( &m_postprocParameters, "PostprocParameters", "Post-Processing Parameters" );
m_postprocParameters = new RimParameterGroup();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRAPostprocSettings::~RimFaultRAPostprocSettings()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPostprocSettings::initFromSettings( RimFaultRASettings* settings )
{
m_geomechEnabled = settings->geomechCase() != nullptr;
m_baseDir = settings->outputBaseDirectory();
m_startTimestepEclipse = settings->startTimeStepEclipseIndex();
m_endTimestepEclipse = settings->endTimeStepEclipseIndex();
m_basicMacrisDatabase = settings->basicMacrisDatabase();
m_advancedMacrisDatabase = settings->advancedMacrisDatabase();
RimDoubleParameter* friction_angle =
dynamic_cast<RimDoubleParameter*>( settings->getInputParameter( "friction_angle" ) );
if ( friction_angle != nullptr )
{
m_postprocParameters->addParameter( "friction_coef", std::atan( friction_angle->value() / 180.0 * M_PI ) );
}
RimDoubleParameter* rho_rock = dynamic_cast<RimDoubleParameter*>( settings->getInputParameter( "rho_rock" ) );
if ( rho_rock != nullptr )
{
m_postprocParameters->addParameter( "rockdensity", rho_rock->value() );
}
RimDoubleParameter* k0_effective =
dynamic_cast<RimDoubleParameter*>( settings->getInputParameter( "k0_effective" ) );
if ( k0_effective != nullptr )
{
m_postprocParameters->addParameter( "k0", k0_effective->value() );
}
RimDoubleParameter* sh_ratio = dynamic_cast<RimDoubleParameter*>( settings->getInputParameter( "sh_ratio" ) );
if ( sh_ratio != nullptr )
{
m_postprocParameters->addParameter( "sh_ratio", sh_ratio->value() );
}
RimDoubleParameter* s_azimuth = dynamic_cast<RimDoubleParameter*>( settings->getInputParameter( "s_azimuth" ) );
if ( s_azimuth != nullptr )
{
m_postprocParameters->addParameter( "sh_azim", s_azimuth->value() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimFaultRAPostprocSettings::stepsToLoad()
{
QStringList timesteps;
for ( int i = m_startTimestepEclipse(); i <= m_endTimestepEclipse(); i++ )
{
timesteps.push_back( QString::number( i ) );
}
return timesteps;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPostprocSettings::postprocParameterFilename( int faultID ) const
{
QString retval = m_baseDir;
retval += QString( "/tmp/postproc_%1.json" ).arg( faultID, 3, 10, QChar( '0' ) );
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPostprocSettings::outputBaseDirectory() const
{
return m_baseDir;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPostprocSettings::advancedMacrisDatabase() const
{
return m_advancedMacrisDatabase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPostprocSettings::basicMacrisDatabase() const
{
return m_basicMacrisDatabase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimParameterGroup* RimFaultRAPostprocSettings::parameters() const
{
return m_postprocParameters;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultRAPostprocSettings::geomechEnabled() const
{
return m_geomechEnabled;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimFaultRAPostprocSettings::postprocCommandParameters( int faultID ) const
{
QStringList retlist;
retlist << postprocParameterFilename( faultID );
return retlist;
}

View File

@ -1,61 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <list>
#include <QString>
#include <QStringList>
class RimFaultRASettings;
class RimParameterGroup;
class RimFaultRAPostprocSettings : public caf::PdmObject
{
public:
RimFaultRAPostprocSettings();
~RimFaultRAPostprocSettings() override;
void initFromSettings( RimFaultRASettings* settings );
QStringList stepsToLoad();
QString postprocParameterFilename( int faultID ) const;
QString outputBaseDirectory() const;
QString basicMacrisDatabase() const;
QString advancedMacrisDatabase() const;
bool geomechEnabled() const;
RimParameterGroup* parameters() const;
QStringList postprocCommandParameters( int faultID ) const;
protected:
caf::PdmField<QString> m_baseDir;
caf::PdmField<int> m_startTimestepEclipse;
caf::PdmField<int> m_endTimestepEclipse;
caf::PdmField<bool> m_geomechEnabled;
caf::PdmField<QString> m_basicMacrisDatabase;
caf::PdmField<QString> m_advancedMacrisDatabase;
caf::PdmPtrField<RimParameterGroup*> m_postprocParameters;
};

View File

@ -1,451 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFaultRAPreprocSettings.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RimEclipseResultCase.h"
#include "RimGeoMechCase.h"
#include "RimProject.h"
#include "RimTools.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiFilePathEditor.h"
#include <QDir>
#include <QFileInfo>
CAF_PDM_SOURCE_INIT( RimFaultRAPreprocSettings, "RimFaultRAPreprocSettings" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRAPreprocSettings::RimFaultRAPreprocSettings()
{
CAF_PDM_InitObject( "Fault RA Preproc Settings", ":/fault_react_24x24.png" );
CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" );
m_startTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step" );
m_endTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step" );
m_startTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step" );
m_endTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" );
m_eclipseCase.setValue( nullptr );
CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case" );
m_geomechCase.setValue( nullptr );
CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Output Directory" );
m_baseDir.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &m_cleanBaseDir, "CleanBaseDir", false, "Clean Output Directory" );
CAF_PDM_InitField( &m_smoothEclipseData, "SmoothEclipseData", true, "Smooth Eclipse Data" );
CAF_PDM_InitField( &m_elasticTableFilename, "ElasticTableFilename", QString( "" ), "Elastic Table" );
m_elasticTableFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_elasticTableFilename.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRAPreprocSettings::~RimFaultRAPreprocSettings()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPreprocSettings::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
if ( ( changedField == &m_eclipseCase ) && ( m_startTimestepEclipse == m_endTimestepEclipse ) )
{
m_endTimestepEclipse = m_eclipseCase()->timeStepStrings().size() - 1;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPreprocSettings::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPreprocSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
if ( m_geomechCase() )
{
auto geomechGroup = uiOrdering.addNewGroup( "GeoMechanical Model" );
geomechGroup->add( &m_geomechCase );
geomechGroup->add( &m_startTimestepGeoMech );
geomechGroup->add( &m_endTimestepGeoMech );
auto tableGroup = uiOrdering.addNewGroup( "Elastic Table" );
tableGroup->add( &m_elasticTableFilename );
}
auto eclipseGroup = uiOrdering.addNewGroup( "Eclipse Model" );
eclipseGroup->add( &m_eclipseCase );
eclipseGroup->add( &m_smoothEclipseData );
eclipseGroup->add( &m_startTimestepEclipse );
eclipseGroup->add( &m_endTimestepEclipse );
auto outputGroup = uiOrdering.addNewGroup( "Output Settings" );
outputGroup->add( &m_baseDir );
outputGroup->add( &m_cleanBaseDir );
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo>
RimFaultRAPreprocSettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_eclipseCase )
{
RimTools::eclipseCaseOptionItems( &options );
}
else if ( fieldNeedingOptions == &m_geomechCase )
{
RimTools::geoMechCaseOptionItems( &options );
}
if ( m_geomechCase() )
{
if ( fieldNeedingOptions == &m_startTimestepGeoMech )
{
RimTools::timeStepsForCase( m_geomechCase, &options );
}
else if ( fieldNeedingOptions == &m_endTimestepGeoMech )
{
RimTools::timeStepsForCase( m_geomechCase, &options );
}
}
if ( m_eclipseCase() )
{
if ( fieldNeedingOptions == &m_startTimestepEclipse )
{
RimTools::timeStepsForCase( m_eclipseCase, &options );
}
else if ( fieldNeedingOptions == &m_endTimestepEclipse )
{
RimTools::timeStepsForCase( m_eclipseCase, &options );
}
}
return options;
}
RimCase* RimFaultRAPreprocSettings::startCase() const
{
if ( m_geomechCase() ) return m_geomechCase();
return m_eclipseCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRAPreprocSettings::startTimeStepEclipseIndex() const
{
return m_startTimestepEclipse();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::startTimeStepEclipse() const
{
if ( m_eclipseCase() )
{
if ( ( m_startTimestepEclipse >= 0 ) && ( m_startTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
return m_eclipseCase->timeStepStrings()[m_startTimestepEclipse];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRAPreprocSettings::endTimeStepEclipseIndex() const
{
return m_endTimestepEclipse();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::endTimeStepEclipse() const
{
if ( m_eclipseCase() )
{
if ( ( m_endTimestepEclipse >= 0 ) && ( m_endTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
return m_eclipseCase->timeStepStrings()[m_endTimestepEclipse];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::eclipseCaseFilename() const
{
if ( m_eclipseCase ) return m_eclipseCase->gridFileName();
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRAPreprocSettings::startTimeStepGeoMechIndex() const
{
return m_startTimestepGeoMech();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::startTimeStepGeoMech() const
{
if ( m_geomechCase() )
{
if ( ( m_startTimestepGeoMech >= 0 ) && ( m_startTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
return m_geomechCase->timeStepStrings()[m_startTimestepGeoMech];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRAPreprocSettings::endTimeStepGeoMechIndex() const
{
return m_endTimestepGeoMech();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::endTimeStepGeoMech() const
{
if ( m_geomechCase() )
{
if ( ( m_endTimestepGeoMech >= 0 ) && ( m_endTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
return m_geomechCase->timeStepStrings()[m_endTimestepGeoMech];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::geomechCaseFilename() const
{
if ( m_geomechCase ) return m_geomechCase->gridFileName();
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::elasticTableFilename() const
{
return m_elasticTableFilename();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::preprocParameterFilename() const
{
return m_baseDir + "/tmp/pre_processing.json";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::outputBaseDirectory() const
{
return m_baseDir();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultRAPreprocSettings::cleanBaseDirectory() const
{
return m_cleanBaseDir();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPreprocSettings::setCleanBaseDirectory( bool clean )
{
m_cleanBaseDir = clean;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultRAPreprocSettings::smoothEclipseData() const
{
return m_smoothEclipseData();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPreprocSettings::setGeoMechCase( RimGeoMechCase* geomechCase )
{
m_geomechCase = geomechCase;
if ( geomechCase ) m_endTimestepGeoMech = geomechCase->timeStepStrings().size() - 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase* RimFaultRAPreprocSettings::geoMechCase() const
{
return m_geomechCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPreprocSettings::setEclipseCase( RimEclipseResultCase* eclipseCase )
{
m_eclipseCase = eclipseCase;
if ( eclipseCase ) m_endTimestepEclipse = eclipseCase->timeStepStrings().size() - 1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimFaultRAPreprocSettings::eclipseCase() const
{
return m_eclipseCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRAPreprocSettings::setOutputBaseDirectory( QString baseDir )
{
m_baseDir = baseDir;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::outputEclipseFilename() const
{
QString retval = outputEclipseDirectory();
retval += QDir::separator();
QFileInfo fi( eclipseCaseFilename() );
retval += fi.baseName() + "_RI.GRDECL";
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::outputEclipseDirectory() const
{
QString retval = m_baseDir;
retval += "/Eclipse";
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRAPreprocSettings::outputAbaqusDirectory() const
{
QString retval = m_baseDir;
retval += "/Abaqus";
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimFaultRAPreprocSettings::preprocParameterList() const
{
QStringList retlist;
retlist << preprocParameterFilename();
return retlist;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimFaultRAPreprocSettings::macrisPrepareParameterList() const
{
QStringList retlist;
retlist << "prepare";
retlist << "-o";
retlist << outputEclipseDirectory();
if ( m_smoothEclipseData )
{
retlist << "-ds";
}
else
{
retlist << "-d";
}
retlist << m_eclipseCase()->gridFileName();
return retlist;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultRAPreprocSettings::geoMechSelected() const
{
return m_geomechCase.value() != nullptr;
}

View File

@ -1,96 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
class RimEclipseResultCase;
class RimEclipseCase;
class RimGeoMechCase;
class RimCase;
class RimFaultRAPreprocSettings : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFaultRAPreprocSettings();
~RimFaultRAPreprocSettings() override;
void setGeoMechCase( RimGeoMechCase* geomechCase );
RimGeoMechCase* geoMechCase() const;
void setEclipseCase( RimEclipseResultCase* eclipseCase );
RimEclipseCase* eclipseCase() const;
void setOutputBaseDirectory( QString baseDir );
QString outputBaseDirectory() const;
int startTimeStepGeoMechIndex() const;
QString startTimeStepGeoMech() const;
int endTimeStepGeoMechIndex() const;
QString endTimeStepGeoMech() const;
int startTimeStepEclipseIndex() const;
QString startTimeStepEclipse() const;
int endTimeStepEclipseIndex() const;
QString endTimeStepEclipse() const;
QString eclipseCaseFilename() const;
QString geomechCaseFilename() const;
bool smoothEclipseData() const;
QString elasticTableFilename() const;
bool cleanBaseDirectory() const;
void setCleanBaseDirectory( bool clean );
bool geoMechSelected() const;
QString preprocParameterFilename() const;
QString outputEclipseFilename() const;
QString outputEclipseDirectory() const;
QString outputAbaqusDirectory() const;
QStringList preprocParameterList() const;
QStringList macrisPrepareParameterList() const;
protected:
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
RimCase* startCase() const;
caf::PdmField<int> m_startTimestepEclipse;
caf::PdmField<int> m_endTimestepEclipse;
caf::PdmField<int> m_startTimestepGeoMech;
caf::PdmField<int> m_endTimestepGeoMech;
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseCase;
caf::PdmField<bool> m_smoothEclipseData;
caf::PdmPtrField<RimGeoMechCase*> m_geomechCase;
caf::PdmField<QString> m_baseDir;
caf::PdmField<bool> m_cleanBaseDir;
caf::PdmField<QString> m_elasticTableFilename;
};

View File

@ -1,627 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 - 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimFaultRASettings.h"
#include "RimFaultRAPreprocSettings.h"
#include "RiaApplication.h"
#include "RiaPreferencesGeoMech.h"
#include "RimDoubleParameter.h"
#include "RimEclipseCase.h"
#include "RimEclipseInputCase.h"
#include "RimEclipseResultCase.h"
#include "RimGenericParameter.h"
#include "RimGeoMechCase.h"
#include "RimIntegerParameter.h"
#include "RimParameterGroup.h"
#include "RimProject.h"
#include "RimStringParameter.h"
#include "RimTools.h"
#include "RifParameterXmlReader.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiComboBoxEditor.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiTableViewEditor.h"
#include "cafPdmUiTreeOrdering.h"
#include <QFileInfo>
#include <cmath>
CAF_PDM_SOURCE_INIT( RimFaultRASettings, "RimFaultRASettings" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRASettings::RimFaultRASettings()
{
CAF_PDM_InitObject( "Reactivation Assessment Settings", ":/fault_react_24x24.png" );
CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" );
m_eclipseCase.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case" );
m_geomechCase.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_eclipseFRAGeneratedCase, "EclipseFRACase", "Eclipse FRA Case" );
m_eclipseFRAGeneratedCase.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Working Directory" );
m_baseDir.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &m_elasticTableFilename, "ElasticTableFilename", QString( "" ), "Elastic Table" );
m_elasticTableFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
m_elasticTableFilename.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" );
m_startTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step" );
m_endTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step" );
m_startTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
m_startTimestepGeoMech.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step" );
m_endTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
m_endTimestepGeoMech.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_basicParameters, "BasicParameters", "Basic Processing Parameters", ":/Bullet.png" );
CAF_PDM_InitFieldNoDefault( &m_advancedParameters, "AdvancedParameters", "Advanced Processing Parameters", ":/Bullet.png" );
CAF_PDM_InitFieldNoDefault( &m_basicParametersRI, "BasicParametersRI", "Basic ResInsight Parameters" );
CAF_PDM_InitFieldNoDefault( &m_advancedParametersRI, "AdvancedParametersRI", "Advanced ResInsight Parameters" );
setupResInsightParameters();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultRASettings::~RimFaultRASettings()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimFaultRASettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
{
QList<caf::PdmOptionItemInfo> options;
if ( fieldNeedingOptions == &m_eclipseCase )
{
RimTools::eclipseCaseOptionItems( &options );
}
else if ( fieldNeedingOptions == &m_geomechCase )
{
RimTools::geoMechCaseOptionItems( &options );
}
if ( m_geomechCase() )
{
if ( fieldNeedingOptions == &m_startTimestepGeoMech )
{
RimTools::timeStepsForCase( m_geomechCase, &options );
}
else if ( fieldNeedingOptions == &m_endTimestepGeoMech )
{
RimTools::timeStepsForCase( m_geomechCase, &options );
}
}
if ( m_eclipseCase() )
{
if ( fieldNeedingOptions == &m_startTimestepEclipse )
{
RimTools::timeStepsForCase( m_eclipseCase(), &options );
}
else if ( fieldNeedingOptions == &m_endTimestepEclipse )
{
RimTools::timeStepsForCase( m_eclipseCase(), &options );
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_baseDir );
auto eclipseGroup = uiOrdering.addNewGroup( "Eclipse Time Steps" );
eclipseGroup->add( &m_startTimestepEclipse );
eclipseGroup->add( &m_endTimestepEclipse );
if ( m_geomechCase() != nullptr )
{
auto geomechGroup = uiOrdering.addNewGroup( "GeoMech Time Steps" );
geomechGroup->add( &m_startTimestepGeoMech );
geomechGroup->add( &m_endTimestepGeoMech );
auto tableGroup = uiOrdering.addNewGroup( "Additional Settings" );
tableGroup->add( &m_elasticTableFilename );
}
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
{
uiTreeOrdering.add( &m_basicParameters );
uiTreeOrdering.add( &m_advancedParameters );
uiTreeOrdering.skipRemainingChildren();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::eclipseCaseFilename() const
{
if ( m_eclipseCase ) return m_eclipseCase->gridFileName();
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimFaultRASettings::eclipseCase() const
{
return m_eclipseCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseInputCase* RimFaultRASettings::eclipseFRAGeneratedCase() const
{
return m_eclipseFRAGeneratedCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::geomechCaseFilename() const
{
if ( m_geomechCase ) return m_geomechCase->gridFileName();
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::geomechCaseName() const
{
QFileInfo fi( geomechCaseFilename() );
return fi.baseName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase* RimFaultRASettings::geomechCase() const
{
return m_geomechCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::outputBaseDirectory() const
{
return m_baseDir();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::setGeoMechCase( RimGeoMechCase* geomechCase )
{
m_geomechCase = geomechCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::setOutputBaseDirectory( QString baseDir )
{
m_baseDir = baseDir;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::initFromPreprocSettings( RimFaultRAPreprocSettings* preprocSettings,
RimEclipseInputCase* eclipseCase )
{
m_geomechCase = preprocSettings->geoMechCase();
m_eclipseCase = preprocSettings->eclipseCase();
m_eclipseFRAGeneratedCase = eclipseCase;
m_baseDir = preprocSettings->outputBaseDirectory();
m_startTimestepEclipse = preprocSettings->startTimeStepEclipseIndex();
m_endTimestepEclipse = preprocSettings->endTimeStepEclipseIndex();
m_startTimestepGeoMech = preprocSettings->startTimeStepGeoMechIndex();
m_endTimestepGeoMech = preprocSettings->endTimeStepGeoMechIndex();
m_elasticTableFilename = preprocSettings->elasticTableFilename();
QString errorText;
RifParameterXmlReader basicreader( RiaPreferencesGeoMech::current()->geomechFRADefaultBasicXML() );
if ( !basicreader.parseFile( errorText ) ) return;
m_basicParameters.deleteChildren();
for ( auto group : basicreader.parameterGroups() )
{
m_basicParameters.push_back( group );
}
if ( geomechCase() != nullptr )
{
RifParameterXmlReader advreader( RiaPreferencesGeoMech::current()->geomechFRADefaultAdvXML() );
if ( !advreader.parseFile( errorText ) ) return;
m_advancedParameters.deleteChildren();
for ( auto group : advreader.parameterGroups() )
{
m_advancedParameters.push_back( group );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRASettings::startTimeStepEclipseIndex() const
{
return m_startTimestepEclipse();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::startTimeStepEclipse() const
{
if ( m_eclipseCase() )
{
if ( ( m_startTimestepEclipse >= 0 ) && ( m_startTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
return m_eclipseCase->timeStepStrings()[m_startTimestepEclipse];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRASettings::endTimeStepEclipseIndex() const
{
return m_endTimestepEclipse();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::endTimeStepEclipse() const
{
if ( m_eclipseCase() )
{
if ( ( m_endTimestepEclipse >= 0 ) && ( m_endTimestepEclipse <= m_eclipseCase->timeStepStrings().size() ) )
return m_eclipseCase->timeStepStrings()[m_endTimestepEclipse];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRASettings::startTimeStepGeoMechIndex() const
{
return m_startTimestepGeoMech();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::startTimeStepGeoMech() const
{
if ( m_geomechCase() )
{
if ( ( m_startTimestepGeoMech >= 0 ) && ( m_startTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
return m_geomechCase->timeStepStrings()[m_startTimestepGeoMech];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRASettings::endTimeStepGeoMechIndex() const
{
return m_endTimestepGeoMech();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::endTimeStepGeoMech() const
{
if ( m_geomechCase() )
{
if ( ( m_endTimestepGeoMech >= 0 ) && ( m_endTimestepGeoMech <= m_geomechCase->timeStepStrings().size() ) )
return m_geomechCase->timeStepStrings()[m_endTimestepGeoMech];
}
return "";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::setEclipseTimeStepIndexes( int start, int stop )
{
m_startTimestepEclipse = start;
m_endTimestepEclipse = stop;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::setGeomechTimeStepIndexes( int start, int stop )
{
m_startTimestepGeoMech = start;
m_endTimestepGeoMech = stop;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::list<RimGenericParameter*> RimFaultRASettings::basicParameters( int faultID )
{
m_basicParametersRI->setParameterValue( "eclipse_input_grid", eclipseCaseFilename() );
m_basicParametersRI->setParameterValue( "faultid", faultID );
std::list<RimGenericParameter*> retlist;
for ( auto& p : m_basicParametersRI->parameters() )
{
retlist.push_back( p );
}
for ( auto& group : m_basicParameters.children() )
{
for ( auto& p : group->parameters() )
{
retlist.push_back( p );
}
}
return retlist;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::list<RimGenericParameter*> RimFaultRASettings::advancedParameters( int faultID )
{
bool advanced = true;
m_advancedParametersRI->setParameterValue( "eclipse_loadstep_start", loadStepStart( advanced ) );
m_advancedParametersRI->setParameterValue( "eclipse_loadstep_end", loadStepEnd() );
m_advancedParametersRI->setParameterValue( "faultid_calibration", faultID );
m_advancedParametersRI->setParameterValue( "abaqus_elastic_properties", elasticPropertiesFilename() );
m_advancedParametersRI->setParameterValue( "abaqus_stress_start", stressStartFilename() );
m_advancedParametersRI->setParameterValue( "abaqus_stress_end", stressEndFilename() );
std::list<RimGenericParameter*> retlist;
for ( auto& p : m_advancedParametersRI->parameters() )
{
retlist.push_back( p );
}
for ( auto& group : m_advancedParameters.children() )
{
for ( auto& p : group->parameters() )
{
retlist.push_back( p );
}
}
return retlist;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFaultRASettings::setupResInsightParameters()
{
m_basicParametersRI = new RimParameterGroup();
m_basicParametersRI->setName( "ResInsight Basic" );
m_basicParametersRI->addParameter( "eclipse_input_grid", "" );
m_basicParametersRI->addParameter( "faultid", -1 );
m_advancedParametersRI = new RimParameterGroup();
m_advancedParametersRI->setName( "ResInsight Advanced" );
m_advancedParametersRI->addParameter( "abaqus_elastic_properties", "" );
m_advancedParametersRI->addParameter( "abaqus_stress_start", "" );
m_advancedParametersRI->addParameter( "abaqus_stress_end", "" );
m_advancedParametersRI->addParameter( "faultid_calibration", -1 );
m_advancedParametersRI->addParameter( "eclipse_loadstep_start", "" );
m_advancedParametersRI->addParameter( "eclipse_loadstep_end", "" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::elasticPropertiesFilename() const
{
return m_elasticTableFilename;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::stressStartFilename() const
{
QString filename = QString( "/%1/%2_%3_stress.rpt" ).arg( "Abaqus", geomechCaseName(), startTimeStepGeoMech() );
return m_baseDir + filename;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::stressEndFilename() const
{
QString filename = QString( "/%1/%2_%3_stress.rpt" ).arg( "Abaqus", geomechCaseName(), endTimeStepGeoMech() );
return m_baseDir + filename;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::basicMacrisDatabase() const
{
return m_baseDir + "/MacrisCalcResult.sqlite3";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::advancedMacrisDatabase() const
{
return m_baseDir + "/MacrisCalcCalibration.sqlite3";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimFaultRASettings::timeStepDigits() const
{
if ( m_eclipseCase == nullptr ) return 1;
int timesteps = m_eclipseCase->timeStepStrings().size();
if ( timesteps <= 0 ) return 1;
return 1 + (int)( std::log10( 1.0 * timesteps ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::loadStepStart( bool advanced /* = false */ ) const
{
int startStep = 0;
if ( !advanced ) startStep = startTimeStepEclipseIndex();
QString retval = QString( "PRESSURE_%1" ).arg( startStep, timeStepDigits(), 10, QChar( '0' ) );
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::loadStepEnd() const
{
QString retval = QString( "PRESSURE_%1" ).arg( endTimeStepEclipseIndex(), timeStepDigits(), 10, QChar( '0' ) );
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::basicParameterXMLFilename( int faultID ) const
{
QString retval = m_baseDir;
retval += QString( "/tmp/calculate_%1.xml" ).arg( faultID, 3, 10, QChar( '0' ) );
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::advancedParameterXMLFilename( int faultID ) const
{
QString retval = m_baseDir;
retval += QString( "/tmp/calibrate_%1.xml" ).arg( faultID, 3, 10, QChar( '0' ) );
return retval;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimFaultRASettings::basicMacrisParameters( int faultID ) const
{
QStringList retlist;
retlist << "calculate";
retlist << basicParameterXMLFilename( faultID );
retlist << m_baseDir();
retlist << "-i";
retlist << loadStepStart();
retlist << loadStepEnd();
return retlist;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimFaultRASettings::advancedMacrisParameters( int faultID ) const
{
QStringList retlist;
retlist << "calibrate";
retlist << basicParameterXMLFilename( faultID );
retlist << advancedParameterXMLFilename( faultID );
retlist << m_baseDir();
return retlist;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFaultRASettings::tsurfOutputDirectory() const
{
return m_baseDir + "/tsurf";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGenericParameter* RimFaultRASettings::getInputParameter( QString name ) const
{
RimGenericParameter* retval = nullptr;
for ( auto group : m_basicParameters.children() )
{
retval = group->parameter( name );
if ( retval != nullptr ) return retval;
}
for ( auto group : m_advancedParameters.children() )
{
retval = group->parameter( name );
if ( retval != nullptr ) return retval;
}
return retval;
}

View File

@ -1,118 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include <list>
#include <string>
class RimEclipseInputCase;
class RimEclipseCase;
class RimGeoMechCase;
class RimParameterGroup;
class RimFaultRAPreprocSettings;
class RimGenericParameter;
class RimFaultRASettings : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFaultRASettings();
~RimFaultRASettings() override;
void initFromPreprocSettings( RimFaultRAPreprocSettings* preprocsettings, RimEclipseInputCase* eclipseCase );
void setGeoMechCase( RimGeoMechCase* geomechCase );
RimGeoMechCase* geomechCase() const;
QString geomechCaseFilename() const;
QString geomechCaseName() const;
RimEclipseInputCase* eclipseFRAGeneratedCase() const;
RimEclipseCase* eclipseCase() const;
QString eclipseCaseFilename() const;
void setOutputBaseDirectory( QString baseDir );
QString outputBaseDirectory() const;
int startTimeStepGeoMechIndex() const;
QString startTimeStepGeoMech() const;
int endTimeStepGeoMechIndex() const;
QString endTimeStepGeoMech() const;
void setEclipseTimeStepIndexes( int start, int stop );
void setGeomechTimeStepIndexes( int start, int stop );
int startTimeStepEclipseIndex() const;
QString startTimeStepEclipse() const;
QString loadStepStart( bool advanced = false ) const;
int endTimeStepEclipseIndex() const;
QString endTimeStepEclipse() const;
QString loadStepEnd() const;
std::list<RimGenericParameter*> basicParameters( int faultID );
std::list<RimGenericParameter*> advancedParameters( int faultID );
QString elasticPropertiesFilename() const;
QString stressStartFilename() const;
QString stressEndFilename() const;
QString basicMacrisDatabase() const;
QString advancedMacrisDatabase() const;
QString basicParameterXMLFilename( int faultID ) const;
QString advancedParameterXMLFilename( int faultID ) const;
QStringList basicMacrisParameters( int faultID ) const;
QStringList advancedMacrisParameters( int faultID ) const;
QString tsurfOutputDirectory() const;
RimGenericParameter* getInputParameter( QString name ) const;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
private:
void setupResInsightParameters();
int timeStepDigits() const;
private:
caf::PdmPtrField<RimEclipseInputCase*> m_eclipseFRAGeneratedCase;
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
caf::PdmPtrField<RimGeoMechCase*> m_geomechCase;
caf::PdmField<QString> m_baseDir;
caf::PdmField<QString> m_elasticTableFilename;
caf::PdmField<int> m_startTimestepEclipse;
caf::PdmField<int> m_endTimestepEclipse;
caf::PdmField<int> m_startTimestepGeoMech;
caf::PdmField<int> m_endTimestepGeoMech;
caf::PdmChildArrayField<RimParameterGroup*> m_basicParameters;
caf::PdmChildArrayField<RimParameterGroup*> m_advancedParameters;
caf::PdmChildField<RimParameterGroup*> m_basicParametersRI;
caf::PdmChildField<RimParameterGroup*> m_advancedParametersRI;
};

View File

@ -282,13 +282,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "Separator";
menuBuilder << "RicCopyReferencesToClipboardFeature";
menuBuilder << "Separator";
#ifdef USE_ODB_API
if ( dynamic_cast<RimEclipseResultCase*>( firstUiItem ) )
{
menuBuilder << "RicNewFaultReactAssessmentFeature";
menuBuilder << "Separator";
}
#endif
}
else if ( dynamic_cast<RimGridInfoCollection*>( firstUiItem ) )
{
@ -306,8 +299,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "Separator";
menuBuilder << "RicGeoMechCopyCaseFeature";
menuBuilder << "Separator";
menuBuilder << "RicNewFaultReactAssessmentFeature";
menuBuilder << "Separator";
}
else if ( dynamic_cast<RimIdenticalGridCaseGroup*>( firstUiItem ) )
{
@ -1224,19 +1215,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
else if ( dynamic_cast<RimFaultInView*>( firstUiItem ) )
{
menuBuilder << "RicExportFaultsFeature";
#ifdef USE_ODB_API
menuBuilder.subMenuStart( "Reactivation Assessment" );
menuBuilder << "RicRunBasicFaultReactAssessmentFeature";
menuBuilder << "RicRunAdvFaultReactAssessmentFeature";
menuBuilder.subMenuEnd();
}
else if ( dynamic_cast<RimFaultInViewCollection*>( firstUiItem ) )
{
menuBuilder.subMenuStart( "Reactivation Assessment" );
menuBuilder << "RicRunBasicFaultReactAssessmentFeature";
menuBuilder << "RicRunAdvFaultReactAssessmentFeature";
menuBuilder.subMenuEnd();
#endif
}
else if ( dynamic_cast<RimSimWellInView*>( firstUiItem ) )
{

View File

@ -449,22 +449,6 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
QVariant( fault->name() ) );
menuBuilder.addSeparator();
if ( eclipseView->faultCollection() && eclipseView->faultCollection()->faultRAEnabled() )
{
menuBuilder.subMenuStart( "Reactivation Assessment" );
menuBuilder.addCmdFeatureWithUserData( "RicRunBasicFaultReactAssessment3dFeature",
"Run Basic Processing",
QVariant( fault->name() ) );
if ( eclipseView->faultCollection()->faultRAAdvancedEnabled() )
{
menuBuilder.addCmdFeatureWithUserData( "RicRunAdvFaultReactAssessment3dFeature",
"Run Advanced Processing",
QVariant( fault->name() ) );
}
menuBuilder.subMenuEnd();
menuBuilder.addSeparator();
}
}
}