From 3974067297cfe95539ef816ee5f0b490517a651c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Mon, 31 Oct 2016 10:34:51 +0100 Subject: [PATCH] #939 Added deviatoric strain --- .../RigFemPartResultsCollection.cpp | 59 +++++++++++++++++-- .../RigFemPartResultsCollection.h | 1 + 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index 30424acb75..bb7d57df1f 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -253,6 +253,7 @@ std::map > RigFemPartResultsCollection::sc fieldCompNames["Gamma"].push_back("Gamma33"); fieldCompNames["NE"].push_back("EV"); + fieldCompNames["NE"].push_back("ED"); fieldCompNames["NE"].push_back("E11"); fieldCompNames["NE"].push_back("E22"); fieldCompNames["NE"].push_back("E33"); @@ -316,6 +317,7 @@ std::map > RigFemPartResultsCollection::sc fieldCompNames["Gamma"].push_back("Gamma33"); fieldCompNames["NE"].push_back("EV"); + fieldCompNames["NE"].push_back("ED"); fieldCompNames["NE"].push_back("E11"); fieldCompNames["NE"].push_back("E22"); fieldCompNames["NE"].push_back("E33"); @@ -718,16 +720,16 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDeviatoricStress //-------------------------------------------------------------------------------------------------- RigFemScalarResultFrames* RigFemPartResultsCollection::calculateVolumetricStrain(int partIndex, const RigFemResultAddress& resVarAddr) { - RigFemScalarResultFrames * ea11 = nullptr; - RigFemScalarResultFrames * ea22 = nullptr; - RigFemScalarResultFrames * ea33 = nullptr; - CVF_ASSERT(resVarAddr.fieldName == "NE" && resVarAddr.componentName == "EV"); caf::ProgressInfo frameCountProgress(this->frameCount() * 4, ""); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); frameCountProgress.setNextProgressIncrement(this->frameCount()); + RigFemScalarResultFrames * ea11 = nullptr; + RigFemScalarResultFrames * ea22 = nullptr; + RigFemScalarResultFrames * ea33 = nullptr; + { ea11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E11")); frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); @@ -762,6 +764,50 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateVolumetricStrain return dstDataFrames; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDeviatoricStrain(int partIndex, const RigFemResultAddress& resVarAddr) +{ + CVF_ASSERT(resVarAddr.fieldName == "NE" && resVarAddr.componentName == "ED"); + + caf::ProgressInfo frameCountProgress(this->frameCount() * 3, ""); + frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); + frameCountProgress.setNextProgressIncrement(this->frameCount()); + + RigFemScalarResultFrames * ea11 = nullptr; + RigFemScalarResultFrames * ea33 = nullptr; + { + ea11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E1")); + frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); + ea33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "NE", "E3")); + } + + RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); + + frameCountProgress.incrementProgress(); + + int frameCount = ea11->frameCount(); + for ( int fIdx = 0; fIdx < frameCount; ++fIdx ) + { + const std::vector& ea11Data = ea11->frameData(fIdx); + const std::vector& ea33Data = ea33->frameData(fIdx); + + std::vector& dstFrameData = dstDataFrames->frameData(fIdx); + size_t valCount = ea11Data.size(); + dstFrameData.resize(valCount); + + for ( size_t vIdx = 0; vIdx < valCount; ++vIdx ) + { + dstFrameData[vIdx] = 0.666666666666667f*(ea11Data[vIdx] - ea33Data[vIdx]); + } + + frameCountProgress.incrementProgress(); + } + + return dstDataFrames; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1111,6 +1157,11 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(in return calculateVolumetricStrain(partIndex, resVarAddr); } + if ( resVarAddr.fieldName == "NE" && resVarAddr.componentName == "ED" ) + { + return calculateDeviatoricStrain(partIndex, resVarAddr); + } + if(resVarAddr.fieldName == "ST" && resVarAddr.componentName == "Q" ) { return calculateDeviatoricStress(partIndex, resVarAddr); diff --git a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h index 4ca0145ad7..0ddfb23fe6 100644 --- a/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h +++ b/ApplicationCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.h @@ -92,6 +92,7 @@ private: RigFemScalarResultFrames* calculateMeanStressSTM(int partIndex, const RigFemResultAddress& resVarAddr); RigFemScalarResultFrames* calculateDeviatoricStress(int partIndex, const RigFemResultAddress& resVarAddr); RigFemScalarResultFrames* calculateVolumetricStrain(int partIndex, const RigFemResultAddress& resVarAddr); + RigFemScalarResultFrames* calculateDeviatoricStrain(int partIndex, const RigFemResultAddress& resVarAddr); RigFemScalarResultFrames* calculateSurfaceAlignedStress(int partIndex, const RigFemResultAddress& resVarAddr); RigFemScalarResultFrames* calculatePrincipalStressValues(int partIndex, const RigFemResultAddress &resVarAddr); RigFemScalarResultFrames* calculatePrincipalStrainValues(int partIndex, const RigFemResultAddress &resVarAddr);