# beam_slider.mbd
#-----------------------------------------------------------------------------
# [Data Block]
begin: data;
problem: initial value;
end: data;
#-----------------------------------------------------------------------------
# [<Problem> Block]
begin: initial value;
initial time: 0.;
final time: 9.;
time step: 1.e-3;
max iterations: 100;
tolerance: 1.e-6;
derivatives tolerance: 1.e-3;
derivatives max iterations: 100;
end: initial value;
#-----------------------------------------------------------------------------
# Design Variables
set: real m_Rod = 1.; #[kg] Mass of the rod
set: real L_Rod = 2.0; #[m] Length of the rod
set: real m_Head = 5.; #[kg] Mass of the head
set: real I_Head = 0.01; #[kgm^2] Moment of inertia of the head
set: real X_Slider = 0.5; #[m] X position of the slider
set: real EA = 1.e5; #[N] Beam stiffness of the rod
set: real GAy = 0.6e5; #[N] Beam stiffness of the rod
set: real GAz = 0.6e5; #[N] Beam stiffness of the rod
set: real GJ = 2.e2; #[Nm^2] Beam stiffness of the rod
set: real EJy = 2.e2; #[Nm^2] Beam stiffness of the rod
set: real EJz = 1.e3; #[Nm^2] Beam stiffness of the rod
set: real viscos_factor = 0.05; # Proportional viscosity factor of the rod
set: real N = 5; # Number of beams for the rod
#-----------------------------------------------------------------------------
# [Control Data Block]
begin: control data;
output meter: meter, 0., forever, steps, 10;
structural nodes: 1
+2*N+1;
rigid bodies: 1
+2*N+1;
joints: 3;
beams: N;
gravity;
end: control data;
#-----------------------------------------------------------------------------
# Node Labels
set: integer NoSta_Ground = 1;
set: integer NoDyn_RodElem_1st = 101;
set: integer NoDyn_RodElem_curr;
set: integer NoDyn_RodElem_end = (NoDyn_RodElem_1st-1)+2*N+1;
# Body Labels
set: integer Body_Head = 1;
set: integer Body_RodElem_curr;
# Joint Labels
set: integer JoClamp_Ground = 1; # Clamp
set: integer JoTotp_RodElem_1st = 2; # Total pin joint
set: integer JoBmSld_Ground_Rod = 3; # Beam slider
# Beam Labels
set: integer Beam_RodElem_curr;
# Index
set: integer Index;
#-----------------------------------------------------------------------------
# Intermediate Variables
set: real m_RodElem = m_Rod/N/2.;
set: real L_RodElem = L_Rod/N/2.;
set: real I_RodElem = m_RodElem*L_RodElem^2/12.;
set: real m_RodElemEnd = m_RodElem/2.;
set: real L_RodElemEnd = L_RodElem/2.;
set: real I_RodElemEnd = m_RodElemEnd*L_RodElemEnd^2/12.;
#-----------------------------------------------------------------------------
# [Nodes Block]
begin: nodes;
#-----------------------------------------------------------------------------
# Structural Nodes
structural: NoSta_Ground, static,
null, # absolute position
eye, # absolute orientation
null, # absolute velocity
null; # absolute angular velocity
set: Index = 1;
include: "node_Rod.sub";
set: Index = 2;
include: "node_Rod.sub";
set: Index = 3;
include: "node_Rod.sub";
set: Index = 4;
include: "node_Rod.sub";
set: Index = 5;
include: "node_Rod.sub";
set: Index = 6;
include: "node_Rod.sub";
set: Index = 7;
include: "node_Rod.sub";
set: Index = 8;
include: "node_Rod.sub";
set: Index = 9;
include: "node_Rod.sub";
set: Index = 10;
include: "node_Rod.sub";
set: Index = 11;
include: "node_Rod.sub";
end: nodes;
#-----------------------------------------------------------------------------
# [Elements Block]
begin: elements;
#-----------------------------------------------------------------------------
# Bodies
body: Body_Head, NoDyn_RodElem_end,
m_Head, # mass
null, # relative center of mass
diag, I_Head, I_Head, I_Head; # inertia matrix
set: Index = 1;
set: Body_RodElem_curr = (NoDyn_RodElem_1st-1)+Index;
set: NoDyn_RodElem_curr = (NoDyn_RodElem_1st-1)+Index;
body: Body_RodElem_curr, NoDyn_RodElem_curr,
m_RodElemEnd, # mass
L_RodElemEnd/2., 0., 0., # relative center of mass
diag, 1., I_RodElemEnd, I_RodElemEnd; # inertia matrix
set: Index = 2;
include: "body_Rod.sub";
set: Index = 3;
include: "body_Rod.sub";
set: Index = 4;
include: "body_Rod.sub";
set: Index = 5;
include: "body_Rod.sub";
set: Index = 6;
include: "body_Rod.sub";
set: Index = 7;
include: "body_Rod.sub";
set: Index = 8;
include: "body_Rod.sub";
set: Index = 9;
include: "body_Rod.sub";
set: Index = 10;
include: "body_Rod.sub";
set: Index = 11;
set: Body_RodElem_curr = (NoDyn_RodElem_1st-1)+Index;
set: NoDyn_RodElem_curr = (NoDyn_RodElem_1st-1)+Index;
body: Body_RodElem_curr, NoDyn_RodElem_curr,
m_RodElem, # mass
-L_RodElemEnd/2., 0., 0., # relative center of mass
diag, 1., I_RodElemEnd, I_RodElemEnd; # inertia matrix
#-----------------------------------------------------------------------------
# Beams
set: Index = 2;
include: "beam_Rod.sub";
set: Index = 4;
include: "beam_Rod.sub";
set: Index = 6;
include: "beam_Rod.sub";
set: Index = 8;
include: "beam_Rod.sub";
set: Index = 10;
include: "beam_Rod.sub";
#-----------------------------------------------------------------------------
# Joints
joint: JoClamp_Ground,
clamp,
NoSta_Ground,
null, # absolute position
eye; # absolute orientation
joint: JoTotp_RodElem_1st,
total pin joint,
NoDyn_RodElem_1st,
position, null, # relative offset
rotation orientation, eye, # relative rotation orientation
position constraint,
active, active, active,
single, -1., 0., 0., cosine, 1., pi/2., 0.75, forever, 0.,
orientation constraint,
active, active, active,
null;
joint: JoBmSld_Ground_Rod,
beam slider,
NoSta_Ground,
X_Slider, 0., 0., # relative offset
hinge, eye, # relative orientation
type, classic,
4, # beam number
(NoDyn_RodElem_1st-1)+4, # 3 node beam
null, # first node offset
null, # mid node offset
null, # end node offset
(NoDyn_RodElem_1st-1)+6, # 3 node beam
null, # first node offset
null, # mid node offset
null, # end node offset
(NoDyn_RodElem_1st-1)+8, # 3 node beam
null, # first node offset
null, # mid node offset
null, # end node offset
(NoDyn_RodElem_1st-1)+10, # 3 node beam
null, # first node offset
null, # mid node offset
null; # end node offset
#-----------------------------------------------------------------------------
# Gravity
gravity: 0., 0., -1., const, 9.81;
end: elements;
# beam_Rod.sub
#-----------------------------------------------------------------------------
set: Beam_RodElem_curr = (NoDyn_RodElem_1st-1)+Index;
set: NoDyn_RodElem_curr = (NoDyn_RodElem_1st-1)+Index;
# Beams
beam3: Beam_RodElem_curr,
NoDyn_RodElem_curr-1,
null, # relative offset
NoDyn_RodElem_curr,
null, # relative offset
NoDyn_RodElem_curr+1,
null, # relative offset
eye, # orientation matrix section I
linear viscoelastic generic, # constitutive law section I
diag, EA, GAy, GAz, GJ, EJy, EJz, # stiffness
proportional, viscos_factor, # proportional viscosity factor
same, # orientation matrix section II
same; # constitutive law section II