1 | MODULE dynldf |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE dynldf *** |
---|
4 | !! Ocean physics: lateral diffusivity trends |
---|
5 | !!===================================================================== |
---|
6 | !! History : 9.0 ! 05-11 (G. Madec) Original code (new step architecture) |
---|
7 | !!---------------------------------------------------------------------- |
---|
8 | |
---|
9 | !!---------------------------------------------------------------------- |
---|
10 | !! dyn_ldf : update the dynamics trend with the lateral diffusion |
---|
11 | !! dyn_ldf_init : initialization, namelist read, and parameters control |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | USE oce ! ocean dynamics and tracers |
---|
14 | USE dom_oce ! ocean space and time domain |
---|
15 | USE phycst ! physical constants |
---|
16 | USE ldfdyn_oce ! ocean dynamics lateral physics |
---|
17 | USE ldftra_oce ! ocean tracers lateral physics |
---|
18 | USE ldfslp ! lateral mixing: slopes of mixing orientation |
---|
19 | USE dynldf_bilapg ! lateral mixing (dyn_ldf_bilapg routine) |
---|
20 | USE dynldf_bilap ! lateral mixing (dyn_ldf_bilap routine) |
---|
21 | USE dynldf_iso ! lateral mixing (dyn_ldf_iso routine) |
---|
22 | USE dynldf_lap ! lateral mixing (dyn_ldf_lap routine) |
---|
23 | USE trd_oce ! trends: ocean variables |
---|
24 | USE trddyn ! trend manager: dynamics (trd_dyn routine) |
---|
25 | ! |
---|
26 | USE prtctl ! Print control |
---|
27 | USE in_out_manager ! I/O manager |
---|
28 | USE lib_mpp ! distribued memory computing library |
---|
29 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
30 | USE wrk_nemo ! Memory Allocation |
---|
31 | USE timing ! Timing |
---|
32 | |
---|
33 | IMPLICIT NONE |
---|
34 | PRIVATE |
---|
35 | |
---|
36 | PUBLIC dyn_ldf ! called by step module |
---|
37 | PUBLIC dyn_ldf_init ! called by opa module |
---|
38 | |
---|
39 | INTEGER :: nldf = -2 ! type of lateral diffusion used defined from ln_dynldf_... namlist logicals) |
---|
40 | |
---|
41 | !! * Substitutions |
---|
42 | # include "domzgr_substitute.h90" |
---|
43 | # include "vectopt_loop_substitute.h90" |
---|
44 | !!---------------------------------------------------------------------- |
---|
45 | !! NEMO/OPA 3.3 , NEMO Consortium (2010) |
---|
46 | !! $Id$ |
---|
47 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | CONTAINS |
---|
50 | |
---|
51 | SUBROUTINE dyn_ldf( kt ) |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | !! *** ROUTINE dyn_ldf *** |
---|
54 | !! |
---|
55 | !! ** Purpose : compute the lateral ocean dynamics physics. |
---|
56 | !!---------------------------------------------------------------------- |
---|
57 | INTEGER, INTENT(in) :: kt ! ocean time-step index |
---|
58 | ! |
---|
59 | REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdu, ztrdv |
---|
60 | REAL(wp), POINTER, DIMENSION(:,:) :: ztmp |
---|
61 | INTEGER :: ji,jj |
---|
62 | !!---------------------------------------------------------------------- |
---|
63 | ! |
---|
64 | IF( nn_timing == 1 ) CALL timing_start('dyn_ldf') |
---|
65 | ! |
---|
66 | IF( l_trddyn ) THEN ! temporary save of ta and sa trends |
---|
67 | CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv ) |
---|
68 | ztrdu(:,:,:) = ua(:,:,:) |
---|
69 | ztrdv(:,:,:) = va(:,:,:) |
---|
70 | ENDIF |
---|
71 | |
---|
72 | SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend |
---|
73 | ! |
---|
74 | CASE ( 0 ) ; CALL dyn_ldf_lap ( kt ) ! iso-level laplacian |
---|
75 | CASE ( 1 ) |
---|
76 | CALL dyn_ldf_iso ( kt ) ! rotated laplacian (except dk[ dk[.] ] part) |
---|
77 | #ifdef key_dynldf_c2d |
---|
78 | IF (kt == nit000) CALL iom_put("ahmt_lap", ahm1) |
---|
79 | #endif |
---|
80 | CASE ( 2 ) |
---|
81 | CALL dyn_ldf_bilap ( kt ) ! iso-level bilaplacian |
---|
82 | #ifdef key_dynldf_c2d |
---|
83 | !Average ahm3 and ahm4 onto T points and output for CMIP6 diagnostics |
---|
84 | IF(kt == nit000) THEN |
---|
85 | CALL wrk_alloc(jpi, jpj, ztmp) |
---|
86 | DO jj=2,jpj |
---|
87 | DO ji=2,jpi |
---|
88 | ztmp(ji,jj) = (ahm3(ji,jj)*umask(ji,jj,1) + ahm3(ji-1,jj)*umask(ji-1,jj,1) & |
---|
89 | + ahm4(ji,jj)*vmask(ji,jj,1) + ahm4(ji,jj-1)*vmask(ji,jj-1,1)) / & |
---|
90 | & (umask(ji,jj,1) + umask(ji-1,jj,1) + vmask(ji,jj,1) + vmask(ji,jj-1,1)) |
---|
91 | ENDDO |
---|
92 | ENDDO |
---|
93 | CALL iom_put("ahmt_blb", ztmp) |
---|
94 | CALL wrk_dealloc(jpi, jpj, ztmp) |
---|
95 | ENDIF |
---|
96 | #endif |
---|
97 | CASE ( 3 ) ; CALL dyn_ldf_bilapg ( kt ) ! s-coord. horizontal bilaplacian |
---|
98 | CASE ( 4 ) ! iso-level laplacian + bilaplacian |
---|
99 | CALL dyn_ldf_lap ( kt ) |
---|
100 | CALL dyn_ldf_bilap ( kt ) |
---|
101 | CASE ( 5 ) ! rotated laplacian + bilaplacian (s-coord) |
---|
102 | CALL dyn_ldf_iso ( kt ) |
---|
103 | CALL dyn_ldf_bilapg ( kt ) |
---|
104 | ! |
---|
105 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
106 | CALL dyn_ldf_lap ( kt ) |
---|
107 | CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf0 - Ua: ', mask1=umask, & |
---|
108 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
109 | CALL dyn_ldf_iso ( kt ) |
---|
110 | CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf1 - Ua: ', mask1=umask, & |
---|
111 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
112 | CALL dyn_ldf_bilap ( kt ) |
---|
113 | CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf2 - Ua: ', mask1=umask, & |
---|
114 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
115 | CALL dyn_ldf_bilapg ( kt ) |
---|
116 | CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf3 - Ua: ', mask1=umask, & |
---|
117 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
118 | ! |
---|
119 | CASE ( -2 ) ! neither laplacian nor bilaplacian schemes used |
---|
120 | IF( kt == nit000 ) THEN |
---|
121 | IF(lwp) WRITE(numout,*) |
---|
122 | IF(lwp) WRITE(numout,*) 'dyn_ldf : no lateral diffusion on momentum setup' |
---|
123 | IF(lwp) WRITE(numout,*) '~~~~~~~ ' |
---|
124 | ENDIF |
---|
125 | END SELECT |
---|
126 | |
---|
127 | IF( l_trddyn ) THEN ! save the horizontal diffusive trends for further diagnostics |
---|
128 | ztrdu(:,:,:) = ua(:,:,:) - ztrdu(:,:,:) |
---|
129 | ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:) |
---|
130 | CALL trd_dyn( ztrdu, ztrdv, jpdyn_ldf, kt ) |
---|
131 | CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv ) |
---|
132 | ENDIF |
---|
133 | ! ! print sum trends (used for debugging) |
---|
134 | IF(ln_ctl) CALL prt_ctl( tab3d_1=ua, clinfo1=' ldf - Ua: ', mask1=umask, & |
---|
135 | & tab3d_2=va, clinfo2= ' Va: ', mask2=vmask, clinfo3='dyn' ) |
---|
136 | ! |
---|
137 | IF( nn_timing == 1 ) CALL timing_stop('dyn_ldf') |
---|
138 | ! |
---|
139 | END SUBROUTINE dyn_ldf |
---|
140 | |
---|
141 | |
---|
142 | SUBROUTINE dyn_ldf_init |
---|
143 | !!---------------------------------------------------------------------- |
---|
144 | !! *** ROUTINE dyn_ldf_init *** |
---|
145 | !! |
---|
146 | !! ** Purpose : initializations of the horizontal ocean dynamics physics |
---|
147 | !!---------------------------------------------------------------------- |
---|
148 | INTEGER :: ioptio, ierr ! temporary integers |
---|
149 | !!---------------------------------------------------------------------- |
---|
150 | |
---|
151 | ! ! Namelist nam_dynldf: already read in ldfdyn module |
---|
152 | |
---|
153 | IF(lwp) THEN ! Namelist print |
---|
154 | WRITE(numout,*) |
---|
155 | WRITE(numout,*) 'dyn_ldf_init : Choice of the lateral diffusive operator on dynamics' |
---|
156 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
157 | WRITE(numout,*) ' Namelist nam_dynldf : set lateral mixing parameters (type, direction, coefficients)' |
---|
158 | WRITE(numout,*) ' laplacian operator ln_dynldf_lap = ', ln_dynldf_lap |
---|
159 | WRITE(numout,*) ' bilaplacian operator ln_dynldf_bilap = ', ln_dynldf_bilap |
---|
160 | WRITE(numout,*) ' iso-level ln_dynldf_level = ', ln_dynldf_level |
---|
161 | WRITE(numout,*) ' horizontal (geopotential) ln_dynldf_hor = ', ln_dynldf_hor |
---|
162 | WRITE(numout,*) ' iso-neutral ln_dynldf_iso = ', ln_dynldf_iso |
---|
163 | ENDIF |
---|
164 | |
---|
165 | ! ! control the consistency |
---|
166 | ioptio = 0 |
---|
167 | IF( ln_dynldf_lap ) ioptio = ioptio + 1 |
---|
168 | IF( ln_dynldf_bilap ) ioptio = ioptio + 1 |
---|
169 | IF( ioptio < 1 ) CALL ctl_warn( ' neither laplacian nor bilaplacian operator set for dynamics' ) |
---|
170 | ioptio = 0 |
---|
171 | IF( ln_dynldf_level ) ioptio = ioptio + 1 |
---|
172 | IF( ln_dynldf_hor ) ioptio = ioptio + 1 |
---|
173 | IF( ln_dynldf_iso ) ioptio = ioptio + 1 |
---|
174 | IF( ioptio > 1 ) CALL ctl_stop( ' use only ONE direction (level/hor/iso)' ) |
---|
175 | |
---|
176 | IF( ln_dynldf_iso .AND. ln_traldf_hor ) CALL ctl_stop & |
---|
177 | & ( 'Not sensible to use geopotential diffusion for tracers with isoneutral diffusion for dynamics' ) |
---|
178 | |
---|
179 | ! ! Set nldf, the type of lateral diffusion, from ln_dynldf_... logicals |
---|
180 | ierr = 0 |
---|
181 | IF ( ln_dynldf_lap ) THEN ! laplacian operator |
---|
182 | IF ( ln_zco ) THEN ! z-coordinate |
---|
183 | IF ( ln_dynldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
184 | IF ( ln_dynldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
185 | IF ( ln_dynldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
186 | ENDIF |
---|
187 | IF ( ln_zps ) THEN ! z-coordinate |
---|
188 | IF ( ln_dynldf_level ) ierr = 1 ! iso-level not allowed |
---|
189 | IF ( ln_dynldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
190 | IF ( ln_dynldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
191 | ENDIF |
---|
192 | IF ( ln_sco ) THEN ! s-coordinate |
---|
193 | IF ( ln_dynldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
194 | IF ( ln_dynldf_hor ) nldf = 1 ! horizontal ( rotation) |
---|
195 | IF ( ln_dynldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
196 | ENDIF |
---|
197 | ENDIF |
---|
198 | |
---|
199 | IF( ln_dynldf_bilap ) THEN ! bilaplacian operator |
---|
200 | IF ( ln_zco ) THEN ! z-coordinate |
---|
201 | IF ( ln_dynldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
202 | IF ( ln_dynldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
203 | IF ( ln_dynldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
204 | ENDIF |
---|
205 | IF ( ln_zps ) THEN ! z-coordinate |
---|
206 | IF ( ln_dynldf_level ) ierr = 1 ! iso-level not allowed |
---|
207 | IF ( ln_dynldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
208 | IF ( ln_dynldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
209 | ENDIF |
---|
210 | IF ( ln_sco ) THEN ! s-coordinate |
---|
211 | IF ( ln_dynldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
212 | IF ( ln_dynldf_hor ) nldf = 3 ! horizontal ( rotation) |
---|
213 | IF ( ln_dynldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
214 | ENDIF |
---|
215 | ENDIF |
---|
216 | |
---|
217 | IF( ln_dynldf_lap .AND. ln_dynldf_bilap ) THEN ! mixed laplacian and bilaplacian operators |
---|
218 | IF ( ln_zco ) THEN ! z-coordinate |
---|
219 | IF ( ln_dynldf_level ) nldf = 4 ! iso-level (no rotation) |
---|
220 | IF ( ln_dynldf_hor ) nldf = 4 ! horizontal (no rotation) |
---|
221 | IF ( ln_dynldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
222 | ENDIF |
---|
223 | IF ( ln_zps ) THEN ! z-coordinate |
---|
224 | IF ( ln_dynldf_level ) ierr = 1 ! iso-level not allowed |
---|
225 | IF ( ln_dynldf_hor ) nldf = 4 ! horizontal (no rotation) |
---|
226 | IF ( ln_dynldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
227 | ENDIF |
---|
228 | IF ( ln_sco ) THEN ! s-coordinate |
---|
229 | IF ( ln_dynldf_level ) nldf = 4 ! iso-level (no rotation) |
---|
230 | IF ( ln_dynldf_hor ) nldf = 5 ! horizontal ( rotation) |
---|
231 | IF ( ln_dynldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
232 | ENDIF |
---|
233 | ENDIF |
---|
234 | |
---|
235 | IF( lk_esopa ) nldf = -1 ! esopa test |
---|
236 | |
---|
237 | IF( ierr == 1 ) CALL ctl_stop( 'iso-level in z-coordinate - partial step, not allowed' ) |
---|
238 | IF( ierr == 2 ) CALL ctl_stop( 'isoneutral bilaplacian operator does not exist' ) |
---|
239 | IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation |
---|
240 | IF( .NOT.lk_ldfslp ) CALL ctl_stop( 'the rotation of the diffusive tensor require key_ldfslp' ) |
---|
241 | ENDIF |
---|
242 | |
---|
243 | IF(lwp) THEN |
---|
244 | WRITE(numout,*) |
---|
245 | IF( nldf == -2 ) WRITE(numout,*) ' neither laplacian nor bilaplacian schemes used' |
---|
246 | IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
247 | IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' |
---|
248 | IF( nldf == 1 ) WRITE(numout,*) ' rotated laplacian operator' |
---|
249 | IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' |
---|
250 | IF( nldf == 3 ) WRITE(numout,*) ' rotated bilaplacian' |
---|
251 | IF( nldf == 4 ) WRITE(numout,*) ' laplacian and bilaplacian operators' |
---|
252 | IF( nldf == 5 ) WRITE(numout,*) ' rotated laplacian and bilaplacian operators' |
---|
253 | ENDIF |
---|
254 | ! |
---|
255 | END SUBROUTINE dyn_ldf_init |
---|
256 | |
---|
257 | !!====================================================================== |
---|
258 | END MODULE dynldf |
---|