mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-20 11:48:35 -06:00
#5213 Use calculate geo mech stresses with biot coefficient.
This commit is contained in:
parent
c56385361e
commit
0d0ecf42fa
@ -19,6 +19,8 @@
|
||||
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RifElementPropertyReader.h"
|
||||
#include "RifGeoMechReaderInterface.h"
|
||||
|
||||
@ -104,6 +106,9 @@ RigFemPartResultsCollection::RigFemPartResultsCollection( RifGeoMechReaderInterf
|
||||
m_cohesion = 10.0;
|
||||
m_frictionAngleRad = cvf::Math::toRadians( 30.0 );
|
||||
m_normalizationAirGap = 0.0;
|
||||
|
||||
m_biotFixedFactor = 1.0;
|
||||
m_biotResultAddress = "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -233,6 +238,70 @@ void RigFemPartResultsCollection::setCalculationParameters( double cohesion, dou
|
||||
RigFemResultAddress( RIG_INTEGRATION_POINT, "SE", "FOS", RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::setBiotCoefficientParameters( double biotFixedFactor, const QString& biotResultAddress )
|
||||
{
|
||||
m_biotFixedFactor = biotFixedFactor;
|
||||
m_biotResultAddress = biotResultAddress;
|
||||
|
||||
// Invalidate all results which depends on biot coefficient (directly or indirectly)
|
||||
std::vector<std::string> componentNames = getStressComponentNames();
|
||||
componentNames.push_back( "S1inc" );
|
||||
componentNames.push_back( "S1azi" );
|
||||
componentNames.push_back( "S2inc" );
|
||||
componentNames.push_back( "S2azi" );
|
||||
componentNames.push_back( "S3inc" );
|
||||
componentNames.push_back( "S3azi" );
|
||||
|
||||
for ( auto elementType : {RIG_ELEMENT_NODAL, RIG_INTEGRATION_POINT} )
|
||||
{
|
||||
for ( auto fieldName : {"SE", "ST"} )
|
||||
{
|
||||
for ( auto componentName : componentNames )
|
||||
{
|
||||
deleteResult(
|
||||
RigFemResultAddress( elementType, fieldName, componentName, RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
}
|
||||
}
|
||||
|
||||
// SE only: depends on SE.S1 and SE.S3
|
||||
deleteResult( RigFemResultAddress( elementType, "SE", "SFI", RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
deleteResult( RigFemResultAddress( elementType, "SE", "DSM", RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
deleteResult( RigFemResultAddress( elementType, "SE", "SEM", RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
|
||||
// SE only: depends on SE.DSM
|
||||
deleteResult( RigFemResultAddress( elementType, "SE", "FOS", RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
|
||||
// ST only: depends on ST.S1 and ST.S3
|
||||
deleteResult( RigFemResultAddress( elementType, "ST", "Q", RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
deleteResult( RigFemResultAddress( elementType, "ST", "STM", RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
}
|
||||
|
||||
for ( auto fieldName : {"SE", "ST"} )
|
||||
{
|
||||
// Surface aligned stress
|
||||
for ( auto componentName : {"SN", "TP", "TPinc", "TPH", "TPQV", "FAULTMOB", "PCRIT"} )
|
||||
{
|
||||
deleteResult( RigFemResultAddress( RIG_ELEMENT_NODAL_FACE,
|
||||
fieldName,
|
||||
componentName,
|
||||
RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
}
|
||||
|
||||
// Stress gradient components
|
||||
const std::vector<std::string> stressGradientComponentNames = getStressGradientComponentNames();
|
||||
for ( auto componentName : stressGradientComponentNames )
|
||||
{
|
||||
deleteResult( RigFemResultAddress( RIG_DIFFERENTIALS,
|
||||
fieldName,
|
||||
componentName,
|
||||
RigFemResultAddress::allTimeLapsesValue() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Will always return a valid object, but it can be empty
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -338,8 +407,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult( i
|
||||
|
||||
if ( !frames )
|
||||
{
|
||||
frames = m_femPartResults[partIndex]->createScalarResult( resVarAddr ); // Create a dummy empty result, if the
|
||||
// request did not specify the component.
|
||||
frames = m_femPartResults[partIndex]->createScalarResult( resVarAddr ); // Create a dummy empty result, if
|
||||
// the request did not specify the
|
||||
// component.
|
||||
}
|
||||
|
||||
return frames;
|
||||
@ -710,7 +780,8 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateTimeLapseResult(
|
||||
}
|
||||
else
|
||||
{
|
||||
// Gamma time lapse needs to be calculated as ST_dt / POR_dt and not Gamma - Gamma_baseFrame see github issue #937
|
||||
// Gamma time lapse needs to be calculated as ST_dt / POR_dt and not Gamma - Gamma_baseFrame see github
|
||||
// issue #937
|
||||
|
||||
caf::ProgressInfo frameCountProgress( this->frameCount() * 3, "" );
|
||||
frameCountProgress.setProgressDescription(
|
||||
@ -2149,10 +2220,20 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSE( int partInde
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
|
||||
// Biot porelastic coeffisient (alpha)
|
||||
RigFemScalarResultFrames* biotCoefficient = nullptr;
|
||||
if ( !m_biotResultAddress.isEmpty() )
|
||||
{
|
||||
biotCoefficient =
|
||||
this->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( RIG_ELEMENT, m_biotResultAddress.toStdString(), "" ) );
|
||||
}
|
||||
|
||||
const RigFemPart* femPart = m_femParts->part( partIndex );
|
||||
float inf = std::numeric_limits<float>::infinity();
|
||||
|
||||
int frameCount = srcDataFrames->frameCount();
|
||||
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
const std::vector<float>& srcSFrameData = srcDataFrames->frameData( fIdx );
|
||||
@ -2160,10 +2241,21 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSE( int partInde
|
||||
size_t valCount = srcSFrameData.size();
|
||||
dstFrameData.resize( valCount );
|
||||
|
||||
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData( fIdx );
|
||||
const std::vector<float>& initialPORFrameData = srcPORDataFrames->frameData( 0 );
|
||||
|
||||
int elementCount = femPart->elementCount();
|
||||
|
||||
std::vector<float> biotData;
|
||||
if ( biotCoefficient )
|
||||
{
|
||||
biotData = biotCoefficient->frameData( fIdx );
|
||||
if ( !isValidBiotData( biotData, elementCount ) )
|
||||
{
|
||||
deleteResult( resVarAddr );
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int elmIdx = 0; elmIdx < elementCount; ++elmIdx )
|
||||
{
|
||||
@ -2178,7 +2270,37 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSE( int partInde
|
||||
size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx );
|
||||
if ( elmNodResIdx < srcSFrameData.size() )
|
||||
{
|
||||
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx];
|
||||
double SE_abacus = -srcSFrameData[elmNodResIdx];
|
||||
if ( fIdx == 0 )
|
||||
{
|
||||
// Geostatic step: biot coefficient == 1.0
|
||||
dstFrameData[elmNodResIdx] = SE_abacus;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use biot coefficient for all other (not Geostatic) timesteps
|
||||
double biotCoefficient = 1.0;
|
||||
if ( biotData.empty() )
|
||||
{
|
||||
biotCoefficient = m_biotFixedFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use coefficient from element property table
|
||||
biotCoefficient = biotData[elmIdx];
|
||||
}
|
||||
|
||||
// SE = St - alpha * porePressure - (1 - alpha) * initialPorePressure
|
||||
// ST = SE_abaqus + alpha * porePressure
|
||||
// Can be simplified:
|
||||
// SE = SE_abaqus - (1-alpha) * initialPorePressure
|
||||
// SE_abaqus is called S-Bar
|
||||
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
|
||||
double initialPorePressure = initialPORFrameData[nodeIdx];
|
||||
if ( initialPorePressure == inf ) initialPorePressure = 0.0f;
|
||||
|
||||
dstFrameData[elmNodResIdx] = SE_abacus - ( 1.0 - biotCoefficient ) * initialPorePressure;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2221,6 +2343,15 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateST_11_22_33( int
|
||||
RigFemScalarResultFrames* srcPORDataFrames =
|
||||
this->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
|
||||
|
||||
// Biot porelastic coeffisient (alpha)
|
||||
RigFemScalarResultFrames* biotCoefficient = nullptr;
|
||||
if ( !m_biotResultAddress.isEmpty() )
|
||||
{
|
||||
biotCoefficient =
|
||||
this->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( RIG_ELEMENT, m_biotResultAddress.toStdString(), "" ) );
|
||||
}
|
||||
|
||||
RigFemScalarResultFrames* dstDataFrames = m_femPartResults[partIndex]->createScalarResult( resVarAddr );
|
||||
const RigFemPart* femPart = m_femParts->part( partIndex );
|
||||
int frameCount = srcSDataFrames->frameCount();
|
||||
@ -2234,13 +2365,24 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateST_11_22_33( int
|
||||
const std::vector<float>& srcSFrameData = srcSDataFrames->frameData( fIdx );
|
||||
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData( fIdx );
|
||||
|
||||
int elementCount = femPart->elementCount();
|
||||
|
||||
std::vector<float> biotData;
|
||||
if ( biotCoefficient )
|
||||
{
|
||||
biotData = biotCoefficient->frameData( fIdx );
|
||||
if ( !isValidBiotData( biotData, elementCount ) )
|
||||
{
|
||||
deleteResult( resVarAddr );
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<float>& dstFrameData = dstDataFrames->frameData( fIdx );
|
||||
|
||||
size_t valCount = srcSFrameData.size();
|
||||
dstFrameData.resize( valCount );
|
||||
|
||||
int elementCount = femPart->elementCount();
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int elmIdx = 0; elmIdx < elementCount; ++elmIdx )
|
||||
{
|
||||
@ -2260,7 +2402,31 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateST_11_22_33( int
|
||||
float por = srcPORFrameData[nodeIdx];
|
||||
if ( por == inf ) por = 0.0f;
|
||||
|
||||
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx] + por;
|
||||
// ST = SE_abacus + alpha * porePressure
|
||||
// where alpha is biot coefficient, and porePressure is POR-Bar.
|
||||
|
||||
double SE_abacus = -srcSFrameData[elmNodResIdx];
|
||||
if ( fIdx == 0 )
|
||||
{
|
||||
// Geostatic step: biot coefficient == 1.0
|
||||
dstFrameData[elmNodResIdx] = SE_abacus + por;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use biot coefficient for all other (not Geostatic) timesteps
|
||||
double biotCoefficient = 1.0;
|
||||
if ( biotData.empty() )
|
||||
{
|
||||
biotCoefficient = m_biotFixedFactor;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use coefficient from element property table
|
||||
biotCoefficient = biotData[elmIdx];
|
||||
}
|
||||
|
||||
dstFrameData[elmNodResIdx] = SE_abacus + biotCoefficient * por;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3512,3 +3678,29 @@ std::vector<std::string> RigFemPartResultsCollection::getStressGradientComponent
|
||||
|
||||
return stressGradientComponentNames;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigFemPartResultsCollection::isValidBiotData( const std::vector<float>& biotData, size_t elementCount ) const
|
||||
{
|
||||
if ( biotData.size() != elementCount )
|
||||
{
|
||||
RiaLogging::error( QString( "Unexpected size of biot coefficient element properties: %1 (expected: %2)" )
|
||||
.arg( biotData.size() )
|
||||
.arg( elementCount ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
for ( float b : biotData )
|
||||
{
|
||||
if ( !std::isinf( b ) && ( b < 0.0 || b > 1.0 ) )
|
||||
{
|
||||
RiaLogging::error(
|
||||
QString( "Found unexpected biot coefficient. The value must be in the [0, 1] interval." ) );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ public:
|
||||
double parameterCohesion() const { return m_cohesion; }
|
||||
double parameterFrictionAngleRad() const { return m_frictionAngleRad; }
|
||||
|
||||
void setBiotCoefficientParameters( double fixedFactor, const QString& biotResultAddress );
|
||||
|
||||
std::map<std::string, std::vector<std::string>> scalarFieldAndComponentNames( RigFemResultPosEnum resPos );
|
||||
std::vector<std::string> filteredStepNames() const;
|
||||
bool assertResultsLoaded( const RigFemResultAddress& resVarAddr );
|
||||
@ -161,6 +163,8 @@ private:
|
||||
|
||||
const RigFormationNames* activeFormationNames() const;
|
||||
|
||||
bool isValidBiotData( const std::vector<float>& biotData, size_t elementCount ) const;
|
||||
|
||||
private:
|
||||
cvf::Collection<RigFemPartResults> m_femPartResults;
|
||||
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
||||
@ -172,6 +176,9 @@ private:
|
||||
double m_frictionAngleRad;
|
||||
double m_normalizationAirGap;
|
||||
|
||||
double m_biotFixedFactor;
|
||||
QString m_biotResultAddress;
|
||||
|
||||
RigStatisticsDataCache* statistics( const RigFemResultAddress& resVarAddr );
|
||||
std::vector<RigFemResultAddress> getResAddrToComponentsToRead( const RigFemResultAddress& resVarAddr );
|
||||
std::map<RigFemResultAddress, cvf::ref<RigStatisticsDataCache>> m_resultStatistics;
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -931,3 +931,11 @@ void RimGeoMechResultDefinition::updateLegendTextAndRanges( RimRegularLegendConf
|
||||
|
||||
legendConfigToUpdate->setTitle( legendTitle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGeoMechResultDefinition::isBiotCoefficientDependent() const
|
||||
{
|
||||
return ( this->resultFieldName() == "SE" || this->resultFieldName() == "ST" );
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user