FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD as pre-post procesor for MBDyn

Post by vocx »

mfasano wrote: Tue Sep 10, 2019 1:23 pm In this thread https://forum.freecadweb.org/viewtopic.php?t=6836 it says the Solid.MatrixOfInertia() method gives units of l^5; this you multipy by the uniform density to get moment of inertia.
Okay, so from this reply, it seems the units are "mm" and "kg" for length and mass, and the others follow from there.
shoogen wrote: Tue Jun 17, 2014 4:29 pm I would just pretend that you get a specific moment of inertia (L^5) / (mm^5).
Then you multiply it by some density (M L^-3) / (kg mm^-3) and get your usual Moment of inertia (M L^2) in (kg mm²)
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: FreeCAD as pre-post procesor for MBDyn

Post by microelly2 »

I moved the topic to FEM.
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post procesor for MBDyn

Post by josegegas »

Previously only the "revolute pin" joint was included. A bit of progress made today: added the "revolute hinge" joint, which allows linking two solid bodies. Made the classic double pendulum simulation. See the reaction forces on the revolute pin joint :)

https://www.youtube.com/watch?v=Nv5qaQj ... e=youtu.be
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FreeCAD as pre-post procesor for MBDyn

Post by bernd »

FreeCAD has a unit system. You can get any (im implemented) attribut in any unit (if implemented) you like

see https://forum.freecadweb.org/viewtopic. ... 84#p333484

The moment of inertia might not be supported ATM. Since standad unit is mm it will be mm.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FreeCAD as pre-post procesor for MBDyn

Post by bernd »

in the regard of a new solver ...

Before a new solver runs with FreeCAD FEM the new solver needs to be implemented in FreeCAD FEM. As an example have a look at the implementation of oofem solver in FreeCAD FEM.

https://github.com/berndhahnebach/FreeC ... s/femoofem

mainly what FreeCAD FEM does:

- writes an solver input file
- executes the solver
- reads the results

The biggest part is the input file. Since every solver has its own input file format this usually needs to be implemented.
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Post by mfasano »

MBDyn needs to be run from a terminal. Is there a way to run a shell script from python?
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post procesor for MBDyn

Post by josegegas »

bernd wrote: Wed Sep 11, 2019 12:24 pm in the regard of a new solver ...

Before a new solver runs with FreeCAD FEM the new solver needs to be implemented in FreeCAD FEM. As an example have a look at the implementation of oofem solver in FreeCAD FEM.

https://github.com/berndhahnebach/FreeC ... s/femoofem

mainly what FreeCAD FEM does:

- writes an solver input file
- executes the solver
- reads the results

The biggest part is the input file. Since every solver has its own input file format this usually needs to be implemented.
This is exactly what I'm doing. FreeCAD writes the input file for MBDyn, execute MBDyn, and then simply read the results to animate the model. The beauty of this is that all the information, such as center of mass of each body, inertia moments, positions and orientations, all this stuff (needed for the input file) can be obtained from the FreeCAD model. This saves the user so much work in writing input files manually. Also, being able to visualize the results with just a click, and get an animation and plots, is fantastically handy. What the people using MBDyn normally do is use Matlab to program an animation and/or plot results. FreeCAD can do this without programing, much easier and faster.
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post procesor for MBDyn

Post by josegegas »

mfasano wrote: Wed Sep 11, 2019 12:36 pm MBDyn needs to be run from a terminal. Is there a way to run a shell script from python?
Yep. I've don this. So that MBDyn can be executed from FreeCAD with a click...
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FreeCAD as pre-post procesor for MBDyn

Post by bernd »

FreeCAD FEM is set up to do run the solver as external binaries. This including some smart methods fr solver handling. Adding a new solver and run this solver are just a few lines of code. The big part is writing the input file for a new solver.

- adding the solver object: https://github.com/berndhahnebach/FreeC ... 41bb58ca99
- adding a new task and writer for the new solver: https://github.com/berndhahnebach/FreeC ... ce313d833d
- run the solver https://github.com/berndhahnebach/FreeC ... #L147-L154
- start to implement the real writer
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Post by mfasano »

josegegas wrote: Wed Sep 11, 2019 12:45 pm
mfasano wrote: Wed Sep 11, 2019 12:36 pm MBDyn needs to be run from a terminal. Is there a way to run a shell script from python?
Yep. I've don this. So that MBDyn can be executed from FreeCAD with a click...
From the video it looks like you open shell and run a command.
Post Reply