[MBDyn-users] When SimulationEntity::Update is called/should be called

Pierangelo Masarati masarati at aero.polimi.it
Wed Jul 4 18:40:36 CEST 2012

On 07/04/2012 03:24 PM, Resch Reinhard wrote:
> Dear Mr. Masarati,
> I would like to know the exact specification of the following member
> function:
> void SimulationEntity::Update(const VectorHandler& XCurr, const
> VectorHandler& XPrimeCurr);
> Can I be sure that this member function is called automatically
> before AssRes and AssJac are called, or should I call it directly
> from within AssRes and AssJac in order to compute internal variables
> or update internal states?
> Some elements compute internal variables inside AssRes and reuse it
> in AssJac and possible in dGetPrivData and Output. Can I be sure that
> AssRes is always called before AssJac, dGetPrivData and Output?
> Otherwise internal variables have to be computed three times:
> 1.  Update
> 2.  AssRes
> 3.  AssJac

Update() was originally intended to be called only after each iteration 
during the solution for a time step.  So yes, it is always called before 
AssRes() (and implicitly before AssJac(), which always occurs after 
AssRes(), when needed; it is not called, for example, when convergence 
is achieved after AssRes(), or when using modified Newton-Raphson, such 
than a Jacobian matrix factorization is reused for multiple iterations).

It is guaranteed that the state and its derivative (XCurr and 
XPrimeCurr) are updated as soon as a new increment is obtained from each 
linear solution.  However, many elements with internal states (typically 
joint elements) do not provide an Update() method; they rather count on 
the fact that AssRes() is always called for each iteration, and AssJac() 
is always preceded by a call to AssRes(), to update their internal 
states directly from XCurr/XPrimeCurr received within AssRes().

Private data are a separate issue.  First of all, they were introduced 
way after the design of the basic interface.  Furthermore, in many cases 
they are not intended to use updated information until convergence. 
However, in many cases they need to provide the best estimate of 
aggregate information based on internal states and so.  For this reason, 
for example, many joints perform expensive and duplicate calculations to 
update relative orientation or angular velocity info.  This design is 
justified by the fact that private data are seldom used, and thus they 
are only computed when needed.

Hope this helps.

Cheers, p.

Pierangelo Masarati
Associate Professor
Dipartimento di Ingegneria Aerospaziale
Politecnico di Milano

More information about the MBDyn-users mailing list