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