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 13874 for NEMO/branches/2020 – NEMO

Changeset 13874 for NEMO/branches/2020


Ignore:
Timestamp:
2020-11-25T14:49:40+01:00 (3 years ago)
Author:
techene
Message:

#2574 ssh set up at initialization or restart separated from u,v,ts : removed from istate_init added in dom_init

Location:
NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/domain.F90

    r13737 r13874  
    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.0  ! 2020-02  (G. Madec, S. Techene)  introduce ssh to h0 ratio 
     17   !!            4.1  ! 2020-02  (G. Madec, S. Techene)  introduce ssh to h0 ratio 
    1818   !!---------------------------------------------------------------------- 
    1919    
     
    2828   USE oce            ! ocean variables 
    2929   USE dom_oce        ! domain: ocean 
     30#if defined key_qco 
     31   USE domqco         ! quasi-eulerian 
     32#else 
     33   USE domvvl         ! variable volume 
     34#endif 
     35   USE sshwzv  , ONLY : ssh_init_rst   ! set initial ssh  
    3036   USE sbc_oce        ! surface boundary condition: ocean 
    3137   USE trc_oce        ! shared ocean & passive tracers variab 
     
    3541   USE dommsk         ! domain: set the mask system 
    3642   USE domwri         ! domain: write the meshmask file 
    37 #if ! defined key_qco 
    38    USE domvvl         ! variable volume 
    39 #else 
    40    USE domqco          ! variable volume 
    41 #endif 
    4243   USE c1d            ! 1D configuration 
    4344   USE dyncor_c1d     ! 1D configuration: Coriolis term    (cor_c1d routine) 
    44    USE wet_dry, ONLY : ll_wd 
    45    USE closea , ONLY : dom_clo ! closed seas 
     45   USE wet_dry , ONLY : ll_wd     ! wet & drying flag 
     46   USE closea  , ONLY : dom_clo   ! closed seas routine 
    4647   ! 
    4748   USE in_out_manager ! I/O manager 
     
    5657   PUBLIC   domain_cfg   ! called by nemogcm.F90 
    5758 
     59   !! * Substitutions 
     60#  include "do_loop_substitute.h90" 
    5861   !!------------------------------------------------------------------------- 
    5962   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    173176      r1_hf_0(:,:) = ssfmask(:,:) / ( hf_0(:,:) + 1._wp -  ssfmask(:,:) ) 
    174177      ! 
     178      IF( ll_wd ) THEN       ! wet and drying (check ht_0 >= 0) 
     179         DO_2D( 1, 1, 1, 1 ) 
     180            IF( ht_0(ji,jj) < 0._wp .AND. ssmask(ji,jj) == 1._wp ) THEN 
     181               CALL ctl_stop( 'ssh_init_rst : ht_0 must be positive at potentially wet points' ) 
     182            ENDIF 
     183         END_2D 
     184      ENDIF 
     185      ! 
     186      !           !==  initialisation of time varying coordinate  ==! 
     187      ! 
     188      !                                 != ssh initialization 
     189      IF( cdstr /= 'SAS' ) THEN 
     190         CALL ssh_init_rst( Kbb, Kmm, Kaa ) 
     191      ENDIF 
     192      ! 
    175193#if defined key_qco 
    176       !           !==  initialisation of time varying coordinate  ==!  Quasi-Euerian coordinate case 
     194      !                                 != Quasi-Euerian coordinate case 
    177195      ! 
    178196      IF( .NOT.l_offline )   CALL dom_qco_init( Kbb, Kmm, Kaa ) 
    179       ! 
    180       IF( ln_linssh )        CALL ctl_stop('STOP','domain: key_qco and ln_linssh = T are incompatible') 
    181       ! 
    182197#else 
    183       !           !==  time varying part of coordinate system  ==! 
    184       ! 
    185       IF( ln_linssh ) THEN       != Fix in time : set to the reference one for all 
     198      ! 
     199      IF( ln_linssh ) THEN              != Fix in time : set to the reference one for all 
    186200         ! 
    187201         DO jt = 1, jpt                         ! depth of t- and w-grid-points 
     
    209223               ht   (:,:) =    ht_0(:,:) 
    210224         ! 
    211       ELSE                       != time varying : initialize before/now/after variables 
     225      ELSE                              != Time varying : initialize before/now/after variables 
    212226         ! 
    213227         IF( .NOT.l_offline )   CALL dom_vvl_init( Kbb, Kmm, Kaa ) 
     
    325339      ENDIF 
    326340      ! 
     341      !                       !=======================! 
     342      !                       !==  namelist namrun  ==! 
     343      !                       !=======================! 
    327344      ! 
    328345      READ  ( numnam_ref, namrun, IOSTAT = ios, ERR = 901) 
     
    423440         END SELECT 
    424441      ENDIF 
    425  
     442      ! 
     443      !                       !=======================! 
     444      !                       !==  namelist namdom  ==! 
     445      !                       !=======================! 
     446      ! 
    426447      READ  ( numnam_ref, namdom, IOSTAT = ios, ERR = 903) 
    427448903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namdom in reference namelist' ) 
     
    431452      ! 
    432453#if defined key_agrif 
    433       IF( .NOT. Agrif_Root() ) THEN 
    434             rn_Dt = Agrif_Parent(rn_Dt) / Agrif_Rhot() 
     454      IF( .NOT. Agrif_Root() ) THEN    ! AGRIF child, subdivide the Parent timestep 
     455         rn_Dt = Agrif_Parent (rn_Dt ) / Agrif_Rhot() 
    435456      ENDIF 
    436457#endif 
     
    446467      ENDIF 
    447468      ! 
    448       !! Initialise current model timestep rDt = 2*rn_Dt if MLF or rDt = rn_Dt if RK3 
    449       rDt  = 2._wp * rn_Dt 
     469      ! set current model timestep rDt = 2*rn_Dt if MLF or rDt = rn_Dt if RK3 
     470      rDt   = 2._wp * rn_Dt 
    450471      r1_Dt = 1._wp / rDt 
     472      ! 
     473#if defined key_qco 
     474      IF( ln_linssh )   CALL ctl_stop( 'STOP','domain: key_qco and ln_linssh = T are incompatible' ) 
     475#endif 
    451476 
    452477      IF( TRIM(Agrif_CFixed()) == '0' ) THEN 
    453          lrxios = ln_xios_read.AND.ln_rstart 
    454 !set output file type for XIOS based on NEMO namelist  
    455          IF (nn_wxios > 0) lwxios = .TRUE.  
     478         lrxios = ln_xios_read .AND. ln_rstart 
     479         IF (nn_wxios > 0)   lwxios = .TRUE.    ! set output file type for XIOS based on NEMO namelist 
    456480         nxioso = nn_wxios 
    457481      ENDIF 
    458482 
    459483#if defined key_netcdf4 
    460       !                             ! NetCDF 4 case   ("key_netcdf4" defined) 
     484      ! 
     485      !                       !=======================! 
     486      !                       !==  namelist namnc4  ==!   NetCDF 4 case   ("key_netcdf4" defined) 
     487      !                       !=======================! 
     488      ! 
    461489      READ  ( numnam_ref, namnc4, IOSTAT = ios, ERR = 907) 
    462490907   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namnc4 in reference namelist' ) 
     
    467495      IF(lwp) THEN                        ! control print 
    468496         WRITE(numout,*) 
    469          WRITE(numout,*) '   Namelist namnc4 - Netcdf4 chunking parameters' 
     497         WRITE(numout,*) '   Namelist namnc4 - Netcdf4 chunking parameters ("key_netcdf4" defined)' 
    470498         WRITE(numout,*) '      number of chunks in i-dimension             nn_nchunks_i = ', nn_nchunks_i 
    471499         WRITE(numout,*) '      number of chunks in j-dimension             nn_nchunks_j = ', nn_nchunks_j 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/domqco.F90

    r13761 r13874  
    99   !!            3.6  !  2014-11  (P. Mathiot) add ice shelf capability 
    1010   !!            4.1  !  2019-08  (A. Coward, D. Storkey) add time level indices for prognostic variables 
    11    !!            4.x  !  2020-02  (S. Techene, G. Madec) quasi-eulerian coordinate (z* or s*) from domvvl 
    12    !!---------------------------------------------------------------------- 
    13  
    14    !!---------------------------------------------------------------------- 
    15    !!   dom_qco_init   : define initial vertical scale factors, depths and column thickness 
    16    !!   dom_qco_zgr    : Set ssh/h_0 ratio at t 
    17    !!   dom_qco_r3c    : Compute ssh/h_0 ratio at t-, u-, v-, and optionally f-points 
    18    !!       qco_rst_read : read/write restart file 
    19    !!       qco_ctl    : Check the vvl options 
     11   !!             -   !  2020-02  (S. Techene, G. Madec) quasi-eulerian coordinate (z* or s*) 
     12   !!---------------------------------------------------------------------- 
     13 
     14   !!---------------------------------------------------------------------- 
     15   !!   dom_qco_init  : define initial vertical scale factors, depths and column thickness 
     16   !!   dom_qco_zgr   : Set ssh/h_0 ratio at t 
     17   !!   dom_qco_r3c   : Compute ssh/h_0 ratio at t-, u-, v-, and optionally f-points 
     18   !!       qco_ctl   : Check the vvl options 
    2019   !!---------------------------------------------------------------------- 
    2120   USE oce            ! ocean dynamics and tracers 
     
    5655   LOGICAL , PUBLIC :: ln_vvl_dbg = .FALSE.                ! debug control prints 
    5756 
    58    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: un_td, vn_td                ! thickness diffusion transport 
    59  
    6057   !! * Substitutions 
    6158#  include "do_loop_substitute.h90" 
     
    8885      ! 
    8986      CALL qco_ctl                            ! choose vertical coordinate (z_star, z_tilde or layer) 
    90       ! 
    91       CALL qco_rst_read( nit000, Kbb, Kmm )   ! Read or initialize ssh_(Kbb/Kmm) 
    9287      ! 
    9388      CALL dom_qco_zgr( Kbb, Kmm )            ! interpolation scale factor, depth and water column 
     
    113108      !!                ***  ROUTINE dom_qco_init  *** 
    114109      !! 
    115       !! ** Purpose :  Initialization of all ssh./h._0 ratio 
    116       !! 
    117       !! ** Method  :  - call domqco using Kbb and Kmm 
    118       !! 
    119       !! ** Action  : - r3(t/u/v)_b 
    120       !!              - r3(t/u/v/f)_n 
     110      !! ** Purpose :  Initialization of all r3. = ssh./h._0 ratios 
     111      !! 
     112      !! ** Method  :  Call domqco using Kbb and Kmm 
     113      !!               NB: dom_qco_zgr is called by dom_qco_init it uses ssh from ssh_init  
     114      !! 
     115      !! ** Action  : - r3(t/u/v)(Kbb) 
     116      !!              - r3(t/u/v/f)(Kmm) 
    121117      !!---------------------------------------------------------------------- 
    122118      INTEGER, INTENT(in) ::   Kbb, Kmm   ! time level indices 
     
    125121      !                    !== Set of all other vertical scale factors  ==!  (now and before) 
    126122      !                                ! Horizontal interpolation of e3t 
    127       CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb) ) 
     123      CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb)           ) 
    128124      CALL dom_qco_r3c( ssh(:,:,Kmm), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm), r3f(:,:) ) 
    129       ! 
    130125      ! 
    131126   END SUBROUTINE dom_qco_zgr 
     
    204199      ! 
    205200   END SUBROUTINE dom_qco_r3c 
    206  
    207  
    208    SUBROUTINE qco_rst_read( kt, Kbb, Kmm ) 
    209       !!--------------------------------------------------------------------- 
    210       !!                   ***  ROUTINE qco_rst_read  *** 
    211       !! 
    212       !! ** Purpose :   Read ssh in restart file 
    213       !! 
    214       !! ** Method  :   use of IOM library 
    215       !!                if the restart does not contain ssh, 
    216       !!                it is set to the _0 values. 
    217       !!---------------------------------------------------------------------- 
    218       INTEGER, INTENT(in) ::   kt         ! ocean time-step 
    219       INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices 
    220       ! 
    221       INTEGER ::   ji, jj, jk 
    222       INTEGER ::   id1, id2     ! local integers 
    223       !!---------------------------------------------------------------------- 
    224       ! 
    225       IF( ln_rstart ) THEN                   !* Read the restart file 
    226          CALL rst_read_open                  !  open the restart file if necessary 
    227          ! 
    228          id1 = iom_varid( numror, 'sshb', ldstop = .FALSE. ) 
    229          id2 = iom_varid( numror, 'sshn', ldstop = .FALSE. ) 
    230          ! 
    231          !                             ! --------- ! 
    232          !                             ! all cases ! 
    233          !                             ! --------- ! 
    234          ! 
    235          IF( MIN( id1, id2 ) > 0 ) THEN       ! all required arrays exist 
    236             CALL iom_get( numror, jpdom_auto, 'sshb'   , ssh(:,:,Kbb), ldxios = lrxios    ) 
    237             CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    ) 
    238             ! needed to restart if land processor not computed 
    239             IF(lwp) write(numout,*) 'qco_rst_read : ssh(:,:,Kbb) and ssh(:,:,Kmm) found in restart files' 
    240             !!WHERE ( ssmask(:,:) == 0.0_wp )   !!gm/st ==> sm should not be necessary on ssh while it was required on e3 
    241             !!   ssh(:,:,Kmm) = 0._wp 
    242             !!   ssh(:,:,Kbb) = 0._wp 
    243             !!END WHERE 
    244             IF( l_1st_euler ) THEN 
    245                ssh(:,:,Kbb) = ssh(:,:,Kmm) 
    246             ENDIF 
    247          ELSE IF( id1 > 0 ) THEN 
    248             IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart files' 
    249             IF(lwp) write(numout,*) 'sshn set equal to sshb.' 
    250             IF(lwp) write(numout,*) 'neuler is forced to 0' 
    251             CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios ) 
    252             ssh(:,:,Kmm) = ssh(:,:,Kbb) 
    253             l_1st_euler = .TRUE. 
    254          ELSE IF( id2 > 0 ) THEN 
    255             IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kbb) not found in restart files' 
    256             IF(lwp) write(numout,*) 'sshb set equal to sshn.' 
    257             IF(lwp) write(numout,*) 'neuler is forced to 0' 
    258             CALL iom_get( numror, jpdom_auto, 'sshn', ssh(:,:,Kmm), ldxios = lrxios ) 
    259             ssh(:,:,Kbb) = ssh(:,:,Kmm) 
    260             l_1st_euler = .TRUE. 
    261          ELSE 
    262             IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart file' 
    263             IF(lwp) write(numout,*) 'ssh_b and ssh_n set to zero' 
    264             IF(lwp) write(numout,*) 'neuler is forced to 0' 
    265             ssh(:,:,:) = 0._wp 
    266             l_1st_euler = .TRUE. 
    267          ENDIF 
    268          ! 
    269       ELSE                                   !* Initialize at "rest" 
    270          ! 
    271          IF( ll_wd ) THEN   ! MJB ll_wd edits start here - these are essential 
    272             ! 
    273             IF( cn_cfg == 'wad' ) THEN            ! Wetting and drying test case 
    274                CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  ) 
    275                ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones 
    276                ssh(:,:    ,Kmm) = ssh(:,:    ,Kbb) 
    277                uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb) 
    278                vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb) 
    279             ELSE                                  ! if not test case 
    280                ssh(:,:,Kmm) = -ssh_ref 
    281                ssh(:,:,Kbb) = -ssh_ref 
    282                ! 
    283                DO_2D( 1, 1, 1, 1 ) 
    284                   IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth 
    285                      ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) ) 
    286                      ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) ) 
    287                   ENDIF 
    288                END_2D 
    289             ENDIF 
    290             ! 
    291             DO ji = 1, jpi 
    292                DO jj = 1, jpj 
    293                   IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN 
    294                     CALL ctl_stop( 'qco_rst_read: ht_0 must be positive at potentially wet points' ) 
    295                   ENDIF 
    296                END DO 
    297             END DO 
    298             ! 
    299          ELSE 
    300             ! 
    301             ! Just to read set ssh in fact, called latter once vertical grid 
    302             ! is set up: 
    303 !           CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  ) 
    304 !           ! 
    305 !!st            ssh(:,:,:) = 0._wp 
    306             CALL usr_def_ssh( tmask, ssh(:,:,Kbb) ) 
    307             ! 
    308             ssh(:,:,Kmm) = ssh(:,:,Kbb) 
    309             ! 
    310          ENDIF           ! end of ll_wd edits 
    311          ! 
    312       ENDIF 
    313       ! 
    314    END SUBROUTINE qco_rst_read 
    315201 
    316202 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/domvvl.F90

    r13295 r13874  
    99   !!            3.6  !  2014-11  (P. Mathiot) add ice shelf capability 
    1010   !!            4.1  !  2019-08  (A. Coward, D. Storkey) rename dom_vvl_sf_swp -> dom_vvl_sf_update for new timestepping 
    11    !!            4.x  ! 2020-02  (G. Madec, S. Techene) introduce ssh to h0 ratio 
     11   !!             -   ! 2020-02  (G. Madec, S. Techene) introduce ssh to h0 ratio 
    1212   !!---------------------------------------------------------------------- 
    1313 
     
    805805         IF( ln_rstart ) THEN                   !* Read the restart file 
    806806            CALL rst_read_open                  !  open the restart file if necessary 
    807             CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    ) 
    808807            ! 
    809808            id1 = iom_varid( numror, 'e3t_b', ldstop = .FALSE. ) 
     
    882881            ENDIF 
    883882            ! 
    884          ELSE                                   !* Initialize at "rest" 
     883         ELSE                                   !* Initialize at "rest" with ssh 
    885884            ! 
    886  
    887             IF( ll_wd ) THEN   ! MJB ll_wd edits start here - these are essential  
    888                ! 
    889                IF( cn_cfg == 'wad' ) THEN 
    890                   ! Wetting and drying test case 
    891                   CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  ) 
    892                   ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones 
    893                   ssh (:,:,Kmm)     = ssh(:,:,Kbb) 
    894                   uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb) 
    895                   vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb) 
    896                ELSE 
    897                   ! if not test case 
    898                   ssh(:,:,Kmm) = -ssh_ref 
    899                   ssh(:,:,Kbb) = -ssh_ref 
    900  
    901                   DO_2D( 1, 1, 1, 1 ) 
    902                      IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN ! if total depth is less than min depth 
    903                         ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) ) 
    904                         ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) ) 
    905                      ENDIF 
    906                   END_2D 
    907                ENDIF !If test case else 
    908  
    909                ! Adjust vertical metrics for all wad 
    910                DO jk = 1, jpk 
    911                   e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kmm)  ) & 
    912                     &                            / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk)   & 
    913                     &            + e3t_0(:,:,jk) * ( 1._wp - tmask(:,:,jk) ) 
    914                END DO 
    915                e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
    916  
    917                DO_2D( 1, 1, 1, 1 ) 
    918                   IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN 
    919                      CALL ctl_stop( 'dom_vvl_rst: ht_0 must be positive at potentially wet points' ) 
    920                   ENDIF 
    921                END_2D 
    922                ! 
    923             ELSE 
    924                ! 
    925                ! Just to read set ssh in fact, called latter once vertical grid 
    926                ! is set up: 
    927 !               CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  ) 
    928 !               ! 
    929 !               DO jk=1,jpk 
    930 !                  e3t(:,:,jk,Kbb) =  e3t_0(:,:,jk) * ( ht_0(:,:) + ssh(:,:,Kbb) ) & 
    931 !                     &            / ( ht_0(:,:) + 1._wp -ssmask(:,:) ) * tmask(:,:,jk) 
    932 !               END DO 
    933 !               e3t(:,:,:,Kmm) = e3t(:,:,:,Kbb) 
    934                 ssh(:,:,Kmm)=0._wp 
    935                 e3t(:,:,:,Kmm)=e3t_0(:,:,:) 
    936                 e3t(:,:,:,Kbb)=e3t_0(:,:,:) 
    937                ! 
    938             END IF           ! end of ll_wd edits 
    939  
     885            DO jk = 1, jpk 
     886               e3t(:,:,jk,Kmm) =  e3t_0(:,:,jk) * ( 1._wp + ssh(:,:,Kmm)  / ( ht_0(:,:) + 1._wp - ssmask(:,:) ) * tmask(:,:,jk) ) 
     887            END DO 
     888            e3t(:,:,:,Kbb) = e3t(:,:,:,Kmm) 
     889            ! 
    940890            IF( ln_vvl_ztilde .OR. ln_vvl_layer) THEN 
    941891               tilde_e3t_b(:,:,:) = 0._wp 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DOM/istate.F90

    r13734 r13874  
    5959      !!  
    6060      !! ** Purpose :   Initialization of the dynamics and tracer fields. 
     61      !! 
     62      !! ** Method  :    
    6163      !!---------------------------------------------------------------------- 
    6264      INTEGER, INTENT( in )  ::  Kbb, Kmm, Kaa   ! ocean time level indices 
     
    7375      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' 
    7476 
    75 !!gm  Why not include in the first call of dta_tsd ?   
    76 !!gm  probably associated with the use of internal damping... 
    7777       CALL dta_tsd_init        ! Initialisation of T & S input data 
    78 !!gm to be moved in usrdef of C1D case 
     78 
    7979!      IF( lk_c1d )   CALL dta_uvd_init        ! Initialization of U & V input data 
    80 !!gm 
     80 
    8181      rhd  (:,:,:      ) = 0._wp   ;   rhop (:,:,:  ) = 0._wp      ! set one for all to 0 at level jpk 
    8282      rn2b (:,:,:      ) = 0._wp   ;   rn2  (:,:,:  ) = 0._wp      ! set one for all to 0 at levels 1 and jpk 
     
    9595         CALL agrif_istate( Kbb, Kmm, Kaa )   ! Interp from parent 
    9696         ! 
    97          ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)  
     97         ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb) 
     98!!st 
     99!!st need for a recent agrif version to be displaced toward ssh_init_rst with agrif_istate_ssh 
    98100         ssh(:,:,    Kmm) = ssh(:,:    ,Kbb) 
     101!!st end 
    99102         uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb) 
    100103         vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb) 
     
    116119            CALL dta_tsd( nit000, ts(:,:,:,:,Kbb) )       ! read 3D T and S data at nit000 
    117120            ! 
    118             ssh(:,:  ,Kbb) = 0._wp               ! set the ocean at rest 
    119121            uu (:,:,:,Kbb) = 0._wp 
    120122            vv (:,:,:,Kbb) = 0._wp   
    121123            ! 
    122             IF( ll_wd ) THEN 
    123                ssh(:,:,Kbb) =  -ssh_ref  ! Added in 30 here for bathy that adds 30 as Iterative test CEOD  
    124                ! 
    125                ! Apply minimum wetdepth criterion 
    126                ! 
    127                DO_2D( 1, 1, 1, 1 ) 
    128                   IF( ht_0(ji,jj) + ssh(ji,jj,Kbb)  < rn_wdmin1 ) THEN 
    129                      ssh(ji,jj,Kbb) = tmask(ji,jj,1)*( rn_wdmin1 - (ht_0(ji,jj)) ) 
    130                   ENDIF 
    131                END_2D 
    132             ENDIF  
    133              ! 
    134124         ELSE                                 ! user defined initial T and S 
    135125            DO jk = 1, jpk 
    136126               zgdept(:,:,jk) = gdept(:,:,jk,Kbb) 
    137127            END DO 
    138             CALL usr_def_istate( zgdept, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )          
     128            CALL usr_def_istate( zgdept, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb) ) 
    139129         ENDIF 
    140130         ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones 
    141          ssh(:,:    ,Kmm) = ssh(:,:    ,Kbb)    
    142131         uu (:,:,:  ,Kmm) = uu (:,:,:  ,Kbb) 
    143132         vv (:,:,:  ,Kmm) = vv (:,:,:  ,Kbb) 
    144133 
    145 !!gm POTENTIAL BUG : 
    146 !!gm  ISSUE :  if ssh(:,:,Kbb) /= 0  then, in non linear free surface, the e3._n, e3._b should be recomputed 
    147 !!             as well as gdept_ and gdepw_....   !!!!!  
    148 !!      ===>>>>   probably a call to domvvl initialisation here.... 
    149  
    150  
    151134         ! 
    152 !!gm to be moved in usrdef of C1D case 
    153 !         IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
    154 !            ALLOCATE( zuvd(jpi,jpj,jpk,2) ) 
    155 !            CALL dta_uvd( nit000, zuvd ) 
    156 !            uu(:,:,:,Kbb) = zuvd(:,:,:,1) ;  uu(:,:,:,Kmm) = uu(:,:,:,Kbb) 
    157 !            vv(:,:,:,Kbb) = zuvd(:,:,:,2) ;  vv(:,:,:,Kmm) = vv(:,:,:,Kbb) 
    158 !            DEALLOCATE( zuvd ) 
    159 !         ENDIF 
     135!!gm ==>>>  to be moved in usrdef_istate of C1D case  
     136         IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 
     137            ALLOCATE( zuvd(jpi,jpj,jpk,2) ) 
     138            CALL dta_uvd( nit000, Kbb, zuvd ) 
     139            uu(:,:,:,Kbb) = zuvd(:,:,:,1) ;  uu(:,:,:,Kmm) = uu(:,:,:,Kbb) 
     140            vv(:,:,:,Kbb) = zuvd(:,:,:,2) ;  vv(:,:,:,Kmm) = vv(:,:,:,Kbb) 
     141            DEALLOCATE( zuvd ) 
     142         ENDIF 
    160143         ! 
    161 !!gm This is to be changed !!!! 
    162 !         ! - ML - ssh(:,:,Kmm) could be modified by istate_eel, so that initialization of e3t(:,:,:,Kbb) is done here 
    163 !         IF( .NOT.ln_linssh ) THEN 
    164 !            DO jk = 1, jpk 
    165 !               e3t(:,:,jk,Kbb) = e3t(:,:,jk,Kmm) 
    166 !            END DO 
    167 !         ENDIF 
    168 !!gm  
    169144         !  
    170145      ENDIF  
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/DYN/sshwzv.F90

    r13427 r13874  
    66   !! History :  3.1  !  2009-02  (G. Madec, M. Leclair)  Original code 
    77   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  modified LF-RA  
    8    !!             -   !  2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface 
    9    !!             -   !  2010-09  (D.Storkey and E.O'Dea) bug fixes for BDY module 
    10    !!            3.3  !  2011-10  (M. Leclair) split former ssh_wzv routine and remove all vvl related work 
    11    !!            4.0  !  2018-12  (A. Coward) add mixed implicit/explicit advection 
    12    !!            4.1  !  2019-08  (A. Coward, D. Storkey) Rename ssh_nxt -> ssh_atf. Now only does time filtering. 
     8   !!             -   !  2010-05  (K. Mogensen, A. Weaver, M. Martin, D. Lea)  Assimilation interface 
     9   !!             -   !  2010-09  (D.Storkey and E.O'Dea)  bug fixes for BDY module 
     10   !!            3.3  !  2011-10  (M. Leclair)  split former ssh_wzv routine and remove all vvl related work 
     11   !!            4.0  !  2018-12  (A. Coward)  add mixed implicit/explicit advection 
     12   !!            4.1  !  2019-08  (A. Coward, D. Storkey)  Rename ssh_nxt -> ssh_atf. Now only does time filtering. 
     13   !!             -   !  2020-08  (S. Techene, G. Madec)  add here ssh initiatlisation 
    1314   !!---------------------------------------------------------------------- 
    1415 
     
    1718   !!   ssh_atf       : time filter the ssh arrays 
    1819   !!   wzv           : compute now vertical velocity 
     20   !!   ssh_init_rst  : ssh set from restart or domcfg.nc file or usr_def_istat_ssh 
    1921   !!---------------------------------------------------------------------- 
    2022   USE oce            ! ocean dynamics and tracers variables 
     
    4042   USE timing         ! Timing 
    4143   USE wet_dry        ! Wetting/Drying flux limiting 
    42  
     44   USE usrdef_istate, ONLY : usr_def_istate_ssh   ! user defined ssh initial state  
     45    
    4346   IMPLICIT NONE 
    4447   PRIVATE 
    4548 
    46    PUBLIC   ssh_nxt    ! called by step.F90 
    47    PUBLIC   wzv        ! called by step.F90 
    48    PUBLIC   wAimp      ! called by step.F90 
    49    PUBLIC   ssh_atf    ! called by step.F90 
     49   PUBLIC   ssh_nxt        ! called by step.F90 
     50   PUBLIC   wzv            ! called by step.F90 
     51   PUBLIC   wAimp          ! called by step.F90 
     52   PUBLIC   ssh_atf        ! called by step.F90 
     53   PUBLIC   ssh_init_rst   ! called by domain.F90 
    5054 
    5155   !! * Substitutions 
    5256#  include "do_loop_substitute.h90" 
    5357#  include "domzgr_substitute.h90" 
    54  
    5558   !!---------------------------------------------------------------------- 
    5659   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
     
    433436      ! 
    434437   END SUBROUTINE wAimp 
     438 
     439 
     440   SUBROUTINE ssh_init_rst( Kbb, Kmm, Kaa ) 
     441      !!--------------------------------------------------------------------- 
     442      !!                   ***  ROUTINE ssh_init_rst  *** 
     443      !! 
     444      !! ** Purpose :   ssh initialization of the sea surface height (ssh) 
     445      !! 
     446      !! ** Method  :   set ssh from restart or read configuration, or user_def 
     447      !!              * ln_rstart = T 
     448      !!                   USE of IOM library to read ssh in the restart file 
     449      !!                   Leap-Frog: Kbb and Kmm are read except for l_1st_euler=T 
     450      !!                              or Kbb not found  
     451      !!              * otherwise  
     452      !!                   call user defined ssh or 
     453      !!                   set to -ssh_ref in wet and drying case with domcfg.nc 
     454      !! 
     455      !!              NB: ssh_b/n are written by restart.F90 
     456      !!---------------------------------------------------------------------- 
     457      INTEGER, INTENT(in) ::   Kbb, Kmm, Kaa   ! ocean time level indices 
     458      ! 
     459      INTEGER ::   ji, jj, jk 
     460      INTEGER ::   id_sshb, id_sshn     ! local integers 
     461      !!---------------------------------------------------------------------- 
     462      ! 
     463      !                            !=============================! 
     464      IF( ln_rstart ) THEN         !==  Read the restart file  ==! 
     465         !                         !=============================! 
     466         ! 
     467         CALL rst_read_open                    !*  open the restart file 
     468         ! 
     469         id_sshb = iom_varid( numror, 'sshb', ldstop = .FALSE. ) 
     470         id_sshn = iom_varid( numror, 'sshn', ldstop = .FALSE. ) 
     471         ! 
     472         IF( id_sshb <= 0 .AND. .NOT.l_1st_euler ) THEN 
     473            CALL ctl_warn ('ssh_init_rst: ssh at Kbb not found in restart files ',   & 
     474               &                         'l_1st_euler forced to .true. and ',        & 
     475               &                         'ssh(Kbb) = ssh(Kmm) '                    ) 
     476            l_1st_euler = .TRUE. 
     477         ENDIF 
     478         ! 
     479         IF( id_sshn <= 0 ) THEN       ! A restart require sshn present in the restart file 
     480            CALL ctl_stop('STOP', 'ssh_init_rst: ssh at Kmm not found in the restart file') 
     481            ! 
     482         ELSE                          ! read ssh at Kmm 
     483            CALL iom_get( numror, jpdom_auto, 'sshn'   , ssh(:,:,Kmm), ldxios = lrxios    ) 
     484            ! 
     485            IF( l_1st_euler ) THEN     ! Euler at first time-step: ssh_Kbb = ssh_Kmm 
     486               ssh(:,:,Kbb) = ssh(:,:,Kmm) 
     487               ! 
     488            ELSE                       ! read ssh at Kbb 
     489               CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios ) 
     490            ENDIF 
     491         ENDIF 
     492         !                         !============================! 
     493      ELSE                         !==  Initialize at "rest"  ==! 
     494         !                         !============================! 
     495         ! 
     496         IF( ll_wd ) THEN                      !* wet and dry  
     497            ! 
     498            IF( ln_read_cfg  ) THEN                 ! read configuration : ssh_ref is read in domain_cfg file 
     499!!st  why ssh is not masked : i.e. ssh(:,:,Kmm) = -ssh_ref*ssmask(:,:), 
     500!!st  since at the 1st time step lbclnk will be applied on ssh at Kaa but not initially at Kbb and Kmm 
     501               ssh(:,:,Kbb) = -ssh_ref 
     502               ! 
     503               DO_2D( 1, 1, 1, 1 ) 
     504                  IF( ht_0(ji,jj)-ssh_ref <  rn_wdmin1 ) THEN   ! if total depth is less than min depth 
     505                     ssh(ji,jj,Kbb) = rn_wdmin1 - ht_0(ji,jj) 
     506                  ENDIF 
     507               END_2D 
     508            ELSE                                    ! user define configuration case   
     509               CALL usr_def_istate_ssh( tmask, ssh(:,:,Kbb) ) 
     510            ENDIF 
     511            ! 
     512         ELSE                                  !* user defined configuration 
     513            CALL usr_def_istate_ssh( tmask, ssh(:,:,Kbb) ) 
     514            ! 
     515         ENDIF 
     516         ! 
     517         ssh(:,:,Kmm) = ssh(:,:,Kbb)           !* set now values from to before ones 
     518         ssh(:,:,Kaa) = 0._wp  
     519      ENDIF 
     520      ! 
     521   END SUBROUTINE ssh_init_rst 
     522       
    435523   !!====================================================================== 
    436524END MODULE sshwzv 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/IOM/restart.F90

    r13697 r13874  
    1111   !!            3.7  !  2014-01  (G. Madec) suppression of curl and hdiv from the restart 
    1212   !!             -   !  2014-12  (G. Madec) remove KPP scheme 
     13   !!            4.1  !  2020-11  (S. Techene, G. Madec)  move ssh initiatlisation in DYN/sshwzv:ssh_init_rst 
    1314   !!---------------------------------------------------------------------- 
    1415 
     
    139140      !! ** Method  :   Write in numrow when kt == nitrst in NetCDF 
    140141      !!              file, save fields which are necessary for restart 
     142      !! 
     143      !!                NB: ssh is written here (rst_write) 
     144      !!                    but is read or set in DYN/sshwzv:shh_init_rst 
    141145      !!---------------------------------------------------------------------- 
    142146      INTEGER, INTENT(in) ::   kt         ! ocean time-step 
     
    209213! can handle checking if variable is in the restart file (there will be no need to open 
    210214! restart) 
    211          IF(.NOT.lxios_set) lrxios = lrxios.AND.lxios_sini 
    212          IF( lrxios) THEN 
     215         IF( .NOT.lxios_set )  lrxios = lrxios.AND.lxios_sini 
     216         IF( lrxios ) THEN 
    213217             crxios_context = 'nemo_rst' 
    214218             IF( .NOT.lxios_set ) THEN 
     
    218222             ENDIF 
    219223         ENDIF 
    220          IF( TRIM(Agrif_CFixed()) /= '0' .AND. lrxios) THEN 
     224         IF( TRIM(Agrif_CFixed()) /= '0' .AND. lrxios ) THEN 
    221225             CALL iom_init( crxios_context ) 
    222226             IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for AGRIF' 
     
    232236      !!                   ***  ROUTINE rst_read  *** 
    233237      !!  
    234       !! ** Purpose :   Read files for NetCDF restart 
     238      !! ** Purpose :   Read velocity and T-S fields in the restart file 
    235239      !!  
    236       !! ** Method  :   Read in restart.nc file fields which are necessary for restart 
     240      !! ** Method  :   Read in restart.nc fields which are necessary for restart 
     241      !! 
     242      !!                NB: ssh is read or set in DYN/sshwzv:shh_init_rst 
     243      !!                    but is written     in IOM/restart:rst_write 
    237244      !!---------------------------------------------------------------------- 
    238245      INTEGER, INTENT(in) ::   Kbb, Kmm   ! ocean time level indices 
     
    242249      !!---------------------------------------------------------------------- 
    243250 
    244       CALL rst_read_open           ! open restart for reading (if not already opened) 
    245  
    246       ! Check dynamics and tracer time-step consistency and force Euler restart if changed 
     251      CALL rst_read_open            ! open restart for reading (if not already opened) 
     252 
     253      !                             ! Check time-step consistency and force Euler restart if changed 
    247254      IF( iom_varid( numror, 'rdt', ldstop = .FALSE. ) > 0 )   THEN 
    248255         CALL iom_get( numror, 'rdt', zrdt, ldxios = lrxios ) 
     
    258265      CALL iom_delay_rst( 'READ', 'OCE', numror )   ! read only ocean delayed global communication variables 
    259266       
    260       ! Diurnal DSST  
    261       IF( ln_diurnal ) CALL iom_get( numror, jpdom_auto, 'Dsst' , x_dsst, ldxios = lrxios )  
     267      !                             ! Diurnal DSST  
     268      IF( ln_diurnal )   CALL iom_get( numror, jpdom_auto, 'Dsst' , x_dsst, ldxios = lrxios )  
    262269      IF ( ln_diurnal_only ) THEN  
    263270         IF(lwp) WRITE( numout, * ) & 
     
    275282         CALL iom_get( numror, jpdom_auto, 'tb'     , ts(:,:,:,jp_tem,Kbb), ldxios = lrxios ) 
    276283         CALL iom_get( numror, jpdom_auto, 'sb'     , ts(:,:,:,jp_sal,Kbb), ldxios = lrxios ) 
    277 #if ! defined key_qco 
    278          CALL iom_get( numror, jpdom_auto, 'sshb'   ,ssh(:,:         ,Kbb), ldxios = lrxios ) 
    279 #endif 
    280284      ELSE 
    281285         l_1st_euler =  .TRUE.      ! before field not found, forced euler 1st time-step 
     
    287291      CALL iom_get( numror, jpdom_auto, 'tn'     , ts(:,:,:,jp_tem,Kmm), ldxios = lrxios ) 
    288292      CALL iom_get( numror, jpdom_auto, 'sn'     , ts(:,:,:,jp_sal,Kmm), ldxios = lrxios ) 
    289 #if ! defined key_qco 
    290       CALL iom_get( numror, jpdom_auto, 'sshn'   ,ssh(:,:         ,Kmm), ldxios = lrxios ) 
    291 #endif 
     293      ! 
    292294      IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN 
    293295         CALL iom_get( numror, jpdom_auto, 'rhop'   , rhop, ldxios = lrxios )   ! now    potential density 
     
    296298      ENDIF 
    297299      ! 
    298       IF( l_1st_euler ) THEN                                  ! Euler restart  
    299          ts   (:,:,:,:,Kbb) = ts   (:,:,:,:,Kmm)              ! all before fields set to now values 
    300          uu   (:,:,:  ,Kbb) = uu   (:,:,:  ,Kmm) 
    301          vv   (:,:,:  ,Kbb) = vv   (:,:,:  ,Kmm) 
    302          ssh  (:,:    ,Kbb) = ssh  (:,:    ,Kmm) 
     300      IF( l_1st_euler ) THEN                 ! Euler restart  
     301         ts(:,:,:,:,Kbb) = ts(:,:,:,:,Kmm)         ! all before fields set to now values 
     302         uu(:,:,:  ,Kbb) = uu(:,:,:  ,Kmm) 
     303         vv(:,:,:  ,Kbb) = vv(:,:,:  ,Kmm) 
    303304      ENDIF 
    304305      ! 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/src/OCE/USR/usrdef_istate.F90

    r13761 r13874  
    77   !! User defined : set the initial state of a user configuration 
    88   !!====================================================================== 
    9    !! History :  4.0 ! 2016-03  (S. Flavoni) Original code 
     9   !! History :  4.0  ! 2016-03  (S. Flavoni) Original code 
     10   !!                 ! 2020-11  (S. Techene, G. Madec) separate tsuv from ssh 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    2223   PRIVATE 
    2324 
    24    PUBLIC   usr_def_istate   ! called in istate.F90 
    25    PUBLIC   usr_def_ssh      ! called by domqco.F90 
     25   PUBLIC   usr_def_istate       ! called in istate.F90 
     26   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90 
    2627 
    2728   !! * Substitutions 
     
    3435CONTAINS 
    3536   
    36    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     37   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    3738      !!---------------------------------------------------------------------- 
    3839      !!                   ***  ROUTINE usr_def_istate  *** 
     
    4950      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    5051      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    51       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5252      ! 
    5353      INTEGER :: ji, jj, jk  ! dummy loop indices 
     
    6060      pu  (:,:,:) = 0._wp        ! ocean at rest 
    6161      pv  (:,:,:) = 0._wp 
    62       pssh(:,:)   = 0._wp 
    6362      ! 
    6463      DO_3D( 1, 1, 1, 1, 1, jpk ) 
     
    8281 
    8382    
    84    SUBROUTINE usr_def_ssh( ptmask, pssh ) 
     83   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
    8584      !!---------------------------------------------------------------------- 
    86       !!                   ***  ROUTINE usr_def_istate  *** 
     85      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
    8786      !!  
    8887      !! ** Purpose :   Initialization of ssh 
    8988      !! 
    90       !! ** Method  :   Set as null 
     89      !! ** Method  :   Set ssh as null, ptmask is required for test cases 
    9190      !!---------------------------------------------------------------------- 
    9291      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m] 
     
    9594      ! 
    9695      IF(lwp) WRITE(numout,*) 
    97       IF(lwp) WRITE(numout,*) 'usr_def_ssh : GYRE configuration, analytical definition of initial state' 
    98       IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   ' 
     96      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : GYRE configuration, analytical definition of initial state' 
     97      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~~~~~   Ocean at rest, ssh is zero' 
    9998      ! 
    10099      ! Sea level: 
    101100      pssh(:,:) = 0._wp 
    102        
    103    END SUBROUTINE usr_def_ssh 
     101      ! 
     102   END SUBROUTINE usr_def_istate_ssh 
    104103 
    105104   !!====================================================================== 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/BENCH/MY_SRC/usrdef_istate.F90

    r13762 r13874  
    2626   PRIVATE 
    2727 
    28    PUBLIC   usr_def_istate   ! called by istate.F90 
    29    PUBLIC   usr_def_ssh      ! called by domqco.F90 
     28   PUBLIC   usr_def_istate       ! called by istate.F90 
     29   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90 
    3030 
    3131   !! * Substitutions 
     
    3838CONTAINS 
    3939   
    40    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     40   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) !!st, pssh ) 
    4141      !!---------------------------------------------------------------------- 
    4242      !!                   ***  ROUTINE usr_def_istate  *** 
     
    5353      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    5454      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    55       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
     55!!st      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5656      ! 
    5757      REAL(wp), DIMENSION(jpi,jpj) ::   z2d   ! 2D workspace 
     
    8080      ! 
    8181      ! sea level: 
    82       pssh(:,:) = z2d(:,:)                                                ! +/- 0.05 m 
     82!!st      pssh(:,:) = z2d(:,:)                                                ! +/- 0.05 m 
    8383      ! 
    8484      DO_3D( 0, 0, 0, 0, 1, jpkm1 ) 
     
    9696      pv( :,:,jpk  ) = 0._wp 
    9797      ! 
    98       CALL lbc_lnk('usrdef_istate', pssh, 'T',  1. )            ! apply boundary conditions 
     98!!st      CALL lbc_lnk('usrdef_istate', pssh, 'T',  1. )            ! apply boundary conditions 
    9999      CALL lbc_lnk('usrdef_istate',  pts, 'T',  1. )            ! apply boundary conditions 
    100100      CALL lbc_lnk('usrdef_istate',   pu, 'U', -1. )            ! apply boundary conditions 
     
    104104 
    105105 
    106    SUBROUTINE usr_def_ssh( ptmask, pssh ) 
     106   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
    107107      !!---------------------------------------------------------------------- 
    108       !!                   ***  ROUTINE usr_def_ssh  *** 
     108      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
    109109      !!  
    110110      !! ** Purpose :   Initialization of ssh 
     
    115115      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m] 
    116116      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height   [m] 
     117      ! 
     118      INTEGER  ::   ji, jj 
     119      INTEGER  ::   igloi, igloj   ! to be removed in the future, see usr_def_istate comment  
    117120      !!---------------------------------------------------------------------- 
    118121      ! 
    119122      IF(lwp) WRITE(numout,*) 
    120       IF(lwp) WRITE(numout,*) 'usr_def_ssh : BENCH configuration, analytical definition of initial state' 
     123      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : BENCH configuration, analytical definition of initial ssh' 
    121124      ! 
    122       pssh(:,:)   = 0._wp   
     125      igloi = Ni0glo + 2 * COUNT( (/ jperio == 1 .OR. jperio == 4 .OR. jperio == 6 .OR. jperio == 7 /) ) 
     126      igloj = Nj0glo + 2 * COUNT( (/ jperio == 2 .OR. jperio == 7 /) ) + 1 * COUNT( (/ jperio >= 4 .AND. jperio <= 6 /) ) 
     127      ! sea level:  +/- 0.05 m 
     128      DO_2D( 0, 0, 0, 0 ) 
     129         pssh(ji,jj) = 0.1 * ( 0.5 - REAL( mig0_oldcmp(ji) + (mjg0_oldcmp(jj)-1) * igloi, wp ) / REAL( igloi * igloj, wp ) ) 
     130      END_2D 
    123131      ! 
    124    END SUBROUTINE usr_def_ssh 
     132      CALL lbc_lnk('usrdef_istate', pssh, 'T',  1. )            ! apply boundary conditions 
     133      ! 
     134   END SUBROUTINE usr_def_istate_ssh 
    125135    
    126136   !!====================================================================== 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/CANAL/MY_SRC/usrdef_istate.F90

    r13295 r13874  
    2626   PRIVATE 
    2727 
    28    PUBLIC   usr_def_istate   ! called by istate.F90 
     28   PUBLIC   usr_def_istate       ! called by istate.F90 
     29   PUBLIC   usr_def_istate_ssh   ! called by sshwzv.F90 
    2930 
    3031   !! * Substitutions 
     
    3738CONTAINS 
    3839   
    39    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     40   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    4041      !!---------------------------------------------------------------------- 
    4142      !!                   ***  ROUTINE usr_def_istate  *** 
     
    5253      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    5354      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    54       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5555      ! 
    5656      INTEGER  :: ji, jj, jk, jl  ! dummy loop indices 
     
    7272      SELECT CASE(nn_initcase) 
    7373      CASE(0)    ! rest 
    74           
    75          ! sea level: 
    76          pssh(:,:) = 0. 
     74         ! 
    7775         ! temperature: 
    7876         pts(:,:,:,jp_tem) = 10._wp 
     
    8482          
    8583      CASE(1)    ! geostrophic zonal jet from -zjety to +zjety 
    86  
    87          ! sea level: 
    88          SELECT CASE( nn_fcase ) 
    89          CASE(0)    ! f = f0 
    90             ! sea level: ssh = - fuy / g 
    91             WHERE( ABS(gphit) <= zjety ) 
    92                pssh(:,:) = - ff_t(:,:) * rn_uzonal * gphit(:,:) * 1.e3 / grav 
    93             ELSEWHERE 
    94                pssh(:,:) = - ff_t(:,:) * rn_uzonal * SIGN(zjety, gphit(:,:)) * 1.e3 / grav 
    95             END WHERE 
    96          CASE(1)    ! f = f0 + beta*y 
    97             ! sea level: ssh = - u / g * ( fy + 0.5 * beta * y^2 ) 
    98             zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra 
    99             WHERE( ABS(gphit) <= zjety ) 
    100                pssh(:,:) = - rn_uzonal / grav * ( ff_t(:,:) * gphit(:,:) * 1.e3 + 0.5 * zbeta * gphit(:,:) * gphit(:,:) * 1.e6 ) 
    101             ELSEWHERE 
    102                pssh(:,:) = - rn_uzonal / grav * ( ff_t(:,:) * SIGN(zjety, gphit(:,:)) * 1.e3   & 
    103                   &                             + 0.5 * zbeta * zjety * zjety * 1.e6 ) 
    104             END WHERE 
    105          END SELECT 
     84         ! 
    10685         ! temperature: 
    10786         pts(:,:,:,jp_tem) = 10._wp 
     
    11998         !                   
    12099      CASE(2)    ! geostrophic zonal current shear 
    121        
    122          ! sea level: 
    123          SELECT CASE( nn_fcase ) 
    124          CASE(0)    ! f = f0 
    125             ! sea level: ssh = - fuy / g 
    126             WHERE( ABS(gphit) <= zjety ) 
    127                pssh(:,:) = - ff_t(:,:) * rn_uzonal * ABS(gphit(:,:)) * 1.e3 / grav 
    128             ELSEWHERE 
    129                pssh(:,:) = - ff_t(:,:) * rn_uzonal * zjety * 1.e3 / grav 
    130             END WHERE 
    131          CASE(1)    ! f = f0 + beta*y 
    132             ! sea level: ssh = - u / g * ( fy + 0.5 * beta * y^2 ) 
    133             zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra 
    134             WHERE( ABS(gphit) <= zjety ) 
    135                pssh(:,:) = - SIGN(rn_uzonal, gphit(:,:)) / grav   & 
    136                   &        * ( ff_t(:,:) * gphit(:,:) * 1.e3 + 0.5 * zbeta * gphit(:,:) * gphit(:,:) * 1.e6 ) 
    137             ELSEWHERE 
    138                pssh(:,:) = - SIGN(rn_uzonal, gphit(:,:)) / grav   & 
    139                   &        * ( ff_t(:,:) * SIGN(zjety, gphit(:,:)) * 1.e3 + 0.5 * zbeta * zjety * zjety * 1.e6 ) 
    140             END WHERE 
    141          END SELECT 
     100         ! 
    142101         ! temperature: 
    143102         pts(:,:,:,jp_tem) = 10._wp 
     
    156115         !                   
    157116      CASE(3)    ! gaussian zonal currant 
    158  
     117         ! 
    159118         ! zonal current 
    160119         DO jk=1, jpkm1 
     
    162121            pu(:,:,jk) = rn_uzonal * EXP( - 0.5 * gphit(:,:)**2 / rn_lambda**2 ) 
    163122         END DO 
    164           
    165          ! sea level: 
    166          pssh(:,1) = - ff_t(:,1) / grav * pu(:,1,1) * e2t(:,1) 
    167          DO jl=1, jpnj 
    168             DO_2D( 0, 0, 0, 0 ) 
    169                pssh(ji,jj) = pssh(ji,jj-1) - ff_t(ji,jj) / grav * pu(ji,jj,1) * e2t(ji,jj) 
    170             END_2D 
    171             CALL lbc_lnk( 'usrdef_istate', pssh, 'T',  1. ) 
    172          END DO 
    173           
    174123         ! temperature: 
    175124         pts(:,:,:,jp_tem) = 10._wp 
     
    182131         !             
    183132      CASE(4)    ! geostrophic zonal pulse 
    184     
     133         ! 
    185134         DO_2D( 1, 1, 1, 1 ) 
    186135            IF ( ABS(glamt(ji,jj)) <= zjetx ) THEN 
     
    190139            ELSE 
    191140               zdu = 0. 
    192             END IF 
     141            ENDIF 
    193142            IF ( ABS(gphit(ji,jj)) <= zjety ) THEN 
    194                pssh(ji,jj) = - ff_t(ji,jj) * zdu * gphit(ji,jj) * 1.e3 / grav 
    195143               pu(ji,jj,:) = zdu 
    196144               pts(ji,jj,:,jp_sal) = zdu / rn_uzonal + 1. 
    197145            ELSE 
    198                pssh(ji,jj) = - ff_t(ji,jj) * zdu * SIGN(zjety,gphit(ji,jj)) * 1.e3 / grav  
    199146               pu(ji,jj,:) = 0. 
    200147               pts(ji,jj,:,jp_sal) = 1. 
    201             END IF 
    202          END_2D 
    203           
     148            ENDIF 
     149         END_2D 
     150         ! 
    204151         ! temperature: 
    205152         pts(:,:,:,jp_tem) = 10._wp * ptmask(:,:,:)         
    206153         pv(:,:,:) = 0. 
    207           
    208        CASE(5)    ! vortex 
    209                   ! 
     154         ! 
     155      CASE(5)    ! vortex 
     156         ! 
    210157         zf0   = 2._wp * omega * SIN( rad * rn_ppgphi0 ) 
    211          zumax = rn_vtxmax * SIGN(1._wp, zf0) ! Here Anticyclonic: set zumax=-1 for cyclonic 
     158         zumax = rn_vtxmax * SIGN(1._wp, zf0)  ! Here Anticyclonic: set zumax=-1 for cyclonic 
    212159         zlambda = SQRT(2._wp)*rn_lambda       ! Horizontal scale in meters  
    213160         zn2 = 3.e-3**2 
     
    222169            ! Surface pressure: P(x,y,z) = F(z) * Psurf(x,y) 
    223170            zpsurf = zP0 * EXP(-(zx**2+zy**2)*zr_lambda2) - rho0 * ff_t(ji,jj) * rn_uzonal * zy 
    224             ! Sea level: 
    225             pssh(ji,jj) = 0. 
    226             DO jl=1,5 
    227                zdt = pssh(ji,jj) 
    228                zdzF = (1._wp - EXP(zdt-zH)) / (zH - 1._wp + EXP(-zH))   ! F'(z) 
    229                zrho1 = rho0 * (1._wp + zn2*zdt/grav) - zdzF * zpsurf / grav    ! -1/g Dz(P) = -1/g * F'(z) * Psurf(x,y) 
    230                pssh(ji,jj) = zpsurf / (zrho1*grav) * ptmask(ji,jj,1)   ! ssh = Psurf / (Rho*g) 
    231             END DO 
    232171            ! temperature: 
    233172            DO jk=1,jpk 
     
    279218         !             
    280219      END SELECT 
    281        
     220      ! 
     221      CALL lbc_lnk( 'usrdef_istate', pts , 'T',  1. ) 
     222      CALL lbc_lnk_multi( 'usrdef_istate', pu, 'U', -1., pv, 'V', -1. ) 
     223 
     224   END SUBROUTINE usr_def_istate 
     225 
     226   
     227   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
     228      !!---------------------------------------------------------------------- 
     229      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
     230      !!  
     231      !! ** Purpose :   Initialization of the dynamics and tracers 
     232      !!                Here CANAL configuration  
     233      !! 
     234      !! ** Method  :   Set ssh  
     235      !!---------------------------------------------------------------------- 
     236      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask             [m] 
     237      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
     238      ! 
     239      INTEGER  :: ji, jj, jk, jl  ! dummy loop indices 
     240      REAL(wp) :: zx, zy, zP0, zumax, zlambda, zr_lambda2, zn2, zf0, zH, zrho1, za, zf, zdzF 
     241      REAL(wp) :: zpsurf, zdyPs, zdxPs 
     242      REAL(wp) :: zdt, zdu, zdv 
     243      REAL(wp) :: zjetx, zjety, zbeta 
     244      REAL(wp), DIMENSION(jpi,jpj)  ::   zrandom 
     245      !!---------------------------------------------------------------------- 
     246      ! 
     247      IF(lwp) WRITE(numout,*) 
     248      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : CANAL configuration, analytical definition of initial state' 
     249      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   ' 
     250      ! 
     251      IF (ln_sshnoise) CALL RANDOM_NUMBER(zrandom) 
     252      zjetx = ABS(rn_ujetszx)/2. 
     253      zjety = ABS(rn_ujetszy)/2. 
     254      ! 
     255      SELECT CASE(nn_initcase) 
     256      CASE(0)                      !==   rest  ==! 
     257         ! 
     258         pssh(:,:) = 0. 
     259         ! 
     260      CASE(1)                      !==  geostrophic zonal jet from -zjety to +zjety  ==! 
     261         ! 
     262         SELECT CASE( nn_fcase ) 
     263         CASE(0)                          !* f = f0 : ssh = - fuy / g 
     264            WHERE( ABS(gphit) <= zjety ) 
     265               pssh(:,:) = - ff_t(:,:) * rn_uzonal * gphit(:,:) * 1.e3 / grav 
     266            ELSEWHERE 
     267               pssh(:,:) = - ff_t(:,:) * rn_uzonal * SIGN(zjety, gphit(:,:)) * 1.e3 / grav 
     268            END WHERE 
     269         CASE(1)                          !* f = f0 + beta*y : ssh = - u / g * ( fy + 0.5 * beta * y^2 ) 
     270            zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra 
     271            WHERE( ABS(gphit) <= zjety ) 
     272               pssh(:,:) = - rn_uzonal / grav * ( ff_t(:,:) * gphit(:,:) * 1.e3 + 0.5 * zbeta * gphit(:,:) * gphit(:,:) * 1.e6 ) 
     273            ELSEWHERE 
     274               pssh(:,:) = - rn_uzonal / grav * ( ff_t(:,:) * SIGN(zjety, gphit(:,:)) * 1.e3   & 
     275                  &                             + 0.5 * zbeta * zjety * zjety * 1.e6 ) 
     276            END WHERE 
     277         END SELECT 
     278         !                   
     279      CASE(2)                      !==  geostrophic zonal current shear  ==! 
     280         ! 
     281         SELECT CASE( nn_fcase ) 
     282         CASE(0)                          !* f = f0 : ssh = - fuy / g 
     283            WHERE( ABS(gphit) <= zjety ) 
     284               pssh(:,:) = - ff_t(:,:) * rn_uzonal * ABS(gphit(:,:)) * 1.e3 / grav 
     285            ELSEWHERE 
     286               pssh(:,:) = - ff_t(:,:) * rn_uzonal * zjety * 1.e3 / grav 
     287            END WHERE 
     288         CASE(1)                          !* f = f0 + beta*y : ssh = - u / g * ( fy + 0.5 * beta * y^2 ) 
     289            zbeta = 2._wp * omega * COS( rad * rn_ppgphi0 ) / ra 
     290            WHERE( ABS(gphit) <= zjety ) 
     291               pssh(:,:) = - SIGN(rn_uzonal, gphit(:,:)) / grav   & 
     292                  &        * ( ff_t(:,:) * gphit(:,:) * 1.e3 + 0.5 * zbeta * gphit(:,:) * gphit(:,:) * 1.e6 ) 
     293            ELSEWHERE 
     294               pssh(:,:) = - SIGN(rn_uzonal, gphit(:,:)) / grav   & 
     295                  &        * ( ff_t(:,:) * SIGN(zjety, gphit(:,:)) * 1.e3 + 0.5 * zbeta * zjety * zjety * 1.e6 ) 
     296            END WHERE 
     297         END SELECT 
     298         !                   
     299      CASE(3)                      !==  gaussian zonal currant  ==! 
     300         ! 
     301         pssh(:,1) = - ff_t(:,1) / grav * e2t(:,1) * rn_uzonal * EXP( - 0.5 * gphit(:,1)**2 / rn_lambda**2 ) 
     302         DO jl=1, jpnj 
     303            DO_2D( 0, 0, 0, 0 ) 
     304               pssh(ji,jj) = pssh(ji,jj-1) - ff_t(ji,jj) / grav * rn_uzonal * EXP( - 0.5 * gphit(ji,jj)**2 / rn_lambda**2 ) * e2t(ji,jj) 
     305            END_2D 
     306            CALL lbc_lnk( 'usrdef_istate_ssh', pssh, 'T',  1. ) 
     307         END DO 
     308         !             
     309      CASE(4)                      !==  geostrophic zonal pulse !!st need to implement a way to separate ssh properly  ==! 
     310         ! 
     311         DO_2D( 1, 1, 1, 1 ) 
     312            IF ( ABS(glamt(ji,jj)) <= zjetx ) THEN 
     313               zdu = rn_uzonal 
     314            ELSEIF ( ABS(glamt(ji,jj)) <= zjetx + 100. ) THEN 
     315               zdu = rn_uzonal * ( ( zjetx-ABS(glamt(ji,jj)) )/100. + 1. ) 
     316            ELSE 
     317               zdu = 0. 
     318            ENDIF 
     319            IF ( ABS(gphit(ji,jj)) <= zjety ) THEN 
     320               pssh(ji,jj) = - ff_t(ji,jj) * zdu * gphit(ji,jj) * 1.e3 / grav 
     321            ELSE 
     322               pssh(ji,jj) = - ff_t(ji,jj) * zdu * SIGN(zjety,gphit(ji,jj)) * 1.e3 / grav  
     323            ENDIF 
     324         END_2D 
     325         ! 
     326      CASE(5)                    !==  vortex  ==! 
     327         ! 
     328         zf0   = 2._wp * omega * SIN( rad * rn_ppgphi0 ) 
     329         zumax = rn_vtxmax * SIGN(1._wp, zf0)   ! Here Anticyclonic: set zumax=-1 for cyclonic 
     330         zlambda = SQRT(2._wp)*rn_lambda        ! Horizontal scale in meters  
     331         zn2 = 3.e-3**2 
     332         zH = 0.5_wp * 5000._wp 
     333         ! 
     334         zr_lambda2 = 1._wp / zlambda**2 
     335         zP0 = rho0 * zf0 * zumax * zlambda * SQRT(EXP(1._wp)/2._wp) 
     336         ! 
     337         DO_2D( 1, 1, 1, 1 ) 
     338            zx = glamt(ji,jj) * 1.e3 
     339            zy = gphit(ji,jj) * 1.e3 
     340            !                                   ! Surface pressure: P(x,y,z) = F(z) * Psurf(x,y) 
     341            zpsurf = zP0 * EXP(-(zx**2+zy**2)*zr_lambda2) - rho0 * ff_t(ji,jj) * rn_uzonal * zy 
     342            pssh(ji,jj) = 0. 
     343            DO jl=1,5 
     344               zdt = pssh(ji,jj) 
     345               zdzF = (1._wp - EXP(zdt-zH)) / (zH - 1._wp + EXP(-zH))   ! F'(z) 
     346               zrho1 = rho0 * (1._wp + zn2*zdt/grav) - zdzF * zpsurf / grav    ! -1/g Dz(P) = -1/g * F'(z) * Psurf(x,y) 
     347               pssh(ji,jj) = zpsurf / (zrho1*grav) * ptmask(ji,jj,1)   ! ssh = Psurf / (Rho*g) 
     348            END DO 
     349         END_2D 
     350         !             
     351      END SELECT 
     352      !                          !==  add noise  ==! 
    282353      IF (ln_sshnoise) THEN 
    283354         CALL RANDOM_NUMBER(zrandom) 
    284355         pssh(:,:) = pssh(:,:) + ( 0.1  * zrandom(:,:) - 0.05 ) 
    285       END IF 
    286       CALL lbc_lnk( 'usrdef_istate', pssh, 'T',  1. ) 
    287       CALL lbc_lnk( 'usrdef_istate', pts , 'T',  1. ) 
    288       CALL lbc_lnk_multi( 'usrdef_istate', pu, 'U', -1., pv, 'V', -1. ) 
    289  
    290    END SUBROUTINE usr_def_istate 
    291  
     356      ENDIF 
     357      CALL lbc_lnk( 'usrdef_istate_ssh', pssh, 'T',  1. ) 
     358      ! 
     359   END SUBROUTINE usr_def_istate_ssh 
     360    
    292361   !!====================================================================== 
    293362END MODULE usrdef_istate 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/ISOMIP+/MY_SRC/istate.F90

    r13295 r13874  
    9999            CALL dta_tsd( nit000, 'ini', ts(:,:,:,:,Kbb) )       ! read 3D T and S data at nit000 
    100100            ! 
    101             ssh(:,:,Kbb)   = 0._wp               ! set the ocean at rest 
    102             IF( ll_wd ) THEN 
    103                ssh(:,:,Kbb) =  -ssh_ref  ! Added in 30 here for bathy that adds 30 as Iterative test CEOD  
    104                ! 
    105                ! Apply minimum wetdepth criterion 
    106                ! 
    107                DO_2D( 1, 1, 1, 1 ) 
    108                   IF( ht_0(ji,jj) + ssh(ji,jj,Kbb)  < rn_wdmin1 ) THEN 
    109                      ssh(ji,jj,Kbb) = tmask(ji,jj,1)*( rn_wdmin1 - (ht_0(ji,jj)) ) 
    110                   ENDIF 
    111                END_2D 
    112             ENDIF  
     101!!st            ssh(:,:,Kbb)   = 0._wp               ! set the ocean at rest 
     102!!st            IF( ll_wd ) THEN 
     103!!st               ssh(:,:,Kbb) =  -ssh_ref  ! Added in 30 here for bathy that adds 30 as Iterative test CEOD  
     104!!st               ! 
     105!!st               ! Apply minimum wetdepth criterion 
     106!!st               ! 
     107!!st               DO_2D( 1, 1, 1, 1 ) 
     108!!st                  IF( ht_0(ji,jj) + ssh(ji,jj,Kbb)  < rn_wdmin1 ) THEN 
     109!!st                     ssh(ji,jj,Kbb) = tmask(ji,jj,1)*( rn_wdmin1 - (ht_0(ji,jj)) ) 
     110!!st                  ENDIF 
     111!!st               END_2D 
     112!!st            ENDIF  
    113113            uu  (:,:,:,Kbb) = 0._wp 
    114114            vv  (:,:,:,Kbb) = 0._wp   
    115115            ! 
    116116         ELSE                                 ! user defined initial T and S 
    117             CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb)  )          
     117            CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb) ) 
     118            CALL usr_def_istate_ssh(tmask, ssh(:,:,Kbb) )          
    118119         ENDIF 
    119120         ts  (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb)       ! set now values from to before ones 
    120          ssh (:,:,Kmm)     = ssh(:,:,Kbb)    
     121!!st         ssh (:,:,Kmm)     = ssh(:,:,Kbb)    
    121122         uu   (:,:,:,Kmm)   = uu  (:,:,:,Kbb) 
    122123         vv   (:,:,:,Kmm)   = vv  (:,:,:,Kbb) 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/ISOMIP/MY_SRC/usrdef_istate.F90

    r13762 r13874  
    99   !! History :  NEMO ! 2016-11 (S. Flavoni)             Original code 
    1010   !!                 ! 2017-02 (P. Mathiot, S. Flavoni) Adapt code to ISOMIP case 
     11   !!                 ! 2020-11 (S. Techene, G. Madec) separate tsuv from ssh 
    1112   !!---------------------------------------------------------------------- 
    1213 
     
    2425   PRIVATE 
    2526 
    26    PUBLIC   usr_def_istate   ! called by istate.F90 
    27    PUBLIC   usr_def_ssh      ! called by domqco.F90 
     27   PUBLIC   usr_def_istate       ! called by istate.F90 
     28   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90 
    2829 
    2930   !!---------------------------------------------------------------------- 
     
    3435CONTAINS 
    3536   
    36    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     37   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    3738      !!---------------------------------------------------------------------- 
    3839      !!                   ***  ROUTINE usr_def_istate  *** 
     
    4950      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    5051      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    51       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    52       ! 
    53       INTEGER  ::   jk     ! dummy loop indices 
    5452      !!---------------------------------------------------------------------- 
    5553      ! 
     
    5957      pu  (:,:,:) = 0._wp        ! ocean at rest 
    6058      pv  (:,:,:) = 0._wp 
    61       pssh(:,:)   = 0._wp 
    62       ! 
    6359      !                          ! T & S profiles 
    6460      pts(:,:,:,jp_tem) = - 1.9 * ptmask(:,:,:)          ! ISOMIP configuration : start from constant T+S fields 
     
    6864 
    6965 
    70    SUBROUTINE usr_def_ssh( ptmask, pssh ) 
     66   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
    7167      !!---------------------------------------------------------------------- 
    72       !!                   ***  ROUTINE usr_def_ssh  *** 
     68      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
    7369      !!  
    7470      !! ** Purpose :   Initialization of ssh 
    7571      !!                Here ISOMIP configuration  
    7672      !! 
    77       !! ** Method  :   set ssh 
     73      !! ** Method  :   set ssh to 0 
    7874      !!---------------------------------------------------------------------- 
    7975      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m] 
     
    8278      ! 
    8379      IF(lwp) WRITE(numout,*) 
    84       IF(lwp) WRITE(numout,*) 'usr_def_ssh : ISOMIP configuration, analytical definition of initial state' 
     80      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : ISOMIP configuration, analytical definition of initial state' 
    8581      ! 
    8682      pssh(:,:)   = 0._wp 
    8783      ! 
    88    END SUBROUTINE usr_def_ssh 
     84   END SUBROUTINE usr_def_istate_ssh 
    8985 
    9086   !!====================================================================== 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/LOCK_EXCHANGE/MY_SRC/usrdef_istate.F90

    r13762 r13874  
    88   !!====================================================================== 
    99   !! History :  NEMO ! 2016-03  (S. Flavoni, G. Madec) Original code 
     10   !!                 ! 2020-11  (S. Techene, G. Madec) separate tsuv from ssh 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    2324   PRIVATE 
    2425 
    25    PUBLIC   usr_def_istate   ! called by istate.F90 
    26    PUBLIC   usr_def_ssh      ! called by domqco.F90 
     26   PUBLIC   usr_def_istate       ! called by istate.F90 
     27   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90 
    2728 
    2829   !!---------------------------------------------------------------------- 
     
    3334CONTAINS 
    3435   
    35    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     36   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    3637      !!---------------------------------------------------------------------- 
    3738      !!                   ***  ROUTINE usr_def_istate  *** 
     
    4849      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    4950      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    50       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5151      ! 
    5252      INTEGER  ::   jk     ! dummy loop indices 
     
    6666      pu  (:,:,:) = 0._wp        ! ocean at rest 
    6767      pv  (:,:,:) = 0._wp 
    68       pssh(:,:)   = 0._wp 
    6968      ! 
    7069      !                          ! T & S profiles 
     
    8079 
    8180 
    82    SUBROUTINE usr_def_ssh( ptmask, pssh ) 
     81   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
    8382      !!---------------------------------------------------------------------- 
    84       !!                   ***  ROUTINE usr_def_ssh  *** 
     83      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
    8584      !!  
    8685      !! ** Purpose :   Initialization of ssh 
    8786      !!                Here LOCK_EXCHANGE configuration  
    8887      !! 
    89       !! ** Method  :   set ssh 
     88      !! ** Method  :   set ssh to 0 
    9089      !!---------------------------------------------------------------------- 
    9190      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m] 
     
    9493      ! 
    9594      IF(lwp) WRITE(numout,*) 
    96       IF(lwp) WRITE(numout,*) 'usr_def_ssh : LOCK_EXCHANGE configuration, analytical definition of initial state' 
     95      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : LOCK_EXCHANGE configuration, analytical definition of initial state' 
    9796      ! 
    9897      pssh(:,:)   = 0._wp 
    9998      ! 
    100    END SUBROUTINE usr_def_ssh 
     99   END SUBROUTINE usr_def_istate_ssh 
    101100 
    102101   !!====================================================================== 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/OVERFLOW/MY_SRC/usrdef_istate.F90

    r13762 r13874  
    88   !!============================================================================== 
    99   !! History :  NEMO ! 2016-03  (S. Flavoni, G. Madec) Original code 
     10   !!                 ! 2020-11  (S. Techene, G. Madec) separate tsuv from ssh 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    2324   PRIVATE 
    2425 
    25    PUBLIC   usr_def_istate   ! called by istate.F90 
    26    PUBLIC   usr_def_ssh      ! called by domqco.F90 
     26   PUBLIC   usr_def_istate       ! called by istate.F90 
     27   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90 
    2728    
    2829   !!---------------------------------------------------------------------- 
     
    3334CONTAINS 
    3435   
    35    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     36   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    3637      !!---------------------------------------------------------------------- 
    3738      !!                   ***  ROUTINE usr_def_istate  *** 
     
    4849      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    4950      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    50       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5151      ! 
    5252      INTEGER  ::   jk     ! dummy loop indices 
     
    6666      pu  (:,:,:) = 0._wp        ! ocean at rest 
    6767      pv  (:,:,:) = 0._wp 
    68       pssh(:,:)   = 0._wp 
    6968      ! 
    7069      !                          ! T & S profiles 
     
    8079 
    8180 
    82    SUBROUTINE usr_def_ssh( ptmask, pssh ) 
     81   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
    8382      !!---------------------------------------------------------------------- 
    84       !!                   ***  ROUTINE usr_def_ssh  *** 
     83      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
    8584      !!  
    8685      !! ** Purpose :   Initialization of the ssh 
    8786      !!                Here  OVERFLOW configuration  
    8887      !! 
    89       !! ** Method  :   set ssh 
     88      !! ** Method  :   set ssh to 0 
    9089      !!---------------------------------------------------------------------- 
    9190      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask   [m] 
     
    9493      ! 
    9594      IF(lwp) WRITE(numout,*) 
    96       IF(lwp) WRITE(numout,*) 'usr_def_ssh : OVERFLOW configuration, analytical definition of initial state' 
     95      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : OVERFLOW configuration, analytical definition of initial state' 
    9796      ! 
    9897      pssh(:,:)   = 0._wp 
    9998      ! 
    100    END SUBROUTINE usr_def_ssh 
     99   END SUBROUTINE usr_def_istate_ssh 
    101100 
    102101   !!====================================================================== 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/SWG/MY_SRC/usrdef_istate.F90

    r13762 r13874  
    99   !! History :  4.0  ! 2016-03  (S. Flavoni) Original code 
    1010   !!             -   ! 2020-03  (A. Nasser) Shallow Water Eq. configuration 
     11   !!                 ! 2020-11  (S. Techene, G. Madec) separate tsuv from ssh 
    1112   !!---------------------------------------------------------------------- 
    1213 
     
    2324   PRIVATE 
    2425 
    25    PUBLIC   usr_def_istate   ! called in istate.F90 
    26    PUBLIC   usr_def_ssh      ! called by domqco.F90 
     26   PUBLIC   usr_def_istate       ! called in istate.F90 
     27   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90 
    2728 
    2829   !!---------------------------------------------------------------------- 
     
    3334CONTAINS 
    3435   
    35    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     36   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    3637      !!---------------------------------------------------------------------- 
    3738      !!                   ***  ROUTINE usr_def_istate  *** 
     
    4950      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    5051      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    51       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5252      ! 
    5353      INTEGER :: ji, jj, jk  ! dummy loop indices 
     
    6060      pu  (:,:,:)   = 0._wp        ! ocean at rest 
    6161      pv  (:,:,:)   = 0._wp 
    62       pssh(:,:)     = 0._wp 
    6362      pts (:,:,:,:) = 0._wp            ! not used in SWE 
    6463 
     
    6968 
    7069 
    71    SUBROUTINE usr_def_ssh( ptmask, pssh ) 
     70   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
    7271      !!---------------------------------------------------------------------- 
    73       !!                   ***  ROUTINE usr_def_ssh  *** 
     72      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
    7473      !!  
    7574      !! ** Purpose :   Initialization of ssh 
    7675      !!                Here SWG configuration  
    7776      !! 
    78       !! ** Method  :   set ssh 
     77      !! ** Method  :   set ssh to 0 
    7978      !!---------------------------------------------------------------------- 
    8079      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask             [m] 
     
    8382      ! 
    8483      IF(lwp) WRITE(numout,*) 
    85       IF(lwp) WRITE(numout,*) 'usr_def_ssh : SWG configuration, analytical definition of initial state' 
     84      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : SWG configuration, analytical definition of initial state' 
    8685      ! 
    8786      pssh(:,:)   = 0._wp        ! ocean at rest 
    8887      ! 
    89    END SUBROUTINE usr_def_ssh 
     88   END SUBROUTINE usr_def_istate_ssh 
    9089 
    9190   !!====================================================================== 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/VORTEX/MY_SRC/usrdef_istate.F90

    r13757 r13874  
    88   !!====================================================================== 
    99   !! History :  NEMO ! 2017-11  (J. Chanut) Original code 
     10   !!                 ! 2020-11  (S. Techene, G. Madec) separate tsuv from ssh 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    2627   PRIVATE 
    2728 
    28    PUBLIC   usr_def_istate   ! called by istate.F90 
    29    PUBLIC   usr_def_ssh      ! called by domqco.F90 
     29   PUBLIC   usr_def_istate       ! called by istate.F90 
     30   PUBLIC   usr_def_istate_ssh   ! called by domqco.F90 
    3031 
    3132   !! * Substitutions 
     
    3839CONTAINS 
    3940   
    40    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     41   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    4142      !!---------------------------------------------------------------------- 
    4243      !!                   ***  ROUTINE usr_def_istate  *** 
     
    5354      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    5455      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    55       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5656      ! 
    5757      INTEGER  :: ji, jj, jk  ! dummy loop indices 
     
    7373      ! 
    7474      zP0 = rho0 * zf0 * zumax * zlambda * SQRT(EXP(1._wp)/2._wp) 
    75       ! 
    76       ! Sea level: 
    77       za = -zP0 * (1._wp-EXP(-zH)) / (grav*(zH-1._wp + EXP(-zH))) 
    78       DO_2D( 1, 1, 1, 1 ) 
    79          zx = glamt(ji,jj) * 1.e3 
    80          zy = gphit(ji,jj) * 1.e3 
    81          zrho1 = rho0 + za * EXP(-(zx**2+zy**2)/zlambda**2) 
    82          pssh(ji,jj) = zP0 * EXP(-(zx**2+zy**2)/zlambda**2)/(zrho1*grav) * ptmask(ji,jj,1) 
    83       END_2D 
    8475      ! 
    8576      ! temperature:          
     
    136127 
    137128 
    138    SUBROUTINE usr_def_ssh( ptmask, pssh ) 
     129   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
    139130      !!---------------------------------------------------------------------- 
    140131      !!                   ***  ROUTINE usr_def_istate  *** 
     
    143134      !!                Here VORTEX configuration  
    144135      !! 
    145       !! ** Method  :   Set a gaussian anomaly of pressure and associated 
     136      !! ** Method  :   Set ssh according to a gaussian anomaly of pressure and associated 
    146137      !!                geostrophic velocities 
    147138      !!---------------------------------------------------------------------- 
     
    154145      ! 
    155146      IF(lwp) WRITE(numout,*) 
    156       IF(lwp) WRITE(numout,*) 'usr_def_ssh : VORTEX configuration, analytical definition of initial state' 
     147      IF(lwp) WRITE(numout,*) 'usr_def_istate_ssh : VORTEX configuration, analytical definition of initial state' 
    157148      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~   ' 
    158149      ! 
     
    175166      END_2D 
    176167       
    177    END SUBROUTINE usr_def_ssh 
     168   END SUBROUTINE usr_def_istate_ssh 
    178169 
    179170   !!====================================================================== 
  • NEMO/branches/2020/dev_r13327_KERNEL-06_2_techene_e3/tests/WAD/MY_SRC/usrdef_istate.F90

    r13295 r13874  
    77   !! User defined : set the initial state of a user configuration 
    88   !!====================================================================== 
    9    !! History :  4.0 ! 2016-03  (S. Flavoni) Original code 
     9   !! History :  4.0  ! 2016-03  (S. Flavoni) Original code 
     10   !!                 ! 2020-11  (S. Techene, G. Madec) separate tsuv from ssh 
    1011   !!---------------------------------------------------------------------- 
    1112 
     
    2425   PRIVATE 
    2526 
    26    PUBLIC   usr_def_istate   ! called in istate.F90 
     27   PUBLIC   usr_def_istate       ! called in istate.F90 
     28   PUBLIC   usr_def_istate_ssh   ! called in sshwzv.F90 
    2729 
    2830   !! * Substitutions 
     
    3436   !!---------------------------------------------------------------------- 
    3537CONTAINS 
    36    
    37    SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv, pssh ) 
     38 
     39 
     40   SUBROUTINE usr_def_istate( pdept, ptmask, pts, pu, pv ) 
    3841      !!---------------------------------------------------------------------- 
    3942      !!                   ***  ROUTINE usr_def_istate  *** 
     
    4245      !!                Here WAD_TEST_CASES configuration  
    4346      !! 
    44       !! ** Method  : - set temprature field 
     47q      !! ** Method  : - set temprature field 
    4548      !!              - set salinity   field 
    4649      !!---------------------------------------------------------------------- 
     
    5053      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pu      ! i-component of the velocity  [m/s]  
    5154      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(  out) ::   pv      ! j-component of the velocity  [m/s]  
    52       REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
    5355      INTEGER  ::   ji, jj            ! dummy loop indices 
    5456      REAL(wp) ::   zi, zj 
     
    6668      pu  (:,:,:) = 0._wp        ! ocean at rest 
    6769      pv  (:,:,:) = 0._wp 
    68       pssh(:,:)   = 0._wp 
    69       ! 
    7070      !                          ! T & S profiles 
    7171      pts(:,:,:,jp_tem) = 10._wp * ptmask(:,:,:) 
     
    8383         CASE ( 1 )                               ! WAD 1 configuration 
    8484            !                                     ! ==================== 
    85             ! 
    8685            IF(lwp) WRITE(numout,*) 
    8786            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Closed box with EW linear bottom slope' 
    8887            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    89             ! 
    90             do ji = 1,jpi 
    91              pssh(ji,:) = ( -5.5_wp + 7.4_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
    92             end do 
    9388            !                                     ! ==================== 
    9489         CASE ( 2, 8 )                            ! WAD 2 configuration 
    9590            !                                     ! ==================== 
    96             ! 
    9791            IF(lwp) WRITE(numout,*) 
    9892            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, mid-range initial ssh slope' 
    9993            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    100             ! 
    101             do ji = 1,jpi 
    102              pssh(ji,:) = ( -1.5_wp + 5.0_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
    103             end do 
    10494            !                                     ! ==================== 
    10595         CASE ( 3 )                               ! WAD 3 configuration 
    10696            !                                     ! ==================== 
    107             ! 
    10897            IF(lwp) WRITE(numout,*) 
    10998            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, extreme initial ssh slope'  
    11099            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    111             ! 
    112             do ji = 1,jpi 
    113              pssh(ji,:) = ( -4.5_wp + 6.8_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
    114             end do 
     100            !                                     ! ==================== 
     101         CASE ( 4 )                               ! WAD 4 configuration 
     102            !                                     ! ==================== 
     103            IF(lwp) WRITE(numout,*) 
     104            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic bowl, mid-range initial ssh slope'  
     105            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     106            !                                    ! =========================== 
     107         CASE ( 5, 7 )                           ! WAD 5 and 7 configurations 
     108            !                                    ! =========================== 
     109            IF(lwp) WRITE(numout,*) 
     110            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Double slope with shelf' 
     111            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     112            !                                     ! ==================== 
     113         CASE ( 6 )                               ! WAD 6 configuration 
     114            !                                     ! ==================== 
     115            IF(lwp) WRITE(numout,*) 
     116            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel with gaussian ridge'  
     117            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     118            ! 
     119            DO ji = mi0(jpiglo/2), mi0(jpiglo) 
     120               pts(ji,:,:,jp_sal) = 30._wp 
     121            END DO 
     122            ! 
     123            ! 
     124            !                                    ! =========================== 
     125         CASE DEFAULT                            ! NONE existing configuration 
     126            !                                    ! =========================== 
     127            WRITE(ctmp1,*) 'WAD test with a ', nn_cfg,' option is not coded' 
     128            ! 
     129            CALL ctl_stop( ctmp1 ) 
     130            ! 
     131      END SELECT 
     132      ! 
     133   END SUBROUTINE usr_def_istate 
     134 
     135      
     136   SUBROUTINE usr_def_istate_ssh( ptmask, pssh ) 
     137      !!---------------------------------------------------------------------- 
     138      !!                   ***  ROUTINE usr_def_istate_ssh  *** 
     139      !!  
     140      !! ** Purpose :   Initialization of the dynamics and tracers 
     141      !!                Here WAD_TEST_CASES configuration  
     142      !! 
     143      !! ** Method  : - set ssh 
     144      !!---------------------------------------------------------------------- 
     145      REAL(wp), DIMENSION(jpi,jpj,jpk)     , INTENT(in   ) ::   ptmask  ! t-point ocean mask             [m] 
     146      REAL(wp), DIMENSION(jpi,jpj)         , INTENT(  out) ::   pssh    ! sea-surface height 
     147      INTEGER  ::   ji, jj            ! dummy loop indices 
     148      REAL(wp) ::   zi, zj 
     149      ! 
     150      INTEGER  ::   jk     ! dummy loop indices 
     151      REAL(wp) ::   zdam   ! location of dam [Km] 
     152      !!---------------------------------------------------------------------- 
     153      ! 
     154      ! 
     155      SELECT CASE ( nn_cfg )  
     156         !                                        ! ==================== 
     157         CASE ( 1 )                               ! WAD 1 configuration 
     158            !                                     ! ==================== 
     159            ! 
     160            IF(lwp) WRITE(numout,*) 
     161            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Closed box with EW linear bottom slope' 
     162            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     163            ! 
     164            DO ji = 1,jpi 
     165               pssh(ji,:) = ( -5.5_wp + 7.4_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
     166            END DO 
     167            !                                     ! ==================== 
     168         CASE ( 2, 8 )                            ! WAD 2 configuration 
     169            !                                     ! ==================== 
     170            ! 
     171            IF(lwp) WRITE(numout,*) 
     172            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, mid-range initial ssh slope' 
     173            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     174            ! 
     175            DO ji = 1,jpi 
     176               pssh(ji,:) = ( -1.5_wp + 5.0_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
     177            END DO 
     178            !                                     ! ==================== 
     179         CASE ( 3 )                               ! WAD 3 configuration 
     180            !                                     ! ==================== 
     181            ! 
     182            IF(lwp) WRITE(numout,*) 
     183            IF(lwp) WRITE(numout,*) 'usr_def_istate : WAD Parobolic EW channel, extreme initial ssh slope'  
     184            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
     185            ! 
     186            DO ji = 1,jpi 
     187               pssh(ji,:) = ( -4.5_wp + 6.8_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
     188            END DO 
    115189 
    116190            ! 
     
    140214            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    141215            ! 
    142             do ji = 1,jpi 
    143              pssh(ji,:) = ( -2.5_wp + 5.5_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
    144             end do 
     216            DO ji = 1,jpi 
     217               pssh(ji,:) = ( -2.5_wp + 5.5_wp*glamt(ji,1)/50._wp)*ptmask(ji,:,1) 
     218            END DO 
    145219 
    146220            ! 
     
    153227            IF(lwp) WRITE(numout,*) '~~~~~~~~~~' 
    154228            ! 
    155             do ji = 1,jpi 
    156              pssh(ji,:) = ( -2.5_wp + 5.5_wp*(50._wp-glamt(ji,1))/50._wp)*ptmask(ji,:,1) 
    157             end do 
    158             ! 
    159             do ji = mi0(jpiglo/2), mi0(jpiglo) 
    160              pts(ji,:,:,jp_sal) = 30._wp 
    161              pssh(ji,:) = -0.1*ptmask(ji,:,1) 
    162             end do 
     229            DO ji = 1,jpi 
     230               pssh(ji,:) = ( -2.5_wp + 5.5_wp*(50._wp-glamt(ji,1))/50._wp)*ptmask(ji,:,1) 
     231            END DO 
     232            ! 
     233            DO ji = mi0(jpiglo/2), mi0(jpiglo) 
     234               pssh(ji,:) = -0.1*ptmask(ji,:,1) 
     235            END DO 
    163236            ! 
    164237            ! 
     
    182255      END_2D 
    183256      ! 
    184    END SUBROUTINE usr_def_istate 
     257   END SUBROUTINE usr_def_istate_ssh 
    185258 
    186259   !!====================================================================== 
Note: See TracChangeset for help on using the changeset viewer.