[6906] | 1 | MODULE usrdef_zgr |
---|
[6923] | 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE usrdef_zgr *** |
---|
[6906] | 4 | !! |
---|
[6923] | 5 | !! === LOCK_EXCHANGE case === |
---|
[6906] | 6 | !! |
---|
[6914] | 7 | !! Ocean domain : user defined vertical coordinate system |
---|
[6923] | 8 | !!====================================================================== |
---|
[6914] | 9 | !! History : 4.0 ! 2016-08 (G. Madec, S. Flavoni) Original code |
---|
[6906] | 10 | !!---------------------------------------------------------------------- |
---|
| 11 | |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
[6914] | 13 | !! usr_def_zgr : user defined vertical coordinate system (required) |
---|
| 14 | !! zgr_z1d : reference 1D z-coordinate |
---|
[6906] | 15 | !!--------------------------------------------------------------------- |
---|
[6914] | 16 | USE oce ! ocean variables |
---|
| 17 | USE dom_oce , ONLY: ln_zco, ln_zps, ln_sco ! ocean space and time domain |
---|
| 18 | USE usrdef_nam ! User defined : namelist variables |
---|
[6906] | 19 | ! |
---|
[6914] | 20 | USE in_out_manager ! I/O manager |
---|
| 21 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 22 | USE lib_mpp ! distributed memory computing library |
---|
| 23 | USE wrk_nemo ! Memory allocation |
---|
| 24 | USE timing ! Timing |
---|
[6906] | 25 | |
---|
| 26 | IMPLICIT NONE |
---|
| 27 | PRIVATE |
---|
| 28 | |
---|
[6923] | 29 | PUBLIC usr_def_zgr ! called by domzgr.F90 |
---|
[6906] | 30 | |
---|
| 31 | !! * Substitutions |
---|
| 32 | # include "vectopt_loop_substitute.h90" |
---|
| 33 | !!---------------------------------------------------------------------- |
---|
| 34 | !! NEMO/OPA 4.0 , NEMO Consortium (2016) |
---|
[6923] | 35 | !! $Id$ |
---|
[6906] | 36 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 37 | !!---------------------------------------------------------------------- |
---|
| 38 | CONTAINS |
---|
| 39 | |
---|
| 40 | SUBROUTINE usr_def_zgr( ld_zco , ld_zps , ld_sco , ld_isfcav, & ! type of vertical coordinate |
---|
| 41 | & pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d , & ! 1D reference vertical coordinate |
---|
| 42 | & pdept , pdepw , & ! 3D t & w-points depth |
---|
| 43 | & pe3t , pe3u , pe3v , pe3f , & ! vertical scale factors |
---|
| 44 | & pe3w , pe3uw , pe3vw, & ! - - - |
---|
| 45 | & k_top , k_bot ) ! top & bottom ocean level |
---|
| 46 | !!--------------------------------------------------------------------- |
---|
| 47 | !! *** ROUTINE usr_def_zgr *** |
---|
| 48 | !! |
---|
| 49 | !! ** Purpose : User defined the vertical coordinates |
---|
| 50 | !! |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
| 52 | LOGICAL , INTENT(out) :: ld_zco, ld_zps, ld_sco ! vertical coordinate flags |
---|
| 53 | LOGICAL , INTENT(out) :: ld_isfcav ! under iceshelf cavity flag |
---|
| 54 | REAL(wp), DIMENSION(:) , INTENT(out) :: pdept_1d, pdepw_1d ! 1D grid-point depth [m] |
---|
| 55 | REAL(wp), DIMENSION(:) , INTENT(out) :: pe3t_1d , pe3w_1d ! 1D grid-point depth [m] |
---|
| 56 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pdept, pdepw ! grid-point depth [m] |
---|
| 57 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pe3t , pe3u , pe3v , pe3f ! vertical scale factors [m] |
---|
| 58 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pe3w , pe3uw, pe3vw ! i-scale factors |
---|
| 59 | INTEGER , DIMENSION(:,:) , INTENT(out) :: k_top, k_bot ! first & last ocean level |
---|
| 60 | ! |
---|
[6914] | 61 | INTEGER :: jk ! dummy indices |
---|
| 62 | REAL(wp), DIMENSION(jpi,jpj) :: z2d ! 2D workspace |
---|
[6906] | 63 | !!---------------------------------------------------------------------- |
---|
| 64 | ! |
---|
| 65 | IF(lwp) WRITE(numout,*) |
---|
| 66 | IF(lwp) WRITE(numout,*) 'usr_def_zgr : LOCK_EXCHANGE configuration (z-coordinate closed box ocean without cavities)' |
---|
| 67 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' |
---|
| 68 | ! |
---|
| 69 | ! |
---|
| 70 | ! type of vertical coordinate |
---|
| 71 | ! --------------------------- |
---|
| 72 | ! set in usrdef_nam.F90 by reading the namusr_def namelist only ln_zco |
---|
[6914] | 73 | ln_zco = .TRUE. ! z-partial-step coordinate |
---|
[6906] | 74 | ln_zps = .FALSE. ! z-partial-step coordinate |
---|
| 75 | ln_sco = .FALSE. ! s-coordinate |
---|
| 76 | ld_isfcav = .FALSE. ! ISF Ice Shelves Flag |
---|
| 77 | ! |
---|
| 78 | ! |
---|
| 79 | ! Build the vertical coordinate system |
---|
| 80 | ! ------------------------------------ |
---|
| 81 | ! |
---|
| 82 | ! !== UNmasked meter bathymetry ==! |
---|
| 83 | ! |
---|
[6914] | 84 | ! flat bassin (20m deep and 64000m wide, set through the jpk and jpi (see userdef_nam.F90)) |
---|
[6906] | 85 | CALL zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d ) ! Reference z-coordinate system |
---|
| 86 | ! |
---|
| 87 | ! |
---|
| 88 | ! !== top masked level bathymetry ==! (all coordinates) |
---|
| 89 | ! |
---|
| 90 | ! no ocean cavities : top ocean level is ONE, except over land |
---|
| 91 | ! the ocean basin surrounded by land (1 grid-point) set through lbc_lnk call as jperio=0 |
---|
| 92 | z2d(:,:) = 1._wp ! surface ocean is the 1st level |
---|
[6914] | 93 | CALL lbc_lnk( z2d, 'T', 1. ) ! closed basin since jperio = 0 (see userdef_nam.F90) |
---|
| 94 | k_top(:,:) = NINT( z2d(:,:) ) |
---|
[6906] | 95 | ! |
---|
| 96 | ! |
---|
[6914] | 97 | ! !== z-coordinate ==! (step-like topography) |
---|
[6906] | 98 | ! |
---|
[6914] | 99 | ! !* bottom ocean compute from the depth of grid-points |
---|
| 100 | k_bot(:,:) = jpkm1 * k_top(:,:) ! here use k_top as a land mask |
---|
| 101 | ! !* horizontally uniform coordinate (reference z-co everywhere) |
---|
| 102 | DO jk = 1, jpk |
---|
| 103 | pdept(:,:,jk) = pdept_1d(jk) |
---|
| 104 | pdepw(:,:,jk) = pdepw_1d(jk) |
---|
| 105 | pe3t (:,:,jk) = pe3t_1d (jk) |
---|
| 106 | pe3u (:,:,jk) = pe3t_1d (jk) |
---|
| 107 | pe3v (:,:,jk) = pe3t_1d (jk) |
---|
| 108 | pe3f (:,:,jk) = pe3t_1d (jk) |
---|
| 109 | pe3w (:,:,jk) = pe3w_1d (jk) |
---|
| 110 | pe3uw(:,:,jk) = pe3w_1d (jk) |
---|
| 111 | pe3vw(:,:,jk) = pe3w_1d (jk) |
---|
| 112 | END DO |
---|
[6906] | 113 | ! |
---|
| 114 | END SUBROUTINE usr_def_zgr |
---|
| 115 | |
---|
| 116 | |
---|
| 117 | SUBROUTINE zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d ) ! 1D reference vertical coordinate |
---|
| 118 | !!---------------------------------------------------------------------- |
---|
| 119 | !! *** ROUTINE zgr_z1d *** |
---|
| 120 | !! |
---|
| 121 | !! ** Purpose : set the depth of model levels and the resulting |
---|
| 122 | !! vertical scale factors. |
---|
| 123 | !! |
---|
[7188] | 124 | !! ** Method : 1D z-coordinate system (use in all type of coordinate) |
---|
| 125 | !! The depth of model levels is set from dep(k), an analytical function: |
---|
| 126 | !! w-level: depw_1d = dep(k) |
---|
| 127 | !! t-level: dept_1d = dep(k+0.5) |
---|
| 128 | !! The scale factors are the discrete derivative of the depth: |
---|
| 129 | !! e3w_1d(jk) = dk[ dept_1d ] |
---|
| 130 | !! e3t_1d(jk) = dk[ depw_1d ] |
---|
[6906] | 131 | !! |
---|
| 132 | !! === Here constant vertical resolution === |
---|
| 133 | !! |
---|
| 134 | !! ** Action : - pdept_1d, pdepw_1d : depth of T- and W-point (m) |
---|
| 135 | !! - pe3t_1d , pe3w_1d : scale factors at T- and W-levels (m) |
---|
| 136 | !!---------------------------------------------------------------------- |
---|
| 137 | REAL(wp), DIMENSION(:), INTENT(out) :: pdept_1d, pdepw_1d ! 1D grid-point depth [m] |
---|
| 138 | REAL(wp), DIMENSION(:), INTENT(out) :: pe3t_1d , pe3w_1d ! 1D vertical scale factors [m] |
---|
| 139 | ! |
---|
| 140 | INTEGER :: jk ! dummy loop indices |
---|
| 141 | REAL(wp) :: zt, zw ! local scalar |
---|
| 142 | !!---------------------------------------------------------------------- |
---|
| 143 | ! |
---|
| 144 | IF(lwp) THEN ! Parameter print |
---|
| 145 | WRITE(numout,*) |
---|
| 146 | WRITE(numout,*) ' zgr_z1d : Reference vertical z-coordinates: uniform dz = ', rn_dz |
---|
| 147 | WRITE(numout,*) ' ~~~~~~~' |
---|
| 148 | ENDIF |
---|
| 149 | ! |
---|
| 150 | ! Reference z-coordinate (depth - scale factor at T- and W-points) ! Madec & Imbard 1996 function |
---|
| 151 | ! ---------------------- |
---|
| 152 | DO jk = 1, jpk |
---|
| 153 | zw = REAL( jk , wp ) |
---|
| 154 | zt = REAL( jk , wp ) + 0.5_wp |
---|
| 155 | pdepw_1d(jk) = rn_dz * REAL( jk-1 , wp ) |
---|
| 156 | pdept_1d(jk) = rn_dz * ( REAL( jk-1 , wp ) + 0.5_wp ) |
---|
| 157 | pe3w_1d (jk) = rn_dz |
---|
| 158 | pe3t_1d (jk) = rn_dz |
---|
| 159 | END DO |
---|
| 160 | ! |
---|
| 161 | IF(lwp) THEN ! control print |
---|
| 162 | WRITE(numout,*) |
---|
| 163 | WRITE(numout,*) ' Reference 1D z-coordinate depth and scale factors:' |
---|
| 164 | WRITE(numout, "(9x,' level gdept_1d gdepw_1d e3t_1d e3w_1d ')" ) |
---|
| 165 | WRITE(numout, "(10x, i4, 4f9.2)" ) ( jk, pdept_1d(jk), pdepw_1d(jk), pe3t_1d(jk), pe3w_1d(jk), jk = 1, jpk ) |
---|
| 166 | ENDIF |
---|
| 167 | ! |
---|
| 168 | END SUBROUTINE zgr_z1d |
---|
| 169 | |
---|
| 170 | !!====================================================================== |
---|
| 171 | END MODULE usrdef_zgr |
---|