[fixed] [bug 6972] division by zero when creating stress linearization plot

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

[fixed] [bug 6972] division by zero when creating stress linearization plot

Post by uwestoehr »

When trying to create a stress linearization plot
https://wiki.freecadweb.org/FEM_PostFil ... edStresses

I get a division by zero error.

Here is an example file: https://github.com/FreeCAD/FreeCAD/file ... y-zero.zip

- select the line filter object and create a linearization plot to get the error

The error occurs here: https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L1225
So the last coordinate that is read here: https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L1218
has the value zero.

The strange thing is that one can change the line filter points and one like but the bug does not go away. So the bug is somewhat deeper that the coordinate is not updated on updating the line filter.

And indeed, when you delete the line filter and recreate it using exactly the same point settings, the issue does no longer occur.
user1234
Veteran
Posts: 3319
Joined: Mon Jul 11, 2016 5:08 pm

Re: [bug 6972] division by zero when creating stress linearization plot

Post by user1234 »

This is the first time, i use filters, so please be patient if i writ something wrong.

First of all, i do not really understand, for what this all is or how to use it correctly, especially some of the filters like the line clip filter (which points,, are they x, y, z and mm? which select points?, what is resolution in that case?, .....)


I used it an an bar, similar to yours but with an straight tensions, no bending, then the there is no dived to zero error (van Mises). But other errors. For example the plot is in MPa, which does not match with the new SI units now (1e7 vs. 10MPa). Also some things are not readable on the plot. If the mm is OK, i can not say, since i do not know, if i set the points correctly (that the max. the tensions is 10MPa, even the position is not clear is, because the tensions is very homogeneous).

1.png
1.png (35.31 KiB) Viewed 1203 times

test.FCStd
(231.36 KiB) Downloaded 18 times


Greetings
user1234
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [bug 6972] division by zero when creating stress linearization plot

Post by uwestoehr »

user1234 wrote: Mon Jun 06, 2022 10:32 pm First of all, i do not really understand, for what this all is
Me neither ;) I just filled the last empty FEM Wiki pages and this way found the issues.
MPa is hereby correct since the CCX panel uses the set unit system. However, I don't understand what is plot is about so cannot tell.
user1234
Veteran
Posts: 3319
Joined: Mon Jul 11, 2016 5:08 pm

Re: [bug 6972] division by zero when creating stress linearization plot

Post by user1234 »

uwestoehr wrote: Mon Jun 06, 2022 10:36 pm I don't understand what is plot so cannot tell.
I am pretty sure, that is a only method to plot a stair curve without stairs. wrong

A divide to zero can then happen when the array is (half) shifted (must be, when this plotting method is the case, fell in that trap myself once a time). in that case also wrong

Greetings
user1234

edit: strokes
user1234
Veteran
Posts: 3319
Joined: Mon Jul 11, 2016 5:08 pm

Re: [bug 6972] division by zero when creating stress linearization plot

Post by user1234 »

That is stress linearization: https://www.graspengineering.com/what-i ... arization/.

Since i never have something to do with ASME and not that often with piping systems (and when is calculated in an other way), i never head about that.


Greetings
user1234
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [bug 6972] division by zero when creating stress linearization plot

Post by uwestoehr »

user1234 wrote: Tue Jun 07, 2022 2:04 pm That is stress linearization: https://www.graspengineering.com/what-i ... arization/.
Thanks! Great site. I linked it now in the Wiki: https://wiki.freecadweb.org/FEM_PostFil ... edStresses
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [bug 6972] division by zero when creating stress linearization plot

Post by wmayer »

With your attached example there was an error that an object DataAlongLine doesn't exist. And there is indeed no object of this name but DataAlongLine001. It's only the label that has set this value.


With git commit 7400b118700 I can run the function now but I don't get a division-by-zero error.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [bug 6972] division by zero when creating stress linearization plot

Post by uwestoehr »

wmayer wrote: Mon Jun 13, 2022 3:12 pm With git commit 7400b118700 I can run the function now but I don't get a division-by-zero error.
Thanks for this commit!
I could reproduce this issue here on another PC. Strange what happened to the file.

Concerning the division by zero I will retest with current master later on the machine where i encountered the bug.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [bug 6972] division by zero when creating stress linearization plot

Post by uwestoehr »

uwestoehr wrote: Mon Jun 13, 2022 3:37 pm Concerning the division by zero I will retest with current master later on the machine where i encountered the bug.
I had a look. The bug occurred because the axis data were completely zero. This happened because in some cases the axis data was never filled. I fixed this last weekend perhaps with https://github.com/FreeCAD/FreeCAD/comm ... e3070336e5
However now the axis data won't be zero.
Post Reply