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 ! shared variables between ocean and passive tracers |
---|
19 | USE trc ! passive tracers common variables |
---|
20 | USE trcrst ! passive tracers restart |
---|
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 ! initialisation form files |
---|
28 | USE daymod ! calendar manager |
---|
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 | INTEGER :: jk, jn, jl ! dummy loop indices |
---|
59 | INTEGER :: ierr ! local integer |
---|
60 | CHARACTER (len=25) :: charout |
---|
61 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: ztrcdta ! 4D workspace |
---|
62 | !!--------------------------------------------------------------------- |
---|
63 | |
---|
64 | IF(lwp) WRITE(numout,*) |
---|
65 | IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers' |
---|
66 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
67 | |
---|
68 | CALL top_alloc() ! allocate TOP arrays |
---|
69 | |
---|
70 | IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) ) & |
---|
71 | & CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER ' ) |
---|
72 | |
---|
73 | IF( nn_cla == 1 ) & |
---|
74 | & CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) |
---|
75 | |
---|
76 | ! ! masked grid volume |
---|
77 | DO jk = 1, jpk |
---|
78 | cvol(:,:,jk) = e1t(:,:) * e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) |
---|
79 | END DO |
---|
80 | |
---|
81 | ! ! total volume of the ocean ( degrad option: reduction by facvol ) |
---|
82 | IF( .NOT.lk_degrad ) THEN ; areatot = glob_sum( cvol(:,:,:) ) |
---|
83 | ELSE ; areatot = glob_sum( cvol(:,:,:) * facvol(:,:,:) ) |
---|
84 | ENDIF |
---|
85 | |
---|
86 | CALL trc_nam ! read passive tracers namelists |
---|
87 | |
---|
88 | IF( lk_lobster ) THEN ; CALL trc_ini_lobster ! LOBSTER bio-model |
---|
89 | ELSE ; IF(lwp) WRITE(numout,*) ' LOBSTER not used' |
---|
90 | ENDIF |
---|
91 | |
---|
92 | IF( lk_pisces ) THEN ; CALL trc_ini_pisces ! PISCES bio-model |
---|
93 | ELSE ; IF(lwp) WRITE(numout,*) ' PISCES not used' |
---|
94 | ENDIF |
---|
95 | |
---|
96 | IF( lk_cfc ) THEN ; CALL trc_ini_cfc ! CFC tracers |
---|
97 | ELSE ; IF(lwp) WRITE(numout,*) ' CFC not used' |
---|
98 | ENDIF |
---|
99 | |
---|
100 | IF( lk_c14b ) THEN ; CALL trc_ini_c14b ! C14 bomb tracer |
---|
101 | ELSE ; IF(lwp) WRITE(numout,*) ' C14 not used' |
---|
102 | ENDIF |
---|
103 | |
---|
104 | IF( lk_my_trc ) THEN ; CALL trc_ini_my_trc ! MY_TRC tracers |
---|
105 | ELSE ; IF(lwp) WRITE(numout,*) ' MY_TRC not used' |
---|
106 | ENDIF |
---|
107 | |
---|
108 | IF( ln_trcdta ) CALL trc_dta_init |
---|
109 | |
---|
110 | IF( ln_rsttr ) THEN |
---|
111 | ! |
---|
112 | IF( lk_offline ) neuler = 1 ! Set time-step indicator at nit000 (leap-frog) |
---|
113 | CALL trc_rst_read ! restart from a file |
---|
114 | ! |
---|
115 | ELSE |
---|
116 | IF( lk_offline ) THEN |
---|
117 | neuler = 0 ! Set time-step indicator at nit000 (euler) |
---|
118 | CALL day_init ! set calendar |
---|
119 | ENDIF |
---|
120 | IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN ! Initialisation of tracer from a file that may also be used for damping |
---|
121 | ALLOCATE( ztrcdta(jpi,jpj,jpk,nb_trcdta), STAT=ierr ) |
---|
122 | IF( ierr > 0 ) THEN |
---|
123 | CALL ctl_stop( 'trc_ini: unable to allocate ztrcdta array' ) ; RETURN |
---|
124 | ENDIF |
---|
125 | ! |
---|
126 | CALL trc_dta( nit000, ztrcdta ) ! read tracer data at nit000 |
---|
127 | ! |
---|
128 | DO jn = 1, jptra |
---|
129 | IF( ln_trc_ini(jn) ) THEN ! update passive tracers arrays with input data read from file |
---|
130 | jl = n_trc_index(jn) |
---|
131 | trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * tmask(:,:,:) |
---|
132 | ENDIF |
---|
133 | ENDDO |
---|
134 | DEALLOCATE( ztrcdta ) |
---|
135 | ENDIF |
---|
136 | ! |
---|
137 | trb(:,:,:,:) = trn(:,:,:,:) |
---|
138 | ! |
---|
139 | ENDIF |
---|
140 | |
---|
141 | tra(:,:,:,:) = 0._wp |
---|
142 | |
---|
143 | IF( ln_zps .AND. .NOT. lk_c1d ) & ! Partial steps: before horizontal gradient of passive |
---|
144 | & CALL zps_hde( nit000, jptra, trn, gtru, gtrv ) ! tracers at the bottom ocean level |
---|
145 | |
---|
146 | |
---|
147 | ! |
---|
148 | trai(:) = 0._wp ! Computation content of all tracers ( degrad option: reduction by facvol ) |
---|
149 | DO jn = 1, jptra |
---|
150 | IF( .NOT.lk_degrad ) THEN ; trai(jn) = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) |
---|
151 | ELSE ; trai(jn) = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) |
---|
152 | ENDIF |
---|
153 | END DO |
---|
154 | |
---|
155 | IF(lwp) THEN ! control print |
---|
156 | WRITE(numout,*) |
---|
157 | WRITE(numout,*) |
---|
158 | WRITE(numout,*) ' *** Total number of passive tracer jptra = ', jptra |
---|
159 | WRITE(numout,*) ' *** Total volume of ocean = ', areatot |
---|
160 | WRITE(numout,*) ' *** Total inital content of all tracers ' |
---|
161 | DO jn = 1, jptra |
---|
162 | WRITE(numout,*) ' tracer nb : ', jn, ' name : ', ctrcnm(jn), ' initial content :', trai(jn) |
---|
163 | ENDDO |
---|
164 | WRITE(numout,*) |
---|
165 | ENDIF |
---|
166 | |
---|
167 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
168 | CALL prt_ctl_trc_init |
---|
169 | WRITE(charout, FMT="('ini ')") |
---|
170 | CALL prt_ctl_trc_info( charout ) |
---|
171 | CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) |
---|
172 | ENDIF |
---|
173 | ! |
---|
174 | END SUBROUTINE trc_init |
---|
175 | |
---|
176 | |
---|
177 | SUBROUTINE top_alloc |
---|
178 | !!---------------------------------------------------------------------- |
---|
179 | !! *** ROUTINE top_alloc *** |
---|
180 | !! |
---|
181 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
182 | !!---------------------------------------------------------------------- |
---|
183 | USE trcadv , ONLY: trc_adv_alloc ! TOP-related alloc routines... |
---|
184 | USE trc , ONLY: trc_alloc |
---|
185 | USE trcnxt , ONLY: trc_nxt_alloc |
---|
186 | USE trczdf , ONLY: trc_zdf_alloc |
---|
187 | USE trdmod_trc_oce, ONLY: trd_mod_trc_oce_alloc |
---|
188 | #if defined key_trdmld_trc |
---|
189 | USE trdmld_trc , ONLY: trd_mld_trc_alloc |
---|
190 | #endif |
---|
191 | ! |
---|
192 | INTEGER :: ierr |
---|
193 | !!---------------------------------------------------------------------- |
---|
194 | ! |
---|
195 | ierr = trc_adv_alloc() ! Start of TOP-related alloc routines... |
---|
196 | ierr = ierr + trc_alloc () |
---|
197 | ierr = ierr + trc_nxt_alloc() |
---|
198 | ierr = ierr + trc_zdf_alloc() |
---|
199 | ierr = ierr + trd_mod_trc_oce_alloc() |
---|
200 | #if defined key_trdmld_trc |
---|
201 | ierr = ierr + trd_mld_trc_alloc() |
---|
202 | #endif |
---|
203 | ! |
---|
204 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
205 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' ) |
---|
206 | ! |
---|
207 | END SUBROUTINE top_alloc |
---|
208 | |
---|
209 | #else |
---|
210 | !!---------------------------------------------------------------------- |
---|
211 | !! Empty module : No passive tracer |
---|
212 | !!---------------------------------------------------------------------- |
---|
213 | CONTAINS |
---|
214 | SUBROUTINE trc_init ! Dummy routine |
---|
215 | END SUBROUTINE trc_init |
---|
216 | #endif |
---|
217 | |
---|
218 | !!====================================================================== |
---|
219 | END MODULE trcini |
---|