1/*
2 * MBDyn (C) is a multibody analysis code.
3 * http://www.mbdyn.org
4 *
5 * Copyright (C) 1996-2017
6 *
7 * Pierangelo Masarati	<masarati@aero.polimi.it>
8 * Paolo Mantegazza	<mantegazza@aero.polimi.it>
9 *
10 * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
11 * via La Masa, 34 - 20156 Milano, Italy
12 * http://www.aero.polimi.it
13 *
14 * Changing this copyright notice is forbidden.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation (version 2 of the License).
19 *
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29 */
30
31/*
32 AUTHOR: Reinhard Resch <r.resch@secop.com>
33        Copyright (C) 2013(-2017) all rights reserved.
34
35        The copyright of this code is transferred
36        to Pierangelo Masarati and Paolo Mantegazza
37        for use in the software MBDyn as described
38        in the GNU Public License version 2.1
39*/
40
41# module load: "libmodule-autodiff_test.la";
42
43set: real X0 = 20e-3;
44set: real Y0 = 30e-3;
45set: real Z0 = -15e-3;
46
47set: real m = 2;
48set: real J11 = 1;
49set: real J22 = 1;
50set: real J33 = 1;
51set: real g = 9.81;
52
53set: real gravity_Zeta = -pi/2.;
54set: real gravity_Psi = 30 * pi / 180.;
55
56set: real theta_y = 70*pi/180;
57set: real theta_z = 90*pi/180;
58
59set: integer node_id_slider = 1001;
60set: integer node_id_ground = 1002;
61set: integer prm_node_id_lambda1 = 1003;
62set: integer prm_node_id_lambda2 = 1004;
63set: integer body_id_slider = 2001;
64set: integer joint_id_ground = 3001;
65set: integer joint_id_slider = 3002;
66set: integer ref_id_slider = 4001;
67
68begin: data;
69	problem: initial value;	# the default
70end: data;
71
72begin: initial value;
73	initial time: 0.;
74	final time: 1;
75	time step: 1e-4;
76    min time step: 1e-4;
77    max time step: 5e-2;
78	max iterations: 10;
79	#strategy: factor, 0.8, 1, 1.25, 1, 3, 6;
80	tolerance: 1e-8;
81
82	max iterations: 100;
83    method: ms, 0.9;
84    derivatives tolerance: 2e-5;
85    derivatives max iterations: 100;
86	derivatives coefficient: 0.3e-2;
87    #output: residual;
88    #output: solution;
89    #output: jacobian;
90
91    linear solver: umfpack, colamd, scale, iterative, always, max iterations, 10;
92
93	eigenanalysis: list, 11, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
94    output matrices,
95	parameter, 0.01,
96	output eigenvectors, output geometry,
97    use lapack, balance, permute;
98    #abort after: assembly;
99    #abort after: derivatives;
100end: initial value;
101
102begin: control data;
103    default output: all;
104	structural nodes: 2;
105    parameter nodes: 2;
106    rigid bodies: 1;
107    loadable elements: 1;
108    joints: 1;
109	max iterations: 100;
110	tolerance: 1e-8;
111	gravity;
112	#~ print: dof stats;
113	#~ print: equation description;
114	#~ print: dof description;
115	#~ print: element connection;
116	#~ print: node connection;
117    use: loadable elements, in assembly;
118    print: all, to file;
119end: control data;
120
121reference: ref_id_slider,
122    position, reference, global, X0, Y0, Z0,
123    orientation, reference, global, matr, 	cos(theta_y) * cos(theta_z),	-sin(theta_z),	sin(theta_y) * cos(theta_z),
124								            cos(theta_y) * sin(theta_z),	 cos(theta_z),	sin(theta_y) * sin(theta_z),
125								            -sin(theta_y),		 	 			 	   0.,					cos(theta_y),
126    velocity,         reference, global, null,
127    angular velocity, reference, global, null;
128
129begin: nodes;
130
131structural: node_id_slider, dynamic,
132    position, reference, ref_id_slider, 0., 0., -15e-3,
133	orientation, reference, ref_id_slider, euler123, 45*pi/180, -60*pi/180, 30*pi/180,
134	velocity, reference, ref_id_slider, null,
135	angular velocity, reference, ref_id_slider, null;
136
137structural: node_id_ground, static,
138    position, reference, global, -150e-3, 560e-3, -100e-3,
139	orientation, reference, global, euler123, 45*pi/180, -60*pi/180, 30*pi/180,
140	velocity, reference, global, null,
141	angular velocity, reference, global, null;
142
143parameter: prm_node_id_lambda1, element;
144parameter: prm_node_id_lambda2, element;
145
146end: nodes;
147
148begin: elements;
149
150	body: body_id_slider,
151		# node
152		node_id_slider,
153		# mass
154		m,
155		# relative center of mass
156		reference, node, null,
157		# inertia matrix
158		diag, J11, J22, J33,
159		inertial, reference, node, eye;
160
161    joint: joint_id_ground, clamp, node_id_ground, node, node;
162
163    user defined: joint_id_slider,
164        inline joint ad,
165        node1,
166            node_id_ground,
167            offset, reference, ref_id_slider, null,
168            orientation, reference, ref_id_slider, eye,
169        node2,
170            node_id_slider,
171            offset, reference, ref_id_slider, null;
172
173    bind: joint_id_slider, user defined, prm_node_id_lambda1, string, "lambda1";
174    bind: joint_id_slider, user defined, prm_node_id_lambda2, string, "lambda2";
175
176	gravity: cos(gravity_Zeta) * cos(gravity_Psi),
177             cos(gravity_Zeta) * sin(gravity_Psi),
178             sin(gravity_Zeta),
179	const, g;
180end: elements;
181
182