Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Dymola to solve DAEs, why use the DASSL algorithm after performing the Patelides algorithm?

I am confused about the solving DAEs process in Dymola. So I made an example to explore it.
Here is the screenshot of the example scheme and control equations

enter image description here

Based on the following definition of variables, I think the solving DAEs process is to

  1. choose the state variables
  2. using an integrator to calculate the state variables according to their derivatives.
  3. calculate the other variables.

enter image description here

I build the model in Dymola with the following debug settings.

enter image description here

Since the DAE's index in my model is 3, there is a need to do index reduction, after using the Pantelides Algorithm, Dymola would adding more differentiated equations to the DAE system.
The translate log verified my deduction. enter image description here

enter image description here enter image description here

Now, according to the equation browser, it is apparent the DAE system has been modified into a BLT form, I think I could just use the newton method with the current equation system, but Dymola would use the DASSL algorithm. And apparently, DASSL would do build the Structural Jacobian Matrix from scratch again, so during the initialization(using Pantelides Algorithm) and simulation(using DASSL Algorithm) processes, different Structural Jacobian Matrix would be used.

enter image description here

My question is:
After using Pantelides Algorithm to do index reduction and partitioning, I could solve the equations with Newton Method, but why does Dymola have to do partitioning again and use DASSL Algorithm?

enter image description here

In addition, I compared the Structural Jacobian Matrix in initialization and simulation process in Wolfram System Modeler, which showed these two matrices are different.

enter image description here

like image 774
Jack Avatar asked Dec 13 '22 07:12

Jack


1 Answers

I think there are actually two things that are important to understand the overall process:

  1. The system of equations is different for initialization and for simulation. The reason is e.g. found in the Modelica Language Specification 3.4 in Section 8.6:

During this phase, also the derivatives, der(..), and the pre-variables, pre(..), are interpreted as unknown algebraic variables. The initialization uses all equations and algorithms that are utilized in the intended operation...

Basically, a different set of unknowns (and respective equations) results in two separated problems to solve for initialization and during simulation. As far as I know symbolic processing (incl. Pantelides algorithm) is applied to simplify both problems. As an example: Translating Modelica.Blocks.Examples.PID_Controller results in the following translation log, which separates the two aspects (Note: the "Translated Model" and the "Initialization problem" being different):

enter image description here

  1. After a consistent solution for the initial problem is found (e.g. using a Newton Method), the actual integration starts. What DASSL does after the initialization is finished, is the same as every other solver for dynamic simulation: Computing the state vector for the next simulation step, using information from the current step and the derivatives computed by the model equations (and in case of DASSL and some others, future values as DASSL uses a BDF algorithm which is implicit, see e.g. here).

One thing that is special about DASSL, though not unique, is that DASSL has two interfaces which can be used during simulation: It can work with an ODE description of the system (after it has been transformed e.g. by the symbolic pre-processing of Dymola) or it can use a DAE description (by setting Advance.Define.DAEsolver=true;). By default, the ODE interface is used. Both have advantages, the Dymola Manual states:

When DAE solver is enabled the equations in the output and dynamics section of the model are not solved during calls to the model. They are instead handled by the integrator as part of the nonlinear system of equations that the integrator solves each step. If the translated model contains several or large nonlinear equation systems, then DAE solvers may be more efficient since fewer nonlinear systems are solved.

like image 132
Markus A. Avatar answered Dec 28 '22 06:12

Markus A.