Merge pull request #6223 from OPM/geomech-calculation-fixes

Geomech calculation fixes
This commit is contained in:
Kristian Bendiksen 2020-07-08 17:21:07 +02:00 committed by GitHub
commit acb177c2f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 35 deletions

View File

@ -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;

View File

@ -101,3 +101,11 @@ std::vector<RigFemResultAddress> RigFemPartResults::loadedResults() const
}
return currentResults;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemPartResults::deleteAllScalarResults()
{
resultSets.clear();
}

View File

@ -42,6 +42,7 @@ public:
RigFemScalarResultFrames* createScalarResult( const RigFemResultAddress& resVarAddr );
RigFemScalarResultFrames* findScalarResult( const RigFemResultAddress& resVarAddr );
void deleteScalarResult( const RigFemResultAddress& resVarAddr );
void deleteAllScalarResults();
std::vector<RigFemResultAddress> loadedResults() const;
private:

View File

@ -599,6 +599,17 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::createScalarResult( int
return m_femPartResults[partIndex]->createScalarResult( resVarAddr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFemPartResultsCollection::deleteAllScalarResults()
{
for ( cvf::ref<RigFemPartResults> results : m_femPartResults )
{
results->deleteAllScalarResults();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -693,9 +704,9 @@ std::map<std::string, std::vector<std::string>>
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<std::string, std::vector<std::string>>
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<RigFemResultAddress> 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<RigFemResultAddress> RigFemPartResultsCollection::initialPermeabilityDe
std::set<RigFemResultAddress> 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;
}

View File

@ -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<float>& biotData, size_t elementCount ) const;
static std::vector<std::string> getStressComponentNames( bool includeShear = true );

View File

@ -609,6 +609,7 @@ void RimGeoMechCase::addElementPropertyFiles( const std::vector<caf::FilePath>&
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() )

View File

@ -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";
}