[MITgcm-devel] global_sum_tile_ad.F

Jean-Michel Campin jmc at ocean.mit.edu
Tue Mar 29 17:12:50 EDT 2011


Hi,

I wrote a simplified version of GLOBAL_SUM_TILE_RL which, except for
truncation errors, gives the same results as the current one.
I pass it through TAF to get the adjoint:

simplified GLOBAL_SUM_TILE_RL subroutine:
      SUBROUTINE GLOBAL_SUM_TILE_RL(
     I                       phiTile,
     O                       sumPhi,
     I                       myThid )
... variable declaration ...
      sumPhi = 0.
      DO bj = myByLo(myThid), myByHi(myThid)
       DO bi = myBxLo(myThid), myBxHi(myThid)
         sumPhi = sumPhi + phiTile(bi,bj)
       ENDDO
      ENDDO
      _GLOBAL_SUM_RL( sumPhi, myThid )

adjoint version from TAF:
      subroutine adglobal_sum_tile_rl( adphitile, adsumphi, mythid )
... variable declaration ...
      call global_adsum_r8( adsumphi,mythid )
      do bj = mybylo(mythid), mybyhi(mythid)
        do bi = mybxlo(mythid), mybxhi(mythid)
          adphitile(bi,bj) = adphitile(bi,bj)+adsumphi
        end do
      end do
      adsumphi = 0.d0

I am going to change pkg/autodiff/global_sum_tile_ad.F, line 64
from:
          adphiTile(bi,bj) = tmp
to:
          adphitile(bi,bj) = adphitile(bi,bj)+tmp

Cheers,
Jean-Michel



More information about the MITgcm-devel mailing list