FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

HaiLiExp
Posts: 4
Joined: Sun Oct 25, 2020 6:36 pm

Re: FreeCAD as pre-post processor for MBDyn

Post by HaiLiExp »

Hello mfasano

Thank you very much for your hint! I didn't know that I have to set the initial values each time the case is opened. It works fine now. It was due to the absence of the derivative tolerance.

Best regards
Hai Li
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Post by mfasano »

There has been another update of the MBDyn workbench. It changes the way the MBDyn model is created. It Allows for you to save parameters for multiple simulations, like different initial values. Look for more ways the simulations may be setup in the future.

We will update the documentation soon.

Thanks to T-Garnier for providing the code for this update.

Here is where you can download the workbench.
https://github.com/mfasano727/MBDynFCwb
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Post by mfasano »

Sorry. If you downloaded the the WB since my last post announcing the latest update. I found a bug that would not allow running an MBDyn simulation. It is fixed now
carno
Posts: 12
Joined: Sun Jun 18, 2017 4:38 am

Re: FreeCAD as pre-post processor for MBDyn

Post by carno »

Hi,

I am trying to run the pendulum tutorial. Earlier WB was not running the simulations, which seems to be solved.
I am facing two problems.
1. I am not able to add gravity. It is just adding blank entry. It is giving me following error.

Code: Select all

 'Traceback (most recent call last):
14:21:41    File "E:\FreeCAD\0.19\FreeCAD_0.19.22522-Win-Conda_vc14.x-x86_64\Mod\MBDynFCwb-asm4\MBDyn_guitools\External_Ui\gravity_field.py", line 29, in accept
14:21:41      createGravity(grav_parameters)
14:21:41    File "E:\FreeCAD\0.19\FreeCAD_0.19.22522-Win-Conda_vc14.x-x86_64\Mod\MBDynFCwb-asm4\MBDyn_objects\MBDynObjectFactory\LoadsCreation.py", line 7, in createGravity
14:21:41      MBDynGravity(gravity, grav_parameter)
14:21:41  TypeError: __init__() takes 2 positional arguments but 3 were given
2. If I paste gravity field from the downloaded file from this forum and edit, it goes ahead. But simulation seems to be runing forever. When I try to check the status, it gives me this error.

Code: Select all

Traceback (most recent call last):
14:36:42    File "E:\FreeCAD\0.19\FreeCAD_0.19.22522-Win-Conda_vc14.x-x86_64\Mod\MBDynFCwb-asm4\MBDyn_guitools\External_Ui\MBDynFreeCAD.py", line 163, in outputMessage
14:36:42      proc = subprocess.Popen(args)
14:36:42    File "E:\FreeCAD\0.19\FreeCAD_0.19.22522-Win-Conda_vc14.x-x86_64\bin\lib\subprocess.py", line 854, in __init__
14:36:42      self._execute_child(args, executable, preexec_fn, close_fds,
14:36:42    File "E:\FreeCAD\0.19\FreeCAD_0.19.22522-Win-Conda_vc14.x-x86_64\bin\lib\subprocess.py", line 1307, in _execute_child
14:36:42      hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
14:36:42  OSError: [WinError 87] The parameter is incorrect
_console.log file says:
MBDyn - MultiBody Dynamics 1.7.3
configured on Oct 15 2017 at 15:04:55

Copyright 1996-2017 (C) Paolo Mantegazza and Pierangelo Masarati,
Dipartimento di Ingegneria Aerospaziale <http://www.aero.polimi.it/>
Politecnico di Milano <http://www.polimi.it/>

MBDyn is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it
under certain conditions. Use 'mbdyn --license' to see the conditions.
There is absolutely no warranty for MBDyn. Use "mbdyn --warranty"
for details.

reading from file "E:\1st.mbd"
Creating scalar solver with Naive linear solver
Reading Structural(1)
Reading Structural(2)
Reading Body(1)
Reading Body(2)
Reading Joint(1)
Reading Joint(2)
error: 1 elements are missing;
1 Force
An error occurred during the execution of MBDyn; aborting...
I suspect this is due to gravity.
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Post by mfasano »

carno wrote: Mon Nov 02, 2020 9:10 am Hi,

I am trying to run the pendulum tutorial. Earlier WB was not running the simulations, which seems to be solved.
I am facing two problems.
1. I am not able to add gravity. It is just adding blank entry. It is giving me following error.
I made changes that I think will work(commit 153). I will not be able to test it until tonight.

The slow simulation run may be due to a unit conversion. I have you put 9.81 m/s/s for gravity but it should be in mm/s/s. You should still input 9.81; It is converted in the code now. I will let you know how the test goes
carno
Posts: 12
Joined: Sun Jun 18, 2017 4:38 am

Re: FreeCAD as pre-post processor for MBDyn

Post by carno »

Excellent... Very good Job. I hope it matures further.

I managed to complete the simulation.

When I change the gravity value to 9810 mm/s2, the run diverges. I had to play with simulation settings to converge. In the end, it converged.
Run converges very well on settings mentioned on tutorial with gravity value of 9.81 mm/s2. Note the units.

The run status check button does not work in my case, may be because I have not set the text editor for the workbench.

My aim is to solve CAM-Follower tutorial. Please let me know if you have any literature. Which join I have to use at the contact point of CAM-Follower?
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Post by mfasano »

I made a mistake with the gravity units conversion It is fixed with commit 158.

To change the simulations parameters right click the simulation and select edit in the popup menu.
carno
Posts: 12
Joined: Sun Jun 18, 2017 4:38 am

Re: FreeCAD as pre-post processor for MBDyn

Post by carno »

Okay, I will try new commit.

Another feedback is, it is putting a word 'offset' in the 'In-line Joint' script. This seems to be a syntax error. Let me know if I am wrong.

Code: Select all

        joint: 3, in line,
                3,
                position, null,
                orientation, , 0.0, 0.0, 0.0,
                2,
                offset, 0.0, 0.0, -3.0;
T-Garnier
Posts: 18
Joined: Sat Jun 27, 2020 5:30 am

Re: FreeCAD as pre-post processor for MBDyn

Post by T-Garnier »

Hello,

you can find the documation here: https://www.mbdyn.org/userfiles/documen ... -1.7.3.pdf or directly download it from https://www.mbdyn.org/?Software_Download.

As shown on the documentation, the keyword "offset" exists. The InLine joint works as follow:

The node N2' (moved from N2 by "offset" keyword) is constrained on the line define by N1' (moved from N1 by "position" keyword) and the direction v(defined by "direction" keyword) as shown on the above illustration.
inline.PNG
inline.PNG (18.69 KiB) Viewed 1878 times
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Post by mfasano »

carno wrote: Tue Nov 03, 2020 2:14 pm Okay, I will try new commit.

Another feedback is, it is putting a word 'offset' in the 'In-line Joint' script. This seems to be a syntax error. Let me know if I am wrong.

Code: Select all

        joint: 3, in line,
                3,
                position, null,
                orientation, , 0.0, 0.0, 0.0,
                2,
                offset, 0.0, 0.0, -3.0;
There is a bug with the offset for the inline joint I just got fixed. I have not updated it. I should probably test it more before committing it. The offset is optional, but it may work best to have it. The MBDyn input manual T-Gannier referred to has a nice diagram to help explain how the inline joint works. Most joints use the node position (Programmed to be the center of mass for the rigid bodies.) and a position often away from the node position given in a reference frame relative the the node's frame. I think the offset could have been named "position" for the second node.
I will let you know when the bug is fixed. I have put off writing the tutorial for the slide crank mechanism until I fixed the problem. I can continue writing it now.
Post Reply