#7339 StimPlanModel: Update python api changes in pdm objects.

The eclipse cases are now set on the StimPlanModelTemplate, not on the
StimPlanModel.
This commit is contained in:
Kristian Bendiksen 2021-02-17 13:10:23 +01:00
parent dc4e372fc2
commit 530c6d3e85
7 changed files with 39 additions and 23 deletions

View File

@ -65,6 +65,7 @@ void RicNewStimPlanModelTemplateFeature::onActionTriggered( bool isChecked )
stimPlanModelTemplate->setDynamicEclipseCase( eclipseCase );
stimPlanModelTemplate->setTimeStep( timeStep );
stimPlanModelTemplate->setStaticEclipseCase( eclipseCase );
stimPlanModelTemplate->setInitialPressureEclipseCase( eclipseCase );
}
fracModColl->addStimPlanModelTemplate( stimPlanModelTemplate );

View File

@ -323,11 +323,14 @@ void RimStimPlanModel::fieldChangedByUi( const caf::PdmFieldHandle* changedField
if ( changedField == &m_eclipseCase )
{
// Set a valid default time step
const int timeStepCount = m_eclipseCase->timeStepStrings().size();
if ( timeStepCount > 0 )
if ( m_eclipseCase )
{
m_timeStep = timeStepCount - 1;
// Set a valid default time step
const int timeStepCount = m_eclipseCase->timeStepStrings().size();
if ( timeStepCount > 0 )
{
m_timeStep = timeStepCount - 1;
}
}
updateExtractionDepthBoundaries();
@ -1664,6 +1667,7 @@ void RimStimPlanModel::setStimPlanModelTemplate( RimStimPlanModelTemplate* stimP
}
m_stimPlanModelTemplate = stimPlanModelTemplate;
stimPlanModelTemplateChanged( nullptr );
if ( m_stimPlanModelTemplate )
{

View File

@ -42,8 +42,6 @@ RimcStimPlanModelCollection_newStimPlanModel::RimcStimPlanModelCollection_newSti
: caf::PdmObjectMethod( self )
{
CAF_PDM_InitObject( "Create StimPlan Model", "", "", "Create a new StimPlan Model" );
CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "", "", "", "Eclipse Case" );
CAF_PDM_InitScriptableFieldNoDefault( &m_timeStep, "TimeStep", "", "", "", "Time Step" );
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "", "", "", "Well Path" );
CAF_PDM_InitScriptableFieldNoDefault( &m_md, "MeasuredDepth", "", "", "", "Measured Depth" );
CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModelTemplate, "StimPlanModelTemplate", "", "", "", "StimPlan Model Template" );
@ -56,13 +54,12 @@ caf::PdmObjectHandle* RimcStimPlanModelCollection_newStimPlanModel::execute()
{
RimStimPlanModel* newStimPlanModel = nullptr;
RimStimPlanModelCollection* stimPlanModelCollection = self<RimStimPlanModelCollection>();
if ( m_wellPath && m_eclipseCase )
if ( m_wellPath )
{
RimWellPathCollection* wellPathCollection = nullptr;
stimPlanModelCollection->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
newStimPlanModel =
RicNewStimPlanModelFeature::addStimPlanModel( m_wellPath, wellPathCollection, m_eclipseCase, m_timeStep );
newStimPlanModel = RicNewStimPlanModelFeature::addStimPlanModel( m_wellPath, wellPathCollection );
}
if ( newStimPlanModel )

View File

@ -48,8 +48,6 @@ public:
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
private:
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<double> m_md;
caf::PdmPtrField<RimStimPlanModelTemplate*> m_stimPlanModelTemplate;

View File

@ -23,6 +23,7 @@
#include "FractureCommands/RicFractureNameGenerator.h"
#include "FractureCommands/RicNewStimPlanModelFeature.h"
#include "RimEclipseCase.h"
#include "RimStimPlanModelTemplate.h"
#include "RimStimPlanModelTemplateCollection.h"
@ -41,6 +42,9 @@ RimcStimPlanModelTemplateCollection_newStimPlanModelTemplate::RimcStimPlanModelT
: caf::PdmObjectMethod( self )
{
CAF_PDM_InitObject( "Create StimPlan Model Template", "", "", "Create a new StimPlan Model Template" );
CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "", "", "", "Eclipse Case" );
CAF_PDM_InitScriptableFieldNoDefault( &m_timeStep, "TimeStep", "", "", "", "Time Step" );
CAF_PDM_InitScriptableFieldNoDefault( &m_faciesPropertiesFilePath,
"FaciesPropertiesFilePath",
"",
@ -60,9 +64,17 @@ RimcStimPlanModelTemplateCollection_newStimPlanModelTemplate::RimcStimPlanModelT
//--------------------------------------------------------------------------------------------------
caf::PdmObjectHandle* RimcStimPlanModelTemplateCollection_newStimPlanModelTemplate::execute()
{
if ( !m_eclipseCase ) return nullptr;
RimStimPlanModelTemplate* newStimPlanModelTemplate = new RimStimPlanModelTemplate;
RimStimPlanModelTemplateCollection* stimPlanModelTemplateCollection = self<RimStimPlanModelTemplateCollection>();
newStimPlanModelTemplate->setName( RicFractureNameGenerator::nameForNewStimPlanModelTemplate() );
newStimPlanModelTemplate->setDynamicEclipseCase( m_eclipseCase );
newStimPlanModelTemplate->setTimeStep( m_timeStep );
newStimPlanModelTemplate->setInitialPressureEclipseCase( m_eclipseCase );
newStimPlanModelTemplate->setStaticEclipseCase( m_eclipseCase );
stimPlanModelTemplateCollection->addStimPlanModelTemplate( newStimPlanModelTemplate );
RicElasticPropertiesImportTools::importElasticPropertiesFromFile( m_elasticPropertiesFilePath,

View File

@ -29,6 +29,7 @@
#include <QString>
class RimStimPlanModelTemplateCollection;
class RimEclipseCase;
//==================================================================================================
///
@ -45,6 +46,8 @@ public:
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
private:
caf::PdmField<QString> m_elasticPropertiesFilePath;
caf::PdmField<QString> m_faciesPropertiesFilePath;
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
caf::PdmField<int> m_timeStep;
caf::PdmField<QString> m_elasticPropertiesFilePath;
caf::PdmField<QString> m_faciesPropertiesFilePath;
};

View File

@ -17,9 +17,20 @@ 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)
# Find a case
cases = resinsight.project.cases()
case = cases[1]
# Use the last time step
time_steps = case.time_steps()
time_step = time_steps[len(time_steps) - 1]
# Create stim plan model template
fmt_collection = project.descendants(rips.StimPlanModelTemplateCollection)[0]
stim_plan_model_template = fmt_collection.new_stim_plan_model_template(
eclipse_case=case,
time_step=time_step,
elastic_properties_file_path=elastic_properties_file_path,
facies_properties_file_path=facies_properties_file_path,
)
@ -63,14 +74,6 @@ well_path = project.well_path_by_name(well_name)
print("well path:", well_path)
stim_plan_model_collection = project.descendants(rips.StimPlanModelCollection)[0]
# Find a case
cases = resinsight.project.cases()
case = cases[0]
# Use the last time step
time_steps = case.time_steps()
time_step = time_steps[len(time_steps) - 1]
export_folder = tempfile.gettempdir()
@ -82,8 +85,6 @@ for measured_depth in measured_depths:
# Create stim plan model at a give measured depth
stim_plan_model = stim_plan_model_collection.new_stim_plan_model(
eclipse_case=case,
time_step=time_step,
well_path=well_path,
measured_depth=measured_depth,
stim_plan_model_template=stim_plan_model_template,