mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
StimPlan Model: Provide default value for facies
This commit is contained in:
@@ -991,6 +991,29 @@ double RimStimPlanModel::defaultPermeability() const
|
||||
return m_stimPlanModelTemplate() ? m_stimPlanModelTemplate()->defaultPermeability() : RiaDefines::defaultPermeability();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimStimPlanModel::defaultFaciesValue() const
|
||||
{
|
||||
RimStimPlanModelTemplate* templ = m_stimPlanModelTemplate();
|
||||
if ( templ )
|
||||
{
|
||||
// Map the facies to a value using the color legend
|
||||
RimFaciesProperties* faciesProperties = templ->faciesProperties();
|
||||
if ( faciesProperties )
|
||||
{
|
||||
RimColorLegend* faciesColorLegend = faciesProperties->colorLegend();
|
||||
if ( faciesColorLegend )
|
||||
{
|
||||
return findFaciesValue( *faciesColorLegend, templ->defaultFacies() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1008,6 +1031,10 @@ double RimStimPlanModel::getDefaultForMissingValue( RiaDefines::CurveProperty cu
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
else if ( curveProperty == RiaDefines::CurveProperty::FACIES )
|
||||
{
|
||||
return defaultFaciesValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::numeric_limits<double>::infinity();
|
||||
|
@@ -105,6 +105,7 @@ public:
|
||||
|
||||
double defaultPorosity() const;
|
||||
double defaultPermeability() const;
|
||||
double defaultFaciesValue() const;
|
||||
|
||||
double verticalStress() const;
|
||||
double verticalStressGradient() const;
|
||||
|
@@ -714,7 +714,8 @@ std::pair<std::vector<double>, std::vector<QString>> RimStimPlanModelCalculator:
|
||||
|
||||
for ( auto value : values )
|
||||
{
|
||||
auto [isFound, faciesName] = RimStimPlanModelElasticPropertyCalculator::findFaciesName( *colorLegend, value );
|
||||
auto [isFound, faciesName] =
|
||||
RimStimPlanModelElasticPropertyCalculator::findFaciesName( *colorLegend, value, stimPlanModelTemplate->defaultFacies() );
|
||||
faciesNames.push_back( faciesName );
|
||||
}
|
||||
|
||||
|
@@ -221,8 +221,9 @@ bool RimStimPlanModelElasticPropertyCalculator::calculate( RiaDefines::CurveProp
|
||||
for ( size_t i = 0; i < tvDepthValues.size(); i++ )
|
||||
{
|
||||
// Avoid using the field name in the match for now
|
||||
QString fieldName = "";
|
||||
auto [foundFaciesName, faciesName] = findFaciesName( *colorLegend, faciesValues[i] );
|
||||
QString fieldName = "";
|
||||
auto [foundFaciesName, faciesName] =
|
||||
findFaciesName( *colorLegend, faciesValues[i], stimPlanModel->stimPlanModelTemplate()->defaultFacies() );
|
||||
if ( !foundFaciesName )
|
||||
{
|
||||
RiaLogging::error( QString( "Missing facies name for facies value: %1 (%2). Color legend: '%3'" )
|
||||
@@ -321,8 +322,12 @@ bool RimStimPlanModelElasticPropertyCalculator::calculate( RiaDefines::CurveProp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<bool, QString> RimStimPlanModelElasticPropertyCalculator::findFaciesName( const RimColorLegend& colorLegend, double value )
|
||||
std::pair<bool, QString> RimStimPlanModelElasticPropertyCalculator::findFaciesName( const RimColorLegend& colorLegend,
|
||||
double value,
|
||||
const QString& defaultFaciesName )
|
||||
{
|
||||
if ( std::isinf( value ) || std::isnan( value ) ) return { true, defaultFaciesName };
|
||||
|
||||
for ( auto item : colorLegend.colorLegendItems() )
|
||||
{
|
||||
if ( item->categoryValue() == static_cast<int>( value ) ) return { true, item->categoryName() };
|
||||
|
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
bool isMatching( RiaDefines::CurveProperty curveProperty ) const override;
|
||||
|
||||
static std::pair<bool, QString> findFaciesName( const RimColorLegend& colorLegend, double value );
|
||||
static std::pair<bool, QString> findFaciesName( const RimColorLegend& colorLegend, double value, const QString& defaultFaciesName );
|
||||
|
||||
protected:
|
||||
static void addOverburden( std::vector<QString>& formationNames,
|
||||
|
@@ -88,6 +88,7 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate()
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_defaultPorosity, "DefaultPorosity", RiaDefines::defaultPorosity(), "Default Porosity" );
|
||||
CAF_PDM_InitScriptableField( &m_defaultPermeability, "DefaultPermeability", RiaDefines::defaultPermeability(), "Default Permeability" );
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_defaultFacies, "DefaultFacies", "Default Facies" );
|
||||
|
||||
// Stress unit: bar
|
||||
// Stress gradient unit: bar/m
|
||||
@@ -194,7 +195,8 @@ QList<caf::PdmOptionItemInfo> RimStimPlanModelTemplate::calculateValueOptions( c
|
||||
options.push_back( caf::PdmOptionItemInfo( formationName, formationName ) );
|
||||
}
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_overburdenFacies || fieldNeedingOptions == &m_underburdenFacies )
|
||||
else if ( fieldNeedingOptions == &m_overburdenFacies || fieldNeedingOptions == &m_underburdenFacies ||
|
||||
fieldNeedingOptions == &m_defaultFacies )
|
||||
{
|
||||
if ( !m_faciesProperties ) return options;
|
||||
|
||||
@@ -240,9 +242,10 @@ void RimStimPlanModelTemplate::defineUiOrdering( QString uiConfigName, caf::PdmU
|
||||
pressureDataSourceGroup->add( &m_useEqlnumForPressureInterpolation );
|
||||
m_initialPressureEclipseCase.uiCapability()->setUiReadOnly( m_useTableForInitialPressure() );
|
||||
|
||||
caf::PdmUiOrdering* defaultsGroup = uiOrdering.addNewGroup( "Defaults" );
|
||||
caf::PdmUiOrdering* defaultsGroup = uiOrdering.addNewGroup( "Reservoir Defaults" );
|
||||
defaultsGroup->add( &m_defaultPorosity );
|
||||
defaultsGroup->add( &m_defaultPermeability );
|
||||
defaultsGroup->add( &m_defaultFacies );
|
||||
|
||||
caf::PdmUiOrdering* referenceStressGroup = uiOrdering.addNewGroup( "Reference Stress" );
|
||||
referenceStressGroup->add( &m_verticalStress );
|
||||
@@ -494,6 +497,11 @@ void RimStimPlanModelTemplate::initAfterRead()
|
||||
{
|
||||
m_nonNetLayers->setEclipseCase( eclipseCase );
|
||||
}
|
||||
|
||||
if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2023.03" ) )
|
||||
{
|
||||
m_defaultFacies = m_overburdenFacies;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -560,6 +568,14 @@ double RimStimPlanModelTemplate::defaultPermeability() const
|
||||
return m_defaultPermeability();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimStimPlanModelTemplate::defaultFacies() const
|
||||
{
|
||||
return m_defaultFacies;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -59,8 +59,9 @@ public:
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
double defaultPorosity() const;
|
||||
double defaultPermeability() const;
|
||||
double defaultPorosity() const;
|
||||
double defaultPermeability() const;
|
||||
QString defaultFacies() const;
|
||||
|
||||
double overburdenHeight() const;
|
||||
double underburdenHeight() const;
|
||||
@@ -152,6 +153,7 @@ private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_staticEclipseCase;
|
||||
caf::PdmField<double> m_defaultPorosity;
|
||||
caf::PdmField<double> m_defaultPermeability;
|
||||
caf::PdmField<QString> m_defaultFacies;
|
||||
caf::PdmField<double> m_verticalStress;
|
||||
caf::PdmField<double> m_verticalStressGradient;
|
||||
caf::PdmField<double> m_stressDepth;
|
||||
|
Reference in New Issue
Block a user