1 | MODULE dynspg |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE dynspg *** |
---|
4 | !! Ocean dynamics: surface pressure gradient control |
---|
5 | !!====================================================================== |
---|
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 |
---|
8 | !! 4.2 ! 2020-12 (G. Madec, E. Clementi) add Bernoulli Head for |
---|
9 | !! wave coupling |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !! dyn_spg : update the dynamics trend with surface pressure gradient |
---|
14 | !! dyn_spg_init: initialization, namelist read, and parameters control |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | USE oce ! ocean dynamics and tracers variables |
---|
17 | USE dom_oce ! ocean space and time domain variables |
---|
18 | USE c1d ! 1D vertical configuration |
---|
19 | USE phycst ! physical constants |
---|
20 | USE sbc_oce ! surface boundary condition: ocean |
---|
21 | USE sbc_ice , ONLY : snwice_mass, snwice_mass_b |
---|
22 | USE sbcapr ! surface boundary condition: atmospheric pressure |
---|
23 | USE sbcwave, ONLY : bhd_wave |
---|
24 | USE dynspg_exp ! surface pressure gradient (dyn_spg_exp routine) |
---|
25 | USE dynspg_ts ! surface pressure gradient (dyn_spg_ts routine) |
---|
26 | USE tide_mod ! |
---|
27 | USE trd_oce ! trends: ocean variables |
---|
28 | USE trddyn ! trend manager: dynamics |
---|
29 | ! |
---|
30 | USE prtctl ! Print control (prt_ctl routine) |
---|
31 | USE in_out_manager ! I/O manager |
---|
32 | USE lib_mpp ! MPP library |
---|
33 | USE timing ! Timing |
---|
34 | |
---|
35 | IMPLICIT NONE |
---|
36 | PRIVATE |
---|
37 | |
---|
38 | PUBLIC dyn_spg ! routine called by step module |
---|
39 | PUBLIC dyn_spg_init ! routine called by opa module |
---|
40 | |
---|
41 | INTEGER :: nspg = 0 ! type of surface pressure gradient scheme defined from lk_dynspg_... |
---|
42 | |
---|
43 | ! ! Parameter to control the surface pressure gradient scheme |
---|
44 | INTEGER, PARAMETER :: np_TS = 1 ! split-explicit time stepping (Time-Splitting) |
---|
45 | INTEGER, PARAMETER :: np_EXP = 0 ! explicit time stepping |
---|
46 | INTEGER, PARAMETER :: np_NO =-1 ! no surface pressure gradient, no scheme |
---|
47 | ! |
---|
48 | REAL(wp) :: zt0step ! Time of day at the beginning of the time step |
---|
49 | |
---|
50 | !! * Substitutions |
---|
51 | # include "do_loop_substitute.h90" |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
54 | !! $Id$ |
---|
55 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
56 | !!---------------------------------------------------------------------- |
---|
57 | CONTAINS |
---|
58 | |
---|
59 | SUBROUTINE dyn_spg( kt, Kbb, Kmm, Krhs, puu, pvv, pssh, puu_b, pvv_b, Kaa ) |
---|
60 | !!---------------------------------------------------------------------- |
---|
61 | !! *** ROUTINE dyn_spg *** |
---|
62 | !! |
---|
63 | !! ** Purpose : compute surface pressure gradient including the |
---|
64 | !! atmospheric pressure forcing (ln_apr_dyn=T). |
---|
65 | !! |
---|
66 | !! ** Method : Two schemes: |
---|
67 | !! - explicit : the spg is evaluated at now |
---|
68 | !! - split-explicit : a time splitting technique is used |
---|
69 | !! |
---|
70 | !! ln_apr_dyn=T : the atmospheric pressure forcing is applied |
---|
71 | !! as the gradient of the inverse barometer ssh: |
---|
72 | !! apgu = - 1/rho0 di[apr] = 0.5*grav di[ssh_ib+ssh_ibb] |
---|
73 | !! apgv = - 1/rho0 dj[apr] = 0.5*grav dj[ssh_ib+ssh_ibb] |
---|
74 | !! Note that as all external forcing a time averaging over a two rn_Dt |
---|
75 | !! period is used to prevent the divergence of odd and even time step. |
---|
76 | !!---------------------------------------------------------------------- |
---|
77 | INTEGER , INTENT( in ) :: kt ! ocean time-step index |
---|
78 | INTEGER , INTENT( in ) :: Kbb, Kmm, Krhs, Kaa ! ocean time level indices |
---|
79 | REAL(wp), DIMENSION(jpi,jpj,jpk,jpt), INTENT(inout) :: puu, pvv ! ocean velocities and RHS of momentum equation |
---|
80 | REAL(wp), DIMENSION(jpi,jpj,jpt) , INTENT(inout) :: pssh, puu_b, pvv_b ! SSH and barotropic velocities at main time levels |
---|
81 | ! |
---|
82 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
83 | REAL(wp) :: z2dt, zg_2, zintp, zgrho0r, zld ! local scalars |
---|
84 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zpice |
---|
85 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) :: ztrdu, ztrdv |
---|
86 | !!---------------------------------------------------------------------- |
---|
87 | ! |
---|
88 | IF( ln_timing ) CALL timing_start('dyn_spg') |
---|
89 | ! |
---|
90 | IF( l_trddyn ) THEN ! temporary save of ta and sa trends |
---|
91 | ALLOCATE( ztrdu(jpi,jpj,jpk) , ztrdv(jpi,jpj,jpk) ) |
---|
92 | ztrdu(:,:,:) = puu(:,:,:,Krhs) |
---|
93 | ztrdv(:,:,:) = pvv(:,:,:,Krhs) |
---|
94 | ENDIF |
---|
95 | ! |
---|
96 | IF( ln_apr_dyn & ! atmos. pressure |
---|
97 | .OR. ( .NOT.ln_dynspg_ts .AND. (ln_tide_pot .AND. ln_tide) ) & ! tide potential (no time slitting) |
---|
98 | .OR. ln_ice_embd ) THEN ! embedded sea-ice |
---|
99 | ! |
---|
100 | DO_2D( 0, 0, 0, 0 ) |
---|
101 | spgu(ji,jj) = 0._wp |
---|
102 | spgv(ji,jj) = 0._wp |
---|
103 | END_2D |
---|
104 | ! |
---|
105 | IF( ln_apr_dyn .AND. .NOT.ln_dynspg_ts ) THEN !== Atmospheric pressure gradient (added later in time-split case) ==! |
---|
106 | zg_2 = grav * 0.5 |
---|
107 | DO_2D( 0, 0, 0, 0 ) ! gradient of Patm using inverse barometer ssh |
---|
108 | spgu(ji,jj) = spgu(ji,jj) + zg_2 * ( ssh_ib (ji+1,jj) - ssh_ib (ji,jj) & |
---|
109 | & + ssh_ibb(ji+1,jj) - ssh_ibb(ji,jj) ) * r1_e1u(ji,jj) |
---|
110 | spgv(ji,jj) = spgv(ji,jj) + zg_2 * ( ssh_ib (ji,jj+1) - ssh_ib (ji,jj) & |
---|
111 | & + ssh_ibb(ji,jj+1) - ssh_ibb(ji,jj) ) * r1_e2v(ji,jj) |
---|
112 | END_2D |
---|
113 | ENDIF |
---|
114 | ! |
---|
115 | ! !== tide potential forcing term ==! |
---|
116 | IF( .NOT.ln_dynspg_ts .AND. ( ln_tide_pot .AND. ln_tide ) ) THEN ! N.B. added directly at sub-time-step in ts-case |
---|
117 | ! |
---|
118 | ! Update tide potential at the beginning of current time step |
---|
119 | zt0step = REAL(nsec_day, wp)-0.5_wp*rn_Dt |
---|
120 | CALL upd_tide(zt0step, Kmm) |
---|
121 | ! |
---|
122 | DO_2D( 0, 0, 0, 0 ) ! add tide potential forcing |
---|
123 | spgu(ji,jj) = spgu(ji,jj) + grav * ( pot_astro(ji+1,jj) - pot_astro(ji,jj) ) * r1_e1u(ji,jj) |
---|
124 | spgv(ji,jj) = spgv(ji,jj) + grav * ( pot_astro(ji,jj+1) - pot_astro(ji,jj) ) * r1_e2v(ji,jj) |
---|
125 | END_2D |
---|
126 | ! |
---|
127 | IF (ln_scal_load) THEN |
---|
128 | zld = rn_scal_load * grav |
---|
129 | DO_2D( 0, 0, 0, 0 ) ! add scalar approximation for load potential |
---|
130 | spgu(ji,jj) = spgu(ji,jj) + zld * ( pssh(ji+1,jj,Kmm) - pssh(ji,jj,Kmm) ) * r1_e1u(ji,jj) |
---|
131 | spgv(ji,jj) = spgv(ji,jj) + zld * ( pssh(ji,jj+1,Kmm) - pssh(ji,jj,Kmm) ) * r1_e2v(ji,jj) |
---|
132 | END_2D |
---|
133 | ENDIF |
---|
134 | ENDIF |
---|
135 | ! |
---|
136 | IF( ln_ice_embd ) THEN !== embedded sea ice: Pressure gradient due to snow-ice mass ==! |
---|
137 | ALLOCATE( zpice(jpi,jpj) ) |
---|
138 | zintp = REAL( MOD( kt-1, nn_fsbc ) ) / REAL( nn_fsbc ) |
---|
139 | zgrho0r = - grav * r1_rho0 |
---|
140 | zpice(:,:) = ( zintp * snwice_mass(:,:) + ( 1.- zintp ) * snwice_mass_b(:,:) ) * zgrho0r |
---|
141 | DO_2D( 0, 0, 0, 0 ) |
---|
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) |
---|
144 | END_2D |
---|
145 | DEALLOCATE( zpice ) |
---|
146 | ENDIF |
---|
147 | ! |
---|
148 | IF( ln_wave .and. ln_bern_srfc ) THEN !== Add J terms: depth-independent Bernoulli head |
---|
149 | DO_2D( 0, 0, 0, 0 ) |
---|
150 | spgu(ji,jj) = spgu(ji,jj) + ( bhd_wave(ji+1,jj) - bhd_wave(ji,jj) ) / e1u(ji,jj) !++ bhd_wave from wave model in m2/s2 [BHD parameters in WW3] |
---|
151 | spgv(ji,jj) = spgv(ji,jj) + ( bhd_wave(ji,jj+1) - bhd_wave(ji,jj) ) / e2v(ji,jj) |
---|
152 | END_2D |
---|
153 | ENDIF |
---|
154 | ! |
---|
155 | DO_3D( 0, 0, 0, 0, 1, jpkm1 ) !== Add all terms to the general trend |
---|
156 | puu(ji,jj,jk,Krhs) = puu(ji,jj,jk,Krhs) + spgu(ji,jj) |
---|
157 | pvv(ji,jj,jk,Krhs) = pvv(ji,jj,jk,Krhs) + spgv(ji,jj) |
---|
158 | END_3D |
---|
159 | ! |
---|
160 | !!gm add here a call to dyn_trd for ice pressure gradient, the surf pressure trends ???? |
---|
161 | ! |
---|
162 | ENDIF |
---|
163 | ! |
---|
164 | SELECT CASE ( nspg ) !== surface pressure gradient computed and add to the general trend ==! |
---|
165 | CASE ( np_EXP ) ; CALL dyn_spg_exp( kt, Kmm, puu, pvv, Krhs ) ! explicit |
---|
166 | CASE ( np_TS ) ; CALL dyn_spg_ts ( kt, Kbb, Kmm, Krhs, puu, pvv, pssh, puu_b, pvv_b, Kaa ) ! time-splitting |
---|
167 | END SELECT |
---|
168 | ! |
---|
169 | IF( l_trddyn ) THEN ! save the surface pressure gradient trends for further diagnostics |
---|
170 | ztrdu(:,:,:) = puu(:,:,:,Krhs) - ztrdu(:,:,:) |
---|
171 | ztrdv(:,:,:) = pvv(:,:,:,Krhs) - ztrdv(:,:,:) |
---|
172 | CALL trd_dyn( ztrdu, ztrdv, jpdyn_spg, kt, Kmm ) |
---|
173 | DEALLOCATE( ztrdu , ztrdv ) |
---|
174 | ENDIF |
---|
175 | ! ! print mean trends (used for debugging) |
---|
176 | IF(sn_cfctl%l_prtctl) CALL prt_ctl( tab3d_1=puu(:,:,:,Krhs), clinfo1=' spg - Ua: ', mask1=umask, & |
---|
177 | & tab3d_2=pvv(:,:,:,Krhs), clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
178 | ! |
---|
179 | IF( ln_timing ) CALL timing_stop('dyn_spg') |
---|
180 | ! |
---|
181 | END SUBROUTINE dyn_spg |
---|
182 | |
---|
183 | |
---|
184 | SUBROUTINE dyn_spg_init |
---|
185 | !!--------------------------------------------------------------------- |
---|
186 | !! *** ROUTINE dyn_spg_init *** |
---|
187 | !! |
---|
188 | !! ** Purpose : Control the consistency between namelist options for |
---|
189 | !! surface pressure gradient schemes |
---|
190 | !!---------------------------------------------------------------------- |
---|
191 | INTEGER :: ioptio, ios ! local integers |
---|
192 | ! |
---|
193 | NAMELIST/namdyn_spg/ ln_dynspg_exp , ln_dynspg_ts, & |
---|
194 | & ln_bt_fw, ln_bt_av , ln_bt_auto , & |
---|
195 | & nn_e , rn_bt_cmax, nn_bt_flt, rn_bt_alpha |
---|
196 | !!---------------------------------------------------------------------- |
---|
197 | ! |
---|
198 | IF(lwp) THEN |
---|
199 | WRITE(numout,*) |
---|
200 | WRITE(numout,*) 'dyn_spg_init : choice of the surface pressure gradient scheme' |
---|
201 | WRITE(numout,*) '~~~~~~~~~~~~' |
---|
202 | ENDIF |
---|
203 | ! |
---|
204 | READ ( numnam_ref, namdyn_spg, IOSTAT = ios, ERR = 901) |
---|
205 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namdyn_spg in reference namelist' ) |
---|
206 | ! |
---|
207 | READ ( numnam_cfg, namdyn_spg, IOSTAT = ios, ERR = 902 ) |
---|
208 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namdyn_spg in configuration namelist' ) |
---|
209 | IF(lwm) WRITE ( numond, namdyn_spg ) |
---|
210 | ! |
---|
211 | IF(lwp) THEN ! Namelist print |
---|
212 | WRITE(numout,*) ' Namelist : namdyn_spg ' |
---|
213 | WRITE(numout,*) ' Explicit free surface ln_dynspg_exp = ', ln_dynspg_exp |
---|
214 | WRITE(numout,*) ' Free surface with time splitting ln_dynspg_ts = ', ln_dynspg_ts |
---|
215 | ENDIF |
---|
216 | ! ! Control of surface pressure gradient scheme options |
---|
217 | nspg = np_NO ; ioptio = 0 |
---|
218 | IF( ln_dynspg_exp ) THEN ; nspg = np_EXP ; ioptio = ioptio + 1 ; ENDIF |
---|
219 | IF( ln_dynspg_ts ) THEN ; nspg = np_TS ; ioptio = ioptio + 1 ; ENDIF |
---|
220 | ! |
---|
221 | IF( ioptio > 1 ) CALL ctl_stop( 'Choose only one surface pressure gradient scheme' ) |
---|
222 | IF( ioptio == 0 ) CALL ctl_warn( 'NO surface pressure gradient trend in momentum Eqs.' ) |
---|
223 | IF( ln_dynspg_exp .AND. ln_isfcav ) & |
---|
224 | & CALL ctl_stop( ' dynspg_exp not tested with ice shelf cavity ' ) |
---|
225 | ! |
---|
226 | IF(lwp) THEN |
---|
227 | WRITE(numout,*) |
---|
228 | IF( nspg == np_EXP ) WRITE(numout,*) ' ==>>> explicit free surface' |
---|
229 | IF( nspg == np_TS ) WRITE(numout,*) ' ==>>> free surface with time splitting scheme' |
---|
230 | IF( nspg == np_NO ) WRITE(numout,*) ' ==>>> No surface surface pressure gradient trend in momentum Eqs.' |
---|
231 | ENDIF |
---|
232 | ! |
---|
233 | IF( nspg == np_TS ) THEN ! split-explicit scheme initialisation |
---|
234 | CALL dyn_spg_ts_init ! do it first: set nn_e used to allocate some arrays later on |
---|
235 | ENDIF |
---|
236 | ! |
---|
237 | END SUBROUTINE dyn_spg_init |
---|
238 | |
---|
239 | !!====================================================================== |
---|
240 | END MODULE dynspg |
---|