Index: trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90
===================================================================
--- trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90	(revision 558)
+++ trunk/NEMO/OPA_SRC/IOM/iom_ioipsl.F90	(revision 559)
@@ -330,13 +330,11 @@
                &                  long_name="Time axis", units='seconds since 0001-01-01 00:00:00' )
          ! update informations structure related the dimension variable we just added...
-         iom_file(kiomid)%nvars         = 4
-         iom_file(kiomid)%luld(1:4)     = (/ .FALSE., .FALSE., .FALSE., .TRUE. /)
-         iom_file(kiomid)%cn_var(1:3)   = (/ 'nav_lon', 'nav_lat', 'nav_lev' /)
-         iom_file(kiomid)%cn_var(4)     = 'time_counter'
-         iom_file(kiomid)%ndims(1:4)    = (/ 2, 2, 1, 1 /)  
-         CALL flioinqf( ioipslid, ln_dim = idimsz )
-         iom_file(kiomid)%dimsz(1:2, 1) = idimsz(1:2)
-         iom_file(kiomid)%dimsz(1:2, 2) = idimsz(1:2)
-         iom_file(kiomid)%dimsz(1, 3:4) = (/idimsz(3), 1/)
+         iom_file(kiomid)%nvars       = 4
+         iom_file(kiomid)%luld(1:4)   = (/ .FALSE., .FALSE., .FALSE., .TRUE. /)
+         iom_file(kiomid)%cn_var(1:3) = (/ 'nav_lon', 'nav_lat', 'nav_lev' /)
+         iom_file(kiomid)%cn_var(4)   = 'time_counter'
+         iom_file(kiomid)%ndims(1:4)  = (/ 2, 2, 1, 1 /)
+         ! trick: defined to 0 to say that dimension variables are defined but not yet written
+         iom_file(kiomid)%dimsz(1, 1) = 0   
          IF(lwp) WRITE(numout,*) TRIM(clinfo)//' define dimension variables done'
       ENDIF
@@ -403,4 +401,5 @@
             ! write dimension variables if it is not already done
             ! =============
+            ! trick: is defined to 0 => dimension variable are defined but not yet written
             IF( iom_file(kiomid)%dimsz(1, 1) == 0 ) THEN
                CALL flioputv( ioipslid, 'nav_lon'     , glamt(ix1:ix2, iy1:iy2) )
@@ -408,5 +407,10 @@
                CALL flioputv( ioipslid, 'nav_lev'     , gdept_0 )
                ! +++ WRONG VALUE: to be improved but not really useful...
-               CALL flioputv( ioipslid, 'time_counter', kt )   
+               CALL flioputv( ioipslid, 'time_counter', kt )
+               ! update the values of the variables dimensions size
+               CALL flioinqf( ioipslid, ln_dim = idimsz )
+               iom_file(kiomid)%dimsz(1:2, 1) = idimsz(1:2)
+               iom_file(kiomid)%dimsz(1:2, 2) = idimsz(1:2)
+               iom_file(kiomid)%dimsz(1, 3:4) = (/idimsz(3), 1/)
                IF(lwp) WRITE(numout,*) TRIM(clinfo)//' write dimension variables done'
             ENDIF
Index: trunk/NEMO/OPA_SRC/IOM/iom_nf90.F90
===================================================================
--- trunk/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 558)
+++ trunk/NEMO/OPA_SRC/IOM/iom_nf90.F90	(revision 559)
@@ -355,9 +355,6 @@
          iom_file(kiomid)%cn_var(1:4) = cltmp
          iom_file(kiomid)%ndims(1:4)  = (/ 2, 2, 1, 1 /)  
-         CALL iom_nf90_check(NF90_INQUIRE_DIMENSION( if90id, 1, len = iom_file(kiomid)%dimsz(1,1) ), clinfo)
-         CALL iom_nf90_check(NF90_INQUIRE_DIMENSION( if90id, 2, len = iom_file(kiomid)%dimsz(2,1) ), clinfo)
-         iom_file(kiomid)%dimsz(1:2, 2) = iom_file(kiomid)%dimsz(1:2, 1)
-         CALL iom_nf90_check(NF90_INQUIRE_DIMENSION( if90id, 3, len = iom_file(kiomid)%dimsz(1,3) ), clinfo)
-         iom_file(kiomid)%dimsz(1  , 4) = 1   ! unlimited dimension
+         ! trick: defined to 0 to say that dimension variables are defined but not yet written
+         iom_file(kiomid)%dimsz(1, 1)  = 0   
          IF(lwp) WRITE(numout,*) TRIM(clinfo)//' define dimension variables done'
       ENDIF
@@ -433,4 +430,5 @@
             ! write dimension variables if it is not already done
             ! =============
+            ! trick: is defined to 0 => dimension variable are defined but not yet written
             IF( iom_file(kiomid)%dimsz(1, 1) == 0 ) THEN
                CALL iom_nf90_check(NF90_INQ_VARID( if90id, 'nav_lon'     , idmy ), clinfo)
@@ -443,4 +441,10 @@
                CALL iom_nf90_check(NF90_INQ_VARID( if90id, 'time_counter', idmy ), clinfo)
                CALL iom_nf90_check(NF90_PUT_VAR( if90id, idmy, kt                      ), clinfo)   
+               ! update the values of the variables dimensions size
+               CALL iom_nf90_check(NF90_INQUIRE_DIMENSION( if90id, 1, len = iom_file(kiomid)%dimsz(1,1) ), clinfo)
+               CALL iom_nf90_check(NF90_INQUIRE_DIMENSION( if90id, 2, len = iom_file(kiomid)%dimsz(2,1) ), clinfo)
+               iom_file(kiomid)%dimsz(1:2, 2) = iom_file(kiomid)%dimsz(1:2, 1)
+               CALL iom_nf90_check(NF90_INQUIRE_DIMENSION( if90id, 3, len = iom_file(kiomid)%dimsz(1,3) ), clinfo)
+               iom_file(kiomid)%dimsz(1  , 4) = 1   ! unlimited dimension
                IF(lwp) WRITE(numout,*) TRIM(clinfo)//' write dimension variables done'
             ENDIF
