diff --git a/ApplicationLibCode/ProjectDataModel/CompletionData/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CompletionData/CMakeLists_files.cmake index 54cd4366c2..f1adc572ba 100644 --- a/ApplicationLibCode/ProjectDataModel/CompletionData/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CompletionData/CMakeLists_files.cmake @@ -1,9 +1,13 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimCompletionData.h + ${CMAKE_CURRENT_LIST_DIR}/RimWelspecsData.h + ${CMAKE_CURRENT_LIST_DIR}/RimCompdatData.h ) set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimCompletionData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimWelspecsData.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimCompdatData.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompdatData.cpp b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompdatData.cpp new file mode 100644 index 0000000000..dd9c8c31cf --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompdatData.cpp @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2025 Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimCompdatData.h" + +#include "cafPdmFieldScriptingCapability.h" +#include "cafPdmObjectScriptingCapability.h" + +CAF_PDM_SOURCE_INIT( RimCompdatData, "Compdat" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCompdatData::RimCompdatData() +{ + CAF_PDM_InitScriptableObject( "Compdat", ":/Well.png" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellname, "WellName", "Well Name" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_I, "GridI", "Grid I" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_J, "GridJ", "Grid J" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_upperK, "UpperK", "Upper K" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_lowerK, "LowerK", "Lower K" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_openShutFlag, "OpenShutFlag", "Open/Shut Flag" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_satTableNum, "SatTableNum", "Saturation Table Number" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_transmissibility, "Transmissibility", "Transmissibility" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_diameter, "Diameter", "Diameter" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_kh, "Kh", "Kh Factor" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_skinFactor, "SkinFactor", "Skin Factor" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_dFactor, "DFactor", "D Factor" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_direction, "Direction", "Direction" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCompdatData::~RimCompdatData() +{ +} diff --git a/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompdatData.h b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompdatData.h new file mode 100644 index 0000000000..5d358fe31d --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompdatData.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2025 Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" + +#include + +#include + +//================================================================================================== +/// +/// +//================================================================================================== +class RimCompdatData : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimCompdatData(); + ~RimCompdatData() override; + +public: + caf::PdmField m_wellname; + caf::PdmField m_I; + caf::PdmField m_J; + caf::PdmField m_upperK; + caf::PdmField m_lowerK; + caf::PdmField m_openShutFlag; + caf::PdmField> m_satTableNum; + caf::PdmField> m_transmissibility; + caf::PdmField> m_diameter; + caf::PdmField> m_kh; + caf::PdmField> m_skinFactor; + caf::PdmField> m_dFactor; + caf::PdmField> m_direction; +}; diff --git a/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.cpp b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.cpp index e69de29bb2..8d64dd590c 100644 --- a/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.cpp +++ b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.cpp @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2025 Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimCompletionData.h" + +#include "RimCompdatData.h" +#include "RimWelspecsData.h" + +#include "cafPdmFieldScriptingCapability.h" +#include "cafPdmObjectScriptingCapability.h" + +CAF_PDM_SOURCE_INIT( RimCompletionData, "CompletionData" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCompletionData::RimCompletionData() +{ + CAF_PDM_InitScriptableObject( "CompletionData", ":/Well.png" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_welspecs, "Welspecs", "Welspecs Data" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_compdat, "Compdat", "Compdat Data" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCompletionData::~RimCompletionData() +{ +} \ No newline at end of file diff --git a/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.h b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.h index e69de29bb2..d2379d372b 100644 --- a/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.h +++ b/ApplicationLibCode/ProjectDataModel/CompletionData/RimCompletionData.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2025 Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" + +class RimWelspecsData; +class RimCompdatData; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimCompletionData : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimCompletionData(); + ~RimCompletionData() override; + +private: + caf::PdmChildArrayField m_welspecs; + caf::PdmChildArrayField m_compdat; +}; diff --git a/ApplicationLibCode/ProjectDataModel/CompletionData/RimWelspecsData.cpp b/ApplicationLibCode/ProjectDataModel/CompletionData/RimWelspecsData.cpp new file mode 100644 index 0000000000..746689f91c --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/CompletionData/RimWelspecsData.cpp @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2025 Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimWelspecsData.h" + +#include "cafPdmFieldScriptingCapability.h" +#include "cafPdmObjectScriptingCapability.h" + +CAF_PDM_SOURCE_INIT( RimWelspecsData, "Welspecs" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWelspecsData::RimWelspecsData() +{ + CAF_PDM_InitScriptableObject( "Welspecs", ":/Well.png" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_wellname, "WellName", "Well Name" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_groupname, "GroupName", "Group Name" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_I, "WellI", "I" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_J, "WellJ", "J" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_bhpDepth, "BhpDepth", "BHP Depth" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_phase, "Phase", "Phase" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_drainageRadius, "DrainageRadius", "Drainage Radius" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_inflowEquation, "InflowEquation", "Inflow Equation" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_autoShutIn, "AutoShutIn", "Auto Shut In" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_crossFlow, "CrossFlow", "Cross Flow" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_pvtTableNum, "PvtTableNum", "PVT Table Number" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_hydrostaticDensCalc, "HydrostaticDensCalc", "Hydrostatic Density Calculation" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_fipRegion, "FipRegion", "FIP Region" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWelspecsData::~RimWelspecsData() +{ +} diff --git a/ApplicationLibCode/ProjectDataModel/CompletionData/RimWelspecsData.h b/ApplicationLibCode/ProjectDataModel/CompletionData/RimWelspecsData.h new file mode 100644 index 0000000000..e9aa55a667 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/CompletionData/RimWelspecsData.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2025 Equinor ASA +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" + +#include + +#include + +//================================================================================================== +/// +/// +//================================================================================================== +class RimWelspecsData : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimWelspecsData(); + ~RimWelspecsData() override; + +public: + caf::PdmField m_wellname; + caf::PdmField m_groupname; + caf::PdmField m_I; + caf::PdmField m_J; + caf::PdmField> m_bhpDepth; + caf::PdmField m_phase; + caf::PdmField> m_drainageRadius; + caf::PdmField> m_inflowEquation; + caf::PdmField> m_autoShutIn; + caf::PdmField> m_crossFlow; + caf::PdmField> m_pvtTableNum; + caf::PdmField> m_hydrostaticDensCalc; + caf::PdmField> m_fipRegion; +}; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp index e39f6aeb42..3aa507214b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp @@ -25,6 +25,7 @@ #include "Well/RigWellPath.h" #include "Well/RigWellPathGeometryTools.h" +#include "CompletionData/RimCompletionData.h" #include "RimExtrudedCurveIntersection.h" #include "RimPlotCurve.h" #include "RimProject.h" @@ -286,3 +287,11 @@ void RimModeledWellPath::updateReferencePoint() auto refPoint = topLevelModelledWell->geometryDefinition()->anchorPointXyz(); m_geometryDefinition->setReferencePointXyz( refPoint ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimCompletionData* RimModeledWellPath::completionData() +{ + return new RimCompletionData(); +} diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h index 141467bab6..928ab6957d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h @@ -25,6 +25,7 @@ class RimWellPathTarget; class RimWellPath; class RimWellPathGeometryDef; +class RimCompletionData; class RimModeledWellPath : public RimWellPath { @@ -42,6 +43,8 @@ public: void updateTieInLocationFromParentWell(); void updateReferencePoint(); + RimCompletionData* completionData(); + private: void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; void onGeometryDefinitionChanged( const caf::SignalEmitter* emitter, bool fullUpdate ); diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.cpp index ef58ab77c6..4b0bee3cce 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.cpp @@ -18,6 +18,8 @@ #include "RimcWellPathCollection.h" +#include "CompletioNData/RimCompletionData.h" +#include "RimModeledWellPath.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" @@ -77,3 +79,56 @@ QString RimcWellPathCollection_importWellPath::classKeywordReturnedType() const { return RimWellPath::classKeywordStatic(); } + +CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPathCollection, RimcWellPathCollection_wellCompletions, "WellCompletions" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcWellPathCollection_wellCompletions::RimcWellPathCollection_wellCompletions( caf::PdmObjectHandle* self ) + : caf::PdmObjectCreationMethod( self ) +{ + CAF_PDM_InitObject( "Well Completions" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellName, "WellName", "Name of Well" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::expected RimcWellPathCollection_wellCompletions::execute() +{ + auto wellPathCollection = self(); + if ( !wellPathCollection ) + { + return std::unexpected( QString( "Well path collection is missing. Cannot get completion data." ) ); + } + + if ( m_wellName().isEmpty() ) + { + return std::unexpected( QString( "Well name is empty. Nothing to do." ) ); + } + + if ( auto wellPath = wellPathCollection->wellPathByName( m_wellName ) ) + { + if ( auto modWellPath = dynamic_cast( wellPath ) ) + { + if ( auto completionData = modWellPath->completionData() ) + { + return completionData; + } + else + { + return std::unexpected( QString( "Well path '%1' does not have any completion data." ).arg( m_wellName ) ); + } + } + } + return std::unexpected( QString( "Well path with name '%1' does not exist. Cannot get completion data." ).arg( m_wellName ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimcWellPathCollection_wellCompletions::classKeywordReturnedType() const +{ + return RimCompletionData::classKeywordStatic(); +} diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.h b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.h index e78e1b0642..ec2fccb5df 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.h +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathCollection.h @@ -40,3 +40,20 @@ public: private: caf::PdmField m_fileName; }; + +//================================================================================================== +/// +//================================================================================================== +class RimcWellPathCollection_wellCompletions : public caf::PdmObjectCreationMethod +{ + CAF_PDM_HEADER_INIT; + +public: + RimcWellPathCollection_wellCompletions( caf::PdmObjectHandle* self ); + + std::expected execute() override; + QString classKeywordReturnedType() const override; + +private: + caf::PdmField m_wellName; +}; diff --git a/GrpcInterface/Python/rips/PythonExamples/wells_and_fractures/completion_data.py b/GrpcInterface/Python/rips/PythonExamples/wells_and_fractures/completion_data.py new file mode 100644 index 0000000000..88b4be0d73 --- /dev/null +++ b/GrpcInterface/Python/rips/PythonExamples/wells_and_fractures/completion_data.py @@ -0,0 +1,21 @@ +################################################################################### +# This example will connect to ResInsight, retrieve a list of wells, print info and +# get the completion data for the first well found +# +################################################################################### + +# Import the ResInsight Processing Server Module +import rips + +# Connect to ResInsight +resinsight = rips.Instance.find() +if resinsight is not None: + # Get a list of all wells + wells = resinsight.project.well_paths() + + print("Got " + str(len(wells)) + " wells: ") + for well in wells: + print("Well name: " + well.name) + + if len(wells) > 0: + comp_data = wells.completion_data(wells[0].name)