Thermal Fracture: add api for changing time step from python

This commit is contained in:
Kristian Bendiksen 2022-10-21 19:30:10 +02:00
parent fa83d17818
commit 737eb9693a
11 changed files with 95 additions and 33 deletions

View File

@ -18,9 +18,6 @@
#include "RicPlaceThermalFractureUsingTemplateDataFeature.h"
#include "RiaLogging.h"
#include "RigWellPath.h"
#include "RimProject.h"
#include "RimThermalFractureTemplate.h"
#include "RimWellPath.h"
@ -56,31 +53,7 @@ bool RicPlaceThermalFractureUsingTemplateDataFeature::placeUsingTemplateData( Ri
RimThermalFractureTemplate* thermalTemplate = dynamic_cast<RimThermalFractureTemplate*>( fracture->fractureTemplate() );
if ( !thermalTemplate ) return false;
RimWellPath* wellPath = nullptr;
fracture->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry ) return false;
auto [centerPosition, rotation] = thermalTemplate->computePositionAndRotation();
// TODO: y conversion is workaround for strange test data
centerPosition.y() = std::fabs( centerPosition.y() );
centerPosition.z() *= -1.0;
double md = wellPathGeometry->closestMeasuredDepth( centerPosition );
RiaLogging::info( QString( "Placing thermal fracture. Posotion: [%1 %2 %3]" )
.arg( centerPosition.x() )
.arg( centerPosition.y() )
.arg( centerPosition.z() ) );
RiaLogging::info( QString( "Computed MD: %1" ).arg( md ) );
fracture->setMeasuredDepth( md );
fracture->setAzimuth( rotation.x() );
fracture->setDip( rotation.y() );
fracture->setTilt( rotation.z() );
if ( !thermalTemplate->placeFractureUsingTemplateData( fracture ) ) return false;
fracture->updateConnectedEditors();
RimProject* project = RimProject::current();

View File

@ -197,6 +197,10 @@ double RimFracture::perforationEfficiency() const
void RimFracture::setStimPlanTimeIndexToPlot( int timeIndex )
{
m_stimPlanTimeIndexToPlot = timeIndex;
if ( m_autoUpdateWellPathDepthAtFractureFromTemplate )
{
placeUsingTemplateData();
}
}
//--------------------------------------------------------------------------------------------------
@ -263,6 +267,7 @@ void RimFracture::fieldChangedByUi( const caf::PdmFieldHandle* changedField, con
if ( m_autoUpdateWellPathDepthAtFractureFromTemplate && m_fractureTemplate() )
{
m_wellPathDepthAtFracture = m_fractureTemplate->wellPathDepthAtFracture();
placeUsingTemplateData();
}
updateFractureGrid();
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
@ -274,6 +279,11 @@ void RimFracture::fieldChangedByUi( const caf::PdmFieldHandle* changedField, con
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
}
if ( changedField == &m_stimPlanTimeIndexToPlot )
{
if ( m_autoUpdateWellPathDepthAtFractureFromTemplate() ) placeUsingTemplateData();
}
if ( changedField == &m_azimuth || changedField == &m_fractureTemplate ||
changedField == &m_stimPlanTimeIndexToPlot || changedField == this->objectToggleField() ||
changedField == &m_dip || changedField == &m_tilt || changedField == &m_perforationLength )
@ -1004,3 +1014,10 @@ void RimFracture::onWellPathDepthAtFractureInTemplateChanged( const caf::SignalE
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFracture::placeUsingTemplateData()
{
}

View File

@ -121,6 +121,8 @@ public:
virtual void loadDataAndUpdate() = 0;
virtual std::vector<cvf::Vec3d> perforationLengthCenterLineCoords() const = 0;
virtual void placeUsingTemplateData();
// Fracture properties
const NonDarcyData& nonDarcyProperties() const;
void ensureValidNonDarcyProperties();

View File

@ -1001,3 +1001,11 @@ double RimFractureTemplate::wellPathDepthAtFracture() const
{
return m_wellPathDepthAtFracture;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFractureTemplate::placeFractureUsingTemplateData( RimFracture* fracture )
{
return true;
}

View File

@ -147,6 +147,8 @@ public:
std::vector<cvf::uint>* triangleIndices,
double wellPathDepthAtFracture ) const = 0;
virtual bool placeFractureUsingTemplateData( RimFracture* fracture );
virtual cvf::cref<RigFractureGrid> createFractureGrid( double wellPathDepthAtFracture ) const = 0;
const RimFractureContainment* fractureContainment() const;

View File

@ -66,11 +66,11 @@ RimMeshFractureTemplate::RimMeshFractureTemplate()
CAF_PDM_InitField( &m_borderPolygonResultName, "BorderPolygonResultName", QString( "" ), "Parameter" );
m_borderPolygonResultName.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_activeTimeStepIndex, "ActiveTimeStepIndex", 0, "Active TimeStep Index" );
CAF_PDM_InitField( &m_conductivityResultNameOnFile,
"ConductivityResultName",
QString( "" ),
"Active Conductivity Result Name" );
CAF_PDM_InitScriptableField( &m_activeTimeStepIndex, "ActiveTimeStepIndex", 0, "Active TimeStep Index" );
CAF_PDM_InitScriptableField( &m_conductivityResultNameOnFile,
"ConductivityResultName",
QString( "" ),
"Active Conductivity Result Name" );
m_readError = false;

View File

@ -31,11 +31,13 @@
#include "RigFractureGrid.h"
#include "RigThermalFractureDefinition.h"
#include "RigThermalFractureResultUtil.h"
#include "RigWellPath.h"
#include "RimEclipseView.h"
#include "RimFracture.h"
#include "RimStimPlanColors.h"
#include "RimWellPath.h"
#include "RimWellPathFracture.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObject.h"
@ -784,3 +786,38 @@ RimThermalFractureTemplate::FilterCakePressureDrop RimThermalFractureTemplate::f
{
return m_filterCakePressureDropType.value();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimThermalFractureTemplate::placeFractureUsingTemplateData( RimFracture* fracture )
{
RimWellPath* wellPath = nullptr;
fracture->firstAncestorOrThisOfTypeAsserted( wellPath );
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry ) return false;
auto [centerPosition, rotation] = computePositionAndRotation();
// TODO: y conversion is workaround for strange test data
centerPosition.y() = std::fabs( centerPosition.y() );
centerPosition.z() *= -1.0;
double md = wellPathGeometry->closestMeasuredDepth( centerPosition );
RiaLogging::info( QString( "Placing thermal fracture. Posotion: [%1 %2 %3]" )
.arg( centerPosition.x() )
.arg( centerPosition.y() )
.arg( centerPosition.z() ) );
RiaLogging::info( QString( "Computed MD: %1" ).arg( md ) );
RimWellPathFracture* wellPathFracture = dynamic_cast<RimWellPathFracture*>( fracture );
if ( wellPathFracture ) wellPathFracture->setMeasuredDepth( md );
m_orientationType = RimFractureTemplate::AZIMUTH;
fracture->setAzimuth( rotation.x() );
fracture->setDip( rotation.y() );
fracture->setTilt( rotation.z() );
return true;
}

View File

@ -62,6 +62,8 @@ public:
std::vector<cvf::uint>* triangleIndices,
double wellPathDepthAtFracture ) const override;
bool placeFractureUsingTemplateData( RimFracture* fracture ) override;
// Result Access
std::vector<QString> timeStepsStrings() override;
std::vector<double> timeSteps() override;

View File

@ -355,3 +355,14 @@ void RimWellPathFracture::applyOffset( double offsetMD )
{
m_measuredDepth = m_measuredDepth + offsetMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathFracture::placeUsingTemplateData()
{
if ( m_fractureTemplate )
{
m_fractureTemplate->placeFractureUsingTemplateData( this );
}
}

View File

@ -48,6 +48,8 @@ public:
double wellAzimuthAtFracturePosition() const override;
void placeUsingTemplateData() override;
void loadDataAndUpdate() override;
std::vector<cvf::Vec3d> perforationLengthCenterLineCoords() const override;

View File

@ -34,3 +34,11 @@ fracture = well_path.add_thermal_fracture(
fracture_template=fracture_template,
place_using_template_data=True,
)
time_steps = fracture_template.time_steps().values
for time_step_index, time_stamp in enumerate(time_steps):
print("Time step #{}: {}".format(time_step_index, time_stamp))
fracture_template.active_time_step_index = time_step_index
fracture_template.conductivity_result_name = "Conductivity"
fracture_template.update()