Index: branches/UKMO/dev_r5518_nemo_fabm_ukmo/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- branches/UKMO/dev_r5518_nemo_fabm_ukmo/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 7827)
+++ branches/UKMO/dev_r5518_nemo_fabm_ukmo/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 7829)
@@ -25,4 +25,7 @@
    USE trcnam_c14b       ! C14 SMS namelist
    USE trcnam_my_trc     ! MY_TRC SMS namelist
+   ! +++>>> FABM
+   USE trcnam_fabm       ! FABM SMS namelist
+   ! FABM <<<+++
    USE trd_oce       
    USE trdtrc_oce
@@ -34,4 +37,10 @@
    PUBLIC trc_nam_run  ! called in trcini
    PUBLIC trc_nam      ! called in trcini
+   PUBLIC trc_nam_dia
+#if defined key_trdmxl_trc  || defined key_trdtrc
+   NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
+      &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
+      &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
+#endif
 
    !! * Substitutions
@@ -57,4 +66,8 @@
       !!---------------------------------------------------------------------
       INTEGER  ::   jn                  ! dummy loop indice
+#if defined key_trdmxl_trc  || defined key_trdtrc
+      INTEGER :: ios
+#endif
+
       !                                        !   Parameters of the run 
       IF( .NOT. lk_offline ) CALL trc_nam_run
@@ -168,4 +181,10 @@
       ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
       ENDIF
+
+      ! +++>>> FABM
+      IF( lk_fabm    ) THEN   ;   CALL trc_nam_fabm        ! FABM tracers
+      ELSE                    ;   IF(lwp) WRITE(numout,*) '          FABM not used'
+      ENDIF
+      ! FABM <<<+++
       !
    END SUBROUTINE trc_nam
@@ -187,5 +206,5 @@
 
 
-      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
+      IF(lwp) WRITE(numout,*) 'trc_nam_run : read the passive tracer namelists'
       IF(lwp) WRITE(numout,*) '~~~~~~~'
 
@@ -234,5 +253,10 @@
 
       ! --- Namelist declarations --- !
-      TYPE(TRC_I_NML), DIMENSION(jptra) :: sn_tri_tracer
+      ! --->>> FABM
+      !TYPE(TRC_I_NML), DIMENSION(jptra) :: sn_tri_tracer
+      ! FABM <<<--- 
+      ! +++>>> FABM
+      TYPE(TRC_I_NML), DIMENSION(jpmaxtrc) :: sn_tri_tracer
+      ! FABM <<<+++ 
       NAMELIST/namtrc_ice/ nn_ice_tr, sn_tri_tracer
 
@@ -278,7 +302,12 @@
       !!
       !!---------------------------------------------------------------------
-      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
-      !!
-      NAMELIST/namtrc/ sn_tracer, ln_trcdta,ln_trcdmp, ln_trcdmp_clo
+      ! --->>> FABM
+      !TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
+      ! FABM <<<---
+      ! +++>>> FABM
+      TYPE(PTRACER), DIMENSION(jpmaxtrc) :: sn_tracer  ! type of tracer for saving if not key_iomput
+      ! FABM <<<+++
+      !!
+      NAMELIST/namtrc/ sn_tracer, ln_trcdta, ln_trcdmp, ln_trcdmp_clo
   
       INTEGER  ::   ios                 ! Local integer output status for namelist read
@@ -286,7 +315,15 @@
       !!---------------------------------------------------------------------
       IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
+      IF(lwp) WRITE(numout,*) 'trc_nam_trc : read the passive tracer namelists'
       IF(lwp) WRITE(numout,*) '~~~~~~~'
 
+      ! Initialise logical flags to .FALSE.:
+      sn_tracer(:)%llinit = .FALSE.
+      sn_tracer(:)%llsave = .FALSE.
+#ifdef key_fabm
+      sn_tracer(:)%llsbc = .FALSE.
+      sn_tracer(:)%llcbc = .FALSE.
+      sn_tracer(:)%llcbc = .FALSE.
+#endif
 
       REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
@@ -304,7 +341,20 @@
          ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  )
          ln_trc_ini(jn) =       sn_tracer(jn)%llinit
+! --->>> FABM
+!!#if defined key_my_trc
+! FABM <<<---
+! +++>>> FABM
+#if defined key_fabm
+! FABM <<<+++
+         ln_trc_sbc(jn) =       sn_tracer(jn)%llsbc
+         ln_trc_cbc(jn) =       sn_tracer(jn)%llcbc
+         ln_trc_obc(jn) =       sn_tracer(jn)%llobc
+#endif
          ln_trc_wri(jn) =       sn_tracer(jn)%llsave
       END DO
-      
+     
+      ! +++>>> FABM
+      if (lk_fabm) CALL trc_nam_fabm_override
+      ! FABM <<<+++
     END SUBROUTINE trc_nam_trc
 
@@ -322,7 +372,7 @@
       INTEGER ::  ierr
 #if defined key_trdmxl_trc  || defined key_trdtrc
-      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
-         &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
-         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
+!     NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
+!        &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
+!        &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
 #endif
       NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
@@ -330,8 +380,4 @@
       INTEGER  ::   ios                 ! Local integer output status for namelist read
       !!---------------------------------------------------------------------
-
-      IF(lwp) WRITE(numout,*) 
-      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
-      IF(lwp) WRITE(numout,*) '~~~~~~~'
 
       IF(lwp) WRITE(numout,*)
@@ -397,3 +443,3 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!======================================================================
-END MODULE  trcnam
+END MODULE trcnam
