#939 Added deviatoric strain

This commit is contained in:
Jacob Støren
2016-10-31 10:34:51 +01:00
parent 91db241ee1
commit 3974067297
2 changed files with 56 additions and 4 deletions

View File

@@ -253,6 +253,7 @@ std::map<std::string, std::vector<std::string> > 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<std::string, std::vector<std::string> > 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<float>& ea11Data = ea11->frameData(fIdx);
const std::vector<float>& ea33Data = ea33->frameData(fIdx);
std::vector<float>& 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);

View File

@@ -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);