Multibody System Dynamics: MBDyn Primer Pierangelo Masarati <[email protected]> Politecnico di Milano Dipartimento di Ingegneria Aerospaziale
Multibody System Dynamics:MBDyn Primer
Pierangelo Masarati <[email protected]>Politecnico di MilanoDipartimento di Ingegneria Aerospaziale
2
Pierangelo Masarati – MBDyn Primer
Outline
• SoftwareSoftware• Input FileInput File• ResultsResults• Example 1: Rigid BodyExample 1: Rigid Body• Example 2: PendulumExample 2: Pendulum• Example 3: Cantilever BeamExample 3: Cantilever Beam• Example 4: Plane MechanismExample 4: Plane Mechanism
3
Pierangelo Masarati – MBDyn Primer
Software
• Web site: Web site: http://www.mbdyn.org/http://www.mbdyn.org/
• Distributed in source formDistributed in source form
• Developed for LinuxDeveloped for Linux
• Needs Un*x-like build environment (gmake, gcc, g++, gfortran)Needs Un*x-like build environment (gmake, gcc, g++, gfortran)
• Latest binary compiled for Windows XP available here:Latest binary compiled for Windows XP available here:http://home.aero.polimi.it/masarati/Download/mbdyn/mbdyn-1.7.0-win32.ziphttp://home.aero.polimi.it/masarati/Download/mbdyn/mbdyn-1.7.0-win32.zip
4
Pierangelo Masarati – MBDyn Primer
Software
• Command-line softwareCommand-line software
• Prepare an input file using your favourite text editorPrepare an input file using your favourite text editor
• execute:execute:
• Output in files with specific extensions (discussed later)Output in files with specific extensions (discussed later)
• Load output files in math environment (octave, scilab, matlab, …) Load output files in math environment (octave, scilab, matlab, …) and use results (e.g. for plotting)and use results (e.g. for plotting)
# mbdyn.exe -o output_file input_file
5
Pierangelo Masarati – MBDyn Primer
Software
• Output can be reformatted for some post-processing toolsOutput can be reformatted for some post-processing tools BlenderBlender EasyAnimEasyAnim ......
• Ongoing third-party project about usingOngoing third-party project about usingBlender Blender http://www.blender.org/http://www.blender.org/ for pre/post-processing for pre/post-processing
• Output also available in binary form for NetCDFOutput also available in binary form for NetCDFhttp://www.unidata.ucar.edu/software/netcdf/http://www.unidata.ucar.edu/software/netcdf/
• Several tools are able to interpret NetCDF, including matlab, octaveSeveral tools are able to interpret NetCDF, including matlab, octave
6
Pierangelo Masarati – MBDyn Primer
Input File
• The model and the analysis are defined in an input fileThe model and the analysis are defined in an input file
• Use your preferred editor to prepare the input fileUse your preferred editor to prepare the input file
• The structure and the syntax of the statements are described hereThe structure and the syntax of the statements are described herehttps://www.mbdyn.org/userfiles/documents/mbdyn-input-1.5.6.pdfhttps://www.mbdyn.org/userfiles/documents/mbdyn-input-1.5.6.pdf(pick the manual for the version in use)(pick the manual for the version in use)
• A set of tutorials is presented hereA set of tutorials is presented herehttps://www.mbdyn.org/userfiles/documents/tutorials.pdfhttps://www.mbdyn.org/userfiles/documents/tutorials.pdf
7
Pierangelo Masarati – MBDyn Primer
Input File
• The input is organized in statements:The input is organized in statements:
• Statements are terminated by a semicolon.Statements are terminated by a semicolon.• If no args expected:If no args expected:
• Arguments are comma-separatedArguments are comma-separated• Keywords are case-insensitive; data is case-sensitiveKeywords are case-insensitive; data is case-sensitive• When a numerical value is expected, a mathematical parser is called When a numerical value is expected, a mathematical parser is called
to evaluate math expressions; example:to evaluate math expressions; example:
<statement> [ : <arglist> ] ;
<statement> ;
structural nodes: +1 # first node +10*2 # other 20 nodes; # i.e. 21 structural nodes will be defined
8
Pierangelo Masarati – MBDyn Primer
Input File
• File structure: blocks of statementsFile structure: blocks of statements
# data block (type of analysis)
# <type> block (analysis parameters)
# control data block (model-specific general data)
# nodes block
# (optional) drivers block
# elements block
9
Pierangelo Masarati – MBDyn Primer
Input File
• Data blockData block
• We only consider initial value problems by now.We only consider initial value problems by now.
begin: data; problem: initial value;end: data;
10
Pierangelo Masarati – MBDyn Primer
Input File
• ““Initial value” block: define the parameters of the analysisInitial value” block: define the parameters of the analysis
• Other statements can be requiredOther statements can be required
begin: initial value; time step: real DT = 1e-3; initial time: real INITIAL_TIME = 0.; final time: INITIAL_TIME + 1000*DT;
tolerance: 1e-6; max iterations: 10;
# linear solver: naive, colamd, mt, 1; # nonlinear solver: newton raphson, modified, 5; # method: ms, 0.6;end: initial value;
11
Pierangelo Masarati – MBDyn Primer
Input File
• ““Initial value” block: define the parameters of the analysisInitial value” block: define the parameters of the analysis
# Better style:begin: initial value; set: real DT = 1e-3; set: real INITIAL_TIME = 0.;
time step: DT; initial time: INITIAL_TIME; final time: INITIAL_TIME + 1000*DT; # 1000 time steps
tolerance: 1e-6; max iterations: 10;
# linear solver: naive, colamd, mt, 1; # nonlinear solver: newton raphson, modified, 5; # method: ms, 0.6;end: initial value;
12
Pierangelo Masarati – MBDyn Primer
Input File
• Control data block: define the parameters of the modelControl data block: define the parameters of the model
• Other entities and parameters can be declared/definedOther entities and parameters can be declared/defined• Rationale:Rationale:
Declare the count of each entity type expected laterDeclare the count of each entity type expected later Define parameters related to model initializationDefine parameters related to model initialization Define parameters related to model handling (output...)Define parameters related to model handling (output...)
begin: control data; structural nodes: 1; rigid bodies: 1; gravity;end: control data;
13
Pierangelo Masarati – MBDyn Primer
Input File
• Miscellaneous statements (can appear anywhere)Miscellaneous statements (can appear anywhere)• The “set” statements calls the math parser:The “set” statements calls the math parser:
• The “reference” statement defines a reference frame:The “reference” statement defines a reference frame:
set: real X = 0.;
set: integer LABEL = 1000;reference: LABEL, reference, global, 0., 0., 0., # position reference, global, # orientation 1, 1., 0., 0., 3, 0., 0., 1., reference, global, 0., 0., 0., # velocity reference, global, 0., 0., 0.; # angular velocity
14
Pierangelo Masarati – MBDyn Primer
Input File
• References can be defined incrementally:References can be defined incrementally:a new reference can refer to an already defined onea new reference can refer to an already defined one
• The combined useThe combined useof symbolicof symbolicnames and data,names and data,and of hierarchicaland of hierarchicalreferences, allowsreferences, allowsto build parametricto build parametricmodelsmodels
x1
y
x
y
0
A
set: integer POINT_0 = 1;set: integer POINT_A = 2;set: real X_A = 10.0; # mset: real Y_A = 20.0; # mset: real Z_A = 0.0; # mset: real OMEGA = 99.9; # rad/s, about zset: real ALPHA = 30.0*deg2rad; # radreference: POINT_0, reference, global, null, reference, global, eye, reference, global, null, reference, global, 0.0, 0.0, OMEGA;reference: POINT_A, reference, POINT_0, X_A, Y_A, Z_A, reference, POINT_0, 3, 0.0, 0.0, 1.0, 1, cos(ALPHA), sin(ALPHA), 0.0, reference, POINT_0, null, reference, POINT_0, null;
15
Pierangelo Masarati – MBDyn Primer
Input File
• References do not participate in the simulationReferences do not participate in the simulation
• References are only used during model inputReferences are only used during model input
• References inherit:References inherit: position,position, orientation,orientation, velocityvelocity angular velocityangular velocity
of the references they refer to:of the references they refer to:
x final= x0+R0 xrel
R final= R0 Rrel
v final= v0+ω0×R0 xrel+R0 vrel
ωfinal= ω0+R0ωrel
16
Pierangelo Masarati – MBDyn Primer
Input File
• Nodes:Nodes:
begin: nodes; set: integer NODE_1 = 100; # a node with initial velocity in x structural: NODE_1, dynamic, reference, global, null, reference, global, eye, reference, global, null, reference, global, 10., 0., 0.;end: nodes;
17
Pierangelo Masarati – MBDyn Primer
Input File
• Nodes instantiate kinematic degrees of freedom and the Nodes instantiate kinematic degrees of freedom and the corresponding equilibrium equationscorresponding equilibrium equations
• Static nodes only instantiate equilibrium equationsStatic nodes only instantiate equilibrium equations
• Dynamic nodes also instantiate momentum and momenta moment Dynamic nodes also instantiate momentum and momenta moment definitionsdefinitions
0= ∑ f0= ∑ m
M x=
J=
= ∑ f= ∑ m
18
Pierangelo Masarati – MBDyn Primer
Input File
• Elements:Elements:
• Elements write contributions to nodes equationsElements write contributions to nodes equations
• Elements represent “connectivity” and “constitutive properties”Elements represent “connectivity” and “constitutive properties”
• Elements can add further, “private” equationsElements can add further, “private” equations(e.g. algebraic constraints)(e.g. algebraic constraints)
begin: elements; set: integer BODY_1 = 200; body: BODY_1, NODE_1, 36.0, # mass reference, node, null, # CM offset diag, 10.0, 20.0, 30.0; # inertia tensor
gravity: 0.0, 0.0, -1.0, const, 9.81;end: elements;
19
Pierangelo Masarati – MBDyn Primer
Input File
• Multibody vs. FEM: nodes at bodies vs. nodes at frontierMultibody vs. FEM: nodes at bodies vs. nodes at frontier(node (node ↔↔ body; element body; element ↔↔ hinge) hinge)
body
1
body 2hinge
node
element
multibody FEM
dof
connectivity
20
Pierangelo Masarati – MBDyn Primer
Input File
body
1
body 2element (hinge)
nodes at bodies
node (body)
MULTIBODY
node (body)
nodes (bodies)
nodes at bodies & at frontier
body
1
element (hinge)
beam elementwithin multibody
MULTIBODY + FEM (e.g. beam)
node (body)
21
Pierangelo Masarati – MBDyn Primer
Output
outfile.mov: structural node motionoutfile.mov: structural node motion
• One row for each nodeOne row for each node
• One block for each time stepOne block for each time step
• Columns:Columns: #1:#1: node labelnode label #2 – 4:#2 – 4: position componentsposition components #5 – 7:#5 – 7: orientation parametersorientation parameters #8 – 10:#8 – 10: velocity componentsvelocity components #11 – 13:#11 – 13: angular velocity componentsangular velocity components
• Acceleration and angular acceleration can be requestedAcceleration and angular acceleration can be requested(only for dynamic nodes)(only for dynamic nodes)
• All data is in the global reference frame (exceptions on demand)All data is in the global reference frame (exceptions on demand)
22
Pierangelo Masarati – MBDyn Primer
Output
outfile.jnt: joints outputoutfile.jnt: joints output
• One row for each jointOne row for each joint
• One block for each time stepOne block for each time step
• Columns: each joint type differsColumns: each joint type differs
• Column number may differ (cannot be loaded in matlab)Column number may differ (cannot be loaded in matlab)
• Joint output documented in input manualJoint output documented in input manual
23
Pierangelo Masarati – MBDyn Primer
Output
• Other node and element types have their output file and formatOther node and element types have their output file and format(presented and discussed in tutorials and input manual)(presented and discussed in tutorials and input manual)
• Output on database (NetCDF)Output on database (NetCDF)
• Not all nodes/elements support NetCDF (but will...)Not all nodes/elements support NetCDF (but will...)
• More efficient:More efficient: Less disk spaceLess disk space No overhead in formatting outputNo overhead in formatting output Higher precision (more digits) for less disk spaceHigher precision (more digits) for less disk space
• Octave, matlab, many other software natively interpret the formatOctave, matlab, many other software natively interpret the format
• Not supported by distributed Windows executable!Not supported by distributed Windows executable!
24
Pierangelo Masarati – MBDyn Primer
Rigid Body
• Model a body that falls freely, subjected to gravityModel a body that falls freely, subjected to gravity
• Hints:Hints: Use a dynamic structural nodeUse a dynamic structural node Connect a rigid body to itConnect a rigid body to it Apply gravityApply gravity
25
Pierangelo Masarati – MBDyn Primer
Pendulum
• Model a pendulum, subjected to gravityModel a pendulum, subjected to gravity
• Hints:Hints: Use two structural nodes: ground and pendulumUse two structural nodes: ground and pendulum Use a “clamp” joint to ground the ground nodeUse a “clamp” joint to ground the ground node Use a “revolute hinge” joint to ground the pendulum nodeUse a “revolute hinge” joint to ground the pendulum node Connect a rigid body to the pendulum nodeConnect a rigid body to the pendulum node Add gravityAdd gravity
26
Pierangelo Masarati – MBDyn Primer
Cantilever Beam
• Model a cantilever beam subjected to a load at the free end,Model a cantilever beam subjected to a load at the free end,using a variable number of 3 node beam elementsusing a variable number of 3 node beam elements
• Hints:Hints: Ground one structural nodeGround one structural node Add two more nodes for each beamAdd two more nodes for each beam Add a rigid body for each non-grounded nodeAdd a rigid body for each non-grounded node
27
Pierangelo Masarati – MBDyn Primer
Plane Mechanism
• Model a plane mechanism, consisting in three bodies hinged Model a plane mechanism, consisting in three bodies hinged together and to the ground, according to the figuretogether and to the ground, according to the figure
• Add a spring about hinge in point AAdd a spring about hinge in point A
• Load the system with a force in point ILoad the system with a force in point I point x z
A 0.921 1.124
B 0.918 1.114
C 0.915 1.104
D 0.896 1.106
E 0.878 1.108
F 0.878 1.118
G 0.830 1.080
H 0.790 1.088
I 0.825 1.109