Skip to content

Commit

Permalink
FEM: use a more precise object name "vonMises" instead "StressValues"
Browse files Browse the repository at this point in the history
  • Loading branch information
UR-0 authored and wwmayer committed Feb 14, 2020
1 parent a2a59b8 commit 8b68ab7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Fem/App/FemVTKTools.cpp
Expand Up @@ -694,7 +694,7 @@ std::map<std::string, std::string> _getFreeCADMechResultScalarProperties() {
// resFCScalProp["PrincipalMax"] = "Major Principal Stress"; // can be plotted in Paraview as THE MAJOR PRINCIPAL STRESS MAGNITUDE
// resFCScalProp["PrincipalMed"] = "Intermediate Principal Stress"; // can be plotted in Paraview as THE INTERMEDIATE PRINCIPAL STRESS MAGNITUDE
// resFCScalProp["PrincipalMin"] = "Minor Principal Stress"; // can be plotted in Paraview as THE MINOR PRINCIPAL STRESS MAGNITUDE
resFCScalProp["StressValues"] = "von Mises Stress";
resFCScalProp["vonMises"] = "von Mises Stress";
resFCScalProp["Temperature"] = "Temperature";
resFCScalProp["MohrCoulomb"] = "MohrCoulomb";
resFCScalProp["ReinforcementRatio_x"] = "ReinforcementRatio_x";
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/Gui/Resources/ui/ResultHints.ui
Expand Up @@ -90,7 +90,7 @@
<item row="3" column="0">
<widget class="QLabel" name="user_def_head_13">
<property name="text">
<string>von Mises stress: Von</string>
<string>von Mises stress: vM</string>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
Expand Down
12 changes: 6 additions & 6 deletions src/Mod/Fem/femguiobjects/_ViewProviderFemResultMechanical.py
Expand Up @@ -379,8 +379,8 @@ def z_displacement_selected(self, state):
self.none_selected(True)

def vm_stress_selected(self, state):
if len(self.result_obj.StressValues) > 0:
self.result_selected("Sabs", self.result_obj.StressValues, "MPa")
if len(self.result_obj.vonMises) > 0:
self.result_selected("Sabs", self.result_obj.vonMises, "MPa")
else:
self.result_widget.rb_none.setChecked(True)
self.none_selected(True)
Expand Down Expand Up @@ -445,7 +445,7 @@ def calculate(self):
P1 = np.array(self.result_obj.PrincipalMax)
P2 = np.array(self.result_obj.PrincipalMed)
P3 = np.array(self.result_obj.PrincipalMin)
Von = np.array(self.result_obj.StressValues)
vM = np.array(self.result_obj.vonMises)
Peeq = np.array(self.result_obj.Peeq)
T = np.array(self.result_obj.Temperature)
MF = np.array(self.result_obj.MassFlowRate)
Expand Down Expand Up @@ -526,7 +526,7 @@ def calculate(self):
self.update_colors_stats(UserDefinedFormula, "", minm, avg, maxm)

# Dummy use of the variables to get around flake8 error
del x, y, z, T, Von, Peeq, P1, P2, P3
del x, y, z, T, vM, Peeq, P1, P2, P3
del sxx, syy, szz, sxy, sxz, syz
del exx, eyy, ezz, exy, exz, eyz
del MF, NP, rx, ry, rz, mc
Expand Down Expand Up @@ -620,7 +620,7 @@ def disable_empty_result_buttons(self):
DisplacementLengths --> rb_abs_displacement
DisplacementVectors --> rb_x_displacement, rb_y_displacement, rb_z_displacement
Temperature --> rb_temperature
StressValues --> rb_vm_stress
vonMises --> rb_vm_stress
PrincipalMax --> rb_maxprin
PrincipalMin --> rb_minprin
MaxShear --> rb_max_shear_stress
Expand All @@ -635,7 +635,7 @@ def disable_empty_result_buttons(self):
self.result_widget.rb_z_displacement.setEnabled(0)
if len(self.result_obj.Temperature) == 0:
self.result_widget.rb_temperature.setEnabled(0)
if len(self.result_obj.StressValues) == 0:
if len(self.result_obj.vonMises) == 0:
self.result_widget.rb_vm_stress.setEnabled(0)
if len(self.result_obj.PrincipalMax) == 0:
self.result_widget.rb_maxprin.setEnabled(0)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/feminout/importCcxFrdResults.py
Expand Up @@ -151,7 +151,7 @@ def importFrd(

# fill DisplacementLengths
res_obj = restools.add_disp_apps(res_obj)
# fill StressValues
# fill vonMises
res_obj = restools.add_von_mises(res_obj)
if res_obj.getParentGroup():
has_reinforced_mat = False
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femobjects/_FemResultMechanical.py
Expand Up @@ -139,7 +139,7 @@ def __init__(self, obj):
)
obj.addProperty(
"App::PropertyFloatList",
"StressValues",
"vonMises",
"NodeData",
"",
True
Expand Down
14 changes: 7 additions & 7 deletions src/Mod/Fem/femresult/resulttools.py
Expand Up @@ -124,7 +124,7 @@ def show_result(resultobj, result_type="Sabs", limit=None):
return
if resultobj:
if result_type == "Sabs":
values = resultobj.StressValues
values = resultobj.vonMises
elif result_type == "Uabs":
values = resultobj.DisplacementLengths
# TODO: the result object does have more result types to show, implement them
Expand Down Expand Up @@ -282,10 +282,10 @@ def fill_femresult_stats(res_obj):
a_min = min(res_obj.DisplacementLengths)
a_avg = sum(res_obj.DisplacementLengths) / no_of_values
a_max = max(res_obj.DisplacementLengths)
if res_obj.StressValues:
s_min = min(res_obj.StressValues)
s_avg = sum(res_obj.StressValues) / no_of_values
s_max = max(res_obj.StressValues)
if res_obj.vonMises:
s_min = min(res_obj.vonMises)
s_avg = sum(res_obj.vonMises) / no_of_values
s_max = max(res_obj.vonMises)
if res_obj.PrincipalMax:
p1_min = min(res_obj.PrincipalMax)
p1_avg = sum(res_obj.PrincipalMax) / no_of_values
Expand Down Expand Up @@ -382,8 +382,8 @@ def add_von_mises(res_obj):
)
for Sxx, Syy, Szz, Sxy, Sxz, Syz in iterator:
mstress.append(calculate_von_mises((Sxx, Syy, Szz, Sxy, Sxz, Syz)))
res_obj.StressValues = mstress
FreeCAD.Console.PrintLog("Added StressValues (von Mises).\n")
res_obj.vonMises = mstress
FreeCAD.Console.PrintLog("Added von Mises stress.\n")
return res_obj


Expand Down

0 comments on commit 8b68ab7

Please sign in to comment.