[12732] | 1 | MODULE domqco |
---|
[12482] | 2 | !!====================================================================== |
---|
[12732] | 3 | !! *** MODULE domqco *** |
---|
[12482] | 4 | !! Ocean : |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 2.0 ! 2006-06 (B. Levier, L. Marie) original code |
---|
| 7 | !! 3.1 ! 2009-02 (G. Madec, M. Leclair, R. Benshila) pure z* coordinate |
---|
| 8 | !! 3.3 ! 2011-10 (M. Leclair) totally rewrote domvvl: vvl option includes z_star and z_tilde coordinates |
---|
| 9 | !! 3.6 ! 2014-11 (P. Mathiot) add ice shelf capability |
---|
[13427] | 10 | !! 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 |
---|
[12482] | 12 | !!---------------------------------------------------------------------- |
---|
| 13 | |
---|
| 14 | !!---------------------------------------------------------------------- |
---|
[13427] | 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 |
---|
[12482] | 20 | !!---------------------------------------------------------------------- |
---|
[12680] | 21 | USE oce ! ocean dynamics and tracers |
---|
| 22 | USE phycst ! physical constant |
---|
| 23 | USE dom_oce ! ocean space and time domain |
---|
[12492] | 24 | USE dynadv , ONLY : ln_dynadv_vec |
---|
[12680] | 25 | USE isf_oce ! iceshelf cavities |
---|
| 26 | USE sbc_oce ! ocean surface boundary condition |
---|
| 27 | USE wet_dry ! wetting and drying |
---|
| 28 | USE usrdef_istate ! user defined initial state (wad only) |
---|
| 29 | USE restart ! ocean restart |
---|
[12482] | 30 | ! |
---|
[12680] | 31 | USE in_out_manager ! I/O manager |
---|
| 32 | USE iom ! I/O manager library |
---|
| 33 | USE lib_mpp ! distributed memory computing library |
---|
| 34 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 35 | USE timing ! Timing |
---|
[12482] | 36 | |
---|
| 37 | IMPLICIT NONE |
---|
| 38 | PRIVATE |
---|
| 39 | |
---|
[12732] | 40 | PUBLIC dom_qco_init ! called by domain.F90 |
---|
| 41 | PUBLIC dom_qco_zgr ! called by isfcpl.F90 |
---|
| 42 | PUBLIC dom_qco_r3c ! called by steplf.F90 |
---|
[12482] | 43 | |
---|
| 44 | ! !!* Namelist nam_vvl |
---|
| 45 | LOGICAL , PUBLIC :: ln_vvl_zstar = .FALSE. ! zstar vertical coordinate |
---|
| 46 | LOGICAL , PUBLIC :: ln_vvl_ztilde = .FALSE. ! ztilde vertical coordinate |
---|
| 47 | LOGICAL , PUBLIC :: ln_vvl_layer = .FALSE. ! level vertical coordinate |
---|
| 48 | LOGICAL , PUBLIC :: ln_vvl_ztilde_as_zstar = .FALSE. ! ztilde vertical coordinate |
---|
| 49 | LOGICAL , PUBLIC :: ln_vvl_zstar_at_eqtor = .FALSE. ! ztilde vertical coordinate |
---|
| 50 | LOGICAL , PUBLIC :: ln_vvl_kepe = .FALSE. ! kinetic/potential energy transfer |
---|
| 51 | ! ! conservation: not used yet |
---|
| 52 | REAL(wp) :: rn_ahe3 ! thickness diffusion coefficient |
---|
| 53 | REAL(wp) :: rn_rst_e3t ! ztilde to zstar restoration timescale [days] |
---|
| 54 | REAL(wp) :: rn_lf_cutoff ! cutoff frequency for low-pass filter [days] |
---|
| 55 | REAL(wp) :: rn_zdef_max ! maximum fractional e3t deformation |
---|
| 56 | LOGICAL , PUBLIC :: ln_vvl_dbg = .FALSE. ! debug control prints |
---|
| 57 | |
---|
| 58 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: un_td, vn_td ! thickness diffusion transport |
---|
| 59 | |
---|
| 60 | !! * Substitutions |
---|
| 61 | # include "do_loop_substitute.h90" |
---|
| 62 | !!---------------------------------------------------------------------- |
---|
| 63 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
| 64 | !! $Id: domvvl.F90 12377 2020-02-12 14:39:06Z acc $ |
---|
| 65 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
| 66 | !!---------------------------------------------------------------------- |
---|
| 67 | CONTAINS |
---|
| 68 | |
---|
[12732] | 69 | SUBROUTINE dom_qco_init( Kbb, Kmm, Kaa ) |
---|
[12482] | 70 | !!---------------------------------------------------------------------- |
---|
[12732] | 71 | !! *** ROUTINE dom_qco_init *** |
---|
[12482] | 72 | !! |
---|
[12732] | 73 | !! ** Purpose : Initialization of all ssh. to h._0 ratio |
---|
[12482] | 74 | !! |
---|
| 75 | !! ** Method : - use restart file and/or initialize |
---|
[12732] | 76 | !! - compute ssh. to h._0 ratio |
---|
[12482] | 77 | !! |
---|
[12732] | 78 | !! ** Action : - r3(t/u/v)_b |
---|
| 79 | !! - r3(t/u/v/f)_n |
---|
[12482] | 80 | !! |
---|
| 81 | !!---------------------------------------------------------------------- |
---|
[13427] | 82 | INTEGER, INTENT(in) :: Kbb, Kmm, Kaa ! time level indices |
---|
| 83 | !!---------------------------------------------------------------------- |
---|
[12482] | 84 | ! |
---|
| 85 | IF(lwp) WRITE(numout,*) |
---|
[12732] | 86 | IF(lwp) WRITE(numout,*) 'dom_qco_init : Variable volume activated' |
---|
[12482] | 87 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' |
---|
| 88 | ! |
---|
[13427] | 89 | CALL qco_ctl ! choose vertical coordinate (z_star, z_tilde or layer) |
---|
| 90 | ! ! CAUTION COM A METTRE !!! |
---|
| 91 | !!st CALL qco_rst_read2( nit000, Kbb, Kmm ) ! Read or initialize ssh_(Kbb/Kmm) and r3 |
---|
| 92 | !!st CAUTION if read2 removed change restart.F90 ! |
---|
[12482] | 93 | ! |
---|
[13427] | 94 | CALL qco_rst_read( nit000, Kbb, Kmm ) ! Read or initialize ssh_(Kbb/Kmm) |
---|
[12482] | 95 | ! |
---|
[13427] | 96 | CALL dom_qco_zgr( Kbb, Kmm, Kaa ) ! interpolation scale factor, depth and water column |
---|
[12482] | 97 | ! |
---|
[13427] | 98 | IF(lwxios) THEN ! define variables in restart file when writing with XIOS |
---|
| 99 | CALL iom_set_rstw_var_active('sshb') |
---|
| 100 | CALL iom_set_rstw_var_active('sshn') |
---|
| 101 | ENDIF |
---|
[12482] | 102 | ! |
---|
[12732] | 103 | END SUBROUTINE dom_qco_init |
---|
[12492] | 104 | |
---|
| 105 | |
---|
[13427] | 106 | SUBROUTINE dom_qco_zgr( Kbb, Kmm, Kaa ) |
---|
[12482] | 107 | !!---------------------------------------------------------------------- |
---|
[12732] | 108 | !! *** ROUTINE dom_qco_init *** |
---|
[12482] | 109 | !! |
---|
[13427] | 110 | !! ** Purpose : Initialization of all ssh./h._0 ratio |
---|
[12482] | 111 | !! |
---|
[13427] | 112 | !! ** Method : - call domqco using Kbb and Kmm |
---|
[12482] | 113 | !! |
---|
[12732] | 114 | !! ** Action : - r3(t/u/v)_b |
---|
| 115 | !! - r3(t/u/v/f)_n |
---|
[12482] | 116 | !!---------------------------------------------------------------------- |
---|
[13427] | 117 | INTEGER, INTENT(in) :: Kbb, Kmm, Kaa ! time level indices |
---|
[12482] | 118 | !!---------------------------------------------------------------------- |
---|
| 119 | ! |
---|
| 120 | ! !== Set of all other vertical scale factors ==! (now and before) |
---|
| 121 | ! ! Horizontal interpolation of e3t |
---|
[12732] | 122 | CALL dom_qco_r3c( ssh(:,:,Kbb), r3t(:,:,Kbb), r3u(:,:,Kbb), r3v(:,:,Kbb) ) |
---|
| 123 | CALL dom_qco_r3c( ssh(:,:,Kmm), r3t(:,:,Kmm), r3u(:,:,Kmm), r3v(:,:,Kmm), r3f(:,:) ) |
---|
[12492] | 124 | ! |
---|
[13427] | 125 | #if defined key_agrif |
---|
| 126 | ! We need to define r3[tuv](Kaa) for AGRIF initialisation (should not be a problem for the restartability...) |
---|
| 127 | r3t(:,:,Kaa) = r3t(:,:,Kmm) |
---|
| 128 | r3u(:,:,Kaa) = r3u(:,:,Kmm) |
---|
| 129 | r3v(:,:,Kaa) = r3v(:,:,Kmm) |
---|
| 130 | #endif |
---|
| 131 | ! |
---|
[12732] | 132 | END SUBROUTINE dom_qco_zgr |
---|
[12482] | 133 | |
---|
[12624] | 134 | |
---|
[12732] | 135 | SUBROUTINE dom_qco_r3c( pssh, pr3t, pr3u, pr3v, pr3f ) |
---|
[12492] | 136 | !!--------------------------------------------------------------------- |
---|
| 137 | !! *** ROUTINE r3c *** |
---|
| 138 | !! |
---|
| 139 | !! ** Purpose : compute the filtered ratio ssh/h_0 at t-,u-,v-,f-points |
---|
| 140 | !! |
---|
| 141 | !! ** Method : - compute the ssh at u- and v-points (f-point optional) |
---|
| 142 | !! Vector Form : surface weighted averaging |
---|
| 143 | !! Flux Form : simple averaging |
---|
| 144 | !! - compute the ratio ssh/h_0 at t-,u-,v-pts, (f-pt optional) |
---|
| 145 | !!---------------------------------------------------------------------- |
---|
| 146 | REAL(wp), DIMENSION(:,:) , INTENT(in ) :: pssh ! sea surface height [m] |
---|
| 147 | REAL(wp), DIMENSION(:,:) , INTENT( out) :: pr3t, pr3u, pr3v ! ssh/h0 ratio at t-, u-, v-,points [-] |
---|
| 148 | REAL(wp), DIMENSION(:,:), OPTIONAL, INTENT( out) :: pr3f ! ssh/h0 ratio at f-point [-] |
---|
| 149 | ! |
---|
| 150 | INTEGER :: ji, jj ! dummy loop indices |
---|
| 151 | !!---------------------------------------------------------------------- |
---|
| 152 | ! |
---|
| 153 | ! |
---|
| 154 | pr3t(:,:) = pssh(:,:) * r1_ht_0(:,:) !== ratio at t-point ==! |
---|
| 155 | ! |
---|
| 156 | ! |
---|
| 157 | ! !== ratio at u-,v-point ==! |
---|
| 158 | ! |
---|
[13427] | 159 | !!st IF( ln_dynadv_vec ) THEN !- Vector Form (thickness weighted averaging) |
---|
| 160 | #if ! defined key_qcoTest_FluxForm |
---|
| 161 | ! ! no 'key_qcoTest_FluxForm' : surface weighted ssh average |
---|
[13295] | 162 | DO_2D( 0, 0, 0, 0 ) |
---|
[12492] | 163 | pr3u(ji,jj) = 0.5_wp * ( e1e2t(ji ,jj) * pssh(ji ,jj) & |
---|
| 164 | & + e1e2t(ji+1,jj) * pssh(ji+1,jj) ) * r1_hu_0(ji,jj) * r1_e1e2u(ji,jj) |
---|
| 165 | pr3v(ji,jj) = 0.5_wp * ( e1e2t(ji,jj ) * pssh(ji,jj ) & |
---|
| 166 | & + e1e2t(ji,jj+1) * pssh(ji,jj+1) ) * r1_hv_0(ji,jj) * r1_e1e2v(ji,jj) |
---|
| 167 | END_2D |
---|
[13427] | 168 | !!st ELSE !- Flux Form (simple averaging) |
---|
| 169 | #else |
---|
[13295] | 170 | DO_2D( 0, 0, 0, 0 ) |
---|
[13427] | 171 | pr3u(ji,jj) = 0.5_wp * ( pssh(ji,jj) + pssh(ji+1,jj ) ) * r1_hu_0(ji,jj) |
---|
| 172 | pr3v(ji,jj) = 0.5_wp * ( pssh(ji,jj) + pssh(ji ,jj+1) ) * r1_hv_0(ji,jj) |
---|
[12492] | 173 | END_2D |
---|
[13427] | 174 | !!st ENDIF |
---|
| 175 | #endif |
---|
[12492] | 176 | ! |
---|
| 177 | IF( .NOT.PRESENT( pr3f ) ) THEN !- lbc on ratio at u-, v-points only |
---|
[12732] | 178 | CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp ) |
---|
[12492] | 179 | ! |
---|
| 180 | ! |
---|
| 181 | ELSE !== ratio at f-point ==! |
---|
| 182 | ! |
---|
[13427] | 183 | !!st IF( ln_dynadv_vec ) THEN !- Vector Form (thickness weighted averaging) |
---|
| 184 | #if ! defined key_qcoTest_FluxForm |
---|
| 185 | ! ! no 'key_qcoTest_FluxForm' : surface weighted ssh average |
---|
| 186 | |
---|
[13607] | 187 | DO_2D( 0, 0, 0, 0 ) ! start from 1 since lbc_lnk('F') doesn't update the 1st row/line |
---|
[12492] | 188 | pr3f(ji,jj) = 0.25_wp * ( e1e2t(ji ,jj ) * pssh(ji ,jj ) & |
---|
| 189 | & + e1e2t(ji+1,jj ) * pssh(ji+1,jj ) & |
---|
| 190 | & + e1e2t(ji ,jj+1) * pssh(ji ,jj+1) & |
---|
| 191 | & + e1e2t(ji+1,jj+1) * pssh(ji+1,jj+1) ) * r1_hf_0(ji,jj) * r1_e1e2f(ji,jj) |
---|
| 192 | END_2D |
---|
[13427] | 193 | !!st ELSE !- Flux Form (simple averaging) |
---|
| 194 | #else |
---|
[13607] | 195 | DO_2D( 0, 0, 0, 0 ) ! start from 1 since lbc_lnk('F') doesn't update the 1st row/line |
---|
[13427] | 196 | pr3f(ji,jj) = 0.25_wp * ( pssh(ji,jj ) + pssh(ji+1,jj ) & |
---|
| 197 | & + pssh(ji,jj+1) + pssh(ji+1,jj+1) ) * r1_hf_0(ji,jj) |
---|
[12492] | 198 | END_2D |
---|
[13427] | 199 | !!st ENDIF |
---|
| 200 | #endif |
---|
[12492] | 201 | ! ! lbc on ratio at u-,v-,f-points |
---|
[12732] | 202 | CALL lbc_lnk_multi( 'dom_qco_r3c', pr3u, 'U', 1._wp, pr3v, 'V', 1._wp, pr3f, 'F', 1._wp ) |
---|
[12492] | 203 | ! |
---|
| 204 | ENDIF |
---|
| 205 | ! |
---|
[12732] | 206 | END SUBROUTINE dom_qco_r3c |
---|
[12492] | 207 | |
---|
| 208 | |
---|
[13427] | 209 | SUBROUTINE qco_rst_read( kt, Kbb, Kmm ) |
---|
[12482] | 210 | !!--------------------------------------------------------------------- |
---|
[13427] | 211 | !! *** ROUTINE qco_rst_read *** |
---|
[12482] | 212 | !! |
---|
[12680] | 213 | !! ** Purpose : Read ssh in restart file |
---|
[12482] | 214 | !! |
---|
| 215 | !! ** Method : use of IOM library |
---|
[12680] | 216 | !! if the restart does not contain ssh, |
---|
| 217 | !! it is set to the _0 values. |
---|
[12482] | 218 | !!---------------------------------------------------------------------- |
---|
[13427] | 219 | INTEGER, INTENT(in) :: kt ! ocean time-step |
---|
| 220 | INTEGER, INTENT(in) :: Kbb, Kmm ! ocean time level indices |
---|
[12482] | 221 | ! |
---|
| 222 | INTEGER :: ji, jj, jk |
---|
| 223 | INTEGER :: id1, id2 ! local integers |
---|
| 224 | !!---------------------------------------------------------------------- |
---|
| 225 | ! |
---|
[13427] | 226 | IF( ln_rstart ) THEN !* Read the restart file |
---|
| 227 | CALL rst_read_open ! open the restart file if necessary |
---|
| 228 | ! |
---|
| 229 | id1 = iom_varid( numror, 'sshb', ldstop = .FALSE. ) |
---|
| 230 | id2 = iom_varid( numror, 'sshn', ldstop = .FALSE. ) |
---|
| 231 | ! |
---|
| 232 | ! ! --------- ! |
---|
| 233 | ! ! all cases ! |
---|
| 234 | ! ! --------- ! |
---|
| 235 | ! |
---|
| 236 | IF( MIN( id1, id2 ) > 0 ) THEN ! all required arrays exist |
---|
| 237 | CALL iom_get( numror, jpdom_auto, 'sshb' , ssh(:,:,Kbb), ldxios = lrxios ) |
---|
| 238 | CALL iom_get( numror, jpdom_auto, 'sshn' , ssh(:,:,Kmm), ldxios = lrxios ) |
---|
| 239 | ! needed to restart if land processor not computed |
---|
| 240 | IF(lwp) write(numout,*) 'qco_rst_read : ssh(:,:,Kbb) and ssh(:,:,Kmm) found in restart files' |
---|
| 241 | !!WHERE ( ssmask(:,:) == 0.0_wp ) !!gm/st ==> sm should not be necessary on ssh while it was required on e3 |
---|
| 242 | !! ssh(:,:,Kmm) = 0._wp |
---|
| 243 | !! ssh(:,:,Kbb) = 0._wp |
---|
| 244 | !!END WHERE |
---|
| 245 | IF( l_1st_euler ) THEN |
---|
| 246 | ssh(:,:,Kbb) = ssh(:,:,Kmm) |
---|
| 247 | ENDIF |
---|
| 248 | ELSE IF( id1 > 0 ) THEN |
---|
| 249 | IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart files' |
---|
| 250 | IF(lwp) write(numout,*) 'sshn set equal to sshb.' |
---|
| 251 | IF(lwp) write(numout,*) 'neuler is forced to 0' |
---|
| 252 | CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios ) |
---|
| 253 | ssh(:,:,Kmm) = ssh(:,:,Kbb) |
---|
| 254 | l_1st_euler = .TRUE. |
---|
| 255 | ELSE IF( id2 > 0 ) THEN |
---|
| 256 | IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kbb) not found in restart files' |
---|
| 257 | IF(lwp) write(numout,*) 'sshb set equal to sshn.' |
---|
| 258 | IF(lwp) write(numout,*) 'neuler is forced to 0' |
---|
| 259 | CALL iom_get( numror, jpdom_auto, 'sshn', ssh(:,:,Kmm), ldxios = lrxios ) |
---|
| 260 | ssh(:,:,Kbb) = ssh(:,:,Kmm) |
---|
| 261 | l_1st_euler = .TRUE. |
---|
| 262 | ELSE |
---|
| 263 | IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart file' |
---|
| 264 | IF(lwp) write(numout,*) 'ssh_b and ssh_n set to zero' |
---|
| 265 | IF(lwp) write(numout,*) 'neuler is forced to 0' |
---|
| 266 | ssh(:,:,:) = 0._wp |
---|
| 267 | l_1st_euler = .TRUE. |
---|
| 268 | ENDIF |
---|
| 269 | ! |
---|
| 270 | ELSE !* Initialize at "rest" |
---|
| 271 | ! |
---|
| 272 | IF( ll_wd ) THEN ! MJB ll_wd edits start here - these are essential |
---|
[12482] | 273 | ! |
---|
[13427] | 274 | IF( cn_cfg == 'wad' ) THEN ! Wetting and drying test case |
---|
| 275 | CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb) ) |
---|
| 276 | ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb) ! set now values from to before ones |
---|
| 277 | ssh(:,: ,Kmm) = ssh(:,: ,Kbb) |
---|
| 278 | uu (:,:,: ,Kmm) = uu (:,:,: ,Kbb) |
---|
| 279 | vv (:,:,: ,Kmm) = vv (:,:,: ,Kbb) |
---|
| 280 | ELSE ! if not test case |
---|
| 281 | ssh(:,:,Kmm) = -ssh_ref |
---|
| 282 | ssh(:,:,Kbb) = -ssh_ref |
---|
| 283 | ! |
---|
| 284 | DO_2D( 1, 1, 1, 1 ) |
---|
| 285 | IF( ht_0(ji,jj)-ssh_ref < rn_wdmin1 ) THEN ! if total depth is less than min depth |
---|
| 286 | ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) ) |
---|
| 287 | ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) ) |
---|
| 288 | ENDIF |
---|
| 289 | END_2D |
---|
| 290 | ENDIF |
---|
[12482] | 291 | ! |
---|
[13427] | 292 | DO ji = 1, jpi |
---|
| 293 | DO jj = 1, jpj |
---|
| 294 | IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN |
---|
| 295 | CALL ctl_stop( 'qco_rst_read: ht_0 must be positive at potentially wet points' ) |
---|
| 296 | ENDIF |
---|
| 297 | END DO |
---|
| 298 | END DO |
---|
[12482] | 299 | ! |
---|
[13427] | 300 | ELSE |
---|
| 301 | ! |
---|
| 302 | ! Just to read set ssh in fact, called latter once vertical grid |
---|
| 303 | ! is set up: |
---|
| 304 | ! CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb) ) |
---|
| 305 | ! ! |
---|
| 306 | ssh(:,:,:) = 0._wp |
---|
| 307 | ! |
---|
| 308 | ENDIF ! end of ll_wd edits |
---|
| 309 | ! |
---|
| 310 | ENDIF |
---|
| 311 | ! |
---|
| 312 | END SUBROUTINE qco_rst_read |
---|
| 313 | |
---|
| 314 | |
---|
| 315 | SUBROUTINE qco_rst_read2( kt, Kbb, Kmm ) |
---|
| 316 | !!--------------------------------------------------------------------- |
---|
| 317 | !! *** ROUTINE qco_rst_read *** |
---|
| 318 | !! |
---|
| 319 | !! ** Purpose : Read ssh in restart file |
---|
| 320 | !! |
---|
| 321 | !! ** Method : use of IOM library |
---|
| 322 | !! if the restart does not contain ssh, |
---|
| 323 | !! it is set to the _0 values. |
---|
| 324 | !!---------------------------------------------------------------------- |
---|
| 325 | INTEGER, INTENT(in) :: kt ! ocean time-step |
---|
| 326 | INTEGER, INTENT(in) :: Kbb, Kmm ! ocean time level indices |
---|
| 327 | ! |
---|
| 328 | INTEGER :: ji, jj, jk |
---|
| 329 | INTEGER :: id1, id2 ! local integers |
---|
| 330 | !!---------------------------------------------------------------------- |
---|
| 331 | ! |
---|
| 332 | IF( ln_rstart ) THEN !* Read the restart file |
---|
| 333 | CALL rst_read_open ! open the restart file if necessary |
---|
| 334 | ! |
---|
| 335 | id1 = iom_varid( numror, 'sshb', ldstop = .FALSE. ) |
---|
| 336 | id2 = iom_varid( numror, 'sshn', ldstop = .FALSE. ) |
---|
| 337 | ! |
---|
| 338 | ! ! --------- ! |
---|
| 339 | ! ! all cases ! |
---|
| 340 | ! ! --------- ! |
---|
| 341 | ! |
---|
| 342 | IF( MIN( id1, id2 ) > 0 ) THEN ! all required arrays exist |
---|
| 343 | CALL iom_get( numror, jpdom_auto, 'sshb' , ssh(:,:,Kbb), ldxios = lrxios ) |
---|
| 344 | CALL iom_get( numror, jpdom_auto, 'sshn' , ssh(:,:,Kmm), ldxios = lrxios ) |
---|
| 345 | CALL iom_get( numror, jpdom_auto, 'r3tb' , r3t(:,:,Kbb), ldxios = lrxios ) |
---|
| 346 | CALL iom_get( numror, jpdom_auto, 'r3tn' , r3t(:,:,Kmm), ldxios = lrxios ) |
---|
| 347 | CALL iom_get( numror, jpdom_auto, 'r3ub' , r3u(:,:,Kbb), ldxios = lrxios, cd_type = 'U' ) |
---|
| 348 | CALL iom_get( numror, jpdom_auto, 'r3un' , r3u(:,:,Kmm), ldxios = lrxios, cd_type = 'U' ) |
---|
| 349 | CALL iom_get( numror, jpdom_auto, 'r3vb' , r3v(:,:,Kbb), ldxios = lrxios, cd_type = 'V' ) |
---|
| 350 | CALL iom_get( numror, jpdom_auto, 'r3vn' , r3v(:,:,Kmm), ldxios = lrxios, cd_type = 'V' ) |
---|
| 351 | CALL iom_get( numror, jpdom_auto, 'r3f' , r3f(:,:) , ldxios = lrxios, cd_type = 'F' ) |
---|
| 352 | |
---|
| 353 | ! needed to restart if land processor not computed |
---|
| 354 | IF(lwp) write(numout,*) 'qco_rst_read : ssh(:,:,Kbb) and ssh(:,:,Kmm) found in restart files' |
---|
| 355 | !!WHERE ( ssmask(:,:) == 0.0_wp ) !!gm/st ==> sm should not be necessary on ssh while it was required on e3 |
---|
| 356 | !! ssh(:,:,Kmm) = 0._wp |
---|
| 357 | !! ssh(:,:,Kbb) = 0._wp |
---|
| 358 | !!END WHERE |
---|
| 359 | IF( l_1st_euler ) THEN |
---|
[12680] | 360 | ssh(:,:,Kbb) = ssh(:,:,Kmm) |
---|
[12482] | 361 | ENDIF |
---|
[13427] | 362 | ELSE IF( id1 > 0 ) THEN |
---|
| 363 | IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart files' |
---|
| 364 | IF(lwp) write(numout,*) 'sshn set equal to sshb.' |
---|
| 365 | IF(lwp) write(numout,*) 'neuler is forced to 0' |
---|
| 366 | CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb), ldxios = lrxios ) |
---|
| 367 | ssh(:,:,Kmm) = ssh(:,:,Kbb) |
---|
| 368 | l_1st_euler = .TRUE. |
---|
| 369 | ELSE IF( id2 > 0 ) THEN |
---|
| 370 | IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kbb) not found in restart files' |
---|
| 371 | IF(lwp) write(numout,*) 'sshb set equal to sshn.' |
---|
| 372 | IF(lwp) write(numout,*) 'neuler is forced to 0' |
---|
| 373 | CALL iom_get( numror, jpdom_auto, 'sshn', ssh(:,:,Kmm), ldxios = lrxios ) |
---|
| 374 | ssh(:,:,Kbb) = ssh(:,:,Kmm) |
---|
| 375 | l_1st_euler = .TRUE. |
---|
| 376 | ELSE |
---|
| 377 | IF(lwp) write(numout,*) 'qco_rst_read WARNING : ssh(:,:,Kmm) not found in restart file' |
---|
| 378 | IF(lwp) write(numout,*) 'ssh_b and ssh_n set to zero' |
---|
| 379 | IF(lwp) write(numout,*) 'neuler is forced to 0' |
---|
| 380 | ssh(:,:,:) = 0._wp |
---|
| 381 | l_1st_euler = .TRUE. |
---|
| 382 | ENDIF |
---|
| 383 | ! |
---|
| 384 | ELSE !* Initialize at "rest" |
---|
| 385 | ! |
---|
| 386 | IF( ll_wd ) THEN ! MJB ll_wd edits start here - these are essential |
---|
[12482] | 387 | ! |
---|
[13427] | 388 | IF( cn_cfg == 'wad' ) THEN ! Wetting and drying test case |
---|
| 389 | CALL usr_def_istate( gdept(:,:,:,Kbb), tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb) ) |
---|
| 390 | ts (:,:,:,:,Kmm) = ts (:,:,:,:,Kbb) ! set now values from to before ones |
---|
| 391 | ssh(:,: ,Kmm) = ssh(:,: ,Kbb) |
---|
| 392 | uu (:,:,: ,Kmm) = uu (:,:,: ,Kbb) |
---|
| 393 | vv (:,:,: ,Kmm) = vv (:,:,: ,Kbb) |
---|
| 394 | ELSE ! if not test case |
---|
| 395 | ssh(:,:,Kmm) = -ssh_ref |
---|
| 396 | ssh(:,:,Kbb) = -ssh_ref |
---|
| 397 | ! |
---|
| 398 | DO_2D( 1, 1, 1, 1 ) |
---|
| 399 | IF( ht_0(ji,jj)-ssh_ref < rn_wdmin1 ) THEN ! if total depth is less than min depth |
---|
| 400 | ssh(ji,jj,Kbb) = rn_wdmin1 - (ht_0(ji,jj) ) |
---|
| 401 | ssh(ji,jj,Kmm) = rn_wdmin1 - (ht_0(ji,jj) ) |
---|
| 402 | ENDIF |
---|
| 403 | END_2D |
---|
| 404 | ENDIF |
---|
[12482] | 405 | ! |
---|
[13427] | 406 | DO ji = 1, jpi |
---|
| 407 | DO jj = 1, jpj |
---|
| 408 | IF ( ht_0(ji,jj) .LE. 0.0 .AND. NINT( ssmask(ji,jj) ) .EQ. 1) THEN |
---|
| 409 | CALL ctl_stop( 'qco_rst_read: ht_0 must be positive at potentially wet points' ) |
---|
| 410 | ENDIF |
---|
[12482] | 411 | END DO |
---|
[13427] | 412 | END DO |
---|
[12482] | 413 | ! |
---|
[13427] | 414 | ELSE |
---|
| 415 | ! |
---|
| 416 | ! Just to read set ssh in fact, called latter once vertical grid |
---|
| 417 | ! is set up: |
---|
| 418 | ! CALL usr_def_istate( gdept_0, tmask, ts(:,:,:,:,Kbb), uu(:,:,:,Kbb), vv(:,:,:,Kbb), ssh(:,:,Kbb) ) |
---|
| 419 | ! ! |
---|
| 420 | ssh(:,:,:) = 0._wp |
---|
| 421 | r3t(:,:,:) = 0._wp |
---|
| 422 | r3u(:,:,:) = 0._wp |
---|
| 423 | r3v(:,:,:) = 0._wp |
---|
| 424 | r3f(:,: ) = 0._wp |
---|
| 425 | ! |
---|
| 426 | ENDIF ! end of ll_wd edits |
---|
| 427 | ! |
---|
| 428 | ENDIF |
---|
[12482] | 429 | ! |
---|
[13427] | 430 | END SUBROUTINE qco_rst_read2 |
---|
[12482] | 431 | |
---|
| 432 | |
---|
[13427] | 433 | SUBROUTINE qco_ctl |
---|
[12482] | 434 | !!--------------------------------------------------------------------- |
---|
[13427] | 435 | !! *** ROUTINE qco_ctl *** |
---|
[12482] | 436 | !! |
---|
| 437 | !! ** Purpose : Control the consistency between namelist options |
---|
| 438 | !! for vertical coordinate |
---|
| 439 | !!---------------------------------------------------------------------- |
---|
| 440 | INTEGER :: ioptio, ios |
---|
| 441 | !! |
---|
| 442 | NAMELIST/nam_vvl/ ln_vvl_zstar, ln_vvl_ztilde, ln_vvl_layer, ln_vvl_ztilde_as_zstar, & |
---|
| 443 | & ln_vvl_zstar_at_eqtor , rn_ahe3 , rn_rst_e3t , & |
---|
| 444 | & rn_lf_cutoff , rn_zdef_max , ln_vvl_dbg ! not yet implemented: ln_vvl_kepe |
---|
| 445 | !!---------------------------------------------------------------------- |
---|
| 446 | ! |
---|
| 447 | READ ( numnam_ref, nam_vvl, IOSTAT = ios, ERR = 901) |
---|
| 448 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nam_vvl in reference namelist' ) |
---|
| 449 | READ ( numnam_cfg, nam_vvl, IOSTAT = ios, ERR = 902 ) |
---|
| 450 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nam_vvl in configuration namelist' ) |
---|
| 451 | IF(lwm) WRITE ( numond, nam_vvl ) |
---|
| 452 | ! |
---|
| 453 | IF(lwp) THEN ! Namelist print |
---|
| 454 | WRITE(numout,*) |
---|
[13427] | 455 | WRITE(numout,*) 'qco_ctl : choice/control of the variable vertical coordinate' |
---|
| 456 | WRITE(numout,*) '~~~~~~~~' |
---|
[12482] | 457 | WRITE(numout,*) ' Namelist nam_vvl : chose a vertical coordinate' |
---|
| 458 | WRITE(numout,*) ' zstar ln_vvl_zstar = ', ln_vvl_zstar |
---|
| 459 | WRITE(numout,*) ' ztilde ln_vvl_ztilde = ', ln_vvl_ztilde |
---|
| 460 | WRITE(numout,*) ' layer ln_vvl_layer = ', ln_vvl_layer |
---|
| 461 | WRITE(numout,*) ' ztilde as zstar ln_vvl_ztilde_as_zstar = ', ln_vvl_ztilde_as_zstar |
---|
| 462 | WRITE(numout,*) ' ztilde near the equator ln_vvl_zstar_at_eqtor = ', ln_vvl_zstar_at_eqtor |
---|
| 463 | WRITE(numout,*) ' !' |
---|
| 464 | WRITE(numout,*) ' thickness diffusion coefficient rn_ahe3 = ', rn_ahe3 |
---|
| 465 | WRITE(numout,*) ' maximum e3t deformation fractional change rn_zdef_max = ', rn_zdef_max |
---|
| 466 | IF( ln_vvl_ztilde_as_zstar ) THEN |
---|
| 467 | WRITE(numout,*) ' ztilde running in zstar emulation mode (ln_vvl_ztilde_as_zstar=T) ' |
---|
| 468 | WRITE(numout,*) ' ignoring namelist timescale parameters and using:' |
---|
| 469 | WRITE(numout,*) ' hard-wired : z-tilde to zstar restoration timescale (days)' |
---|
| 470 | WRITE(numout,*) ' rn_rst_e3t = 0.e0' |
---|
| 471 | WRITE(numout,*) ' hard-wired : z-tilde cutoff frequency of low-pass filter (days)' |
---|
[12724] | 472 | WRITE(numout,*) ' rn_lf_cutoff = 1.0/rn_Dt' |
---|
[12482] | 473 | ELSE |
---|
| 474 | WRITE(numout,*) ' z-tilde to zstar restoration timescale (days) rn_rst_e3t = ', rn_rst_e3t |
---|
| 475 | WRITE(numout,*) ' z-tilde cutoff frequency of low-pass filter (days) rn_lf_cutoff = ', rn_lf_cutoff |
---|
| 476 | ENDIF |
---|
| 477 | WRITE(numout,*) ' debug prints flag ln_vvl_dbg = ', ln_vvl_dbg |
---|
| 478 | ENDIF |
---|
| 479 | ! |
---|
| 480 | ioptio = 0 ! Parameter control |
---|
| 481 | IF( ln_vvl_ztilde_as_zstar ) ln_vvl_ztilde = .true. |
---|
| 482 | IF( ln_vvl_zstar ) ioptio = ioptio + 1 |
---|
| 483 | IF( ln_vvl_ztilde ) ioptio = ioptio + 1 |
---|
| 484 | IF( ln_vvl_layer ) ioptio = ioptio + 1 |
---|
| 485 | ! |
---|
| 486 | IF( ioptio /= 1 ) CALL ctl_stop( 'Choose ONE vertical coordinate in namelist nam_vvl' ) |
---|
| 487 | ! |
---|
| 488 | IF(lwp) THEN ! Print the choice |
---|
| 489 | WRITE(numout,*) |
---|
| 490 | IF( ln_vvl_zstar ) WRITE(numout,*) ' ==>>> zstar vertical coordinate is used' |
---|
| 491 | IF( ln_vvl_ztilde ) WRITE(numout,*) ' ==>>> ztilde vertical coordinate is used' |
---|
| 492 | IF( ln_vvl_layer ) WRITE(numout,*) ' ==>>> layer vertical coordinate is used' |
---|
| 493 | IF( ln_vvl_ztilde_as_zstar ) WRITE(numout,*) ' ==>>> to emulate a zstar coordinate' |
---|
| 494 | ENDIF |
---|
| 495 | ! |
---|
| 496 | #if defined key_agrif |
---|
| 497 | IF( (.NOT.Agrif_Root()).AND.(.NOT.ln_vvl_zstar) ) CALL ctl_stop( 'AGRIF is implemented with zstar coordinate only' ) |
---|
| 498 | #endif |
---|
| 499 | ! |
---|
[13427] | 500 | END SUBROUTINE qco_ctl |
---|
[12482] | 501 | |
---|
| 502 | !!====================================================================== |
---|
[12732] | 503 | END MODULE domqco |
---|