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