# [MITgcm-support] MITgcm tangent linear

Patrick Heimbach heimbach at mit.edu
Mon Feb 26 22:21:05 EST 2018

```Antoine,

the old manual (prior to move to readthedocs) has some documentation of the underlying algebra (old chapter 5), although admittedly the tangent linear mode has not been covered much since it has been used for very few science applications; focus has thus been on documenting the adjoint (reverse mode), and which is now also a bit out-of-date (although basic principles still apply).

For the adjoint you seed the adjoint of the dependent variable. So for the scalar dependent variable (=cost function) fc, you seed adfc = 1, and obtain the adjoint state as the dual of variables xx_..., i.e. the field adxx_...

For the tangent linear mode, instead, you seed the tangent linear of the independent variables xx_..., i.e. you provide values for fields g_xx_...
The result of the tangent linear would be in variable g_fc
However, you typically are interested, not in a scalar-valued cost function fc, but in a vector-valued cost function (the state of which you'd like to compute your eigenmodes). We provide this option by defining vector-valued variable objc_state_final, and so the output of the TLM model would be stored in variable g_objc_state_final.

* provide initial perturbation to the TLM model via variables g_xx (that's via the ctrl package),
* obtain the output of the TLM run in variable g_fc (or rather g_objc_state_final), which is defined in the cost package.

The gradient check package tests the TLM functionality for 19 verification experiments, and they all seem to work as of yesterday, see e.g.:
http://mitgcm.org/public/testing.html
and look for Type "tanglin-taf"

We (Zanna et al., 2010,2011,2012) have developed a long time ago a package (pkg/admtlm/) for computing the left-hand-side of a generalized eigenvalue problem, i.e. for computing the correct sequence
v = g_xx perturbation vector,
METRIC = metric tensor,
TLM the tangent linear model,
(which is probably what you'd like to do?) and where the optimcycle index is used as iteration counter. The right-hand side is then solved via ARPACK. That package hasn't been maintained and may need some updating to work with the latest code.
If your EV problem L.H.S. is simply
v_{i+1} = TLM*v_{i},
you'll need output of array g_objc_state_final.

The diagnostics package does not output any derivative variable (neither ADM nor TLM), although a student has been working on generalizing diagnostics to enable ADM output via that package (and once it works, extending to the TLM output should be straightforward).

-Patrick

> On Feb 25, 2018, at 2:38 PM, Antoine Hochet <ahochet at ucsd.edu> wrote:
>
> Hi all,
>
> I'd like to use the MITgcm tangent linear (I have a staf licence) to calculate a few eigenmodes of a given steady state. However I am new to MITgcm and I can't find documentation online about the tangent linear... So I am wondering if someone could help me with the following questions:
>
> To calculate the eigenmodes I need to run the tangent linear on the same steady state several times, using output of iteration number n as the new initial perturbation of iteration number n+1. However I am not sure to understand how I can control the initial perturbation and get the tangent linear ouputs… Is this done with the control and cost packages ?and if yes, how ?
>
> Also It seems that the outputs produced by the diagnostics package with the tangent linear are exactly the same as the outputs produced by the full forward model, is it normal ?
>
> thank you for your help,
>
> Antoine
>
>
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1849 bytes
Desc: not available
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20180227/6eef99a8/attachment.p7s>
```