1 | MODULE trcldf_crs |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE trcldf *** |
---|
4 | !! Ocean Passive tracers : lateral diffusive trends |
---|
5 | !!===================================================================== |
---|
6 | !! History : 9.0 ! 2005-11 (G. Madec) Original code |
---|
7 | !! NEMO 3.0 ! 2008-01 (C. Ethe, G. Madec) merge TRC-TRA |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | #if defined key_top |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! 'key_top' TOP models |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !!---------------------------------------------------------------------- |
---|
14 | !! trc_ldf : update the tracer trend with the lateral diffusion |
---|
15 | !! ldf_ctl : initialization, namelist read, and parameters control |
---|
16 | !!---------------------------------------------------------------------- |
---|
17 | USE oce_trc ! ocean dynamics and active tracers |
---|
18 | USE trc ! ocean passive tracers variables |
---|
19 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
20 | USE ldftra_oce ! lateral diffusion coefficient on tracers |
---|
21 | USE ldfslp ! ??? |
---|
22 | USE traldf_bilapg ! lateral mixing (tra_ldf_bilapg routine) |
---|
23 | USE traldf_bilap ! lateral mixing (tra_ldf_bilap routine) |
---|
24 | USE traldf_iso_crs ! lateral mixing (tra_ldf_iso routine) |
---|
25 | USE traldf_iso_grif ! lateral mixing (tra_ldf_iso_grif routine) |
---|
26 | USE traldf_lap_crs ! lateral mixing (tra_ldf_lap routine) |
---|
27 | USE trd_oce |
---|
28 | USE trdtra |
---|
29 | USE prtctl_trc ! Print control |
---|
30 | !USE crs |
---|
31 | USE trc_oce, ONLY : lk_offline |
---|
32 | |
---|
33 | IMPLICIT NONE |
---|
34 | PRIVATE |
---|
35 | |
---|
36 | PUBLIC trc_ldf_crs ! called by step.F90 |
---|
37 | ! !!: ** lateral mixing namelist (nam_trcldf) ** |
---|
38 | REAL(wp) :: rldf_rat ! ratio between active and passive tracers diffusive coefficient |
---|
39 | INTEGER :: nldf = 0 ! type of lateral diffusion used defined from ln_trcldf_... namlist logicals) |
---|
40 | !! * Substitutions |
---|
41 | # include "domzgr_substitute.h90" |
---|
42 | # include "vectopt_loop_substitute.h90" |
---|
43 | !!---------------------------------------------------------------------- |
---|
44 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
45 | !! $Id: trcldf.F90 3294 2012-01-28 16:44:18Z rblod $ |
---|
46 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
47 | !!---------------------------------------------------------------------- |
---|
48 | |
---|
49 | CONTAINS |
---|
50 | |
---|
51 | SUBROUTINE trc_ldf_crs( kt ) |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | !! *** ROUTINE tra_ldf *** |
---|
54 | !! |
---|
55 | !! ** Purpose : compute the lateral ocean tracer physics. |
---|
56 | !! |
---|
57 | !!---------------------------------------------------------------------- |
---|
58 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
59 | !! |
---|
60 | INTEGER :: jn |
---|
61 | CHARACTER (len=22) :: charout |
---|
62 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd |
---|
63 | !!---------------------------------------------------------------------- |
---|
64 | ! |
---|
65 | IF( nn_timing == 1 ) CALL timing_start('trc_ldf') |
---|
66 | ! |
---|
67 | IF( kt == nittrc000 ) CALL ldf_ctl ! initialisation & control of options |
---|
68 | |
---|
69 | rldf = rldf_rat |
---|
70 | |
---|
71 | IF( l_trdtrc ) THEN |
---|
72 | CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
73 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
74 | ENDIF |
---|
75 | |
---|
76 | ! WRITE(numout,*) 'nldf', nldf |
---|
77 | SELECT CASE ( nldf ) ! compute lateral mixing trend and add it to the general trend |
---|
78 | CASE ( 0 ) ; CALL tra_ldf_lap_crs ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra ) ! iso-level laplacian |
---|
79 | CASE ( 1 ) ! rotated laplacian |
---|
80 | IF( ln_traldf_grif ) THEN |
---|
81 | CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) |
---|
82 | ELSE |
---|
83 | CALL tra_ldf_iso_crs ( kt, nittrc000, 'TRC', gtru ,gtrv , trb, tra, jptra, rn_ahtb_0 ) |
---|
84 | ENDIF |
---|
85 | CASE ( 2 ) ; CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra ) ! iso-level bilaplacian |
---|
86 | CASE ( 3 ) ; CALL tra_ldf_bilapg( kt, nittrc000, 'TRC', trb, tra, jptra ) ! s-coord. horizontal bilaplacian |
---|
87 | ! |
---|
88 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
89 | CALL tra_ldf_lap_crs ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra ) |
---|
90 | WRITE(charout, FMT="('ldf0 ')") ; CALL prt_ctl_trc_info(charout) |
---|
91 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
92 | IF( ln_traldf_grif ) THEN |
---|
93 | CALL tra_ldf_iso_grif( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) |
---|
94 | ELSE |
---|
95 | CALL tra_ldf_iso_crs ( kt, nittrc000, 'TRC', gtru, gtrv, trb, tra, jptra, rn_ahtb_0 ) |
---|
96 | ENDIF |
---|
97 | WRITE(charout, FMT="('ldf1 ')") ; CALL prt_ctl_trc_info(charout) |
---|
98 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
99 | CALL tra_ldf_bilap ( kt, nittrc000, 'TRC', gtru, gtrv, gtrui, gtrvi, trb, tra, jptra ) |
---|
100 | WRITE(charout, FMT="('ldf2 ')") ; CALL prt_ctl_trc_info(charout) |
---|
101 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
102 | CALL tra_ldf_bilapg( kt, nittrc000, 'TRC', trb, tra, jptra ) |
---|
103 | WRITE(charout, FMT="('ldf3 ')") ; CALL prt_ctl_trc_info(charout) |
---|
104 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
105 | END SELECT |
---|
106 | ! |
---|
107 | IF( l_trdtrc ) THEN ! save the horizontal diffusive trends for further diagnostics |
---|
108 | DO jn = 1, jptra |
---|
109 | ztrtrd(:,:,:,jn) = tra(:,:,:,jn) - ztrtrd(:,:,:,jn) |
---|
110 | CALL trd_tra( kt, 'TRC', jn, jptra_ldf, ztrtrd(:,:,:,jn) ) |
---|
111 | END DO |
---|
112 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
113 | ENDIF |
---|
114 | ! ! print mean trends (used for debugging) |
---|
115 | IF( ln_ctl ) THEN |
---|
116 | WRITE(charout, FMT="('ldf ')") ; CALL prt_ctl_trc_info(charout) |
---|
117 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
118 | ENDIF |
---|
119 | ! |
---|
120 | IF( nn_timing == 1 ) CALL timing_stop('trc_ldf') |
---|
121 | ! |
---|
122 | END SUBROUTINE trc_ldf_crs |
---|
123 | |
---|
124 | |
---|
125 | SUBROUTINE ldf_ctl |
---|
126 | !!---------------------------------------------------------------------- |
---|
127 | !! *** ROUTINE ldf_ctl *** |
---|
128 | !! |
---|
129 | !! ** Purpose : Choice of the operator for the lateral tracer diffusion |
---|
130 | !! |
---|
131 | !! ** Method : set nldf from the namtra_ldf logicals |
---|
132 | !! nldf == -2 No lateral diffusion |
---|
133 | !! nldf == -1 ESOPA test: ALL operators are used |
---|
134 | !! nldf == 0 laplacian operator |
---|
135 | !! nldf == 1 Rotated laplacian operator |
---|
136 | !! nldf == 2 bilaplacian operator |
---|
137 | !! nldf == 3 Rotated bilaplacian |
---|
138 | !!---------------------------------------------------------------------- |
---|
139 | INTEGER :: ioptio, ierr ! temporary integers |
---|
140 | !!---------------------------------------------------------------------- |
---|
141 | |
---|
142 | IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN |
---|
143 | ! IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN !! cc |
---|
144 | ! rldf_rat = 1.0_wp |
---|
145 | ! ELSE |
---|
146 | ! CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) |
---|
147 | ! END IF |
---|
148 | rldf_rat = 1.0_wp !!cc |
---|
149 | ELSE |
---|
150 | rldf_rat = rn_ahtrc_0 / rn_aht_0 |
---|
151 | END IF |
---|
152 | ! Define the lateral mixing oparator for tracers |
---|
153 | ! =============================================== |
---|
154 | |
---|
155 | ! ! control the input |
---|
156 | ioptio = 0 |
---|
157 | IF( ln_trcldf_lap ) ioptio = ioptio + 1 |
---|
158 | IF( ln_trcldf_bilap ) ioptio = ioptio + 1 |
---|
159 | IF( ioptio > 1 ) CALL ctl_stop( ' use ONE or NONE of the 2 lap/bilap operator type on tracer' ) |
---|
160 | IF( ioptio == 0 ) nldf = -2 ! No lateral diffusion |
---|
161 | ioptio = 0 |
---|
162 | IF( ln_trcldf_level ) ioptio = ioptio + 1 |
---|
163 | IF( ln_trcldf_hor ) ioptio = ioptio + 1 |
---|
164 | IF( ln_trcldf_iso ) ioptio = ioptio + 1 |
---|
165 | IF( ioptio /= 1 ) CALL ctl_stop( ' use only ONE direction (level/hor/iso)' ) |
---|
166 | |
---|
167 | ! defined the type of lateral diffusion from ln_trcldf_... logicals |
---|
168 | ! CAUTION : nldf = 1 is used in trazdf_imp, change it carefully |
---|
169 | ierr = 0 |
---|
170 | IF( ln_trcldf_lap ) THEN ! laplacian operator |
---|
171 | IF ( ln_zco ) THEN ! z-coordinate |
---|
172 | IF ( ln_trcldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
173 | IF ( ln_trcldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
174 | IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
175 | ENDIF |
---|
176 | IF ( ln_zps ) THEN ! z-coordinate |
---|
177 | IF ( ln_trcldf_level ) ierr = 1 ! iso-level not allowed |
---|
178 | IF ( ln_trcldf_hor ) nldf = 0 ! horizontal (no rotation) |
---|
179 | IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
180 | ENDIF |
---|
181 | IF ( ln_sco ) THEN ! z-coordinate |
---|
182 | IF ( ln_trcldf_level ) nldf = 0 ! iso-level (no rotation) |
---|
183 | IF ( ln_trcldf_hor ) nldf = 1 ! horizontal ( rotation) |
---|
184 | IF ( ln_trcldf_iso ) nldf = 1 ! isoneutral ( rotation) |
---|
185 | ENDIF |
---|
186 | ENDIF |
---|
187 | |
---|
188 | IF( ln_trcldf_bilap ) THEN ! bilaplacian operator |
---|
189 | IF ( ln_zco ) THEN ! z-coordinate |
---|
190 | IF ( ln_trcldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
191 | IF ( ln_trcldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
192 | IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
193 | ENDIF |
---|
194 | IF ( ln_zps ) THEN ! z-coordinate |
---|
195 | IF ( ln_trcldf_level ) ierr = 1 ! iso-level not allowed |
---|
196 | IF ( ln_trcldf_hor ) nldf = 2 ! horizontal (no rotation) |
---|
197 | IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
198 | ENDIF |
---|
199 | IF ( ln_sco ) THEN ! z-coordinate |
---|
200 | IF ( ln_trcldf_level ) nldf = 2 ! iso-level (no rotation) |
---|
201 | IF ( ln_trcldf_hor ) nldf = 3 ! horizontal ( rotation) |
---|
202 | IF ( ln_trcldf_iso ) ierr = 2 ! isoneutral ( rotation) |
---|
203 | ENDIF |
---|
204 | ENDIF |
---|
205 | |
---|
206 | IF( ierr == 1 ) CALL ctl_stop( ' iso-level in z-coordinate - partial step, not allowed' ) |
---|
207 | IF( ierr == 2 ) CALL ctl_stop( ' isoneutral bilaplacian operator does not exist' ) |
---|
208 | IF( lk_traldf_eiv .AND. .NOT.ln_trcldf_iso ) & |
---|
209 | CALL ctl_stop( ' eddy induced velocity on tracers', & |
---|
210 | & ' the eddy induced velocity on tracers requires isopycnal laplacian diffusion' ) |
---|
211 | IF( nldf == 1 .OR. nldf == 3 ) THEN ! rotation |
---|
212 | IF( .NOT.lk_ldfslp ) CALL ctl_stop( ' the rotation of the diffusive tensor require key_ldfslp' ) |
---|
213 | #if defined key_offline |
---|
214 | l_traldf_rot = .TRUE. ! needed for trazdf_imp |
---|
215 | #endif |
---|
216 | ENDIF |
---|
217 | |
---|
218 | IF( lk_esopa ) THEN |
---|
219 | IF(lwp) WRITE(numout,*) ' esopa control: use all lateral physics options' |
---|
220 | nldf = -1 |
---|
221 | ENDIF |
---|
222 | |
---|
223 | IF(lwp) THEN |
---|
224 | WRITE(numout,*) |
---|
225 | IF( nldf == -2 ) WRITE(numout,*) ' NO lateral diffusion' |
---|
226 | IF( nldf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
227 | IF( nldf == 0 ) WRITE(numout,*) ' laplacian operator' |
---|
228 | IF( nldf == 1 ) WRITE(numout,*) ' Rotated laplacian operator' |
---|
229 | IF( nldf == 2 ) WRITE(numout,*) ' bilaplacian operator' |
---|
230 | IF( nldf == 3 ) WRITE(numout,*) ' Rotated bilaplacian' |
---|
231 | ENDIF |
---|
232 | |
---|
233 | IF( ln_trcldf_bilap ) THEN |
---|
234 | IF(lwp) WRITE(numout,*) ' biharmonic tracer diffusion' |
---|
235 | IF( rn_ahtrc_0 > 0 .AND. .NOT. lk_esopa ) CALL ctl_stop( 'The horizontal diffusivity coef. rn_ahtrc_0 must be negative' ) |
---|
236 | ELSE |
---|
237 | IF(lwp) WRITE(numout,*) ' harmonic tracer diffusion (default)' |
---|
238 | IF( rn_ahtrc_0 < 0 .AND. .NOT. lk_esopa ) CALL ctl_stop('The horizontal diffusivity coef. rn_ahtrc_0 must be positive' ) |
---|
239 | ENDIF |
---|
240 | |
---|
241 | ! ratio between active and passive tracers diffusive coef. |
---|
242 | IF (ABS(rn_aht_0) < 2._wp*TINY(1.e0)) THEN |
---|
243 | ! IF (ABS(rn_ahtrc_0) < 2._wp*TINY(1.e0)) THEN !!cc |
---|
244 | ! rldf_rat = 1.0_wp |
---|
245 | ! ELSE |
---|
246 | ! CALL ctl_stop( 'STOP', 'ldf_ctl : cannot define rldf_rat, rn_aht_0==0, rn_ahtrc_0 /=0' ) |
---|
247 | ! END IF |
---|
248 | rldf_rat = 1.0_wp !!cc |
---|
249 | ELSE |
---|
250 | rldf_rat = rn_ahtrc_0 / rn_aht_0 |
---|
251 | END IF |
---|
252 | IF( rldf_rat < 0 ) THEN |
---|
253 | IF( .NOT.lk_offline ) THEN |
---|
254 | CALL ctl_stop( 'Choose the same type of diffusive scheme both for active & passive tracers' ) |
---|
255 | ELSE |
---|
256 | CALL ctl_stop( 'Change the sign of rn_aht_0 in namelist to -/+1' ) |
---|
257 | ENDIF |
---|
258 | ENDIF |
---|
259 | ! |
---|
260 | END SUBROUTINE ldf_ctl |
---|
261 | #else |
---|
262 | !!---------------------------------------------------------------------- |
---|
263 | !! Default option Empty module |
---|
264 | !!---------------------------------------------------------------------- |
---|
265 | CONTAINS |
---|
266 | SUBROUTINE trc_ldf_crs( kt ) |
---|
267 | INTEGER, INTENT(in) :: kt |
---|
268 | WRITE(*,*) 'trc_ldf: You should not have seen this print! error?', kt |
---|
269 | END SUBROUTINE trc_ldf_crs |
---|
270 | #endif |
---|
271 | !!====================================================================== |
---|
272 | END MODULE trcldf_crs |
---|