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