mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' into sigurdp/vizfwk-qopenglwidget
This commit is contained in:
commit
88a252e19b
@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaMemoryCleanup.h"
|
||||
#include "RiaStdStringTools.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseResultInfo.h"
|
||||
@ -34,6 +35,10 @@
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -55,6 +60,9 @@ RiaMemoryCleanup::RiaMemoryCleanup()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_performDelete, "ClearSelectedData", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_performDelete );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_showMemoryReport, "ShowMemoryReport", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_showMemoryReport );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -107,6 +115,38 @@ void RiaMemoryCleanup::clearSelectedResultsFromMemory()
|
||||
m_geomResultAddresses.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class TextDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
TextDialog( const QString& text, QWidget* parent = nullptr )
|
||||
: QDialog( parent )
|
||||
{
|
||||
auto textWidget = new QTextEdit( "", this );
|
||||
textWidget->setPlainText( text );
|
||||
auto layout = new QVBoxLayout( this );
|
||||
layout->addWidget( textWidget );
|
||||
setLayout( layout );
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaMemoryCleanup::showMemoryReport()
|
||||
{
|
||||
auto [summary, details] = createMemoryReport();
|
||||
|
||||
QString allText = summary + "\n\n" + details;
|
||||
|
||||
auto dialog = new TextDialog( allText );
|
||||
dialog->setWindowTitle( "Memory Report" );
|
||||
dialog->setMinimumSize( 800, 600 );
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -204,6 +244,12 @@ void RiaMemoryCleanup::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
m_resultsToDelete.uiCapability()->updateConnectedEditors();
|
||||
m_performDelete = false;
|
||||
}
|
||||
else if ( changedField == &m_showMemoryReport )
|
||||
{
|
||||
m_showMemoryReport = false;
|
||||
|
||||
showMemoryReport();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -310,10 +356,72 @@ void RiaMemoryCleanup::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
{
|
||||
if ( field == &m_performDelete )
|
||||
{
|
||||
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Clear Checked Data From Memory";
|
||||
}
|
||||
}
|
||||
if ( field == &m_showMemoryReport )
|
||||
{
|
||||
auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Show Memory Report";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<QString, QString> RiaMemoryCleanup::createMemoryReport()
|
||||
{
|
||||
QString details;
|
||||
|
||||
auto allCases = RimProject::current()->allGridCases();
|
||||
|
||||
size_t totalMemory = 0;
|
||||
for ( auto gridCase : allCases )
|
||||
{
|
||||
if ( auto eclipseCase = dynamic_cast<RimEclipseCase*>( gridCase ) )
|
||||
{
|
||||
RigCaseCellResultsData* caseData = eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
if ( caseData )
|
||||
{
|
||||
size_t totalMemoryForCase = 0;
|
||||
QString caseReport;
|
||||
|
||||
auto memoryUse = caseData->resultValueCount();
|
||||
for ( const auto& [name, valueCount] : memoryUse )
|
||||
{
|
||||
if ( valueCount > 0 )
|
||||
{
|
||||
size_t memory = valueCount * sizeof( double );
|
||||
totalMemoryForCase += memory;
|
||||
|
||||
auto formattedValueCount = RiaStdStringTools::formatThousandGrouping( valueCount );
|
||||
|
||||
caseReport += QString( " %1 MB\tValue count %2, %3\n" )
|
||||
.arg( memory / 1024.0 / 1024.0, 0, 'f', 2 )
|
||||
.arg( QString::fromStdString( formattedValueCount ) )
|
||||
.arg( QString::fromStdString( name ) );
|
||||
}
|
||||
}
|
||||
|
||||
totalMemory += totalMemoryForCase;
|
||||
|
||||
if ( totalMemoryForCase > 0 )
|
||||
{
|
||||
details +=
|
||||
QString( "%1 - %2 MB\n" ).arg( eclipseCase->caseUserDescription() ).arg( totalMemoryForCase / 1024.0 / 1024.0, 0, 'f', 2 );
|
||||
|
||||
details += caseReport;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString summary = QString( "Total memory used: %1 MB\n\n" ).arg( totalMemory / 1024.0 / 1024.0, 0, 'f', 2 );
|
||||
return std::make_pair( summary, details );
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
void setPropertiesFromView( Rim3dView* view );
|
||||
void clearSelectedResultsFromMemory();
|
||||
|
||||
static void showMemoryReport();
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
@ -52,10 +54,13 @@ private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
static std::pair<QString, QString> createMemoryReport();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
caf::PdmField<std::vector<size_t>> m_resultsToDelete;
|
||||
std::vector<RigFemResultAddress> m_geomResultAddresses;
|
||||
std::vector<RigEclipseResultAddress> m_eclipseResultAddresses;
|
||||
caf::PdmField<bool> m_performDelete;
|
||||
caf::PdmField<bool> m_showMemoryReport;
|
||||
};
|
||||
|
@ -138,6 +138,26 @@ bool RiaStdStringTools::startsWithAlphabetic( const std::string& s )
|
||||
return isalpha( s[0] ) != 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RiaStdStringTools::formatThousandGrouping( long value )
|
||||
{
|
||||
class my_punct : public std::numpunct<char>
|
||||
{
|
||||
protected:
|
||||
char do_decimal_point() const override { return '.'; }
|
||||
char do_thousands_sep() const override { return ' '; }
|
||||
std::string do_grouping() const override { return std::string( "\3" ); }
|
||||
};
|
||||
|
||||
std::ostringstream os;
|
||||
os.imbue( std::locale( os.getloc(), new my_punct ) );
|
||||
fixed( os );
|
||||
os << value;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -43,6 +43,8 @@ public:
|
||||
static bool containsAlphabetic( const std::string& s );
|
||||
static bool startsWithAlphabetic( const std::string& s );
|
||||
|
||||
static std::string formatThousandGrouping( long value );
|
||||
|
||||
// Conversion using fastest known approach
|
||||
static bool toDouble( const std::string_view& s, double& value );
|
||||
static bool toInt( const std::string_view& s, int& value );
|
||||
|
@ -20,6 +20,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowClassNamesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataCtxFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicOpenInTextEditorFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowMemoryReportFeature.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@ -44,6 +45,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowClassNamesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataCtxFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicOpenInTextEditorFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicShowMemoryReportFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024 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 "RicShowMemoryReportFeature.h"
|
||||
|
||||
#include "RiaMemoryCleanup.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicShowMemoryReportFeature, "RicShowMemoryReportFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowMemoryReportFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RiaMemoryCleanup::showMemoryReport();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowMemoryReportFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Memory Report" );
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2024 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 RicShowMemoryReportFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
private:
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
@ -45,7 +45,7 @@ void RicImportSurfacesFeature::onActionTriggered( bool isChecked )
|
||||
QStringList fileNames = RiuFileDialogTools::getOpenFileNames( Riu3DMainWindowTools::mainWindowWidget(),
|
||||
"Import Surfaces",
|
||||
defaultDir,
|
||||
"Surface files (*.ptl *.ts *.dat);;All Files (*.*)" );
|
||||
"Surface files (*.ptl *.ts *.dat *.xyz);;All Files (*.*)" );
|
||||
|
||||
if ( fileNames.isEmpty() ) return;
|
||||
|
||||
|
@ -86,6 +86,7 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream(
|
||||
{ RimFaultReactivation::ElementSets::IntraReservoir, "INTRA_RESERVOIR" },
|
||||
{ RimFaultReactivation::ElementSets::Reservoir, "RESERVOIR" },
|
||||
{ RimFaultReactivation::ElementSets::UnderBurden, "UNDERBURDEN" },
|
||||
{ RimFaultReactivation::ElementSets::FaultZone, "FAULT_ZONE" },
|
||||
};
|
||||
|
||||
bool useGridVoidRatio = rimModel.useGridVoidRatio();
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RigFaultReactivationModel.h"
|
||||
#include "RigGriddedPart3d.h"
|
||||
|
||||
#include "RimFaultReactivationDataAccess.h"
|
||||
#include "RimFaultReactivationModel.h"
|
||||
|
||||
#include <map>
|
||||
|
@ -127,6 +127,10 @@ bool RifReaderOpmCommon::staticResult( const QString& result, RiaDefines::Porosi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Always clear data after reading to avoid memory use
|
||||
m_initFile->clearData();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
@ -179,6 +183,9 @@ bool RifReaderOpmCommon::dynamicResult( const QString& result,
|
||||
}
|
||||
}
|
||||
|
||||
// Always clear data after reading to avoid memory use
|
||||
m_restartFile->clearData();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
@ -441,22 +448,29 @@ std::vector<RifReaderOpmCommon::TimeDataFile> RifReaderOpmCommon::readTimeSteps(
|
||||
{
|
||||
namespace VI = Opm::RestartIO::Helpers::VectorItems;
|
||||
|
||||
for ( auto seqNumber : restartFile->listOfReportStepNumbers() )
|
||||
for ( auto seqNum : restartFile->listOfReportStepNumbers() )
|
||||
{
|
||||
auto fileView = std::make_shared<EclIO::RestartFileView>( restartFile, seqNumber );
|
||||
const std::string inteheadString = "INTEHEAD";
|
||||
const std::string doubheadString = "DOUBHEAD";
|
||||
|
||||
auto intehead = fileView->intehead();
|
||||
if ( restartFile->hasArray( inteheadString, seqNum ) )
|
||||
{
|
||||
auto intehead = restartFile->getRestartData<int>( inteheadString, seqNum );
|
||||
auto year = intehead[VI::intehead::YEAR];
|
||||
auto month = intehead[VI::intehead::MONTH];
|
||||
auto day = intehead[VI::intehead::DAY];
|
||||
|
||||
auto year = intehead[VI::intehead::YEAR];
|
||||
auto month = intehead[VI::intehead::MONTH];
|
||||
auto day = intehead[VI::intehead::DAY];
|
||||
double daySinceSimStart = 0.0;
|
||||
|
||||
auto doubhead = fileView->doubhead();
|
||||
if ( restartFile->hasArray( doubheadString, seqNum ) )
|
||||
{
|
||||
auto doubhead = restartFile->getRestartData<double>( doubheadString, seqNum );
|
||||
daySinceSimStart = doubhead[VI::doubhead::TsInit];
|
||||
}
|
||||
|
||||
auto daySinceSimStart = doubhead[VI::doubhead::TsInit];
|
||||
|
||||
reportTimeData.emplace_back(
|
||||
TimeDataFile{ .sequenceNumber = seqNumber, .year = year, .month = month, .day = day, .simulationTimeFromStart = daySinceSimStart } );
|
||||
reportTimeData.emplace_back(
|
||||
TimeDataFile{ .sequenceNumber = seqNum, .year = year, .month = month, .day = day, .simulationTimeFromStart = daySinceSimStart } );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( std::exception& e )
|
||||
|
@ -90,7 +90,8 @@ RimFaultReactivationDataAccess::RimFaultReactivationDataAccess( const RimFaultRe
|
||||
std::vector<RimFaultReactivation::ElementSets> elementSets = { RimFaultReactivation::ElementSets::OverBurden,
|
||||
RimFaultReactivation::ElementSets::UnderBurden,
|
||||
RimFaultReactivation::ElementSets::Reservoir,
|
||||
RimFaultReactivation::ElementSets::IntraReservoir };
|
||||
RimFaultReactivation::ElementSets::IntraReservoir,
|
||||
RimFaultReactivation::ElementSets::FaultZone };
|
||||
for ( auto e : elementSets )
|
||||
{
|
||||
densities[e] = model.materialParameters( e )[2];
|
||||
|
@ -46,7 +46,8 @@ enum class ElementSets
|
||||
OverBurden,
|
||||
UnderBurden,
|
||||
Reservoir,
|
||||
IntraReservoir
|
||||
IntraReservoir,
|
||||
FaultZone
|
||||
};
|
||||
|
||||
enum class Property
|
||||
|
@ -82,7 +82,7 @@ RimFaultReactivationModel::RimFaultReactivationModel()
|
||||
CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDirectory", "Working Folder" );
|
||||
CAF_PDM_InitField( &m_modelThickness, "ModelThickness", 100.0, "Model Cell Thickness" );
|
||||
|
||||
CAF_PDM_InitField( &m_modelExtentFromAnchor, "ModelExtentFromAnchor", 3000.0, "Horz. Extent from Anchor" );
|
||||
CAF_PDM_InitField( &m_modelExtentFromAnchor, "ModelExtentFromAnchor", 1000.0, "Horz. Extent from Anchor" );
|
||||
CAF_PDM_InitField( &m_modelMinZ, "ModelMinZ", 0.0, "Seabed Depth" );
|
||||
CAF_PDM_InitField( &m_modelBelowSize, "ModelBelowSize", 500.0, "Depth Below Fault" );
|
||||
|
||||
@ -96,6 +96,8 @@ RimFaultReactivationModel::RimFaultReactivationModel()
|
||||
CAF_PDM_InitField( &m_faultExtendDownwards, "FaultExtendDownwards", 0.0, "Below Reservoir" );
|
||||
m_faultExtendDownwards.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_faultZoneCells, "FaultZoneCells", 0, "Fault Zone Width [cells]" );
|
||||
|
||||
CAF_PDM_InitField( &m_showModelPlane, "ShowModelPlane", true, "Show 2D Model" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_fault, "Fault", "Fault" );
|
||||
@ -104,14 +106,14 @@ RimFaultReactivationModel::RimFaultReactivationModel()
|
||||
CAF_PDM_InitField( &m_modelPart1Color, "ModelPart1Color", cvf::Color3f( cvf::Color3f::GREEN ), "Part 1 Color" );
|
||||
CAF_PDM_InitField( &m_modelPart2Color, "ModelPart2Color", cvf::Color3f( cvf::Color3f::BLUE ), "Part 2 Color" );
|
||||
|
||||
CAF_PDM_InitField( &m_maxReservoirCellHeight, "MaxReservoirCellHeight", 20.0, "Max. Reservoir Cell Height" );
|
||||
CAF_PDM_InitField( &m_maxReservoirCellHeight, "MaxReservoirCellHeight", 5.0, "Max. Reservoir Cell Height" );
|
||||
CAF_PDM_InitField( &m_minReservoirCellHeight, "MinReservoirCellHeight", 0.5, "Min. Reservoir Cell Height" );
|
||||
CAF_PDM_InitField( &m_cellHeightGrowFactor, "CellHeightGrowFactor", 1.05, "Cell Height Grow Factor" );
|
||||
CAF_PDM_InitField( &m_cellHeightGrowFactor, "CellHeightGrowFactor", 1.15, "Cell Height Grow Factor" );
|
||||
|
||||
CAF_PDM_InitField( &m_minReservoirCellWidth, "MinReservoirCellWidth", 20.0, "Reservoir Cell Width" );
|
||||
CAF_PDM_InitField( &m_cellWidthGrowFactor, "CellWidthGrowFactor", 1.05, "Cell Width Grow Factor" );
|
||||
CAF_PDM_InitField( &m_minReservoirCellWidth, "MinReservoirCellWidth", 5.0, "Reservoir Cell Width" );
|
||||
CAF_PDM_InitField( &m_cellWidthGrowFactor, "CellWidthGrowFactor", 1.15, "Cell Width Grow Factor" );
|
||||
|
||||
CAF_PDM_InitField( &m_useLocalCoordinates, "UseLocalCoordinates", false, "Export Using Local Coordinates" );
|
||||
CAF_PDM_InitField( &m_useLocalCoordinates, "UseLocalCoordinates", false, "Use Local Coordinates" );
|
||||
|
||||
// Time Step Selection
|
||||
CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps" );
|
||||
@ -321,14 +323,14 @@ void RimFaultReactivationModel::updateVisualization()
|
||||
if ( !normal.normalize() ) return;
|
||||
|
||||
auto modelNormal = normal ^ cvf::Vec3d::Z_AXIS;
|
||||
modelNormal.normalize();
|
||||
if ( !modelNormal.normalize() ) return;
|
||||
|
||||
auto generator = std::make_shared<RigFaultReactivationModelGenerator>( m_targets[0]->targetPointXYZ(), modelNormal );
|
||||
auto generator = std::make_shared<RigFaultReactivationModelGenerator>( m_targets[0]->targetPointXYZ(), modelNormal, normal );
|
||||
generator->setFault( m_fault()->faultGeometry() );
|
||||
generator->setGrid( eclipseCase()->mainGrid() );
|
||||
generator->setActiveCellInfo( eclipseCase()->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ) );
|
||||
generator->setModelSize( m_modelMinZ, m_modelBelowSize, m_modelExtentFromAnchor );
|
||||
generator->setFaultBufferDepth( m_faultExtendUpwards, m_faultExtendDownwards );
|
||||
generator->setFaultBufferDepth( m_faultExtendUpwards, m_faultExtendDownwards, m_faultZoneCells );
|
||||
generator->setModelThickness( m_modelThickness );
|
||||
generator->setModelGriddingOptions( m_minReservoirCellHeight,
|
||||
m_maxReservoirCellHeight,
|
||||
@ -443,6 +445,7 @@ void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::Pdm
|
||||
sizeModelGrp->add( &m_modelExtentFromAnchor );
|
||||
sizeModelGrp->add( &m_modelMinZ );
|
||||
sizeModelGrp->add( &m_modelBelowSize );
|
||||
sizeModelGrp->add( &m_faultZoneCells );
|
||||
|
||||
const bool hasGeoMechCase = ( m_geomechCase() != nullptr );
|
||||
|
||||
@ -505,6 +508,8 @@ void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::Pdm
|
||||
|
||||
propertiesGrp->add( &m_frictionAngleDeg );
|
||||
|
||||
uiOrdering.add( &m_targets );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
}
|
||||
|
||||
@ -618,6 +623,15 @@ void RimFaultReactivationModel::updateTimeSteps()
|
||||
m_availableTimeSteps.clear();
|
||||
const auto eCase = eclipseCase();
|
||||
if ( eCase != nullptr ) m_availableTimeSteps = eCase->timeStepDates();
|
||||
|
||||
if ( m_selectedTimeSteps().empty() )
|
||||
{
|
||||
std::vector<QDateTime> newVal;
|
||||
if ( !m_availableTimeSteps.empty() ) newVal.push_back( m_availableTimeSteps.front() );
|
||||
if ( m_availableTimeSteps.size() > 1 ) newVal.push_back( m_availableTimeSteps.back() );
|
||||
|
||||
m_selectedTimeSteps.setValue( newVal );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -714,7 +728,8 @@ std::array<double, 3> RimFaultReactivationModel::materialParameters( ElementSets
|
||||
static std::map<ElementSets, std::string> groupMap = { { ElementSets::OverBurden, "material_overburden" },
|
||||
{ ElementSets::Reservoir, "material_reservoir" },
|
||||
{ ElementSets::IntraReservoir, "material_intrareservoir" },
|
||||
{ ElementSets::UnderBurden, "material_underburden" } };
|
||||
{ ElementSets::UnderBurden, "material_underburden" },
|
||||
{ ElementSets::FaultZone, "material_faultzone" } };
|
||||
|
||||
auto keyName = QString::fromStdString( groupMap[elementSet] );
|
||||
|
||||
|
@ -168,6 +168,7 @@ private:
|
||||
|
||||
caf::PdmField<double> m_faultExtendUpwards;
|
||||
caf::PdmField<double> m_faultExtendDownwards;
|
||||
caf::PdmField<int> m_faultZoneCells;
|
||||
|
||||
caf::PdmField<double> m_maxReservoirCellHeight;
|
||||
caf::PdmField<double> m_minReservoirCellHeight;
|
||||
|
@ -33,7 +33,9 @@
|
||||
#include "RigResultAccessorFactory.h"
|
||||
#include "RigStatisticsMath.h"
|
||||
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseCaseTools.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseResultAddress.h"
|
||||
@ -41,6 +43,8 @@
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGridCalculationCollection.h"
|
||||
#include "RimGridCalculationVariable.h"
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReloadCaseTools.h"
|
||||
#include "RimResultSelectionUi.h"
|
||||
@ -67,6 +71,14 @@ void caf::AppEnum<RimGridCalculation::DefaultValueType>::setUp()
|
||||
addItem( RimGridCalculation::DefaultValueType::USER_DEFINED, "USER_DEFINED", "User Defined Custom Value" );
|
||||
setDefault( RimGridCalculation::DefaultValueType::POSITIVE_INFINITY );
|
||||
}
|
||||
template <>
|
||||
void caf::AppEnum<RimGridCalculation::AdditionalCasesType>::setUp()
|
||||
{
|
||||
addItem( RimGridCalculation::AdditionalCasesType::NONE, "NONE", "None" );
|
||||
addItem( RimGridCalculation::AdditionalCasesType::GRID_CASE_GROUP, "GRID_CASE_GROUP", "Case Group" );
|
||||
addItem( RimGridCalculation::AdditionalCasesType::ALL_CASES, "NONE", "All Cases" );
|
||||
setDefault( RimGridCalculation::AdditionalCasesType::NONE );
|
||||
}
|
||||
}; // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -79,7 +91,12 @@ RimGridCalculation::RimGridCalculation()
|
||||
CAF_PDM_InitFieldNoDefault( &m_defaultValueType, "DefaultValueType", "Non-visible Cell Value" );
|
||||
CAF_PDM_InitField( &m_defaultValue, "DefaultValue", 0.0, "Custom Value" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_destinationCase, "DestinationCase", "Destination Case" );
|
||||
CAF_PDM_InitField( &m_applyToAllCases, "AllDestinationCase", false, "Apply to All Cases" );
|
||||
|
||||
CAF_PDM_InitField( &m_applyToAllCases_OBSOLETE, "AllDestinationCase", false, "Apply to All Cases" );
|
||||
m_applyToAllCases_OBSOLETE.xmlCapability()->setIOWritable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_additionalCasesType, "AdditionalCasesType", "Apply To Additional Cases" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_additionalCaseGroup, "AdditionalCaseGroup", "Case Group" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_nonVisibleResultAddress, "NonVisibleResultAddress", "" );
|
||||
m_nonVisibleResultAddress = new RimEclipseResultAddress;
|
||||
@ -102,7 +119,7 @@ RimGridCalculation::RimGridCalculation()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridCalculation::preCalculate() const
|
||||
{
|
||||
if ( RiaGuiApplication::isRunning() && m_applyToAllCases() )
|
||||
if ( RiaGuiApplication::isRunning() && m_additionalCasesType() != RimGridCalculation::AdditionalCasesType::NONE )
|
||||
{
|
||||
const QString cacheKey = "GridCalculatorMessage";
|
||||
|
||||
@ -222,17 +239,18 @@ bool RimGridCalculation::calculate()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseCase*> RimGridCalculation::outputEclipseCases() const
|
||||
{
|
||||
if ( m_applyToAllCases )
|
||||
if ( m_additionalCasesType() == RimGridCalculation::AdditionalCasesType::ALL_CASES )
|
||||
{
|
||||
// Find all Eclipse cases suitable for grid calculations. This includes all single grid cases and source cases in a grid case group.
|
||||
// Exclude the statistics cases, as it is not possible to use them in a grid calculations.
|
||||
//
|
||||
// Note that data read from file can be released from memory when statistics for a time step is calculated. See
|
||||
// RimEclipseStatisticsCaseEvaluator::evaluateForResults()
|
||||
|
||||
return RimEclipseCaseTools::allEclipseGridCases();
|
||||
}
|
||||
|
||||
if ( m_additionalCasesType() == RimGridCalculation::AdditionalCasesType::GRID_CASE_GROUP )
|
||||
{
|
||||
if ( m_additionalCaseGroup() ) return m_additionalCaseGroup->reservoirs.childrenByType();
|
||||
}
|
||||
|
||||
return { m_destinationCase };
|
||||
}
|
||||
|
||||
@ -287,12 +305,9 @@ void RimGridCalculation::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder
|
||||
|
||||
uiOrdering.add( &m_destinationCase );
|
||||
|
||||
uiOrdering.add( &m_applyToAllCases );
|
||||
if ( !allSourceCasesAreEqualToDestinationCase() )
|
||||
{
|
||||
m_applyToAllCases = false;
|
||||
}
|
||||
m_applyToAllCases.uiCapability()->setUiReadOnly( !allSourceCasesAreEqualToDestinationCase() );
|
||||
uiOrdering.add( &m_additionalCasesType );
|
||||
uiOrdering.add( &m_additionalCaseGroup );
|
||||
m_additionalCaseGroup.uiCapability()->setUiHidden( m_additionalCasesType() != RimGridCalculation::AdditionalCasesType::GRID_CASE_GROUP );
|
||||
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "Cell Filter" );
|
||||
filterGroup->setCollapsedByDefault();
|
||||
@ -339,8 +354,8 @@ QList<caf::PdmOptionItemInfo> RimGridCalculation::calculateValueOptions( const c
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no input cases are defined, use the destination case to determine the grid size. This will enable use of expressions with
|
||||
// no input cases like "calculation := 1.0"
|
||||
// If no input cases are defined, use the destination case to determine the grid size. This will enable use of expressions
|
||||
// with no input cases like "calculation := 1.0"
|
||||
firstEclipseCase = m_destinationCase();
|
||||
}
|
||||
|
||||
@ -391,6 +406,20 @@ QList<caf::PdmOptionItemInfo> RimGridCalculation::calculateValueOptions( const c
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( &m_additionalCaseGroup == fieldNeedingOptions )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj->activeOilField() && proj->activeOilField()->analysisModels() )
|
||||
{
|
||||
auto analysisModels = proj->activeOilField()->analysisModels();
|
||||
for ( RimIdenticalGridCaseGroup* cg : analysisModels->caseGroups() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( cg->name(), cg, false, cg->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@ -410,6 +439,8 @@ void RimGridCalculation::initAfterRead()
|
||||
if ( m_destinationCase == nullptr ) m_destinationCase = gridVar->eclipseCase();
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_applyToAllCases_OBSOLETE ) m_additionalCasesType = RimGridCalculation::AdditionalCasesType::ALL_CASES;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -559,16 +590,18 @@ std::vector<double> RimGridCalculation::getDataForResult( const QString&
|
||||
|
||||
auto eclipseCaseData = sourceCase->eclipseCaseData();
|
||||
auto rigCaseCellResultsData = eclipseCaseData->results( porosityModel );
|
||||
if ( !rigCaseCellResultsData->ensureKnownResultLoaded( resAddr ) ) return {};
|
||||
if ( !rigCaseCellResultsData->findOrLoadKnownScalarResultForTimeStep( resAddr, timeStepToUse ) ) return {};
|
||||
|
||||
// Active cell info must always be retrieved from the destination case, as the returned vector must be of the same size as number of
|
||||
// active cells in the destination case.
|
||||
// Active cell info must always be retrieved from the destination case, as the returned vector must be of the same size as
|
||||
// number of active cells in the destination case. Active cells can be different between source and destination case.
|
||||
auto activeCellInfoDestination = destinationCase->eclipseCaseData()->activeCellInfo( porosityModel );
|
||||
auto activeReservoirCells = activeCellInfoDestination->activeReservoirCellIndices();
|
||||
|
||||
std::vector<double> values( activeCellInfoDestination->activeReservoirCellIndices().size() );
|
||||
|
||||
auto resultAccessor = RigResultAccessorFactory::createFromResultAddress( eclipseCaseData, 0, porosityModel, timeStepToUse, resAddr );
|
||||
size_t gridIndex = 0;
|
||||
auto resultAccessor =
|
||||
RigResultAccessorFactory::createFromResultAddress( eclipseCaseData, gridIndex, porosityModel, timeStepToUse, resAddr );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int i = 0; i < static_cast<int>( activeReservoirCells.size() ); i++ )
|
||||
@ -576,6 +609,11 @@ std::vector<double> RimGridCalculation::getDataForResult( const QString&
|
||||
values[i] = resultAccessor->cellScalarGlobIdx( activeReservoirCells[i] );
|
||||
}
|
||||
|
||||
auto categoriesToExclude = { RiaDefines::ResultCatType::GENERATED };
|
||||
|
||||
sourceCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepToUse );
|
||||
sourceCase->results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->freeAllocatedResultsData( categoriesToExclude, timeStepToUse );
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
@ -828,10 +866,10 @@ bool RimGridCalculation::calculateForCases( const std::vector<RimEclipseCase*>&
|
||||
RimGridCalculationVariable* v = dynamic_cast<RimGridCalculationVariable*>( m_variables[i] );
|
||||
CAF_ASSERT( v != nullptr );
|
||||
|
||||
bool useDataFromDestinationCase = ( v->eclipseCase() == m_destinationCase );
|
||||
auto sourceCase = useDataFromDestinationCase ? m_destinationCase : calculationCase;
|
||||
bool useDataFromSourceCase = ( v->eclipseCase() == m_destinationCase );
|
||||
auto sourceCase = useDataFromSourceCase ? calculationCase : v->eclipseCase();
|
||||
|
||||
auto dataForVariable = getDataForVariable( v, tsId, porosityModel, sourceCase, m_destinationCase );
|
||||
auto dataForVariable = getDataForVariable( v, tsId, porosityModel, sourceCase, calculationCase );
|
||||
if ( dataForVariable.empty() )
|
||||
{
|
||||
RiaLogging::error( QString( " No data found for variable '%1'." ).arg( v->name() ) );
|
||||
@ -965,9 +1003,9 @@ void RimGridCalculation::findAndEvaluateDependentCalculations( const std::vector
|
||||
{
|
||||
if ( dependentCalc == this ) continue;
|
||||
|
||||
// Propagate the settings for this calculation to the dependent calculation. This will allow changes on top level calculation to be
|
||||
// propagated to dependent calculations automatically. Do not trigger findAndEvaluateDependentCalculations() recursively, as all
|
||||
// dependent calculations are traversed in this function.
|
||||
// Propagate the settings for this calculation to the dependent calculation. This will allow changes on top level
|
||||
// calculation to be propagated to dependent calculations automatically. Do not trigger
|
||||
// findAndEvaluateDependentCalculations() recursively, as all dependent calculations are traversed in this function.
|
||||
|
||||
bool evaluateDependentCalculations = false;
|
||||
dependentCalc->calculateForCases( calculationCases, inputValueVisibilityFilter, timeSteps, evaluateDependentCalculations );
|
||||
|
@ -33,6 +33,7 @@ class RimEclipseCase;
|
||||
class RimGridView;
|
||||
class RigEclipseResultAddress;
|
||||
class RimEclipseResultAddress;
|
||||
class RimCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -50,6 +51,13 @@ public:
|
||||
USER_DEFINED
|
||||
};
|
||||
|
||||
enum class AdditionalCasesType
|
||||
{
|
||||
NONE,
|
||||
GRID_CASE_GROUP,
|
||||
ALL_CASES
|
||||
};
|
||||
|
||||
RimGridCalculation();
|
||||
|
||||
bool preCalculate() const override;
|
||||
@ -136,11 +144,15 @@ private:
|
||||
caf::PdmField<caf::AppEnum<DefaultValueType>> m_defaultValueType;
|
||||
caf::PdmField<double> m_defaultValue;
|
||||
caf::PdmPtrField<RimEclipseCase*> m_destinationCase;
|
||||
caf::PdmField<bool> m_applyToAllCases;
|
||||
|
||||
caf::PdmField<caf::AppEnum<AdditionalCasesType>> m_additionalCasesType;
|
||||
caf::PdmPtrField<RimCaseCollection*> m_additionalCaseGroup;
|
||||
|
||||
caf::PdmField<std::vector<int>> m_selectedTimeSteps;
|
||||
|
||||
caf::PdmProxyValueField<QString> m_nonVisibleResultText;
|
||||
caf::PdmChildField<RimEclipseResultAddress*> m_nonVisibleResultAddress;
|
||||
caf::PdmField<bool> m_editNonVisibleResultAddress;
|
||||
|
||||
caf::PdmField<bool> m_applyToAllCases_OBSOLETE;
|
||||
};
|
||||
|
@ -178,7 +178,7 @@ bool RimFileSurface::loadDataFromFile()
|
||||
|
||||
surface = m_gocadData->gocadGeometry();
|
||||
}
|
||||
else if ( filePath.endsWith( "dat", Qt::CaseInsensitive ) )
|
||||
else if ( filePath.endsWith( "dat", Qt::CaseInsensitive ) || filePath.endsWith( "xyz", Qt::CaseInsensitive ) )
|
||||
{
|
||||
double resamplingDistance = RiaPreferences::current()->surfaceImportResamplingDistance();
|
||||
surface = RifSurfaceImporter::readOpenWorksXyzFile( filePath, resamplingDistance );
|
||||
|
@ -216,6 +216,24 @@ void RigCaseCellResultsData::mobileVolumeWeightedMean( const RigEclipseResultAdd
|
||||
statistics( resVarAddr )->mobileVolumeWeightedMean( timeStepIndex, meanValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<std::string, size_t> RigCaseCellResultsData::resultValueCount() const
|
||||
{
|
||||
std::map<std::string, size_t> memoryUse;
|
||||
|
||||
for ( size_t i = 0; i < m_cellScalarResults.size(); i++ )
|
||||
{
|
||||
if ( allocatedValueCount( i ) > 0 )
|
||||
{
|
||||
memoryUse[m_resultInfos[i].resultName().toStdString()] = allocatedValueCount( i );
|
||||
}
|
||||
}
|
||||
|
||||
return memoryUse;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -724,10 +742,14 @@ void RigCaseCellResultsData::freeAllocatedResultsData( std::vector<RiaDefines::R
|
||||
}
|
||||
|
||||
auto& dataForTimeStep = m_cellScalarResults[resultIdx][index];
|
||||
// Using swap with an empty vector as that is the safest way to really get rid of the allocated data in a
|
||||
// vector
|
||||
std::vector<double> empty;
|
||||
dataForTimeStep.swap( empty );
|
||||
|
||||
if ( !dataForTimeStep.empty() )
|
||||
{
|
||||
// Using swap with an empty vector as that is the safest way to really get rid of the allocated data in a
|
||||
// vector
|
||||
std::vector<double> empty;
|
||||
dataForTimeStep.swap( empty );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2838,22 +2860,25 @@ RigAllanDiagramData* RigCaseCellResultsData::allanDiagramData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigCaseCellResultsData::isDataPresent( size_t scalarResultIndex ) const
|
||||
{
|
||||
if ( scalarResultIndex >= resultCount() )
|
||||
return allocatedValueCount( scalarResultIndex ) > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RigCaseCellResultsData::allocatedValueCount( size_t scalarResultIndex ) const
|
||||
{
|
||||
if ( scalarResultIndex >= resultCount() ) return 0;
|
||||
|
||||
const std::vector<std::vector<double>>& valuesAllTimeSteps = m_cellScalarResults[scalarResultIndex];
|
||||
|
||||
size_t valueCount = 0;
|
||||
for ( const auto& values : valuesAllTimeSteps )
|
||||
{
|
||||
return false;
|
||||
valueCount += values.size();
|
||||
}
|
||||
|
||||
const std::vector<std::vector<double>>& data = m_cellScalarResults[scalarResultIndex];
|
||||
|
||||
for ( size_t tsIdx = 0; tsIdx < data.size(); ++tsIdx )
|
||||
{
|
||||
if ( !data[tsIdx].empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return valueCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -99,6 +99,9 @@ public:
|
||||
void mobileVolumeWeightedMean( const RigEclipseResultAddress& resVarAddr, double& meanValue );
|
||||
void mobileVolumeWeightedMean( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex, double& meanValue );
|
||||
|
||||
// Return the number of double values allocated for each result
|
||||
std::map<std::string, size_t> resultValueCount() const;
|
||||
|
||||
// Access meta-information about the results
|
||||
|
||||
size_t timeStepCount( const RigEclipseResultAddress& resVarAddr ) const;
|
||||
@ -128,9 +131,12 @@ public:
|
||||
QString makeResultNameUnique( const QString& resultNameProposal ) const;
|
||||
|
||||
bool ensureKnownResultLoaded( const RigEclipseResultAddress& resultAddress );
|
||||
|
||||
bool findAndLoadResultByName( const QString& resultName, const std::vector<RiaDefines::ResultCatType>& resultCategorySearchOrder );
|
||||
|
||||
// Load result for a single time step. This can be used to process data for a single time step
|
||||
// Other data access functions assume all time steps are loaded at the same time
|
||||
size_t findOrLoadKnownScalarResultForTimeStep( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex );
|
||||
|
||||
bool hasResultEntry( const RigEclipseResultAddress& resultAddress ) const;
|
||||
bool isResultLoaded( const RigEclipseResultAddress& resultAddress ) const;
|
||||
void createResultEntry( const RigEclipseResultAddress& resultAddress, bool needsToBeStored );
|
||||
@ -164,7 +170,6 @@ private:
|
||||
friend class RigOilVolumeResultCalculator;
|
||||
friend class RigCellVolumeResultCalculator;
|
||||
friend class RigCellsWithNncsCalculator;
|
||||
size_t findOrLoadKnownScalarResultForTimeStep( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex );
|
||||
|
||||
size_t findOrCreateScalarResultIndex( const RigEclipseResultAddress& resVarAddr, bool needsToBeStored );
|
||||
|
||||
@ -199,7 +204,8 @@ private:
|
||||
void computeFaultDistance();
|
||||
void computeNncsCells();
|
||||
|
||||
bool isDataPresent( size_t scalarResultIndex ) const;
|
||||
bool isDataPresent( size_t scalarResultIndex ) const;
|
||||
size_t allocatedValueCount( size_t scalarResultIndex ) const;
|
||||
|
||||
void assignValuesToTemporaryLgrs( const QString& resultName, std::vector<double>& values );
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfMatrix4.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfPlane.h"
|
||||
#include "cvfStructGrid.h"
|
||||
#include "cvfTextureImage.h"
|
||||
#include "cvfVector3.h"
|
||||
@ -37,7 +36,6 @@
|
||||
|
||||
class RigGriddedPart3d;
|
||||
class RigMainGrid;
|
||||
class RimFaultReactivationDataAccess;
|
||||
class RigFaultReactivationModelGenerator;
|
||||
|
||||
class RigFRModelPart
|
||||
|
@ -36,9 +36,10 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFaultReactivationModelGenerator::RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal )
|
||||
RigFaultReactivationModelGenerator::RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal, cvf::Vec3d modelDirection )
|
||||
: m_startPosition( position )
|
||||
, m_normal( normal )
|
||||
, m_modelDirection( modelDirection )
|
||||
, m_bufferAboveFault( 0.0 )
|
||||
, m_bufferBelowFault( 0.0 )
|
||||
, m_startDepth( 0.0 )
|
||||
@ -52,6 +53,7 @@ RigFaultReactivationModelGenerator::RigFaultReactivationModelGenerator( cvf::Vec
|
||||
, m_minCellHeight( 0.5 )
|
||||
, m_maxCellHeight( 20.0 )
|
||||
, m_minCellWidth( 20.0 )
|
||||
, m_faultZoneCells( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
@ -89,10 +91,11 @@ void RigFaultReactivationModelGenerator::setActiveCellInfo( const RigActiveCellI
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFaultReactivationModelGenerator::setFaultBufferDepth( double aboveFault, double belowFault )
|
||||
void RigFaultReactivationModelGenerator::setFaultBufferDepth( double aboveFault, double belowFault, int faultZoneCells )
|
||||
{
|
||||
m_bufferAboveFault = aboveFault;
|
||||
m_bufferBelowFault = belowFault;
|
||||
m_faultZoneCells = faultZoneCells;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -142,10 +145,7 @@ void RigFaultReactivationModelGenerator::setModelGriddingOptions( double minCell
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<cvf::Vec3d, cvf::Vec3d> RigFaultReactivationModelGenerator::modelLocalNormalsXY()
|
||||
{
|
||||
cvf::Vec3d xNormal = m_normal ^ cvf::Vec3d::Z_AXIS;
|
||||
xNormal.z() = 0.0;
|
||||
xNormal.normalize();
|
||||
|
||||
cvf::Vec3d xNormal = m_modelDirection;
|
||||
cvf::Vec3d yNormal = xNormal ^ cvf::Vec3d::Z_AXIS;
|
||||
|
||||
return std::make_pair( xNormal, yNormal );
|
||||
@ -197,8 +197,11 @@ const std::array<int, 4> RigFaultReactivationModelGenerator::faceIJCornerIndexes
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RigFaultReactivationModelGenerator::lineIntersect( const cvf::Plane& plane, cvf::Vec3d lineA, cvf::Vec3d lineB )
|
||||
{
|
||||
double dist = 0.0;
|
||||
return caf::HexGridIntersectionTools::planeLineIntersectionForMC( plane, lineA, lineB, &dist );
|
||||
double dist = 0.0;
|
||||
cvf::Vec3d intersect;
|
||||
caf::HexGridIntersectionTools::planeLineIntersect( plane, lineA, lineB, &intersect, &dist, 0.01 );
|
||||
|
||||
return intersect;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -292,14 +295,11 @@ void RigFaultReactivationModelGenerator::generatePointsFrontBack()
|
||||
{
|
||||
std::array<cvf::Vec3d, 24> points;
|
||||
|
||||
auto alongModel = m_normal ^ cvf::Vec3d::Z_AXIS;
|
||||
alongModel.normalize();
|
||||
|
||||
double top_depth = -m_startDepth;
|
||||
m_bottomDepth = m_bottomFault.z() - m_depthBelowFault;
|
||||
|
||||
cvf::Vec3d edge_front = m_startPosition - m_horzExtentFromFault * alongModel;
|
||||
cvf::Vec3d edge_back = m_startPosition + m_horzExtentFromFault * alongModel;
|
||||
cvf::Vec3d edge_front = m_startPosition - m_horzExtentFromFault * m_modelDirection;
|
||||
cvf::Vec3d edge_back = m_startPosition + m_horzExtentFromFault * m_modelDirection;
|
||||
|
||||
points[8] = m_bottomFault;
|
||||
points[8].z() = m_bottomDepth;
|
||||
@ -503,7 +503,9 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t
|
||||
m_cellSizeHeightFactor,
|
||||
m_horizontalPartition,
|
||||
m_modelThickness,
|
||||
m_topReservoirFront.z() );
|
||||
m_topReservoirFront.z(),
|
||||
m_normal,
|
||||
m_faultZoneCells );
|
||||
backPart->generateGeometry( m_backPoints,
|
||||
backReservoirLayers,
|
||||
kLayersBack,
|
||||
@ -511,7 +513,9 @@ void RigFaultReactivationModelGenerator::generateGeometry( size_t
|
||||
m_cellSizeHeightFactor,
|
||||
m_horizontalPartition,
|
||||
m_modelThickness,
|
||||
m_topReservoirBack.z() );
|
||||
m_topReservoirBack.z(),
|
||||
m_normal,
|
||||
m_faultZoneCells );
|
||||
|
||||
frontPart->generateLocalNodes( m_localCoordTransform );
|
||||
backPart->generateLocalNodes( m_localCoordTransform );
|
||||
|
@ -37,13 +37,13 @@ class RigActiveCellInfo;
|
||||
class RigFaultReactivationModelGenerator : cvf::Object
|
||||
{
|
||||
public:
|
||||
RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal );
|
||||
RigFaultReactivationModelGenerator( cvf::Vec3d position, cvf::Vec3d normal, cvf::Vec3d direction );
|
||||
~RigFaultReactivationModelGenerator() override;
|
||||
|
||||
void setFault( const RigFault* fault );
|
||||
void setGrid( const RigMainGrid* grid );
|
||||
void setActiveCellInfo( const RigActiveCellInfo* activeCellInfo );
|
||||
void setFaultBufferDepth( double aboveFault, double belowFault );
|
||||
void setFaultBufferDepth( double aboveFault, double belowFault, int faultZoneCells );
|
||||
void setModelSize( double startDepth, double depthBelowFault, double horzExtentFromFault );
|
||||
void setModelThickness( double thickness );
|
||||
void setModelGriddingOptions( double minCellHeight,
|
||||
@ -90,6 +90,7 @@ protected:
|
||||
private:
|
||||
cvf::Vec3d m_startPosition;
|
||||
cvf::Vec3d m_normal;
|
||||
cvf::Vec3d m_modelDirection;
|
||||
|
||||
std::array<cvf::Vec3d, 12> m_frontPoints;
|
||||
std::array<cvf::Vec3d, 12> m_backPoints;
|
||||
@ -102,6 +103,7 @@ private:
|
||||
|
||||
double m_bufferAboveFault;
|
||||
double m_bufferBelowFault;
|
||||
int m_faultZoneCells;
|
||||
|
||||
double m_startDepth;
|
||||
double m_bottomDepth;
|
||||
|
@ -234,7 +234,9 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
|
||||
double cellSizeFactor,
|
||||
const std::vector<double>& horizontalPartition,
|
||||
double modelThickness,
|
||||
double topHeight )
|
||||
double topHeight,
|
||||
cvf::Vec3d thicknessDirection,
|
||||
int nFaultZoneCells )
|
||||
{
|
||||
reset();
|
||||
|
||||
@ -266,9 +268,7 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
|
||||
|
||||
const std::vector<double> m_thicknessFactors = { -1.0, 0.0, 1.0 };
|
||||
const int nThicknessCells = 2;
|
||||
cvf::Vec3d tVec = stepVector( inputPoints[0], inputPoints[6], 1 ) ^ cvf::Vec3d::Z_AXIS;
|
||||
tVec.normalize();
|
||||
tVec *= modelThickness;
|
||||
cvf::Vec3d tVec = modelThickness * thicknessDirection;
|
||||
|
||||
size_t reserveSize = ( nVertCells + 1 ) * ( nHorzCells + 1 ) * ( nThicknessCells + 1 );
|
||||
m_nodes.reserve( reserveSize );
|
||||
@ -391,6 +391,7 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
|
||||
m_elementSets[ElementSets::Reservoir] = {};
|
||||
m_elementSets[ElementSets::IntraReservoir] = {};
|
||||
m_elementSets[ElementSets::UnderBurden] = {};
|
||||
m_elementSets[ElementSets::FaultZone] = {};
|
||||
|
||||
m_boundaryElements[Boundary::Bottom] = {};
|
||||
m_boundaryElements[Boundary::FarSide] = {};
|
||||
@ -415,6 +416,8 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
|
||||
const int nThicknessOff = nThicknessCells + 1;
|
||||
const int seaBedLayer = (int)( nVertCells - 2 );
|
||||
|
||||
const int nFaultZoneStart = (int)nHorzCells - nFaultZoneCells - 1;
|
||||
|
||||
for ( int v = 0; v < (int)nVertCells - 1; v++ )
|
||||
{
|
||||
if ( v >= nVertCellsLower ) currentSurfaceRegion = RimFaultReactivation::BorderSurface::FaultSurface;
|
||||
@ -452,21 +455,28 @@ void RigGriddedPart3d::generateGeometry( const std::array<cvf::Vec3d, 12>& input
|
||||
m_boundaryElements[Boundary::FarSide].push_back( elementIdx );
|
||||
}
|
||||
|
||||
bool inFaultZone = ( currentSurfaceRegion == RimFaultReactivation::BorderSurface::FaultSurface ) && ( h > nFaultZoneStart );
|
||||
|
||||
if ( inFaultZone ) m_elementSets[RimFaultReactivation::ElementSets::FaultZone].push_back( elementIdx );
|
||||
|
||||
if ( currentElementSet == RimFaultReactivation::ElementSets::Reservoir )
|
||||
{
|
||||
m_elementKLayer[elementIdx] = kLayers[kLayer];
|
||||
if ( kLayers[kLayer] < 0 )
|
||||
if ( !inFaultZone )
|
||||
{
|
||||
m_elementSets[RimFaultReactivation::ElementSets::IntraReservoir].push_back( elementIdx );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_elementSets[currentElementSet].push_back( elementIdx );
|
||||
if ( kLayers[kLayer] < 0 )
|
||||
{
|
||||
m_elementSets[RimFaultReactivation::ElementSets::IntraReservoir].push_back( elementIdx );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_elementSets[currentElementSet].push_back( elementIdx );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_elementSets[currentElementSet].push_back( elementIdx );
|
||||
if ( !inFaultZone ) m_elementSets[currentElementSet].push_back( elementIdx );
|
||||
m_elementKLayer[elementIdx] = -2000;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,9 @@ public:
|
||||
double cellSizeFactor,
|
||||
const std::vector<double>& horizontalPartition,
|
||||
double modelThickness,
|
||||
double topHeight );
|
||||
double topHeight,
|
||||
cvf::Vec3d thicknessDirection,
|
||||
int nFaultZoneCells );
|
||||
|
||||
void generateLocalNodes( const cvf::Mat4d transform );
|
||||
void setUseLocalCoordinates( bool useLocalCoordinates );
|
||||
|
@ -672,6 +672,7 @@ void RiuMainWindow::createToolBars()
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) );
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicExecuteLastUsedScriptFeature" ) );
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicExportCompletionsForVisibleWellPathsFeature" ) );
|
||||
toolbar->addAction( cmdFeatureMgr->action( "RicShowMemoryReportFeature" ) );
|
||||
}
|
||||
|
||||
// Create animation toolbar
|
||||
|
@ -367,6 +367,8 @@ bool StructGridInterface::hasValidCharacteristicCellSizes() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void StructGridInterface::computeCharacteristicCellSize( const std::vector<size_t>& globalCellIndices ) const
|
||||
{
|
||||
if ( globalCellIndices.empty() ) return;
|
||||
|
||||
ubyte faceConnPosI[4];
|
||||
cellFaceVertexIndices( StructGridInterface::POS_I, faceConnPosI );
|
||||
|
||||
|
@ -716,6 +716,7 @@ std::string AABBTree::treeInfo() const
|
||||
{
|
||||
size_t treeSizeInMB = treeSize() / (1024u *1024u);
|
||||
auto text = "Tree size : " + std::to_string(treeSizeInMB) + "[MB] \n";
|
||||
if (treeSize() == 0) return text;
|
||||
|
||||
text += "Num leaves: " + std::to_string(leavesCount()) + "\n";
|
||||
|
||||
|
2
ThirdParty/custom-opm-common/opm-common
vendored
2
ThirdParty/custom-opm-common/opm-common
vendored
@ -1 +1 @@
|
||||
Subproject commit f0c77de5d4a0b04b989c90f9750b7f507326341b
|
||||
Subproject commit a76421efffb45ae42831a5a5a8cc7e2bddbf5b8e
|
2
ThirdParty/openzgy
vendored
2
ThirdParty/openzgy
vendored
@ -1 +1 @@
|
||||
Subproject commit 61126458c761f4fa4fffa817cb162f7912afef3c
|
||||
Subproject commit 194068f4dca443a782b81d35533a89877e25a7e4
|
Loading…
Reference in New Issue
Block a user