diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorPorosityPermeability.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorPorosityPermeability.cpp index 7d3abde0e8..96cbd73922 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorPorosityPermeability.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultCalculatorPorosityPermeability.cpp @@ -52,7 +52,7 @@ RigFemPartResultCalculatorPorosityPermeability::~RigFemPartResultCalculatorPoros //-------------------------------------------------------------------------------------------------- bool RigFemPartResultCalculatorPorosityPermeability::isMatching( const RigFemResultAddress& resVarAddr ) const { - return ( resVarAddr.fieldName == "POROSITY-PERMEABILITY" && + return ( resVarAddr.fieldName == "PORO-PERM" && ( resVarAddr.componentName == "PHI" || resVarAddr.componentName == "DPHI" || resVarAddr.componentName == "PERM" ) ); } @@ -190,21 +190,27 @@ RigFemScalarResultFrames* double voidr = voidRatioData[elmNodResIdx]; double initialPorosity = voidr / ( 1.0 + voidr ); - // Calculate difference in pore pressure between reference state and this state, - // and convert unit from Bar to Pascal. - double referencePorePressure = referencePorFrameData[nodeIdx]; - double framePorePressure = porFrameData[nodeIdx]; - double deltaPorePressure = - RiaEclipseUnitTools::barToPascal( framePorePressure - referencePorePressure ); + // Calculate porosity change. + // No change for geostatic timestep + double deltaPorosity = 0.0; + if ( fIdx != 0 ) + { + // Calculate difference in pore pressure between reference state and this state, + // and convert unit from Bar to Pascal. + double referencePorePressure = referencePorFrameData[nodeIdx]; + double framePorePressure = porFrameData[nodeIdx]; + double deltaPorePressure = + RiaEclipseUnitTools::barToPascal( framePorePressure - referencePorePressure ); - // Pore compressibility. Convert from 1/GPa to 1/Pa. - double poreCompressibility = poreCompressibilityFrameData[elmNodResIdx] / 1.0e9; + // Pore compressibility. Convert from 1/GPa to 1/Pa. + double poreCompressibility = poreCompressibilityFrameData[elmNodResIdx] / 1.0e9; - // Volumetric strain - double deltaEv = evData[elmNodResIdx] - referenceEvData[elmNodResIdx]; + // Volumetric strain + double deltaEv = evData[elmNodResIdx] - referenceEvData[elmNodResIdx]; - // Porosity change between reference state and initial state (geostatic) - double deltaPorosity = initialPorosity * ( poreCompressibility * deltaPorePressure + deltaEv ); + // Porosity change between reference state and initial state (geostatic). + deltaPorosity = initialPorosity * ( poreCompressibility * deltaPorePressure + deltaEv ); + } // Current porosity double currentPorosity = initialPorosity + deltaPorosity; diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp index bad6468c26..bcb21778b0 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.cpp @@ -101,3 +101,11 @@ std::vector RigFemPartResults::loadedResults() const } return currentResults; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemPartResults::deleteAllScalarResults() +{ + resultSets.clear(); +} diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h index bf727cd4ba..acfb148749 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResults.h @@ -42,6 +42,7 @@ public: RigFemScalarResultFrames* createScalarResult( const RigFemResultAddress& resVarAddr ); RigFemScalarResultFrames* findScalarResult( const RigFemResultAddress& resVarAddr ); void deleteScalarResult( const RigFemResultAddress& resVarAddr ); + void deleteAllScalarResults(); std::vector loadedResults() const; private: diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index ad13e53b00..c75a68cdce 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -599,6 +599,17 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::createScalarResult( int return m_femPartResults[partIndex]->createScalarResult( resVarAddr ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFemPartResultsCollection::deleteAllScalarResults() +{ + for ( cvf::ref results : m_femPartResults ) + { + results->deleteAllScalarResults(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -693,9 +704,9 @@ std::map> fieldCompNames["COMPRESSIBILITY"].push_back( "VERTICAL" ); fieldCompNames["COMPRESSIBILITY"].push_back( "VERTICAL-RATIO" ); - fieldCompNames["POROSITY-PERMEABILITY"].push_back( "PHI" ); - fieldCompNames["POROSITY-PERMEABILITY"].push_back( "DPHI" ); - fieldCompNames["POROSITY-PERMEABILITY"].push_back( "PERM" ); + fieldCompNames["PORO-PERM"].push_back( "PHI" ); + fieldCompNames["PORO-PERM"].push_back( "DPHI" ); + fieldCompNames["PORO-PERM"].push_back( "PERM" ); } else if ( resPos == RIG_INTEGRATION_POINT ) { @@ -776,9 +787,9 @@ std::map> fieldCompNames["COMPRESSIBILITY"].push_back( "VERTICAL" ); fieldCompNames["COMPRESSIBILITY"].push_back( "VERTICAL-RATIO" ); - fieldCompNames["POROSITY-PERMEABILITY"].push_back( "PHI" ); - fieldCompNames["POROSITY-PERMEABILITY"].push_back( "DPHI" ); - fieldCompNames["POROSITY-PERMEABILITY"].push_back( "PERM" ); + fieldCompNames["PORO-PERM"].push_back( "PHI" ); + fieldCompNames["PORO-PERM"].push_back( "DPHI" ); + fieldCompNames["PORO-PERM"].push_back( "PERM" ); } else if ( resPos == RIG_ELEMENT_NODAL_FACE ) { @@ -1306,12 +1317,9 @@ std::set RigFemPartResultsCollection::referenceCaseDependen "COMPRESSIBILITY", "VERTICAL-RATIO", RigFemResultAddress::allTimeLapsesValue() ) ); - results.insert( - RigFemResultAddress( elementType, "POROSITY-PERMEABILITY", "PHI", RigFemResultAddress::allTimeLapsesValue() ) ); - results.insert( - RigFemResultAddress( elementType, "POROSITY-PERMEABILITY", "DPHI", RigFemResultAddress::allTimeLapsesValue() ) ); - results.insert( - RigFemResultAddress( elementType, "POROSITY-PERMEABILITY", "PERM", RigFemResultAddress::allTimeLapsesValue() ) ); + results.insert( RigFemResultAddress( elementType, "PORO-PERM", "PHI", RigFemResultAddress::allTimeLapsesValue() ) ); + results.insert( RigFemResultAddress( elementType, "PORO-PERM", "DPHI", RigFemResultAddress::allTimeLapsesValue() ) ); + results.insert( RigFemResultAddress( elementType, "PORO-PERM", "PERM", RigFemResultAddress::allTimeLapsesValue() ) ); } return results; @@ -1325,12 +1333,9 @@ std::set RigFemPartResultsCollection::initialPermeabilityDe std::set results; for ( auto elementType : {RIG_ELEMENT_NODAL, RIG_INTEGRATION_POINT} ) { - results.insert( - RigFemResultAddress( elementType, "POROSITY-PERMEABILITY", "PHI", RigFemResultAddress::allTimeLapsesValue() ) ); - results.insert( - RigFemResultAddress( elementType, "POROSITY-PERMEABILITY", "DPHI", RigFemResultAddress::allTimeLapsesValue() ) ); - results.insert( - RigFemResultAddress( elementType, "POROSITY-PERMEABILITY", "PERM", RigFemResultAddress::allTimeLapsesValue() ) ); + results.insert( RigFemResultAddress( elementType, "PORO-PERM", "PHI", RigFemResultAddress::allTimeLapsesValue() ) ); + results.insert( RigFemResultAddress( elementType, "PORO-PERM", "DPHI", RigFemResultAddress::allTimeLapsesValue() ) ); + results.insert( RigFemResultAddress( elementType, "PORO-PERM", "PERM", RigFemResultAddress::allTimeLapsesValue() ) ); } return results; } diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h index 9538dd28b2..0d877fefbb 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h @@ -147,6 +147,7 @@ public: RigFemScalarResultFrames* findOrLoadScalarResult( int partIndex, const RigFemResultAddress& resVarAddr ); RigFemScalarResultFrames* createScalarResult( int partIndex, const RigFemResultAddress& resVarAddr ); + void deleteAllScalarResults(); bool isValidBiotData( const std::vector& biotData, size_t elementCount ) const; static std::vector getStressComponentNames( bool includeShear = true ); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 1db67c7946..4d73afa76c 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -609,6 +609,7 @@ void RimGeoMechCase::addElementPropertyFiles( const std::vector& if ( m_geoMechCaseData.notNull() ) { geoMechData()->femPartResults()->addElementPropertyFiles( newFileNames ); + geoMechData()->femPartResults()->deleteAllScalarResults(); } } @@ -747,9 +748,9 @@ void RimGeoMechCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, updateFormationNamesData(); } + RigGeoMechCaseData* rigCaseData = geoMechData(); if ( changedField == &m_cohesion || changedField == &m_frictionAngleDeg ) { - RigGeoMechCaseData* rigCaseData = geoMechData(); if ( rigCaseData && rigCaseData->femPartResults() ) { rigCaseData->femPartResults()->setCalculationParameters( m_cohesion(), @@ -761,7 +762,6 @@ void RimGeoMechCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, else if ( changedField == &m_biotFixedCoefficient || changedField == &m_biotCoefficientType || changedField == &m_biotResultAddress ) { - RigGeoMechCaseData* rigCaseData = geoMechData(); if ( rigCaseData && rigCaseData->femPartResults() ) { if ( m_biotCoefficientType() == RimGeoMechCase::BiotCoefficientType::BIOT_NONE ) @@ -810,7 +810,6 @@ void RimGeoMechCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, else if ( changedField == &m_initialPermeabilityFixed || changedField == &m_initialPermeabilityType || changedField == &m_initialPermeabilityResultAddress || changedField == &m_permeabilityExponent ) { - RigGeoMechCaseData* rigCaseData = geoMechData(); if ( rigCaseData && rigCaseData->femPartResults() ) { if ( m_initialPermeabilityType() == RimGeoMechCase::InitialPermeabilityType::INITIAL_PERMEABILITY_FIXED ) @@ -861,19 +860,34 @@ void RimGeoMechCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { m_reloadElementPropertyFileCommand = false; reloadSelectedElementPropertyFiles(); + if ( rigCaseData && rigCaseData->femPartResults() ) + { + rigCaseData->femPartResults()->deleteAllScalarResults(); + } updateConnectedEditors(); + updateConnectedViews(); } else if ( changedField == &m_closeElementPropertyFileCommand ) { m_closeElementPropertyFileCommand = false; closeSelectedElementPropertyFiles(); + if ( rigCaseData && rigCaseData->femPartResults() ) + { + rigCaseData->femPartResults()->deleteAllScalarResults(); + } updateConnectedEditors(); + updateConnectedViews(); } else if ( changedField == &m_importElementPropertyFileCommand ) { m_importElementPropertyFileCommand = false; importElementPropertyFile(); + if ( rigCaseData && rigCaseData->femPartResults() ) + { + rigCaseData->femPartResults()->deleteAllScalarResults(); + } updateConnectedEditors(); + updateConnectedViews(); } } @@ -1002,6 +1016,7 @@ void RimGeoMechCase::closeSelectedElementPropertyFiles() if ( m_geoMechCaseData.notNull() ) { addressesToDelete = geoMechData()->femPartResults()->removeElementPropertyFiles( filesToClose ); + geoMechData()->femPartResults()->deleteAllScalarResults(); } for ( RimGeoMechView* view : geoMechViews() ) diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp index 2f26282c21..b244297e57 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechResultDefinition.cpp @@ -656,6 +656,11 @@ RigFemResultAddress RimGeoMechResultDefinition::resultAddress() const address.normalizedByHydrostaticPressure = false; } + if ( RigFemPartResultsCollection::isReferenceCaseDependentResult( address ) ) + { + address.timeLapseBaseFrameIdx = RigFemResultAddress::noTimeLapseValue(); + } + return address; } } @@ -828,7 +833,7 @@ QString RimGeoMechResultDefinition::currentResultUnits() const { return "1/GPa"; } - else if ( this->resultFieldName() == "POROSITY-PERMEABILITY" && this->resultComponentName() == "PERM" ) + else if ( this->resultFieldName() == "PORO-PERM" && this->resultComponentName() == "PERM" ) { return "mD"; }