FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
josegegas
Posts: 241
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

FreeCAD as pre-post processor for MBDyn

Post by josegegas »

Hi all. For my PhD I've been using MBDyn to do simulations of engines and other mechanisms. It is a free and open source multi body dynamics software. It is very powerful but it lacks pre and post processing graphic interface. I've been using FreeCAD as pre and post processing tool for MBDyn and all works very well. Both programs can be integrated nicely through python scripts. I think they could also be integrated in a new workbench. A few days ago I started programing a new workbench with this purpose and though it may be a good idea to share the results here and see if people are interested. In the video you can see a simulation of a simple pendulum under different initial conditions (mass, initial angular velocity, gravitational acceleration, etc). Then I add another body, a simple cylinder, and give it some initial conditions too. FreeCAD can then be used to visualize the MBDyn results. Wat you see in the video is the two objects moving and the reaction forces in the "hinge", which is how they call the joint in MBDyn. Let me know what do you think and if its worth keep working on this! In the end we could be able to give FreeCAD similar features as MSC Adams or something....

https://www.facebook.com/josegabriel.eg ... 599267675/

In this video I've already added the plot tool, so you can visualize the position, angular position, acceleration, and angular acceleration of each "node" in the simulation. A node can be defined as a point within the body:

https://www.youtube.com/watch?v=V0cVsi3 ... e=youtu.be
Last edited by Kunda1 on Sat Jul 04, 2020 2:26 pm, edited 1 time in total.
Reason: fixed typo in forum thread
RatonLaveur
Posts: 991
Joined: Wed Mar 27, 2019 10:45 am

Re: FreeCAD as pre-post procesor for MBDyn

Post by RatonLaveur »

That is sick, Sir! Perhaps a call to the FEM crowd, such as Bernd (FEM) or Oliveroxtoby (CFD) to continue this discussion on how best to integrate efforts?
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD as pre-post procesor for MBDyn

Post by vocx »

josegegas wrote: Sun Sep 08, 2019 5:21 am I've been using MBDyn to do simulations of engines and other mechanisms. It is a free and open source multi body dynamics software. It is very powerful but it lacks pre and post processing graphic interface. I've been using FreeCAD as pre and post processing tool for MBDyn and all works very well. Both programs can be integrated nicely through python scripts. I think they could also be integrated in a new workbench.
I don't know MBDyn, but it sounds like it would be in the same ballpark as Modelica. Saso has a keen interest in something like this, but so far no real development has taken place; see Modelica.

It'd be awesome if you could develop something that is general, that is, able to use different solvers, one of which could be MBDyn and another Modelica. That's basically how the FEM Workbench works.
saso wrote: Sat Dec 01, 2018 1:17 pm ping
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 »

It realy would be nice to have an interface to MBDyn.
Implement a protytype and see how comformatable it will be.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: FreeCAD as pre-post procesor for MBDyn

Post by saso »

Above demo videos indeed look very nice, in the past there has been a similar demo done also with Bullet Physics but there were some concerns if it is really appropriate for real engineering work... MBDyn license is GPL so it would have to be installed separately, ok, but it seems like default installation packages are only for linux? We have also been already looking at https://projectchrono.org/ and Modelica https://forum.freecadweb.org/viewtopic.php?f=18&t=32556
Last edited by saso on Wed Feb 12, 2020 11:50 am, edited 1 time in total.
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Post by mfasano »

I have just started a work bench as a pre and post processor for MBDyn. I was going to use assembly 4 as a base. I thought the use of local coordinate systems would be useful and I would not need a constraint solver because MBDyn would notify if there was a problem. I also thought it would be difficult to translate constraints from assembly 3 or A2+ into MBDyn joints.

One issue with using FreeCAD for multibody dynamics is there is no routine to calculate moment of inertia for arbitrary shapes(part design); that would need to be written.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD as pre-post procesor for MBDyn

Post by Kunda1 »

Just an aside, looking at the original clips by OP and how many times they needed to increase/decrease the widget window, that's a useability issue. Looking at the UI it's pretty surprising how much space title bars and tabs take up. But this discussion would be better the UI/UX subforum.

Also, maybe at some point a potential workbench like this would for sure benefit from a node based paradigm: pyflow.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
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: Mon Sep 09, 2019 2:43 pm I have just started a work bench as a pre and post processor for MBDyn.
Sounds great that you had the same idea! Would you mind sharing some details? My approach has been to create customized objects in FreeCAD that contain the properties of each object required by MBDyn. Thus, I create a "Gravity" object in FreeCAD that has the gravitational acceleration and the direction vector. There is also a "Rigid Body" object that has the mass, center of mass, inertia tensor, etc. A "Node" object that has the initial conditions, etc... Then my Python script reads the objects and writes the txt file (.mbd) to be read by MBDyn. I then run the simulation, and read the output files to animate the objects in FreeCAD. What is your approach?
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: Mon Sep 09, 2019 2:43 pm I was going to use assembly 4 as a base.
Why would you need assembly 4? I mean, MBDyn already takes care of the mechanism assembly. It will yield an error if the assembly was not consistent. My approach to animate the simulation results is just to use a timer (imported from Qt) to update each part's position and orientation. This is very straightforward since MBDyn writes the simulation results in a simple text file, from where all I do is read the values and move the 3D objects accordingly. MBDyn gives me XYZ positions and Euler angles, exactly what FreeCAD loves haha
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: Mon Sep 09, 2019 2:43 pm I would not need a constraint solver because MBDyn would notify if there was a problem. I also thought it would be difficult to translate constraints from assembly 3 or A2+ into MBDyn joints.
I thought exactly the same. There is no need for constraint solver because MBDyn already does this. My idea is to use FreeCAD only as pre and post processor. MBDyn is already a very powerful tool. If we could use FreeCAD to make MBDyn more user friendly, by avoiding the complicated input files, this would be awesome! :D
Post Reply