variable change from kout to kstp(ng) when compling

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
xiaozhu557
Posts: 62
Joined: Fri Sep 11, 2009 1:48 pm
Location: nmefc

variable change from kout to kstp(ng) when compling

#1 Unread post by xiaozhu557 »

Hello Everyone,
I found some variables name changed while compling from *.F to *.f90. Such as
in the file wrt_his.F Line 509

Code: Select all

        status=nf_fwrite3d(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idUvel), &
     &                     HIS(ng)%Rindex, gtype,                       &
     &                     LBi, UBi, LBj, UBj, 1, N(ng), scale,         &
# ifdef MASKING
     &                     GRID(ng) % umask_io,                         &
# endif
     &                     OCEAN(ng) % u(:,:,:,NOUT))
but in the file wrt_his.f90, it is as follow

Code: Select all

status=nf_fwrite3d(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idUvel), &
     &                     HIS(ng)%Rindex, gtype,                       &
     &                     LBi, UBi, LBj, UBj, 1, N(ng), scale,         &
     &                     GRID(ng) % umask_io,                         &
     &                     OCEAN(ng) % u(:,:,:,nrhs(ng)))
NOUT changed to nrhs(ng)

OR in the file wrt_his.F

Code: Select all

status=nf_fwrite2d(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idUbar), &
     &                     HIS(ng)%Rindex, gtype,                       &
     &                     LBi, UBi, LBj, UBj, scale,                   &
#ifdef MASKING
     &                     GRID(ng) % umask_io,                         &
#endif
     &                     OCEAN(ng) % ubar(:,:,KOUT))
but in the file wrt_his.f90, it is as follow

Code: Select all

status=nf_fwrite2d(ng, iNLM, HIS(ng)%ncid, HIS(ng)%Vid(idUbar), &
     &                     HIS(ng)%Rindex, gtype,                       &
     &                     LBi, UBi, LBj, UBj, scale,                   &
     &                     GRID(ng) % umask_io,                         &
     &                     OCEAN(ng) % ubar(:,:,kstp(ng)))
KOUT changed to kstp(ng)

Anyone know what is the reason for that? Thanks.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: variable change from kout to kstp(ng) when compling

#2 Unread post by kate »

This is happening in the C preprocessor stage and is entirely intentional. If you look in globaldefs.h, you see:

Code: Select all

/*
** Set output index for multi-time levels variables.
*/

#ifdef SOLVE3D
# if defined TANGENT || defined TL_IOMS
#  define TKOUT kstp(ng)
#  define KOUT kstp(ng)
#  define NOUT nrhs(ng)
# else
#  define KOUT kstp(ng)
#  define NOUT nrhs(ng)
# endif
#else
# if defined TANGENT || defined TL_IOMS
#  define TKOUT kstp(ng)
# endif
# define KOUT knew(ng)
#endif
So we want one thing with the tangent linear, something else otherwise.

Post Reply