New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 1749 for trunk – NEMO

Changeset 1749 for trunk


Ignore:
Timestamp:
2009-11-23T11:52:11+01:00 (14 years ago)
Author:
cetlod
Message:

update opa.F90 and step.F90 modules, see ticket:609

Location:
trunk/NEMO/OFF_SRC
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OFF_SRC/IOM/in_out_manager.F90

    r1642 r1749  
    7777   INTEGER            ::   nn_jctls     =    0    !: Start j indice for the SUM control 
    7878   INTEGER            ::   nn_jctle     =    0    !: End   j indice for the SUM control 
    79    INTEGER            ::   nn_isplt      =    1   !: number of processors following i 
    80    INTEGER            ::   nn_jsplt      =    1   !: number of processors following j 
     79   INTEGER            ::   nn_isplt     =    1    !: number of processors following i 
     80   INTEGER            ::   nn_jsplt     =    1    !: number of processors following j 
    8181   INTEGER            ::   nn_bench     =    0    !: benchmark parameter (0/1) 
    8282   INTEGER            ::   nn_bit_cmp   =    0    !: bit reproducibility  (0/1) 
     
    9090   !!                        logical units 
    9191   !!---------------------------------------------------------------------- 
    92    INTEGER            ::   numstp                 !: logical unit for time step 
     92   INTEGER            ::   numstp     =   -1      !: logical unit for time step 
    9393   INTEGER            ::   numout     =    6      !: logical unit for output print 
    94    INTEGER            ::   numnam                 !: logical unit for namelist 
    95    INTEGER            ::   numnam_ice             !: logical unit for ice namelist 
    96    INTEGER            ::   numevo_ice             !: logical unit for ice variables (temp. evolution) 
    97    INTEGER            ::   numsol                 !: logical unit for solver statistics 
    98    INTEGER            ::   numwri                 !: logical unit for output write 
    99    INTEGER            ::   numgap                 !: logical unit for differences diagnostic 
    100    INTEGER            ::   numbol                 !: logical unit for "bol" diagnostics 
    101    INTEGER            ::   numptr                 !: logical unit for Poleward TRansports 
    102    INTEGER            ::   numflo                 !: logical unit for drifting floats 
     94   INTEGER            ::   numnam     =   -1      !: logical unit for namelist 
     95   INTEGER            ::   numnam_ice =   -1      !: logical unit for ice namelist 
     96   INTEGER            ::   numevo_ice =   -1      !: logical unit for ice variables (temp. evolution) 
     97   INTEGER            ::   numsol     =   -1      !: logical unit for solver statistics 
    10398 
    10499   !!---------------------------------------------------------------------- 
     
    149144         IF( PRESENT(cd10) ) WRITE(numout,*) cd10 
    150145      ENDIF 
    151       CALL FLUSH(numout) 
     146                               CALL FLUSH(numout    ) 
     147      IF( numstp     /= -1 )   CALL FLUSH(numstp    ) 
     148      IF( numsol     /= -1 )   CALL FLUSH(numsol    ) 
     149      IF( numevo_ice /= -1 )   CALL FLUSH(numevo_ice) 
    152150      ! 
    153151   END SUBROUTINE ctl_stop 
  • trunk/NEMO/OFF_SRC/IOM/iom.F90

    r1697 r1749  
    2727 
    2828#if defined key_iomput 
     29   USE domngb          ! ocean space and time domain 
     30   USE phycst          ! physical constants 
     31   USE dianam          ! build name of file 
    2932   USE mod_event_client 
     33   USE mod_attribut 
    3034# endif 
    3135 
     
    3438    
    3539#if defined key_iomput 
    36    LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .TRUE.       !: iom_put flag 
     40   LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .TRUE.        !: iom_put flag 
    3741#else 
    3842   LOGICAL, PUBLIC, PARAMETER ::   lk_iomput = .FALSE.       !: iom_put flag 
    3943#endif 
    40  
    4144   PUBLIC iom_init, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_gettime, iom_rstput, iom_put 
    4245 
     
    5558   END INTERFACE 
    5659  INTERFACE iom_put 
    57      MODULE PROCEDURE iom_p2d, iom_p3d 
     60     MODULE PROCEDURE iom_p0d, iom_p2d, iom_p3d 
    5861  END INTERFACE 
    5962#if defined key_iomput 
     
    7174CONTAINS 
    7275 
    73    SUBROUTINE iom_init( pjulian ) 
     76   SUBROUTINE iom_init 
    7477      !!---------------------------------------------------------------------- 
    7578      !!                     ***  ROUTINE   *** 
     
    7881      !! 
    7982      !!---------------------------------------------------------------------- 
    80       REAL(wp), INTENT(in) ::  pjulian   !: julian day at nit000 = 0 
    8183#if defined key_iomput 
     84      REAL(wp) ::   ztmp 
    8285      !!---------------------------------------------------------------------- 
    8386      ! read the xml file 
     
    8588 
    8689      ! calendar parameters 
    87       CALL event__set_time_parameters( nit000 - 1, pjulian, rdt ) 
     90      SELECT CASE ( nleapy )        ! Choose calendar for IOIPSL 
     91      CASE ( 1)   ;   CALL event__set_calendar('gregorian') 
     92      CASE ( 0)   ;   CALL event__set_calendar('noleap'   ) 
     93      CASE (30)   ;   CALL event__set_calendar('360d'     ) 
     94      END SELECT 
     95      ztmp = fjulday - adatrj 
     96      IF( ABS(ztmp  - REAL(NINT(ztmp),wp)) < 0.1 / rday )   ztmp = REAL(NINT(ztmp),wp)   ! avoid truncation error 
     97      CALL event__set_time_parameters( nit000 - 1, ztmp, rdt ) 
    8898 
    8999      ! horizontal grid definition 
     100      CALL set_scalar 
    90101      CALL set_grid( "grid_T", glamt, gphit ) 
    91102      CALL set_grid( "grid_U", glamu, gphiu ) 
     
    98109      CALL event__set_vert_axis( "depthv", gdept_0 ) 
    99110      CALL event__set_vert_axis( "depthw", gdepw_0 ) 
     111       
     112      ! automatic definitions of some of the xml attributs 
     113      CALL set_xmlatt 
    100114 
    101115      ! end file definition 
     
    180194      ! do we read the overlap  
    181195      ! ugly patch SM+JMM+RB to overwrite global definition in some cases 
    182       llnoov = (jpni * jpnj ) == jpnij  
     196      llnoov = (jpni * jpnj ) == jpnij .AND. .NOT. lk_agrif 
    183197      ! create the file name by added, if needed, TRIM(Agrif_CFixed()) and TRIM(clsuffix) 
    184198      ! ============= 
     
    525539      ! do we read the overlap  
    526540      ! ugly patch SM+JMM+RB to overwrite global definition in some cases 
    527       llnoov = (jpni * jpnj ) == jpnij  
     541      llnoov = (jpni * jpnj ) == jpnij .AND. .NOT. lk_agrif 
    528542      ! check kcount and kstart optionals parameters... 
    529543      IF( PRESENT(kcount) .AND. (.NOT. PRESENT(kstart)) ) CALL ctl_stop(trim(clinfo), 'kcount present needs kstart present') 
     
    894908 
    895909   !!---------------------------------------------------------------------- 
    896    !!                   INTERFACE iom_rstput 
     910   !!                   INTERFACE iom_put 
    897911   !!---------------------------------------------------------------------- 
     912   SUBROUTINE iom_p0d( cdname, pfield0d ) 
     913      CHARACTER(LEN=*), INTENT(in) ::   cdname 
     914      REAL(wp)        , INTENT(in) ::   pfield0d 
     915#if defined key_iomput 
     916      CALL event__write_field2D( cdname, RESHAPE( (/pfield0d/), (/1,1/) ) ) 
     917#else 
     918      IF( .FALSE. )   WRITE(numout,*) cdname, pfield0d   ! useless test to avoid compilation warnings 
     919#endif 
     920   END SUBROUTINE iom_p0d 
     921 
    898922   SUBROUTINE iom_p2d( cdname, pfield2d ) 
    899923      CHARACTER(LEN=*)            , INTENT(in) ::   cdname 
     
    901925#if defined key_iomput 
    902926      CALL event__write_field2D( cdname, pfield2d(nldi:nlei, nldj:nlej) ) 
     927#else 
     928      IF( .FALSE. )   WRITE(numout,*) cdname, pfield2d   ! useless test to avoid compilation warnings 
    903929#endif 
    904930   END SUBROUTINE iom_p2d 
     
    909935#if defined key_iomput 
    910936      CALL event__write_field3D( cdname, pfield3d(nldi:nlei, nldj:nlej, :) ) 
     937#else 
     938      IF( .FALSE. )   WRITE(numout,*) cdname, pfield3d   ! useless test to avoid compilation warnings 
    911939#endif 
    912940   END SUBROUTINE iom_p3d 
     
    920948      !!                     ***  ROUTINE   *** 
    921949      !! 
    922       !! ** Purpose :    
     950      !! ** Purpose :   define horizontal grids 
    923951      !! 
    924952      !!---------------------------------------------------------------------- 
     
    934962   END SUBROUTINE set_grid 
    935963 
     964 
     965   SUBROUTINE set_scalar 
     966      !!---------------------------------------------------------------------- 
     967      !!                     ***  ROUTINE   *** 
     968      !! 
     969      !! ** Purpose :   define fake grids for scalar point 
     970      !! 
     971      !!---------------------------------------------------------------------- 
     972      REAL(wp), DIMENSION(1,1) ::   zz = 1. 
     973      !!---------------------------------------------------------------------- 
     974      CALL event__set_grid_dimension( 'scalarpoint', jpnij, 1) 
     975      CALL event__set_grid_domain   ( 'scalarpoint', 1, 1, narea, 1, zz, zz ) 
     976      CALL event__set_grid_type_nemo( 'scalarpoint' ) 
     977 
     978   END SUBROUTINE set_scalar 
     979 
     980 
     981   SUBROUTINE set_xmlatt 
     982      !!---------------------------------------------------------------------- 
     983      !!                     ***  ROUTINE   *** 
     984      !! 
     985      !! ** Purpose :   automatic definitions of some of the xml attributs... 
     986      !! 
     987      !!---------------------------------------------------------------------- 
     988      CHARACTER(len=6),DIMENSION( 8) ::   clsuff                   ! suffix name 
     989      CHARACTER(len=1),DIMENSION( 3) ::   clgrd                    ! suffix name 
     990      CHARACTER(len=50)              ::   clname                   ! file name 
     991      CHARACTER(len=1)               ::   cl1                      ! 1 character 
     992      CHARACTER(len=2)               ::   cl2                      ! 1 character 
     993      INTEGER                        ::   idt                      ! time-step in seconds 
     994      INTEGER                        ::   iddss, ihhss             ! number of seconds in 1 day, 1 hour and 1 year 
     995      INTEGER                        ::   iyymo                    ! number of months in 1 year 
     996      INTEGER                        ::   jg, jh, jd, jm, jy       ! loop counters 
     997      INTEGER                        ::   ix, iy                   ! i-,j- index 
     998      REAL(wp)        ,DIMENSION(11) ::   zlontao                  ! longitudes of tao    moorings 
     999      REAL(wp)        ,DIMENSION( 7) ::   zlattao                  ! latitudes  of tao    moorings 
     1000      REAL(wp)        ,DIMENSION( 4) ::   zlonrama                 ! longitudes of rama   moorings 
     1001      REAL(wp)        ,DIMENSION(11) ::   zlatrama                 ! latitudes  of rama   moorings 
     1002      REAL(wp)        ,DIMENSION( 3) ::   zlonpira                 ! longitudes of pirata moorings 
     1003      REAL(wp)        ,DIMENSION( 9) ::   zlatpira                 ! latitudes  of pirata moorings 
     1004      !!---------------------------------------------------------------------- 
     1005      !  
     1006      idt   = NINT( rdttra(1)     ) 
     1007      iddss = NINT( rday          )                                         ! number of seconds in 1 day 
     1008      ihhss = NINT( rmmss * rhhmm )                                         ! number of seconds in 1 hour 
     1009      iyymo = NINT( raamo         )                                         ! number of months in 1 year 
     1010 
     1011      ! frequency of the call of iom_put (attribut: freq_op) 
     1012      CALL event__set_attribut( 'field_definition', attr( field__freq_op, idt           ) )    ! model time-step 
     1013       
     1014      ! output file names (attribut: name) 
     1015      clsuff(:) = (/ 'grid_T', 'grid_U', 'grid_V', 'grid_W', 'icemod', 'ptrc_T', 'diad_T', 'scalar' /)       
     1016      DO jg = 1, SIZE(clsuff)                                                                  ! grid type 
     1017         DO jh = 1, 12                                                                         ! 1, 2, 3, 4, 6, 12 hours 
     1018            IF( MOD(12,jh) == 0 ) THEN  
     1019               WRITE(cl2,'(i2)') jh  
     1020               CALL dia_nam( clname, jh * ihhss, clsuff(jg), ldfsec = .TRUE. ) 
     1021               CALL event__set_attribut( TRIM(ADJUSTL(cl2))//'h_'//clsuff(jg), attr( file__name, TRIM(clname) ) ) 
     1022            ENDIF 
     1023         END DO 
     1024         DO jd = 1, 5, 2                                                                       ! 1, 3, 5 days 
     1025            WRITE(cl1,'(i1)') jd  
     1026            CALL dia_nam( clname, jd * iddss, clsuff(jg), ldfsec = .TRUE. ) 
     1027            CALL event__set_attribut( cl1//'d_'//clsuff(jg), attr( file__name, TRIM(clname) ) ) 
     1028         END DO 
     1029         DO jm = 1, 6                                                                          ! 1, 2, 3, 4, 6 months 
     1030            IF( MOD(6,jm) == 0 ) THEN  
     1031               WRITE(cl1,'(i1)') jm  
     1032               CALL dia_nam( clname, -jm, clsuff(jg) ) 
     1033               CALL event__set_attribut( cl1//'m_'//clsuff(jg), attr( file__name, TRIM(clname) ) ) 
     1034            ENDIF 
     1035         END DO 
     1036         DO jy = 1, 10                                                                         ! 1, 2, 5, 10 years   
     1037            IF( MOD(10,jy) == 0 ) THEN  
     1038               WRITE(cl2,'(i2)') jy  
     1039               CALL dia_nam( clname, -jy * iyymo, clsuff(jg) ) 
     1040               CALL event__set_attribut( TRIM(ADJUSTL(cl2))//'y_'//clsuff(jg), attr( file__name, TRIM(clname) ) ) 
     1041            ENDIF 
     1042         END DO 
     1043      END DO 
     1044 
     1045      ! Zooms... 
     1046      clgrd = (/ 'T', 'U', 'W' /)  
     1047      DO jg = 1, SIZE(clgrd)                                                                   ! grid type 
     1048         cl1 = clgrd(jg) 
     1049         ! Equatorial section (attributs: jbegin, ni, name_suffix) 
     1050         CALL dom_ngb( 0., 0., ix, iy, cl1 ) 
     1051         CALL event__set_attribut( 'Eq'//cl1, attr( zoom__jbegin     , iy     ) ) 
     1052         CALL event__set_attribut( 'Eq'//cl1, attr( zoom__ni         , jpiglo ) ) 
     1053         CALL event__set_attribut( 'Eq'//cl1, attr( file__name_suffix, '_Eq'  ) ) 
     1054      END DO 
     1055      ! TAO moorings (attributs: ibegin, jbegin, name_suffix) 
     1056      zlontao = (/ 137.0, 147.0, 156.0, 165.0, -180.0, -170.0, -155.0, -140.0, -125.0, -110.0, -95.0 /) 
     1057      zlattao = (/  -8.0,  -5.0,  -2.0,   0.0,    2.0,    5.0,    8.0 /) 
     1058      CALL set_mooring( zlontao, zlattao ) 
     1059      ! RAMA moorings (attributs: ibegin, jbegin, name_suffix) 
     1060      zlonrama = (/  55.0,  67.0, 80.5, 90.0 /) 
     1061      zlatrama = (/ -16.0, -12.0, -8.0, -4.0, -1.5, 0.0, 1.5, 4.0, 8.0, 12.0, 15.0 /) 
     1062      CALL set_mooring( zlonrama, zlatrama ) 
     1063      ! PIRATA moorings (attributs: ibegin, jbegin, name_suffix) 
     1064      zlonpira = (/ -38.0, -23.0, -10.0 /) 
     1065      zlatpira = (/ -19.0, -14.0,  -8.0, 0.0, 4.0, 8.0, 12.0, 15.0, 20.0 /) 
     1066      CALL set_mooring( zlonpira, zlatpira ) 
     1067       
     1068   END SUBROUTINE set_xmlatt 
     1069 
     1070 
     1071   SUBROUTINE set_mooring( plon, plat) 
     1072      !!---------------------------------------------------------------------- 
     1073      !!                     ***  ROUTINE   *** 
     1074      !! 
     1075      !! ** Purpose :   automatic definitions of moorings xml attributs... 
     1076      !! 
     1077      !!---------------------------------------------------------------------- 
     1078      REAL(wp), DIMENSION(:), INTENT(in) ::  plon, plat           ! longitudes/latitudes oft the mooring 
     1079      ! 
     1080!!$      CHARACTER(len=1),DIMENSION(4) ::   clgrd = (/ 'T', 'U', 'V', 'W' /)   ! suffix name 
     1081      CHARACTER(len=1),DIMENSION(1) ::   clgrd = (/ 'T' /)        ! suffix name 
     1082      CHARACTER(len=50)             ::   clname                   ! file name 
     1083      CHARACTER(len=1)              ::   cl1                      ! 1 character 
     1084      CHARACTER(len=6)              ::   clon,clat                ! name of longitude, latitude 
     1085      INTEGER                       ::   ji, jj, jg               ! loop counters 
     1086      INTEGER                       ::   ix, iy                   ! i-,j- index 
     1087      REAL(wp)                      ::   zlon, zlat 
     1088      !!---------------------------------------------------------------------- 
     1089      DO jg = 1, SIZE(clgrd) 
     1090         cl1 = clgrd(jg) 
     1091         DO ji = 1, SIZE(plon) 
     1092            DO jj = 1, SIZE(plat) 
     1093               zlon = plon(ji) 
     1094               zlat = plat(jj) 
     1095               ! modifications for RAMA moorings 
     1096               IF( zlon ==  67. .AND. zlat ==  15. )   zlon =  65. 
     1097               IF( zlon ==  90. .AND. zlat <=  -4. )   zlon =  95. 
     1098               IF( zlon ==  95. .AND. zlat ==  -4. )   zlat =  -5. 
     1099               ! modifications for PIRATA moorings 
     1100               IF( zlon == -38. .AND. zlat == -19. )   zlon = -34. 
     1101               IF( zlon == -38. .AND. zlat == -14. )   zlon = -32. 
     1102               IF( zlon == -38. .AND. zlat ==  -8. )   zlon = -30. 
     1103               IF( zlon == -38. .AND. zlat ==   0. )   zlon = -35. 
     1104               IF( zlon == -23. .AND. zlat ==  20. )   zlat =  21. 
     1105               IF( zlon == -10. .AND. zlat == -14. )   zlat = -10. 
     1106               IF( zlon == -10. .AND. zlat ==  -8. )   zlat =  -6. 
     1107               IF( zlon == -10. .AND. zlat ==   4. ) THEN   ;   zlon = 0.   ;   zlat = 0.   ;   ENDIF 
     1108               CALL dom_ngb( zlon, zlat, ix, iy, cl1 ) 
     1109               IF( zlon >= 0. ) THEN   
     1110                  IF( zlon == REAL(NINT(zlon), wp) ) THEN   ;   WRITE(clon, '(i3,  a)') NINT( zlon), 'e' 
     1111                  ELSE                                      ;   WRITE(clon, '(f5.1,a)')       zlon , 'e' 
     1112                  ENDIF 
     1113               ELSE              
     1114                  IF( zlon == REAL(NINT(zlon), wp) ) THEN   ;   WRITE(clon, '(i3,  a)') NINT(-zlon), 'w' 
     1115                  ELSE                                      ;   WRITE(clon, '(f5.1,a)')      -zlon , 'w' 
     1116                  ENDIF 
     1117               ENDIF 
     1118               IF( zlat >= 0. ) THEN   
     1119                  IF( zlat == REAL(NINT(zlat), wp) ) THEN   ;   WRITE(clat, '(i2,  a)') NINT( zlat), 'n' 
     1120                  ELSE                                      ;   WRITE(clat, '(f4.1,a)')       zlat , 'n' 
     1121                  ENDIF 
     1122               ELSE              
     1123                  IF( zlat == REAL(NINT(zlat), wp) ) THEN   ;   WRITE(clat, '(i2,  a)') NINT(-zlat), 's' 
     1124                  ELSE                                      ;   WRITE(clat, '(f4.1,a)')      -zlat , 's' 
     1125                  ENDIF 
     1126               ENDIF 
     1127               clname = TRIM(ADJUSTL(clat))//TRIM(ADJUSTL(clon)) 
     1128               CALL event__set_attribut( TRIM(clname)//cl1, attr( zoom__ibegin     , ix                ) ) 
     1129               CALL event__set_attribut( TRIM(clname)//cl1, attr( zoom__jbegin     , iy                ) ) 
     1130               CALL event__set_attribut( TRIM(clname)//cl1, attr( file__name_suffix, '_'//TRIM(clname) ) )       
     1131            END DO 
     1132         END DO 
     1133      END DO 
     1134       
     1135   END SUBROUTINE set_mooring 
     1136 
    9361137#else 
    9371138 
    9381139   SUBROUTINE iom_setkt( kt ) 
    9391140      INTEGER, INTENT(in   )::   kt  
     1141      IF( .FALSE. )   WRITE(numout,*) kt   ! useless test to avoid compilation warnings 
    9401142   END SUBROUTINE iom_setkt 
    9411143 
  • trunk/NEMO/OFF_SRC/IOM/iom_ioipsl.F90

    r1324 r1749  
    4848      !! ** Purpose :  open an input file with IOIPSL (only fliocom module) 
    4949      !!--------------------------------------------------------------------- 
    50       CHARACTER(len=*)       , INTENT(inout)           ::   cdname    ! File name 
    51       INTEGER                , INTENT(  out)           ::   kiomid    ! ioipsl identifier of the opened file 
    52       LOGICAL                , INTENT(in   )           ::   ldwrt     ! read or write the file? 
    53       LOGICAL                , INTENT(in   )           ::   ldok      ! check the existence  
    54       INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar   ! domain parameters:  
    55  
    56       CHARACTER(LEN=100) ::   clinfo     ! info character 
    57       INTEGER            ::   iln        ! lengths of character 
    58       INTEGER            ::   istop      ! temporary storage of nstop 
    59       INTEGER            ::   ifliodom   ! model domain identifier (see flio_dom_set) 
    60       INTEGER            ::   ioipslid   ! ioipsl identifier of the opened file 
    61       INTEGER            ::   jl         ! loop variable 
     50      CHARACTER(len=*)       , INTENT(inout)           ::   cdname      ! File name 
     51      INTEGER                , INTENT(  out)           ::   kiomid      ! ioipsl identifier of the opened file 
     52      LOGICAL                , INTENT(in   )           ::   ldwrt       ! read or write the file? 
     53      LOGICAL                , INTENT(in   )           ::   ldok        ! check the existence  
     54      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar     ! domain parameters:  
     55 
     56      CHARACTER(LEN=100) ::   clinfo      ! info character 
     57      CHARACTER(LEN=10 ) ::   clstatus    ! status of opened file (REPLACE or NEW) 
     58      INTEGER            ::   iln         ! lengths of character 
     59      INTEGER            ::   istop       ! temporary storage of nstop 
     60      INTEGER            ::   ifliodom    ! model domain identifier (see flio_dom_set) 
     61      INTEGER            ::   ioipslid    ! ioipsl identifier of the opened file 
     62      INTEGER            ::   jl          ! loop variable 
     63      LOGICAL            ::   llclobber   ! local definition of ln_clobber 
    6264      !--------------------------------------------------------------------- 
    6365 
     
    6567      istop = nstop 
    6668      ! 
    67       IF( ldok ) THEN      ! Open existing file... 
     69      llclobber = ldwrt .AND. ln_clobber 
     70      IF( ldok .AND. .NOT. llclobber ) THEN      ! Open existing file... 
    6871         !                 ! ============= 
    6972         IF( ldwrt ) THEN  ! ... in write mode 
     
    7881         iln = INDEX( cdname, '.nc' ) 
    7982         IF( ldwrt ) THEN  ! the file should be open in write mode so we create it... 
     83            IF( llclobber ) THEN   ;   clstatus = 'REPLACE'  
     84            ELSE                   ;   clstatus = 'NEW' 
     85            ENDIF 
    8086            IF( jpnij > 1 ) THEN 
    8187               ! define the domain position regarding to the global domain (mainly useful in mpp) 
     
    8692               IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//cdname(1:iln-1)//'... in WRITE mode' 
    8793               CALL fliocrfd( cdname, (/'x'         , 'y'         , 'z', 't'/)   & 
    88                   &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid, ifliodom ) 
     94                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid, ifliodom, mode = clstatus ) 
    8995            ELSE              ! the file should be open for read mode so it must exist... 
    9096               IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//cdname//' in WRITE mode' 
    9197               CALL fliocrfd( cdname, (/'x'         , 'y'         , 'z', 't'/)   & 
    92                   &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid ) 
     98                  &         , (/kdompar(1,1), kdompar(2,1), jpk, -1 /), ioipslid,           mode = clstatus ) 
    9399            ENDIF 
    94100         ELSE              ! the file should be open for read mode so it must exist... 
  • trunk/NEMO/OFF_SRC/IOM/iom_nf90.F90

    r1324 r1749  
    4949      !! ** Purpose : open an input file with NF90 
    5050      !!--------------------------------------------------------------------- 
    51       CHARACTER(len=*)       , INTENT(inout)           ::   cdname    ! File name 
    52       INTEGER                , INTENT(  out)           ::   kiomid    ! nf90 identifier of the opened file 
    53       LOGICAL                , INTENT(in   )           ::   ldwrt     ! read or write the file? 
    54       LOGICAL                , INTENT(in   )           ::   ldok      ! check the existence  
    55       INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar   ! domain parameters:  
    56  
    57       CHARACTER(LEN=100) ::   clinfo   ! info character 
    58       CHARACTER(LEN=100) ::   cltmp    ! temporary character 
    59       INTEGER            ::   iln      ! lengths of character 
    60       INTEGER            ::   istop    ! temporary storage of nstop 
    61       INTEGER            ::   if90id   ! nf90 identifier of the opened file 
    62       INTEGER            ::   idmy     ! dummy variable 
    63       INTEGER            ::   jl       ! loop variable 
     51      CHARACTER(len=*)       , INTENT(inout)           ::   cdname      ! File name 
     52      INTEGER                , INTENT(  out)           ::   kiomid      ! nf90 identifier of the opened file 
     53      LOGICAL                , INTENT(in   )           ::   ldwrt       ! read or write the file? 
     54      LOGICAL                , INTENT(in   )           ::   ldok        ! check the existence  
     55      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar     ! domain parameters:  
     56 
     57      CHARACTER(LEN=100) ::   clinfo           ! info character 
     58      CHARACTER(LEN=100) ::   cltmp            ! temporary character 
     59      INTEGER            ::   iln              ! lengths of character 
     60      INTEGER            ::   istop            ! temporary storage of nstop 
     61      INTEGER            ::   if90id           ! nf90 identifier of the opened file 
     62      INTEGER            ::   idmy             ! dummy variable 
     63      INTEGER            ::   jl               ! loop variable 
     64      INTEGER            ::   ichunk           ! temporary storage of nn_chunksz 
     65      INTEGER            ::   imode            ! creation mode flag: NF90_CLOBBER or NF90_NOCLOBBER 
     66      LOGICAL            ::   llclobber        ! local definition of ln_clobber 
    6467      !--------------------------------------------------------------------- 
    6568 
    6669      clinfo = '                    iom_nf90_open ~~~  ' 
    6770      istop = nstop   ! store the actual value of nstop 
    68       ! 
    69       IF( ldok ) THEN      ! Open existing file... 
     71      IF( nn_chunksz > 0 ) THEN   ;   ichunk = nn_chunksz 
     72      ELSE                        ;   ichunk = NF90_SIZEHINT_DEFAULT 
     73      ENDIF 
     74      ! 
     75      llclobber = ldwrt .AND. ln_clobber 
     76      IF( ldok .AND. .NOT. llclobber ) THEN      ! Open existing file... 
    7077         !                 ! ============= 
    7178         IF( ldwrt ) THEN  ! ... in write mode 
    7279            IF(lwp) WRITE(numout,*) TRIM(clinfo)//' open existing file: '//TRIM(cdname)//' in WRITE mode' 
    73             CALL iom_nf90_check(NF90_OPEN(TRIM(cdname), NF90_WRITE  , if90id), clinfo) 
    74             CALL iom_nf90_check(NF90_SET_FILL( if90id, NF90_NOFILL, idmy    ), clinfo) 
     80            CALL iom_nf90_check(NF90_OPEN( TRIM(cdname), NF90_WRITE  , if90id, chunksize = ichunk ), clinfo) 
     81            CALL iom_nf90_check(NF90_SET_FILL( if90id, NF90_NOFILL, idmy                          ), clinfo) 
    7582         ELSE              ! ... in read mode 
    7683            IF(lwp) WRITE(numout,*) TRIM(clinfo)//' open existing file: '//TRIM(cdname)//' in READ mode' 
    77             CALL iom_nf90_check(NF90_OPEN(TRIM(cdname), NF90_NOWRITE, if90id), clinfo) 
    78          ENDIF 
    79       ELSE                 ! the file does not exist 
     84            CALL iom_nf90_check(NF90_OPEN( TRIM(cdname), NF90_NOWRITE, if90id, chunksize = ichunk ), clinfo) 
     85         ENDIF 
     86      ELSE                                       ! the file does not exist (or we overwrite it) 
    8087         !                 ! ============= 
    8188         iln = INDEX( cdname, '.nc' ) 
     
    8693            ENDIF 
    8794            IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//TRIM(cdname)//' in WRITE mode' 
    88             CALL iom_nf90_check(NF90_CREATE( TRIM(cdname), NF90_NOCLOBBER, if90id ), clinfo) 
    89             CALL iom_nf90_check(NF90_SET_FILL( if90id, NF90_NOFILL, idmy          ), clinfo) 
     95 
     96            IF( llclobber ) THEN   ;   imode = NF90_CLOBBER  
     97            ELSE                   ;   imode = NF90_NOCLOBBER  
     98            ENDIF 
     99            CALL iom_nf90_check(NF90_CREATE( TRIM(cdname), imode, if90id, chunksize = ichunk ), clinfo) 
     100            CALL iom_nf90_check(NF90_SET_FILL( if90id, NF90_NOFILL, idmy                     ), clinfo) 
    90101            ! define dimensions 
    91102            CALL iom_nf90_check(NF90_DEF_DIM( if90id, 'x', kdompar(1,1)  , idmy ), clinfo) 
  • trunk/NEMO/OFF_SRC/IOM/iom_rstdimg.F90

    r1152 r1749  
    4848      !! ** Purpose :  open an input file read only (return 0 if not found) 
    4949      !!--------------------------------------------------------------------- 
    50       CHARACTER(len=*)       , INTENT(inout)           ::   cdname   ! File name 
    51       INTEGER                , INTENT(  out)           ::   kiomid   ! iom identifier of the opened file 
    52       LOGICAL                , INTENT(in   )           ::   ldwrt    ! read or write the file? 
    53       LOGICAL                , INTENT(in   )           ::   ldok     ! check the existence  
    54       INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar  ! domain parameters:  
     50      CHARACTER(len=*)       , INTENT(inout)           ::   cdname      ! File name 
     51      INTEGER                , INTENT(  out)           ::   kiomid      ! iom identifier of the opened file 
     52      LOGICAL                , INTENT(in   )           ::   ldwrt       ! read or write the file? 
     53      LOGICAL                , INTENT(in   )           ::   ldok        ! check the existence  
     54      INTEGER, DIMENSION(2,5), INTENT(in   ), OPTIONAL ::   kdompar     ! domain parameters:  
    5555 
    5656      CHARACTER(LEN=100)                      ::   clinfo                     ! info character 
    5757      CHARACTER(LEN=100)                      ::   cltmp                      ! temporary character 
     58      CHARACTER(LEN=10 )                      ::   clstatus                   ! status of opened file (REPLACE or NEW) 
    5859      INTEGER                                 ::   jv                         ! loop counter 
    5960      INTEGER                                 ::   istop                      ! temporary storage of nstop 
     
    7071      INTEGER                                 ::   iiglo, ijglo               ! domain global size  
    7172      INTEGER                                 ::   jl                         ! loop variable 
     73      LOGICAL                                 ::   llclobber                  ! local definition of ln_clobber 
    7274      CHARACTER(LEN=jpvnl), DIMENSION(jpmax_vars) ::   clna0d, clna1d, clna2d, clna3d     ! name of 0/1/2/3D variables 
    73       REAL(wp),         DIMENSION(jpmax_vars) ::   zval0d, zval1d, zval2d, zval3d     ! value of 0d variables or record 
    74       !                                                                               ! position for 1/2/3D variables 
     75      REAL(wp),             DIMENSION(jpmax_vars) ::   zval0d, zval1d, zval2d, zval3d     ! value of 0d variables or record 
     76      !                                                                                   ! position for 1/2/3D variables 
    7577      !--------------------------------------------------------------------- 
    7678      clinfo = '                    iom_rstdimg_open ~~~  ' 
     
    7880      ios = 0            ! default definition 
    7981      kiomid = 0         ! default definition 
     82      llclobber = ldwrt .AND. ln_clobber 
    8083      ! get a free unit 
    8184      idrst = getunit()  ! get a free logical unit for the restart file 
     
    8588      ! Open the file... 
    8689      ! ============= 
    87       IF( ldok ) THEN      ! Open existing file... 
     90      IF( ldok .AND. .NOT. llclobber ) THEN      ! Open existing file... 
    8891         ! find the record length 
    8992         OPEN( idrst, FILE = TRIM(cdname), FORM = 'unformatted', ACCESS = 'direct'   & 
     
    101104               &       , RECL = irecl8, STATUS = 'old', ACTION = 'read'     , IOSTAT = ios, ERR = 987 ) 
    102105         ENDIF 
    103       ELSE                 ! the file does not exist 
     106      ELSE                                       ! the file does not exist (or we overwrite it) 
    104107         iln = INDEX( cdname, '.dimg' ) 
    105108         IF( ldwrt ) THEN  ! the file should be open in readwrite mode so we create it... 
     
    110113            ENDIF 
    111114            IF(lwp) WRITE(numout,*) TRIM(clinfo)//' create new file: '//TRIM(cdname)//' in READWRITE mode' 
     115             
     116            IF( llclobber ) THEN   ;   clstatus = 'REPLACE'  
     117            ELSE                   ;   clstatus = 'NEW' 
     118            ENDIF 
    112119            OPEN( idrst, FILE = TRIM(cdname), FORM = 'UNFORMATTED', ACCESS = 'DIRECT'   & 
    113                &       , RECL = irecl8, STATUS = 'new', ACTION = 'readwrite', IOSTAT = ios, ERR = 987 ) 
     120               &       , RECL = irecl8, STATUS = TRIM(clstatus), ACTION = 'readwrite', IOSTAT = ios, ERR = 987 ) 
    114121         ELSE              ! the file should be open for read mode so it must exist... 
    115122            CALL ctl_stop( TRIM(clinfo), ' should be impossible case...' ) 
     
    118125      ! Performs checks on the file 
    119126      ! ============= 
    120       IF( ldok ) THEN      ! old file 
     127      IF( ldok .AND. .NOT. llclobber ) THEN      ! old file 
    121128         READ( idrst, REC = 1   , IOSTAT = ios, ERR = 987 )              & 
    122129              &   irecl8, inx, iny, inz, in0d, in1d, in2d, in3d, irhd,   & 
  • trunk/NEMO/OFF_SRC/opa.F90

    r1715 r1749  
    216216       
    217217      CALL phy_cst                          ! Physical constants 
    218  
    219218      CALL eos_init                         ! Equation of state 
    220  
    221219      CALL dom_cfg                          ! Domain configuration 
    222  
    223220      CALL dom_init                         ! Domain 
    224  
    225221      CALL istate_init                      ! ocean initial state (Dynamics and tracers) 
    226        
     222      CALL trc_ini                           ! Passive tracers 
    227223      CALL dta_dyn( nit000 )                 ! Initialization for the dynamics 
    228        
    229       CALL trc_ini                           ! Passive tracers 
    230       !                                     ! Ocean physics 
    231224      CALL tra_qsr_init                         ! Solar radiation penetration 
    232  
    233225#if ! defined key_off_degrad 
    234226      CALL ldf_tra_init                         ! Lateral ocean tracer physics 
    235227#endif  
    236       CALL iom_init( fjulday - adatrj )     ! iom_put initialization 
    237       !                                     ! =============== ! 
    238       !                                     !  time stepping  ! 
    239       !                                     ! =============== ! 
     228      CALL iom_init                         ! iom_put initialization 
    240229 
    241230      IF(lwp) WRITE(numout,cform_aaa)       ! Flag AAAAAAA 
  • trunk/NEMO/OFF_SRC/step.F90

    r1457 r1749  
    7373      !! --------------------------------------------------------------------- 
    7474 
    75       CALL day( kstp )             ! Calendar 
     75      IF( kstp /= nit000 )   CALL day( kstp )         ! Calendar (day was already called at nit000 in day_init) 
    7676 
    7777      IF( lk_iomput ) CALL iom_setkt( kstp )       ! say to iom that we are at time step kstp 
Note: See TracChangeset for help on using the changeset viewer.