The Wayback Machine - https://web.archive.org/web/20240601001400/https://github.com/FreeCAD/FreeCAD/pull/12833
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEA: fix 1d beam cross section orientation #12833

Merged
merged 5 commits into from
Mar 18, 2024

Conversation

lyphrowny
Copy link
Contributor

closes #12818

Changes not only the rotation of the cross section, but the order of the 1,2-dimensions for the RECT beam section - now matches with CalculiX docs. This might be a breaking change for some 3rd Parties (if any), but it doesn't break anything in FreeCAD

Tested on Windows

  • Example CCX cantilever beam rectangle gives the same result in both the previous and the proposed version
  • Checked all directions
    all_directions
  • Checked ElementRotation1D with different angles
    rotated_30deg_cube

.FCStd files are in the forum thread: https://forum.freecad.org/viewtopic.php?t=85951

@github-actions github-actions bot added the WB FEM Related to the FEM Workbench label Mar 10, 2024
@FEA-eng
Copy link
Contributor

FEA-eng commented Mar 10, 2024

When I run this modified version of FreeCAD and try to submit the analysis in your test file (011_beam.FCStd), I get the following error:

CalculiX finished with error 201
*ERROR in cascade: zero coefficient on the dependent side of an equation
dependent node: 24 direction: 1

Same with a simple test file with an inclined rectangular beam. The ones aligned with global axes are working.

@lyphrowny
Copy link
Contributor Author

lyphrowny commented Mar 11, 2024

Thank you for noticing!

TL;DR

The real issue is with CalculiX, see Dhondtguido/CalculiX/issues/40. It might be better to change the directions of the cross section the way they were, though it's not a panacea

Long version

Firsty, I reproduced your results on a 011 beam. Then I decided to run a simulation on a all_dirs.FCStd (a bunch of beams, looking at different directions) and strangely there were no errors.

After that I wrote an example, that generates standalone beams in all directions
The previous implementation [1] failed in 2 directions. Then I tested the current implementation [2] - 5+ fails, and current implementation with FreeCAD-way directions of a cross section [3] - 0 fails. After that I started rotating the beams with the BeamElementRotation1D and FreeCAD directions started failing too.

The CalculiX issue is not fixed in the version, which one can find on the official site. It is fixed in the original github repo (but I had to revert this commit Dhondtguido/CalculiX@004538d in order to compile)

As I see it, the best action is to update CalculiX, that's bundled with FreeCAD, the easiest - to have the directions of a cross section the FreeCAD way: unless a rotation is applied, it doesn't fail in any direction (the most common cases)


To run the example: FEM -> Utilities -> Open FEM examples -> "run me" example. It will generate 26 files, then will run all of them. Failed directions (if any) will be printed after all the files are ran

[1] - code can be found here https://github.com/lyphrowny/FreeCAD/tree/all_dirs_examples_generation
[2] - -//- https://github.com/lyphrowny/FreeCAD/tree/check_new_implementation_all_dirs
[3] - -//- https://github.com/lyphrowny/FreeCAD/tree/check_new_implementation_all_dirs_freecad

@FEA-eng
Copy link
Contributor

FEA-eng commented Mar 11, 2024

Since it's a bug in the current (2.21) release of CalculiX and the next one likely won't happen anytime soon, perhaps it's better to leave it the FreeCAD way as you say. Using non-stable CalculiX build would be risky. But maybe we could implement a fix for another related limitation and make it possible to use multiple FEM ElementRotation1D objects assigned to different beams. Currently, all beams use the same rotation. What do you think?

@lyphrowny
Copy link
Contributor Author

Yeah, let's leave the directions the FreeCAD way (though I still stand my ground on updating the version of the bundled CalculiX (it's still 2.17 in FreeCAD 0.21.2 on Windows))

We could make it possible to have multiple ElementRotation1D, but it wouldn't solve the issue of
*ERROR in cascade: zero coefficient on the dependent side of an equation dependent node, but might patch it, i.e. when facing the issue, rotate the beam a bit, repeat until solved

For 1,1,0 beam, which cross section I wanted to be rotated 90 degrees, I managed to rotate it by 73 and 107 degrees, all degrees between 73 and 107 gave me the error in cascade. Is a 17-degrees-off rotation acceptible? :)

@FEA-eng
Copy link
Contributor

FEA-eng commented Mar 11, 2024

The CalculiX binary provided with FreeCAD definitely needs to be updated (it seems to be 2.21 in weekly builds already though). It should always be the newest ccx version available when preparing the FreeCAD release (related: #10865) . I’m just unsure about including our own build of ccx created long before the next official release (in which this bug will be fixed) since CalculiX development is in progress and there might be some issues because of that.

Multiple beam rotations are needed mostly for other reasons (more flexibility) but I assumed that they can also help with this issue at least to some extent.

@lyphrowny
Copy link
Contributor Author

I've reverted the change to the directions and tested it locally via ./bin/FreeCADCmd --run-test "TestFemApp" with no errors
@FEA-eng could you please review?

@FEA-eng
Copy link
Contributor

FEA-eng commented Mar 11, 2024

I've reverted the change to the directions and tested it locally via ./bin/FreeCADCmd --run-test "TestFemApp" with no errors @FEA-eng could you please review?

I recompiled it. Looks good. It seems to be the best solution for now. But let's keep the issue open or create a new one since there's still some area for improvement once the next version of CalculiX is released.

@lyphrowny
Copy link
Contributor Author

Thank you for the review!
I believe, it should be another issue. #12818 is about wrong cross section orientation and is solved by this PR

Previous commit changes the 1-direction to -y axis, however originally it was directed at +y axis. This commit makes the 1-direction face +y axis
@lyphrowny
Copy link
Contributor Author

@FEA-eng please, take a look. I changed the normal for 1-direction from -y to +y as it was in the previous version (only for consistency as -y worked too)

Not all FEM tests were ran via TestFemApp unitcase, so it wasn't obvious to me why I was getting errors on builds here, but not on my machine. Is expected behaviour of TestFemApp?

@FEA-eng
Copy link
Contributor

FEA-eng commented Mar 13, 2024

@FEA-eng please, take a look. I changed the normal for 1-direction from -y to +y as it was in the previous version (only for consistency as -y worked too)

It's ok for me, works well enough. We have to live with that CalculiX bug for now but at least we know that it should be fixed in the next release.

Not all FEM tests were ran via TestFemApp unitcase, so it wasn't obvious to me why I was getting errors on builds here, but not on my machine. Is expected behaviour of TestFemApp?

No idea TBH. I just submit a PR, check the automatic tests and correct what's needed ;-)

@lyphrowny
Copy link
Contributor Author

@chennes could you please start the bulding workflow?

@lyphrowny
Copy link
Contributor Author

@chennes could you please run the workflow? Should be ok to merge

@yorikvanhavre yorikvanhavre merged commit 6bdff47 into FreeCAD:main Mar 18, 2024
9 checks passed
@lyphrowny lyphrowny deleted the fea_fix_cross_section branch March 18, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WB FEM Related to the FEM Workbench
3 participants