# Feature: Improve the computation of MDA residuals

The role of the MDA is to solve for `y_1, \dots y_m`

the equation,

`R(x, y_1, \dots, y_m) = 0.`

The residual vector `R(x, y_1, \dots, y_m) \in \mathbb{R}^n`

is the concatenation of sub-residuals associated with the different disciplines involved in the MDA, that is

`R = \begin{bmatrix} r_1\\ \vdots \\ r_m \end{bmatrix}.`

The convergence of the MDA is monitored by checking how close to zero the residual is, and there are several options for defining the stopping criterion.

# Existing scaling strategies

Currently, the convergence of the MDA can be monitored using 3 different stopping crtierion.

### No scaling

The MDA is considered converged whenever,

`\left\| R^{(k)} \right\|_2 \leq \text{tol}. \tag{Criterion 1}`

### Initial residual norm

The MDA is considered converged whenever,

`\frac{ \left\| R^{(k)} \right\|_2 }{ \left\| R^{(0)} \right\|_2 } \leq \text{tol}. \tag{Criterion 2}`

### Number of coupling variables

The MDA is considered converged whenever,

`\frac{ \left\| R^{(k)} \right\|_2 }{ \sqrt{n} } \leq \text{tol}. \tag{Criterion 3}`

# New proposed scaling strategies

Since the residual vector `R^{(k)}`

has a block structure, if the blocks have various order of magnitude, then the ratio `||R^{(k)}||_2 / ||R^{(0)}||_2`

can be driven down only by the blocks with the largest magnitude, the ones with smaller magnitude having a negligible contribution to the norm. To remedy this, one may consider additional scaling strategies. From now, `\div`

denote the component wise division between two vectors.

### Initial sub-residual norm

The MDA is considered converged whenever,

`\frac{ \left\| r_i^{(k)} \right\|_2 }{ \left\| r_i^{(0)} \right\|_2 } \leq \text{tol}, \quad \text{for all} \quad 1 \leq i \leq m. \tag{Criterion 4}`

### Initial residual component

If we denote `R^{(k)}_j`

the `j`

-th component of `R^{(k)}`

, then the MDA is considered converged whenever,

` \left| \frac{R^{(k)}_j}{R^{(0)}_j} \right| \leq \text{tol} \quad \text{for all} \quad 1 \leq j \leq n, \quad \iff \quad \left\| R^{(k)} \div R^{(0)} \right\|_{\infty} \leq \text{tol} \tag{Criterion 5}`

### Normalized component wise ratio.

The MDA is considered converged whenever,

`\frac{1}{\sqrt{n}} \, \left\| R^{(k)} \div R^{(0)} \right\|_2 \leq \text{tol}, \quad \text{for all} \quad 1 \leq i \leq m. \tag{Criterion 6}`

# Comparison of the criteria

From the above propositions, one has

`\text{Criterion 5 } \implies \begin{cases} ~\text{Criterion 4 } \implies \text{ Criterion 2} \\[0.25cm] ~\text{Criterion 6} \end{cases}`

The reciprocal are false precisely in cases where there are different order of magnitudes between the components.