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 11573 for NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/SAS – NEMO

Ignore:
Timestamp:
2019-09-19T11:18:03+02:00 (5 years ago)
Author:
jchanut
Message:

#2222, merged with trunk

Location:
NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/SAS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/SAS/diawri.F90

    r10425 r11573  
    125125      !!      define all the NETCDF files and fields 
    126126      !!      At each time step call histdef to compute the mean if ncessary 
    127       !!      Each nwrite time step, output the instantaneous or mean fields 
     127      !!      Each nn_write time step, output the instantaneous or mean fields 
    128128      !!---------------------------------------------------------------------- 
    129129      !! 
     
    138138      REAL(wp) ::   zsto, zout, zmax, zjulian                ! local scalars 
    139139      !!---------------------------------------------------------------------- 
    140       !  
    141       IF( ln_timing )   CALL timing_start('dia_wri') 
    142140      ! 
    143141      ! Output the initial state and forcings 
     
    147145      ENDIF 
    148146      ! 
     147      IF( nn_write == -1 )   RETURN   ! we will never do any output 
     148      !  
     149      IF( ln_timing )   CALL timing_start('dia_wri') 
     150      ! 
    149151      ! 0. Initialisation 
    150152      ! ----------------- 
     
    159161      ENDIF 
    160162#if defined key_diainstant 
    161       zsto = nwrite * rdt 
     163      zsto = nn_write * rdt 
    162164      clop = "inst("//TRIM(clop)//")" 
    163165#else 
     
    165167      clop = "ave("//TRIM(clop)//")" 
    166168#endif 
    167       zout = nwrite * rdt 
     169      zout = nn_write * rdt 
    168170      zmax = ( nitend - nit000 + 1 ) * rdt 
    169171 
     
    196198         ! WRITE root name in date.file for use by postpro 
    197199         IF(lwp) THEN 
    198             CALL dia_nam( clhstnam, nwrite,' ' ) 
     200            CALL dia_nam( clhstnam, nn_write,' ' ) 
    199201            CALL ctl_opn( inum, 'date.file', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp, narea ) 
    200202            WRITE(inum,*) clhstnam 
     
    204206         ! Define the T grid FILE ( nid_T ) 
    205207 
    206          CALL dia_nam( clhstnam, nwrite, 'grid_T' ) 
     208         CALL dia_nam( clhstnam, nn_write, 'grid_T' ) 
    207209         IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam    ! filename 
    208210         CALL histbeg( clhstnam, jpi, glamt, jpj, gphit,           &  ! Horizontal grid: glamt and gphit 
     
    216218         ! Define the U grid FILE ( nid_U ) 
    217219 
    218          CALL dia_nam( clhstnam, nwrite, 'grid_U' ) 
     220         CALL dia_nam( clhstnam, nn_write, 'grid_U' ) 
    219221         IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam    ! filename 
    220222         CALL histbeg( clhstnam, jpi, glamu, jpj, gphiu,           &  ! Horizontal grid: glamu and gphiu 
     
    228230         ! Define the V grid FILE ( nid_V ) 
    229231 
    230          CALL dia_nam( clhstnam, nwrite, 'grid_V' )                   ! filename 
     232         CALL dia_nam( clhstnam, nn_write, 'grid_V' )                   ! filename 
    231233         IF(lwp) WRITE(numout,*) " Name of NETCDF file ", clhstnam 
    232234         CALL histbeg( clhstnam, jpi, glamv, jpj, gphiv,           &  ! Horizontal grid: glamv and gphiv 
     
    291293      ! donne le nombre d'elements, et ndex la liste des indices a sortir 
    292294 
    293       IF( lwp .AND. MOD( itmod, nwrite ) == 0 ) THEN  
     295      IF( lwp .AND. MOD( itmod, nn_write ) == 0 ) THEN  
    294296         WRITE(numout,*) 'dia_wri : write model outputs in NetCDF files at ', kt, 'time-step' 
    295297         WRITE(numout,*) '~~~~~~ ' 
  • NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/SAS/nemogcm.F90

    r11229 r11573  
    151151      ! 
    152152      IF( nstop /= 0 .AND. lwp ) THEN        ! error print 
    153          WRITE(numout,cform_err) 
    154          WRITE(numout,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
    155          WRITE(numout,*) 
     153         WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found' 
     154         CALL ctl_stop( ctmp1 ) 
    156155      ENDIF 
    157156      ! 
     
    165164#else 
    166165      IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS 
    167       ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop( ldfinal = .TRUE. )   ! end mpp communications 
     166      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop        ! end mpp communications 
    168167      ENDIF 
    169168#endif 
     
    171170      IF(lwm) THEN 
    172171         IF( nstop == 0 ) THEN   ;   STOP 0 
    173          ELSE                    ;   STOP 999 
     172         ELSE                    ;   STOP 123 
    174173         ENDIF 
    175174      ENDIF 
     
    184183      !! ** Purpose :   initialization of the NEMO GCM 
    185184      !!---------------------------------------------------------------------- 
    186       INTEGER  ::   ji                 ! dummy loop indices 
    187       INTEGER  ::   ios, ilocal_comm   ! local integers 
    188       CHARACTER(len=120), DIMENSION(30) ::   cltxt, cltxt2, clnam 
    189       CHARACTER(len=80)                 ::   clname 
     185      INTEGER ::   ios, ilocal_comm   ! local integers 
    190186      !! 
    191187      NAMELIST/namctl/ ln_ctl   , sn_cfctl, nn_print, nn_ictls, nn_ictle,   & 
     
    195191      !!---------------------------------------------------------------------- 
    196192      ! 
    197       cltxt  = '' 
    198       cltxt2 = '' 
    199       clnam  = ''   
    200       cxios_context = 'nemo' 
    201       ! 
    202       !                             ! Open reference namelist and configuration namelist files 
    203       IF( lk_oasis ) THEN  
    204          CALL ctl_opn( numnam_ref, 'namelist_sas_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    205          CALL ctl_opn( numnam_cfg, 'namelist_sas_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    206          cxios_context = 'sas' 
    207          clname = 'output.namelist_sas.dyn' 
    208       ELSE 
    209          CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    210          CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    211          cxios_context = 'nemo' 
    212          clname = 'output.namelist.dyn' 
    213    ENDIF 
    214       ! 
    215       REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
    216       READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
    217 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. ) 
    218       REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
    219       READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
    220 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. ) 
    221       ! 
    222       REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
    223       READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
    224 903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. ) 
    225       REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
    226       READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
    227 904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. )    
    228  
    229       !                             !--------------------------! 
    230       !                             !  Set global domain size  !   (control print return in cltxt2) 
    231       !                             !--------------------------! 
    232       IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file 
    233          CALL domain_cfg ( cltxt2,        cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    234          ! 
    235       ELSE                                ! user-defined namelist 
    236          CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
    237       ENDIF 
    238       ! 
    239       ! 
    240       !                             !--------------------------------------------! 
    241       !                             !  set communicator & select the local node  ! 
    242       !                             !  NB: mynode also opens output.namelist.dyn ! 
    243       !                             !      on unit number numond on first proc   ! 
    244       !                             !--------------------------------------------! 
     193      IF( lk_oasis ) THEN   ;   cxios_context = 'sas' 
     194      ELSE                  ;   cxios_context = 'nemo' 
     195      ENDIF 
     196      ! 
     197      !                             !-------------------------------------------------! 
     198      !                             !     set communicator & select the local rank    ! 
     199      !                             !  must be done as soon as possible to get narea  ! 
     200      !                             !-------------------------------------------------! 
     201      ! 
    245202#if defined key_iomput 
    246203      IF( Agrif_Root() ) THEN 
    247204         IF( lk_oasis ) THEN 
    248             CALL cpl_init( "sas", ilocal_comm )                          ! nemo local communicator given by oasis  
    249             CALL xios_initialize( "not used",local_comm=ilocal_comm )    ! send nemo communicator to xios 
     205            CALL cpl_init( "sas", ilocal_comm )                                  ! nemo local communicator given by oasis  
     206            CALL xios_initialize( "not used",local_comm=ilocal_comm )            ! send nemo communicator to xios 
    250207         ELSE 
    251208            CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm )    ! nemo local communicator given by xios 
    252209         ENDIF 
    253210      ENDIF 
    254       narea = mynode ( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )  ! Nodes selection 
     211      CALL mpp_start( ilocal_comm ) 
    255212#else 
    256213      IF( lk_oasis ) THEN 
    257214         IF( Agrif_Root() ) THEN 
    258             CALL cpl_init( "sas", ilocal_comm )                          ! nemo local communicator given by oasis 
     215            CALL cpl_init( "sas", ilocal_comm )             ! nemo local communicator given by oasis 
    259216         ENDIF 
    260          narea = mynode( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection (control print return in cltxt) 
     217         CALL mpp_start( ilocal_comm ) 
    261218      ELSE 
    262          ilocal_comm = 0 
    263          narea = mynode( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop )                ! Nodes selection (control print return in cltxt) 
    264       ENDIF 
    265 #endif 
    266  
    267       narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 ) 
    268  
    269       IF( sn_cfctl%l_config ) THEN 
    270          ! Activate finer control of report outputs 
    271          ! optionally switch off output from selected areas (note this only 
    272          ! applies to output which does not involve global communications) 
    273          IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
    274            & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
    275            &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
     219         CALL mpp_start( ) 
     220      ENDIF 
     221#endif 
     222      ! 
     223      narea = mpprank + 1                                   ! mpprank: the rank of proc (0 --> mppsize -1 ) 
     224      lwm = (narea == 1)                ! control of output namelists 
     225      ! 
     226      !                             !---------------------------------------------------------------! 
     227      !                             ! Open output files, reference and configuration namelist files ! 
     228      !                             !---------------------------------------------------------------! 
     229      ! 
     230      ! open ocean.output as soon as possible to get all output prints (including errors messages) 
     231      IF( lk_oasis ) THEN 
     232         IF( lwm )   CALL ctl_opn(     numout,              'sas.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     233         ! open reference and configuration namelist files 
     234                     CALL ctl_opn( numnam_ref,        'namelist_sas_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     235                     CALL ctl_opn( numnam_cfg,        'namelist_sas_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     236         IF( lwm )   CALL ctl_opn(     numond, 'output.namelist_sas.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
    276237      ELSE 
    277          ! Use ln_ctl to turn on or off all options. 
    278          CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
    279       ENDIF 
    280  
    281       lwm = (narea == 1)                                    ! control of output namelists 
    282       lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print 
    283  
    284       IF(lwm) THEN               ! write merged namelists from earlier to output namelist  
    285          !                       ! now that the file has been opened in call to mynode.  
    286          !                       ! NB: nammpp has already been written in mynode (if lk_mpp_mpi) 
    287          WRITE( numond, namctl ) 
    288          WRITE( numond, namcfg ) 
    289          IF( .NOT.ln_read_cfg ) THEN 
    290             DO ji = 1, SIZE(clnam) 
    291                IF( TRIM(clnam(ji)) /= '' )   WRITE(numond, * ) clnam(ji)     ! namusr_def print 
    292             END DO 
     238         IF( lwm )   CALL ctl_opn(     numout,            'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     239         ! open reference and configuration namelist files 
     240                     CALL ctl_opn( numnam_ref,            'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     241                     CALL ctl_opn( numnam_cfg,            'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     242         IF( lwm )   CALL ctl_opn(     numond,     'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     243      ENDIF 
     244      ! open /dev/null file to be able to supress output write easily 
     245                     CALL ctl_opn(     numnul,               '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) 
     246      ! 
     247      !                             !--------------------! 
     248      !                             ! Open listing units !  -> need ln_ctl from namctl to define lwp 
     249      !                             !--------------------! 
     250      ! 
     251      REWIND( numnam_ref )              ! Namelist namctl in reference namelist 
     252      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) 
     253901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' ) 
     254      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist 
     255      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) 
     256902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' ) 
     257      ! 
     258      lwp = (narea == 1) .OR. ln_ctl    ! control of all listing output print 
     259      ! 
     260      IF(lwp) THEN                      ! open listing units 
     261         ! 
     262         IF( .NOT. lwm ) THEN           ! alreay opened for narea == 1 
     263            IF(lk_oasis) THEN   ;   CALL ctl_opn( numout,   'sas.output','REPLACE','FORMATTED','SEQUENTIAL',-1,-1, .FALSE., narea ) 
     264            ELSE                ;   CALL ctl_opn( numout, 'ocean.output','REPLACE','FORMATTED','SEQUENTIAL',-1,-1, .FALSE., narea ) 
     265            ENDIF 
    293266         ENDIF 
    294       ENDIF 
    295  
    296       IF(lwp) THEN                            ! open listing units 
    297          ! 
    298          IF( lk_oasis ) THEN   ;   CALL ctl_opn( numout,   'sas.output', 'REPLACE','FORMATTED','SEQUENTIAL', -1, 6, .FALSE., narea ) 
    299          ELSE                  ;   CALL ctl_opn( numout, 'ocean.output', 'REPLACE','FORMATTED','SEQUENTIAL', -1, 6, .FALSE., narea ) 
    300          ENDIF 
    301267         ! 
    302268         WRITE(numout,*) 
    303          WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC' 
     269         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' 
    304270         WRITE(numout,*) '                       NEMO team' 
    305271         WRITE(numout,*) '            Ocean General Circulation Model' 
     
    320286         WRITE(numout,*) "     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " 
    321287         WRITE(numout,*) 
    322  
    323          DO ji = 1, SIZE(cltxt) 
    324             IF( TRIM(cltxt (ji)) /= '' )   WRITE(numout,*) TRIM(cltxt(ji))    ! control print of mynode 
    325          END DO 
    326288         WRITE(numout,*) 
    327          WRITE(numout,*) 
    328          DO ji = 1, SIZE(cltxt2) 
    329             IF( TRIM(cltxt2(ji)) /= '' )   WRITE(numout,*) TRIM(cltxt2(ji))   ! control print of domain size 
    330          END DO 
    331289         ! 
    332290         WRITE(numout,cform_aaa)                                        ! Flag AAAAAAA 
    333291         ! 
    334292      ENDIF 
    335       ! open /dev/null file to be able to supress output write easily 
    336       CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) 
    337       ! 
    338       !                                      ! Domain decomposition 
    339       CALL mpp_init                          ! MPP 
     293     ! 
     294      ! finalize the definition of namctl variables 
     295      IF( sn_cfctl%l_config ) THEN 
     296         ! Activate finer control of report outputs 
     297         ! optionally switch off output from selected areas (note this only 
     298         ! applies to output which does not involve global communications) 
     299         IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. & 
     300           & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    & 
     301           &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) 
     302      ELSE 
     303         ! Use ln_ctl to turn on or off all options. 
     304         CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) 
     305      ENDIF 
     306      ! 
     307      IF(lwm) WRITE( numond, namctl ) 
     308      ! 
     309      !                             !------------------------------------! 
     310      !                             !  Set global domain size parameters ! 
     311      !                             !------------------------------------! 
     312      ! 
     313      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist 
     314      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) 
     315903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' ) 
     316      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist 
     317      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) 
     318904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )    
     319      ! 
     320      IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file 
     321         CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     322      ELSE                              ! user-defined namelist 
     323         CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) 
     324      ENDIF 
     325      ! 
     326      IF(lwm)   WRITE( numond, namcfg ) 
     327      ! 
     328      !                             !-----------------------------------------! 
     329      !                             ! mpp parameters and domain decomposition ! 
     330      !                             !-----------------------------------------! 
     331      CALL mpp_init 
    340332 
    341333      ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays 
  • NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/SAS/sbcssm.F90

    r10068 r11573  
    188188      REWIND( numnam_ref )              ! Namelist namsbc_sas in reference namelist : Input fields 
    189189      READ  ( numnam_ref, namsbc_sas, IOSTAT = ios, ERR = 901) 
    190 901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_sas in reference namelist', lwp ) 
     190901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namsbc_sas in reference namelist' ) 
    191191      REWIND( numnam_cfg )              ! Namelist namsbc_sas in configuration namelist : Input fields 
    192192      READ  ( numnam_cfg, namsbc_sas, IOSTAT = ios, ERR = 902 ) 
    193 902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_sas in configuration namelist', lwp ) 
     193902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namsbc_sas in configuration namelist' ) 
    194194      IF(lwm) WRITE ( numond, namsbc_sas ) 
    195195      !            
  • NEMO/branches/2019/dev_r11233_AGRIF-05_jchanut_vert_coord_interp/src/SAS/step.F90

    r10425 r11573  
    9696      !           From SAS: ocean bdy data are wrong  (but we do not care) and ice bdy data are OK.   
    9797      !           This is not clean and should be changed in the future.  
    98       IF( ln_bdy     )       CALL bdy_dta ( kstp, time_offset=+1 )   ! update dynamic & tracer data at open boundaries 
     98      IF( ln_bdy     )       CALL bdy_dta ( kstp, kt_offset=+1 )   ! update dynamic & tracer data at open boundaries 
    9999      ! ==> 
    100100                             CALL sbc    ( kstp )         ! Sea Boundary Condition (including sea-ice) 
Note: See TracChangeset for help on using the changeset viewer.