[MBDyn-users] Scalar function drive

Pierangelo Masarati masarati at aero.polimi.it
Mon Feb 15 15:21:04 CET 2010


Romuald NORET wrote:
> Hello,
> 
> I am trying to use scalar function drive (type multilinear), but something 
> is wrong in my input file. To summarize, I would like to use a scalar 
> function drive to define a coefficient (y) wihch depends of another (x):
> x       y
> 1       0.5
> 10      0.7
> 100     1.0
> so I would like to use after "y(40)" which will return automatically 
> "0.8", something like : "set: real MY_VALUE = MY_FUNCTION(40);"
> To define the driver, I wrote :
> 
> scalar function: 
>         "MY_FUNCTION",
>         multilinear,
>         1, 0.5,
>         10, 0.7,
>         100, 1.0;
> 
> I read into input manual that the scalar function drive seems could do 
> that, but I didn't find  how to translate "MY_FUNCTION(40)" into MBDyn 
> langage. I am sure it is very simple, but I didn't find how, could you 
> give me a little bit of help?

set: real MY_VALUE = model::sf::MY_FUNCTION(40);

you can only use this after the <problem> block (e.g. after "end: 
initial value;", as the model namespace needs to exist.

A minimal example is

<input>
begin: data;
end: data;

begin: initial value;
end: initial value;

scalar function:
         "MY_FUNCTION",
         multilinear,
         1, 0.5,
         10, 0.7,
         100, 1.0;
remark: "evaluating MY_FUNCTION(40) yields", model::sf::MY_FUNCTION(40);

begin: control data;
end: control data;
</input>

$ mbdyn -f input

MBDyn - MultiBody Dynamics 1.X-Devel
compiled on Feb 13 2010 at 01:52:21

Copyright 1996-2010 (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 "x"
Creating scalar solver with Umfpack linear solver
line 13, file <x>: evaluating MY_FUNCTION(40) yields, 0.8
warning, no dof owners are defined
MBDyn terminated normally

Cheers, p.


More information about the MBDyn-users mailing list