[1565] | 1 | MODULE sshwzv |
---|
[3] | 2 | !!============================================================================== |
---|
[1438] | 3 | !! *** MODULE sshwzv *** |
---|
| 4 | !! Ocean dynamics : sea surface height and vertical velocity |
---|
[3] | 5 | !!============================================================================== |
---|
[1438] | 6 | !! History : 3.1 ! 2009-02 (G. Madec, M. Leclair) Original code |
---|
[2528] | 7 | !! 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 |
---|
[4292] | 10 | !! 3.3 ! 2011-10 (M. Leclair) split former ssh_wzv routine and remove all vvl related work |
---|
[3] | 11 | !!---------------------------------------------------------------------- |
---|
[1438] | 12 | |
---|
[3] | 13 | !!---------------------------------------------------------------------- |
---|
[6140] | 14 | !! ssh_nxt : after ssh |
---|
| 15 | !! ssh_swp : filter ans swap the ssh arrays |
---|
| 16 | !! wzv : compute now vertical velocity |
---|
[1438] | 17 | !!---------------------------------------------------------------------- |
---|
[6140] | 18 | USE oce ! ocean dynamics and tracers variables |
---|
| 19 | USE dom_oce ! ocean space and time domain variables |
---|
| 20 | USE sbc_oce ! surface boundary condition: ocean |
---|
| 21 | USE domvvl ! Variable volume |
---|
| 22 | USE divhor ! horizontal divergence |
---|
| 23 | USE phycst ! physical constants |
---|
| 24 | USE bdy_oce ! |
---|
| 25 | USE bdy_par ! |
---|
| 26 | USE bdydyn2d ! bdy_ssh routine |
---|
[2528] | 27 | #if defined key_agrif |
---|
[2486] | 28 | USE agrif_opa_interp |
---|
[2528] | 29 | #endif |
---|
| 30 | #if defined key_asminc |
---|
[6140] | 31 | USE asminc ! Assimilation increment |
---|
[2528] | 32 | #endif |
---|
[6140] | 33 | ! |
---|
| 34 | USE in_out_manager ! I/O manager |
---|
| 35 | USE restart ! only for lrst_oce |
---|
| 36 | USE prtctl ! Print control |
---|
| 37 | USE lbclnk ! ocean lateral boundary condition (or mpp link) |
---|
| 38 | USE lib_mpp ! MPP library |
---|
| 39 | USE wrk_nemo ! Memory Allocation |
---|
| 40 | USE timing ! Timing |
---|
[6152] | 41 | USE wet_dry ! Wetting/Drying flux limting |
---|
[592] | 42 | |
---|
[3] | 43 | IMPLICIT NONE |
---|
| 44 | PRIVATE |
---|
| 45 | |
---|
[1438] | 46 | PUBLIC ssh_nxt ! called by step.F90 |
---|
[4292] | 47 | PUBLIC wzv ! called by step.F90 |
---|
| 48 | PUBLIC ssh_swp ! called by step.F90 |
---|
[3] | 49 | |
---|
| 50 | !! * Substitutions |
---|
[1438] | 51 | # include "vectopt_loop_substitute.h90" |
---|
[3] | 52 | !!---------------------------------------------------------------------- |
---|
[2528] | 53 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
[888] | 54 | !! $Id$ |
---|
[2715] | 55 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[592] | 56 | !!---------------------------------------------------------------------- |
---|
[3] | 57 | CONTAINS |
---|
| 58 | |
---|
[4292] | 59 | SUBROUTINE ssh_nxt( kt ) |
---|
[3] | 60 | !!---------------------------------------------------------------------- |
---|
[4292] | 61 | !! *** ROUTINE ssh_nxt *** |
---|
[1438] | 62 | !! |
---|
[4292] | 63 | !! ** Purpose : compute the after ssh (ssha) |
---|
[3] | 64 | !! |
---|
[4292] | 65 | !! ** Method : - Using the incompressibility hypothesis, the ssh increment |
---|
| 66 | !! is computed by integrating the horizontal divergence and multiply by |
---|
| 67 | !! by the time step. |
---|
[3] | 68 | !! |
---|
[5836] | 69 | !! ** action : ssha, after sea surface height |
---|
[2528] | 70 | !! |
---|
| 71 | !! Reference : Leclair, M., and G. Madec, 2009, Ocean Modelling. |
---|
[3] | 72 | !!---------------------------------------------------------------------- |
---|
[5836] | 73 | INTEGER, INTENT(in) :: kt ! time step |
---|
[4292] | 74 | ! |
---|
[5836] | 75 | INTEGER :: jk ! dummy loop indice |
---|
| 76 | REAL(wp) :: z2dt, zcoef ! local scalars |
---|
| 77 | REAL(wp), POINTER, DIMENSION(:,: ) :: zhdiv ! 2D workspace |
---|
[3] | 78 | !!---------------------------------------------------------------------- |
---|
[3294] | 79 | ! |
---|
[5836] | 80 | IF( nn_timing == 1 ) CALL timing_start('ssh_nxt') |
---|
[3294] | 81 | ! |
---|
[5836] | 82 | CALL wrk_alloc( jpi,jpj, zhdiv ) |
---|
[3294] | 83 | ! |
---|
[3] | 84 | IF( kt == nit000 ) THEN |
---|
| 85 | IF(lwp) WRITE(numout,*) |
---|
[4292] | 86 | IF(lwp) WRITE(numout,*) 'ssh_nxt : after sea surface height' |
---|
[1438] | 87 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
[3] | 88 | ENDIF |
---|
[2528] | 89 | ! |
---|
[5836] | 90 | CALL div_hor( kt ) ! Horizontal divergence |
---|
[2528] | 91 | ! |
---|
[2715] | 92 | z2dt = 2._wp * rdt ! set time step size (Euler/Leapfrog) |
---|
| 93 | IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt |
---|
[3] | 94 | |
---|
[1438] | 95 | ! !------------------------------! |
---|
| 96 | ! ! After Sea Surface Height ! |
---|
| 97 | ! !------------------------------! |
---|
[2715] | 98 | zhdiv(:,:) = 0._wp |
---|
[1438] | 99 | DO jk = 1, jpkm1 ! Horizontal divergence of barotropic transports |
---|
[6140] | 100 | zhdiv(:,:) = zhdiv(:,:) + e3t_n(:,:,jk) * hdivn(:,:,jk) |
---|
[1438] | 101 | END DO |
---|
| 102 | ! ! Sea surface elevation time stepping |
---|
[4338] | 103 | ! In time-split case we need a first guess of the ssh after (using the baroclinic timestep) in order to |
---|
| 104 | ! compute the vertical velocity which can be used to compute the non-linear terms of the momentum equations. |
---|
| 105 | ! |
---|
[5836] | 106 | zcoef = 0.5_wp * r1_rau0 |
---|
[6152] | 107 | |
---|
| 108 | IF(ln_wd) CALL wad_lmt(sshb, zcoef * (emp_b(:,:) + emp(:,:)), z2dt) |
---|
| 109 | |
---|
[5836] | 110 | ssha(:,:) = ( sshb(:,:) - z2dt * ( zcoef * ( emp_b(:,:) + emp(:,:) ) + zhdiv(:,:) ) ) * ssmask(:,:) |
---|
[1438] | 111 | |
---|
[5930] | 112 | IF ( .NOT.ln_dynspg_ts ) THEN |
---|
| 113 | ! These lines are not necessary with time splitting since |
---|
| 114 | ! boundary condition on sea level is set during ts loop |
---|
[5836] | 115 | # if defined key_agrif |
---|
[5930] | 116 | CALL agrif_ssh( kt ) |
---|
[5836] | 117 | # endif |
---|
| 118 | # if defined key_bdy |
---|
[5930] | 119 | IF( lk_bdy ) THEN |
---|
| 120 | CALL lbc_lnk( ssha, 'T', 1. ) ! Not sure that's necessary |
---|
| 121 | CALL bdy_ssh( ssha ) ! Duplicate sea level across open boundaries |
---|
| 122 | ENDIF |
---|
| 123 | # endif |
---|
[4292] | 124 | ENDIF |
---|
[4486] | 125 | |
---|
[3764] | 126 | #if defined key_asminc |
---|
[5836] | 127 | IF( lk_asminc .AND. ln_sshinc .AND. ln_asmiau ) THEN ! Include the IAU weighted SSH increment |
---|
[3764] | 128 | CALL ssh_asm_inc( kt ) |
---|
| 129 | ssha(:,:) = ssha(:,:) + z2dt * ssh_iau(:,:) |
---|
| 130 | ENDIF |
---|
| 131 | #endif |
---|
[4292] | 132 | ! !------------------------------! |
---|
| 133 | ! ! outputs ! |
---|
| 134 | ! !------------------------------! |
---|
| 135 | ! |
---|
| 136 | IF(ln_ctl) CALL prt_ctl( tab2d_1=ssha, clinfo1=' ssha - : ', mask1=tmask, ovlap=1 ) |
---|
| 137 | ! |
---|
| 138 | CALL wrk_dealloc( jpi, jpj, zhdiv ) |
---|
| 139 | ! |
---|
| 140 | IF( nn_timing == 1 ) CALL timing_stop('ssh_nxt') |
---|
| 141 | ! |
---|
| 142 | END SUBROUTINE ssh_nxt |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | SUBROUTINE wzv( kt ) |
---|
| 146 | !!---------------------------------------------------------------------- |
---|
| 147 | !! *** ROUTINE wzv *** |
---|
| 148 | !! |
---|
| 149 | !! ** Purpose : compute the now vertical velocity |
---|
| 150 | !! |
---|
| 151 | !! ** Method : - Using the incompressibility hypothesis, the vertical |
---|
| 152 | !! velocity is computed by integrating the horizontal divergence |
---|
| 153 | !! from the bottom to the surface minus the scale factor evolution. |
---|
| 154 | !! The boundary conditions are w=0 at the bottom (no flux) and. |
---|
| 155 | !! |
---|
| 156 | !! ** action : wn : now vertical velocity |
---|
| 157 | !! |
---|
| 158 | !! Reference : Leclair, M., and G. Madec, 2009, Ocean Modelling. |
---|
| 159 | !!---------------------------------------------------------------------- |
---|
[5836] | 160 | INTEGER, INTENT(in) :: kt ! time step |
---|
[4292] | 161 | ! |
---|
[5836] | 162 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
| 163 | REAL(wp) :: z1_2dt ! local scalars |
---|
[4292] | 164 | REAL(wp), POINTER, DIMENSION(:,: ) :: z2d |
---|
| 165 | REAL(wp), POINTER, DIMENSION(:,:,:) :: z3d, zhdiv |
---|
| 166 | !!---------------------------------------------------------------------- |
---|
| 167 | ! |
---|
[5836] | 168 | IF( nn_timing == 1 ) CALL timing_start('wzv') |
---|
| 169 | ! |
---|
[4292] | 170 | IF( kt == nit000 ) THEN |
---|
| 171 | IF(lwp) WRITE(numout,*) |
---|
| 172 | IF(lwp) WRITE(numout,*) 'wzv : now vertical velocity ' |
---|
| 173 | IF(lwp) WRITE(numout,*) '~~~~~ ' |
---|
| 174 | ! |
---|
| 175 | wn(:,:,jpk) = 0._wp ! bottom boundary condition: w=0 (set once for all) |
---|
| 176 | ENDIF |
---|
| 177 | ! !------------------------------! |
---|
| 178 | ! ! Now Vertical Velocity ! |
---|
| 179 | ! !------------------------------! |
---|
| 180 | z1_2dt = 1. / ( 2. * rdt ) ! set time step size (Euler/Leapfrog) |
---|
| 181 | IF( neuler == 0 .AND. kt == nit000 ) z1_2dt = 1. / rdt |
---|
| 182 | ! |
---|
| 183 | IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN ! z_tilde and layer cases |
---|
| 184 | CALL wrk_alloc( jpi, jpj, jpk, zhdiv ) |
---|
| 185 | ! |
---|
| 186 | DO jk = 1, jpkm1 |
---|
| 187 | ! horizontal divergence of thickness diffusion transport ( velocity multiplied by e3t) |
---|
[4338] | 188 | ! - ML - note: computation already done in dom_vvl_sf_nxt. Could be optimized (not critical and clearer this way) |
---|
[4292] | 189 | DO jj = 2, jpjm1 |
---|
| 190 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[5836] | 191 | zhdiv(ji,jj,jk) = r1_e1e2t(ji,jj) * ( un_td(ji,jj,jk) - un_td(ji-1,jj,jk) + vn_td(ji,jj,jk) - vn_td(ji,jj-1,jk) ) |
---|
[4292] | 192 | END DO |
---|
[592] | 193 | END DO |
---|
| 194 | END DO |
---|
[4292] | 195 | CALL lbc_lnk(zhdiv, 'T', 1.) ! - ML - Perhaps not necessary: not used for horizontal "connexions" |
---|
| 196 | ! ! Is it problematic to have a wrong vertical velocity in boundary cells? |
---|
| 197 | ! ! Same question holds for hdivn. Perhaps just for security |
---|
| 198 | DO jk = jpkm1, 1, -1 ! integrate from the bottom the hor. divergence |
---|
| 199 | ! computation of w |
---|
[6140] | 200 | wn(:,:,jk) = wn(:,:,jk+1) - ( e3t_n(:,:,jk) * hdivn(:,:,jk) + zhdiv(:,:,jk) & |
---|
| 201 | & + z1_2dt * ( e3t_a(:,:,jk) - e3t_b(:,:,jk) ) ) * tmask(:,:,jk) |
---|
[4292] | 202 | END DO |
---|
| 203 | ! IF( ln_vvl_layer ) wn(:,:,:) = 0.e0 |
---|
| 204 | CALL wrk_dealloc( jpi, jpj, jpk, zhdiv ) |
---|
| 205 | ELSE ! z_star and linear free surface cases |
---|
| 206 | DO jk = jpkm1, 1, -1 ! integrate from the bottom the hor. divergence |
---|
| 207 | ! computation of w |
---|
[6140] | 208 | wn(:,:,jk) = wn(:,:,jk+1) - ( e3t_n(:,:,jk) * hdivn(:,:,jk) & |
---|
| 209 | & + z1_2dt * ( e3t_a(:,:,jk) - e3t_b(:,:,jk) ) ) * tmask(:,:,jk) |
---|
[4292] | 210 | END DO |
---|
[1438] | 211 | ENDIF |
---|
[592] | 212 | |
---|
[2528] | 213 | #if defined key_bdy |
---|
[5836] | 214 | IF( lk_bdy ) THEN |
---|
[4327] | 215 | DO jk = 1, jpkm1 |
---|
| 216 | wn(:,:,jk) = wn(:,:,jk) * bdytmask(:,:) |
---|
| 217 | END DO |
---|
| 218 | ENDIF |
---|
[2528] | 219 | #endif |
---|
[4292] | 220 | ! |
---|
| 221 | IF( nn_timing == 1 ) CALL timing_stop('wzv') |
---|
[5836] | 222 | ! |
---|
| 223 | END SUBROUTINE wzv |
---|
[592] | 224 | |
---|
| 225 | |
---|
[4292] | 226 | SUBROUTINE ssh_swp( kt ) |
---|
[1438] | 227 | !!---------------------------------------------------------------------- |
---|
| 228 | !! *** ROUTINE ssh_nxt *** |
---|
| 229 | !! |
---|
| 230 | !! ** Purpose : achieve the sea surface height time stepping by |
---|
| 231 | !! applying Asselin time filter and swapping the arrays |
---|
[4292] | 232 | !! ssha already computed in ssh_nxt |
---|
[1438] | 233 | !! |
---|
[2528] | 234 | !! ** Method : - apply Asselin time fiter to now ssh (excluding the forcing |
---|
| 235 | !! from the filter, see Leclair and Madec 2010) and swap : |
---|
| 236 | !! sshn = ssha + atfp * ( sshb -2 sshn + ssha ) |
---|
| 237 | !! - atfp * rdt * ( emp_b - emp ) / rau0 |
---|
| 238 | !! sshn = ssha |
---|
[1438] | 239 | !! |
---|
| 240 | !! ** action : - sshb, sshn : before & now sea surface height |
---|
| 241 | !! ready for the next time step |
---|
[2528] | 242 | !! |
---|
| 243 | !! Reference : Leclair, M., and G. Madec, 2009, Ocean Modelling. |
---|
[1438] | 244 | !!---------------------------------------------------------------------- |
---|
[2528] | 245 | INTEGER, INTENT(in) :: kt ! ocean time-step index |
---|
[6140] | 246 | ! |
---|
| 247 | REAL(wp) :: zcoef ! local scalar |
---|
[1438] | 248 | !!---------------------------------------------------------------------- |
---|
[3294] | 249 | ! |
---|
[4292] | 250 | IF( nn_timing == 1 ) CALL timing_start('ssh_swp') |
---|
[3294] | 251 | ! |
---|
[1438] | 252 | IF( kt == nit000 ) THEN |
---|
| 253 | IF(lwp) WRITE(numout,*) |
---|
[4292] | 254 | IF(lwp) WRITE(numout,*) 'ssh_swp : Asselin time filter and swap of sea surface height' |
---|
[1438] | 255 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
| 256 | ENDIF |
---|
[6140] | 257 | ! !== Euler time-stepping: no filter, just swap ==! |
---|
| 258 | IF( ( neuler == 0 .AND. kt == nit000 ) .OR. & |
---|
| 259 | & ( ln_bt_fw .AND. ln_dynspg_ts ) ) THEN |
---|
| 260 | sshb(:,:) = sshn(:,:) ! before <-- now |
---|
| 261 | sshn(:,:) = ssha(:,:) ! now <-- after (before already = now) |
---|
[5836] | 262 | ! |
---|
[6140] | 263 | ELSE !== Leap-Frog time-stepping: Asselin filter + swap ==! |
---|
| 264 | ! ! before <-- now filtered |
---|
| 265 | sshb(:,:) = sshn(:,:) + atfp * ( sshb(:,:) - 2 * sshn(:,:) + ssha(:,:) ) |
---|
| 266 | IF( .NOT.ln_linssh ) THEN ! before <-- with forcing removed |
---|
| 267 | zcoef = atfp * rdt * r1_rau0 |
---|
| 268 | sshb(:,:) = sshb(:,:) - zcoef * ( emp_b(:,:) - emp (:,:) & |
---|
| 269 | & - rnf_b(:,:) + rnf (:,:) & |
---|
| 270 | & + fwfisf_b(:,:) - fwfisf(:,:) ) * ssmask(:,:) |
---|
| 271 | ENDIF |
---|
| 272 | sshn(:,:) = ssha(:,:) ! now <-- after |
---|
[1438] | 273 | ENDIF |
---|
| 274 | ! |
---|
[2528] | 275 | IF(ln_ctl) CALL prt_ctl( tab2d_1=sshb, clinfo1=' sshb - : ', mask1=tmask, ovlap=1 ) |
---|
| 276 | ! |
---|
[6140] | 277 | IF( nn_timing == 1 ) CALL timing_stop('ssh_swp') |
---|
[3294] | 278 | ! |
---|
[4292] | 279 | END SUBROUTINE ssh_swp |
---|
[3] | 280 | |
---|
| 281 | !!====================================================================== |
---|
[1565] | 282 | END MODULE sshwzv |
---|