From 64e945db75602f9c035399db4daaa738b6667d64 Mon Sep 17 00:00:00 2001 From: mkhizenz Date: Tue, 20 Dec 2016 18:10:46 +0100 Subject: [PATCH] FEM: linearizedStress: Implementation --- src/Mod/Fem/Gui/Command.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Mod/Fem/Gui/Command.cpp b/src/Mod/Fem/Gui/Command.cpp index fb3724e30..3316ea0b8 100644 --- a/src/Mod/Fem/Gui/Command.cpp +++ b/src/Mod/Fem/Gui/Command.cpp @@ -1126,6 +1126,7 @@ mb = []\n\ for i in range(len(sValues)):\n\ peak.append(sValues[i])\n\ mb.append(bending[i] + membrane[0])\n\ +print str(round(membrane[0],2))\n\ import FreeCAD\n\ import numpy as np\n\ from matplotlib import pyplot as plt\n\ @@ -1133,11 +1134,21 @@ plt.figure(1)\n\ plt.plot(t_coords, membrane, \"k--\")\n\ plt.plot(t_coords, mb, \"b*-\")\n\ plt.plot(t_coords, peak, \"r-x\")\n\ -plt.annotate(str(membrane[0]), xy=(t_coords[0], membrane[0]), xytext=(t_coords[0], membrane[0]))\n\ -plt.annotate(str(mb[0]), xy=(t_coords[0], mb[0]), xytext=(t_coords[0], mb[0]))\n\ -plt.annotate(str(peak[0]), xy=(t_coords[0], peak[0]), xytext=(t_coords[0], peak[0]))\n\ -plt.annotate(str(mb[len(t_coords)-1]), xy=(t_coords[len(t_coords)-1], mb[len(t_coords)-1]), xytext=(t_coords[len(t_coords)-1], mb[len(t_coords)-1]))\n\ -plt.annotate(str(peak[len(t_coords)-1]), xy=(t_coords[len(t_coords)-1], peak[len(t_coords)-1]), xytext=(t_coords[len(t_coords)-1], peak[len(t_coords)-1]))\n\ +plt.annotate(str(round(membrane[0],2)), xy=(t_coords[0], membrane[0]), xytext=(t_coords[0], membrane[0]))\n\ +plt.annotate(str(round(mb[0],2)), xy=(t_coords[0], mb[0]), xytext=(t_coords[0], mb[0]))\n\ +plt.annotate(str(round(mb[len(t_coords)-1],2)), xy=(t_coords[len(t_coords)-1], mb[len(t_coords)-1]), xytext=(t_coords[len(t_coords)-1], mb[len(t_coords)-1]))\n\ +plt.annotate(str(round(peak[0],2)), xy=(t_coords[0], peak[0]), xytext=(t_coords[0], peak[0]))\n\ +plt.annotate(str(round(peak[len(t_coords)-1],2)), xy=(t_coords[len(t_coords)-1], peak[len(t_coords)-1]), xytext=(t_coords[len(t_coords)-1], peak[len(t_coords)-1]))\n\ +FreeCAD.Console.PrintError('membrane stress = ')\n\ +FreeCAD.Console.PrintError([str(round(membrane[0],2))])\n\ +FreeCAD.Console.PrintError('membrane + bending min = ')\n\ +FreeCAD.Console.PrintError([str(round(mb[0],2))])\n\ +FreeCAD.Console.PrintError('membrane + bending max = ')\n\ +FreeCAD.Console.PrintError([str(round(mb[len(t_coords)-1],2))])\n\ +FreeCAD.Console.PrintError('Total stress min = ')\n\ +FreeCAD.Console.PrintError([str(round(peak[0],2))])\n\ +FreeCAD.Console.PrintError('Total stress max = ')\n\ +FreeCAD.Console.PrintError([str(round(peak[len(t_coords)-1],2))])\n\ plt.legend([\"Membrane\", \"Membrane and Bending\", \"Total\"], loc = \"best\")\n\ plt.xlabel(\"Thickness [mm] \")\n\ plt.ylabel(\"Stress [MPa]\")\n\