#5213 Use calculate geo mech stresses with biot coefficient.

This commit is contained in:
Kristian Bendiksen
2020-03-30 14:40:32 +02:00
parent c56385361e
commit 0d0ecf42fa
7 changed files with 405 additions and 15 deletions

View File

@@ -861,6 +861,24 @@ QString Rim3dOverlayInfoConfig::resultInfoText( const HistogramData& histData, R
QString( "<b>Cell result:</b> %1, %2, %3<br>" ).arg( resultPos ).arg( fieldName ).arg( compName );
}
if ( geoMechView->cellResultResultDefinition()->isBiotCoefficientDependent() )
{
if ( geoMechCase->biotCoefficientType() == RimGeoMechCase::BIOT_NONE )
{
infoText += QString( "<b>Biot Coefficient</b>: 1.0 (None)<br>" );
}
else if ( geoMechCase->biotCoefficientType() == RimGeoMechCase::BIOT_FIXED )
{
infoText +=
QString( "<b>Biot Coefficient</b>: %1 (Fixed)<br>" ).arg( geoMechCase->biotFixedCoefficient() );
}
else if ( geoMechCase->biotCoefficientType() == RimGeoMechCase::BIOT_PER_ELEMENT )
{
infoText += QString( "<b>Biot Coefficient</b>: %1 (From element property)<br>" )
.arg( geoMechCase->biotResultAddress() );
}
}
const RimGeoMechContourMapView* contourMapView = dynamic_cast<const RimGeoMechContourMapView*>( geoMechView );
if ( contourMapView )
{

View File

@@ -51,6 +51,8 @@
#include "cafPdmFieldIOScriptability.h"
#include "cafPdmObjectScriptability.h"
#include "cafPdmUiDoubleValueEditor.h"
#include "cafPdmUiListEditor.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTreeOrdering.h"
@@ -65,6 +67,19 @@
CAF_PDM_SOURCE_INIT( RimGeoMechCase, "ResInsightGeoMechCase" );
namespace caf
{
template <>
void caf::AppEnum<RimGeoMechCase::BiotCoefficientType>::setUp()
{
addItem( RimGeoMechCase::BIOT_NONE, "BIOT_NONE", "None" );
addItem( RimGeoMechCase::BIOT_FIXED, "BIOT_FIXED", "Fixed biot coefficient" );
addItem( RimGeoMechCase::BIOT_PER_ELEMENT, "BIOT_PER_ELEMENT", "Biot coefficient from element properties" );
setDefault( RimGeoMechCase::BIOT_NONE );
}
} // End namespace caf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -112,6 +127,14 @@ RimGeoMechCase::RimGeoMechCase( void )
CAF_PDM_InitField( &m_reloadElementPropertyFileCommand, "reloadElementPropertyFileCommand", false, "", "", "", "" );
caf::PdmUiPushButtonEditor::configureEditorForField( &m_reloadElementPropertyFileCommand );
caf::AppEnum<BiotCoefficientType> defaultBiotCoefficientType = RimGeoMechCase::BIOT_NONE;
CAF_PDM_InitField( &m_biotCoefficientType, "BiotCoefficientType", defaultBiotCoefficientType, "Biot Coefficient", "", "", "" );
CAF_PDM_InitField( &m_biotFixedCoefficient, "BiotFixedCoefficient", 1.0, "Fixed coefficient", "", "", "" );
m_biotFixedCoefficient.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
CAF_PDM_InitField( &m_biotResultAddress, "BiotResultAddress", QString( "" ), "Value", "", "", "" );
m_biotResultAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps", "", "", "" );
m_contourMapCollection = new RimGeoMechContourMapViewCollection;
m_contourMapCollection.uiCapability()->setUiTreeHidden( true );
@@ -564,6 +587,30 @@ double RimGeoMechCase::frictionAngleDeg() const
return m_frictionAngleDeg;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase::BiotCoefficientType RimGeoMechCase::biotCoefficientType() const
{
return m_biotCoefficientType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimGeoMechCase::biotFixedCoefficient() const
{
return m_biotFixedCoefficient;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechCase::biotResultAddress() const
{
return m_biotResultAddress;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -636,14 +683,56 @@ void RimGeoMechCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
cvf::Math::toRadians( m_frictionAngleDeg() ) );
}
std::vector<Rim3dView*> views = this->views();
for ( Rim3dView* view : views )
updateConnectedViews();
}
else if ( changedField == &m_biotFixedCoefficient || changedField == &m_biotCoefficientType ||
changedField == &m_biotResultAddress )
{
RigGeoMechCaseData* rigCaseData = geoMechData();
if ( rigCaseData && rigCaseData->femPartResults() )
{
if ( view ) // Todo: only those using the variable actively
if ( m_biotCoefficientType() == RimGeoMechCase::BIOT_NONE )
{
view->scheduleCreateDisplayModelAndRedraw();
rigCaseData->femPartResults()->setBiotCoefficientParameters( 1.0, "" );
}
else if ( m_biotCoefficientType() == RimGeoMechCase::BIOT_FIXED )
{
rigCaseData->femPartResults()->setBiotCoefficientParameters( m_biotFixedCoefficient(), "" );
}
else if ( m_biotCoefficientType() == RimGeoMechCase::BIOT_PER_ELEMENT )
{
if ( changedField == &m_biotCoefficientType )
{
// Show info message to user when selecting "from file" option before
// an element property has been imported
std::vector<std::string> elementProperties = possibleElementPropertyFieldNames();
if ( elementProperties.empty() )
{
QString importMessage =
QString( "Please import biot coefficients from file (typically called alpha.inp) by "
"selecting 'Import Element Property Table' on the Geomechanical Model." );
RiaLogging::info( importMessage );
// Set back to default value
m_biotCoefficientType = RimGeoMechCase::BIOT_NONE;
return;
}
}
if ( biotResultAddress().isEmpty() )
{
// Automatically select the first available property element if empty
std::vector<std::string> elementProperties = possibleElementPropertyFieldNames();
if ( !elementProperties.empty() )
{
m_biotResultAddress = QString::fromStdString( elementProperties[0] );
}
}
rigCaseData->femPartResults()->setBiotCoefficientParameters( 1.0, biotResultAddress() );
}
}
updateConnectedViews();
}
else if ( changedField == &m_reloadElementPropertyFileCommand )
{
@@ -853,6 +942,13 @@ void RimGeoMechCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
elmPropGroup->add( &m_reloadElementPropertyFileCommand );
elmPropGroup->add( &m_closeElementPropertyFileCommand );
caf::PdmUiGroup* biotGroup = uiOrdering.addNewGroup( "Biot Coefficient" );
biotGroup->add( &m_biotCoefficientType );
biotGroup->add( &m_biotFixedCoefficient );
biotGroup->add( &m_biotResultAddress );
m_biotFixedCoefficient.uiCapability()->setUiHidden( m_biotCoefficientType != BIOT_FIXED );
m_biotResultAddress.uiCapability()->setUiHidden( m_biotCoefficientType != BIOT_PER_ELEMENT );
caf::PdmUiGroup* timeStepFilterGroup = uiOrdering.addNewGroup( "Time Step Filter" );
timeStepFilterGroup->setCollapsedByDefault( true );
m_timeStepFilter->uiOrdering( uiConfigName, *timeStepFilterGroup );
@@ -873,6 +969,16 @@ void RimGeoMechCase::defineEditorAttribute( const caf::PdmFieldHandle* field,
{
dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute )->m_buttonText = "Close Case(s)";
}
if ( field == &m_biotFixedCoefficient )
{
auto uiDoubleValueEditorAttr = dynamic_cast<caf::PdmUiDoubleValueEditorAttribute*>( attribute );
if ( uiDoubleValueEditorAttr )
{
uiDoubleValueEditorAttr->m_decimals = 2;
uiDoubleValueEditorAttr->m_validator = new QDoubleValidator( 0.0, 1.0, 2 );
}
}
}
//--------------------------------------------------------------------------------------------------
@@ -892,6 +998,45 @@ QList<caf::PdmOptionItemInfo> RimGeoMechCase::calculateValueOptions( const caf::
options.push_back( caf::PdmOptionItemInfo( m_elementPropertyFileNames.v().at( i ).path(), (int)i, true ) );
}
}
else if ( fieldNeedingOptions == &m_biotResultAddress )
{
std::vector<std::string> elementProperties = possibleElementPropertyFieldNames();
for ( const std::string elementProperty : elementProperties )
{
QString result = QString::fromStdString( elementProperty );
options.push_back( caf::PdmOptionItemInfo( result, result ) );
}
}
return options;
}
void RimGeoMechCase::updateConnectedViews()
{
std::vector<Rim3dView*> views = this->views();
for ( Rim3dView* view : views )
{
if ( view )
{
view->scheduleCreateDisplayModelAndRedraw();
}
}
}
std::vector<std::string> RimGeoMechCase::possibleElementPropertyFieldNames()
{
std::vector<std::string> fieldNames;
if ( geoMechData() )
{
std::map<std::string, std::vector<std::string>> fieldWithComponentNames =
geoMechData()->femPartResults()->scalarFieldAndComponentNames( RIG_ELEMENT );
std::map<std::string, std::vector<std::string>>::const_iterator fieldIt;
for ( fieldIt = fieldWithComponentNames.begin(); fieldIt != fieldWithComponentNames.end(); ++fieldIt )
{
fieldNames.push_back( fieldIt->first );
}
}
return fieldNames;
}

View File

@@ -52,6 +52,14 @@ public:
CASE_OPEN_CANCELLED,
CASE_OPEN_ERROR
};
enum BiotCoefficientType
{
BIOT_NONE = 0,
BIOT_FIXED,
BIOT_PER_ELEMENT
};
RimGeoMechCase( void );
~RimGeoMechCase( void ) override;
@@ -88,6 +96,10 @@ public:
// Fields:
caf::PdmChildArrayField<RimGeoMechView*> geoMechViews;
BiotCoefficientType biotCoefficientType() const;
double biotFixedCoefficient() const;
QString biotResultAddress() const;
private:
cvf::Vec3d displayModelOffset() const override;
static std::vector<QDateTime> vectorOfValidDateTimesFromTimeStepStrings( const QStringList& timeStepStrings );
@@ -107,9 +119,11 @@ private:
void initAfterRead() override;
static QString subStringOfDigits( const QString& timeStepString, int numberOfDigitsToFind );
void closeSelectedElementPropertyFiles();
void reloadSelectedElementPropertyFiles();
std::vector<Rim3dView*> allSpecialViews() const override;
void closeSelectedElementPropertyFiles();
void reloadSelectedElementPropertyFiles();
std::vector<Rim3dView*> allSpecialViews() const override;
void updateConnectedViews();
std::vector<std::string> possibleElementPropertyFieldNames();
private:
cvf::ref<RigGeoMechCaseData> m_geoMechCaseData;
@@ -120,6 +134,10 @@ private:
caf::PdmField<bool> m_closeElementPropertyFileCommand;
caf::PdmField<bool> m_reloadElementPropertyFileCommand;
caf::PdmField<caf::AppEnum<BiotCoefficientType>> m_biotCoefficientType;
caf::PdmField<double> m_biotFixedCoefficient;
caf::PdmField<QString> m_biotResultAddress;
caf::PdmChildField<RimGeoMechContourMapViewCollection*> m_contourMapCollection;
bool m_applyTimeFilter;

View File

@@ -931,3 +931,11 @@ void RimGeoMechResultDefinition::updateLegendTextAndRanges( RimRegularLegendConf
legendConfigToUpdate->setTitle( legendTitle );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGeoMechResultDefinition::isBiotCoefficientDependent() const
{
return ( this->resultFieldName() == "SE" || this->resultFieldName() == "ST" );
}

View File

@@ -80,6 +80,8 @@ public:
const QString& legendHeading,
int timeStepIndex );
bool isBiotCoefficientDependent() const;
protected:
virtual void updateLegendCategorySettings(){};
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;