Bugs in Adjoint model code

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
alanberry
Posts: 8
Joined: Thu May 31, 2007 2:33 pm
Location: Marine Institute of Ireland
Contact:

Bugs in Adjoint model code

#1 Unread post by alanberry »

Hi,

I am using ROMS 3.7 (svn 678) checked out 31/07/2013
I have come across a few coding errors/omissions in various parts of the Adjoint model codes when trying to compile for my specific case study.
The errors are cpp defintion specific, so may not have arisen to date on the bundled test cases.
They relate to UV_VIS4 / TS_MPDATA / TCLIMATOLOGY and are;

ad_pre_step3d.F: from line 1604
should include the code between the ***-> <-*** markers, below:

Code: Select all

          DO k=1,N(ng)-1
	   ****-> DO i=Istr,Iend <-****
              cff1=MAX(W(i,j,k),0.0_r8)
              cff2=MIN(W(i,j,k),0.0_r8)
!>            tl_FC(i,k)=tl_cff1*t(i,j,k  ,nstp,itrc)+                  &
!>   &                   cff1*tl_t(i,j,k  ,nstp,itrc)+                  &
!>   &                   tl_cff2*t(i,j,k+1,nstp,itrc)+                  &
!>   &                   cff2*tl_t(i,j,k+1,nstp,itrc)
!>
              ad_t(i,j,k  ,nstp,itrc)=ad_t(i,j,k  ,nstp,itrc)+          &
     &                                cff1*ad_FC(i,k)
              ad_t(i,j,k+1,nstp,itrc)=ad_t(i,j,k+1,nstp,itrc)+     ***->&<-***
     &                                cff2*ad_FC(i,k)
              ...
              ...
ad_step2d_LF_AM3.h requires the inclusion of:

Code: Select all

# ifdef UV_VIS4
      USE mod_ncparam
# endif
to pass the parameters isUbar and isVbar, as used from line 2235.

Code: Select all

IF (.not.(CompositeGrid(iwest,ng).or.EWperiodic(ng))) THEN
          IF (DOMAIN(ng)%Western_Edge(tile)) THEN
            IF (ad_LBC(iwest,isUbar,ng)%closed) THEN
              ...
              ...
ad_uv3dmix4_s.h and ad_uv3dmix4_geo.h require the inclusion of:

Code: Select all

USE mod_ncparam
so as to pass in the parameters isUvel and isVvel as used from line 330 (ad_uv3dmix4_s.h)

Code: Select all

        IF (.not.(CompositeGrid(iwest,ng).or.EWperiodic(ng))) THEN
          IF (DOMAIN(ng)%Western_Edge(tile)) THEN
            IF (ad_LBC(iwest,isUvel,ng)%closed) THEN
              ...
              ...
and line 855 (ad_uv3dmix4_geo.h).

Code: Select all

      IF (.not.(CompositeGrid(iwest,ng).or.EWperiodic(ng))) THEN
        IF (DOMAIN(ng)%Western_Edge(tile)) THEN
          IF (ad_LBC(iwest,isUvel,ng)%closed) THEN
        ...
        ...
ad_set_data.F needs to declare 'ic' as an integer, as used on line 1132 when setting tracer climatology.

Code: Select all

#  ifdef ANA_TCLIMA
      CALL ana_tclima (ng, tile, iADM)
#  else
      ic=0
      DO itrc=1,NT(ng)
        ...
        ...
I have implemented the required code changes and everything compiles successfully.
I'm not too sure how to log these as tickets, etc, so hopefully they can be passed on through here.

Regards,
Alan.

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

Re: Bugs in Adjoint model code

#2 Unread post by arango »

Yes, good catch. We haven't fully coded the adjoint of TS_MPDATA. This advection scheme is highly nonlinear and probably the tangent linear will be unstable. In ROMS, we can have different advection options for the nonlinear code and the adjoint/tangent algorithms.

alanberry
Posts: 8
Joined: Thu May 31, 2007 2:33 pm
Location: Marine Institute of Ireland
Contact:

Re: Bugs in Adjoint model code

#3 Unread post by alanberry »

Hernan,

Thanks for the heads-up on the adjoint TS_MPDATA.

We are commencing experiments with IS4DVAR to see if it can lead to improvements in our operational modelling capabilites.
Initially we are setting up the IS4DVAR model with the same cppdefs as our op model to assess stability, compute times, etc.
I imagine there will need to be a range of modifications to our initial definitions as we proceed in our testing (TS_MPDATA point in case).

Regards,
Alan.

Post Reply