diff --git a/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp b/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp index f52917b6d1..b74bf6d3e6 100644 --- a/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp +++ b/ApplicationCode/UserInterface/RiuMohrsCirclePlot.cpp @@ -291,7 +291,7 @@ void RiuMohrsCirclePlot::addInfoLabel() textBuilder.append(QString("Friction Angle: %1
").arg(m_frictionAngle)); textBuilder.append(QString("Cohesion: %1

").arg(m_cohesion)); - textBuilder.append(QString("Factor of Safety: %1
").arg("Coming soon")); + textBuilder.append(QString("Factor of Safety: %1
").arg(m_factorOfSafety)); textBuilder.append(QString("σ1: %1
").arg(m_principal1)); textBuilder.append(QString("σ2: %1
").arg(m_principal2)); textBuilder.append(QString("σ3: %1
").arg(m_principal3)); @@ -361,6 +361,8 @@ void RiuMohrsCirclePlot::queryDataAndUpdatePlot(RimGeoMechView* geoMechView, siz cvf::Vec3f principalDirs[3]; cvf::Vec3f elmPrincipals = elmTensor.calculatePrincipals(principalDirs); + setFactorOfSafety(calculateFOS(elmTensor)); + setPrincipalsAndRedrawPlot(elmPrincipals[0], elmPrincipals[1], elmPrincipals[2]); } @@ -529,3 +531,23 @@ bool RiuMohrsCirclePlot::isValidPrincipals(double p1, double p2, double p3) return true; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +float RiuMohrsCirclePlot::calculateFOS(const caf::Ten3f& tensor) +{ + cvf::Vec3f dirs[3]; + cvf::Vec3f principals = tensor.calculatePrincipals(dirs); + + float se1 = principals[0]; + float se3 = principals[2]; + + float tanFricAng = tan(cvf::Math::toRadians(m_frictionAngle)); + float cohPrTanFricAngle = (float)(m_cohesion / tanFricAng); + + float pi_4 = 0.785398163397448309616f; + float rho = 2.0f * (atan(sqrt((se1 + cohPrTanFricAngle) / (se3 + cohPrTanFricAngle))) - pi_4); + + return tanFricAng / tan(rho); +} diff --git a/ApplicationCode/UserInterface/RiuMohrsCirclePlot.h b/ApplicationCode/UserInterface/RiuMohrsCirclePlot.h index 181262d8be..10c6c758a8 100644 --- a/ApplicationCode/UserInterface/RiuMohrsCirclePlot.h +++ b/ApplicationCode/UserInterface/RiuMohrsCirclePlot.h @@ -21,6 +21,8 @@ #include "qwt_plot.h" #include "qwt_plot_item.h" +#include "cafTensor3.h" + #include class QWidget; @@ -87,6 +89,8 @@ private: void replotAndScaleAxis(); static bool isValidPrincipals(double p1, double p2, double p3); + + float calculateFOS(const caf::Ten3f& tensor); private: double m_principal1;