Tangent Linear Model Recipes

Discussion about tangent linear and adjoint models, variational data assimilation, and other related issues.

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Tangent Linear Model Recipes

#1 Unread post by arango »

ROMS/TOMS has two tangent linear models one is based on perturbations to the model state and the other in full fields. The full fields tangent linear is only used for the indirect representer method.

Let's represent ROMS/TOMS nonlinear model (NLM) as follows:

Code: Select all

      d(S)/d(t) = N(S)                                   (1)
where S is the model state with solution So and N(S) are the dynamical operators (usually nonlinear) like advection, Coriolis, pressure gradient, diffusion, etc. The tangent linear model (TLM) is derived by considering a small perturbation s to S, and performing a first-order Taylor expansion of (1) yielding (high-order terms are not considered):

Code: Select all

      d(s)/d(t) = d{N(S)}/d{t} |  s  = A s               (2)
                                So
The adjoint model (ADM) is derived by considering the L2-norm inner-product of (2) with an arbitrary vector s' yielding:

Code: Select all

     -d(s')/d(t) = A' s'                                 (3)
where A' is the adjoint of A. Similarly, the full fields tangent linear model for representers can be derived as:

Code: Select all

      d(S')/d(t) = N(So) + A (S' - So)                   (4)
In ROMS/TOMS, we derived the representer tangent linear (RPM) code by adding the extra terms to the pertubation tangent linear model defined in (2).

The tangent linear and adjoint models are hand-coded using Geiring and Kaminski (1998) recipes. In the following recipes c is a constant and u, v, x, y are time-dependent model state variables.

Code: Select all

   Nonlinear Code                      Tangent Linear Code
---------------------------          -----------------------------

 f = c                               tl_f = 0

 f = x                               tl_f = tl_x

 f = c * x                           tl_f = c * tl_x

 f = x * x                           tl_f = 2 * x * tl_x

 f = x ** (n)                        tl_f = n * x ** (n-1) * tl_x

 f = x * y                           tl_f = tl_x * y + x * tl_y

 f = 1 / x                           tl_f = - f * f * tl_x

 f = 1 / SQRT(x)                     tl_f = - f * f * f * 0.5 * tl_x

 f = c / x                           tl_f = - c * tl_x / (x * x)
                                          = - f * tl_x / x

 f = x / y                           tl_f = (y * tl_x - x * tl_y) / (y * y)

 f = 1 / (x + y)                     tl_f = - f * f * (tl_x + tl_y)

 f = 1 / ((x + y)*(u + v))           tl_f = - f * f * (tl_x + tl_y) * (u + v)
                                            - f * f * (x + y) * (tl_u + tl_v)

 f = (c + u) / (x + y)               tl_f = + tl_u / (x + y)
                                            - f * f * (tl_x + tl_y)

 f = MAX(x, y)                       tl_f = (0.5 + SIGN(0.5, x - y)) * tl_x +
                                            (0.5 - SIGN(0.5, x - y)) * tl_y

 f = MAX(x, c)                       tl_f = (0.5 + SIGN(0.5, x - c)) * tl_x

 f = MAX(c, x)                       tl_f = (0.5 - SIGN(0.5, c - x)) * tl_x

 f = MIN(x, y)                       tl_f = (0.5 + SIGN(0.5, y - x)) * tl_x +
                                            (0.5 - SIGN(0.5, y - x)) * tl_y

 f = MIN(x, c)                       tl_f = (0.5 + SIGN(0.5, c - x)) * tl_x

 f = MIN(c, x)                       tl_f = (0.5 - SIGN(0.5, x - c)) * tl_x

 f = AINT(x)                         tl_f = 0.0

 f = ANINT(x)                        tl_f = 0.0

 f = MOD(x,y)                        tl_f = 0.0

 f = ABS(x)                          tl_f = SIGN(1.0,x) * tl_x

 f = SIGN(x,y)                       tl_f = SIGN(1.0, x) * SIGN(1.0, y) * tl_x + 0.0 * tl_y
                                          = SIGN(1.0, x) * SIGN(1.0, y) * tl_x
 
 f = SIGN(c,x)                       tl_f = SIGN(1.0, c) * SIGN(1.0, x) * tl_c
                                          = 0.0

 f = SQRT(x)                         tl_f = 0.5 * tl_x / f

 f = SQRT(c/x)                       tl_f = - 0.5 * f * tl_x / x

 f = SQRT(x * x + y * y)             tl_f = (x * tl_x + y * tl_y) / f

 f = LOG(x)                          tl_f = tl_x / x

 f = 1/log(x)                        tl_f = - f * f * (tl_x / x)

 f = EXP(x)                          tl_f = EXP(x) * tl_x

 f = SIN(x)                          tl_f = COS(x) * tl_x

 f = COS(x)                          tl_f = - SIN(x) * tl_x

 f = TAN(x)                          tl_f = tl_x / (COS(x) * COS(x))

 f = TANH(x)                         tl_f = tl_x / (COSH(x) * COSH(x))

 f = SINH(x)                         tl_f = COSH(x) * tl_x

 f = COSH(x)                         tl_f = - SINH(x) * tl_x

 f = ASIN(x)                         tl_f = tl_x / SQRT(1.0 - x * x)

 f = ACOS(x)                         tl_f = - tl_x / SQRT (1.0 - x * x)

 f = ATAN(x)                         tl_f = tl_x / (1.0 + x * x)

 f = ATAN2(x,y)                      tl_f =  (y * tl_x - x * tl_y) / ( x * x + y * y)

So it is just variational calculus 8)
Last edited by arango on Tue May 16, 2006 2:49 pm, edited 3 times in total.

User avatar
arango
Site Admin
Posts: 1367
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Representers tangent linear model recipes

#2 Unread post by arango »

The recipes for the RPM are derived using Taylor series expansion:

Code: Select all

f(x) = f(xo +x')
     = f(xo) + (xo + x') df/dx
This can be illustrated with an example. Consider the product of two state variables x and y and let

Code: Select all

x = xo + x'   and    x' = x - xo   (5) 
y = yo + y'   and    y' = y - yo   (6)
where xo and yo are the basic state values and x' and y' are their perturbations. Then,

Code: Select all

x * y = (xo + x') * (yo + y')
      =  xo * yo + x' * yo + xo * y' + x' * y'

Eliminating prime terms using (5) and (6) and neglecting high order terms involving prime variables  (i.e., x' * y') yield

x * y = xo * yo + (x - xo) * yo + xo * (y - yo)
      = xo * yo + x * yo - xo * yo + xo * y - xo * yo
      = x * yo + xo * y - xo * yo

using the above table nomeclature (tl_x=x, tl_y=y, x=xo and y=yo) we get

 f = x * y                           tl_f = tl_x * y + x * tl_y - x * y
                                          = tl_x * y + x * tl_y - f

Notice that to obtain the RPM from the TLM for the above expression, we just need to subtract x * y which is the same as f.
Therefore, the RPM can be derived by adding/subtracting extra term(s) to the TLM code as shown below.

Code: Select all

   Nonlinear Code                      Representers Tangent Linear Code
---------------------------          ---------------------------------------------

 f = c                               tl_f = c

 f = x                               tl_f = tl_x

 f = c * x                           tl_f = c * tl_x

 f = x * x                           tl_f = 2 * x * tl_x - f

 f = x ** (n)                        tl_f = n * x ** (n-1) * tl_x - (n-1) * f

 f = x * y                           tl_f = tl_x * y + x * tl_y - f

 f = x * y * u                       tl_f = tl_x * y * u + x * (tl_y * u + y * tl_u) - 2 * f 

 f = 1 / x                           tl_f = - f * f * tl_x + 2 * f

 f = 1 / (1 + x)                     tl_f = - f * f * tl_x + f * f * (1 + 2 * x) 

 f = 1 / SQRT(x)                     tl_f = - f * f * f * 0.5 * tl_x + 1.5 * f
                                          = f * (1.5 - f * f * 0.5 * tl_x)

 f = c / x                           tl_f = - f * tl_x / x + 2 * f
                                          = f * (2 - tl_x / x) 

 f = x / y                           tl_f = (y * tl_x - x * tl_y) / (y * y) + f

 f = (x * y) / u                     tl_f = (u * (tl_x * y + x * tl_y) - x * y * tl_u) / (u * u);   same!

 f = 1 / (x * y)                     tl_f = - f * f * (tl_x * y + x * tl_y) + 3 * f

 f = 1 / (x + y)                     tl_f = - f * f * (tl_x + tl_y) + 2 * f
                                          = f * (2 - f * (tl_x + tl_y))

 f = 1 / ((x + y)*(u + v))           tl_f = - f * f * (tl_x + tl_y) * (u + v)
                                            - f * f * (x + y) * (tl_u + tl_v)
                                            + 2 * f

 f = (c + u) / (x + y)

 f = MAX(x, y)                       tl_f = (0.5 + SIGN(0.5, x - y)) * tl_x +
                                            (0.5 - SIGN(0.5, x - y)) * tl_y

 f = MAX(x, c)                       tl_f = (0.5 + SIGN(0.5, x - c)) * tl_x +
                                            (0.5 - SIGN(0.5, x - c)) * c

 f = MAX(c, x)                       tl_f = (0.5 - SIGN(0.5, c - x)) * tl_x +
                                            (0.5 + SIGN(0.5, c - x)) * c
 f = MIN(x, y)

 f = MIN(x, c)                       tl_f = (0.5 + SIGN(0.5, c - x)) * tl_x +
                                            (0.5 - SIGN(0.5, c - x)) * c 

 f = MIN(c, x)                       tl_f = (0.5 - SIGN(0.5, x - c)) * tl_x +
                                            (0.5 + SIGN(0.5, x - c)) * c 
 f = ABS(x)

 f = SQRT(x)                         tl_f = 0.5 * tl_x / f + 0.5 * f
                                          = 0.5 (f + tl_x / f)

 f = SQRT(c/x)                       tl_f = - 0.5 * f * tl_x / x + 0.5 * f
                                          = 0.5 * (f - f * tl_x / x)

 f = SQRT(x * x + y * y)             tl_f = ((x * tl_x + y * tl_y) / f)

 f = LOG(x)

 f = 1/log(x)

 f = EXP(x)                          tl_f = tl_x * f + (1 - x) * f

 f = EXP(c * x)                      tl_f = c * tl_x * f + (1 - c * x) * f

 f = SIN(x)                          tl_f = tl_x * COS(x) + f - x * COS(x)

 f = COS(x)

 f = TAN(x)

 f = SINH(x)

 f = COSH(x)

 f = ASIN(x)

 f = ACOS(x)

 f = ATAN(x)

 f = ATAN2(x,y)

Post Reply