﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
766	Minor update to facilitate multi-model coupling	arango		"* The internal CPP option '''ATM_COUPLING''' is renamed to '''FRC_COUPLING''' since it is possible to couple to an atmospheric model or a data model ('''DATA_COUPLING''') for the same forcing fields.  It is done to consolidate with the coupling research branch that uses the ESMF/NUOPC library.

* Introduced CPP option '''ROMS_STDOUT''' to redirect ROMS standard output information to file '''log.roms'''.  It coupling is advantageous to separate the standard output information of all the coupled Earth System Model (ESM) components to different log files.  It is easier to track the solution of each ESM component when they are separated.  In '''inp_par.F''', we now have:
 {{{
#ifdef ROMS_STDOUT
!
!  Change default Fortran standard out unit, so ROMS run information is
!  directed to a file. This is advantageous in coupling applications to
!  ROMS information separated from other models.
!
       stdout=20                      ! overwite Fortran default unit 6
!
       OPEN (stdout, FILE='log.roms', FORM='formatted',                 &
     &       STATUS='replace')
#endif
}}}
 Changed several routines to replace '''PRINT''' statements with '''WRITE (stdout,*)'''.

* Update ROMS Nonlinear model driver '''nl_ocean.h''' to provide the correct information to time stepping kernel during model coupling:
 {{{
!
!  Local variable declarations.
!
#if defined MODEL_COUPLING && !defined MCT_LIB
      logical, save :: FirstPass = .TRUE.
#endif
      integer :: ng
#if defined MODEL_COUPLING && !defined MCT_LIB
      integer :: NstrStep, NendStep
#endif
      real (r8) :: MyRunInterval
!
!-----------------------------------------------------------------------
!  Time-step nonlinear model over all nested grids, if applicable.
#if defined MODEL_COUPLING && !defined MCT_LIB
!  On first pass, add a timestep to the coupling interval to account
!  for ROMS kernel delayed delayed output until next timestep.
#endif
!-----------------------------------------------------------------------
!
      MyRunInterval=RunInterval
      IF (Master) WRITE (stdout,'(1x)')
      DO ng=1,Ngrids
#if defined MODEL_COUPLING && !defined MCT_LIB
        step_counter(ng)=0
        NstrStep=iic(ng)
        IF (FirstPass) THEN
          NendStep=NstrStep+INT((RunInterval+dt(ng))/dt(ng))
          IF (ng.eq.1) MyRunInterval=MyRunInterval+dt(ng) 
          FirstPass=.FALSE.
        ELSE
          NendStep=NstrStep+INT(MyRunInterval/dt(ng))
        END IF
        IF (Master) WRITE (stdout,10) 'NL', ng, NstrStep, NendStep
#else
        IF (Master) WRITE (stdout,10) 'NL', ng, ntstart(ng), ntend(ng)
#endif
      END DO
      IF (Master) WRITE (stdout,'(1x)')
!
!$OMP PARALLEL
#ifdef SOLVE3D
      CALL main3d (MyRunInterval)
#else
      CALL main2d (MyRunInterval)
#endif
!$OMP END PARALLEL
}}}
 Recall that '''!MyRunInterval''' may span the full period of the simulation, a multi-model coupling interval ('''!RunInterval > ifac*dt'''), or just a single step ('''!RunInterval=0'''). The zero value here is valid and can be explained by ROMS design of delayed output."	upgrade	closed	major	Release ROMS/TOMS 3.7	Nonlinear	3.7	Done		
