Mohr circle: Use same function to calculate FOS (=1/dsm) in results collection and mohrs plot

This commit is contained in:
Rebecca Cox
2018-03-06 10:29:04 +01:00
parent d92918d11e
commit c77c08222d
3 changed files with 26 additions and 15 deletions

View File

@@ -776,14 +776,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDSM(int partInde
for ( size_t vIdx = 0; vIdx < valCount; ++vIdx )
{
float se1 = se1Data[vIdx];
float se3 = se3Data[vIdx];
float pi_4 = 0.785398163397448309616f;
float rho = 2.0f * ( atan( sqrt(( se1 + cohPrTanFricAngle)/(se3 + cohPrTanFricAngle)) ) - pi_4);
{
dstFrameData[vIdx] = tan(rho)/tanFricAng;
}
dstFrameData[vIdx] = dsm(se1Data[vIdx], se3Data[vIdx], tanFricAng, cohPrTanFricAngle);
}
frameCountProgress.incrementProgress();
@@ -2049,6 +2042,24 @@ int RigFemPartResultsCollection::frameCount()
return static_cast<int>(stepNames().size());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
float RigFemPartResultsCollection::dsm(float p1, float p3, float tanFricAng, float cohPrTanFricAngle)
{
if (p1 == HUGE_VAL || p3 == HUGE_VAL)
{
return std::nan("");
}
CVF_ASSERT(p1 > p3);
float pi_4 = 0.785398163397448309616f;
float rho = 2.0f * (atan(sqrt((p1 + cohPrTanFricAngle) / (p3 + cohPrTanFricAngle))) - pi_4);
return tan(rho) / tanFricAng;
}
//--------------------------------------------------------------------------------------------------
/// Returns whether any of the parts actually had any of the requested results
//--------------------------------------------------------------------------------------------------

View File

@@ -73,6 +73,7 @@ public:
int partCount() const;
int frameCount();
static float dsm(float p1, float p3, float tanFricAng, float cohPrTanFricAngle);
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax);
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax);

View File

@@ -531,21 +531,20 @@ bool RiuMohrsCirclePlot::isValidPrincipals(const cvf::Vec3f& principals)
//--------------------------------------------------------------------------------------------------
float RiuMohrsCirclePlot::calculateFOS(const cvf::Vec3f& principals, double frictionAngle, double cohesion)
{
float se1 = principals[0];
float se3 = principals[2];
if (cvf::Math::cos(frictionAngle) == 0)
{
return 0.0f;
return std::nan("");
}
float se1 = principals[0];
float se3 = principals[2];
float tanFricAng = cvf::Math::tan(cvf::Math::toRadians(frictionAngle));
float cohPrTanFricAngle = 1.0f * cohesion / tanFricAng;
float pi_4 = 0.785398163397448309616f;
float rho = 2.0f * (cvf::Math::atan(cvf::Math::sqrt((se1 + cohPrTanFricAngle) / (se3 + cohPrTanFricAngle))) - pi_4);
float dsm = RigFemPartResultsCollection::dsm(se1, se3, tanFricAng, cohPrTanFricAngle);
return tanFricAng / cvf::Math::tan(rho);
return 1.0f / dsm;
}
//--------------------------------------------------------------------------------------------------