#5910 Add calculator for stress anisotropy.

This commit is contained in:
Kristian Bendiksen 2020-05-12 11:51:55 +02:00
parent 73ac3e5db1
commit f628730618
5 changed files with 221 additions and 2 deletions

View File

@ -92,6 +92,8 @@ add_library( ${PROJECT_NAME}
RigFemPartResultCalculatorEnIpPorBar.cpp
RigFemPartResultCalculatorNodalGradients.h
RigFemPartResultCalculatorNodalGradients.cpp
RigFemPartResultCalculatorStressAnisotropy.h
RigFemPartResultCalculatorStressAnisotropy.cpp
RimGeoMechGeometrySelectionItem.h
RimGeoMechGeometrySelectionItem.cpp
)

View File

@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigFemPartResultCalculatorStressAnisotropy.h"
#include "RigFemPart.h"
#include "RigFemPartCollection.h"
#include "RigFemPartResultsCollection.h"
#include "RigFemResultAddress.h"
#include "RigFemScalarResultFrames.h"
#include "cafProgressInfo.h"
#include <QString>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemPartResultCalculatorStressAnisotropy::RigFemPartResultCalculatorStressAnisotropy( RigFemPartResultsCollection& collection )
: RigFemPartResultCalculator( collection )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemPartResultCalculatorStressAnisotropy::~RigFemPartResultCalculatorStressAnisotropy()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigFemPartResultCalculatorStressAnisotropy::isMatching( const RigFemResultAddress& resVarAddr ) const
{
return (
( ( resVarAddr.fieldName == "ST" ) && ( resVarAddr.componentName == "STA12" || resVarAddr.componentName == "STA13" ||
resVarAddr.componentName == "STA23" ) ) ||
( ( resVarAddr.fieldName == "SE" ) && ( resVarAddr.componentName == "SEA12" || resVarAddr.componentName == "SEA13" ||
resVarAddr.componentName == "SEA23" ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemScalarResultFrames* RigFemPartResultCalculatorStressAnisotropy::calculate( int partIndex,
const RigFemResultAddress& resVarAddr )
{
CVF_ASSERT( isMatching( resVarAddr ) );
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 4, "" );
frameCountProgress.setProgressDescription(
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
RigFemScalarResultFrames* s1Frames =
m_resultCollection->findOrLoadScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType,
resVarAddr.fieldName,
"S1" ) );
frameCountProgress.incrementProgress();
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
RigFemScalarResultFrames* s2Frames =
m_resultCollection->findOrLoadScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType,
resVarAddr.fieldName,
"S2" ) );
frameCountProgress.incrementProgress();
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
RigFemScalarResultFrames* s3Frames =
m_resultCollection->findOrLoadScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType,
resVarAddr.fieldName,
"S3" ) );
RigFemScalarResultFrames* s12Frames =
m_resultCollection->createScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType,
resVarAddr.fieldName,
resVarAddr.fieldName + "A12" ) );
RigFemScalarResultFrames* s13Frames =
m_resultCollection->createScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType,
resVarAddr.fieldName,
resVarAddr.fieldName + "A13" ) );
RigFemScalarResultFrames* s23Frames =
m_resultCollection->createScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType,
resVarAddr.fieldName,
resVarAddr.fieldName + "A23" ) );
frameCountProgress.incrementProgress();
frameCountProgress.setNextProgressIncrement( 1u );
int frameCount = s1Frames->frameCount();
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
{
const std::vector<float>& s1 = s1Frames->frameData( fIdx );
const std::vector<float>& s2 = s2Frames->frameData( fIdx );
const std::vector<float>& s3 = s3Frames->frameData( fIdx );
std::vector<float>& s12 = s12Frames->frameData( fIdx );
std::vector<float>& s13 = s13Frames->frameData( fIdx );
std::vector<float>& s23 = s23Frames->frameData( fIdx );
size_t valCount = s1.size();
s12.resize( valCount );
s13.resize( valCount );
s23.resize( valCount );
#pragma omp parallel for schedule( dynamic )
for ( long vIdx = 0; vIdx < static_cast<long>( valCount ); ++vIdx )
{
s12[vIdx] = 2.0 * ( s1[vIdx] - s2[vIdx] ) / ( s1[vIdx] + s2[vIdx] );
s13[vIdx] = 2.0 * ( s1[vIdx] - s3[vIdx] ) / ( s1[vIdx] + s3[vIdx] );
s23[vIdx] = 2.0 * ( s2[vIdx] - s3[vIdx] ) / ( s2[vIdx] + s3[vIdx] );
}
frameCountProgress.incrementProgress();
}
RigFemScalarResultFrames* requestedStress = m_resultCollection->findOrLoadScalarResult( partIndex, resVarAddr );
return requestedStress;
}

View File

@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RigFemPartResultCalculator.h"
class RigFemPartResultsCollection;
class RigFemScalarResultFrames;
class RigFemResultAddress;
//==================================================================================================
///
//==================================================================================================
class RigFemPartResultCalculatorStressAnisotropy : public RigFemPartResultCalculator
{
public:
explicit RigFemPartResultCalculatorStressAnisotropy( RigFemPartResultsCollection& collection );
virtual ~RigFemPartResultCalculatorStressAnisotropy();
bool isMatching( const RigFemResultAddress& resVarAddr ) const override;
RigFemScalarResultFrames* calculate( int partIndex, const RigFemResultAddress& resVarAddr ) override;
};

View File

@ -52,6 +52,7 @@
#include "RigFemPartResultCalculatorSTM.h"
#include "RigFemPartResultCalculatorShearSE.h"
#include "RigFemPartResultCalculatorShearST.h"
#include "RigFemPartResultCalculatorStressAnisotropy.h"
#include "RigFemPartResultCalculatorStressGradients.h"
#include "RigFemPartResultCalculatorSurfaceAlignedStress.h"
#include "RigFemPartResultCalculatorSurfaceAngles.h"
@ -161,6 +162,8 @@ RigFemPartResultsCollection::RigFemPartResultsCollection( RifGeoMechReaderInterf
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorPrincipalStrain( *this ) ) );
m_resultCalculators.push_back(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorPrincipalStress( *this ) ) );
m_resultCalculators.push_back(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorStressAnisotropy( *this ) ) );
m_resultCalculators.push_back(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorFormationIndices( *this ) ) );
}
@ -339,6 +342,13 @@ void RigFemPartResultsCollection::setBiotCoefficientParameters( double biotFixed
deleteResult(
RigFemResultAddress( elementType, fieldName, componentName, RigFemResultAddress::allTimeLapsesValue() ) );
}
const std::vector<std::string> stressAnisotropyComponentNames = getStressAnisotropyComponentNames();
for ( auto componentName : stressAnisotropyComponentNames )
{
deleteResult(
RigFemResultAddress( elementType, fieldName, componentName, RigFemResultAddress::allTimeLapsesValue() ) );
}
}
// SE only: depends on SE.S1 and SE.S3
@ -514,8 +524,9 @@ std::map<std::string, std::vector<std::string>>
if ( activeFormationNames() ) fieldCompNames["Active Formation Names"];
}
const std::vector<std::string> stressComponentNames = getStressComponentNames();
const std::vector<std::string> stressGradientComponentNames = getStressGradientComponentNames();
const std::vector<std::string> stressComponentNames = getStressComponentNames();
const std::vector<std::string> stressGradientComponentNames = getStressGradientComponentNames();
const std::vector<std::string> stressAnisotropyComponentNames = getStressAnisotropyComponentNames();
if ( m_readerInterface.notNull() )
{
@ -539,6 +550,11 @@ std::map<std::string, std::vector<std::string>>
fieldCompNames["SE"].push_back( s );
}
for ( auto& s : stressAnisotropyComponentNames )
{
fieldCompNames["SE"].push_back( "SE" + s );
}
fieldCompNames["SE"].push_back( "S1inc" );
fieldCompNames["SE"].push_back( "S1azi" );
fieldCompNames["SE"].push_back( "S2inc" );
@ -554,6 +570,11 @@ std::map<std::string, std::vector<std::string>>
fieldCompNames["ST"].push_back( s );
}
for ( auto& s : stressAnisotropyComponentNames )
{
fieldCompNames["ST"].push_back( "ST" + s );
}
fieldCompNames["ST"].push_back( "S1inc" );
fieldCompNames["ST"].push_back( "S1azi" );
fieldCompNames["ST"].push_back( "S2inc" );
@ -599,6 +620,11 @@ std::map<std::string, std::vector<std::string>>
fieldCompNames["SE"].push_back( "S2" );
fieldCompNames["SE"].push_back( "S3" );
for ( auto& s : stressAnisotropyComponentNames )
{
fieldCompNames["SE"].push_back( "SE" + s );
}
fieldCompNames["SE"].push_back( "S1inc" );
fieldCompNames["SE"].push_back( "S1azi" );
fieldCompNames["SE"].push_back( "S2inc" );
@ -619,6 +645,11 @@ std::map<std::string, std::vector<std::string>>
fieldCompNames["ST"].push_back( "S2" );
fieldCompNames["ST"].push_back( "S3" );
for ( auto& s : stressAnisotropyComponentNames )
{
fieldCompNames["ST"].push_back( "ST" + s );
}
fieldCompNames["ST"].push_back( "S1inc" );
fieldCompNames["ST"].push_back( "S1azi" );
fieldCompNames["ST"].push_back( "S2inc" );
@ -1355,6 +1386,14 @@ std::vector<std::string> RigFemPartResultsCollection::getStressComponentNames( b
return componentNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::string> RigFemPartResultsCollection::getStressAnisotropyComponentNames()
{
return {"A12", "A13", "A23"};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -134,6 +134,7 @@ public:
bool isValidBiotData( const std::vector<float>& biotData, size_t elementCount ) const;
static std::vector<std::string> getStressComponentNames( bool includeShear = true );
static std::vector<std::string> getStressGradientComponentNames( bool includeShear = true );
static std::vector<std::string> getStressAnisotropyComponentNames();
const RigFormationNames* activeFormationNames() const;
private: