mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#9386 Fractures: add python api to scale fracture templates
This commit is contained in:
parent
0fa001fc70
commit
a695edc13a
@ -20,6 +20,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcModeledWellPath.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcWellPath.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplateCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplate.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcThermalFractureTemplate.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.h
|
||||
)
|
||||
@ -46,6 +47,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcModeledWellPath.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcWellPath.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplateCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplate.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcThermalFractureTemplate.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.cpp
|
||||
)
|
||||
|
@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2022- 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 "RimcFractureTemplate.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimFractureTemplate.h"
|
||||
|
||||
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimFractureTemplate, RimcFractureTemplate_setScaleFactors, "SetScaleFactors" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcFractureTemplate_setScaleFactors::RimcFractureTemplate_setScaleFactors( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Set Fracture Template Scale Factors", "", "", "Set Fracture Template Scale Factors." );
|
||||
CAF_PDM_InitScriptableField( &m_halfLength, "HalfLength", 1.0, "Half Length" );
|
||||
CAF_PDM_InitScriptableField( &m_height, "Height", 1.0, "Height" );
|
||||
CAF_PDM_InitScriptableField( &m_dFactor, "DFactor", 1.0, "D Factor" );
|
||||
CAF_PDM_InitScriptableField( &m_conductivity, "Conductivity", 1.0, "Conductivity" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFractureTemplate_setScaleFactors::execute()
|
||||
{
|
||||
if ( m_halfLength() <= 0.0 || m_height() <= 0.0 || m_dFactor() <= 0.0 || m_conductivity() <= 0.0 )
|
||||
{
|
||||
RiaLogging::error( "Invalid scale factors." );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RimFractureTemplate* fractureTemplate = self<RimFractureTemplate>();
|
||||
if ( fractureTemplate )
|
||||
{
|
||||
fractureTemplate->setScaleFactors( m_halfLength, m_height, m_dFactor, m_conductivity );
|
||||
fractureTemplate->loadDataAndUpdateGeometryHasChanged();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcFractureTemplate_setScaleFactors::resultIsPersistent() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcFractureTemplate_setScaleFactors::defaultResult() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcFractureTemplate_setScaleFactors::isNullptrValidResult() const
|
||||
{
|
||||
return true;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "cafPdmField.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimFractureTemplate;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcFractureTemplate_setScaleFactors : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcFractureTemplate_setScaleFactors( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_halfLength;
|
||||
caf::PdmField<double> m_height;
|
||||
caf::PdmField<double> m_dFactor;
|
||||
caf::PdmField<double> m_conductivity;
|
||||
};
|
@ -47,3 +47,8 @@ for measured_depth in measured_depths:
|
||||
fracture_template.orientation = "Azimuth"
|
||||
fracture_template.azimuth_angle = 60.0
|
||||
fracture_template.update()
|
||||
|
||||
# Scale the template
|
||||
fracture_template.set_scale_factors(
|
||||
half_length=2.0, height=2.0, d_factor=1.1, conductivity=1.2
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user