1 | MODULE trczdf |
---|
2 | !!============================================================================== |
---|
3 | !! *** MODULE trczdf *** |
---|
4 | !! Ocean Passive tracers : vertical 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 | !! trc_ldf : update the tracer trend with the lateral diffusion |
---|
14 | !! ldf_ctl : initialization, namelist read, and parameters control |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | USE oce_trc ! ocean dynamics and active tracers |
---|
17 | USE trc ! ocean passive tracers variables |
---|
18 | USE trcnam_trp ! passive tracers transport namelist variables |
---|
19 | USE trazdf_exp ! vertical diffusion: explicit (tra_zdf_exp routine) |
---|
20 | USE trazdf_imp ! vertical diffusion: implicit (tra_zdf_imp routine) |
---|
21 | USE trd_oce |
---|
22 | USE trdtra |
---|
23 | USE prtctl_trc ! Print control |
---|
24 | |
---|
25 | IMPLICIT NONE |
---|
26 | PRIVATE |
---|
27 | |
---|
28 | PUBLIC trc_zdf ! called by step.F90 |
---|
29 | PUBLIC trc_zdf_alloc ! called by nemogcm.F90 |
---|
30 | |
---|
31 | INTEGER :: nzdf = 0 ! type vertical diffusion algorithm used |
---|
32 | ! ! defined from ln_zdf... namlist logicals) |
---|
33 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: r2dt ! vertical profile time-step, = 2 rdttra |
---|
34 | ! ! except at nittrc000 (=rdttra) if neuler=0 |
---|
35 | |
---|
36 | !! * Substitutions |
---|
37 | # include "domzgr_substitute.h90" |
---|
38 | # include "zdfddm_substitute.h90" |
---|
39 | # include "vectopt_loop_substitute.h90" |
---|
40 | !!---------------------------------------------------------------------- |
---|
41 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
42 | !! $Id$ |
---|
43 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
44 | !!---------------------------------------------------------------------- |
---|
45 | CONTAINS |
---|
46 | |
---|
47 | INTEGER FUNCTION trc_zdf_alloc() |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | !! *** ROUTINE trc_zdf_alloc *** |
---|
50 | !!---------------------------------------------------------------------- |
---|
51 | ALLOCATE( r2dt(jpk) , STAT=trc_zdf_alloc ) |
---|
52 | ! |
---|
53 | IF( trc_zdf_alloc /= 0 ) CALL ctl_warn('trc_zdf_alloc : failed to allocate array.') |
---|
54 | ! |
---|
55 | END FUNCTION trc_zdf_alloc |
---|
56 | |
---|
57 | |
---|
58 | SUBROUTINE trc_zdf( kt ) |
---|
59 | !!---------------------------------------------------------------------- |
---|
60 | !! *** ROUTINE trc_zdf *** |
---|
61 | !! |
---|
62 | !! ** Purpose : compute the vertical ocean tracer physics. |
---|
63 | !!--------------------------------------------------------------------- |
---|
64 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
65 | ! |
---|
66 | INTEGER :: jk, jn |
---|
67 | CHARACTER (len=22) :: charout |
---|
68 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztrtrd ! 4D workspace |
---|
69 | !!--------------------------------------------------------------------- |
---|
70 | ! |
---|
71 | IF( nn_timing == 1 ) CALL timing_start('trc_zdf') |
---|
72 | ! |
---|
73 | IF( kt == nittrc000 ) CALL zdf_ctl ! initialisation & control of options |
---|
74 | |
---|
75 | IF( ln_top_euler) THEN |
---|
76 | r2dt(:) = rdttrc(:) ! = rdttrc (use Euler time stepping) |
---|
77 | ELSE |
---|
78 | IF( neuler == 0 .AND. kt == nittrc000 ) THEN ! at nittrc000 |
---|
79 | r2dt(:) = rdttrc(:) ! = rdttrc (restarting with Euler time stepping) |
---|
80 | ELSEIF( kt <= nittrc000 + 1 ) THEN ! at nittrc000 or nittrc000+1 |
---|
81 | r2dt(:) = 2. * rdttrc(:) ! = 2 rdttrc (leapfrog) |
---|
82 | ENDIF |
---|
83 | ENDIF |
---|
84 | |
---|
85 | IF( l_trdtrc ) THEN |
---|
86 | CALL wrk_alloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
87 | ztrtrd(:,:,:,:) = tra(:,:,:,:) |
---|
88 | ENDIF |
---|
89 | |
---|
90 | SELECT CASE ( nzdf ) ! compute lateral mixing trend and add it to the general trend |
---|
91 | CASE ( -1 ) ! esopa: test all possibility with control print |
---|
92 | CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) |
---|
93 | WRITE(charout, FMT="('zdf1 ')") ; CALL prt_ctl_trc_info(charout) |
---|
94 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
95 | CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) |
---|
96 | WRITE(charout, FMT="('zdf2 ')") ; CALL prt_ctl_trc_info(charout) |
---|
97 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
98 | CASE ( 0 ) ; CALL tra_zdf_exp( kt, nittrc000, 'TRC', r2dt, nn_trczdf_exp, trb, tra, jptra ) ! explicit scheme |
---|
99 | CASE ( 1 ) ; CALL tra_zdf_imp( kt, nittrc000, 'TRC', r2dt, trb, tra, jptra ) ! implicit scheme |
---|
100 | |
---|
101 | END SELECT |
---|
102 | |
---|
103 | IF( l_trdtrc ) THEN ! save the vertical diffusive trends for further diagnostics |
---|
104 | DO jn = 1, jptra |
---|
105 | DO jk = 1, jpkm1 |
---|
106 | ztrtrd(:,:,jk,jn) = ( ( tra(:,:,jk,jn) - trb(:,:,jk,jn) ) / r2dt(jk) ) - ztrtrd(:,:,jk,jn) |
---|
107 | END DO |
---|
108 | CALL trd_tra( kt, 'TRC', jn, jptra_zdf, ztrtrd(:,:,:,jn) ) |
---|
109 | END DO |
---|
110 | CALL wrk_dealloc( jpi, jpj, jpk, jptra, ztrtrd ) |
---|
111 | ENDIF |
---|
112 | ! ! print mean trends (used for debugging) |
---|
113 | IF( ln_ctl ) THEN |
---|
114 | WRITE(charout, FMT="('zdf ')") ; CALL prt_ctl_trc_info(charout) |
---|
115 | CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' ) |
---|
116 | END IF |
---|
117 | ! |
---|
118 | IF( nn_timing == 1 ) CALL timing_stop('trc_zdf') |
---|
119 | ! |
---|
120 | END SUBROUTINE trc_zdf |
---|
121 | |
---|
122 | |
---|
123 | SUBROUTINE zdf_ctl |
---|
124 | !!---------------------------------------------------------------------- |
---|
125 | !! *** ROUTINE zdf_ctl *** |
---|
126 | !! |
---|
127 | !! ** Purpose : Choose the vertical mixing scheme |
---|
128 | !! |
---|
129 | !! ** Method : Set nzdf from ln_zdfexp |
---|
130 | !! nzdf = 0 explicit (time-splitting) scheme (ln_trczdf_exp=T) |
---|
131 | !! = 1 implicit (euler backward) scheme (ln_trczdf_exp=F) |
---|
132 | !! NB: The implicit scheme is required when using : |
---|
133 | !! - rotated lateral mixing operator |
---|
134 | !! - TKE, GLS or KPP vertical mixing scheme |
---|
135 | !!---------------------------------------------------------------------- |
---|
136 | |
---|
137 | ! Define the vertical tracer physics scheme |
---|
138 | ! ========================================== |
---|
139 | |
---|
140 | ! Choice from ln_zdfexp already read in namelist in zdfini module |
---|
141 | IF( ln_trczdf_exp ) THEN ! use explicit scheme |
---|
142 | nzdf = 0 |
---|
143 | ELSE ! use implicit scheme |
---|
144 | nzdf = 1 |
---|
145 | ENDIF |
---|
146 | |
---|
147 | ! Force implicit schemes |
---|
148 | IF( ln_trcldf_iso ) nzdf = 1 ! iso-neutral lateral physics |
---|
149 | IF( ln_trcldf_hor .AND. ln_sco ) nzdf = 1 ! horizontal lateral physics in s-coordinate |
---|
150 | #if defined key_zdftke || defined key_zdfgls || defined key_zdfkpp |
---|
151 | nzdf = 1 ! TKE, GLS or KPP physics |
---|
152 | #endif |
---|
153 | IF( ln_trczdf_exp .AND. nzdf == 1 ) THEN |
---|
154 | CALL ctl_stop( 'trc_zdf : If using the rotated lateral mixing operator or TKE, GLS or KPP vertical scheme ', & |
---|
155 | & ' the implicit scheme is required, set ln_trczdf_exp = .false.' ) |
---|
156 | ENDIF |
---|
157 | |
---|
158 | ! Test: esopa |
---|
159 | IF( lk_esopa ) nzdf = -1 ! All schemes used |
---|
160 | |
---|
161 | IF(lwp) THEN |
---|
162 | WRITE(numout,*) |
---|
163 | WRITE(numout,*) 'trc:zdf_ctl : vertical passive tracer physics scheme' |
---|
164 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
165 | IF( nzdf == -1 ) WRITE(numout,*) ' ESOPA test All scheme used' |
---|
166 | IF( nzdf == 0 ) WRITE(numout,*) ' Explicit time-splitting scheme' |
---|
167 | IF( nzdf == 1 ) WRITE(numout,*) ' Implicit (euler backward) scheme' |
---|
168 | ENDIF |
---|
169 | |
---|
170 | END SUBROUTINE zdf_ctl |
---|
171 | #else |
---|
172 | !!---------------------------------------------------------------------- |
---|
173 | !! Default option Empty module |
---|
174 | !!---------------------------------------------------------------------- |
---|
175 | CONTAINS |
---|
176 | SUBROUTINE trc_zdf( kt ) |
---|
177 | INTEGER, INTENT(in) :: kt |
---|
178 | WRITE(*,*) 'trc_zdf: You should not have seen this print! error?', kt |
---|
179 | END SUBROUTINE trc_zdf |
---|
180 | #endif |
---|
181 | !!============================================================================== |
---|
182 | END MODULE trczdf |
---|