Problem with compact tracer Rad + Nud boundaries

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Problem with compact tracer Rad + Nud boundaries

#1 Unread post by m.hadfield »

In a post back in April...

viewtopic.php?f=19&t=3326&hilit=compact

...I reported a problem when radiative+nudging boundary conditions were specified for Fennel biological tracers using the compact specification, for example:

Code: Select all

   LBC(isTvar) ==   RadNud  RadNud  RadNud  RadNud \    ! idbio(*)
ROMS reports that the Rad+Nud boundary is used for each variable, as expected, but for all variables other than the first (NO3 in this case) the boundary data are not retrieved and a value of zero is used instead.

I have now found that a very similar problem occurs for regular tracer boundaries. Eg. I attempt to specify radiative+nudging boundaries for temperature, salinity and several passive tracers using the compact form, but the boundary data are retrieved only for temperature (which I noticed when the salinity in my domain went from 35 to zero in ten days!).

This time I have a fix. In file ROMS/Utility/inp_par.F, subroutine LOAD_LBC, lines 1664-1685, there is a block of code that sets boundary flags for the second and subsequent tracers:

Code: Select all

#ifdef SOLVE3D
!
!  If processing tracers and last standard input entry (Icont=0), set
!  unspecified tracer values to the last tracer entry.
!
        IF ((iTrcStr.gt.0).and.(iTrcEnd.gt.0)) THEN
          IF ((Icont.eq.0).and.(ifield.lt.isTvar(iTrcEnd))) THEN
            DO i=ifield+1,isTvar(iTrcEnd)
              DO ibry=1,4
                S(ibry,i,igrid)%clamped   = S(ibry,ifield,igrid)%clamped
                S(ibry,i,igrid)%closed    = S(ibry,ifield,igrid)%closed
                S(ibry,i,igrid)%gradient  = S(ibry,ifield,igrid)%gradient
                S(ibry,i,igrid)%nested    = S(ibry,ifield,igrid)%nested
                S(ibry,i,igrid)%periodic  = S(ibry,ifield,igrid)%periodic
                S(ibry,i,igrid)%radiation = S(ibry,ifield,igrid)%radiation
                S(ibry,i,igrid)%nudging   = S(ibry,ifield,igrid)%nudging
              END DO
              ic=ic+1
            END DO
          END IF
        END IF
#endif
The fix is to add another statement to set the boundary structure's acquire field:

Code: Select all

#ifdef SOLVE3D
!
!  If processing tracers and last standard input entry (Icont=0), set
!  unspecified tracer values to the last tracer entry.
!
        IF ((iTrcStr.gt.0).and.(iTrcEnd.gt.0)) THEN
          IF ((Icont.eq.0).and.(ifield.lt.isTvar(iTrcEnd))) THEN
            DO i=ifield+1,isTvar(iTrcEnd)
              DO ibry=1,4
                S(ibry,i,igrid)%clamped   = S(ibry,ifield,igrid)%clamped
                S(ibry,i,igrid)%closed    = S(ibry,ifield,igrid)%closed
                S(ibry,i,igrid)%gradient  = S(ibry,ifield,igrid)%gradient
                S(ibry,i,igrid)%nested    = S(ibry,ifield,igrid)%nested
                S(ibry,i,igrid)%periodic  = S(ibry,ifield,igrid)%periodic
                S(ibry,i,igrid)%radiation = S(ibry,ifield,igrid)%radiation
                S(ibry,i,igrid)%nudging   = S(ibry,ifield,igrid)%nudging
                S(ibry,i,igrid)%acquire = S(ibry,i,igrid)%clamped.OR.   &
     &                                    S(ibry,i,igrid)%nudging
              END DO
              ic=ic+1
            END DO
          END IF
        END IF
#endif
I have verified this works for the active+passive tracers. It should work for the biological tracers too, as the same function is called there, but I have not checked this.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

Re: Problem with compact tracer Rad + Nud boundaries

#2 Unread post by m.hadfield »

Hang on, the fix can be simpler than that, just copy the value of the boundary structure's acquire field along with the others:

Code: Select all

#ifdef SOLVE3D
!
!  If processing tracers and last standard input entry (Icont=0), set
!  unspecified tracer values to the last tracer entry.
!
        IF ((iTrcStr.gt.0).and.(iTrcEnd.gt.0)) THEN
          IF ((Icont.eq.0).and.(ifield.lt.isTvar(iTrcEnd))) THEN
            DO i=ifield+1,isTvar(iTrcEnd)
              DO ibry=1,4
                S(ibry,i,igrid)%clamped   = S(ibry,ifield,igrid)%clamped
                S(ibry,i,igrid)%closed    = S(ibry,ifield,igrid)%closed
                S(ibry,i,igrid)%gradient  = S(ibry,ifield,igrid)%gradient
                S(ibry,i,igrid)%nested    = S(ibry,ifield,igrid)%nested
                S(ibry,i,igrid)%periodic  = S(ibry,ifield,igrid)%periodic
                S(ibry,i,igrid)%radiation = S(ibry,ifield,igrid)%radiation
                S(ibry,i,igrid)%nudging   = S(ibry,ifield,igrid)%nudging
                S(ibry,i,igrid)%acquire   = S(ibry,ifield,igrid)%acquire  !!!!!!!!!!!!!!!
              END DO
              ic=ic+1
            END DO
          END IF
        END IF
#endif

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

Re: Problem with compact tracer Rad + Nud boundaries

#3 Unread post by arango »

Yes Mark, good catch :!: Thank you.

Post Reply