1 | MODULE trazdf |
---|
2 | !!============================================================================== |
---|
3 | !! *** MODULE trazdf *** |
---|
4 | !! Ocean active tracers: vertical component of the tracer mixing trend |
---|
5 | !!============================================================================== |
---|
6 | !! History : 9.0 ! 05-11 (G. Madec) Original code |
---|
7 | !!---------------------------------------------------------------------- |
---|
8 | |
---|
9 | !!---------------------------------------------------------------------- |
---|
10 | !! tra_zdf : Update the tracer trend with the vertical diffusion |
---|
11 | !! zdf_ctl : ??? |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | USE oce ! ocean dynamics and tracers variables |
---|
14 | USE dom_oce ! ocean space and time domain variables |
---|
15 | USE zdf_oce ! ocean vertical physics variables |
---|
16 | USE sbc_oce ! surface boundary condition: ocean |
---|
17 | USE dynspg_oce |
---|
18 | |
---|
19 | USE trazdf_exp ! vertical diffusion: explicit (tra_zdf_exp routine) |
---|
20 | USE trazdf_imp ! vertical diffusion: implicit (tra_zdf_imp routine) |
---|
21 | USE trazdf_imp_jki ! vertical diffusion implicit (tra_zdf_imp_jki routine) |
---|
22 | |
---|
23 | USE ldftra_oce ! ocean active tracers: lateral physics |
---|
24 | USE trdmod ! ocean active tracers trends |
---|
25 | USE trdmod_oce ! ocean variables trends |
---|
26 | USE in_out_manager ! I/O manager |
---|
27 | USE prtctl ! Print control |
---|
28 | |
---|
29 | USE phycst |
---|
30 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
31 | USE domvvl ! variable volume |
---|
32 | |
---|
33 | IMPLICIT NONE |
---|
34 | PRIVATE |
---|
35 | |
---|
36 | PUBLIC tra_zdf ! routine called by step.F90 |
---|
37 | |
---|
38 | INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used |
---|
39 | ! ! defined from ln_zdf... namlist logicals) |
---|
40 | |
---|
41 | REAL(wp), DIMENSION(jpk) :: r2dt ! vertical profile time-step, = 2 rdttra |
---|
42 | ! ! except at nit000 (=rdttra) if neuler=0 |
---|
43 | |
---|
44 | !! * Substitutions |
---|
45 | # include "domzgr_substitute.h90" |
---|
46 | # include "zdfddm_substitute.h90" |
---|
47 | # include "vectopt_loop_substitute.h90" |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | !! OPA 9.0 , LOCEAN-IPSL (2005) |
---|
50 | !! $Id$ |
---|
51 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | |
---|
54 | CONTAINS |
---|
55 | |
---|
56 | SUBROUTINE tra_zdf( kt ) |
---|
57 | !!---------------------------------------------------------------------- |
---|
58 | !! *** ROUTINE tra_zdf *** |
---|
59 | !! |
---|
60 | !! ** Purpose : compute the vertical ocean tracer physics. |
---|
61 | !!--------------------------------------------------------------------- |
---|
62 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
63 | |
---|
64 | INTEGER :: jk ! Dummy loop indices |
---|
65 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: ztrdt, ztrds ! 3D workspace |
---|
66 | !!--------------------------------------------------------------------- |
---|
67 | |
---|
68 | IF( kt == nit000 ) CALL zdf_ctl ! initialisation & control of options |
---|
69 | |
---|
70 | ! ! set time step |
---|
71 | IF( neuler == 0 .AND. kt == nit000 ) THEN ! at nit000 |
---|
72 | r2dt(:) = rdttra(:) ! = rdtra (restarting with Euler time stepping) |
---|
73 | ELSEIF( kt <= nit000 + 1) THEN ! at nit000 or nit000+1 |
---|
74 | r2dt(:) = 2. * rdttra(:) ! = 2 rdttra (leapfrog) |
---|
75 | ENDIF |
---|
76 | |
---|
77 | IF( l_trdtra ) THEN ! temporary save of ta and sa trends |
---|
78 | ztrdt(:,:,:) = ta(:,:,:) |
---|
79 | ztrds(:,:,:) = sa(:,:,:) |
---|
80 | ENDIF |
---|
81 | |
---|
82 | IF( lk_vvl ) CALL dom_vvl_ssh( kt ) ! compute ssha field |
---|
83 | |
---|
84 | SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend |
---|
85 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
86 | CALL tra_zdf_exp ( kt, r2dt ) |
---|
87 | CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf0 - Ta: ', mask1=tmask, & |
---|
88 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
89 | CALL tra_zdf_imp ( kt, r2dt ) |
---|
90 | CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf1 - Ta: ', mask1=tmask, & |
---|
91 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
92 | CALL tra_zdf_imp_jki( kt, r2dt ) |
---|
93 | CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf2 - Ta: ', mask1=tmask, & |
---|
94 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
95 | |
---|
96 | CASE ( 0 ) ! explicit scheme |
---|
97 | CALL tra_zdf_exp ( kt, r2dt ) |
---|
98 | IF( l_trdtra ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
99 | ztrdt(:,:,:) = ta(:,:,:) - ztrdt(:,:,:) |
---|
100 | ztrds(:,:,:) = sa(:,:,:) - ztrds(:,:,:) |
---|
101 | CALL trd_mod( ztrdt, ztrds, jptra_trd_zdf, 'TRA', kt ) |
---|
102 | ENDIF |
---|
103 | |
---|
104 | CASE ( 1 ) ! implicit scheme (k-j-i loop) |
---|
105 | CALL tra_zdf_imp ( kt, r2dt ) |
---|
106 | IF( l_trdtra ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
107 | DO jk = 1, jpkm1 |
---|
108 | ztrdt(:,:,jk) = ( ( ta(:,:,jk) - tb(:,:,jk) ) / r2dt(jk) ) - ztrdt(:,:,jk) |
---|
109 | ztrds(:,:,jk) = ( ( sa(:,:,jk) - sb(:,:,jk) ) / r2dt(jk) ) - ztrds(:,:,jk) |
---|
110 | END DO |
---|
111 | CALL trd_mod( ztrdt, ztrds, jptra_trd_zdf, 'TRA', kt ) |
---|
112 | ENDIF |
---|
113 | |
---|
114 | CASE ( 2 ) ! implicit scheme (j-k-i loop) |
---|
115 | CALL tra_zdf_imp_jki( kt, r2dt ) |
---|
116 | IF( l_trdtra ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
117 | DO jk = 1, jpkm1 |
---|
118 | ztrdt(:,:,jk) = ( ( ta(:,:,jk) - tb(:,:,jk) ) / r2dt(jk) ) - ztrdt(:,:,jk) |
---|
119 | ztrds(:,:,jk) = ( ( sa(:,:,jk) - sb(:,:,jk) ) / r2dt(jk) ) - ztrds(:,:,jk) |
---|
120 | END DO |
---|
121 | CALL trd_mod( ztrdt, ztrds, jptra_trd_zdf, 'TRA', kt ) |
---|
122 | ENDIF |
---|
123 | |
---|
124 | END SELECT |
---|
125 | |
---|
126 | ! ! print mean trends (used for debugging) |
---|
127 | IF(ln_ctl) CALL prt_ctl( tab3d_1=ta, clinfo1=' zdf - Ta: ', mask1=tmask, & |
---|
128 | & tab3d_2=sa, clinfo2= ' Sa: ', mask2=tmask, clinfo3='tra' ) |
---|
129 | |
---|
130 | END SUBROUTINE tra_zdf |
---|
131 | |
---|
132 | |
---|
133 | SUBROUTINE zdf_ctl |
---|
134 | !!---------------------------------------------------------------------- |
---|
135 | !! *** ROUTINE zdf_ctl *** |
---|
136 | !! |
---|
137 | !! ** Purpose : Choose the vertical mixing scheme |
---|
138 | !! |
---|
139 | !! ** Method : Set nzdf from ln_zdfexp and 'key_mpp_omp'. |
---|
140 | !! nzdf = 0 explicit (time-splitting) scheme (ln_zdfexp=T) |
---|
141 | !! = 1 implicit (euler backward) scheme (ln_zdfexp=F) |
---|
142 | !! = 2 implicit (euler backward) scheme with j-k-i loops |
---|
143 | !! (ln_zdfexp=T and 'key_mpp_omp') |
---|
144 | !! NB: rotation of lateral mixing operator or TKE or KPP scheme, |
---|
145 | !! the implicit scheme is required. |
---|
146 | !!---------------------------------------------------------------------- |
---|
147 | USE zdftke |
---|
148 | USE zdfkpp |
---|
149 | !!---------------------------------------------------------------------- |
---|
150 | |
---|
151 | ! Define the vertical tracer physics scheme |
---|
152 | ! ========================================== |
---|
153 | |
---|
154 | ! Choice from ln_zdfexp already read in namelist in zdfini module |
---|
155 | IF( ln_zdfexp ) THEN ! use explicit scheme |
---|
156 | nzdf = 0 |
---|
157 | ELSE ! use implicit scheme |
---|
158 | nzdf = 1 |
---|
159 | ENDIF |
---|
160 | |
---|
161 | ! Force implicit schemes |
---|
162 | IF( lk_zdftke .OR. lk_zdfkpp ) nzdf = 1 ! TKE or KPP physics |
---|
163 | IF( ln_traldf_iso ) nzdf = 1 ! iso-neutral lateral physics |
---|
164 | IF( ln_traldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate |
---|
165 | |
---|
166 | IF( ln_zdfexp .AND. nzdf == 1 ) THEN |
---|
167 | CALL ctl_stop( 'tra_zdf : If using the rotation of lateral mixing operator or TKE ', & |
---|
168 | & ' or KPP scheme, the implicit scheme is required, set ln_zdfexp = .false.' ) |
---|
169 | ENDIF |
---|
170 | |
---|
171 | ! NEC autotasking / OpenMP |
---|
172 | #if defined key_mpp_omp |
---|
173 | IF( nzdf == 1 ) nzdf = 2 ! j-k-i loop |
---|
174 | #endif |
---|
175 | |
---|
176 | ! Test: esopa |
---|
177 | IF( lk_esopa ) nzdf = -1 ! All schemes used |
---|
178 | |
---|
179 | IF(lwp) THEN |
---|
180 | WRITE(numout,*) |
---|
181 | WRITE(numout,*) 'tra:zdf_ctl : vertical tracer physics scheme' |
---|
182 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
183 | IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
184 | IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' |
---|
185 | IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' |
---|
186 | IF( nzdf == 2 ) WRITE(numout,*) ' Implicit (euler backward) scheme with j-k-i loops' |
---|
187 | ENDIF |
---|
188 | |
---|
189 | END SUBROUTINE zdf_ctl |
---|
190 | |
---|
191 | !!============================================================================== |
---|
192 | END MODULE trazdf |
---|