Line data Source code
1 : !=======================================================================
2 : ! Indices and flags associated with the tracer infrastructure.
3 : ! Grid-dependent and max_trcr-dependent arrays are declared in ice_state.F90.
4 : !
5 : ! author Elizabeth C. Hunke, LANL
6 :
7 : module icepack_tracers
8 :
9 : use icepack_kinds
10 : use icepack_parameters, only: c0, c1, puny, Tocnfrz
11 : use icepack_warnings, only: warnstr, icepack_warnings_add
12 : use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted
13 :
14 : implicit none
15 :
16 : private
17 : public :: icepack_compute_tracers
18 : public :: icepack_init_tracer_flags
19 : public :: icepack_query_tracer_flags
20 : public :: icepack_write_tracer_flags
21 : public :: icepack_init_tracer_indices
22 : public :: icepack_query_tracer_indices
23 : public :: icepack_write_tracer_indices
24 : public :: icepack_init_tracer_sizes
25 : public :: icepack_query_tracer_sizes
26 : public :: icepack_write_tracer_sizes
27 :
28 : !-----------------------------------------------------------------
29 : ! dimensions
30 : !-----------------------------------------------------------------
31 : integer (kind=int_kind), parameter, public :: &
32 : max_iso = 3 , & ! maximum number of isotopes ! LCOV_EXCL_LINE
33 : max_algae = 3 , & ! maximum number of algal types ! LCOV_EXCL_LINE
34 : max_dic = 1 , & ! maximum number of dissolved inorganic carbon types ! LCOV_EXCL_LINE
35 : max_doc = 3 , & ! maximum number of dissolved organic carbon types ! LCOV_EXCL_LINE
36 : max_don = 1 , & ! maximum number of dissolved organic nitrogen types ! LCOV_EXCL_LINE
37 : max_fe = 2 , & ! maximum number of iron types ! LCOV_EXCL_LINE
38 : nmodal1 = 10 , & ! dimension for modal aerosol radiation parameters ! LCOV_EXCL_LINE
39 : nmodal2 = 8 , & ! dimension for modal aerosol radiation parameters ! LCOV_EXCL_LINE
40 : max_aero = 6 , & ! maximum number of aerosols ! LCOV_EXCL_LINE
41 :
42 : max_nbtrcr = max_algae*2 & ! algal nitrogen and chlorophyll
43 : + max_dic & ! dissolved inorganic carbon ! LCOV_EXCL_LINE
44 : + max_doc & ! dissolved organic carbon ! LCOV_EXCL_LINE
45 : + max_don & ! dissolved organic nitrogen ! LCOV_EXCL_LINE
46 : + 5 & ! nitrate, ammonium, silicate, PON, and humics ! LCOV_EXCL_LINE
47 : + 3 & ! DMSPp, DMSPd, DMS ! LCOV_EXCL_LINE
48 : + max_fe*2 & ! dissolved Fe and particulate Fe ! LCOV_EXCL_LINE
49 : + max_aero ! aerosols
50 :
51 : integer (kind=int_kind), public :: &
52 : ntrcr = 0, & ! number of tracers in use ! LCOV_EXCL_LINE
53 : ntrcr_o = 0, & ! number of non-bio tracers in use ! LCOV_EXCL_LINE
54 : ncat = 0, & ! number of ice categories in use ! LCOV_EXCL_LINE
55 : nilyr = 0, & ! number of ice layers per category ! LCOV_EXCL_LINE
56 : nslyr = 0, & ! number of snow layers per category ! LCOV_EXCL_LINE
57 : nblyr = 0, & ! number of bio/brine layers per category ! LCOV_EXCL_LINE
58 : nfsd = 0, & ! number of fsd layers ! LCOV_EXCL_LINE
59 : n_iso = 0, & ! number of isotopes in use ! LCOV_EXCL_LINE
60 : n_aero = 0, & ! number of aerosols in use ! LCOV_EXCL_LINE
61 : n_zaero = 0, & ! number of z aerosols in use ! LCOV_EXCL_LINE
62 : n_algae = 0, & ! number of algae in use ! LCOV_EXCL_LINE
63 : n_doc = 0, & ! number of DOC pools in use ! LCOV_EXCL_LINE
64 : n_dic = 0, & ! number of DIC pools in use ! LCOV_EXCL_LINE
65 : n_don = 0, & ! number of DON pools in use ! LCOV_EXCL_LINE
66 : n_fed = 0, & ! number of Fe pools in use dissolved Fe ! LCOV_EXCL_LINE
67 : n_fep = 0 ! number of Fe pools in use particulate Fe
68 :
69 : integer (kind=int_kind), public :: &
70 : nt_Tsfc = 0, & ! ice/snow temperature ! LCOV_EXCL_LINE
71 : nt_qice = 0, & ! volume-weighted ice enthalpy (in layers) ! LCOV_EXCL_LINE
72 : nt_qsno = 0, & ! volume-weighted snow enthalpy (in layers) ! LCOV_EXCL_LINE
73 : nt_sice = 0, & ! volume-weighted ice bulk salinity (CICE grid layers) ! LCOV_EXCL_LINE
74 : nt_fbri = 0, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) ! LCOV_EXCL_LINE
75 : nt_iage = 0, & ! volume-weighted ice age ! LCOV_EXCL_LINE
76 : nt_FY = 0, & ! area-weighted first-year ice area ! LCOV_EXCL_LINE
77 : nt_alvl = 0, & ! level ice area fraction ! LCOV_EXCL_LINE
78 : nt_vlvl = 0, & ! level ice volume fraction ! LCOV_EXCL_LINE
79 : nt_apnd = 0, & ! melt pond area fraction ! LCOV_EXCL_LINE
80 : nt_hpnd = 0, & ! melt pond depth ! LCOV_EXCL_LINE
81 : nt_ipnd = 0, & ! melt pond refrozen lid thickness ! LCOV_EXCL_LINE
82 : nt_fsd = 0, & ! floe size distribution ! LCOV_EXCL_LINE
83 : nt_isosno = 0, & ! starting index for isotopes in snow ! LCOV_EXCL_LINE
84 : nt_isoice = 0, & ! starting index for isotopes in ice ! LCOV_EXCL_LINE
85 : nt_aero = 0, & ! starting index for aerosols in ice ! LCOV_EXCL_LINE
86 : nt_bgc_Nit = 0, & ! nutrients ! LCOV_EXCL_LINE
87 : nt_bgc_Am = 0, & ! ! LCOV_EXCL_LINE
88 : nt_bgc_Sil = 0, & ! ! LCOV_EXCL_LINE
89 : nt_bgc_DMSPp = 0, & ! trace gases (skeletal layer) ! LCOV_EXCL_LINE
90 : nt_bgc_DMSPd = 0, & ! ! LCOV_EXCL_LINE
91 : nt_bgc_DMS = 0, & ! ! LCOV_EXCL_LINE
92 : nt_bgc_PON = 0, & ! zooplankton and detritus ! LCOV_EXCL_LINE
93 : nt_bgc_hum = 0, & ! humic material ! LCOV_EXCL_LINE
94 : nt_zbgc_frac = 0, & ! fraction of tracer in the mobile phase ! LCOV_EXCL_LINE
95 : nt_bgc_S = 0 ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)
96 :
97 : logical (kind=log_kind), public :: &
98 : tr_iage = .false., & ! if .true., use age tracer ! LCOV_EXCL_LINE
99 : tr_FY = .false., & ! if .true., use first-year area tracer ! LCOV_EXCL_LINE
100 : tr_lvl = .false., & ! if .true., use level ice tracer ! LCOV_EXCL_LINE
101 : tr_pond = .false., & ! if .true., use melt pond tracer ! LCOV_EXCL_LINE
102 : tr_pond_cesm = .false., & ! if .true., use cesm pond tracer ! LCOV_EXCL_LINE
103 : tr_pond_lvl = .false., & ! if .true., use level-ice pond tracer ! LCOV_EXCL_LINE
104 : tr_pond_topo = .false., & ! if .true., use explicit topography-based ponds ! LCOV_EXCL_LINE
105 : tr_iso = .false., & ! if .true., use isotope tracers ! LCOV_EXCL_LINE
106 : tr_aero = .false., & ! if .true., use aerosol tracers ! LCOV_EXCL_LINE
107 : tr_brine = .false., & ! if .true., brine height differs from ice thickness ! LCOV_EXCL_LINE
108 : tr_fsd = .false. ! if .true., use floe size distribution
109 :
110 : !-----------------------------------------------------------------
111 : ! biogeochemistry
112 : !-----------------------------------------------------------------
113 :
114 : logical (kind=log_kind), public :: &
115 : tr_zaero = .false., & ! if .true., black carbon as tracers (n_zaero) ! LCOV_EXCL_LINE
116 : tr_bgc_Nit = .false., & ! if .true. Nitrate tracer in ice ! LCOV_EXCL_LINE
117 : tr_bgc_N = .false., & ! if .true., algal nitrogen tracers (n_algae) ! LCOV_EXCL_LINE
118 : tr_bgc_DON = .false., & ! if .true., DON pools are tracers (n_don) ! LCOV_EXCL_LINE
119 : tr_bgc_C = .false., & ! if .true., algal carbon tracers + DOC and DIC ! LCOV_EXCL_LINE
120 : tr_bgc_chl = .false., & ! if .true., algal chlorophyll tracers ! LCOV_EXCL_LINE
121 : tr_bgc_Am = .false., & ! if .true., ammonia/um as nutrient tracer ! LCOV_EXCL_LINE
122 : tr_bgc_Sil = .false., & ! if .true., silicon as nutrient tracer ! LCOV_EXCL_LINE
123 : tr_bgc_DMS = .false., & ! if .true., DMS as tracer ! LCOV_EXCL_LINE
124 : tr_bgc_Fe = .false., & ! if .true., Fe as tracer ! LCOV_EXCL_LINE
125 : tr_bgc_PON = .false., & ! if .true., PON as tracer ! LCOV_EXCL_LINE
126 : tr_bgc_hum = .false. ! if .true., humic material as tracer
127 :
128 : integer (kind=int_kind), public :: &
129 : nbtrcr = 0, & ! number of bgc tracers in use ! LCOV_EXCL_LINE
130 : nbtrcr_sw = 0, & ! number of bgc tracers which impact shortwave ! LCOV_EXCL_LINE
131 : nlt_chl_sw = 0 ! points to total chla in trcrn_sw
132 :
133 : integer (kind=int_kind), dimension(max_aero), public :: &
134 : nlt_zaero_sw = 0 ! points to aerosol in trcrn_sw
135 :
136 : integer (kind=int_kind), dimension(max_algae), public :: &
137 : nlt_bgc_N = 0, & ! algae ! LCOV_EXCL_LINE
138 : nlt_bgc_C = 0, & ! ! LCOV_EXCL_LINE
139 : nlt_bgc_chl = 0 !
140 :
141 : integer (kind=int_kind), dimension(max_doc), public :: &
142 : nlt_bgc_DOC = 0 ! disolved organic carbon
143 :
144 : integer (kind=int_kind), dimension(max_don), public :: &
145 : nlt_bgc_DON = 0 !
146 :
147 : integer (kind=int_kind), dimension(max_dic), public :: &
148 : nlt_bgc_DIC = 0 ! disolved inorganic carbon
149 :
150 : integer (kind=int_kind), dimension(max_fe), public :: &
151 : nlt_bgc_Fed = 0, & ! ! LCOV_EXCL_LINE
152 : nlt_bgc_Fep = 0 !
153 :
154 : integer (kind=int_kind), dimension(max_aero), public :: &
155 : nlt_zaero = 0 ! non-reacting layer aerosols
156 :
157 : integer (kind=int_kind), public :: &
158 : nlt_bgc_Nit = 0, & ! nutrients ! LCOV_EXCL_LINE
159 : nlt_bgc_Am = 0, & ! ! LCOV_EXCL_LINE
160 : nlt_bgc_Sil = 0, & ! ! LCOV_EXCL_LINE
161 : nlt_bgc_DMSPp= 0, & ! trace gases (skeletal layer) ! LCOV_EXCL_LINE
162 : nlt_bgc_DMSPd= 0, & ! ! LCOV_EXCL_LINE
163 : nlt_bgc_DMS = 0, & ! ! LCOV_EXCL_LINE
164 : nlt_bgc_PON = 0, & ! zooplankton and detritus ! LCOV_EXCL_LINE
165 : nlt_bgc_hum = 0 ! humic material
166 :
167 : integer (kind=int_kind), dimension(max_algae), public :: &
168 : nt_bgc_N = 0, & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
169 : nt_bgc_C = 0, & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
170 : nt_bgc_chl = 0 ! diatoms, phaeocystis, pico/small
171 :
172 : integer (kind=int_kind), dimension(max_doc), public :: &
173 : nt_bgc_DOC = 0 ! dissolved organic carbon
174 :
175 : integer (kind=int_kind), dimension(max_don), public :: &
176 : nt_bgc_DON = 0 ! dissolved organic nitrogen
177 :
178 : integer (kind=int_kind), dimension(max_dic), public :: &
179 : nt_bgc_DIC = 0 ! dissolved inorganic carbon
180 :
181 : integer (kind=int_kind), dimension(max_fe), public :: &
182 : nt_bgc_Fed = 0, & ! dissolved iron ! LCOV_EXCL_LINE
183 : nt_bgc_Fep = 0 ! particulate iron
184 :
185 : integer (kind=int_kind), dimension(max_aero), public :: &
186 : nt_zaero = 0 ! black carbon and other aerosols
187 :
188 : integer (kind=int_kind), dimension(max_nbtrcr), public :: &
189 : bio_index_o = 0 ! relates nlt_bgc_NO to ocean concentration index
190 : ! see ocean_bio_all
191 :
192 : integer (kind=int_kind), dimension(max_nbtrcr), public :: &
193 : bio_index = 0 ! relates bio indices, ie. nlt_bgc_N to nt_bgc_N
194 :
195 : !=======================================================================
196 :
197 : contains
198 :
199 : !=======================================================================
200 : !autodocument_start icepack_init_tracer_flags
201 : ! set tracer active flags
202 :
203 8276 : subroutine icepack_init_tracer_flags(&
204 : tr_iage_in, tr_FY_in, tr_lvl_in, & ! LCOV_EXCL_LINE
205 : tr_pond_in, tr_pond_cesm_in, tr_pond_lvl_in, tr_pond_topo_in, & ! LCOV_EXCL_LINE
206 : tr_fsd_in, tr_aero_in, tr_iso_in, tr_brine_in, tr_zaero_in, & ! LCOV_EXCL_LINE
207 : tr_bgc_Nit_in, tr_bgc_N_in, tr_bgc_DON_in, tr_bgc_C_in, tr_bgc_chl_in, & ! LCOV_EXCL_LINE
208 : tr_bgc_Am_in, tr_bgc_Sil_in, tr_bgc_DMS_in, tr_bgc_Fe_in, tr_bgc_hum_in, & ! LCOV_EXCL_LINE
209 : tr_bgc_PON_in)
210 :
211 : logical, intent(in), optional :: &
212 : tr_iage_in , & ! if .true., use age tracer ! LCOV_EXCL_LINE
213 : tr_FY_in , & ! if .true., use first-year area tracer ! LCOV_EXCL_LINE
214 : tr_lvl_in , & ! if .true., use level ice tracer ! LCOV_EXCL_LINE
215 : tr_pond_in , & ! if .true., use melt pond tracer ! LCOV_EXCL_LINE
216 : tr_pond_cesm_in , & ! if .true., use cesm pond tracer ! LCOV_EXCL_LINE
217 : tr_pond_lvl_in , & ! if .true., use level-ice pond tracer ! LCOV_EXCL_LINE
218 : tr_pond_topo_in , & ! if .true., use explicit topography-based ponds ! LCOV_EXCL_LINE
219 : tr_fsd_in , & ! if .true., use floe size distribution tracers ! LCOV_EXCL_LINE
220 : tr_iso_in , & ! if .true., use isotope tracers ! LCOV_EXCL_LINE
221 : tr_aero_in , & ! if .true., use aerosol tracers ! LCOV_EXCL_LINE
222 : tr_brine_in , & ! if .true., brine height differs from ice thickness ! LCOV_EXCL_LINE
223 : tr_zaero_in , & ! if .true., black carbon is tracers (n_zaero) ! LCOV_EXCL_LINE
224 : tr_bgc_Nit_in , & ! if .true., Nitrate tracer in ice ! LCOV_EXCL_LINE
225 : tr_bgc_N_in , & ! if .true., algal nitrogen tracers (n_algae) ! LCOV_EXCL_LINE
226 : tr_bgc_DON_in , & ! if .true., DON pools are tracers (n_don) ! LCOV_EXCL_LINE
227 : tr_bgc_C_in , & ! if .true., algal carbon tracers + DOC and DIC ! LCOV_EXCL_LINE
228 : tr_bgc_chl_in , & ! if .true., algal chlorophyll tracers ! LCOV_EXCL_LINE
229 : tr_bgc_Am_in , & ! if .true., ammonia/um as nutrient tracer ! LCOV_EXCL_LINE
230 : tr_bgc_Sil_in , & ! if .true., silicon as nutrient tracer ! LCOV_EXCL_LINE
231 : tr_bgc_DMS_in , & ! if .true., DMS as product tracer ! LCOV_EXCL_LINE
232 : tr_bgc_Fe_in , & ! if .true., Fe as product tracer ! LCOV_EXCL_LINE
233 : tr_bgc_hum_in , & ! if .true., hum as product tracer ! LCOV_EXCL_LINE
234 : tr_bgc_PON_in ! if .true., PON as product tracer
235 :
236 : !autodocument_end
237 :
238 : character(len=*),parameter :: subname='(icepack_init_tracer_flags)'
239 :
240 8276 : if (present(tr_iage_in)) tr_iage = tr_iage_in
241 8276 : if (present(tr_FY_in) ) tr_FY = tr_FY_in
242 8276 : if (present(tr_lvl_in) ) tr_lvl = tr_lvl_in
243 8276 : if (present(tr_pond_in)) tr_pond = tr_pond_in
244 8276 : if (present(tr_pond_cesm_in)) tr_pond_cesm = tr_pond_cesm_in
245 8276 : if (present(tr_pond_lvl_in) ) tr_pond_lvl = tr_pond_lvl_in
246 8276 : if (present(tr_pond_topo_in)) tr_pond_topo = tr_pond_topo_in
247 8276 : if (present(tr_fsd_in) ) tr_fsd = tr_fsd_in
248 8276 : if (present(tr_iso_in) ) tr_iso = tr_iso_in
249 8276 : if (present(tr_aero_in) ) tr_aero = tr_aero_in
250 8276 : if (present(tr_brine_in) ) tr_brine = tr_brine_in
251 8276 : if (present(tr_zaero_in) ) tr_zaero = tr_zaero_in
252 8276 : if (present(tr_bgc_Nit_in)) tr_bgc_Nit = tr_bgc_Nit_in
253 8276 : if (present(tr_bgc_N_in) ) tr_bgc_N = tr_bgc_N_in
254 8276 : if (present(tr_bgc_DON_in)) tr_bgc_DON = tr_bgc_DON_in
255 8276 : if (present(tr_bgc_C_in) ) tr_bgc_C = tr_bgc_C_in
256 8276 : if (present(tr_bgc_chl_in)) tr_bgc_chl = tr_bgc_chl_in
257 8276 : if (present(tr_bgc_Am_in) ) tr_bgc_Am = tr_bgc_Am_in
258 8276 : if (present(tr_bgc_Sil_in)) tr_bgc_Sil = tr_bgc_Sil_in
259 8276 : if (present(tr_bgc_DMS_in)) tr_bgc_DMS = tr_bgc_DMS_in
260 8276 : if (present(tr_bgc_Fe_in )) tr_bgc_Fe = tr_bgc_Fe_in
261 8276 : if (present(tr_bgc_hum_in)) tr_bgc_hum = tr_bgc_hum_in
262 8276 : if (present(tr_bgc_PON_in)) tr_bgc_PON = tr_bgc_PON_in
263 :
264 8276 : end subroutine icepack_init_tracer_flags
265 :
266 : !=======================================================================
267 : !autodocument_start icepack_query_tracer_flags
268 : ! query tracer active flags
269 :
270 95325138 : subroutine icepack_query_tracer_flags(&
271 : tr_iage_out, tr_FY_out, tr_lvl_out, & ! LCOV_EXCL_LINE
272 : tr_pond_out, tr_pond_cesm_out, tr_pond_lvl_out, tr_pond_topo_out, & ! LCOV_EXCL_LINE
273 : tr_fsd_out, tr_aero_out, tr_iso_out, tr_brine_out, tr_zaero_out, & ! LCOV_EXCL_LINE
274 : tr_bgc_Nit_out, tr_bgc_N_out, tr_bgc_DON_out, tr_bgc_C_out, tr_bgc_chl_out, & ! LCOV_EXCL_LINE
275 : tr_bgc_Am_out, tr_bgc_Sil_out, tr_bgc_DMS_out, tr_bgc_Fe_out, tr_bgc_hum_out, & ! LCOV_EXCL_LINE
276 : tr_bgc_PON_out)
277 :
278 : logical, intent(out), optional :: &
279 : tr_iage_out , & ! if .true., use age tracer ! LCOV_EXCL_LINE
280 : tr_FY_out , & ! if .true., use first-year area tracer ! LCOV_EXCL_LINE
281 : tr_lvl_out , & ! if .true., use level ice tracer ! LCOV_EXCL_LINE
282 : tr_pond_out , & ! if .true., use melt pond tracer ! LCOV_EXCL_LINE
283 : tr_pond_cesm_out , & ! if .true., use cesm pond tracer ! LCOV_EXCL_LINE
284 : tr_pond_lvl_out , & ! if .true., use level-ice pond tracer ! LCOV_EXCL_LINE
285 : tr_pond_topo_out , & ! if .true., use explicit topography-based ponds ! LCOV_EXCL_LINE
286 : tr_fsd_out , & ! if .true., use floe size distribution ! LCOV_EXCL_LINE
287 : tr_iso_out , & ! if .true., use isotope tracers ! LCOV_EXCL_LINE
288 : tr_aero_out , & ! if .true., use aerosol tracers ! LCOV_EXCL_LINE
289 : tr_brine_out , & ! if .true., brine height differs from ice thickness ! LCOV_EXCL_LINE
290 : tr_zaero_out , & ! if .true., black carbon is tracers (n_zaero) ! LCOV_EXCL_LINE
291 : tr_bgc_Nit_out , & ! if .true., Nitrate tracer in ice ! LCOV_EXCL_LINE
292 : tr_bgc_N_out , & ! if .true., algal nitrogen tracers (n_algae) ! LCOV_EXCL_LINE
293 : tr_bgc_DON_out , & ! if .true., DON pools are tracers (n_don) ! LCOV_EXCL_LINE
294 : tr_bgc_C_out , & ! if .true., algal carbon tracers + DOC and DIC ! LCOV_EXCL_LINE
295 : tr_bgc_chl_out , & ! if .true., algal chlorophyll tracers ! LCOV_EXCL_LINE
296 : tr_bgc_Am_out , & ! if .true., ammonia/um as nutrient tracer ! LCOV_EXCL_LINE
297 : tr_bgc_Sil_out , & ! if .true., silicon as nutrient tracer ! LCOV_EXCL_LINE
298 : tr_bgc_DMS_out , & ! if .true., DMS as product tracer ! LCOV_EXCL_LINE
299 : tr_bgc_Fe_out , & ! if .true., Fe as product tracer ! LCOV_EXCL_LINE
300 : tr_bgc_hum_out , & ! if .true., hum as product tracer ! LCOV_EXCL_LINE
301 : tr_bgc_PON_out ! if .true., PON as product tracer
302 :
303 : !autodocument_end
304 :
305 : character(len=*),parameter :: subname='(icepack_query_tracer_flags)'
306 :
307 95325138 : if (present(tr_iage_out)) tr_iage_out = tr_iage
308 95325138 : if (present(tr_FY_out) ) tr_FY_out = tr_FY
309 95325138 : if (present(tr_lvl_out) ) tr_lvl_out = tr_lvl
310 95325138 : if (present(tr_pond_out)) tr_pond_out = tr_pond
311 95325138 : if (present(tr_pond_cesm_out)) tr_pond_cesm_out = tr_pond_cesm
312 95325138 : if (present(tr_pond_lvl_out) ) tr_pond_lvl_out = tr_pond_lvl
313 95325138 : if (present(tr_pond_topo_out)) tr_pond_topo_out = tr_pond_topo
314 95325138 : if (present(tr_fsd_out) ) tr_fsd_out = tr_fsd
315 95325138 : if (present(tr_iso_out) ) tr_iso_out = tr_iso
316 95325138 : if (present(tr_aero_out) ) tr_aero_out = tr_aero
317 95325138 : if (present(tr_brine_out) ) tr_brine_out = tr_brine
318 95325138 : if (present(tr_zaero_out) ) tr_zaero_out = tr_zaero
319 95325138 : if (present(tr_bgc_Nit_out)) tr_bgc_Nit_out = tr_bgc_Nit
320 95325138 : if (present(tr_bgc_N_out) ) tr_bgc_N_out = tr_bgc_N
321 95325138 : if (present(tr_bgc_DON_out)) tr_bgc_DON_out = tr_bgc_DON
322 95325138 : if (present(tr_bgc_C_out) ) tr_bgc_C_out = tr_bgc_C
323 95325138 : if (present(tr_bgc_chl_out)) tr_bgc_chl_out = tr_bgc_chl
324 95325138 : if (present(tr_bgc_Am_out) ) tr_bgc_Am_out = tr_bgc_Am
325 95325138 : if (present(tr_bgc_Sil_out)) tr_bgc_Sil_out = tr_bgc_Sil
326 95325138 : if (present(tr_bgc_DMS_out)) tr_bgc_DMS_out = tr_bgc_DMS
327 95325138 : if (present(tr_bgc_Fe_out )) tr_bgc_Fe_out = tr_bgc_Fe
328 95325138 : if (present(tr_bgc_hum_out)) tr_bgc_hum_out = tr_bgc_hum
329 95325138 : if (present(tr_bgc_PON_out)) tr_bgc_PON_out = tr_bgc_PON
330 :
331 95325138 : end subroutine icepack_query_tracer_flags
332 :
333 : !=======================================================================
334 : !autodocument_start icepack_write_tracer_flags
335 : ! write tracer active flags
336 :
337 334 : subroutine icepack_write_tracer_flags(iounit)
338 :
339 : integer, intent(in) :: iounit
340 :
341 : !autodocument_end
342 :
343 : character(len=*),parameter :: subname='(icepack_write_tracer_flags)'
344 :
345 334 : write(iounit,*) subname//":"
346 334 : write(iounit,*) " tr_iage = ",tr_iage
347 334 : write(iounit,*) " tr_FY = ",tr_FY
348 334 : write(iounit,*) " tr_lvl = ",tr_lvl
349 334 : write(iounit,*) " tr_pond = ",tr_pond
350 334 : write(iounit,*) " tr_pond_cesm = ",tr_pond_cesm
351 334 : write(iounit,*) " tr_pond_lvl = ",tr_pond_lvl
352 334 : write(iounit,*) " tr_pond_topo = ",tr_pond_topo
353 334 : write(iounit,*) " tr_fsd = ",tr_fsd
354 334 : write(iounit,*) " tr_iso = ",tr_iso
355 334 : write(iounit,*) " tr_aero = ",tr_aero
356 334 : write(iounit,*) " tr_brine = ",tr_brine
357 334 : write(iounit,*) " tr_zaero = ",tr_zaero
358 334 : write(iounit,*) " tr_bgc_Nit = ",tr_bgc_Nit
359 334 : write(iounit,*) " tr_bgc_N = ",tr_bgc_N
360 334 : write(iounit,*) " tr_bgc_DON = ",tr_bgc_DON
361 334 : write(iounit,*) " tr_bgc_C = ",tr_bgc_C
362 334 : write(iounit,*) " tr_bgc_chl = ",tr_bgc_chl
363 334 : write(iounit,*) " tr_bgc_Am = ",tr_bgc_Am
364 334 : write(iounit,*) " tr_bgc_Sil = ",tr_bgc_Sil
365 334 : write(iounit,*) " tr_bgc_DMS = ",tr_bgc_DMS
366 334 : write(iounit,*) " tr_bgc_Fe = ",tr_bgc_Fe
367 334 : write(iounit,*) " tr_bgc_hum = ",tr_bgc_hum
368 334 : write(iounit,*) " tr_bgc_PON = ",tr_bgc_PON
369 :
370 334 : end subroutine icepack_write_tracer_flags
371 :
372 : !=======================================================================
373 : !autodocument_start icepack_init_tracer_indices
374 : ! set the number of column tracer indices
375 :
376 8276 : subroutine icepack_init_tracer_indices(&
377 : nt_Tsfc_in, nt_qice_in, nt_qsno_in, nt_sice_in, & ! LCOV_EXCL_LINE
378 : nt_fbri_in, nt_iage_in, nt_FY_in, & ! LCOV_EXCL_LINE
379 : nt_alvl_in, nt_vlvl_in, nt_apnd_in, nt_hpnd_in, nt_ipnd_in, & ! LCOV_EXCL_LINE
380 : nt_fsd_in, nt_isosno_in, nt_isoice_in, & ! LCOV_EXCL_LINE
381 : nt_aero_in, nt_zaero_in, nt_bgc_C_in, & ! LCOV_EXCL_LINE
382 : nt_bgc_N_in, nt_bgc_chl_in, nt_bgc_DOC_in, nt_bgc_DON_in, & ! LCOV_EXCL_LINE
383 : nt_bgc_DIC_in, nt_bgc_Fed_in, nt_bgc_Fep_in, nt_bgc_Nit_in, nt_bgc_Am_in, & ! LCOV_EXCL_LINE
384 : nt_bgc_Sil_in, nt_bgc_DMSPp_in, nt_bgc_DMSPd_in, nt_bgc_DMS_in, nt_bgc_hum_in, & ! LCOV_EXCL_LINE
385 : nt_bgc_PON_in, nlt_zaero_in, nlt_bgc_C_in, nlt_bgc_N_in, nlt_bgc_chl_in, & ! LCOV_EXCL_LINE
386 : nlt_bgc_DOC_in, nlt_bgc_DON_in, nlt_bgc_DIC_in, nlt_bgc_Fed_in, & ! LCOV_EXCL_LINE
387 : nlt_bgc_Fep_in, nlt_bgc_Nit_in, nlt_bgc_Am_in, nlt_bgc_Sil_in, & ! LCOV_EXCL_LINE
388 : nlt_bgc_DMSPp_in, nlt_bgc_DMSPd_in, nlt_bgc_DMS_in, nlt_bgc_hum_in, & ! LCOV_EXCL_LINE
389 : nlt_bgc_PON_in, nt_zbgc_frac_in, nt_bgc_S_in, nlt_chl_sw_in, & ! LCOV_EXCL_LINE
390 : nlt_zaero_sw_in, & ! LCOV_EXCL_LINE
391 8276 : bio_index_o_in, bio_index_in)
392 :
393 : integer, intent(in), optional :: &
394 : nt_Tsfc_in, & ! ice/snow temperature ! LCOV_EXCL_LINE
395 : nt_qice_in, & ! volume-weighted ice enthalpy (in layers) ! LCOV_EXCL_LINE
396 : nt_qsno_in, & ! volume-weighted snow enthalpy (in layers) ! LCOV_EXCL_LINE
397 : nt_sice_in, & ! volume-weighted ice bulk salinity (CICE grid layers) ! LCOV_EXCL_LINE
398 : nt_fbri_in, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) ! LCOV_EXCL_LINE
399 : nt_iage_in, & ! volume-weighted ice age ! LCOV_EXCL_LINE
400 : nt_FY_in, & ! area-weighted first-year ice area ! LCOV_EXCL_LINE
401 : nt_alvl_in, & ! level ice area fraction ! LCOV_EXCL_LINE
402 : nt_vlvl_in, & ! level ice volume fraction ! LCOV_EXCL_LINE
403 : nt_apnd_in, & ! melt pond area fraction ! LCOV_EXCL_LINE
404 : nt_hpnd_in, & ! melt pond depth ! LCOV_EXCL_LINE
405 : nt_ipnd_in, & ! melt pond refrozen lid thickness ! LCOV_EXCL_LINE
406 : nt_fsd_in, & ! floe size distribution ! LCOV_EXCL_LINE
407 : nt_isosno_in, & ! starting index for isotopes in snow ! LCOV_EXCL_LINE
408 : nt_isoice_in, & ! starting index for isotopes in ice ! LCOV_EXCL_LINE
409 : nt_aero_in, & ! starting index for aerosols in ice ! LCOV_EXCL_LINE
410 : nt_bgc_Nit_in, & ! nutrients ! LCOV_EXCL_LINE
411 : nt_bgc_Am_in, & ! ! LCOV_EXCL_LINE
412 : nt_bgc_Sil_in, & ! ! LCOV_EXCL_LINE
413 : nt_bgc_DMSPp_in,&! trace gases (skeletal layer) ! LCOV_EXCL_LINE
414 : nt_bgc_DMSPd_in,&! ! LCOV_EXCL_LINE
415 : nt_bgc_DMS_in, & ! ! LCOV_EXCL_LINE
416 : nt_bgc_hum_in, & ! ! LCOV_EXCL_LINE
417 : nt_bgc_PON_in, & ! zooplankton and detritus ! LCOV_EXCL_LINE
418 : nlt_bgc_Nit_in,& ! nutrients ! LCOV_EXCL_LINE
419 : nlt_bgc_Am_in, & ! ! LCOV_EXCL_LINE
420 : nlt_bgc_Sil_in,& ! ! LCOV_EXCL_LINE
421 : nlt_bgc_DMSPp_in,&! trace gases (skeletal layer) ! LCOV_EXCL_LINE
422 : nlt_bgc_DMSPd_in,&! ! LCOV_EXCL_LINE
423 : nlt_bgc_DMS_in,& ! ! LCOV_EXCL_LINE
424 : nlt_bgc_hum_in,& ! ! LCOV_EXCL_LINE
425 : nlt_bgc_PON_in,& ! zooplankton and detritus ! LCOV_EXCL_LINE
426 : nt_zbgc_frac_in,&! fraction of tracer in the mobile phase ! LCOV_EXCL_LINE
427 : nt_bgc_S_in, & ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)) ! LCOV_EXCL_LINE
428 : nlt_chl_sw_in ! points to total chla in trcrn_sw
429 :
430 : integer (kind=int_kind), dimension(:), intent(in), optional :: &
431 : bio_index_o_in, & ! LCOV_EXCL_LINE
432 : bio_index_in
433 :
434 : integer (kind=int_kind), dimension(:), intent(in), optional :: &
435 : nt_bgc_N_in , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
436 : nt_bgc_C_in , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
437 : nt_bgc_chl_in, & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
438 : nlt_bgc_N_in , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
439 : nlt_bgc_C_in , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
440 : nlt_bgc_chl_in ! diatoms, phaeocystis, pico/small
441 :
442 : integer (kind=int_kind), dimension(:), intent(in), optional :: &
443 : nt_bgc_DOC_in, & ! dissolved organic carbon ! LCOV_EXCL_LINE
444 : nlt_bgc_DOC_in ! dissolved organic carbon
445 :
446 : integer (kind=int_kind), dimension(:), intent(in), optional :: &
447 : nt_bgc_DON_in, & ! dissolved organic nitrogen ! LCOV_EXCL_LINE
448 : nlt_bgc_DON_in ! dissolved organic nitrogen
449 :
450 : integer (kind=int_kind), dimension(:), intent(in), optional :: &
451 : nt_bgc_DIC_in, & ! dissolved inorganic carbon ! LCOV_EXCL_LINE
452 : nlt_bgc_DIC_in ! dissolved inorganic carbon
453 :
454 : integer (kind=int_kind), dimension(:), intent(in), optional :: &
455 : nt_bgc_Fed_in, & ! dissolved iron ! LCOV_EXCL_LINE
456 : nt_bgc_Fep_in, & ! particulate iron ! LCOV_EXCL_LINE
457 : nlt_bgc_Fed_in,& ! dissolved iron ! LCOV_EXCL_LINE
458 : nlt_bgc_Fep_in ! particulate iron
459 :
460 : integer (kind=int_kind), dimension(:), intent(in), optional :: &
461 : nt_zaero_in, & ! black carbon and other aerosols ! LCOV_EXCL_LINE
462 : nlt_zaero_in, & ! black carbon and other aerosols ! LCOV_EXCL_LINE
463 : nlt_zaero_sw_in ! black carbon and dust in trcrn_sw
464 :
465 : !autodocument_end
466 :
467 : ! local
468 : integer (kind=int_kind) :: k, nsiz
469 : character(len=*),parameter :: subname='(icepack_init_tracer_indices)'
470 :
471 8276 : if (present(nt_Tsfc_in)) nt_Tsfc = nt_Tsfc_in
472 8276 : if (present(nt_qice_in)) nt_qice = nt_qice_in
473 8276 : if (present(nt_qsno_in)) nt_qsno = nt_qsno_in
474 8276 : if (present(nt_sice_in)) nt_sice = nt_sice_in
475 8276 : if (present(nt_fbri_in)) nt_fbri = nt_fbri_in
476 8276 : if (present(nt_iage_in)) nt_iage = nt_iage_in
477 8276 : if (present(nt_FY_in) ) nt_FY = nt_FY_in
478 8276 : if (present(nt_alvl_in)) nt_alvl = nt_alvl_in
479 8276 : if (present(nt_vlvl_in)) nt_vlvl = nt_vlvl_in
480 8276 : if (present(nt_apnd_in)) nt_apnd = nt_apnd_in
481 8276 : if (present(nt_hpnd_in)) nt_hpnd = nt_hpnd_in
482 8276 : if (present(nt_ipnd_in)) nt_ipnd = nt_ipnd_in
483 8276 : if (present(nt_fsd_in) ) nt_fsd = nt_fsd_in
484 8276 : if (present(nt_isosno_in) ) nt_isosno = nt_isosno_in
485 8276 : if (present(nt_isoice_in) ) nt_isoice = nt_isoice_in
486 8276 : if (present(nt_aero_in) ) nt_aero = nt_aero_in
487 8276 : if (present(nt_bgc_Nit_in) ) nt_bgc_Nit = nt_bgc_Nit_in
488 8276 : if (present(nt_bgc_Am_in) ) nt_bgc_Am = nt_bgc_Am_in
489 8276 : if (present(nt_bgc_Sil_in) ) nt_bgc_Sil = nt_bgc_Sil_in
490 8276 : if (present(nt_bgc_DMSPp_in) ) nt_bgc_DMSPp = nt_bgc_DMSPp_in
491 8276 : if (present(nt_bgc_DMSPd_in) ) nt_bgc_DMSPd = nt_bgc_DMSPd_in
492 8276 : if (present(nt_bgc_DMS_in) ) nt_bgc_DMS = nt_bgc_DMS_in
493 8276 : if (present(nt_bgc_hum_in) ) nt_bgc_hum = nt_bgc_hum_in
494 8276 : if (present(nt_bgc_PON_in) ) nt_bgc_PON = nt_bgc_PON_in
495 8276 : if (present(nlt_bgc_Nit_in) ) nlt_bgc_Nit = nlt_bgc_Nit_in
496 8276 : if (present(nlt_bgc_Am_in) ) nlt_bgc_Am = nlt_bgc_Am_in
497 8276 : if (present(nlt_bgc_Sil_in) ) nlt_bgc_Sil = nlt_bgc_Sil_in
498 8276 : if (present(nlt_bgc_DMSPp_in)) nlt_bgc_DMSPp = nlt_bgc_DMSPp_in
499 8276 : if (present(nlt_bgc_DMSPd_in)) nlt_bgc_DMSPd = nlt_bgc_DMSPd_in
500 8276 : if (present(nlt_bgc_DMS_in) ) nlt_bgc_DMS = nlt_bgc_DMS_in
501 8276 : if (present(nlt_bgc_hum_in) ) nlt_bgc_hum = nlt_bgc_hum_in
502 8276 : if (present(nlt_bgc_PON_in) ) nlt_bgc_PON = nlt_bgc_PON_in
503 8276 : if (present(nlt_chl_sw_in) ) nlt_chl_sw = nlt_chl_sw_in
504 8276 : if (present(nt_zbgc_frac_in) ) nt_zbgc_frac = nt_zbgc_frac_in
505 8276 : if (present(nt_bgc_S_in) ) nt_bgc_S = nt_bgc_S_in
506 :
507 8276 : if (present(bio_index_in)) then
508 4138 : nsiz = size(bio_index_in)
509 4138 : if (size(bio_index) < nsiz) then
510 0 : call icepack_warnings_add(subname//'error in bio_index size')
511 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
512 : else
513 124140 : bio_index(1:nsiz) = bio_index_in(1:nsiz)
514 : endif
515 : endif
516 :
517 8276 : if (present(bio_index_o_in)) then
518 4138 : nsiz = size(bio_index_o_in)
519 4138 : if (size(bio_index_o) < nsiz) then
520 0 : call icepack_warnings_add(subname//'error in bio_index_o size')
521 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
522 : else
523 124140 : bio_index_o(1:nsiz) = bio_index_o_in(1:nsiz)
524 : endif
525 : endif
526 :
527 8276 : if (present(nt_bgc_N_in)) then
528 4138 : nsiz = size(nt_bgc_N_in)
529 4138 : if (size(nt_bgc_N) < nsiz) then
530 0 : call icepack_warnings_add(subname//'error in nt_bgc_N size')
531 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
532 : else
533 16552 : nt_bgc_N(1:nsiz) = nt_bgc_N_in(1:nsiz)
534 : endif
535 : endif
536 :
537 8276 : if (present(nlt_bgc_N_in)) then
538 4138 : nsiz = size(nlt_bgc_N_in)
539 4138 : if (size(nlt_bgc_N) < nsiz) then
540 0 : call icepack_warnings_add(subname//'error in nlt_bgc_N size')
541 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
542 : else
543 16552 : nlt_bgc_N(1:nsiz) = nlt_bgc_N_in(1:nsiz)
544 : endif
545 : endif
546 :
547 8276 : if (present(nt_bgc_chl_in)) then
548 4138 : nsiz = size(nt_bgc_chl_in)
549 4138 : if (size(nt_bgc_chl) < nsiz) then
550 0 : call icepack_warnings_add(subname//'error in nt_bgc_chl size')
551 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
552 : else
553 16552 : nt_bgc_chl(1:nsiz) = nt_bgc_chl_in(1:nsiz)
554 : endif
555 : endif
556 :
557 8276 : if (present(nlt_bgc_chl_in)) then
558 4138 : nsiz = size(nlt_bgc_chl_in)
559 4138 : if (size(nlt_bgc_chl) < nsiz) then
560 0 : call icepack_warnings_add(subname//'error in nlt_bgc_chl size')
561 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
562 : else
563 16552 : nlt_bgc_chl(1:nsiz) = nlt_bgc_chl_in(1:nsiz)
564 : endif
565 : endif
566 :
567 : ! algal C is not yet distinct from algal N
568 8276 : if (present(nt_bgc_C_in) .or. present(nlt_bgc_C_in)) then
569 0 : call icepack_warnings_add(subname//'error bgc_C not supported')
570 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
571 : endif
572 :
573 : ! if (present(nt_bgc_C_in)) then
574 : ! nsiz = size(nt_bgc_C_in)
575 : ! if (size(nt_bgc_C) < nsiz) then
576 : ! call icepack_warnings_add(subname//'error in nt_bgc_C size')
577 : ! call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
578 : ! else
579 : ! nt_bgc_C(1:nsiz) = nt_bgc_C_in(1:nsiz)
580 : ! endif
581 : ! endif
582 :
583 : ! if (present(nlt_bgc_C_in)) then
584 : ! nsiz = size(nlt_bgc_C_in)
585 : ! if (size(nlt_bgc_C) < nsiz) then
586 : ! call icepack_warnings_add(subname//'error in nlt_bgc_C size')
587 : ! call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
588 : ! else
589 : ! nlt_bgc_C(1:nsiz) = nlt_bgc_C_in(1:nsiz)
590 : ! endif
591 : ! endif
592 :
593 8276 : if (present(nt_bgc_DOC_in)) then
594 4138 : nsiz = size(nt_bgc_DOC_in)
595 4138 : if (size(nt_bgc_DOC) < nsiz) then
596 0 : call icepack_warnings_add(subname//'error in nt_bgc_DOC size')
597 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
598 : else
599 16552 : nt_bgc_DOC(1:nsiz) = nt_bgc_DOC_in(1:nsiz)
600 : endif
601 : endif
602 :
603 8276 : if (present(nlt_bgc_DOC_in)) then
604 4138 : nsiz = size(nlt_bgc_DOC_in)
605 4138 : if (size(nlt_bgc_DOC) < nsiz) then
606 0 : call icepack_warnings_add(subname//'error in nlt_bgc_DOC size')
607 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
608 : else
609 16552 : nlt_bgc_DOC(1:nsiz) = nlt_bgc_DOC_in(1:nsiz)
610 : endif
611 : endif
612 :
613 8276 : if (present(nt_bgc_DON_in)) then
614 4138 : nsiz = size(nt_bgc_DON_in)
615 4138 : if (size(nt_bgc_DON) < nsiz) then
616 0 : call icepack_warnings_add(subname//'error in nt_bgc_DON size')
617 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
618 : else
619 8276 : nt_bgc_DON(1:nsiz) = nt_bgc_DON_in(1:nsiz)
620 : endif
621 : endif
622 :
623 8276 : if (present(nlt_bgc_DON_in)) then
624 4138 : nsiz = size(nlt_bgc_DON_in)
625 4138 : if (size(nlt_bgc_DON) < nsiz) then
626 0 : call icepack_warnings_add(subname//'error in nlt_bgc_DON size')
627 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
628 : else
629 8276 : nlt_bgc_DON(1:nsiz) = nlt_bgc_DON_in(1:nsiz)
630 : endif
631 : endif
632 :
633 8276 : if (present(nt_bgc_DIC_in)) then
634 4138 : nsiz = size(nt_bgc_DIC_in)
635 4138 : if (size(nt_bgc_DIC) < nsiz) then
636 0 : call icepack_warnings_add(subname//'error in nt_bgc_DIC size')
637 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
638 : else
639 8276 : nt_bgc_DIC(1:nsiz) = nt_bgc_DIC_in(1:nsiz)
640 : endif
641 : endif
642 :
643 8276 : if (present(nlt_bgc_DIC_in)) then
644 4138 : nsiz = size(nlt_bgc_DIC_in)
645 4138 : if (size(nlt_bgc_DIC) < nsiz) then
646 0 : call icepack_warnings_add(subname//'error in nlt_bgc_DIC size')
647 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
648 : else
649 8276 : nlt_bgc_DIC(1:nsiz) = nlt_bgc_DIC_in(1:nsiz)
650 : endif
651 : endif
652 :
653 8276 : if (present(nt_bgc_Fed_in)) then
654 4138 : nsiz = size(nt_bgc_Fed_in)
655 4138 : if (size(nt_bgc_Fed) < nsiz) then
656 0 : call icepack_warnings_add(subname//'error in nt_bgc_Fed size')
657 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
658 : else
659 12414 : nt_bgc_Fed(1:nsiz) = nt_bgc_Fed_in(1:nsiz)
660 : endif
661 : endif
662 :
663 8276 : if (present(nlt_bgc_Fed_in)) then
664 4138 : nsiz = size(nlt_bgc_Fed_in)
665 4138 : if (size(nlt_bgc_Fed) < nsiz) then
666 0 : call icepack_warnings_add(subname//'error in nlt_bgc_Fed size')
667 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
668 : else
669 12414 : nlt_bgc_Fed(1:nsiz) = nlt_bgc_Fed_in(1:nsiz)
670 : endif
671 : endif
672 :
673 8276 : if (present(nt_bgc_Fep_in)) then
674 4138 : nsiz = size(nt_bgc_Fep_in)
675 4138 : if (size(nt_bgc_Fep) < nsiz) then
676 0 : call icepack_warnings_add(subname//'error in nt_bgc_Fep size')
677 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
678 : else
679 12414 : nt_bgc_Fep(1:nsiz) = nt_bgc_Fep_in(1:nsiz)
680 : endif
681 : endif
682 :
683 8276 : if (present(nlt_bgc_Fep_in)) then
684 4138 : nsiz = size(nlt_bgc_Fep_in)
685 4138 : if (size(nlt_bgc_Fep) < nsiz) then
686 0 : call icepack_warnings_add(subname//'error in nlt_bgc_Fep size')
687 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
688 : else
689 12414 : nlt_bgc_Fep(1:nsiz) = nlt_bgc_Fep_in(1:nsiz)
690 : endif
691 : endif
692 :
693 8276 : if (present(nt_zaero_in)) then
694 4138 : nsiz = size(nt_zaero_in)
695 4138 : if (size(nt_zaero) < nsiz) then
696 0 : call icepack_warnings_add(subname//'error in nt_zaero size')
697 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
698 : else
699 28966 : nt_zaero(1:nsiz) = nt_zaero_in(1:nsiz)
700 : endif
701 : endif
702 :
703 8276 : if (present(nlt_zaero_in)) then
704 4138 : nsiz = size(nlt_zaero_in)
705 4138 : if (size(nlt_zaero) < nsiz) then
706 0 : call icepack_warnings_add(subname//'error in nlt_zaero size')
707 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
708 : else
709 28966 : nlt_zaero(1:nsiz) = nlt_zaero_in(1:nsiz)
710 : endif
711 : endif
712 :
713 8276 : if (present(nlt_zaero_sw_in)) then
714 4138 : nsiz = size(nlt_zaero_sw_in)
715 4138 : if (size(nlt_zaero_sw) < nsiz) then
716 0 : call icepack_warnings_add(subname//'error in nlt_zaero_sw size')
717 0 : call icepack_warnings_setabort(.true.,__FILE__,__LINE__)
718 : else
719 28966 : nlt_zaero_sw(1:nsiz) = nlt_zaero_sw_in(1:nsiz)
720 : endif
721 : endif
722 :
723 8276 : end subroutine icepack_init_tracer_indices
724 :
725 : !=======================================================================
726 : !autodocument_start icepack_query_tracer_indices
727 : ! query the number of column tracer indices
728 :
729 117077687 : subroutine icepack_query_tracer_indices(&
730 : nt_Tsfc_out, nt_qice_out, nt_qsno_out, nt_sice_out, & ! LCOV_EXCL_LINE
731 : nt_fbri_out, nt_iage_out, nt_FY_out, & ! LCOV_EXCL_LINE
732 : nt_alvl_out, nt_vlvl_out, nt_apnd_out, nt_hpnd_out, nt_ipnd_out, & ! LCOV_EXCL_LINE
733 : nt_fsd_out, nt_isosno_out, nt_isoice_out, & ! LCOV_EXCL_LINE
734 : nt_aero_out, nt_zaero_out, nt_bgc_C_out, & ! LCOV_EXCL_LINE
735 : nt_bgc_N_out, nt_bgc_chl_out, nt_bgc_DOC_out, nt_bgc_DON_out, & ! LCOV_EXCL_LINE
736 : nt_bgc_DIC_out, nt_bgc_Fed_out, nt_bgc_Fep_out, nt_bgc_Nit_out, nt_bgc_Am_out, & ! LCOV_EXCL_LINE
737 : nt_bgc_Sil_out, nt_bgc_DMSPp_out, nt_bgc_DMSPd_out, nt_bgc_DMS_out, nt_bgc_hum_out, & ! LCOV_EXCL_LINE
738 : nt_bgc_PON_out, nlt_zaero_out, nlt_bgc_C_out, nlt_bgc_N_out, nlt_bgc_chl_out, & ! LCOV_EXCL_LINE
739 : nlt_bgc_DOC_out, nlt_bgc_DON_out, nlt_bgc_DIC_out, nlt_bgc_Fed_out, & ! LCOV_EXCL_LINE
740 : nlt_bgc_Fep_out, nlt_bgc_Nit_out, nlt_bgc_Am_out, nlt_bgc_Sil_out, & ! LCOV_EXCL_LINE
741 : nlt_bgc_DMSPp_out, nlt_bgc_DMSPd_out, nlt_bgc_DMS_out, nlt_bgc_hum_out, & ! LCOV_EXCL_LINE
742 : nlt_bgc_PON_out, nt_zbgc_frac_out, nt_bgc_S_out, nlt_chl_sw_out, & ! LCOV_EXCL_LINE
743 : nlt_zaero_sw_out, & ! LCOV_EXCL_LINE
744 117077687 : bio_index_o_out, bio_index_out)
745 :
746 : integer, intent(out), optional :: &
747 : nt_Tsfc_out, & ! ice/snow temperature ! LCOV_EXCL_LINE
748 : nt_qice_out, & ! volume-weighted ice enthalpy (in layers) ! LCOV_EXCL_LINE
749 : nt_qsno_out, & ! volume-weighted snow enthalpy (in layers) ! LCOV_EXCL_LINE
750 : nt_sice_out, & ! volume-weighted ice bulk salinity (CICE grid layers) ! LCOV_EXCL_LINE
751 : nt_fbri_out, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) ! LCOV_EXCL_LINE
752 : nt_iage_out, & ! volume-weighted ice age ! LCOV_EXCL_LINE
753 : nt_FY_out, & ! area-weighted first-year ice area ! LCOV_EXCL_LINE
754 : nt_alvl_out, & ! level ice area fraction ! LCOV_EXCL_LINE
755 : nt_vlvl_out, & ! level ice volume fraction ! LCOV_EXCL_LINE
756 : nt_apnd_out, & ! melt pond area fraction ! LCOV_EXCL_LINE
757 : nt_hpnd_out, & ! melt pond depth ! LCOV_EXCL_LINE
758 : nt_ipnd_out, & ! melt pond refrozen lid thickness ! LCOV_EXCL_LINE
759 : nt_fsd_out, & ! floe size distribution ! LCOV_EXCL_LINE
760 : nt_isosno_out, & ! starting index for isotopes in snow ! LCOV_EXCL_LINE
761 : nt_isoice_out, & ! starting index for isotopes in ice ! LCOV_EXCL_LINE
762 : nt_aero_out, & ! starting index for aerosols in ice ! LCOV_EXCL_LINE
763 : nt_bgc_Nit_out, & ! nutrients ! LCOV_EXCL_LINE
764 : nt_bgc_Am_out, & ! ! LCOV_EXCL_LINE
765 : nt_bgc_Sil_out, & ! ! LCOV_EXCL_LINE
766 : nt_bgc_DMSPp_out,&! trace gases (skeletal layer) ! LCOV_EXCL_LINE
767 : nt_bgc_DMSPd_out,&! ! LCOV_EXCL_LINE
768 : nt_bgc_DMS_out, & ! ! LCOV_EXCL_LINE
769 : nt_bgc_hum_out, & ! ! LCOV_EXCL_LINE
770 : nt_bgc_PON_out, & ! zooplankton and detritus ! LCOV_EXCL_LINE
771 : nlt_bgc_Nit_out,& ! nutrients ! LCOV_EXCL_LINE
772 : nlt_bgc_Am_out, & ! ! LCOV_EXCL_LINE
773 : nlt_bgc_Sil_out,& ! ! LCOV_EXCL_LINE
774 : nlt_bgc_DMSPp_out,&! trace gases (skeletal layer) ! LCOV_EXCL_LINE
775 : nlt_bgc_DMSPd_out,&! ! LCOV_EXCL_LINE
776 : nlt_bgc_DMS_out,& ! ! LCOV_EXCL_LINE
777 : nlt_bgc_hum_out,& ! ! LCOV_EXCL_LINE
778 : nlt_bgc_PON_out,& ! zooplankton and detritus ! LCOV_EXCL_LINE
779 : nt_zbgc_frac_out,&! fraction of tracer in the mobile phase ! LCOV_EXCL_LINE
780 : nt_bgc_S_out, & ! Bulk salinity in fraction ice with dynamic salinity (Bio grid)) ! LCOV_EXCL_LINE
781 : nlt_chl_sw_out ! points to total chla in trcrn_sw
782 :
783 : integer (kind=int_kind), dimension(:), intent(out), optional :: &
784 : bio_index_o_out, & ! LCOV_EXCL_LINE
785 : bio_index_out
786 :
787 : integer (kind=int_kind), dimension(:), intent(out), optional :: &
788 : nt_bgc_N_out , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
789 : nt_bgc_C_out , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
790 : nt_bgc_chl_out, & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
791 : nlt_bgc_N_out , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
792 : nlt_bgc_C_out , & ! diatoms, phaeocystis, pico/small ! LCOV_EXCL_LINE
793 : nlt_bgc_chl_out ! diatoms, phaeocystis, pico/small
794 :
795 : integer (kind=int_kind), dimension(:), intent(out), optional :: &
796 : nt_bgc_DOC_out, & ! dissolved organic carbon ! LCOV_EXCL_LINE
797 : nlt_bgc_DOC_out ! dissolved organic carbon
798 :
799 : integer (kind=int_kind), dimension(:), intent(out), optional :: &
800 : nt_bgc_DON_out, & ! dissolved organic nitrogen ! LCOV_EXCL_LINE
801 : nlt_bgc_DON_out ! dissolved organic nitrogen
802 :
803 : integer (kind=int_kind), dimension(:), intent(out), optional :: &
804 : nt_bgc_DIC_out, & ! dissolved inorganic carbon ! LCOV_EXCL_LINE
805 : nlt_bgc_DIC_out ! dissolved inorganic carbon
806 :
807 : integer (kind=int_kind), dimension(:), intent(out), optional :: &
808 : nt_bgc_Fed_out, & ! dissolved iron ! LCOV_EXCL_LINE
809 : nt_bgc_Fep_out, & ! particulate iron ! LCOV_EXCL_LINE
810 : nlt_bgc_Fed_out,& ! dissolved iron ! LCOV_EXCL_LINE
811 : nlt_bgc_Fep_out ! particulate iron
812 :
813 : integer (kind=int_kind), dimension(:), intent(out), optional :: &
814 : nt_zaero_out, & ! black carbon and other aerosols ! LCOV_EXCL_LINE
815 : nlt_zaero_out, & ! black carbon and other aerosols ! LCOV_EXCL_LINE
816 : nlt_zaero_sw_out ! black carbon and dust in trcrn_sw
817 :
818 : !autodocument_end
819 :
820 : character(len=*),parameter :: subname='(icepack_query_tracer_indices)'
821 :
822 117077687 : if (present(nt_Tsfc_out)) nt_Tsfc_out = nt_Tsfc
823 117077687 : if (present(nt_qice_out)) nt_qice_out = nt_qice
824 117077687 : if (present(nt_qsno_out)) nt_qsno_out = nt_qsno
825 117077687 : if (present(nt_sice_out)) nt_sice_out = nt_sice
826 117077687 : if (present(nt_fbri_out)) nt_fbri_out = nt_fbri
827 117077687 : if (present(nt_iage_out)) nt_iage_out = nt_iage
828 117077687 : if (present(nt_FY_out) ) nt_FY_out = nt_FY
829 117077687 : if (present(nt_alvl_out)) nt_alvl_out = nt_alvl
830 117077687 : if (present(nt_vlvl_out)) nt_vlvl_out = nt_vlvl
831 117077687 : if (present(nt_apnd_out)) nt_apnd_out = nt_apnd
832 117077687 : if (present(nt_hpnd_out)) nt_hpnd_out = nt_hpnd
833 117077687 : if (present(nt_ipnd_out)) nt_ipnd_out = nt_ipnd
834 117077687 : if (present(nt_fsd_out) ) nt_fsd_out = nt_fsd
835 117077687 : if (present(nt_isosno_out) ) nt_isosno_out = nt_isosno
836 117077687 : if (present(nt_isoice_out) ) nt_isoice_out = nt_isoice
837 117077687 : if (present(nt_aero_out) ) nt_aero_out = nt_aero
838 117077687 : if (present(nt_bgc_Nit_out) ) nt_bgc_Nit_out = nt_bgc_Nit
839 117077687 : if (present(nt_bgc_Am_out) ) nt_bgc_Am_out = nt_bgc_Am
840 117077687 : if (present(nt_bgc_Sil_out) ) nt_bgc_Sil_out = nt_bgc_Sil
841 117077687 : if (present(nt_bgc_DMSPp_out) ) nt_bgc_DMSPp_out = nt_bgc_DMSPp
842 117077687 : if (present(nt_bgc_DMSPd_out) ) nt_bgc_DMSPd_out = nt_bgc_DMSPd
843 117077687 : if (present(nt_bgc_DMS_out) ) nt_bgc_DMS_out = nt_bgc_DMS
844 117077687 : if (present(nt_bgc_hum_out) ) nt_bgc_hum_out = nt_bgc_hum
845 117077687 : if (present(nt_bgc_PON_out) ) nt_bgc_PON_out = nt_bgc_PON
846 117077687 : if (present(nlt_bgc_Nit_out) ) nlt_bgc_Nit_out = nlt_bgc_Nit
847 117077687 : if (present(nlt_bgc_Am_out) ) nlt_bgc_Am_out = nlt_bgc_Am
848 117077687 : if (present(nlt_bgc_Sil_out) ) nlt_bgc_Sil_out = nlt_bgc_Sil
849 117077687 : if (present(nlt_bgc_DMSPp_out)) nlt_bgc_DMSPp_out = nlt_bgc_DMSPp
850 117077687 : if (present(nlt_bgc_DMSPd_out)) nlt_bgc_DMSPd_out = nlt_bgc_DMSPd
851 117077687 : if (present(nlt_bgc_DMS_out) ) nlt_bgc_DMS_out = nlt_bgc_DMS
852 117077687 : if (present(nlt_bgc_hum_out) ) nlt_bgc_hum_out = nlt_bgc_hum
853 117077687 : if (present(nlt_bgc_PON_out) ) nlt_bgc_PON_out = nlt_bgc_PON
854 117077687 : if (present(nlt_chl_sw_out) ) nlt_chl_sw_out = nlt_chl_sw
855 117077687 : if (present(nt_zbgc_frac_out) ) nt_zbgc_frac_out = nt_zbgc_frac
856 117077687 : if (present(nt_bgc_S_out) ) nt_bgc_S_out = nt_bgc_S
857 :
858 436558391 : if (present(bio_index_o_out) ) bio_index_o_out = bio_index_o
859 117077687 : if (present(bio_index_out) ) bio_index_out = bio_index
860 183420029 : if (present(nt_bgc_N_out) ) nt_bgc_N_out = nt_bgc_N
861 150354137 : if (present(nlt_bgc_N_out) ) nlt_bgc_N_out = nlt_bgc_N
862 150332306 : if (present(nt_bgc_C_out) ) nt_bgc_C_out = nt_bgc_C
863 150328556 : if (present(nlt_bgc_C_out) ) nlt_bgc_C_out = nlt_bgc_C
864 150344720 : if (present(nt_bgc_chl_out) ) nt_bgc_chl_out = nt_bgc_chl
865 150340970 : if (present(nlt_bgc_chl_out) ) nlt_bgc_chl_out = nlt_bgc_chl
866 150357887 : if (present(nt_bgc_DOC_out) ) nt_bgc_DOC_out = nt_bgc_DOC
867 150354137 : if (present(nlt_bgc_DOC_out) ) nlt_bgc_DOC_out = nlt_bgc_DOC
868 128171087 : if (present(nt_bgc_DON_out) ) nt_bgc_DON_out = nt_bgc_DON
869 128169837 : if (present(nlt_bgc_DON_out) ) nlt_bgc_DON_out = nlt_bgc_DON
870 128166698 : if (present(nt_bgc_DIC_out) ) nt_bgc_DIC_out = nt_bgc_DIC
871 128165448 : if (present(nlt_bgc_DIC_out) ) nlt_bgc_DIC_out = nlt_bgc_DIC
872 139264487 : if (present(nt_bgc_Fed_out) ) nt_bgc_Fed_out = nt_bgc_Fed
873 139261987 : if (present(nlt_bgc_Fed_out) ) nlt_bgc_Fed_out = nlt_bgc_Fed
874 139264487 : if (present(nt_bgc_Fep_out) ) nt_bgc_Fep_out = nt_bgc_Fep
875 139261987 : if (present(nlt_bgc_Fep_out) ) nlt_bgc_Fep_out = nlt_bgc_Fep
876 249762371 : if (present(nt_zaero_out) ) nt_zaero_out = nt_zaero
877 250026107 : if (present(nlt_zaero_out) ) nlt_zaero_out = nlt_zaero
878 249730043 : if (present(nlt_zaero_sw_out)) nlt_zaero_sw_out = nlt_zaero_sw
879 :
880 117077687 : end subroutine icepack_query_tracer_indices
881 :
882 : !=======================================================================
883 : !autodocument_start icepack_write_tracer_indices
884 : ! write the number of column tracer indices
885 :
886 334 : subroutine icepack_write_tracer_indices(iounit)
887 :
888 : integer, intent(in), optional :: iounit
889 :
890 : !autodocument_end
891 :
892 : ! local
893 : integer (kind=int_kind) :: k
894 : character(len=*),parameter :: subname='(icepack_write_tracer_indices)'
895 :
896 334 : write(iounit,*) subname//":"
897 334 : write(iounit,*) " nt_Tsfc = ",nt_Tsfc
898 334 : write(iounit,*) " nt_qice = ",nt_qice
899 334 : write(iounit,*) " nt_qsno = ",nt_qsno
900 334 : write(iounit,*) " nt_sice = ",nt_sice
901 334 : write(iounit,*) " nt_fbri = ",nt_fbri
902 334 : write(iounit,*) " nt_iage = ",nt_iage
903 334 : write(iounit,*) " nt_FY = ",nt_FY
904 334 : write(iounit,*) " nt_alvl = ",nt_alvl
905 334 : write(iounit,*) " nt_vlvl = ",nt_vlvl
906 334 : write(iounit,*) " nt_apnd = ",nt_apnd
907 334 : write(iounit,*) " nt_hpnd = ",nt_hpnd
908 334 : write(iounit,*) " nt_ipnd = ",nt_ipnd
909 334 : write(iounit,*) " nt_fsd = ",nt_fsd
910 334 : write(iounit,*) " nt_isosno = ",nt_isosno
911 334 : write(iounit,*) " nt_isoice = ",nt_isoice
912 334 : write(iounit,*) " nt_aero = ",nt_aero
913 334 : write(iounit,*) " nt_bgc_Nit = ",nt_bgc_Nit
914 334 : write(iounit,*) " nt_bgc_Am = ",nt_bgc_Am
915 334 : write(iounit,*) " nt_bgc_Sil = ",nt_bgc_Sil
916 334 : write(iounit,*) " nt_bgc_DMSPp = ",nt_bgc_DMSPp
917 334 : write(iounit,*) " nt_bgc_DMSPd = ",nt_bgc_DMSPd
918 334 : write(iounit,*) " nt_bgc_DMS = ",nt_bgc_DMS
919 334 : write(iounit,*) " nt_bgc_hum = ",nt_bgc_hum
920 334 : write(iounit,*) " nt_bgc_PON = ",nt_bgc_PON
921 334 : write(iounit,*) " nlt_bgc_Nit = ",nlt_bgc_Nit
922 334 : write(iounit,*) " nlt_bgc_Am = ",nlt_bgc_Am
923 334 : write(iounit,*) " nlt_bgc_Sil = ",nlt_bgc_Sil
924 334 : write(iounit,*) " nlt_bgc_DMSPp = ",nlt_bgc_DMSPp
925 334 : write(iounit,*) " nlt_bgc_DMSPd = ",nlt_bgc_DMSPd
926 334 : write(iounit,*) " nlt_bgc_DMS = ",nlt_bgc_DMS
927 334 : write(iounit,*) " nlt_bgc_hum = ",nlt_bgc_hum
928 334 : write(iounit,*) " nlt_bgc_PON = ",nlt_bgc_PON
929 334 : write(iounit,*) " nlt_chl_sw = ",nlt_chl_sw
930 334 : write(iounit,*) " nt_zbgc_frac = ",nt_zbgc_frac
931 334 : write(iounit,*) " nt_bgc_S = ",nt_bgc_S
932 :
933 334 : write(iounit,*) " max_nbtrcr = ",max_nbtrcr
934 10020 : do k = 1, max_nbtrcr
935 9686 : write(iounit,*) " bio_index_o(k) = ",k,bio_index_o(k)
936 10020 : write(iounit,*) " bio_index(k) = ",k,bio_index(k)
937 : enddo
938 :
939 334 : write(iounit,*) " max_algae = ",max_algae
940 1336 : do k = 1, max_algae
941 1002 : write(iounit,*) " nt_bgc_N(k) = ",k,nt_bgc_N(k)
942 1002 : write(iounit,*) " nlt_bgc_N(k) = ",k,nlt_bgc_N(k)
943 1002 : write(iounit,*) " nt_bgc_C(k) = ",k,nt_bgc_C(k)
944 1002 : write(iounit,*) " nlt_bgc_C(k) = ",k,nlt_bgc_C(k)
945 1002 : write(iounit,*) " nt_bgc_chl(k) = ",k,nt_bgc_chl(k)
946 1336 : write(iounit,*) " nlt_bgc_chl(k) = ",k,nlt_bgc_chl(k)
947 : enddo
948 :
949 334 : write(iounit,*) " max_DOC = ",max_DOC
950 1336 : do k = 1, max_DOC
951 1002 : write(iounit,*) " nt_bgc_DOC(k) = ",k,nt_bgc_DOC(k)
952 1336 : write(iounit,*) " nlt_bgc_DOC(k) = ",k,nlt_bgc_DOC(k)
953 : enddo
954 :
955 334 : write(iounit,*) " max_DON = ",max_DON
956 668 : do k = 1, max_DON
957 334 : write(iounit,*) " nt_bgc_DON(k) = ",k,nt_bgc_DON(k)
958 668 : write(iounit,*) " nlt_bgc_DON(k) = ",k,nlt_bgc_DON(k)
959 : enddo
960 :
961 334 : write(iounit,*) " max_DIC = ",max_DIC
962 668 : do k = 1, max_DIC
963 334 : write(iounit,*) " nt_bgc_DIC(k) = ",k,nt_bgc_DIC(k)
964 668 : write(iounit,*) " nlt_bgc_DIC(k) = ",k,nlt_bgc_DIC(k)
965 : enddo
966 :
967 334 : write(iounit,*) " max_fe = ",max_fe
968 1002 : do k = 1, max_fe
969 668 : write(iounit,*) " nt_bgc_Fed(k) = ",k,nt_bgc_Fed(k)
970 668 : write(iounit,*) " nlt_bgc_Fed(k) = ",k,nlt_bgc_Fed(k)
971 668 : write(iounit,*) " nt_bgc_Fep(k) = ",k,nt_bgc_Fep(k)
972 1002 : write(iounit,*) " nlt_bgc_Fep(k) = ",k,nlt_bgc_Fep(k)
973 : enddo
974 :
975 334 : write(iounit,*) " max_aero = ",max_aero
976 2338 : do k = 1, max_aero
977 2004 : write(iounit,*) " nt_zaero(k) = ",k,nt_zaero(k)
978 2004 : write(iounit,*) " nlt_zaero(k) = ",k,nlt_zaero(k)
979 2338 : write(iounit,*) " nlt_zaero_sw(k) = ",k,nlt_zaero_sw(k)
980 : enddo
981 :
982 334 : end subroutine icepack_write_tracer_indices
983 :
984 : !=======================================================================
985 : !autodocument_start icepack_init_tracer_sizes
986 : ! set the number of column tracers
987 :
988 12414 : subroutine icepack_init_tracer_sizes(&
989 : ncat_in, nilyr_in, nslyr_in, nblyr_in, nfsd_in , & ! LCOV_EXCL_LINE
990 : n_algae_in, n_DOC_in, n_aero_in, n_iso_in, & ! LCOV_EXCL_LINE
991 : n_DON_in, n_DIC_in, n_fed_in, n_fep_in, n_zaero_in, & ! LCOV_EXCL_LINE
992 : ntrcr_in, ntrcr_o_in, nbtrcr_in, nbtrcr_sw_in)
993 :
994 : integer (kind=int_kind), intent(in), optional :: &
995 : ncat_in , & ! Categories ! LCOV_EXCL_LINE
996 : nfsd_in , & ! ! LCOV_EXCL_LINE
997 : nilyr_in , & ! Layers ! LCOV_EXCL_LINE
998 : nslyr_in , & ! ! LCOV_EXCL_LINE
999 : nblyr_in , & ! ! LCOV_EXCL_LINE
1000 : n_algae_in, & ! Dimensions ! LCOV_EXCL_LINE
1001 : n_DOC_in , & ! ! LCOV_EXCL_LINE
1002 : n_DON_in , & ! ! LCOV_EXCL_LINE
1003 : n_DIC_in , & ! ! LCOV_EXCL_LINE
1004 : n_fed_in , & ! ! LCOV_EXCL_LINE
1005 : n_fep_in , & ! ! LCOV_EXCL_LINE
1006 : n_zaero_in, & ! ! LCOV_EXCL_LINE
1007 : n_iso_in , & ! ! LCOV_EXCL_LINE
1008 : n_aero_in , & ! ! LCOV_EXCL_LINE
1009 : ntrcr_in , & ! number of tracers in use ! LCOV_EXCL_LINE
1010 : ntrcr_o_in, & ! number of non-bio tracers in use ! LCOV_EXCL_LINE
1011 : nbtrcr_in , & ! number of bio tracers in use ! LCOV_EXCL_LINE
1012 : nbtrcr_sw_in ! number of shortwave bio tracers in use
1013 :
1014 : !autodocument_end
1015 :
1016 : character(len=*),parameter :: subname='(icepack_init_tracer_sizes)'
1017 :
1018 12414 : if (present(ncat_in) ) ncat = ncat_in
1019 12414 : if (present(nilyr_in) ) nilyr = nilyr_in
1020 12414 : if (present(nslyr_in) ) nslyr = nslyr_in
1021 12414 : if (present(nblyr_in) ) nblyr = nblyr_in
1022 12414 : if (present(nfsd_in) ) nfsd = nfsd_in
1023 :
1024 12414 : if (present(n_algae_in) ) n_algae = n_algae_in
1025 12414 : if (present(n_DOC_in) ) n_DOC = n_DOC_in
1026 12414 : if (present(n_DON_in) ) n_DON = n_DON_in
1027 12414 : if (present(n_DIC_in) ) n_DIC = n_DIC_in
1028 12414 : if (present(n_fed_in) ) n_fed = n_fed_in
1029 12414 : if (present(n_fep_in) ) n_fep = n_fep_in
1030 12414 : if (present(n_zaero_in) ) n_zaero = n_zaero_in
1031 12414 : if (present(n_iso_in) ) n_iso = n_iso_in
1032 12414 : if (present(n_aero_in) ) n_aero = n_aero_in
1033 :
1034 12414 : if (present(ntrcr_in) ) ntrcr = ntrcr_in
1035 12414 : if (present(ntrcr_o_in) ) ntrcr_o = ntrcr_o_in
1036 12414 : if (present(nbtrcr_in) ) nbtrcr = nbtrcr_in
1037 12414 : if (present(nbtrcr_sw_in)) nbtrcr_sw = nbtrcr_sw_in
1038 :
1039 12414 : end subroutine icepack_init_tracer_sizes
1040 :
1041 : !=======================================================================
1042 : !autodocument_start icepack_query_tracer_sizes
1043 : ! query the number of column tracers
1044 :
1045 68647462 : subroutine icepack_query_tracer_sizes(&
1046 : max_algae_out , max_dic_out , max_doc_out , & ! LCOV_EXCL_LINE
1047 : max_don_out , max_fe_out , nmodal1_out , & ! LCOV_EXCL_LINE
1048 : nmodal2_out , max_aero_out , max_nbtrcr_out , & ! LCOV_EXCL_LINE
1049 : ncat_out, nilyr_out, nslyr_out, nblyr_out, nfsd_out, & ! LCOV_EXCL_LINE
1050 : n_algae_out, n_DOC_out, n_aero_out, n_iso_out, & ! LCOV_EXCL_LINE
1051 : n_DON_out, n_DIC_out, n_fed_out, n_fep_out, n_zaero_out, & ! LCOV_EXCL_LINE
1052 : ntrcr_out, ntrcr_o_out, nbtrcr_out, nbtrcr_sw_out)
1053 :
1054 : integer (kind=int_kind), intent(out), optional :: &
1055 : max_algae_out , & ! maximum number of algal types ! LCOV_EXCL_LINE
1056 : max_dic_out , & ! maximum number of dissolved inorganic carbon types ! LCOV_EXCL_LINE
1057 : max_doc_out , & ! maximum number of dissolved organic carbon types ! LCOV_EXCL_LINE
1058 : max_don_out , & ! maximum number of dissolved organic nitrogen types ! LCOV_EXCL_LINE
1059 : max_fe_out , & ! maximum number of iron types ! LCOV_EXCL_LINE
1060 : nmodal1_out , & ! dimension for modal aerosol radiation parameters ! LCOV_EXCL_LINE
1061 : nmodal2_out , & ! dimension for modal aerosol radiation parameters ! LCOV_EXCL_LINE
1062 : max_aero_out , & ! maximum number of aerosols ! LCOV_EXCL_LINE
1063 : max_nbtrcr_out ! algal nitrogen and chlorophyll
1064 :
1065 : integer (kind=int_kind), intent(out), optional :: &
1066 : ncat_out , & ! Categories ! LCOV_EXCL_LINE
1067 : nfsd_out , & ! ! LCOV_EXCL_LINE
1068 : nilyr_out , & ! Layers ! LCOV_EXCL_LINE
1069 : nslyr_out , & ! ! LCOV_EXCL_LINE
1070 : nblyr_out , & ! ! LCOV_EXCL_LINE
1071 : n_algae_out, & ! Dimensions ! LCOV_EXCL_LINE
1072 : n_DOC_out , & ! ! LCOV_EXCL_LINE
1073 : n_DON_out , & ! ! LCOV_EXCL_LINE
1074 : n_DIC_out , & ! ! LCOV_EXCL_LINE
1075 : n_fed_out , & ! ! LCOV_EXCL_LINE
1076 : n_fep_out , & ! ! LCOV_EXCL_LINE
1077 : n_zaero_out, & ! ! LCOV_EXCL_LINE
1078 : n_iso_out , & ! ! LCOV_EXCL_LINE
1079 : n_aero_out , & ! ! LCOV_EXCL_LINE
1080 : ntrcr_out , & ! number of tracers in use ! LCOV_EXCL_LINE
1081 : ntrcr_o_out, & ! number of non-bio tracers in use ! LCOV_EXCL_LINE
1082 : nbtrcr_out , & ! number of bio tracers in use ! LCOV_EXCL_LINE
1083 : nbtrcr_sw_out ! number of shortwave bio tracers in use
1084 :
1085 : !autodocument_end
1086 :
1087 : character(len=*),parameter :: subname='(icepack_query_tracer_sizes)'
1088 :
1089 68647462 : if (present(max_algae_out)) max_algae_out = max_algae
1090 68647462 : if (present(max_dic_out)) max_dic_out = max_dic
1091 68647462 : if (present(max_doc_out)) max_doc_out = max_doc
1092 68647462 : if (present(max_don_out)) max_don_out = max_don
1093 68647462 : if (present(max_fe_out)) max_fe_out = max_fe
1094 68647462 : if (present(nmodal1_out)) nmodal1_out = nmodal1
1095 68647462 : if (present(nmodal2_out)) nmodal2_out = nmodal2
1096 68647462 : if (present(max_aero_out)) max_aero_out = max_aero
1097 68647462 : if (present(max_nbtrcr_out)) max_nbtrcr_out= max_nbtrcr
1098 :
1099 68647462 : if (present(ncat_out) ) ncat_out = ncat
1100 68647462 : if (present(nilyr_out) ) nilyr_out = nilyr
1101 68647462 : if (present(nslyr_out) ) nslyr_out = nslyr
1102 68647462 : if (present(nblyr_out) ) nblyr_out = nblyr
1103 68647462 : if (present(nfsd_out) ) nfsd_out = nfsd
1104 :
1105 68647462 : if (present(n_algae_out) ) n_algae_out = n_algae
1106 68647462 : if (present(n_DOC_out) ) n_DOC_out = n_DOC
1107 68647462 : if (present(n_DON_out) ) n_DON_out = n_DON
1108 68647462 : if (present(n_DIC_out) ) n_DIC_out = n_DIC
1109 68647462 : if (present(n_fed_out) ) n_fed_out = n_fed
1110 68647462 : if (present(n_fep_out) ) n_fep_out = n_fep
1111 68647462 : if (present(n_zaero_out) ) n_zaero_out = n_zaero
1112 68647462 : if (present(n_aero_out) ) n_aero_out = n_aero
1113 68647462 : if (present(n_iso_out) ) n_iso_out = n_iso
1114 :
1115 68647462 : if (present(ntrcr_out) ) ntrcr_out = ntrcr
1116 68647462 : if (present(ntrcr_o_out) ) ntrcr_o_out = ntrcr_o
1117 68647462 : if (present(nbtrcr_out) ) nbtrcr_out = nbtrcr
1118 68647462 : if (present(nbtrcr_sw_out)) nbtrcr_sw_out = nbtrcr_sw
1119 :
1120 68647462 : end subroutine icepack_query_tracer_sizes
1121 :
1122 : !=======================================================================
1123 : !autodocument_start icepack_write_tracer_sizes
1124 : ! write the number of column tracers
1125 :
1126 334 : subroutine icepack_write_tracer_sizes(iounit)
1127 :
1128 : integer (kind=int_kind), intent(in) :: iounit
1129 :
1130 : !autodocument_end
1131 :
1132 : character(len=*),parameter :: subname='(icepack_write_tracer_sizes)'
1133 :
1134 334 : write(iounit,*) subname//":"
1135 334 : write(iounit,*) " fixed parameters: "
1136 334 : write(iounit,*) " max_algae_out =", max_algae
1137 334 : write(iounit,*) " max_dic_out =", max_dic
1138 334 : write(iounit,*) " max_doc_out =", max_doc
1139 334 : write(iounit,*) " max_don_out =", max_don
1140 334 : write(iounit,*) " max_fe_out =", max_fe
1141 334 : write(iounit,*) " nmodal1_out =", nmodal1
1142 334 : write(iounit,*) " nmodal2_out =", nmodal2
1143 334 : write(iounit,*) " max_iso_out =", max_iso
1144 334 : write(iounit,*) " max_aero_out =", max_aero
1145 334 : write(iounit,*) " max_nbtrcr_out=", max_nbtrcr
1146 :
1147 334 : write(iounit,*) " model defined parameters: "
1148 334 : write(iounit,*) " ncat = ",ncat
1149 334 : write(iounit,*) " nilyr = ",nilyr
1150 334 : write(iounit,*) " nslyr = ",nslyr
1151 334 : write(iounit,*) " nblyr = ",nblyr
1152 334 : write(iounit,*) " nfsd = ",nfsd
1153 334 : write(iounit,*) " n_algae = ",n_algae
1154 334 : write(iounit,*) " n_DOC = ",n_DOC
1155 334 : write(iounit,*) " n_DON = ",n_DON
1156 334 : write(iounit,*) " n_DIC = ",n_DIC
1157 334 : write(iounit,*) " n_fed = ",n_fed
1158 334 : write(iounit,*) " n_fep = ",n_fep
1159 334 : write(iounit,*) " n_zaero = ",n_zaero
1160 334 : write(iounit,*) " n_aero = ",n_aero
1161 334 : write(iounit,*) " n_iso = ",n_iso
1162 334 : write(iounit,*) " ntrcr = ",ntrcr
1163 334 : write(iounit,*) " ntrcr_o = ",ntrcr_o
1164 334 : write(iounit,*) " nbtrcr = ",nbtrcr
1165 334 : write(iounit,*) " nbtrcr_sw = ",nbtrcr_sw
1166 :
1167 334 : end subroutine icepack_write_tracer_sizes
1168 :
1169 : !=======================================================================
1170 : !autodocument_start icepack_compute_tracers
1171 : ! Compute tracer fields.
1172 : ! Given atrcrn = aicen*trcrn (or vicen*trcrn, vsnon*trcrn), compute trcrn.
1173 :
1174 19610493246 : subroutine icepack_compute_tracers (ntrcr, trcr_depend, &
1175 : atrcrn, aicen, & ! LCOV_EXCL_LINE
1176 : vicen, vsnon, & ! LCOV_EXCL_LINE
1177 : trcr_base, n_trcr_strata, & ! LCOV_EXCL_LINE
1178 19610493246 : nt_strata, trcrn)
1179 :
1180 : integer (kind=int_kind), intent(in) :: &
1181 : ntrcr ! number of tracers in use
1182 :
1183 : integer (kind=int_kind), dimension (ntrcr), intent(in) :: &
1184 : trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon ! LCOV_EXCL_LINE
1185 : n_trcr_strata ! number of underlying tracer layers
1186 :
1187 : real (kind=dbl_kind), dimension (:,:), intent(in) :: &
1188 : trcr_base ! = 0 or 1 depending on tracer dependency
1189 : ! argument 2: (1) aice, (2) vice, (3) vsno
1190 :
1191 : integer (kind=int_kind), dimension (:,:), intent(in) :: &
1192 : nt_strata ! indices of underlying tracer layers
1193 :
1194 : real (kind=dbl_kind), dimension (:), intent(in) :: &
1195 : atrcrn ! aicen*trcrn or vicen*trcrn or vsnon*trcrn
1196 :
1197 : real (kind=dbl_kind), intent(in) :: &
1198 : aicen , & ! concentration of ice ! LCOV_EXCL_LINE
1199 : vicen , & ! volume per unit area of ice (m) ! LCOV_EXCL_LINE
1200 : vsnon ! volume per unit area of snow (m)
1201 :
1202 : real (kind=dbl_kind), dimension (ntrcr), intent(out) :: &
1203 : trcrn ! ice tracers
1204 :
1205 : !autodocument_end
1206 :
1207 : ! local variables
1208 :
1209 : integer (kind=int_kind) :: &
1210 : it, & ! tracer index ! LCOV_EXCL_LINE
1211 : itl, & ! tracer index ! LCOV_EXCL_LINE
1212 : ntr, & ! tracer index ! LCOV_EXCL_LINE
1213 : k ! loop index
1214 :
1215 : real (kind=dbl_kind), dimension(3) :: &
1216 3795703216 : divisor ! base quantity on which tracers are carried
1217 :
1218 : real (kind=dbl_kind) :: &
1219 948925804 : work ! temporary scalar
1220 :
1221 : character(len=*),parameter :: subname='(icepack_compute_tracers)'
1222 :
1223 : !-----------------------------------------------------------------
1224 : ! Compute new tracers
1225 : !-----------------------------------------------------------------
1226 :
1227 >34506*10^7 : do it = 1, ntrcr
1228 >33526*10^7 : divisor(1) = trcr_base(it,1)*aicen
1229 >33526*10^7 : divisor(2) = trcr_base(it,2)*vicen
1230 >33526*10^7 : divisor(3) = trcr_base(it,3)*vsnon
1231 :
1232 >34506*10^7 : if (trcr_depend(it) == 0) then ! ice area tracers
1233 48124227218 : if (aicen > puny) then
1234 13054060738 : trcrn(it) = atrcrn(it) / aicen
1235 : else
1236 35070166480 : trcrn(it) = c0
1237 35070166480 : if (it == nt_Tsfc) trcrn(it) = Tocnfrz ! surface temperature
1238 : endif
1239 :
1240 : else
1241 :
1242 >28713*10^7 : work = c0
1243 >11485*10^8 : do k = 1, 3
1244 >11485*10^8 : if (divisor(k) > c0) then
1245 68630812157 : work = atrcrn(it) / divisor(k)
1246 : endif
1247 : enddo
1248 >28713*10^7 : trcrn(it) = work ! save it
1249 >28713*10^7 : if (n_trcr_strata(it) > 0) then ! additional tracer layers
1250 71340359018 : do itl = 1, n_trcr_strata(it)
1251 44399932154 : ntr = nt_strata(it,itl)
1252 71340359018 : if (trcrn(ntr) > c0) then
1253 9644602348 : trcrn(it) = trcrn(it) / trcrn(ntr)
1254 : else
1255 34755329806 : trcrn(it) = c0
1256 : endif
1257 : enddo
1258 : endif
1259 >28713*10^7 : if (vicen <= c0 .and. it == nt_fbri) trcrn(it) = c1
1260 :
1261 : endif ! trcr_depend=0
1262 :
1263 : enddo
1264 :
1265 9805246623 : end subroutine icepack_compute_tracers
1266 :
1267 : !=======================================================================
1268 :
1269 : end module icepack_tracers
1270 :
1271 : !=======================================================================
|