1 | MODULE trcini |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE trcini *** |
---|
4 | !! TOP : Manage the passive tracer initialization |
---|
5 | !!====================================================================== |
---|
6 | !! History : - ! 1991-03 (O. Marti) original code |
---|
7 | !! 1.0 ! 2005-03 (O. Aumont, A. El Moussaoui) F90 |
---|
8 | !! 2.0 ! 2005-10 (C. Ethe, G. Madec) revised architecture |
---|
9 | !! 4.0 ! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | #if defined key_top |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !! 'key_top' TOP models |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !! trc_init : Initialization for passive tracer |
---|
16 | !! top_alloc : allocate the TOP arrays |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | USE oce_trc |
---|
19 | USE trc |
---|
20 | USE trcrst |
---|
21 | USE trcnam ! Namelist read |
---|
22 | USE trcini_cfc ! CFC initialisation |
---|
23 | USE trcini_lobster ! LOBSTER initialisation |
---|
24 | USE trcini_pisces ! PISCES initialisation |
---|
25 | USE trcini_c14b ! C14 bomb initialisation |
---|
26 | USE trcini_my_trc ! MY_TRC initialisation |
---|
27 | USE trcdta |
---|
28 | USE daymod |
---|
29 | USE zpshde ! partial step: hor. derivative (zps_hde routine) |
---|
30 | USE prtctl_trc ! Print control passive tracers (prt_ctl_trc_init routine) |
---|
31 | USE trcsubstp ! variables to substep passive tracers |
---|
32 | |
---|
33 | IMPLICIT NONE |
---|
34 | PRIVATE |
---|
35 | |
---|
36 | PUBLIC trc_init ! called by opa |
---|
37 | |
---|
38 | !! * Substitutions |
---|
39 | # include "domzgr_substitute.h90" |
---|
40 | !!---------------------------------------------------------------------- |
---|
41 | !! NEMO/TOP 4.0 , NEMO Consortium (2011) |
---|
42 | !! $Id$ |
---|
43 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
44 | !!---------------------------------------------------------------------- |
---|
45 | CONTAINS |
---|
46 | |
---|
47 | SUBROUTINE trc_init |
---|
48 | !!--------------------------------------------------------------------- |
---|
49 | !! *** ROUTINE trc_init *** |
---|
50 | !! |
---|
51 | !! ** Purpose : Initialization of the passive tracer fields |
---|
52 | !! |
---|
53 | !! ** Method : - read namelist |
---|
54 | !! - control the consistancy |
---|
55 | !! - compute specific initialisations |
---|
56 | !! - set initial tracer fields (either read restart |
---|
57 | !! or read data or analytical formulation |
---|
58 | !!--------------------------------------------------------------------- |
---|
59 | INTEGER :: jk, jn ! dummy loop indices |
---|
60 | CHARACTER (len=25) :: charout |
---|
61 | !!--------------------------------------------------------------------- |
---|
62 | |
---|
63 | IF(lwp) WRITE(numout,*) |
---|
64 | IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers' |
---|
65 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
66 | |
---|
67 | CALL top_alloc() ! allocate TOP arrays |
---|
68 | |
---|
69 | ! ! masked grid volume |
---|
70 | DO jk = 1, jpk |
---|
71 | cvol(:,:,jk) = e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) |
---|
72 | END DO |
---|
73 | |
---|
74 | ! ! total volume of the ocean |
---|
75 | #if ! defined key_degrad |
---|
76 | areatot = glob_sum( cvol(:,:,:) ) |
---|
77 | #else |
---|
78 | areatot = glob_sum( cvol(:,:,:) * facvol(:,:,:) ) ! degrad option: reduction by facvol |
---|
79 | #endif |
---|
80 | |
---|
81 | CALL trc_nam ! read passive tracers namelists |
---|
82 | |
---|
83 | ! ! restart for passive tracer (input) |
---|
84 | IF( ln_rsttr ) THEN |
---|
85 | IF(lwp) WRITE(numout,*) ' read a restart file for passive tracer : ', cn_trcrst_in |
---|
86 | IF(lwp) WRITE(numout,*) ' ' |
---|
87 | ELSE |
---|
88 | IF( lwp .AND. lk_dtatrc ) THEN |
---|
89 | DO jn = 1, jptra |
---|
90 | IF( lutini(jn) ) & ! open input FILE only IF lutini(jn) is true |
---|
91 | & WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' traceur : ', ctrcnm(jn) |
---|
92 | END DO |
---|
93 | ENDIF |
---|
94 | IF( lwp ) WRITE(numout,*) |
---|
95 | ENDIF |
---|
96 | |
---|
97 | IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) ) & |
---|
98 | & CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER ' ) |
---|
99 | |
---|
100 | IF( nn_cla == 1 ) & |
---|
101 | & CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) |
---|
102 | |
---|
103 | IF( lk_lobster ) THEN ; CALL trc_ini_lobster ! LOBSTER bio-model |
---|
104 | ELSE ; IF(lwp) WRITE(numout,*) ' LOBSTER not used' |
---|
105 | ENDIF |
---|
106 | |
---|
107 | IF( lk_pisces ) THEN ; CALL trc_ini_pisces ! PISCES bio-model |
---|
108 | ELSE ; IF(lwp) WRITE(numout,*) ' PISCES not used' |
---|
109 | ENDIF |
---|
110 | |
---|
111 | IF( lk_cfc ) THEN ; CALL trc_ini_cfc ! CFC tracers |
---|
112 | ELSE ; IF(lwp) WRITE(numout,*) ' CFC not used' |
---|
113 | ENDIF |
---|
114 | |
---|
115 | IF( lk_c14b ) THEN ; CALL trc_ini_c14b ! C14 bomb tracer |
---|
116 | ELSE ; IF(lwp) WRITE(numout,*) ' C14 not used' |
---|
117 | ENDIF |
---|
118 | |
---|
119 | IF( lk_my_trc ) THEN ; CALL trc_ini_my_trc ! MY_TRC tracers |
---|
120 | ELSE ; IF(lwp) WRITE(numout,*) ' MY_TRC not used' |
---|
121 | ENDIF |
---|
122 | |
---|
123 | IF( ln_rsttr ) THEN |
---|
124 | ! |
---|
125 | IF( lk_offline ) neuler = 1 ! Set time-step indicator at nittrc000 (leap-frog) |
---|
126 | CALL trc_rst_read ! restart from a file |
---|
127 | ! |
---|
128 | ELSE |
---|
129 | IF( lk_offline ) THEN |
---|
130 | neuler = 0 ! Set time-step indicator at nittrc000 (euler) |
---|
131 | CALL day_init ! set calendar |
---|
132 | ENDIF |
---|
133 | #if defined key_dtatrc |
---|
134 | CALL trc_dta( nittrc000 ) ! Initialization of tracer from a file that may also be used for damping |
---|
135 | DO jn = 1, jptra |
---|
136 | IF( lutini(jn) ) trn(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:) ! initialisation from file if required |
---|
137 | END DO |
---|
138 | #endif |
---|
139 | trb(:,:,:,:) = trn(:,:,:,:) |
---|
140 | ! |
---|
141 | ENDIF |
---|
142 | |
---|
143 | tra(:,:,:,:) = 0._wp |
---|
144 | |
---|
145 | IF( ln_zps .AND. .NOT. lk_c1d ) & ! Partial steps: before horizontal gradient of passive |
---|
146 | & CALL zps_hde( nittrc000, jptra, trn, gtru, gtrv ) ! tracers at the bottom ocean level |
---|
147 | |
---|
148 | |
---|
149 | ! |
---|
150 | trai = 0._wp ! Computation content of all tracers |
---|
151 | DO jn = 1, jptra |
---|
152 | #if ! defined key_degrad |
---|
153 | trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) |
---|
154 | #else |
---|
155 | trai = trai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) ! degrad option: reduction by facvol |
---|
156 | #endif |
---|
157 | END DO |
---|
158 | |
---|
159 | IF(lwp) THEN ! control print |
---|
160 | WRITE(numout,*) |
---|
161 | WRITE(numout,*) |
---|
162 | WRITE(numout,*) ' *** Total number of passive tracer jptra = ', jptra |
---|
163 | WRITE(numout,*) ' *** Total volume of ocean = ', areatot |
---|
164 | WRITE(numout,*) ' *** Total inital content of all tracers = ', trai |
---|
165 | WRITE(numout,*) |
---|
166 | ENDIF |
---|
167 | |
---|
168 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
169 | CALL prt_ctl_trc_init |
---|
170 | WRITE(charout, FMT="('ini ')") |
---|
171 | CALL prt_ctl_trc_info( charout ) |
---|
172 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
173 | ENDIF |
---|
174 | |
---|
175 | IF(nn_dttrc .NE. 1) THEN |
---|
176 | CALL trc_sub_stp_ini !initialize variables for substepping passive tracers |
---|
177 | ENDIF |
---|
178 | ! |
---|
179 | END SUBROUTINE trc_init |
---|
180 | |
---|
181 | |
---|
182 | SUBROUTINE top_alloc |
---|
183 | !!---------------------------------------------------------------------- |
---|
184 | !! *** ROUTINE top_alloc *** |
---|
185 | !! |
---|
186 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
187 | !!---------------------------------------------------------------------- |
---|
188 | USE trcadv , ONLY: trc_adv_alloc ! TOP-related alloc routines... |
---|
189 | USE trc , ONLY: trc_alloc |
---|
190 | USE trcnxt , ONLY: trc_nxt_alloc |
---|
191 | USE trczdf , ONLY: trc_zdf_alloc |
---|
192 | USE trdmod_trc_oce, ONLY: trd_mod_trc_oce_alloc |
---|
193 | #if ! defined key_iomput |
---|
194 | USE trcdia , ONLY: trc_dia_alloc |
---|
195 | #endif |
---|
196 | #if defined key_trcdmp |
---|
197 | USE trcdmp , ONLY: trc_dmp_alloc |
---|
198 | #endif |
---|
199 | #if defined key_dtatrc |
---|
200 | USE trcdta , ONLY: trc_dta_alloc |
---|
201 | #endif |
---|
202 | #if defined key_trdmld_trc || defined key_esopa |
---|
203 | USE trdmld_trc , ONLY: trd_mld_trc_alloc |
---|
204 | #endif |
---|
205 | ! |
---|
206 | INTEGER :: ierr |
---|
207 | !!---------------------------------------------------------------------- |
---|
208 | ! |
---|
209 | ierr = trc_adv_alloc() ! Start of TOP-related alloc routines... |
---|
210 | ierr = ierr + trc_alloc () |
---|
211 | ierr = ierr + trc_nxt_alloc() |
---|
212 | ierr = ierr + trc_zdf_alloc() |
---|
213 | ierr = ierr + trd_mod_trc_oce_alloc() |
---|
214 | #if ! defined key_iomput |
---|
215 | ierr = ierr + trc_dia_alloc() |
---|
216 | #endif |
---|
217 | #if defined key_trcdmp |
---|
218 | ierr = ierr + trc_dmp_alloc() |
---|
219 | #endif |
---|
220 | #if defined key_dtatrc |
---|
221 | ierr = ierr + trc_dta_alloc() |
---|
222 | #endif |
---|
223 | #if defined key_trdmld_trc || defined key_esopa |
---|
224 | ierr = ierr + trd_mld_trc_alloc() |
---|
225 | #endif |
---|
226 | ! |
---|
227 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
228 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) |
---|
229 | ! |
---|
230 | END SUBROUTINE top_alloc |
---|
231 | |
---|
232 | #else |
---|
233 | !!---------------------------------------------------------------------- |
---|
234 | !! Empty module : No passive tracer |
---|
235 | !!---------------------------------------------------------------------- |
---|
236 | CONTAINS |
---|
237 | SUBROUTINE trc_init ! Dummy routine |
---|
238 | END SUBROUTINE trc_init |
---|
239 | #endif |
---|
240 | |
---|
241 | !!====================================================================== |
---|
242 | END MODULE trcini |
---|