# Section 4.3: Differential Algebraic Equations Systems

As should be clear from the discussion of systematic model construction in section 4.2, all `real' models involve a mixture of differential and algebraic equation, which is formally described as a system of differential-algebraic equations or d.a.e.s.

## Introduction

D.a.e.s have properties which are a mixture of those of o.d.e.s and algebraic equations, and in general may require a combination of solution techniques. We will deal here only with the simplest case of d.a.e.s, for which solution is straightforward provided certain conditions are met. There are possible complications which we will not discuss here.

If the following conditions are met, then solution of a set of d.a.e.s can be handled simply as described below.

1. The system contains only algebraic equations and o.d.e.s with a single independent variable (normally time).
2. There are as many equations in total, either differential or algebraic, as there are variables excluding the independent variable.
3. Initial values are given for as many variables as there are o.d.e.s.
4. All variables which do not appear as derivatives occur at least once in the algebraic equations.
5. The algebraic equation subset may be solved using the normal methods available for a.e.s. if values are known for all variables which appear as derivatives.

We will also assume the following additional restrictions which are not fundamental but which make solution very straightforward:

• initial values are given for all variables which appear as derivatives, and
• the algebraic subset is amenable to non-iterative `direct' solution as described in section 3.1.

## Algorithm for D.A.E. Solution

Consider first the following arbitrary set of 4 d.a.e.s:

dx/dt = w - y
dy/dt = y - x
z = y - x
w = z - xº

With initial conditions:
x=1 and
y=0 at t=0

Note that:

• There are only a.e.s and o.d.e.s with one independent variable t.
• There are 4 equations and 4 variables w, x, y, z
• There are 2 o.d.e.s and two initial conditions are given.
This satisfies conditions 1-3 given above. Furthermore:
• In the 2 o.d.e.s x and y appear in derivatives. These will be referred to as the differential variables.
• The remaining variables w and z, which we will call the algebraic variables both appear in the two a.e.s.
• Thus if values were known for the differential variables, the algebraic subset would consist of two equations in two unknowns and would, in principle, be solvable.
We have thus satisfied all the main conditions. Additionally in this example:
• Initial conditions are given for both the differential variables.
• The a.e.s are already both written as formulas which enable the two algebraic variables to be calculated directly.
The solution algorithm involves three steps, one of which is performed only once, at the start of the solution procedure. The other two must each be carried out at each timestep.

Initialisation (once only):

• Initial conditions being given for the differential variable, the a.e.s can be solved for the algebraic variables.
• The values of all variables are now known at time t=0.
The next two steps must be performed at each timestep. The procedure starts with values for all variables known at a general time t and finishes with them calculated at the `new' time (t+dt).

O.D.E solution:

• All variables are known at time t (time t = 0 on the first step)
• The right hand sides of the o.d.e.s, from which values of derivatives can be calculated, are evaluated and the derivatives determined.
• The ``new' values of the differential variables are calculated by a suitable o.d.e. solving procedure, e.g. using:
y(t + dt ) = y (t) + dy = y (t) + dy(t)/dt dt
• After this has been performed for all o.d.e.s the values of the differential variables are known at time (t+dt).
Algebraic equation solution:
• The differential variable values being calculated above, the a.e.s. now involve only the algebraic variables as unknowns.
• Solve the a.e.s
• All variables are now known at time (t+dt).
Notice that the final step is actually the same as the initialisation, namely solving a set of algebraic equations. If we are given initial values for the differential variables then it in fact involves solving the identical set of equations for the identical variables. In many practical problems the steps differ in detail because the initial conditions are not given as values of the differential variables. This is quite acceptable so long as the correct number of conditions is given. The Repeated a.e. solution step however always involves solving for the algebraic variables. In many practical problems an iterative solution will be required.

## Example

A simple system of two o.d.e.s and one a.e. is given under the description of our modelling system. (section L2.3).

This illustrates both the nature of a d.a.e. system and the approach to its solution.