# Transient calculation

### Calculation at a section

#### Discretization for Preissmann Scheme

The advection equation (without diffusion) for drift classes is :

Preissmann scheme discretization equations are :

We note :

These equations for section j+1 at time k+1 yield :

The transport equation can be rewritten as since is given by the upstream condition.

#### Resolution by conjugate gradient method

This equation is solved using a conjugate gradient method, requiring the computation of a Jacobian matrix.

Let . The equation is solved by minimizing , using the conjugate gradient method. One need to calculate the partial derivatives of exchange terms with respect to every quality class in order to calculate ’s Jacobian matrix which gives ’s gradient .

### Discretization at a node

#### Mass balance at a node

The mass balance equation at a node is integrated between et :

This integral is calculated using the trapezoidal rule formula :

The source term E is the only non-linear term in this equation.

#### Newton’s method for a node with a pond

Let be the result of the integration at the ith iteration.

Newton’s method gives :

If where is constant over iterations et we get :

We define

and

yielding :

and

The derivative with respect to is :

As is a vector, this equation is true for every quality class .

The different equations may be interdependent due to the exchange rate E.

As a consequence, matrix a is non-diagonal due to E’. If this term is negligible compared to the others, the Newton’s method can still solve the system.

### Calculation at a node without a pond

A node without a pond is a nodes where the volume (or area) of the pod is zero at time k+1 and k.

The equation is then linear and the exact result is found within one Newton iteration. If distribution coefficients are heterogeneous, they are adjusted to ensure mass balance at the node.

The formula for is :

Equations for a node with a pond are :

et

And :