Add support for calculating LE123 and PE123

This commit is contained in:
jonjenssen 2021-10-22 12:43:53 +02:00 committed by jonjenssen
parent b760404876
commit 8c7ff445b6
3 changed files with 75 additions and 19 deletions

View File

@ -31,9 +31,17 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigFemPartResultCalculatorPrincipalStrain::RigFemPartResultCalculatorPrincipalStrain( RigFemPartResultsCollection& collection ) RigFemPartResultCalculatorPrincipalStrain::RigFemPartResultCalculatorPrincipalStrain( RigFemPartResultsCollection& collection,
const std::string fieldName,
const std::string componentPrefix )
: RigFemPartResultCalculator( collection ) : RigFemPartResultCalculator( collection )
, m_fieldName( fieldName )
, m_componentPrefix( componentPrefix )
, m_componentNames( 3 )
{ {
m_componentNames[0] = componentPrefix + "1";
m_componentNames[1] = componentPrefix + "2";
m_componentNames[2] = componentPrefix + "3";
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -48,8 +56,12 @@ RigFemPartResultCalculatorPrincipalStrain::~RigFemPartResultCalculatorPrincipalS
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RigFemPartResultCalculatorPrincipalStrain::isMatching( const RigFemResultAddress& resVarAddr ) const bool RigFemPartResultCalculatorPrincipalStrain::isMatching( const RigFemResultAddress& resVarAddr ) const
{ {
return ( ( resVarAddr.fieldName == "NE" ) && ( resVarAddr.componentName == "E1" || resVarAddr.componentName == "E2" || if ( resVarAddr.fieldName != m_fieldName ) return false;
resVarAddr.componentName == "E3" ) );
for ( const auto& component : m_componentNames )
if ( resVarAddr.componentName == component ) return true;
return false;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -58,30 +70,32 @@ bool RigFemPartResultCalculatorPrincipalStrain::isMatching( const RigFemResultAd
RigFemScalarResultFrames* RigFemPartResultCalculatorPrincipalStrain::calculate( int partIndex, RigFemScalarResultFrames* RigFemPartResultCalculatorPrincipalStrain::calculate( int partIndex,
const RigFemResultAddress& resAddr ) const RigFemResultAddress& resAddr )
{ {
CVF_ASSERT( resAddr.componentName == "E1" || resAddr.componentName == "E2" || resAddr.componentName == "E3" ); CVF_ASSERT( resAddr.componentName == m_componentNames[0] || resAddr.componentName == m_componentNames[1] ||
resAddr.componentName == m_componentNames[2] );
QString progressText = "Calculating " + QString::fromStdString( resAddr.fieldName + ": " + resAddr.componentName ); QString progressText = "Calculating " + QString::fromStdString( resAddr.fieldName + ": " + resAddr.componentName );
caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 7, progressText ); caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 7, progressText );
auto loadFrameLambda = [&]( const QString& component ) { auto loadFrameLambda = [&]( const std::string& component ) {
auto task = frameCountProgress.task( "Loading " + component, m_resultCollection->frameCount() ); auto task = frameCountProgress.task( QString::fromStdString( "Loading " + component ),
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component.toStdString() ) ); m_resultCollection->frameCount() );
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component ) );
}; };
RigFemScalarResultFrames* e11Frames = loadFrameLambda( "E11" ); RigFemScalarResultFrames* e11Frames = loadFrameLambda( m_componentPrefix + "11" );
RigFemScalarResultFrames* e22Frames = loadFrameLambda( "E22" ); RigFemScalarResultFrames* e22Frames = loadFrameLambda( m_componentPrefix + "22" );
RigFemScalarResultFrames* e33Frames = loadFrameLambda( "E33" ); RigFemScalarResultFrames* e33Frames = loadFrameLambda( m_componentPrefix + "33" );
RigFemScalarResultFrames* e12Frames = loadFrameLambda( "E12" ); RigFemScalarResultFrames* e12Frames = loadFrameLambda( m_componentPrefix + "12" );
RigFemScalarResultFrames* e13Frames = loadFrameLambda( "E13" ); RigFemScalarResultFrames* e13Frames = loadFrameLambda( m_componentPrefix + "13" );
RigFemScalarResultFrames* e23Frames = loadFrameLambda( "E23" ); RigFemScalarResultFrames* e23Frames = loadFrameLambda( m_componentPrefix + "23" );
RigFemScalarResultFrames* e1Frames = RigFemScalarResultFrames* e1Frames =
m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( "E1" ) ); m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( m_componentNames[0] ) );
RigFemScalarResultFrames* e2Frames = RigFemScalarResultFrames* e2Frames =
m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( "E2" ) ); m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( m_componentNames[1] ) );
RigFemScalarResultFrames* e3Frames = RigFemScalarResultFrames* e3Frames =
m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( "E3" ) ); m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( m_componentNames[2] ) );
int frameCount = e11Frames->frameCount(); int frameCount = e11Frames->frameCount();
for ( int fIdx = 0; fIdx < frameCount; ++fIdx ) for ( int fIdx = 0; fIdx < frameCount; ++fIdx )

View File

@ -20,6 +20,9 @@
#include "RigFemPartResultCalculator.h" #include "RigFemPartResultCalculator.h"
#include <string>
#include <vector>
class RigFemPartResultsCollection; class RigFemPartResultsCollection;
class RigFemScalarResultFrames; class RigFemScalarResultFrames;
class RigFemResultAddress; class RigFemResultAddress;
@ -30,8 +33,15 @@ class RigFemResultAddress;
class RigFemPartResultCalculatorPrincipalStrain : public RigFemPartResultCalculator class RigFemPartResultCalculatorPrincipalStrain : public RigFemPartResultCalculator
{ {
public: public:
explicit RigFemPartResultCalculatorPrincipalStrain( RigFemPartResultsCollection& collection ); explicit RigFemPartResultCalculatorPrincipalStrain( RigFemPartResultsCollection& collection,
const std::string fieldName,
const std::string componentPrefix );
~RigFemPartResultCalculatorPrincipalStrain() override; ~RigFemPartResultCalculatorPrincipalStrain() override;
bool isMatching( const RigFemResultAddress& resVarAddr ) const override; bool isMatching( const RigFemResultAddress& resVarAddr ) const override;
RigFemScalarResultFrames* calculate( int partIndex, const RigFemResultAddress& resVarAddr ) override; RigFemScalarResultFrames* calculate( int partIndex, const RigFemResultAddress& resVarAddr ) override;
private:
const std::string m_fieldName;
const std::string m_componentPrefix;
std::vector<std::string> m_componentNames;
}; };

View File

@ -178,8 +178,12 @@ RigFemPartResultsCollection::RigFemPartResultsCollection( RifGeoMechReaderInterf
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorNE( *this ) ) ); std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorNE( *this ) ) );
m_resultCalculators.push_back( m_resultCalculators.push_back(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorGamma( *this ) ) ); std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorGamma( *this ) ) );
m_resultCalculators.push_back( m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorPrincipalStrain( *this ) ) ); new RigFemPartResultCalculatorPrincipalStrain( *this, "NE", "E" ) ) );
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>(
new RigFemPartResultCalculatorPrincipalStrain( *this, "LE", "LE" ) ) );
m_resultCalculators.push_back( std::unique_ptr<RigFemPartResultCalculator>(
new RigFemPartResultCalculatorPrincipalStrain( *this, "PE", "PE" ) ) );
m_resultCalculators.push_back( m_resultCalculators.push_back(
std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorPrincipalStress( *this ) ) ); std::unique_ptr<RigFemPartResultCalculator>( new RigFemPartResultCalculatorPrincipalStress( *this ) ) );
m_resultCalculators.push_back( m_resultCalculators.push_back(
@ -677,6 +681,20 @@ std::map<std::string, std::vector<std::string>>
fieldCompNames["MUD-WEIGHT"].push_back( "MWM" ); fieldCompNames["MUD-WEIGHT"].push_back( "MWM" );
fieldCompNames["MUD-WEIGHT"].push_back( "UMWL" ); fieldCompNames["MUD-WEIGHT"].push_back( "UMWL" );
fieldCompNames["MUD-WEIGHT"].push_back( "LMWL" ); fieldCompNames["MUD-WEIGHT"].push_back( "LMWL" );
if ( fieldCompNames.count( "LE" ) > 0 )
{
fieldCompNames["LE"].push_back( "LE1" );
fieldCompNames["LE"].push_back( "LE2" );
fieldCompNames["LE"].push_back( "LE3" );
}
if ( fieldCompNames.count( "PE" ) > 0 )
{
fieldCompNames["PE"].push_back( "PE1" );
fieldCompNames["PE"].push_back( "PE2" );
fieldCompNames["PE"].push_back( "PE3" );
}
} }
else if ( resPos == RIG_INTEGRATION_POINT ) else if ( resPos == RIG_INTEGRATION_POINT )
{ {
@ -767,6 +785,20 @@ std::map<std::string, std::vector<std::string>>
fieldCompNames["MUD-WEIGHT"].push_back( "MWM" ); fieldCompNames["MUD-WEIGHT"].push_back( "MWM" );
fieldCompNames["MUD-WEIGHT"].push_back( "UMWL" ); fieldCompNames["MUD-WEIGHT"].push_back( "UMWL" );
fieldCompNames["MUD-WEIGHT"].push_back( "LMWL" ); fieldCompNames["MUD-WEIGHT"].push_back( "LMWL" );
if ( fieldCompNames.count( "LE" ) > 0 )
{
fieldCompNames["LE"].push_back( "LE1" );
fieldCompNames["LE"].push_back( "LE2" );
fieldCompNames["LE"].push_back( "LE3" );
}
if ( fieldCompNames.count( "PE" ) > 0 )
{
fieldCompNames["PE"].push_back( "PE1" );
fieldCompNames["PE"].push_back( "PE2" );
fieldCompNames["PE"].push_back( "PE3" );
}
} }
else if ( resPos == RIG_ELEMENT_NODAL_FACE ) else if ( resPos == RIG_ELEMENT_NODAL_FACE )
{ {