mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Added calculation of Total Stress (ST)
Seems to work ok, but the nubers are not yet verified.
This commit is contained in:
parent
e10bc01532
commit
33614b30bc
@ -56,7 +56,9 @@ public:
|
|||||||
int elmId(size_t elementIdx) const { return m_elementId[elementIdx]; }
|
int elmId(size_t elementIdx) const { return m_elementId[elementIdx]; }
|
||||||
RigElementType elementType(size_t elementIdx) const { return m_elementTypes[elementIdx]; }
|
RigElementType elementType(size_t elementIdx) const { return m_elementTypes[elementIdx]; }
|
||||||
const int* connectivities(size_t elementIdx) const { return &m_allAlementConnectivities[m_elementConnectivityStartIndices[elementIdx]];}
|
const int* connectivities(size_t elementIdx) const { return &m_allAlementConnectivities[m_elementConnectivityStartIndices[elementIdx]];}
|
||||||
|
|
||||||
size_t elementNodeResultIdx(int elementIdx, int elmLocalNodeIdx) const { return m_elementConnectivityStartIndices[elementIdx] + elmLocalNodeIdx;}
|
size_t elementNodeResultIdx(int elementIdx, int elmLocalNodeIdx) const { return m_elementConnectivityStartIndices[elementIdx] + elmLocalNodeIdx;}
|
||||||
|
int nodeIdxFromElementNodeResultIdx(size_t elmNodeResultIdx) const { return m_allAlementConnectivities[elmNodeResultIdx]; }
|
||||||
|
|
||||||
RigFemPartNodes& nodes() {return m_nodes;}
|
RigFemPartNodes& nodes() {return m_nodes;}
|
||||||
const RigFemPartNodes& nodes() const {return m_nodes;}
|
const RigFemPartNodes& nodes() const {return m_nodes;}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "RigFemScalarResultFrames.h"
|
#include "RigFemScalarResultFrames.h"
|
||||||
#include "RigStatisticsDataCache.h"
|
#include "RigStatisticsDataCache.h"
|
||||||
#include "RigFemPartResults.h"
|
#include "RigFemPartResults.h"
|
||||||
|
#include "RigFemPartCollection.h"
|
||||||
|
|
||||||
#include "cafProgressInfo.h"
|
#include "cafProgressInfo.h"
|
||||||
#include "cvfBoundingBox.h"
|
#include "cvfBoundingBox.h"
|
||||||
@ -40,11 +41,13 @@
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigFemPartResultsCollection::RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface, int partCount)
|
RigFemPartResultsCollection::RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface, const RigFemPartCollection * femPartCollection)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(readerInterface);
|
CVF_ASSERT(readerInterface);
|
||||||
m_readerInterface = readerInterface;
|
m_readerInterface = readerInterface;
|
||||||
m_femPartResults.resize(partCount);
|
m_femParts = femPartCollection;
|
||||||
|
|
||||||
|
m_femPartResults.resize(m_femParts->partCount());
|
||||||
std::vector<std::string> stepNames = m_readerInterface->stepNames();
|
std::vector<std::string> stepNames = m_readerInterface->stepNames();
|
||||||
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
||||||
{
|
{
|
||||||
@ -62,44 +65,6 @@ RigFemPartResultsCollection::~RigFemPartResultsCollection()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
std::map<std::string, std::vector<std::string> > RigFemPartResultsCollection::scalarFieldAndComponentNames(RigFemResultPosEnum resPos)
|
|
||||||
{
|
|
||||||
std::map<std::string, std::vector<std::string> > fieldCompNames;
|
|
||||||
|
|
||||||
if (m_readerInterface.notNull())
|
|
||||||
{
|
|
||||||
if (resPos == RIG_NODAL)
|
|
||||||
{
|
|
||||||
fieldCompNames = m_readerInterface->scalarNodeFieldAndComponentNames();
|
|
||||||
}
|
|
||||||
else if (resPos == RIG_ELEMENT_NODAL)
|
|
||||||
{
|
|
||||||
fieldCompNames = m_readerInterface->scalarElementNodeFieldAndComponentNames();
|
|
||||||
fieldCompNames["NS"].push_back("S11");
|
|
||||||
fieldCompNames["NS"].push_back("S22");
|
|
||||||
fieldCompNames["NS"].push_back("S33");
|
|
||||||
fieldCompNames["NS"].push_back("S12");
|
|
||||||
fieldCompNames["NS"].push_back("S13");
|
|
||||||
fieldCompNames["NS"].push_back("S23");
|
|
||||||
}
|
|
||||||
else if (resPos == RIG_INTEGRATION_POINT)
|
|
||||||
{
|
|
||||||
fieldCompNames = m_readerInterface->scalarIntegrationPointFieldAndComponentNames();
|
|
||||||
fieldCompNames["NS"].push_back("S11");
|
|
||||||
fieldCompNames["NS"].push_back("S22");
|
|
||||||
fieldCompNames["NS"].push_back("S33");
|
|
||||||
fieldCompNames["NS"].push_back("S12");
|
|
||||||
fieldCompNames["NS"].push_back("S13");
|
|
||||||
fieldCompNames["NS"].push_back("S23");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fieldCompNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
/// Will always return a valid object, but it can be empty
|
/// Will always return a valid object, but it can be empty
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -170,6 +135,52 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(in
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::map<std::string, std::vector<std::string> > RigFemPartResultsCollection::scalarFieldAndComponentNames(RigFemResultPosEnum resPos)
|
||||||
|
{
|
||||||
|
std::map<std::string, std::vector<std::string> > fieldCompNames;
|
||||||
|
|
||||||
|
if (m_readerInterface.notNull())
|
||||||
|
{
|
||||||
|
if (resPos == RIG_NODAL)
|
||||||
|
{
|
||||||
|
fieldCompNames = m_readerInterface->scalarNodeFieldAndComponentNames();
|
||||||
|
}
|
||||||
|
else if (resPos == RIG_ELEMENT_NODAL)
|
||||||
|
{
|
||||||
|
fieldCompNames = m_readerInterface->scalarElementNodeFieldAndComponentNames();
|
||||||
|
fieldCompNames["NS"].push_back("S11");
|
||||||
|
fieldCompNames["NS"].push_back("S22");
|
||||||
|
fieldCompNames["NS"].push_back("S33");
|
||||||
|
fieldCompNames["NS"].push_back("S12");
|
||||||
|
fieldCompNames["NS"].push_back("S13");
|
||||||
|
fieldCompNames["NS"].push_back("S23");
|
||||||
|
|
||||||
|
fieldCompNames["ST"].push_back("S11");
|
||||||
|
fieldCompNames["ST"].push_back("S22");
|
||||||
|
fieldCompNames["ST"].push_back("S33");
|
||||||
|
}
|
||||||
|
else if (resPos == RIG_INTEGRATION_POINT)
|
||||||
|
{
|
||||||
|
fieldCompNames = m_readerInterface->scalarIntegrationPointFieldAndComponentNames();
|
||||||
|
fieldCompNames["NS"].push_back("S11");
|
||||||
|
fieldCompNames["NS"].push_back("S22");
|
||||||
|
fieldCompNames["NS"].push_back("S33");
|
||||||
|
fieldCompNames["NS"].push_back("S12");
|
||||||
|
fieldCompNames["NS"].push_back("S13");
|
||||||
|
fieldCompNames["NS"].push_back("S23");
|
||||||
|
|
||||||
|
fieldCompNames["ST"].push_back("S11");
|
||||||
|
fieldCompNames["ST"].push_back("S22");
|
||||||
|
fieldCompNames["ST"].push_back("S33");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fieldCompNames;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -196,6 +207,36 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(in
|
|||||||
return dstDataFrames;
|
return dstDataFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( resVarAddr.fieldName == "ST"
|
||||||
|
&& (resVarAddr.componentName == "S11"
|
||||||
|
|| resVarAddr.componentName == "S22"
|
||||||
|
|| resVarAddr.componentName == "S33" ))
|
||||||
|
{
|
||||||
|
RigFemScalarResultFrames * srcNSDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NS", resVarAddr.componentName));
|
||||||
|
RigFemScalarResultFrames * srcPORDataFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(RIG_NODAL, "POR", ""));
|
||||||
|
|
||||||
|
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
||||||
|
const RigFemPart * femPart = m_femParts->part(partIndex);
|
||||||
|
int frameCount = srcNSDataFrames->frameCount();
|
||||||
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
||||||
|
{
|
||||||
|
const std::vector<float>& srcNSFrameData = srcNSDataFrames->frameData(fIdx);
|
||||||
|
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData(fIdx);
|
||||||
|
|
||||||
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
||||||
|
|
||||||
|
size_t valCount = srcNSFrameData.size();
|
||||||
|
dstFrameData.resize(valCount);
|
||||||
|
int nodeIdx = 0;
|
||||||
|
for (size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
||||||
|
{
|
||||||
|
nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(vIdx);
|
||||||
|
dstFrameData[vIdx] = srcNSFrameData[vIdx] + srcPORFrameData[nodeIdx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dstDataFrames;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +31,12 @@ class RigFemScalarResultFrames;
|
|||||||
class RigFemPartResultsCollection;
|
class RigFemPartResultsCollection;
|
||||||
class RigFemPartResults;
|
class RigFemPartResults;
|
||||||
class RigStatisticsDataCache;
|
class RigStatisticsDataCache;
|
||||||
|
class RigFemPartCollection;
|
||||||
|
|
||||||
class RigFemPartResultsCollection: public cvf::Object
|
class RigFemPartResultsCollection: public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface, int partCount);
|
RigFemPartResultsCollection(RifGeoMechReaderInterface* readerInterface, const RigFemPartCollection * femPartCollection);
|
||||||
~RigFemPartResultsCollection();
|
~RigFemPartResultsCollection();
|
||||||
|
|
||||||
std::map<std::string, std::vector<std::string> > scalarFieldAndComponentNames(RigFemResultPosEnum resPos);
|
std::map<std::string, std::vector<std::string> > scalarFieldAndComponentNames(RigFemResultPosEnum resPos);
|
||||||
@ -63,6 +64,7 @@ private:
|
|||||||
friend class RigFemNativeStatCalc;
|
friend class RigFemNativeStatCalc;
|
||||||
cvf::Collection<RigFemPartResults> m_femPartResults;
|
cvf::Collection<RigFemPartResults> m_femPartResults;
|
||||||
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
||||||
|
cvf::cref<RigFemPartCollection> m_femParts;
|
||||||
|
|
||||||
RigStatisticsDataCache* statistics(const RigFemResultAddress& resVarAddr);
|
RigStatisticsDataCache* statistics(const RigFemResultAddress& resVarAddr);
|
||||||
std::vector< RigFemResultAddress> getResAddrToComponentsToRead(const RigFemResultAddress& resVarAddr);
|
std::vector< RigFemResultAddress> getResAddrToComponentsToRead(const RigFemResultAddress& resVarAddr);
|
||||||
|
@ -104,7 +104,7 @@ bool RigGeoMechCaseData::openAndReadFemParts(std::string* errorMessage)
|
|||||||
progress.setProgressDescription("Calculating element neighbors");
|
progress.setProgressDescription("Calculating element neighbors");
|
||||||
|
|
||||||
// Initialize results containers
|
// Initialize results containers
|
||||||
m_femPartResultsColl = new RigFemPartResultsCollection(m_readerInterface.p(), m_femParts->partCount());
|
m_femPartResultsColl = new RigFemPartResultsCollection(m_readerInterface.p(), m_femParts.p());
|
||||||
|
|
||||||
// Calculate derived Fem data
|
// Calculate derived Fem data
|
||||||
for (int pIdx = 0; pIdx < m_femParts->partCount(); ++pIdx)
|
for (int pIdx = 0; pIdx < m_femParts->partCount(); ++pIdx)
|
||||||
|
Loading…
Reference in New Issue
Block a user