Skip to content

Commit

Permalink
Generate well target candidates statistics for ensembles.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Dec 16, 2024
1 parent 09326cb commit 83f142e
Show file tree
Hide file tree
Showing 10 changed files with 731 additions and 21 deletions.
2 changes: 2 additions & 0 deletions ApplicationLibCode/FileInterface/CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RifAsciiDataParseOptions.h
${CMAKE_CURRENT_LIST_DIR}/RifByteArrayArrowRandomAccessFile.h
${CMAKE_CURRENT_LIST_DIR}/RifArrowTools.h
${CMAKE_CURRENT_LIST_DIR}/RifReaderRegularGridModel.h
)

set(SOURCE_GROUP_SOURCE_FILES
Expand Down Expand Up @@ -201,6 +202,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RifOsduWellLogReader.cpp
${CMAKE_CURRENT_LIST_DIR}/RifByteArrayArrowRandomAccessFile.cpp
${CMAKE_CURRENT_LIST_DIR}/RifArrowTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RifReaderRegularGridModel.cpp
)

list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Expand Down
104 changes: 104 additions & 0 deletions ApplicationLibCode/FileInterface/RifReaderRegularGridModel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RifReaderRegularGridModel.h"

#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderRegularGridModel::RifReaderRegularGridModel()
: m_reservoir( nullptr )
{
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifReaderRegularGridModel::~RifReaderRegularGridModel()
{
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderRegularGridModel::open( const QString& fileName, RigEclipseCaseData* eclipseCase )
{
m_reservoirBuilder.createGridsAndCells( eclipseCase );
m_reservoir = eclipseCase;
return true;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderRegularGridModel::inputProperty( const QString& propertyName, std::vector<double>* values )

{
CAF_ASSERT( false );
return true;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderRegularGridModel::staticResult( const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector<double>* values )
{
CAF_ASSERT( false );
return true;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RifReaderRegularGridModel::dynamicResult( const QString& result,
RiaDefines::PorosityModelType matrixOrFracture,
size_t stepIndex,
std::vector<double>* values )
{
CAF_ASSERT( false );
return true;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderRegularGridModel::setWorldCoordinates( cvf::Vec3d minWorldCoordinate, cvf::Vec3d maxWorldCoordinate )
{
m_reservoirBuilder.setWorldCoordinates( minWorldCoordinate, maxWorldCoordinate );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderRegularGridModel::setGridPointDimensions( const cvf::Vec3st& gridPointDimensions )
{
m_reservoirBuilder.setIJKCount( gridPointDimensions );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderRegularGridModel::addLocalGridRefinement( const cvf::Vec3st& minCellPosition,
const cvf::Vec3st& maxCellPosition,
const cvf::Vec3st& singleCellRefinementFactors )
{
m_reservoirBuilder.addLocalGridRefinement( minCellPosition, maxCellPosition, singleCellRefinementFactors );
}
47 changes: 47 additions & 0 deletions ApplicationLibCode/FileInterface/RifReaderRegularGridModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RifReaderInterface.h"
#include "RigReservoirBuilder.h"

class RifReaderRegularGridModel : public RifReaderInterface
{
public:
RifReaderRegularGridModel();
~RifReaderRegularGridModel() override;

void setWorldCoordinates( cvf::Vec3d minWorldCoordinate, cvf::Vec3d maxWorldCoordinate );
void setGridPointDimensions( const cvf::Vec3st& gridPointDimensions );

void addLocalGridRefinement( const cvf::Vec3st& minCellPosition,
const cvf::Vec3st& maxCellPosition,
const cvf::Vec3st& singleCellRefinementFactors );

bool open( const QString& fileName, RigEclipseCaseData* eclipseCase ) override;

bool staticResult( const QString& result, RiaDefines::PorosityModelType matrixOrFracture, std::vector<double>* values ) override;
bool dynamicResult( const QString& result, RiaDefines::PorosityModelType matrixOrFracture, size_t stepIndex, std::vector<double>* values ) override;

private:
bool inputProperty( const QString& propertyName, std::vector<double>* values );

RigReservoirBuilder m_reservoirBuilder;
RigEclipseCaseData* m_reservoir;
};
2 changes: 2 additions & 0 deletions ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMap.h
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMapProjection.h
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMapView.h
${CMAKE_CURRENT_LIST_DIR}/RimRegularGridCase.h
)

set(SOURCE_GROUP_SOURCE_FILES
Expand Down Expand Up @@ -274,6 +275,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMap.cpp
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMapProjection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimStatisticsContourMapView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimRegularGridCase.cpp
)

if(RESINSIGHT_USE_QT_CHARTS)
Expand Down
87 changes: 87 additions & 0 deletions ApplicationLibCode/ProjectDataModel/RimRegularGridCase.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimRegularGridCase.h"

#include "RifReaderRegularGridModel.h"

#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"

CAF_PDM_SOURCE_INIT( RimRegularGridCase, "EclipseBoundingBoxCase" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimRegularGridCase::RimRegularGridCase()
{
CAF_PDM_InitObject( "Bounding Box Case", ":/Case48x48.png", "", "Bounding Box Case" );

CAF_PDM_InitFieldNoDefault( &m_minimum, "Minimum", "Minimum" );
m_minimum.uiCapability()->setUiReadOnly( true );

CAF_PDM_InitFieldNoDefault( &m_maximum, "Maximum", "Maximum" );
m_maximum.uiCapability()->setUiReadOnly( true );
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

void RimRegularGridCase::setBoundingBox( const cvf::BoundingBox& boundingBox )
{
m_minimum = boundingBox.min();
m_maximum = boundingBox.max();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::ref<RifReaderInterface> RimRegularGridCase::createModel( QString modelName )
{
cvf::ref<RifReaderRegularGridModel> reader = new RifReaderRegularGridModel;
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData( this );

reader->setWorldCoordinates( m_minimum, m_maximum );

cvf::Vec3st gridPointDimensions( 50, 50, 10 );
reader->setGridPointDimensions( gridPointDimensions );

reader->open( "", reservoir.p() );

setReservoirData( reservoir.p() );

return reader.p();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimRegularGridCase::openEclipseGridFile()
{
if ( eclipseCaseData() ) return true;

auto readerInterface = createModel( "" );

results( RiaDefines::PorosityModelType::MATRIX_MODEL )->setReaderInterface( readerInterface.p() );
results( RiaDefines::PorosityModelType::FRACTURE_MODEL )->setReaderInterface( readerInterface.p() );

computeCachedData();
results( RiaDefines::PorosityModelType::MATRIX_MODEL )->computeCellVolumes();

return true;
}
49 changes: 49 additions & 0 deletions ApplicationLibCode/ProjectDataModel/RimRegularGridCase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RiaDefines.h"

#include "RimEclipseResultCase.h"

#include "cafPdmFieldCvfVec3d.h"
#include "cvfBoundingBox.h"

//==================================================================================================
//
//
//
//==================================================================================================
class RimRegularGridCase : public RimEclipseResultCase
{
CAF_PDM_HEADER_INIT;

public:
RimRegularGridCase();

void setBoundingBox( const cvf::BoundingBox& boundingBox );

bool openEclipseGridFile() override;

cvf::ref<RifReaderInterface> createModel( QString modelName );

private:
caf::PdmField<cvf::Vec3d> m_minimum;
caf::PdmField<cvf::Vec3d> m_maximum;
};
Loading

0 comments on commit 83f142e

Please sign in to comment.