Last edited Timestamp?

## Principle

The adjoint test checks that the adjoint is the adjoint of the tangent using the adjoint deﬁnition. By definition, given a linear operator A going from a space E to a spece F, and scalar products <.,.>_E, and <.,.>_F in these respective spcaces, the adjoint of A is the linear operator A_ad such that for any vectors (x,y) in the suitable spaces,

```<Ax,y>_F = <x,A_ad y>_E
```

In practice, we apply the comparison to perturbations state vectors dx and dy. We have then to compare:

```<Adx,Wdy>_F = <dx,A_ad Wdy>_E
```

W: diagonal matrix of scale factors

## Requierements

To run the some adjoint test we need the following features:

• a direct trajectory (computed with NEMO)
• additionnal namelist (for instance namtst to setup adjoint test parameter (off or on)

## Initialization

• tangent and adjoint variables initalization
• ramdom noise generation (repeatability)

## Unitary Test

We call unitary test some test involving only one subroutine (or at least a limited set of subroutines). It is performed on a single pertubation state vector dX. There is no time evolution. When needed several configuration are tested (for instance n_cla=0/1, nn_fwb=½…)

• _tan and _adj initialization (means "why we should do _tan(nit000) vs. _adj(nitend)" for instance

## Global Test

The global test involves time evolution by reading foward the trajectory (for the tangent) and then backward (for the adjoint). It concerns mainly the step_tam routine. It is more conmplex as it stressed out:

• initializations
• interactions between routines
• handling of direct trajectory

## MPP test

• handling of domain/domain border for MPP test

## Test Pass Criteria

With the above notations, we note (if exists) the reltive error Err = |<Adx,dy>_F - <dx,A_ad dy>_E | / |<Adx,dy>_F| We compare the relative error (Err) to the epsilon machine Eps. It is passed when Err < 100*Eps and failed otherwise. The adjoint test results output are gathered in the file adjoint_test.output_xxx with the following labels:

``` * Test status is OK               if Err < Eps
* Test status is WARNING   if Eps <= Err < 100*Eps
* Test status is RED ALERT if Err >= 100 *Eps
```

## Results

Currently we perform 51 tests (unitary routines and step_tam routine) with 100% passed rate on the different machines (see list below).

```Test Layout:
- configuration ORCA2 / GYRE
- monodomain
- ndays = 1/2/3/10
```

### Machines description

 Name CPU type RAM (per node) OS Compiler Mirage Itanium 1.4 GHz 4 Go Su Se? Intel 9.0 Abel Itanium 1.4 GHz 4 Go Su Se? Intel 8.1 Marvin Core2Duo 2.8 GHz 4 Go OS X g95 0.91