mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Geomech frames support (#9678)
Support for showing frames in geomech data.
This commit is contained in:
@@ -57,10 +57,10 @@ bool RigFemPartResultCalculatorInitialPorosity::isMatching( const RigFemResultAd
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorInitialPorosity::calculate( int partIndex,
|
||||
const RigFemResultAddress& resVarAddr )
|
||||
{
|
||||
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 2, "" );
|
||||
frameCountProgress.setProgressDescription( "Calculating Initial Porosity" );
|
||||
caf::ProgressInfo stepCountProgress( m_resultCollection->timeStepCount() * 2, "" );
|
||||
stepCountProgress.setProgressDescription( "Calculating Initial Porosity" );
|
||||
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
stepCountProgress.setNextProgressIncrement( m_resultCollection->timeStepCount() );
|
||||
|
||||
RigFemScalarResultFrames* voidRatioFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
@@ -69,62 +69,65 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorInitialPorosity::calculate(
|
||||
RigFemScalarResultFrames* porosityFrames =
|
||||
m_resultCollection->createScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, resVarAddr.fieldName, "PHI0" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
stepCountProgress.incrementProgress();
|
||||
|
||||
const RigFemPart* femPart = m_resultCollection->parts()->part( partIndex );
|
||||
float inf = std::numeric_limits<float>::infinity();
|
||||
|
||||
frameCountProgress.setNextProgressIncrement( 1u );
|
||||
stepCountProgress.setNextProgressIncrement( 1u );
|
||||
|
||||
int frameCount = voidRatioFrames->frameCount();
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
const int timeSteps = voidRatioFrames->timeStepCount();
|
||||
for ( int stepIdx = 0; stepIdx < timeSteps; stepIdx++ )
|
||||
{
|
||||
const std::vector<float>& voidRatioData = voidRatioFrames->frameData( 0 );
|
||||
std::vector<float>& porosityFrameData = porosityFrames->frameData( fIdx );
|
||||
const int frameCount = voidRatioFrames->frameCount( stepIdx );
|
||||
for ( int fIdx = 0; fIdx < frameCount; fIdx++ )
|
||||
{
|
||||
const std::vector<float>& voidRatioData = voidRatioFrames->frameData( 0, 0 );
|
||||
std::vector<float>& porosityFrameData = porosityFrames->frameData( stepIdx, fIdx );
|
||||
|
||||
size_t valCount = voidRatioData.size();
|
||||
porosityFrameData.resize( valCount );
|
||||
size_t valCount = voidRatioData.size();
|
||||
porosityFrameData.resize( valCount );
|
||||
|
||||
int elementCount = femPart->elementCount();
|
||||
int elementCount = femPart->elementCount();
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( int elmIdx = 0; elmIdx < elementCount; ++elmIdx )
|
||||
{
|
||||
RigElementType elmType = femPart->elementType( elmIdx );
|
||||
|
||||
int elmNodeCount = RigFemTypes::elementNodeCount( femPart->elementType( elmIdx ) );
|
||||
|
||||
if ( elmType == HEX8P )
|
||||
for ( int elmIdx = 0; elmIdx < elementCount; ++elmIdx )
|
||||
{
|
||||
for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx )
|
||||
RigElementType elmType = femPart->elementType( elmIdx );
|
||||
|
||||
int elmNodeCount = RigFemTypes::elementNodeCount( femPart->elementType( elmIdx ) );
|
||||
|
||||
if ( elmType == HEX8P )
|
||||
{
|
||||
size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx );
|
||||
if ( elmNodResIdx < voidRatioData.size() )
|
||||
for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx )
|
||||
{
|
||||
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
|
||||
size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx );
|
||||
if ( elmNodResIdx < voidRatioData.size() )
|
||||
{
|
||||
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx( elmNodResIdx );
|
||||
|
||||
// Calculate initial porosity
|
||||
double voidr = voidRatioData[elmNodResIdx];
|
||||
double initialPorosity = voidr / ( 1.0 + voidr );
|
||||
// Calculate initial porosity
|
||||
double voidr = voidRatioData[elmNodResIdx];
|
||||
double initialPorosity = voidr / ( 1.0 + voidr );
|
||||
|
||||
porosityFrameData[elmNodResIdx] = initialPorosity;
|
||||
porosityFrameData[elmNodResIdx] = initialPorosity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx )
|
||||
else
|
||||
{
|
||||
size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx );
|
||||
if ( elmNodResIdx < voidRatioData.size() )
|
||||
for ( int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx )
|
||||
{
|
||||
porosityFrameData[elmNodResIdx] = inf;
|
||||
size_t elmNodResIdx = femPart->elementNodeResultIdx( elmIdx, elmNodIdx );
|
||||
if ( elmNodResIdx < voidRatioData.size() )
|
||||
{
|
||||
porosityFrameData[elmNodResIdx] = inf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
stepCountProgress.incrementProgress();
|
||||
}
|
||||
|
||||
RigFemScalarResultFrames* requestedResultFrames = m_resultCollection->findOrLoadScalarResult( partIndex, resVarAddr );
|
||||
|
||||
Reference in New Issue
Block a user