1# $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/modules/module-octave/demo/octave_element.mbdyn,v 1.10 2017/01/12 14:56:29 masarati Exp $ 2# 3# MBDyn (C) is a multibody analysis code. 4# http://www.mbdyn.org 5# 6# Copyright (C) 1996-2017 7# 8# Pierangelo Masarati <masarati@aero.polimi.it> 9# Paolo Mantegazza <mantegazza@aero.polimi.it> 10# 11# Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano 12# via La Masa, 34 - 20156 Milano, Italy 13# http://www.aero.polimi.it 14# 15# Changing this copyright notice is forbidden. 16# 17# This program is free software; you can redistribute it and/or modify 18# it under the terms of the GNU General Public License as published by 19# the Free Software Foundation (version 2 of the License). 20# 21# 22# This program is distributed in the hope that it will be useful, 23# but WITHOUT ANY WARRANTY; without even the implied warranty of 24# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25# GNU General Public License for more details. 26# 27# You should have received a copy of the GNU General Public License 28# along with this program; if not, write to the Free Software 29# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30# 31################################################################# 32## 33## AUTHOR: Reinhard Resch <r.resch@secop.com> 34## Copyright (C) 2011(-2017) all rights reserved. 35## 36## The copyright of this code is transferred 37## to Pierangelo Masarati and Paolo Mantegazza 38## for use in the software MBDyn as described 39## in the GNU Public License version 2.1 40## 41################################################################## 42 43#{ 44# BEGIN OF MBDYN SECTION 45 46# module load: "libmodule-octave.la"; 47 48set: real tau1 = 1e-10; 49set: real tau2 = 0.1; 50 51set: real f = 3; 52set: real F0 = 130; 53set: real r = 15.5; 54 55set: real sx = 7500; 56set: real sy = 4800; 57set: real sz = 3200; 58set: real ks = 0.003; 59 60begin: data; 61 problem: initial value; # the default 62end: data; 63 64begin: initial value; 65 initial time: 0; 66 final time: 1; 67 time step: 0.002; 68 max time step: 0.0005; 69 min time step: 0.00001; 70 strategy: factor, 0.8, 1, 1.25, 1, 3, 6; 71# derivatives coefficient: 1e-2; 72 derivatives tolerance: 1e-5; 73 derivatives max iterations: 10; 74 output: counter; 75# output: iterations; 76# output: residual; 77end: initial value; 78 79begin: control data; 80 structural nodes: 4; 81 rigid bodies: 2; 82 forces: 4; 83 joints: 2; 84 parameter nodes: 2; 85 loadable elements: 4; 86 use: loadable elements, in assembly; 87 max iterations: 100; 88 print: equation description, to file; 89 make restart file: time, 0.1; 90end: control data; 91 92reference: 1, 93 position, reference, global, 0.2, 0.5, 0.3, 94 orientation, reference, global, 1, 0., 1., 0., 95 2, -1., 0., 0., 96 velocity, reference, global, null, 97 angular velocity, reference, global, null; 98 99begin: nodes; 100 structural: 1, dynamic, 101 position, reference, global, null, 102 orientation, reference, global, eye, 103 velocity, reference, global, null, 104 angular velocity, reference, global, null, 105 accelerations, yes; 106 107 structural: 2, dynamic displacement, 108 position, reference, global, null, 109 velocity, reference, global, null, 110 accelerations, yes; 111 112 structural: 3, static, 113 position, reference, global, null, 114 orientation, reference, global, eye, 115 velocity, reference, global, null, 116 angular velocity, reference, global, null; 117 118 structural: 4, static displacement, 119 position, reference, global, null, 120 velocity, reference, global, null; 121 /**/ 122 parameter: 1, element; 123 parameter: 2, element; 124end: nodes; 125 126begin: elements; 127 body: 1, 1, 128 1.4/10, 129 null, 130 diag, 0.01, 0.02, 0.03; 131 132 body: 2, 2, 133 1.4/10; 134 135 joint: 1, total pin joint, 136 1, 137 position, reference, global, null, 138 position orientation, reference, global, eye, 139 rotation orientation, reference, global, eye, 140 position, reference, global, null, 141 position orientation, reference, global, eye, 142 rotation orientation, reference, global, eye, 143 position constraint, 144 inactive, 145 inactive, 146 inactive, 147 component, const, 0., 148 const, 0., 149 const, 0., 150 orientation constraint, 151 active, 152 active, 153 active, 154 component, const, 0., 155 const, 0., 156 const, 0., 157 output, no; 158 159 joint: 2, total pin joint, 160 3, 161 position, reference, global, null, 162 position orientation, reference, global, eye, 163 rotation orientation, reference, global, eye, 164 position, reference, global, null, 165 position orientation, reference, global, eye, 166 rotation orientation, reference, global, eye, 167 position constraint, 168 inactive, 169 inactive, 170 inactive, 171 component, const, 0., 172 const, 0., 173 const, 0., 174 orientation constraint, 175 active, 176 active, 177 active, 178 component, const, 0., 179 const, 0., 180 const, 0., 181 output, no; 182/**/ 183 force: 1, absolute, 1, position, reference, node, null, octave, "my_force", embed octave, yes; 184 185 force: 2, absolute displacement, 2, octave, "my_force", embed octave, yes; 186 187 force: 3, absolute, 3, position, reference, node, null, octave, "my_force", embed octave, yes; 188 189 force: 4, absolute displacement, 4, octave, "my_force", embed octave, yes; 190/**/ 191 user defined: 1, octave, "MyElem1", node1, 1, 192 offset, reference, 1, null, 193 orientation, reference, 1, eye, 194 stiffness x, sx, 195 stiffness y, sy, 196 stiffness z, sz, 197 damping coefficient, ks, 198 force value, time, 199 force direction, 1., 0.5, 0.3, 200 drive1, 4., 201 drive2, 5., 202 output, yes; 203 204 bind: 1, user defined, 1, string, "X2"; 205 bind: 1, user defined, 2, string, "XP2"; 206 207 user defined: 2, octave, "MyElem1", node1, 2, 208 offset, reference, 1, null, 209 orientation, reference, 1, eye, 210 stiffness x, sx, 211 stiffness y, sy, 212 stiffness z, sz, 213 damping coefficient, ks, 214 force value, 0., 215 force direction, 1., 0.5, 0.3, 216 drive1, 0., 217 drive2, 1., 218 output, yes; 219 220 user defined: 3, octave, "MyElem1", node1, 3, 221 offset, reference, 1, null, 222 orientation, reference, 1, eye, 223 stiffness x, sx, 224 stiffness y, sy, 225 stiffness z, sz, 226 damping coefficient, ks, 227 force value, 0., 228 force direction, 1., 0.5, 0.3, 229 drive1, 2., 230 drive2, 3., 231 output, yes; 232 233 user defined: 4, octave, "MyElem1", node1, 4, 234 offset, reference, 1, null, 235 orientation, reference, 1, eye, 236 stiffness x, sx, 237 stiffness y, sy, 238 stiffness z, sz, 239 damping coefficient, ks, 240 force value, 0., 241 force direction, 1., 0.5, 0.3, 242 string value, "string 1", 243 bool value, 1, 244 int value, 17, 245 real value, 1.5, 246 string with delimiter, [string with delimiters 1], 247 drive1, sine, 0., 2*pi*15, 1., forever, 0., 248 drive2, ginac, symbol, "x", "sin(2*3.141592654*15*x)", 249 output, yes; 250/**/ 251end: elements; 252#} 253# END OF MBDYN SECTION 254 255#/* BEGIN OF OCTAVE SECTION 256printf("mboct: embed octave is enabled!\n"); 257 258function F = my_force(t) 259 global f; 260 global F0; 261 global tau1; 262 global tau2; 263 F = (1 - exp(-t/tau1) ) * exp(-t/tau2) * F0 * [ sin(2*pi*f*t); 264 cos(2*pi*f*t); 265 0 ]; 266endfunction 267 268#*/ END OF OCTAVE SECTION 269