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 13151 for NEMO/branches/2020/dev_r12527_Gurvan_ShallowWater/src/OCE/DOM/domain.F90 – NEMO

Ignore:
Timestamp:
2020-06-24T14:38:26+02:00 (4 years ago)
Author:
gm
Message:

result from merge with qco r12983

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r12527_Gurvan_ShallowWater/src/OCE/DOM/domain.F90

    r12489 r13151  
    66   !! History :  OPA  !  1990-10  (C. Levy - G. Madec)  Original code 
    77   !!                 !  1992-01  (M. Imbard) insert time step initialization 
    8    !!                 !  1996-06  (G. Madec) generalized vertical coordinate  
     8   !!                 !  1996-06  (G. Madec) generalized vertical coordinate 
    99   !!                 !  1997-02  (G. Madec) creation of domwri.F 
    1010   !!                 !  2001-05  (E.Durand - G. Madec) insert closed sea 
     
    1515   !!            3.7  !  2015-11  (G. Madec, A. Coward)  time varying zgr by default 
    1616   !!            4.0  !  2016-10  (G. Madec, S. Flavoni)  domain configuration / user defined interface 
     17   !!            4.x  ! 2020-02  (G. Madec, S. Techene) introduce ssh to h0 ratio 
    1718   !!---------------------------------------------------------------------- 
    18     
     19 
    1920   !!---------------------------------------------------------------------- 
    2021   !!   dom_init      : initialize the space and time domain 
     
    3435   USE dommsk         ! domain: set the mask system 
    3536   USE domwri         ! domain: write the meshmask file 
     37#if ! defined key_qco 
    3638   USE domvvl         ! variable volume 
     39#else 
     40   USE domqco          ! variable volume 
     41#endif 
    3742   USE c1d            ! 1D configuration 
    3843   USE dyncor_c1d     ! 1D configuration: Coriolis term    (cor_c1d routine) 
     
    6166      !!---------------------------------------------------------------------- 
    6267      !!                  ***  ROUTINE dom_init  *** 
    63       !!                     
    64       !! ** Purpose :   Domain initialization. Call the routines that are  
    65       !!              required to create the arrays which define the space  
     68      !! 
     69      !! ** Purpose :   Domain initialization. Call the routines that are 
     70      !!              required to create the arrays which define the space 
    6671      !!              and time domain of the ocean model. 
    6772      !! 
     
    7681      CHARACTER (len=*), INTENT(in) :: cdstr                  ! model: NEMO or SAS. Determines core restart variables 
    7782      ! 
    78       INTEGER ::   ji, jj, jk, ik   ! dummy loop indices 
     83      INTEGER ::   ji, jj, jk, jt   ! dummy loop indices 
    7984      INTEGER ::   iconf = 0    ! local integers 
    80       CHARACTER (len=64) ::   cform = "(A12, 3(A13, I7))"  
     85      CHARACTER (len=64) ::   cform = "(A12, 3(A13, I7))" 
    8186      INTEGER , DIMENSION(jpi,jpj) ::   ik_top , ik_bot       ! top and bottom ocean level 
    8287      REAL(wp), DIMENSION(jpi,jpj) ::   z1_hu_0, z1_hv_0 
     
    110115         CASE( 7 )   ;   WRITE(numout,*) '         (i.e. cyclic east-west and north-south)' 
    111116         CASE DEFAULT 
    112             CALL ctl_stop( 'jperio is out of range' ) 
     117            CALL ctl_stop( 'dom_init:   jperio is out of range' ) 
    113118         END SELECT 
    114119         WRITE(numout,*)     '      Ocean model configuration used:' 
     
    140145      IF( ln_closea ) CALL dom_clo      ! Read in masks to define closed seas and lakes 
    141146 
    142       CALL dom_zgr( ik_top, ik_bot )    ! Vertical mesh and bathymetry 
     147      CALL dom_zgr( ik_top, ik_bot )    ! Vertical mesh and bathymetry (return top and bottom ocean t-level indices) 
    143148 
    144149      CALL dom_msk( ik_top, ik_bot )    ! Masks 
     
    147152      hu_0(:,:) = 0._wp 
    148153      hv_0(:,:) = 0._wp 
     154      hf_0(:,:) = 0._wp 
    149155      DO jk = 1, jpk 
    150156         ht_0(:,:) = ht_0(:,:) + e3t_0(:,:,jk) * tmask(:,:,jk) 
    151157         hu_0(:,:) = hu_0(:,:) + e3u_0(:,:,jk) * umask(:,:,jk) 
    152158         hv_0(:,:) = hv_0(:,:) + e3v_0(:,:,jk) * vmask(:,:,jk) 
     159         hf_0(:,:) = hf_0(:,:) + e3f_0(:,:,jk) * fmask(:,:,jk) 
    153160      END DO 
    154161      ! 
     162      r1_ht_0(:,:) = ssmask (:,:) / ( ht_0(:,:) + 1._wp -  ssmask (:,:) ) 
     163      r1_hu_0(:,:) = ssumask(:,:) / ( hu_0(:,:) + 1._wp -  ssumask(:,:) ) 
     164      r1_hv_0(:,:) = ssvmask(:,:) / ( hv_0(:,:) + 1._wp -  ssvmask(:,:) ) 
     165      r1_hf_0(:,:) = ssfmask(:,:) / ( hf_0(:,:) + 1._wp -  ssfmask(:,:) ) 
     166 
     167      ! 
     168#if defined key_qco 
     169      !           !==  initialisation of time varying coordinate  ==!   Quasi-Euerian coordinate case 
     170      ! 
     171      IF( .NOT.l_offline )   CALL dom_qco_init( Kbb, Kmm, Kaa ) 
     172      ! 
     173      IF( ln_linssh )        CALL ctl_stop('STOP','domain: key_qco and ln_linssh = T are incompatible') 
     174      ! 
     175#else 
    155176      !           !==  time varying part of coordinate system  ==! 
    156177      ! 
    157178      IF( ln_linssh ) THEN       != Fix in time : set to the reference one for all 
    158       ! 
    159          !       before        !          now          !       after         ! 
    160             gdept(:,:,:,Kbb) = gdept_0  ;   gdept(:,:,:,Kmm) = gdept_0   ;   gdept(:,:,:,Kaa) = gdept_0   ! depth of grid-points 
    161             gdepw(:,:,:,Kbb) = gdepw_0  ;   gdepw(:,:,:,Kmm) = gdepw_0   ;   gdepw(:,:,:,Kaa) = gdepw_0   ! 
    162                                    gde3w = gde3w_0   !        ---          ! 
    163          !                                                                   
    164               e3t(:,:,:,Kbb) =   e3t_0  ;     e3t(:,:,:,Kmm) =   e3t_0   ;   e3t(:,:,:,Kaa) =  e3t_0    ! scale factors 
    165               e3u(:,:,:,Kbb) =   e3u_0  ;     e3u(:,:,:,Kmm) =   e3u_0   ;   e3u(:,:,:,Kaa) =  e3u_0    ! 
    166               e3v(:,:,:,Kbb) =   e3v_0  ;     e3v(:,:,:,Kmm) =   e3v_0   ;   e3v(:,:,:,Kaa) =  e3v_0    ! 
    167                                      e3f =   e3f_0   !        ---          ! 
    168               e3w(:,:,:,Kbb) =   e3w_0  ;     e3w(:,:,:,Kmm) =   e3w_0   ;    e3w(:,:,:,Kaa) =   e3w_0   !  
    169              e3uw(:,:,:,Kbb) =  e3uw_0  ;    e3uw(:,:,:,Kmm) =  e3uw_0   ;   e3uw(:,:,:,Kaa) =  e3uw_0   !   
    170              e3vw(:,:,:,Kbb) =  e3vw_0  ;    e3vw(:,:,:,Kmm) =  e3vw_0   ;   e3vw(:,:,:,Kaa) =  e3vw_0   ! 
    171          ! 
    172          z1_hu_0(:,:) = ssumask(:,:) / ( hu_0(:,:) + 1._wp - ssumask(:,:) )     ! _i mask due to ISF 
    173          z1_hv_0(:,:) = ssvmask(:,:) / ( hv_0(:,:) + 1._wp - ssvmask(:,:) ) 
    174          ! 
    175          !        before       !          now          !       after         ! 
    176                                       ht =    ht_0   !                     ! water column thickness 
    177                hu(:,:,Kbb) =    hu_0  ;      hu(:,:,Kmm) =    hu_0   ;    hu(:,:,Kaa) =    hu_0   !  
    178                hv(:,:,Kbb) =    hv_0  ;      hv(:,:,Kmm) =    hv_0   ;    hv(:,:,Kaa) =    hv_0   ! 
    179             r1_hu(:,:,Kbb) = z1_hu_0  ;   r1_hu(:,:,Kmm) = z1_hu_0   ; r1_hu(:,:,Kaa) = z1_hu_0   ! inverse of water column thickness 
    180             r1_hv(:,:,Kbb) = z1_hv_0  ;   r1_hv(:,:,Kmm) = z1_hv_0   ; r1_hv(:,:,Kaa) = z1_hv_0   ! 
    181          ! 
     179         ! 
     180         DO jt = 1, jpt                         ! depth of t- and w-grid-points 
     181            gdept(:,:,:,jt) = gdept_0(:,:,:) 
     182            gdepw(:,:,:,jt) = gdepw_0(:,:,:) 
     183         END DO 
     184            gde3w(:,:,:)    = gde3w_0(:,:,:)    ! = gdept as the sum of e3t 
     185         ! 
     186         DO jt = 1, jpt                         ! vertical scale factors 
     187            e3t(:,:,:,jt) =  e3t_0(:,:,:) 
     188            e3u(:,:,:,jt) =  e3u_0(:,:,:) 
     189            e3v(:,:,:,jt) =  e3v_0(:,:,:) 
     190            e3w(:,:,:,jt) =  e3w_0(:,:,:) 
     191            e3uw(:,:,:,jt) = e3uw_0(:,:,:) 
     192            e3vw(:,:,:,jt) = e3vw_0(:,:,:) 
     193         END DO 
     194            e3f(:,:,:)    =  e3f_0(:,:,:) 
     195         ! 
     196         DO jt = 1, jpt                         ! water column thickness and its inverse 
     197            hu(:,:,jt)    =    hu_0(:,:) 
     198            hv(:,:,jt)    =    hv_0(:,:) 
     199            r1_hu(:,:,jt) = r1_hu_0(:,:) 
     200            r1_hv(:,:,jt) = r1_hv_0(:,:) 
     201         END DO 
     202            ht(:,:) =    ht_0(:,:) 
    182203         ! 
    183204      ELSE                       != time varying : initialize before/now/after variables 
    184205         ! 
    185          IF( .NOT.l_offline )  CALL dom_vvl_init( Kbb, Kmm, Kaa ) 
    186          ! 
    187       ENDIF 
     206         IF( .NOT.l_offline )   CALL dom_vvl_init( Kbb, Kmm, Kaa ) 
     207         ! 
     208      ENDIF 
     209#endif 
     210 
    188211      ! 
    189212      IF( lk_c1d         )   CALL cor_c1d       ! 1D configuration: Coriolis set at T-point 
     
    198221         WRITE(numout,*) 'dom_init :   ==>>>   END of domain initialization' 
    199222         WRITE(numout,*) '~~~~~~~~' 
    200          WRITE(numout,*)  
     223         WRITE(numout,*) 
    201224      ENDIF 
    202225      ! 
     
    210233      !! ** Purpose :   initialization of global domain <--> local domain indices 
    211234      !! 
    212       !! ** Method  :    
     235      !! ** Method  : 
    213236      !! 
    214237      !! ** Action  : - mig , mjg : local  domain indices ==> global domain indices 
     
    226249      END DO 
    227250      !                              ! global domain indices ==> local domain indices 
    228       !                                   ! (return (m.0,m.1)=(1,0) if data domain gridpoint is to the west/south of the  
    229       !                                   ! local domain, or (m.0,m.1)=(jp.+1,jp.) to the east/north of local domain.  
     251      !                                   ! (return (m.0,m.1)=(1,0) if data domain gridpoint is to the west/south of the 
     252      !                                   ! local domain, or (m.0,m.1)=(jp.+1,jp.) to the east/north of local domain. 
    230253      DO ji = 1, jpiglo 
    231254        mi0(ji) = MAX( 1 , MIN( ji - nimpp + 1, jpi+1 ) ) 
     
    273296      !!---------------------------------------------------------------------- 
    274297      !!                     ***  ROUTINE dom_nam  *** 
    275       !!                     
     298      !! 
    276299      !! ** Purpose :   read domaine namelists and print the variables. 
    277300      !! 
     
    355378      l_1st_euler = ln_1st_euler 
    356379      IF( .NOT. l_1st_euler .AND. .NOT. ln_rstart ) THEN 
    357          IF(lwp) WRITE(numout,*)   
     380         IF(lwp) WRITE(numout,*) 
    358381         IF(lwp) WRITE(numout,*)'   ==>>>   Start from rest (ln_rstart=F)' 
    359382         IF(lwp) WRITE(numout,*)'           an Euler initial time step is used : l_1st_euler is forced to .true. '    
     
    383406      IF(lwp) WRITE(numout,*) 
    384407      SELECT CASE ( nleapy )        ! Choose calendar for IOIPSL 
    385       CASE (  1 )  
     408      CASE (  1 ) 
    386409         CALL ioconf_calendar('gregorian') 
    387410         IF(lwp) WRITE(numout,*) '   ==>>>   The IOIPSL calendar is "gregorian", i.e. leap year' 
     
    419442      IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    420443         lrxios = ln_xios_read.AND.ln_rstart 
    421 !set output file type for XIOS based on NEMO namelist  
    422          IF (nn_wxios > 0) lwxios = .TRUE.  
     444!set output file type for XIOS based on NEMO namelist 
     445         IF (nn_wxios > 0) lwxios = .TRUE. 
    423446         nxioso = nn_wxios 
    424447      ENDIF 
     
    463486      !!---------------------------------------------------------------------- 
    464487      INTEGER, DIMENSION(2) ::   imi1, imi2, ima1, ima2 
    465       INTEGER, DIMENSION(2) ::   iloc   !  
     488      INTEGER, DIMENSION(2) ::   iloc   ! 
    466489      REAL(wp) ::   ze1min, ze1max, ze2min, ze2max 
    467490      !!---------------------------------------------------------------------- 
     
    473496         CALL mpp_maxloc( 'domain', e2t(:,:), tmask_i(:,:), ze2max, ima2 ) 
    474497      ELSE 
    475          ze1min = MINVAL( e1t(:,:), mask = tmask_i(:,:) == 1._wp )     
    476          ze2min = MINVAL( e2t(:,:), mask = tmask_i(:,:) == 1._wp )     
    477          ze1max = MAXVAL( e1t(:,:), mask = tmask_i(:,:) == 1._wp )     
    478          ze2max = MAXVAL( e2t(:,:), mask = tmask_i(:,:) == 1._wp )     
     498         ze1min = MINVAL( e1t(:,:), mask = tmask_i(:,:) == 1._wp ) 
     499         ze2min = MINVAL( e2t(:,:), mask = tmask_i(:,:) == 1._wp ) 
     500         ze1max = MAXVAL( e1t(:,:), mask = tmask_i(:,:) == 1._wp ) 
     501         ze2max = MAXVAL( e2t(:,:), mask = tmask_i(:,:) == 1._wp ) 
    479502         ! 
    480503         iloc  = MINLOC( e1t(:,:), mask = tmask_i(:,:) == 1._wp ) 
     
    507530      !!---------------------------------------------------------------------- 
    508531      !!                     ***  ROUTINE dom_nam  *** 
    509       !!                     
     532      !! 
    510533      !! ** Purpose :   read the domain size in domain configuration file 
    511534      !! 
     
    514537      CHARACTER(len=*)              , INTENT(out) ::   cd_cfg          ! configuration name 
    515538      INTEGER                       , INTENT(out) ::   kk_cfg          ! configuration resolution 
    516       INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes  
    517       INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c.  
     539      INTEGER                       , INTENT(out) ::   kpi, kpj, kpk   ! global domain sizes 
     540      INTEGER                       , INTENT(out) ::   kperio          ! lateral global domain b.c. 
    518541      ! 
    519542      INTEGER ::   inum   ! local integer 
     
    547570         cd_cfg = 'UNKNOWN' 
    548571         kk_cfg = -9999999 
    549                                           !- or they may be present as global attributes  
    550                                           !- (netcdf only)   
     572                                          !- or they may be present as global attributes 
     573                                          !- (netcdf only) 
    551574         CALL iom_getatt( inum, 'cn_cfg', cd_cfg )  ! returns   !  if not found 
    552575         CALL iom_getatt( inum, 'nn_cfg', kk_cfg )  ! returns -999 if not found 
     
    570593         WRITE(numout,*) '      type of global domain lateral boundary   jperio = ', kperio 
    571594      ENDIF 
    572       !         
     595      ! 
    573596   END SUBROUTINE domain_cfg 
    574     
    575     
     597 
     598 
    576599   SUBROUTINE cfg_write 
    577600      !!---------------------------------------------------------------------- 
    578601      !!                  ***  ROUTINE cfg_write  *** 
    579       !!                    
    580       !! ** Purpose :   Create the "cn_domcfg_out" file, a NetCDF file which  
    581       !!              contains all the ocean domain informations required to  
     602      !! 
     603      !! ** Purpose :   Create the "cn_domcfg_out" file, a NetCDF file which 
     604      !!              contains all the ocean domain informations required to 
    582605      !!              define an ocean configuration. 
    583606      !! 
     
    585608      !!              ocean configuration. 
    586609      !! 
    587       !! ** output file :   domcfg_out.nc : domain size, characteristics, horizontal  
     610      !! ** output file :   domcfg_out.nc : domain size, characteristics, horizontal 
    588611      !!                       mesh, Coriolis parameter, and vertical scale factors 
    589612      !!                    NB: also contain ORCA family information 
     
    603626      !                       !  create 'domcfg_out.nc' file  ! 
    604627      !                       ! ============================= ! 
    605       !          
     628      ! 
    606629      clnam = cn_domcfg_out  ! filename (configuration information) 
    607630      CALL iom_open( TRIM(clnam), inum, ldwrt = .TRUE. ) 
    608        
     631 
    609632      ! 
    610633      !                             !==  ORCA family specificities  ==! 
    611634      IF( cn_cfg == "ORCA" ) THEN 
    612635         CALL iom_rstput( 0, 0, inum, 'ORCA'      , 1._wp            , ktype = jp_i4 ) 
    613          CALL iom_rstput( 0, 0, inum, 'ORCA_index', REAL( nn_cfg, wp), ktype = jp_i4 )          
     636         CALL iom_rstput( 0, 0, inum, 'ORCA_index', REAL( nn_cfg, wp), ktype = jp_i4 ) 
    614637      ENDIF 
    615638      ! 
     
    643666      CALL iom_rstput( 0, 0, inum, 'glamv', glamv, ktype = jp_r8 ) 
    644667      CALL iom_rstput( 0, 0, inum, 'glamf', glamf, ktype = jp_r8 ) 
    645       !                                 
     668      ! 
    646669      CALL iom_rstput( 0, 0, inum, 'gphit', gphit, ktype = jp_r8 )   ! longitude 
    647670      CALL iom_rstput( 0, 0, inum, 'gphiu', gphiu, ktype = jp_r8 ) 
    648671      CALL iom_rstput( 0, 0, inum, 'gphiv', gphiv, ktype = jp_r8 ) 
    649672      CALL iom_rstput( 0, 0, inum, 'gphif', gphif, ktype = jp_r8 ) 
    650       !                                 
     673      ! 
    651674      CALL iom_rstput( 0, 0, inum, 'e1t'  , e1t  , ktype = jp_r8 )   ! i-scale factors (e1.) 
    652675      CALL iom_rstput( 0, 0, inum, 'e1u'  , e1u  , ktype = jp_r8 ) 
     
    663686      ! 
    664687      !                             !==  vertical mesh  ==! 
    665       !                                                      
     688      ! 
    666689      CALL iom_rstput( 0, 0, inum, 'e3t_1d'  , e3t_1d , ktype = jp_r8 )   ! reference 1D-coordinate 
    667690      CALL iom_rstput( 0, 0, inum, 'e3w_1d'  , e3w_1d , ktype = jp_r8 ) 
     
    674697      CALL iom_rstput( 0, 0, inum, 'e3uw_0'  , e3uw_0 , ktype = jp_r8 ) 
    675698      CALL iom_rstput( 0, 0, inum, 'e3vw_0'  , e3vw_0 , ktype = jp_r8 ) 
    676       !                                          
     699      ! 
    677700      !                             !==  wet top and bottom level  ==!   (caution: multiplied by ssmask) 
    678701      ! 
     
    694717      ! 
    695718      !                                ! ============================ 
    696       !                                !        close the files  
     719      !                                !        close the files 
    697720      !                                ! ============================ 
    698721      CALL iom_close( inum ) 
Note: See TracChangeset for help on using the changeset viewer.