[358] | 1 | MODULE dynspg |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE dynspg *** |
---|
| 4 | !! Ocean dynamics: surface pressure gradient control |
---|
| 5 | !!====================================================================== |
---|
[1566] | 6 | !! History : 1.0 ! 2005-12 (C. Talandier, G. Madec, V. Garnier) Original code |
---|
| 7 | !! 3.2 ! 2009-07 (R. Benshila) Suppression of rigid-lid option |
---|
[5930] | 8 | !! 3.7 ! 2015-11 (J. Chanut) Suppression of filtered free surface |
---|
[503] | 9 | !!---------------------------------------------------------------------- |
---|
[358] | 10 | |
---|
| 11 | !!---------------------------------------------------------------------- |
---|
[5930] | 12 | !! dyn_spg : update the dynamics trend with surface pressure gradient |
---|
| 13 | !! dyn_spg_init: initialization, namelist read, and parameters control |
---|
[358] | 14 | !!---------------------------------------------------------------------- |
---|
| 15 | USE oce ! ocean dynamics and tracers variables |
---|
| 16 | USE dom_oce ! ocean space and time domain variables |
---|
[4245] | 17 | USE c1d ! 1D vertical configuration |
---|
[2715] | 18 | USE phycst ! physical constants |
---|
[2528] | 19 | USE sbc_oce ! surface boundary condition: ocean |
---|
| 20 | USE sbcapr ! surface boundary condition: atmospheric pressure |
---|
[358] | 21 | USE dynspg_exp ! surface pressure gradient (dyn_spg_exp routine) |
---|
| 22 | USE dynspg_ts ! surface pressure gradient (dyn_spg_ts routine) |
---|
[4292] | 23 | USE sbctide |
---|
| 24 | USE updtide |
---|
[4990] | 25 | USE trd_oce ! trends: ocean variables |
---|
| 26 | USE trddyn ! trend manager: dynamics |
---|
| 27 | ! |
---|
[358] | 28 | USE prtctl ! Print control (prt_ctl routine) |
---|
| 29 | USE in_out_manager ! I/O manager |
---|
[2715] | 30 | USE lib_mpp ! MPP library |
---|
[4990] | 31 | USE wrk_nemo ! Memory Allocation |
---|
| 32 | USE timing ! Timing |
---|
[358] | 33 | |
---|
[3294] | 34 | |
---|
[358] | 35 | IMPLICIT NONE |
---|
| 36 | PRIVATE |
---|
| 37 | |
---|
[2528] | 38 | PUBLIC dyn_spg ! routine called by step module |
---|
| 39 | PUBLIC dyn_spg_init ! routine called by opa module |
---|
[358] | 40 | |
---|
[5930] | 41 | INTEGER :: nspg = 0 ! type of surface pressure gradient scheme defined from ln_dynspg_... |
---|
[358] | 42 | |
---|
| 43 | !! * Substitutions |
---|
| 44 | # include "domzgr_substitute.h90" |
---|
| 45 | # include "vectopt_loop_substitute.h90" |
---|
| 46 | !!---------------------------------------------------------------------- |
---|
[1566] | 47 | !! NEMO/OPA 3.2 , LODYC-IPSL (2009) |
---|
[1152] | 48 | !! $Id$ |
---|
[2715] | 49 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[358] | 50 | !!---------------------------------------------------------------------- |
---|
| 51 | CONTAINS |
---|
| 52 | |
---|
[5930] | 53 | SUBROUTINE dyn_spg( kt ) |
---|
[358] | 54 | !!---------------------------------------------------------------------- |
---|
| 55 | !! *** ROUTINE dyn_spg *** |
---|
| 56 | !! |
---|
[1566] | 57 | !! ** Purpose : achieve the momentum time stepping by computing the |
---|
[2528] | 58 | !! last trend, the surface pressure gradient including the |
---|
| 59 | !! atmospheric pressure forcing (ln_apr_dyn=T), and performing |
---|
[1566] | 60 | !! the Leap-Frog integration. |
---|
| 61 | !!gm In the current version only the filtered solution provide |
---|
| 62 | !!gm the after velocity, in the 2 other (ua,va) are still the trends |
---|
| 63 | !! |
---|
[5930] | 64 | !! ** Method : Two schemes: |
---|
[1566] | 65 | !! - explicit computation : the spg is evaluated at now |
---|
| 66 | !! - split-explicit computation: a time splitting technique is used |
---|
| 67 | !! |
---|
[2528] | 68 | !! ln_apr_dyn=T : the atmospheric pressure forcing is applied |
---|
| 69 | !! as the gradient of the inverse barometer ssh: |
---|
| 70 | !! apgu = - 1/rau0 di[apr] = 0.5*grav di[ssh_ib+ssh_ibb] |
---|
| 71 | !! apgv = - 1/rau0 dj[apr] = 0.5*grav dj[ssh_ib+ssh_ibb] |
---|
| 72 | !! Note that as all external forcing a time averaging over a two rdt |
---|
| 73 | !! period is used to prevent the divergence of odd and even time step. |
---|
[358] | 74 | !!---------------------------------------------------------------------- |
---|
[2715] | 75 | ! |
---|
[1566] | 76 | INTEGER, INTENT(in ) :: kt ! ocean time-step index |
---|
[2715] | 77 | ! |
---|
[2528] | 78 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
[3625] | 79 | REAL(wp) :: z2dt, zg_2, zintp, zgrau0r ! temporary scalar |
---|
[3294] | 80 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdu, ztrdv |
---|
[3625] | 81 | REAL(wp), POINTER, DIMENSION(:,:) :: zpice |
---|
[358] | 82 | !!---------------------------------------------------------------------- |
---|
[3294] | 83 | ! |
---|
| 84 | IF( nn_timing == 1 ) CALL timing_start('dyn_spg') |
---|
| 85 | ! |
---|
[358] | 86 | |
---|
[1566] | 87 | !!gm NOTA BENE : the dynspg_exp and dynspg_ts should be modified so that |
---|
| 88 | !!gm they return the after velocity, not the trends (as in trazdf_imp...) |
---|
| 89 | !!gm In this case, change/simplify dynnxt |
---|
| 90 | |
---|
| 91 | |
---|
[358] | 92 | IF( l_trddyn ) THEN ! temporary save of ta and sa trends |
---|
[3294] | 93 | CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv ) |
---|
[358] | 94 | ztrdu(:,:,:) = ua(:,:,:) |
---|
| 95 | ztrdv(:,:,:) = va(:,:,:) |
---|
| 96 | ENDIF |
---|
| 97 | |
---|
[4292] | 98 | IF( ln_apr_dyn & ! atmos. pressure |
---|
[5930] | 99 | .OR. ( .NOT.ln_dynspg_ts .AND. (ln_tide_pot .AND. lk_tide) ) & ! tide potential (no time slitting) |
---|
[4292] | 100 | .OR. nn_ice_embd == 2 ) THEN ! embedded sea-ice |
---|
| 101 | ! |
---|
| 102 | DO jj = 2, jpjm1 |
---|
[2528] | 103 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[4292] | 104 | spgu(ji,jj) = 0._wp |
---|
| 105 | spgv(ji,jj) = 0._wp |
---|
[2528] | 106 | END DO |
---|
[4292] | 107 | END DO |
---|
| 108 | ! |
---|
[5930] | 109 | IF( ln_apr_dyn .AND. (.NOT. ln_dynspg_ts) ) THEN !== Atmospheric pressure gradient (added later in time-split case) ==! |
---|
[4292] | 110 | zg_2 = grav * 0.5 |
---|
| 111 | DO jj = 2, jpjm1 ! gradient of Patm using inverse barometer ssh |
---|
[2528] | 112 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[4292] | 113 | spgu(ji,jj) = spgu(ji,jj) + zg_2 * ( ssh_ib (ji+1,jj) - ssh_ib (ji,jj) & |
---|
[5836] | 114 | & + ssh_ibb(ji+1,jj) - ssh_ibb(ji,jj) ) * r1_e1u(ji,jj) |
---|
[4292] | 115 | spgv(ji,jj) = spgv(ji,jj) + zg_2 * ( ssh_ib (ji,jj+1) - ssh_ib (ji,jj) & |
---|
[5836] | 116 | & + ssh_ibb(ji,jj+1) - ssh_ibb(ji,jj) ) * r1_e2v(ji,jj) |
---|
[2528] | 117 | END DO |
---|
| 118 | END DO |
---|
[4292] | 119 | ENDIF |
---|
| 120 | ! |
---|
| 121 | ! !== tide potential forcing term ==! |
---|
[5930] | 122 | IF( .NOT.ln_dynspg_ts .AND. ( ln_tide_pot .AND. lk_tide ) ) THEN ! N.B. added directly at sub-time-step in ts-case |
---|
[4292] | 123 | ! |
---|
| 124 | CALL upd_tide( kt ) ! update tide potential |
---|
| 125 | ! |
---|
| 126 | DO jj = 2, jpjm1 ! add tide potential forcing |
---|
| 127 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[5836] | 128 | spgu(ji,jj) = spgu(ji,jj) + grav * ( pot_astro(ji+1,jj) - pot_astro(ji,jj) ) * r1_e1u(ji,jj) |
---|
| 129 | spgv(ji,jj) = spgv(ji,jj) + grav * ( pot_astro(ji,jj+1) - pot_astro(ji,jj) ) * r1_e2v(ji,jj) |
---|
[4292] | 130 | END DO |
---|
[3625] | 131 | END DO |
---|
[4292] | 132 | ENDIF |
---|
| 133 | ! |
---|
| 134 | IF( nn_ice_embd == 2 ) THEN !== embedded sea ice: Pressure gradient due to snow-ice mass ==! |
---|
| 135 | CALL wrk_alloc( jpi, jpj, zpice ) |
---|
| 136 | ! |
---|
| 137 | zintp = REAL( MOD( kt-1, nn_fsbc ) ) / REAL( nn_fsbc ) |
---|
| 138 | zgrau0r = - grav * r1_rau0 |
---|
| 139 | zpice(:,:) = ( zintp * snwice_mass(:,:) + ( 1.- zintp ) * snwice_mass_b(:,:) ) * zgrau0r |
---|
[3625] | 140 | DO jj = 2, jpjm1 |
---|
| 141 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[5836] | 142 | spgu(ji,jj) = spgu(ji,jj) + ( zpice(ji+1,jj) - zpice(ji,jj) ) * r1_e1u(ji,jj) |
---|
| 143 | spgv(ji,jj) = spgv(ji,jj) + ( zpice(ji,jj+1) - zpice(ji,jj) ) * r1_e2v(ji,jj) |
---|
[4292] | 144 | END DO |
---|
| 145 | END DO |
---|
| 146 | ! |
---|
| 147 | CALL wrk_dealloc( jpi, jpj, zpice ) |
---|
| 148 | ENDIF |
---|
| 149 | ! |
---|
| 150 | DO jk = 1, jpkm1 !== Add all terms to the general trend |
---|
| 151 | DO jj = 2, jpjm1 |
---|
| 152 | DO ji = fs_2, fs_jpim1 ! vector opt. |
---|
[3625] | 153 | ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj) |
---|
| 154 | va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj) |
---|
| 155 | END DO |
---|
| 156 | END DO |
---|
[4990] | 157 | END DO |
---|
| 158 | |
---|
| 159 | !!gm add here a call to dyn_trd for ice pressure gradient, the surf pressure trends ???? |
---|
| 160 | |
---|
[3625] | 161 | ENDIF |
---|
[2528] | 162 | |
---|
[358] | 163 | SELECT CASE ( nspg ) ! compute surf. pressure gradient trend and add it to the general trend |
---|
[789] | 164 | ! |
---|
[1566] | 165 | CASE ( 0 ) ; CALL dyn_spg_exp( kt ) ! explicit |
---|
| 166 | CASE ( 1 ) ; CALL dyn_spg_ts ( kt ) ! time-splitting |
---|
[789] | 167 | ! |
---|
[358] | 168 | END SELECT |
---|
[503] | 169 | ! |
---|
[1566] | 170 | IF( l_trddyn ) THEN ! save the surface pressure gradient trends for further diagnostics |
---|
[5930] | 171 | ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) |
---|
| 172 | ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) |
---|
[4990] | 173 | CALL trd_dyn( ztrdu, ztrdv, jpdyn_spg, kt ) |
---|
[3294] | 174 | ! |
---|
| 175 | CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv ) |
---|
[358] | 176 | ENDIF |
---|
| 177 | ! ! print mean trends (used for debugging) |
---|
| 178 | IF(ln_ctl) CALL prt_ctl( tab3d_1=ua, clinfo1=' spg - Ua: ', mask1=umask, & |
---|
| 179 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
[503] | 180 | ! |
---|
[3294] | 181 | IF( nn_timing == 1 ) CALL timing_stop('dyn_spg') |
---|
[2715] | 182 | ! |
---|
[358] | 183 | END SUBROUTINE dyn_spg |
---|
| 184 | |
---|
| 185 | |
---|
[2528] | 186 | SUBROUTINE dyn_spg_init |
---|
[358] | 187 | !!--------------------------------------------------------------------- |
---|
[2528] | 188 | !! *** ROUTINE dyn_spg_init *** |
---|
[358] | 189 | !! |
---|
[5930] | 190 | !! ** Purpose : Control the consistency between namelist options for |
---|
[1566] | 191 | !! surface pressure gradient schemes |
---|
[358] | 192 | !!---------------------------------------------------------------------- |
---|
[5930] | 193 | INTEGER :: ioptio, ios |
---|
| 194 | ! |
---|
| 195 | NAMELIST/namdyn_spg/ ln_dynspg_exp, ln_dynspg_ts, & |
---|
| 196 | & ln_bt_fw, ln_bt_av, ln_bt_auto, & |
---|
| 197 | & nn_baro, rn_bt_cmax, nn_bt_flt |
---|
[358] | 198 | !!---------------------------------------------------------------------- |
---|
[3294] | 199 | ! |
---|
| 200 | IF( nn_timing == 1 ) CALL timing_start('dyn_spg_init') |
---|
| 201 | ! |
---|
[5930] | 202 | REWIND( numnam_ref ) ! Namelist namdyn_spg in reference namelist : Free surface |
---|
| 203 | READ ( numnam_ref, namdyn_spg, IOSTAT = ios, ERR = 901) |
---|
| 204 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_spg in reference namelist', lwp ) |
---|
| 205 | |
---|
| 206 | REWIND( numnam_cfg ) ! Namelist namdyn_spg in configuration namelist : Free surface |
---|
| 207 | READ ( numnam_cfg, namdyn_spg, IOSTAT = ios, ERR = 902 ) |
---|
| 208 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_spg in configuration namelist', lwp ) |
---|
| 209 | IF(lwm) WRITE ( numond, namdyn_spg ) |
---|
| 210 | ! |
---|
| 211 | IF(lwp) THEN ! Namelist print |
---|
[358] | 212 | WRITE(numout,*) |
---|
[2528] | 213 | WRITE(numout,*) 'dyn_spg_init : choice of the surface pressure gradient scheme' |
---|
[358] | 214 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
[5930] | 215 | WRITE(numout,*) ' Explicit free surface ln_dynspg_exp = ', ln_dynspg_exp |
---|
| 216 | WRITE(numout,*) ' Free surface with time splitting ln_dynspg_ts = ', ln_dynspg_ts |
---|
[358] | 217 | ENDIF |
---|
| 218 | |
---|
[5930] | 219 | IF( ln_dynspg_ts ) THEN |
---|
| 220 | CALL dyn_spg_ts_init( nit000 ) ! do it first, to set nn_baro, used to allocate some arrays later on |
---|
| 221 | ! ! allocate dyn_spg arrays |
---|
[2715] | 222 | IF( dyn_spg_ts_alloc() /= 0 ) CALL ctl_stop('STOP', 'dyn_spg_init: failed to allocate dynspg_ts arrays') |
---|
[4496] | 223 | IF ((neuler/=0).AND.(ln_bt_fw)) CALL ts_rst( nit000, 'READ' ) |
---|
[2715] | 224 | ENDIF |
---|
| 225 | |
---|
[1566] | 226 | ! ! Control of surface pressure gradient scheme options |
---|
[358] | 227 | ioptio = 0 |
---|
[5930] | 228 | IF(ln_dynspg_exp) ioptio = ioptio + 1 |
---|
| 229 | IF(ln_dynspg_ts ) ioptio = ioptio + 1 |
---|
[1566] | 230 | ! |
---|
[5836] | 231 | IF( ioptio > 1 .OR. ( ioptio == 0 .AND. .NOT. lk_c1d ) ) & |
---|
[5930] | 232 | & CALL ctl_stop( ' Choose only one surface pressure gradient scheme' ) |
---|
| 233 | IF( ln_dynspg_ts .AND. ln_isfcav ) & |
---|
| 234 | & CALL ctl_stop( ' dynspg_ts not tested with ice shelf cavity ' ) |
---|
[1566] | 235 | ! |
---|
[5930] | 236 | IF( ln_dynspg_exp) nspg = 0 |
---|
| 237 | IF( ln_dynspg_ts ) nspg = 1 |
---|
[1566] | 238 | ! |
---|
| 239 | IF(lwp) THEN |
---|
[358] | 240 | WRITE(numout,*) |
---|
[372] | 241 | IF( nspg == 0 ) WRITE(numout,*) ' explicit free surface' |
---|
| 242 | IF( nspg == 1 ) WRITE(numout,*) ' free surface with time splitting scheme' |
---|
[358] | 243 | ENDIF |
---|
[1566] | 244 | ! |
---|
[3294] | 245 | IF( nn_timing == 1 ) CALL timing_stop('dyn_spg_init') |
---|
| 246 | ! |
---|
[2528] | 247 | END SUBROUTINE dyn_spg_init |
---|
[358] | 248 | |
---|
| 249 | !!====================================================================== |
---|
| 250 | END MODULE dynspg |
---|