Python: Make more well completion parameters available

Add access to all MSW parameters in Python : "msw_settings = well_path.msw_settings()"
Make all parameters of the well completion object available in Python.
This commit is contained in:
Magne Sjaastad
2024-11-25 09:38:23 +01:00
committed by GitHub
parent 6894149f8e
commit ddefd39fc2
5 changed files with 153 additions and 20 deletions

View File

@@ -23,6 +23,7 @@
#include "RimEclipseCase.h"
#include "RimEclipseCaseTools.h"
#include "RimMswCompletionParameters.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimStimPlanFractureTemplate.h"
@@ -31,6 +32,7 @@
#include "RimTools.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathCompletionSettings.h"
#include "RimWellPathFracture.h"
#include "RigStimPlanModelTools.h"
@@ -223,3 +225,59 @@ std::unique_ptr<caf::PdmObjectHandle> RimcWellPath_appendPerforationInterval::de
{
return std::unique_ptr<caf::PdmObjectHandle>( new RimPerforationInterval );
}
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimWellPath, RimcWellPath_multiSegmentWellSettings, "MswSettings" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimcWellPath_multiSegmentWellSettings::RimcWellPath_multiSegmentWellSettings( caf::PdmObjectHandle* self )
: caf::PdmObjectMethod( self )
{
CAF_PDM_InitObject( "MSW Settings", "", "", "Multi Segment Well Settings" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RimcWellPath_multiSegmentWellSettings::execute()
{
auto wellPath = self<RimWellPath>();
// RimMswCompletionParameters is a child object of RimWellPathCompletionSettings. To simplify the Python API, we return
// RimMswCompletionParameters directly from a well path object in Python. Two parameters are already exposed as part of the completion
// settings object, see RimWellPathCompletionSettings and the proxy fields liner_diameter and roughness. These fields are kept to
// ensure backward compatibility with existing scripts.
//
// https://github.com/OPM/ResInsight/issues/11901
if ( auto completionSettings = wellPath->completionSettings() )
{
return completionSettings->mswCompletionParameters();
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimcWellPath_multiSegmentWellSettings::resultIsPersistent() const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimcWellPath_multiSegmentWellSettings::isNullptrValidResult() const
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::unique_ptr<caf::PdmObjectHandle> RimcWellPath_multiSegmentWellSettings::defaultResult() const
{
return std::unique_ptr<caf::PdmObjectHandle>( new RimMswCompletionParameters );
}

View File

@@ -90,3 +90,19 @@ private:
caf::PdmField<double> m_diameter;
caf::PdmField<double> m_skinFactor;
};
//==================================================================================================
///
//==================================================================================================
class RimcWellPath_multiSegmentWellSettings : public caf::PdmObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcWellPath_multiSegmentWellSettings( caf::PdmObjectHandle* self );
caf::PdmObjectHandle* execute() override;
bool resultIsPersistent() const override;
bool isNullptrValidResult() const override;
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
};