mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6597: Add python api for adding elastic properties scaling.
This commit is contained in:
parent
3baef48926
commit
f4eefc3e08
@ -642,6 +642,11 @@ QDateTime RifCsvUserDataParser::tryParseDateTime( const std::string& colData, co
|
||||
QString RifCsvUserDataParser::tryDetermineCellSeparator()
|
||||
{
|
||||
QTextStream* dataStream = openDataStream();
|
||||
if ( !dataStream )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::vector<QString> lines;
|
||||
int iLine = 0;
|
||||
|
||||
@ -792,6 +797,7 @@ bool RifCsvUserDataFileParser::openFile()
|
||||
RiaLogging::error( QString( "Failed to open %1" ).arg( m_fileName ) );
|
||||
|
||||
delete m_file;
|
||||
m_file = nullptr;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
import rips
|
||||
import tempfile
|
||||
from os.path import expanduser
|
||||
from pathlib import Path
|
||||
|
||||
# Connect to ResInsight instance
|
||||
resinsight = rips.Instance.find()
|
||||
@ -10,8 +11,11 @@ project = resinsight.project
|
||||
|
||||
# Create fracture model template
|
||||
home_dir = expanduser("~")
|
||||
elastic_properties_file_path = home_dir + "/elastic_properties.csv"
|
||||
facies_properties_file_path = home_dir + "/facies_id.roff"
|
||||
elastic_properties_file_path = (Path(home_dir) / "elastic_properties.csv").as_posix()
|
||||
print("Elastic properties file path:", elastic_properties_file_path)
|
||||
|
||||
facies_properties_file_path = (Path(home_dir) / "facies_id.roff").as_posix()
|
||||
print("Facies properties file path:", facies_properties_file_path)
|
||||
|
||||
fmt_collection = project.descendants(rips.FractureModelTemplateCollection)[0]
|
||||
fracture_model_template = fmt_collection.new_fracture_model_template(elastic_properties_file_path=elastic_properties_file_path,
|
||||
@ -32,8 +36,13 @@ eclipse_result.result_variable = "OPERNUM_1"
|
||||
eclipse_result.update()
|
||||
|
||||
|
||||
# Add some scaling factors
|
||||
elastic_properties = fracture_model_template.elastic_properties()
|
||||
elastic_properties.add_property_scaling(formation="Garn", facies="Calcite", property="YOUNGS_MODULUS", scale=1.44)
|
||||
|
||||
|
||||
# Find a well
|
||||
well_path = project.well_path_by_name("B-2_H")
|
||||
well_path = project.well_path_by_name("B-2 H")
|
||||
print("well path:", well_path)
|
||||
fracture_model_collection = project.descendants(rips.FractureModelCollection)[0]
|
||||
|
||||
|
@ -139,6 +139,38 @@ RigEclipseCaseData* RimElasticPropertyScaling::getEclipseCaseData()
|
||||
return eclipseCase->eclipseCaseData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticPropertyScaling::setFormation( const QString& formation )
|
||||
{
|
||||
m_formation = formation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticPropertyScaling::setFacies( const QString& facies )
|
||||
{
|
||||
m_facies = facies;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticPropertyScaling::setScale( double scale )
|
||||
{
|
||||
m_scale = scale;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimElasticPropertyScaling::setProperty( RiaDefines::CurveProperty property )
|
||||
{
|
||||
m_property = property;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -59,4 +59,10 @@ private:
|
||||
caf::PdmField<QString> m_facies;
|
||||
caf::PdmField<caf::AppEnum<RiaDefines::CurveProperty>> m_property;
|
||||
caf::PdmField<double> m_scale;
|
||||
|
||||
public:
|
||||
void setFormation( const QString& formation );
|
||||
void setFacies( const QString& facies );
|
||||
void setScale( double m_scale );
|
||||
void setProperty( RiaDefines::CurveProperty property );
|
||||
};
|
||||
|
@ -4,6 +4,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryResampleData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcProject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcElasticProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelTemplateCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelPlotCollection.h
|
||||
@ -19,6 +20,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimcSummaryPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcSummaryResampleData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcProject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcElasticProperties.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelTemplateCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimcFractureModelPlotCollection.cpp
|
||||
|
@ -0,0 +1,82 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RimcElasticProperties.h"
|
||||
|
||||
#include "RimElasticProperties.h"
|
||||
#include "RimElasticPropertyScaling.h"
|
||||
#include "RimElasticPropertyScalingCollection.h"
|
||||
|
||||
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||
#include "cafPdmFieldScriptingCapability.h"
|
||||
|
||||
CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimElasticProperties, RimcElasticProperties_addPropertyScaling, "AddPropertyScaling" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimcElasticProperties_addPropertyScaling::RimcElasticProperties_addPropertyScaling( caf::PdmObjectHandle* self )
|
||||
: caf::PdmObjectMethod( self )
|
||||
{
|
||||
CAF_PDM_InitObject( "Add Elastic Propery Scaling", "", "", "Add Elastic Property Scaling" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_formation, "Formation", "", "", "", "Formation" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "", "", "", "Facies" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_property, "Property", "", "", "", "Property" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_scale, "Scale", "", "", "", "Scale" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcElasticProperties_addPropertyScaling::execute()
|
||||
{
|
||||
RimElasticProperties* elasticProperties = self<RimElasticProperties>();
|
||||
|
||||
RimElasticPropertyScalingCollection* scalingColl = elasticProperties->scalingCollection();
|
||||
if ( !scalingColl ) return nullptr;
|
||||
|
||||
RimElasticPropertyScaling* propertyScaling = new RimElasticPropertyScaling;
|
||||
propertyScaling->setFormation( m_formation() );
|
||||
propertyScaling->setFacies( m_facies() );
|
||||
propertyScaling->setScale( m_scale() );
|
||||
|
||||
caf::AppEnum<RiaDefines::CurveProperty> property;
|
||||
property.setFromText( m_property() );
|
||||
propertyScaling->setProperty( property );
|
||||
|
||||
scalingColl->addElasticPropertyScaling( propertyScaling );
|
||||
scalingColl->updateConnectedEditors();
|
||||
|
||||
return propertyScaling;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimcElasticProperties_addPropertyScaling::resultIsPersistent() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::unique_ptr<caf::PdmObjectHandle> RimcElasticProperties_addPropertyScaling::defaultResult() const
|
||||
{
|
||||
return std::unique_ptr<caf::PdmObjectHandle>( new RimElasticPropertyScaling );
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimFractureModelCollection.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmObjectMethod.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimFractureModelCollection;
|
||||
class RimFractureModelTemplate;
|
||||
class RimWellPath;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimcElasticProperties_addPropertyScaling : public caf::PdmObjectMethod
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimcElasticProperties_addPropertyScaling( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_formation;
|
||||
caf::PdmField<QString> m_facies;
|
||||
caf::PdmField<QString> m_property;
|
||||
caf::PdmField<double> m_scale;
|
||||
};
|
Loading…
Reference in New Issue
Block a user