[358] | 1 | MODULE dynspg_flt |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE dynspg_flt *** |
---|
| 4 | !! Ocean dynamics: surface pressure gradient trend |
---|
| 5 | !!====================================================================== |
---|
[1438] | 6 | !! History OPA ! 1998-05 (G. Roullet) free surface |
---|
| 7 | !! ! 1998-10 (G. Madec, M. Imbard) release 8.2 |
---|
| 8 | !! NEMO O.1 ! 2002-08 (G. Madec) F90: Free form and module |
---|
| 9 | !! - ! 2002-11 (C. Talandier, A-M Treguier) Open boundaries |
---|
| 10 | !! 1.0 ! 2004-08 (C. Talandier) New trends organization |
---|
| 11 | !! - ! 2005-11 (V. Garnier) Surface pressure gradient organization |
---|
| 12 | !! 2.0 ! 2006-07 (S. Masson) distributed restart using iom |
---|
| 13 | !! - ! 2006-08 (J.Chanut, A.Sellar) Calls to BDY routines. |
---|
| 14 | !! 3.2 ! 2009-03 (G. Madec, M. Leclair, R. Benshila) introduce sshwzv module |
---|
[358] | 15 | !!---------------------------------------------------------------------- |
---|
[575] | 16 | #if defined key_dynspg_flt || defined key_esopa |
---|
[508] | 17 | !!---------------------------------------------------------------------- |
---|
[358] | 18 | !! 'key_dynspg_flt' filtered free surface |
---|
| 19 | !!---------------------------------------------------------------------- |
---|
[1601] | 20 | !! dyn_spg_flt : update the momentum trend with the surface pressure gradient in the filtered free surface case |
---|
[508] | 21 | !! flt_rst : read/write the time-splitting restart fields in the ocean restart file |
---|
[358] | 22 | !!---------------------------------------------------------------------- |
---|
| 23 | USE oce ! ocean dynamics and tracers |
---|
| 24 | USE dom_oce ! ocean space and time domain |
---|
| 25 | USE zdf_oce ! ocean vertical physics |
---|
[888] | 26 | USE sbc_oce ! surface boundary condition: ocean |
---|
| 27 | USE obc_oce ! Lateral open boundary condition |
---|
| 28 | USE sol_oce ! ocean elliptic solver |
---|
[719] | 29 | USE phycst ! physical constants |
---|
[888] | 30 | USE domvvl ! variable volume |
---|
[1683] | 31 | USE dynadv ! advection |
---|
[1601] | 32 | USE solmat ! matrix construction for elliptic solvers |
---|
[508] | 33 | USE solver ! solver initialization |
---|
[358] | 34 | USE solpcg ! preconditionned conjugate gradient solver |
---|
| 35 | USE solsor ! Successive Over-relaxation solver |
---|
| 36 | USE obcdyn ! ocean open boundary condition (obc_dyn routines) |
---|
| 37 | USE obcvol ! ocean open boundary condition (obc_vol routines) |
---|
[911] | 38 | USE bdy_oce ! Unstructured open boundaries condition |
---|
| 39 | USE bdydyn ! Unstructured open boundaries condition (bdy_dyn routine) |
---|
| 40 | USE bdyvol ! Unstructured open boundaries condition (bdy_vol routine) |
---|
[888] | 41 | USE cla_dynspg ! cross land advection |
---|
| 42 | USE in_out_manager ! I/O manager |
---|
[358] | 43 | USE lib_mpp ! distributed memory computing library |
---|
| 44 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
| 45 | USE prtctl ! Print control |
---|
[389] | 46 | USE agrif_opa_interp |
---|
[508] | 47 | USE iom |
---|
| 48 | USE restart ! only for lrst_oce |
---|
[358] | 49 | |
---|
| 50 | IMPLICIT NONE |
---|
| 51 | PRIVATE |
---|
| 52 | |
---|
[1438] | 53 | PUBLIC dyn_spg_flt ! routine called by step.F90 |
---|
| 54 | PUBLIC flt_rst ! routine called by istate.F90 |
---|
[358] | 55 | |
---|
| 56 | !! * Substitutions |
---|
| 57 | # include "domzgr_substitute.h90" |
---|
| 58 | # include "vectopt_loop_substitute.h90" |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
[1438] | 60 | !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009) |
---|
[888] | 61 | !! $Id$ |
---|
[508] | 62 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
[358] | 63 | !!---------------------------------------------------------------------- |
---|
| 64 | |
---|
| 65 | CONTAINS |
---|
| 66 | |
---|
| 67 | SUBROUTINE dyn_spg_flt( kt, kindic ) |
---|
| 68 | !!---------------------------------------------------------------------- |
---|
| 69 | !! *** routine dyn_spg_flt *** |
---|
| 70 | !! |
---|
| 71 | !! ** Purpose : Compute the now trend due to the surface pressure |
---|
| 72 | !! gradient in case of filtered free surface formulation and add |
---|
| 73 | !! it to the general trend of momentum equation. |
---|
| 74 | !! |
---|
| 75 | !! ** Method : Filtered free surface formulation. The surface |
---|
| 76 | !! pressure gradient is given by: |
---|
[1601] | 77 | !! spgu = 1/rau0 d/dx(ps) = 1/e1u di( sshn + btda ) |
---|
| 78 | !! spgv = 1/rau0 d/dy(ps) = 1/e2v dj( sshn + btda ) |
---|
[358] | 79 | !! where sshn is the free surface elevation and btda is the after |
---|
[1438] | 80 | !! time derivative of the free surface elevation |
---|
| 81 | !! -1- evaluate the surface presure trend (including the addi- |
---|
[358] | 82 | !! tional force) in three steps: |
---|
| 83 | !! a- compute the right hand side of the elliptic equation: |
---|
| 84 | !! gcb = 1/(e1t e2t) [ di(e2u spgu) + dj(e1v spgv) ] |
---|
| 85 | !! where (spgu,spgv) are given by: |
---|
| 86 | !! spgu = vertical sum[ e3u (ub+ 2 rdt ua ) ] |
---|
| 87 | !! - grav 2 rdt hu /e1u di[sshn + emp] |
---|
| 88 | !! spgv = vertical sum[ e3v (vb+ 2 rdt va) ] |
---|
| 89 | !! - grav 2 rdt hv /e2v dj[sshn + emp] |
---|
| 90 | !! and define the first guess from previous computation : |
---|
| 91 | !! zbtd = btda |
---|
| 92 | !! btda = 2 zbtd - btdb |
---|
| 93 | !! btdb = zbtd |
---|
| 94 | !! b- compute the relative accuracy to be reached by the |
---|
| 95 | !! iterative solver |
---|
| 96 | !! c- apply the solver by a call to sol... routine |
---|
[1438] | 97 | !! -2- compute and add the free surface pressure gradient inclu- |
---|
[358] | 98 | !! ding the additional force used to stabilize the equation. |
---|
| 99 | !! |
---|
| 100 | !! ** Action : - Update (ua,va) with the surf. pressure gradient trend |
---|
| 101 | !! |
---|
[508] | 102 | !! References : Roullet and Madec 1999, JGR. |
---|
[358] | 103 | !!--------------------------------------------------------------------- |
---|
[1438] | 104 | USE oce, ONLY : zub => ta ! ta used as workspace |
---|
| 105 | USE oce, ONLY : zvb => sa ! ta used as workspace |
---|
| 106 | !! |
---|
[1601] | 107 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
| 108 | INTEGER, INTENT( out) :: kindic ! solver convergence flag (<0 if not converge) |
---|
[508] | 109 | !! |
---|
[1601] | 110 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
| 111 | REAL(wp) :: z2dt, z2dtg, zraur ! temporary scalars |
---|
| 112 | REAL(wp) :: zgcb, zbtd ! - - |
---|
| 113 | REAL(wp) :: ztdgu, ztdgv ! - - |
---|
[358] | 114 | !!---------------------------------------------------------------------- |
---|
[508] | 115 | ! |
---|
[358] | 116 | IF( kt == nit000 ) THEN |
---|
| 117 | IF(lwp) WRITE(numout,*) |
---|
| 118 | IF(lwp) WRITE(numout,*) 'dyn_spg_flt : surface pressure gradient trend' |
---|
| 119 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ (free surface constant volume case)' |
---|
| 120 | |
---|
| 121 | ! set to zero free surface specific arrays |
---|
| 122 | spgu(:,:) = 0.e0 ! surface pressure gradient (i-direction) |
---|
| 123 | spgv(:,:) = 0.e0 ! surface pressure gradient (j-direction) |
---|
[508] | 124 | CALL solver_init( nit000 ) ! Elliptic solver initialisation |
---|
| 125 | |
---|
| 126 | ! read filtered free surface arrays in restart file |
---|
[1200] | 127 | ! when using agrif, sshn, gcx have to be read in istate |
---|
[1601] | 128 | IF(.NOT. lk_agrif) CALL flt_rst( nit000, 'READ' ) ! read or initialize the following fields: |
---|
[1438] | 129 | ! ! gcx, gcxb |
---|
[358] | 130 | ENDIF |
---|
| 131 | |
---|
| 132 | ! Local constant initialization |
---|
[1601] | 133 | z2dt = 2. * rdt ! time step: leap-frog |
---|
| 134 | IF( neuler == 0 .AND. kt == nit000 ) z2dt = rdt ! time step: Euler if restart from rest |
---|
| 135 | IF( neuler == 0 .AND. kt == nit000+1 ) CALL sol_mat( kt ) |
---|
[358] | 136 | z2dtg = grav * z2dt |
---|
| 137 | zraur = 1. / rauw |
---|
| 138 | |
---|
[1683] | 139 | ! Evaluate the masked next velocity (effect of the additional force not included) |
---|
| 140 | ! --------------------------------- |
---|
| 141 | IF( lk_vvl ) THEN ! variable volume (surface pressure gradient already included in dyn_hpg) |
---|
| 142 | ! |
---|
| 143 | IF( ln_dynadv_vec ) THEN ! vector form : applied on velocity |
---|
| 144 | DO jk = 1, jpkm1 |
---|
| 145 | DO jj = 2, jpjm1 |
---|
| 146 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 147 | ua(ji,jj,jk) = ( ub(ji,jj,jk) + z2dt * ua(ji,jj,jk) ) * umask(ji,jj,jk) |
---|
| 148 | va(ji,jj,jk) = ( vb(ji,jj,jk) + z2dt * va(ji,jj,jk) ) * vmask(ji,jj,jk) |
---|
| 149 | END DO |
---|
[592] | 150 | END DO |
---|
| 151 | END DO |
---|
[1683] | 152 | ! |
---|
| 153 | ELSE ! flux form : applied on thickness weighted velocity |
---|
| 154 | DO jk = 1, jpkm1 |
---|
| 155 | DO jj = 2, jpjm1 |
---|
| 156 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 157 | ua(ji,jj,jk) = ( ub(ji,jj,jk) * fse3u_b(ji,jj,jk) & |
---|
| 158 | & + z2dt * ua(ji,jj,jk) * fse3u_n(ji,jj,jk) ) & |
---|
| 159 | & / fse3u_a(ji,jj,jk) * umask(ji,jj,jk) |
---|
| 160 | va(ji,jj,jk) = ( vb(ji,jj,jk) * fse3v_b(ji,jj,jk) & |
---|
| 161 | & + z2dt * va(ji,jj,jk) * fse3v_n(ji,jj,jk) ) & |
---|
| 162 | & / fse3v_a(ji,jj,jk) * vmask(ji,jj,jk) |
---|
| 163 | END DO |
---|
| 164 | END DO |
---|
| 165 | END DO |
---|
| 166 | ! |
---|
| 167 | ENDIF |
---|
| 168 | ! |
---|
| 169 | ELSE ! fixed volume (add the surface pressure gradient + unweighted time stepping) |
---|
| 170 | ! |
---|
| 171 | DO jj = 2, jpjm1 ! Surface pressure gradient (now) |
---|
[358] | 172 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[592] | 173 | spgu(ji,jj) = - grav * ( sshn(ji+1,jj) - sshn(ji,jj) ) / e1u(ji,jj) |
---|
| 174 | spgv(ji,jj) = - grav * ( sshn(ji,jj+1) - sshn(ji,jj) ) / e2v(ji,jj) |
---|
| 175 | END DO |
---|
| 176 | END DO |
---|
[1683] | 177 | DO jk = 1, jpkm1 ! unweighted time stepping |
---|
[592] | 178 | DO jj = 2, jpjm1 |
---|
| 179 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[1438] | 180 | ua(ji,jj,jk) = ( ub(ji,jj,jk) + z2dt * ( ua(ji,jj,jk) + spgu(ji,jj) ) ) * umask(ji,jj,jk) |
---|
| 181 | va(ji,jj,jk) = ( vb(ji,jj,jk) + z2dt * ( va(ji,jj,jk) + spgv(ji,jj) ) ) * vmask(ji,jj,jk) |
---|
[592] | 182 | END DO |
---|
[358] | 183 | END DO |
---|
| 184 | END DO |
---|
[1438] | 185 | ! |
---|
[592] | 186 | ENDIF |
---|
| 187 | |
---|
[358] | 188 | #if defined key_obc |
---|
[508] | 189 | CALL obc_dyn( kt ) ! Update velocities on each open boundary with the radiation algorithm |
---|
| 190 | CALL obc_vol( kt ) ! Correction of the barotropic componant velocity to control the volume of the system |
---|
[358] | 191 | #endif |
---|
[911] | 192 | #if defined key_bdy |
---|
| 193 | ! Update velocities on unstructured boundary using the Flow Relaxation Scheme |
---|
| 194 | CALL bdy_dyn_frs( kt ) |
---|
| 195 | |
---|
| 196 | IF (ln_bdy_vol) THEN |
---|
| 197 | ! Correction of the barotropic component velocity to control the volume of the system |
---|
| 198 | CALL bdy_vol( kt ) |
---|
| 199 | ENDIF |
---|
| 200 | #endif |
---|
[392] | 201 | #if defined key_agrif |
---|
[508] | 202 | CALL Agrif_dyn( kt ) ! Update velocities on each coarse/fine interfaces |
---|
[389] | 203 | #endif |
---|
[358] | 204 | #if defined key_orca_r2 |
---|
| 205 | IF( n_cla == 1 ) CALL dyn_spg_cla( kt ) ! Cross Land Advection (update (ua,va)) |
---|
| 206 | #endif |
---|
| 207 | |
---|
| 208 | ! compute the next vertically averaged velocity (effect of the additional force not included) |
---|
| 209 | ! --------------------------------------------- |
---|
| 210 | DO jj = 2, jpjm1 |
---|
| 211 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 212 | spgu(ji,jj) = 0.e0 |
---|
| 213 | spgv(ji,jj) = 0.e0 |
---|
| 214 | END DO |
---|
| 215 | END DO |
---|
| 216 | |
---|
| 217 | ! vertical sum |
---|
| 218 | !CDIR NOLOOPCHG |
---|
| 219 | IF( lk_vopt_loop ) THEN ! vector opt., forced unroll |
---|
| 220 | DO jk = 1, jpkm1 |
---|
| 221 | DO ji = 1, jpij |
---|
| 222 | spgu(ji,1) = spgu(ji,1) + fse3u(ji,1,jk) * ua(ji,1,jk) |
---|
| 223 | spgv(ji,1) = spgv(ji,1) + fse3v(ji,1,jk) * va(ji,1,jk) |
---|
| 224 | END DO |
---|
| 225 | END DO |
---|
| 226 | ELSE ! No vector opt. |
---|
| 227 | DO jk = 1, jpkm1 |
---|
| 228 | DO jj = 2, jpjm1 |
---|
| 229 | DO ji = 2, jpim1 |
---|
| 230 | spgu(ji,jj) = spgu(ji,jj) + fse3u(ji,jj,jk) * ua(ji,jj,jk) |
---|
| 231 | spgv(ji,jj) = spgv(ji,jj) + fse3v(ji,jj,jk) * va(ji,jj,jk) |
---|
| 232 | END DO |
---|
| 233 | END DO |
---|
| 234 | END DO |
---|
| 235 | ENDIF |
---|
| 236 | |
---|
| 237 | ! transport: multiplied by the horizontal scale factor |
---|
| 238 | DO jj = 2, jpjm1 |
---|
| 239 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 240 | spgu(ji,jj) = spgu(ji,jj) * e2u(ji,jj) |
---|
| 241 | spgv(ji,jj) = spgv(ji,jj) * e1v(ji,jj) |
---|
| 242 | END DO |
---|
| 243 | END DO |
---|
[1601] | 244 | CALL lbc_lnk( spgu, 'U', -1. ) ! lateral boundary conditions |
---|
[358] | 245 | CALL lbc_lnk( spgv, 'V', -1. ) |
---|
| 246 | |
---|
[1438] | 247 | IF( lk_vvl ) CALL sol_mat( kt ) ! build the matrix at kt (vvl case only) |
---|
[592] | 248 | |
---|
[358] | 249 | ! Right hand side of the elliptic equation and first guess |
---|
[1601] | 250 | ! -------------------------------------------------------- |
---|
[358] | 251 | DO jj = 2, jpjm1 |
---|
| 252 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 253 | ! Divergence of the after vertically averaged velocity |
---|
| 254 | zgcb = spgu(ji,jj) - spgu(ji-1,jj) & |
---|
| 255 | + spgv(ji,jj) - spgv(ji,jj-1) |
---|
| 256 | gcb(ji,jj) = gcdprc(ji,jj) * zgcb |
---|
| 257 | ! First guess of the after barotropic transport divergence |
---|
| 258 | zbtd = gcx(ji,jj) |
---|
| 259 | gcx (ji,jj) = 2. * zbtd - gcxb(ji,jj) |
---|
| 260 | gcxb(ji,jj) = zbtd |
---|
| 261 | END DO |
---|
| 262 | END DO |
---|
| 263 | ! applied the lateral boundary conditions |
---|
[1601] | 264 | IF( nn_solv == 2 .AND. MAX( jpr2di, jpr2dj ) > 0 ) CALL lbc_lnk_e( gcb, c_solver_pt, 1. ) |
---|
[358] | 265 | |
---|
[392] | 266 | #if defined key_agrif |
---|
[413] | 267 | IF( .NOT. AGRIF_ROOT() ) THEN |
---|
[389] | 268 | ! add contribution of gradient of after barotropic transport divergence |
---|
[508] | 269 | IF( nbondi == -1 .OR. nbondi == 2 ) gcb(3 ,:) = & |
---|
[1601] | 270 | & gcb(3 ,:) - z2dtg * z2dt * laplacu(2 ,:) * gcdprc(3 ,:) * hu(2 ,:) * e2u(2 ,:) |
---|
[508] | 271 | IF( nbondi == 1 .OR. nbondi == 2 ) gcb(nlci-2,:) = & |
---|
[1601] | 272 | & gcb(nlci-2,:) + z2dtg * z2dt * laplacu(nlci-2,:) * gcdprc(nlci-2,:) * hu(nlci-2,:) * e2u(nlci-2,:) |
---|
[508] | 273 | IF( nbondj == -1 .OR. nbondj == 2 ) gcb(: ,3) = & |
---|
[1601] | 274 | & gcb(:,3 ) - z2dtg * z2dt * laplacv(:,2 ) * gcdprc(:,3 ) * hv(:,2 ) * e1v(:,2 ) |
---|
[508] | 275 | IF( nbondj == 1 .OR. nbondj == 2 ) gcb(:,nlcj-2) = & |
---|
[1601] | 276 | & gcb(:,nlcj-2) + z2dtg * z2dt * laplacv(:,nlcj-2) * gcdprc(:,nlcj-2) * hv(:,nlcj-2) * e1v(:,nlcj-2) |
---|
[413] | 277 | ENDIF |
---|
[389] | 278 | #endif |
---|
| 279 | |
---|
| 280 | |
---|
[358] | 281 | ! Relative precision (computation on one processor) |
---|
| 282 | ! ------------------ |
---|
[1438] | 283 | rnorme =0.e0 |
---|
[358] | 284 | rnorme = SUM( gcb(1:jpi,1:jpj) * gcdmat(1:jpi,1:jpj) * gcb(1:jpi,1:jpj) * bmask(:,:) ) |
---|
| 285 | IF( lk_mpp ) CALL mpp_sum( rnorme ) ! sum over the global domain |
---|
| 286 | |
---|
| 287 | epsr = eps * eps * rnorme |
---|
| 288 | ncut = 0 |
---|
[508] | 289 | ! if rnorme is 0, the solution is 0, the solver is not called |
---|
[358] | 290 | IF( rnorme == 0.e0 ) THEN |
---|
| 291 | gcx(:,:) = 0.e0 |
---|
| 292 | res = 0.e0 |
---|
| 293 | niter = 0 |
---|
| 294 | ncut = 999 |
---|
| 295 | ENDIF |
---|
| 296 | |
---|
| 297 | ! Evaluate the next transport divergence |
---|
| 298 | ! -------------------------------------- |
---|
| 299 | ! Iterarive solver for the elliptic equation (except IF sol.=0) |
---|
| 300 | ! (output in gcx with boundary conditions applied) |
---|
| 301 | kindic = 0 |
---|
| 302 | IF( ncut == 0 ) THEN |
---|
[1601] | 303 | IF ( nn_solv == 1 ) THEN ; CALL sol_pcg( kindic ) ! diagonal preconditioned conjuguate gradient |
---|
| 304 | ELSEIF( nn_solv == 2 ) THEN ; CALL sol_sor( kindic ) ! successive-over-relaxation |
---|
[358] | 305 | ENDIF |
---|
| 306 | ENDIF |
---|
| 307 | |
---|
| 308 | ! Transport divergence gradient multiplied by z2dt |
---|
| 309 | ! --------------------------------------------==== |
---|
| 310 | DO jj = 2, jpjm1 |
---|
| 311 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
| 312 | ! trend of Transport divergence gradient |
---|
[1601] | 313 | ztdgu = z2dtg * (gcx(ji+1,jj ) - gcx(ji,jj) ) / e1u(ji,jj) |
---|
| 314 | ztdgv = z2dtg * (gcx(ji ,jj+1) - gcx(ji,jj) ) / e2v(ji,jj) |
---|
[358] | 315 | ! multiplied by z2dt |
---|
| 316 | #if defined key_obc |
---|
| 317 | ! caution : grad D = 0 along open boundaries |
---|
| 318 | spgu(ji,jj) = z2dt * ztdgu * obcumask(ji,jj) |
---|
| 319 | spgv(ji,jj) = z2dt * ztdgv * obcvmask(ji,jj) |
---|
[911] | 320 | #elif defined key_bdy |
---|
| 321 | ! caution : grad D = 0 along open boundaries |
---|
| 322 | ! Remark: The filtering force could be reduced here in the FRS zone |
---|
| 323 | ! by multiplying spgu/spgv by (1-alpha) ?? |
---|
| 324 | spgu(ji,jj) = z2dt * ztdgu * bdyumask(ji,jj) |
---|
| 325 | spgv(ji,jj) = z2dt * ztdgv * bdyvmask(ji,jj) |
---|
[358] | 326 | #else |
---|
| 327 | spgu(ji,jj) = z2dt * ztdgu |
---|
| 328 | spgv(ji,jj) = z2dt * ztdgv |
---|
| 329 | #endif |
---|
| 330 | END DO |
---|
| 331 | END DO |
---|
| 332 | |
---|
[392] | 333 | #if defined key_agrif |
---|
[413] | 334 | IF( .NOT. Agrif_Root() ) THEN |
---|
| 335 | ! caution : grad D (fine) = grad D (coarse) at coarse/fine interface |
---|
[1601] | 336 | IF( nbondi == -1 .OR. nbondi == 2 ) spgu(2 ,:) = z2dtg * z2dt * laplacu(2 ,:) * umask(2 ,:,1) |
---|
| 337 | IF( nbondi == 1 .OR. nbondi == 2 ) spgu(nlci-2,:) = z2dtg * z2dt * laplacu(nlci-2,:) * umask(nlci-2,:,1) |
---|
| 338 | IF( nbondj == -1 .OR. nbondj == 2 ) spgv(:,2 ) = z2dtg * z2dt * laplacv(:,2 ) * vmask(: ,2,1) |
---|
| 339 | IF( nbondj == 1 .OR. nbondj == 2 ) spgv(:,nlcj-2) = z2dtg * z2dt * laplacv(:,nlcj-2) * vmask(:,nlcj-2,1) |
---|
[389] | 340 | ENDIF |
---|
| 341 | #endif |
---|
[1438] | 342 | ! Add the trends multiplied by z2dt to the after velocity |
---|
| 343 | ! ------------------------------------------------------- |
---|
[358] | 344 | ! ( c a u t i o n : (ua,va) here are the after velocity not the |
---|
| 345 | ! trend, the leap-frog time stepping will not |
---|
[508] | 346 | ! be done in dynnxt.F90 routine) |
---|
[358] | 347 | DO jk = 1, jpkm1 |
---|
| 348 | DO jj = 2, jpjm1 |
---|
| 349 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[1438] | 350 | ua(ji,jj,jk) = ( ua(ji,jj,jk) + spgu(ji,jj) ) * umask(ji,jj,jk) |
---|
| 351 | va(ji,jj,jk) = ( va(ji,jj,jk) + spgv(ji,jj) ) * vmask(ji,jj,jk) |
---|
[358] | 352 | END DO |
---|
| 353 | END DO |
---|
| 354 | END DO |
---|
| 355 | |
---|
[508] | 356 | ! write filtered free surface arrays in restart file |
---|
| 357 | ! -------------------------------------------------- |
---|
| 358 | IF( lrst_oce ) CALL flt_rst( kt, 'WRITE' ) |
---|
| 359 | ! |
---|
[358] | 360 | END SUBROUTINE dyn_spg_flt |
---|
| 361 | |
---|
[508] | 362 | |
---|
| 363 | SUBROUTINE flt_rst( kt, cdrw ) |
---|
| 364 | !!--------------------------------------------------------------------- |
---|
| 365 | !! *** ROUTINE ts_rst *** |
---|
| 366 | !! |
---|
| 367 | !! ** Purpose : Read or write filtered free surface arrays in restart file |
---|
| 368 | !!---------------------------------------------------------------------- |
---|
| 369 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 370 | CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag |
---|
| 371 | !!---------------------------------------------------------------------- |
---|
| 372 | |
---|
| 373 | IF( TRIM(cdrw) == 'READ' ) THEN |
---|
[746] | 374 | IF( iom_varid( numror, 'gcx', ldstop = .FALSE. ) > 0 ) THEN |
---|
[508] | 375 | ! Caution : extra-hallow |
---|
| 376 | ! gcx and gcxb are defined as: DIMENSION(1-jpr2di:jpi+jpr2di,1-jpr2dj:jpj+jpr2dj) |
---|
[683] | 377 | CALL iom_get( numror, jpdom_autoglo, 'gcx' , gcx (1:jpi,1:jpj) ) |
---|
| 378 | CALL iom_get( numror, jpdom_autoglo, 'gcxb', gcxb(1:jpi,1:jpj) ) |
---|
[1438] | 379 | IF( neuler == 0 ) gcxb(:,:) = gcx (:,:) |
---|
[508] | 380 | ELSE |
---|
| 381 | gcx (:,:) = 0.e0 |
---|
| 382 | gcxb(:,:) = 0.e0 |
---|
| 383 | ENDIF |
---|
| 384 | ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN |
---|
| 385 | ! Caution : extra-hallow |
---|
| 386 | ! gcx and gcxb are defined as: DIMENSION(1-jpr2di:jpi+jpr2di,1-jpr2dj:jpj+jpr2dj) |
---|
[1438] | 387 | CALL iom_rstput( kt, nitrst, numrow, 'gcx' , gcx (1:jpi,1:jpj) ) |
---|
[508] | 388 | CALL iom_rstput( kt, nitrst, numrow, 'gcxb', gcxb(1:jpi,1:jpj) ) |
---|
| 389 | ENDIF |
---|
| 390 | ! |
---|
| 391 | END SUBROUTINE flt_rst |
---|
| 392 | |
---|
[358] | 393 | #else |
---|
| 394 | !!---------------------------------------------------------------------- |
---|
| 395 | !! Default case : Empty module No standart free surface cst volume |
---|
| 396 | !!---------------------------------------------------------------------- |
---|
| 397 | CONTAINS |
---|
| 398 | SUBROUTINE dyn_spg_flt( kt, kindic ) ! Empty routine |
---|
| 399 | WRITE(*,*) 'dyn_spg_flt: You should not have seen this print! error?', kt, kindic |
---|
| 400 | END SUBROUTINE dyn_spg_flt |
---|
[657] | 401 | SUBROUTINE flt_rst ( kt, cdrw ) ! Empty routine |
---|
| 402 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
| 403 | CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag |
---|
| 404 | WRITE(*,*) 'flt_rst: You should not have seen this print! error?', kt, cdrw |
---|
| 405 | END SUBROUTINE flt_rst |
---|
[358] | 406 | #endif |
---|
| 407 | |
---|
| 408 | !!====================================================================== |
---|
| 409 | END MODULE dynspg_flt |
---|