Choose a more precise object name: vonMises instead of StressValues

About the development of the FEM module/workbench.

Moderator: bernd

UR_
Posts: 1171
Joined: Tue Jan 03, 2017 8:42 pm

Choose a more precise object name: vonMises instead of StressValues

Postby UR_ » Thu Feb 13, 2020 10:02 am

Disturbed for a long time by diffuse object naming, like

Screenshot 002.png
Screenshot 002.png (8.09 KiB) Viewed 274 times

instead of "von Mises equivalent stress".

There are many stress definitions out there, e.g. von Mises, Tresca, Coulomb, Saint-Venant, Guest, Rankine, Burzyński-Yagn, Huber, Mao-Hong Yu, Altenbach-Bolchoun-Kolupaev

(some of them from wikipedia, and unkown for myself :roll: )

But we should try (at least) to be more precise in naming.

Branch can be found here: https://github.com/UR-0/FreeCAD/commit/ ... 66b165d015

But there is of a drawback. Oldstyle result objects have to be reloaded or recalculated.

What to you think about this?
User avatar
HarryvL
Posts: 1071
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: Choose a more precise object name: vonMises instead of StressValues

Postby HarryvL » Thu Feb 13, 2020 12:17 pm

+1
User avatar
bernd
Posts: 9265
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Choose a more precise object name: vonMises instead of StressValues

Postby bernd » Fri Feb 14, 2020 3:58 pm

git commit 8b68ab7 hopefully no regression somewhere. I had not have the time to test befor merge ... Nevermind we will fix any regression.

The result objects of the start wb examples needs to be updated ... !
User avatar
bernd
Posts: 9265
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Choose a more precise object name: vonMises instead of StressValues

Postby bernd » Fri Feb 14, 2020 4:02 pm

Ahh forgot to say it's a valuable change !
vocx
Posts: 3280
Joined: Thu Oct 18, 2018 9:18 pm

Re: Choose a more precise object name: vonMises instead of StressValues

Postby vocx » Fri Feb 14, 2020 4:10 pm

bernd wrote:
Fri Feb 14, 2020 3:58 pm
git commit 8b68ab7 hopefully no regression somewhere...
I'm not opposed to the change, but doesn't this break the Results object? You cannot just rename a property like that because you won't be able to load the "StressValues" property from older files. Is that not a problem?

To avoid breaking older files, I think we should migrate the property through some code inside onDocumentRestored. This is mentioned in this thread, Migrating and upgrading old scripted objects.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
UR_
Posts: 1171
Joined: Tue Jan 03, 2017 8:42 pm

Re: Choose a more precise object name: vonMises instead of StressValues

Postby UR_ » Fri Feb 14, 2020 8:07 pm

vocx wrote:
Fri Feb 14, 2020 4:10 pm
but doesn't this break the Results object?
Yes, old result objects get broken.

bernd wrote: :bell:

To patch old result object we need to add to femobjects\_FemResultMechanical.py line 304:

Code: Select all

    def onDocumentRestored(self, obj):
        if hasattr(obj, "StressValues") == True:
            obj.addProperty(
                "App::PropertyFloatList",
                "vonMises",
                "NodeData",
                "",
                True
            )
            obj.vonMises = obj.StressValues
            obj.removeProperty("StressValues")

Should this really be done, or is this to much effort.

IIRC, result and other objects gets broken on regular bases in past ;)
vocx
Posts: 3280
Joined: Thu Oct 18, 2018 9:18 pm

Re: Choose a more precise object name: vonMises instead of StressValues

Postby vocx » Sat Feb 15, 2020 7:03 am

UR_ wrote:
Fri Feb 14, 2020 8:07 pm
IIRC, result and other objects gets broken on regular bases in past ;)
I think in FEM it's not very critical to break the result object because if the problem is well defined, the user can just re-run the solver to obtain the results again. Still, it's just a small thing to consider.

In other workbenches it's possibly more important to maintain compatibility and be able to access and re-edit the older objects.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
UR_
Posts: 1171
Joined: Tue Jan 03, 2017 8:42 pm

Re: Choose a more precise object name: vonMises instead of StressValues

Postby UR_ » Sat Feb 15, 2020 9:15 am

vocx wrote:
Sat Feb 15, 2020 7:03 am
I think in FEM it's not very critical to break ...
:)

Nevertheless, PR: https://github.com/FreeCAD/FreeCAD/pull/3052
User avatar
bernd
Posts: 9265
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Choose a more precise object name: vonMises instead of StressValues

Postby bernd » Sat Feb 15, 2020 11:27 am

UR_ wrote:
Sat Feb 15, 2020 9:15 am
vocx wrote:
Sat Feb 15, 2020 7:03 am
I think in FEM it's not very critical to break ...
:)

Nevertheless, PR: https://github.com/FreeCAD/FreeCAD/pull/3052
git commit f192ac8 great. We should have started whith such migrate code much earlier.