Index: trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90
===================================================================
--- trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 6140)
+++ trunk/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90	(revision 8524)
@@ -23,5 +23,6 @@
    PRIVATE
 
-   PUBLIC   sbc_apr    ! routine called in sbcmod
+   PUBLIC   sbc_apr       ! routine called in sbcmod
+   PUBLIC   sbc_apr_init  ! routine called in sbcmod
    
    !                                !!* namsbc_apr namelist (Atmospheric PRessure) *
@@ -46,4 +47,68 @@
 CONTAINS
 
+   SUBROUTINE sbc_apr_init
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE sbc_apr  ***
+      !!
+      !! ** Purpose :   read atmospheric pressure fields in netcdf files.
+      !!
+      !! ** Method  : - Read namelist namsbc_apr
+      !!              - Read Patm fields in netcdf files 
+      !!              - Compute reference atmospheric pressure
+      !!              - Compute inverse barometer ssh
+      !! ** action  :   apr      : atmospheric pressure at kt
+      !!                ssh_ib   : inverse barometer ssh at kt
+      !!---------------------------------------------------------------------
+      INTEGER            ::   ierror  ! local integer 
+      INTEGER            ::   ios     ! Local integer output status for namelist read
+      !!
+      CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files
+      TYPE(FLD_N)        ::  sn_apr   ! informations about the fields to be read
+      !!
+      NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc
+      !!----------------------------------------------------------------------
+      REWIND( numnam_ref )              ! Namelist namsbc_apr in reference namelist : File for atmospheric pressure forcing
+      READ  ( numnam_ref, namsbc_apr, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in reference namelist', lwp )
+
+      REWIND( numnam_cfg )              ! Namelist namsbc_apr in configuration namelist : File for atmospheric pressure forcing
+      READ  ( numnam_cfg, namsbc_apr, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in configuration namelist', lwp )
+      IF(lwm) WRITE ( numond, namsbc_apr )
+      !
+      ALLOCATE( sf_apr(1), STAT=ierror )           !* allocate and fill sf_sst (forcing structure) with sn_sst
+      IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_apr: unable to allocate sf_apr structure' )
+      !
+      CALL fld_fill( sf_apr, (/ sn_apr /), cn_dir, 'sbc_apr', 'Atmospheric pressure ', 'namsbc_apr' )
+                                ALLOCATE( sf_apr(1)%fnow(jpi,jpj,1)   )
+      IF( sn_apr%ln_tint )   ALLOCATE( sf_apr(1)%fdta(jpi,jpj,1,2) )
+                             ALLOCATE( ssh_ib(jpi,jpj) , ssh_ibb(jpi,jpj) )
+                             ALLOCATE( apr (jpi,jpj) )
+      !
+      IF( lwp )THEN                                 !* control print
+         WRITE(numout,*)
+         WRITE(numout,*) '   Namelist namsbc_apr : Atmospheric PRessure as extrenal forcing'
+         WRITE(numout,*) '      ref. pressure: global mean Patm (T) or a constant (F)  ln_ref_apr = ', ln_ref_apr
+      ENDIF
+      !
+      IF( ln_ref_apr ) THEN                        !* Compute whole inner domain mean masked ocean surface
+         tarea = glob_sum( e1e2t(:,:) )
+         IF(lwp) WRITE(numout,*) '         Variable ref. Patm computed over a ocean surface of ', tarea*1e-6, 'km2'
+      ELSE
+         IF(lwp) WRITE(numout,*) '         Reference Patm used : ', rn_pref, ' N/m2'
+      ENDIF
+      !
+      r1_grau = 1.e0 / (grav * rau0)               !* constant for optimization
+      !
+      !                                            !* control check
+      IF ( ln_apr_obc  ) THEN
+         IF(lwp) WRITE(numout,*) '         Inverse barometer added to OBC ssh data'
+      ENDIF
+!jc: stop below should rather be a warning 
+      IF( ln_apr_obc .AND. .NOT.ln_apr_dyn   )   &
+            CALL ctl_warn( 'sbc_apr: use inverse barometer ssh at open boundary ONLY requires ln_apr_dyn=T' )
+      !
+   END SUBROUTINE sbc_apr_init
+
    SUBROUTINE sbc_apr( kt )
       !!---------------------------------------------------------------------
@@ -61,57 +126,5 @@
       INTEGER, INTENT(in)::   kt   ! ocean time step
       !
-      INTEGER            ::   ierror  ! local integer 
-      INTEGER            ::   ios     ! Local integer output status for namelist read
-      !!
-      CHARACTER(len=100) ::  cn_dir   ! Root directory for location of ssr files
-      TYPE(FLD_N)        ::  sn_apr   ! informations about the fields to be read
-      !!
-      NAMELIST/namsbc_apr/ cn_dir, sn_apr, ln_ref_apr, rn_pref, ln_apr_obc
       !!----------------------------------------------------------------------
-      !
-      !                                         ! -------------------- !
-      IF( kt == nit000 ) THEN                   ! First call kt=nit000 !
-         !                                      ! -------------------- !
-         REWIND( numnam_ref )              ! Namelist namsbc_apr in reference namelist : File for atmospheric pressure forcing
-         READ  ( numnam_ref, namsbc_apr, IOSTAT = ios, ERR = 901)
-901      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in reference namelist', lwp )
-
-         REWIND( numnam_cfg )              ! Namelist namsbc_apr in configuration namelist : File for atmospheric pressure forcing
-         READ  ( numnam_cfg, namsbc_apr, IOSTAT = ios, ERR = 902 )
-902      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_apr in configuration namelist', lwp )
-         IF(lwm) WRITE ( numond, namsbc_apr )
-         !
-         ALLOCATE( sf_apr(1), STAT=ierror )           !* allocate and fill sf_sst (forcing structure) with sn_sst
-         IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_apr: unable to allocate sf_apr structure' )
-         !
-         CALL fld_fill( sf_apr, (/ sn_apr /), cn_dir, 'sbc_apr', 'Atmospheric pressure ', 'namsbc_apr' )
-                                ALLOCATE( sf_apr(1)%fnow(jpi,jpj,1)   )
-         IF( sn_apr%ln_tint )   ALLOCATE( sf_apr(1)%fdta(jpi,jpj,1,2) )
-                                ALLOCATE( ssh_ib(jpi,jpj) , ssh_ibb(jpi,jpj) )
-                                ALLOCATE( apr (jpi,jpj) )
-         !
-         IF(lwp) THEN                                 !* control print
-            WRITE(numout,*)
-            WRITE(numout,*) '   Namelist namsbc_apr : Atmospheric PRessure as extrenal forcing'
-            WRITE(numout,*) '      ref. pressure: global mean Patm (T) or a constant (F)  ln_ref_apr = ', ln_ref_apr
-         ENDIF
-         !
-         IF( ln_ref_apr ) THEN                        !* Compute whole inner domain mean masked ocean surface
-            tarea = glob_sum( e1e2t(:,:) )
-            IF(lwp) WRITE(numout,*) '         Variable ref. Patm computed over a ocean surface of ', tarea*1e-6, 'km2'
-         ELSE
-            IF(lwp) WRITE(numout,*) '         Reference Patm used : ', rn_pref, ' N/m2'
-         ENDIF
-         !
-         r1_grau = 1.e0 / (grav * rau0)               !* constant for optimization
-         !
-         !                                            !* control check
-         IF ( ln_apr_obc  ) THEN
-            IF(lwp) WRITE(numout,*) '         Inverse barometer added to OBC ssh data'
-         ENDIF
-!jc: stop below should rather be a warning 
-         IF( ln_apr_obc .AND. .NOT.ln_apr_dyn   )   &
-            CALL ctl_stop( 'sbc_apr: use inverse barometer ssh at open boundary ONLY requires ln_apr_dyn=T' )
-      ENDIF
 
       !                                         ! ========================== !
