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