Index: /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPATAM_SRC/mt19937ar.f90
===================================================================
--- /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPATAM_SRC/mt19937ar.f90	(revision 4599)
+++ /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPATAM_SRC/mt19937ar.f90	(revision 4600)
@@ -271,5 +271,5 @@
       l_mtinit = .TRUE.
 
-   END SUBROUTINE mtrand_seedre
+   END SUBROUTINE mtrand_seedread
    
 END MODULE mt19937ar
Index: /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPATAM_SRC/nemogcm_tam.F90
===================================================================
--- /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPATAM_SRC/nemogcm_tam.F90	(revision 4599)
+++ /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPATAM_SRC/nemogcm_tam.F90	(revision 4600)
@@ -38,5 +38,4 @@
    !!   nemo_init      : initialization of the NEMO system
    !!   nemo_ctl       : initialisation of the contol print
-   !!   nemo_closefile : close remaining open files
    !!   nemo_alloc     : dynamical allocation
    !!   nemo_partition : calculate MPP domain decomposition
@@ -88,4 +87,5 @@
    USE tamctl
    USE lib_mpp_tam
+   USE paresp
    !USE tamtrj
    USE trj_tam
@@ -123,5 +123,6 @@
       !                            !-----------------------!
       !                            !==  Initialisations  ==!
-      CALL nemo_init_tam           !-----------------------!
+      CALL nemo_init               !-----------------------!
+      CALL nemo_init_tam         
       !
       ! check that all process are still there... If some process have an error,
@@ -185,152 +186,4 @@
       !!----------------------------------------------------------------------
       !
-      cltxt = ''
-      !
-      !                             ! open Namelist file
-      CALL ctl_opn( numnam, 'namelist', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
-      !!
-      READ( numnam, namctl )        ! Namelist namctl : Control prints & Benchmark
-      !
-      !                             !--------------------------------------------!
-      !                             !  set communicator & select the local node  !
-      !                             !--------------------------------------------!
-      ilocal_comm = 0
-      narea = mynode( cltxt, numnam, nstop )                 ! Nodes selection (control print return in cltxt)
-      narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 )
-
-      lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print
-
-      ! If dimensions of processor grid weren't specified in the namelist file
-      ! then we calculate them here now that we have our communicator size
-      IF( (jpni < 1) .OR. (jpnj < 1) )THEN
-#if   defined key_mpp_mpi
-         IF( Agrif_Root() ) CALL nemo_partition(mppsize)
-#else
-         jpni  = 1
-         jpnj  = 1
-         jpnij = jpni*jpnj
-#endif
-      END IF
-
-      ! Calculate domain dimensions given calculated jpni and jpnj
-      ! This used to be done in par_oce.F90 when they were parameters rather
-      ! than variables
-      IF( Agrif_Root() ) THEN
-         jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci   ! first  dim.
-         jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj   ! second dim.
-         jpk = jpkdta                                             ! third dim
-         jpim1 = jpi-1                                            ! inner domain indices
-         jpjm1 = jpj-1                                            !   "           "
-         jpkm1 = jpk-1                                            !   "           "
-         jpij  = jpi*jpj                                          !  jpi x j
-      ENDIF
-
-      IF(lwp) THEN                            ! open listing units
-         !
-         CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
-         !
-         WRITE(numout,*)
-         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC'
-         WRITE(numout,*) '                       NEMO team'
-         WRITE(numout,*) '            Ocean General Circulation Model'
-         WRITE(numout,*) '                  version 3.4  (2011) '
-         WRITE(numout,*) '                      NEMOTAM '
-         WRITE(numout,*)
-         WRITE(numout,*)
-         DO ji = 1, SIZE(cltxt)
-            IF( TRIM(cltxt(ji)) /= '' )   WRITE(numout,*) cltxt(ji)      ! control print of mynode
-         END DO
-         WRITE(numout,cform_aaa)                                         ! Flag AAAAAAA
-         !
-      ENDIF
-
-      ! Now we know the dimensions of the grid and numout has been set we canhttp://forge.ipsl.jussieu.fr/nemo/changeset/3640
-      ! allocate arrays
-      CALL nemo_alloc()
-
-      !                                      ! Domain decomposition
-      IF( jpni*jpnj == jpnij ) THEN   ;   CALL mpp_init      ! standard cutting out
-      ELSE                            ;   CALL mpp_init2     ! eliminate land processors
-      ENDIF
-      !
-      IF( nn_timing == 1 )  CALL timing_init
-      !
-      !                                      ! General initialization
-                            CALL     phy_cst    ! Physical constants
-                            CALL     eos_init   ! Equation of state
-                            CALL     dom_cfg    ! Domain configuration
-                            CALL     dom_init   ! Domain
-
-      IF( ln_nnogather )    CALL nemo_northcomms   ! Initialise the northfold neighbour lists (must be done after the masks are defined)
-
-      IF( ln_ctl        )   CALL prt_ctl_init   ! Print control
-
-      IF( lk_obc        )   CALL     obc_init   ! Open boundaries
-      IF( lk_bdy        )   CALL     bdy_init       ! Open boundaries initialisation
-      IF( lk_bdy        )   CALL     bdy_dta_init   ! Open boundaries initialisation of external data arrays
-      IF( lk_bdy        )   CALL     tide_init      ! Open boundaries initialisation of tidal harmonic forcing
-
-                            CALL flush(numout)
-                            CALL dyn_nept_init  ! simplified form of Neptune effect
-                            CALL flush(numout)
-
-                            CALL  istate_init   ! ocean initial state (Dynamics and tracers)
-
-      !                                     ! Ocean physics
-                            CALL     sbc_init   ! Forcings : surface module
-      !                                         ! Vertical physics
-                            CALL     zdf_init      ! namelist read
-                            CALL zdf_bfr_init      ! bottom friction
-      IF( lk_zdfric     )   CALL zdf_ric_init      ! Richardson number dependent Kz
-      IF( lk_zdftke     )   CALL zdf_tke_init      ! TKE closure scheme
-      IF( lk_zdfgls     )   CALL zdf_gls_init      ! GLS closure scheme
-      IF( lk_zdfkpp     )   CALL zdf_kpp_init      ! KPP closure scheme
-      IF( lk_zdftmx     )   CALL zdf_tmx_init      ! tidal vertical mixing
-      IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   &
-         &                  CALL zdf_ddm_init      ! double diffusive mixing
-      !                                         ! Lateral physics
-                            CALL ldf_tra_init      ! Lateral ocean tracer physics
-                            CALL ldf_dyn_init      ! Lateral ocean momentum physics
-      IF( lk_ldfslp     )   CALL ldf_slp_init      ! slope of lateral mixing
-
-      !                                     ! Active tracers
-                            CALL tra_qsr_init   ! penetrative solar radiation qsr
-                            CALL tra_bbc_init   ! bottom heat flux
-      IF( lk_trabbl     )   CALL tra_bbl_init   ! advective (and/or diffusive) bottom boundary layer scheme
-      IF( ln_tradmp     )   CALL tra_dmp_init   ! internal damping trends
-                            CALL tra_adv_init   ! horizontal & vertical advection
-                            CALL tra_ldf_init   ! lateral mixing
-                            CALL tra_zdf_init   ! vertical mixing and after tracer fields
-
-      !                                     ! Dynamics
-                            CALL dyn_adv_init   ! advection (vector or flux form)
-                            CALL dyn_vor_init   ! vorticity term including Coriolis
-                            CALL dyn_ldf_init   ! lateral mixing
-                            CALL dyn_hpg_init   ! horizontal gradient of Hydrostatic pressure
-                            CALL dyn_zdf_init   ! vertical diffusion
-                            CALL dyn_spg_init   ! surface pressure gradient
-
-      !                                     ! Misc. options
-      IF( nn_cla == 1   )   CALL cla_init       ! Cross Land Advection
-
-#if defined key_top
-      !                                     ! Passive tracers
-                            CALL     trc_init
-#endif
-      !                                     ! Diagnostics
-      IF( lk_floats     )   CALL     flo_init   ! drifting Floats
-                            CALL     iom_init   ! iom_put initialization
-      IF( lk_diaar5     )   CALL dia_ar5_init   ! ar5 diag
-                            CALL dia_ptr_init   ! Poleward TRansports initialization
-      IF( lk_diadct     )   CALL dia_dct_init   ! Sections tranports
-                            CALL dia_hsb_init   ! heat content, salt content and volume budgets
-                            CALL trd_mod_init   ! Mixed-layer/Vorticity/Integral constraints trends
-      IF( lk_diaobs     ) THEN                  ! Observation & model comparison
-                            CALL dia_obs_init            ! Initialize observational data
-                            CALL dia_obs( nit000 - 1 )   ! Observation operator for restart
-      ENDIF
-      !                                     ! Assimilation increments
-      IF( lk_asminc     )   CALL asm_inc_init   ! Initialize assimilation increments
-      !
       IF( ln_rnf        )   CALL sbc_rnf_init
       !!!!!!!!!!!!! TAM initialisation !!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -343,19 +196,5 @@
                             CALL     sbc_init_tam   ! Forcings : surface module
                             CALL     sbc_ssr_ini_tam   ! Forcings : surface module
-      !                                         ! Vertical physics
-      !                      CALL     zdf_init_tam      ! namelist read
-      !IF( lk_zdfric     )   CALL zdf_ric_init      ! Richardson number dependent Kz
-      !IF( lk_zdftke     )   CALL zdf_tke_init      ! TKE closure scheme
-      !IF( lk_zdfgls     )   CALL zdf_gls_init      ! GLS closure scheme
-      !IF( lk_zdfkpp     )   CALL zdf_kpp_init      ! KPP closure scheme
-      !IF( lk_zdftmx     )   CALL zdf_tmx_init      ! tidal vertical mixing
-      !IF( lk_zdfddm .AND. .NOT. lk_zdfkpp )   &
-         !&                  CALL zdf_ddm_init      ! double diffusive mixing
-      !                                         ! Lateral physics
-                            !CALL ldf_tra_init      ! Lateral ocean tracer physics
-                            !CALL ldf_dyn_init      ! Lateral ocean momentum physics
-      !IF( lk_ldfslp     )   CALL ldf_slp_init      ! slope of lateral mixing
-
-      !                                     ! Active tracers
+            !                                     ! Active tracers
                             CALL tra_qsr_init_tam   ! penetrative solar radiation qsr
       IF( lk_trabbl     )   CALL tra_bbl_init_tam   ! advective (and/or diffusive) bottom boundary layer scheme
@@ -376,29 +215,8 @@
       IF( nn_cla == 1   )   CALL cla_init_tam       ! Cross Land Advection
                             CALL sbc_rnf_init_tam
-!#if defined key_top
-      !!                                     ! Passive tracers
-                            !CALL     trc_init
-!#endif
-      !!                                     ! Diagnostics
-      !IF( lk_floats     )   CALL     flo_init   ! drifting Floats
-                            !CALL     iom_init   ! iom_put initialization
-      !IF( lk_diaar5     )   CALL dia_ar5_init   ! ar5 diag
-                            !CALL dia_ptr_init   ! Poleward TRansports initialization
-      !IF( lk_diadct     )   CALL dia_dct_init   ! Sections tranports
-                            !CALL dia_hsb_init   ! heat content, salt content and volume budgets
-                            !CALL trd_mod_init   ! Mixed-layer/Vorticity/Integral constraints trends
-      !IF( lk_diaobs     ) THEN                  ! Observation & model comparison
-                            !CALL dia_obs_init            ! Initialize observational data
-                            !CALL dia_obs( nit000 - 1 )   ! Observation operator for restart
-      !ENDIF
-      !!                                     ! Assimilation increments
-      !IF( lk_asminc     )   CALL asm_inc_init   ! Initialize assimilation increments
-      !IF(lwp) WRITE(numout,*) 'Euler time step switch is ', neuler
-      !
-      CALL tam_trj_init
+
       CALL tam_tst_init
       CALL tl_trj_ini
    END SUBROUTINE nemo_init_tam
-
 
    SUBROUTINE nemo_ctl_tam
@@ -488,31 +306,4 @@
    END SUBROUTINE nemo_ctl_tam
 
-
-   SUBROUTINE nemo_closefile
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE nemo_closefile  ***
-      !!
-      !! ** Purpose :   Close the files
-      !!----------------------------------------------------------------------
-      !
-      IF( lk_mpp )   CALL mppsync
-      !
-      CALL iom_close                                 ! close all input/output files managed by iom_*
-      !
-      IF( numstp      /= -1 )   CLOSE( numstp      )   ! time-step file
-      IF( numsol      /= -1 )   CLOSE( numsol      )   ! solver file
-      IF( numnam      /= -1 )   CLOSE( numnam      )   ! oce namelist
-      IF( numnam_ice  /= -1 )   CLOSE( numnam_ice  )   ! ice namelist
-      IF( numevo_ice  /= -1 )   CLOSE( numevo_ice  )   ! ice variables (temp. evolution)
-      IF( numout      /=  6 )   CLOSE( numout      )   ! standard model output file
-      IF( numdct_vol  /= -1 )   CLOSE( numdct_vol  )   ! volume transports
-      IF( numdct_heat /= -1 )   CLOSE( numdct_heat )   ! heat transports
-      IF( numdct_salt /= -1 )   CLOSE( numdct_salt )   ! salt transports
-      !
-      numout = 6                                     ! redefine numout in case it is used after this point...
-      !
-   END SUBROUTINE nemo_closefile
-
-
    SUBROUTINE nemo_alloc_tam
       !!----------------------------------------------------------------------
@@ -539,52 +330,4 @@
       !
    END SUBROUTINE nemo_alloc_tam
-
-
-   SUBROUTINE nemo_partition( num_pes )
-      !!----------------------------------------------------------------------
-      !!                 ***  ROUTINE nemo_partition  ***
-      !!
-      !! ** Purpose :
-      !!
-      !! ** Method  :
-      !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) :: num_pes ! The number of MPI processes we have
-      !
-      INTEGER, PARAMETER :: nfactmax = 20
-      INTEGER :: nfact ! The no. of factors returned
-      INTEGER :: ierr  ! Error flag
-      INTEGER :: ji
-      INTEGER :: idiff, mindiff, imin ! For choosing pair of factors that are closest in value
-      INTEGER, DIMENSION(nfactmax) :: ifact ! Array of factors
-      !!----------------------------------------------------------------------
-
-      ierr = 0
-
-      CALL factorise( ifact, nfactmax, nfact, num_pes, ierr )
-
-      IF( nfact <= 1 ) THEN
-         WRITE (numout, *) 'WARNING: factorisation of number of PEs failed'
-         WRITE (numout, *) '       : using grid of ',num_pes,' x 1'
-         jpnj = 1
-         jpni = num_pes
-      ELSE
-         ! Search through factors for the pair that are closest in value
-         mindiff = 1000000
-         imin    = 1
-         DO ji = 1, nfact-1, 2
-            idiff = ABS( ifact(ji) - ifact(ji+1) )
-            IF( idiff < mindiff ) THEN
-               mindiff = idiff
-               imin = ji
-            ENDIF
-         END DO
-         jpnj = ifact(imin)
-         jpni = ifact(imin + 1)
-      ENDIF
-      !
-      jpnij = jpni*jpnj
-      !
-   END SUBROUTINE nemo_partition
-
 
    SUBROUTINE factorise( kfax, kmaxfax, knfax, kn, kerr )
Index: /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 4599)
+++ /branches/2012/dev_v3_4_STABLE_2012/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 4600)
@@ -84,4 +84,6 @@
    PUBLIC   nemo_init   ! needed by AGRIF
    PUBLIC   nemo_alloc  ! needed by TAM
+   PUBLIC   nemo_closefile ! Needed by NEMOTAM
+   PUBLIC   nemo_partition ! needed by NEMOTAM
 
    CHARACTER(lc) ::   cform_aaa="( /, 'AAAAAAAA', / ) "     ! flag for output listing
