[Mitgcm-support] Re: TAF bug for tangent linear

mitgcm-support at dev.mitgcm.org mitgcm-support at dev.mitgcm.org
Wed Jul 9 15:49:51 EDT 2003


Ralf,

I've solved the second problem which I mentioned below
(wrong forward vs. finite diff. gradients).
It's related to the active file handling.
The tangent linear code reads the perturbation for both e.g.
theta and g_theta from the same file xx_theta,
thus applying the (delta xx)_i = 1. perturbation
to both fields instead of only to g_theta.

(in adjoint mode there's a separation between
xx_theta and adxx_theta).

I guess, a similar split might be useful in forward mode.
I'll look into it further.

Patrick

Patrick Heimbach wrote:

> Hi Ralf,
> 
> there is a problem with the forward mode of TAF
> when exploiting self-adjointness.
> 
> What happens is that in S/R g_solve_for_pressure
> cg2d is called first to compute the g_... quantities
> (g_cg2d_b,g_cg2d_x),
> then called again to calculate the actual state
> (cg2d_b,cg2d_x).
> Before the second call the indices should be reset, thus
>       firstresidual = 0.
>       lastresidual = 0.
>       numiters = cg2dmaxiters
> but the reset is missing.
> 
> The flow directive should have the information,
> since the correct resetting is done in the adjoint code:
> 
> C----------------------------------------
> C subroutine  cg2d
> C----------------------------------------
> CADJ SUBROUTINE cg2d ADNAME  = cg2d
> CADJ SUBROUTINE cg2d FTLNAME = cg2d
> CADJ SUBROUTINE cg2d INPUT   = 1,2,3,4,5,6
> CADJ SUBROUTINE cg2d OUTPUT  =   2,3,4,5
> CADJ SUBROUTINE cg2d ACTIVE  = 1,2
> CADJ SUBROUTINE cg2d DEPEND  =           6
> 
> Another issue (or, why I do all this) is that
> I try to do forward mode vs. finite difference gradient checks.
> Assuming that
>    g_fc = (grad J)_(ith-component) * (delta xx)_(ith-component)
> I should be able to recover (grad J)_(ith-component)
> by setting
>    (delta xx)_(ith-component) = 1.
> (all others = 0.).
> Well, I get the correct order of magnitude,
> but not really correct gradients.
> Do you have an idea what else could go wrong
> (I've tried it with my above hand-fix).
> 
> Cheers
> Patrick
> 


-- 
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Patrick Heimbach     Massachusetts Institute of Technology
FON: +1/617/253-5259                    EAPS, Room 54-1518
FAX: +1/617/253-4464               77 Massachusetts Avenue
mailto:heimbach at mit.edu                 Cambridge MA 02139
http://www.mit.edu/~heimbach/                       U.S.A.




More information about the MITgcm-support mailing list