[MBDyn-users] convergence check

Pierangelo Masarati pierangelo.masarati at polimi.it
Mon Nov 10 21:55:58 CET 2014

On 06/11/2014 16:00, Louis Gagnon wrote:
> Dear fellow users, dear Pierangelo,
> I'd like to know whether there exists in MBDyn a simple method to check
> the simulation for a periodic convergence?
> I'm assuming not because it is a time consuming task but I thought I'd
> ask anyway...
> I am thinking of it as a way to end the simulation when, over iterations
> "end-n" to "end" the average value of a selected output is within a
> desired percent of the average value of the same output over "end-2n" to
> "end-n" where n would be the number of timesteps in a cycle (user-defined).

Hi.  There's nothing like that, but it can be easily added.  You need to 
define a user function that is called at the end of each time step.  A 
user element would be fine, although a little bit of an overkill.

In this element, you create a queue as long as needed, and after 
convergence (e.g. in the AfterConvergence() call) you store what you 
need for convergence test (e.g. some scalar or vector measurement).

As soon as your queue fills, you start checking for convergence (I 
presume you need to compute the difference between your measurement at 
the last n times and its value at the previous n times), and compute 
some norm of it, and some convergence test.

Inside your object, you need to add a member of class "Converged", and 
call it as c.Set(Converged::CONVERGED) at convergence.  That's it.  You 
can find a minimal example usage in extforce.{h,cc}.

Ciao, p.

Pierangelo Masarati
Associate Professor
Dipartimento di Scienze e Tecnologie Aerospaziali
Politecnico di Milano

More information about the MBDyn-users mailing list