SICOPOLIS V3.2
 All Classes Files Functions Variables Macros
output2.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : o u t p u t 2
4 !
5 !> @file
6 !!
7 !! Writing of time-series data on file in ASCII format.
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2009-2016 Ralf Greve
12 !!
13 !! @section License
14 !!
15 !! This file is part of SICOPOLIS.
16 !!
17 !! SICOPOLIS is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! SICOPOLIS is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> Writing of time-series data on file in ASCII format.
34 !<------------------------------------------------------------------------------
35 subroutine output2(time, dxi, deta, delta_ts, glac_index, z_sl)
36 
37 use sico_types
39 use sico_vars
40 
41 implicit none
42 
43 real(dp), intent(in) :: time, dxi, deta, delta_ts, glac_index, z_sl
44 
45 integer(i4b) :: i, j
46 integer(i4b) :: n_base, n_tempbase
47 real(dp) :: time_val, &
48  v_tot, v_grounded, v_floating, &
49  a_tot, a_grounded, a_floating, &
50  h_max, zs_max, v_temp, v_fw, v_sle, &
51  a_temp, v_bm, v_tld, h_t_max, vs_max, tbh_max
52 real(dp) :: x_pos, y_pos
53 real(dp), dimension(0:JMAX,0:IMAX) :: h, h_cold, h_temp
54 real(dp) :: v_gr_redu, a_surf, rhosw_rho_ratio
55 real(dp) :: vs_help, tbh_help
56 real(dp) :: h_ave_sed, tbh_ave_sed, atb_sed
57 real(dp) :: sum_area_sed
58 
59 #if (!defined(OUTSER_V_A) || OUTSER_V_A==1)
60 
61 character(len=128), parameter :: &
62  fmt1 = '(1pe13.6,2(1pe13.4),/,13x,6(1pe13.4),/,'// &
63  '13x,6(1pe13.4),/)'
64 #elif (OUTSER_V_A==2)
65 
66 character(len=128), parameter :: &
67  fmt1 = '(1pe13.6,2(1pe13.4),/,13x,6(1pe13.4),/,'// &
68  '26x,5(1pe13.4),/,26x,5(1pe13.4),/)'
69 #else
70  stop ' sico_init: OUTSER_V_A must be either 1 or 2!'
71 #endif
72 
73 character(len=128), parameter :: &
74  fmt2 = '(1pe13.6,2(1pe13.4),/,13x,3(1pe13.4),/)'
75 
76 !-------- Ice thickness --------
77 
78 h = h_c + h_t
79 
80 !-------- Thickness of the cold and temperate layers --------
81 
82 h_cold = 0.0_dp
83 h_temp = 0.0_dp
84 
85 #if (CALCMOD==1)
86 do i=1, imax-1
87 do j=1, jmax-1
88  h_temp(j,i) = h_t(j,i)
89 end do
90 end do
91 #elif (CALCMOD==0 || CALCMOD==2 || CALCMOD==3 || CALCMOD==-1)
92 do i=1, imax-1
93 do j=1, jmax-1
94  h_temp(j,i) = h_c(j,i)*eaz_c_quotient(kc_cts(j,i))
95 end do
96 end do
97 #endif
98 
99 h_cold = h - h_temp
100 
101 !-------- Maximum ice elevation and thickness, ice volume,
102 ! sea-level equivalent, volume of the temperate ice,
103 ! area, area covered by temperate ice,
104 ! freshwater production due to melting and calving,
105 ! water drainage due to basal melting,
106 ! water drainage from the temperate layer,
107 ! maximum thickness of the temperate layer,
108 ! maximum surface velocity,
109 ! maximum basal temperature rel. to pmp --------
110 
111 #if (defined(ANT) \
112  || defined(grl) \
113  || defined(scand) \
114  || defined(nhem) \
115  || defined(tibet) \
116  || defined(asf) \
117  || defined(emtp2sge) \
118  || defined(xyz)) /* terrestrial ice sheet */
119 
120 rhosw_rho_ratio = rho_sw/rho
121 
122 #elif (defined(NMARS) || defined(SMARS)) /* Martian ice sheet */
123 
124 rhosw_rho_ratio = 0.0_dp ! dummy value
125 
126 #else
127 
128 stop ' output2: No valid domain specified!'
129 
130 #endif
131 
132 v_grounded = 0.0_dp
133 v_gr_redu = 0.0_dp
134 v_floating = 0.0_dp
135 a_grounded = 0.0_dp
136 a_floating = 0.0_dp
137 h_max = 0.0_dp
138 zs_max = -1.11e+11_dp
139 v_temp = 0.0_dp
140 v_fw = 0.0_dp
141 a_temp = 0.0_dp
142 v_bm = 0.0_dp
143 v_tld = 0.0_dp
144 h_t_max = 0.0_dp
145 vs_max = 0.0_dp
146 tbh_max = -273.15_dp
147 
148 do i=1, imax-1
149 do j=1, jmax-1
150 
151  if (maske(j,i) == 0) then ! grounded ice
152 
153  if (zs(j,i) > zs_max) zs_max = zs(j,i)
154  if (h(j,i) > h_max ) h_max = h(j,i)
155  if (h_temp(j,i) > h_t_max) h_t_max = h_temp(j,i)
156 
157  v_grounded = v_grounded + h(j,i) *area(j,i)
158  v_temp = v_temp + h_temp(j,i)*area(j,i)
159 
160 #if (defined(ANT) \
161  || defined(grl) \
162  || defined(scand) \
163  || defined(nhem) \
164  || defined(tibet) \
165  || defined(asf) \
166  || defined(emtp2sge) \
167  || defined(xyz)) /* terrestrial ice sheet */
168 
169  if (zl0(j,i) < z_sl) &
170  v_gr_redu = v_gr_redu + rhosw_rho_ratio*(z_sl-zl0(j,i))*area(j,i)
171 
172 #endif
173 
174  a_grounded = a_grounded + area(j,i)
175 
176  if (n_cts(j,i) /= -1) a_temp = a_temp + area(j,i)
177 
178  v_bm = v_bm + q_bm(j,i) *area(j,i)
179  v_tld = v_tld + q_tld(j,i) *area(j,i)
180 
181  vs_help = sqrt( &
182  0.25_dp*(vx_c(kcmax,j,i)+vx_c(kcmax,j,i-1))**2 &
183  +0.25_dp*(vy_c(kcmax,j,i)+vy_c(kcmax,j-1,i))**2 )
184  if (vs_help > vs_max) vs_max = vs_help
185 
186  if (n_cts(j,i) >= 0) then ! temperate base
187  tbh_max = 0.0_dp
188  else ! cold base
189  tbh_help = min((temp_c(0,j,i)-temp_c_m(0,j,i)), -eps)
190  if (tbh_help > tbh_max) tbh_max = tbh_help
191  end if
192 
193  else if (maske(j,i) == 3) then ! floating ice
194  ! (basal temperature assumed to be below
195  ! the pressure melting point for pure ice)
196 
197  if (zs(j,i) > zs_max) zs_max = zs(j,i)
198  if (h(j,i) > h_max) h_max = h(j,i)
199 
200  v_floating = v_floating + h(j,i)*area(j,i)
201  a_floating = a_floating + area(j,i)
202 
203  v_bm = v_bm + q_bm(j,i) *area(j,i)
204 
205  vs_help = sqrt( &
206  0.25_dp*(vx_c(kcmax,j,i)+vx_c(kcmax,j,i-1))**2 &
207  +0.25_dp*(vy_c(kcmax,j,i)+vy_c(kcmax,j-1,i))**2 )
208  if (vs_help > vs_max) vs_max = vs_help
209 
210  tbh_help = min((temp_c(0,j,i)-temp_c_m(0,j,i)), -eps)
211  if (tbh_help > tbh_max) tbh_max = tbh_help
212 
213  end if
214 
215  if ( (maske(j,i) == 0).or.(maske_help(j,i) == 0) &
216  .or.(maske(j,i) == 3).or.(maske_help(j,i) == 3) ) then
217  ! grounded or floating ice before or after the time step
218  v_fw = v_fw + accum(j,i)*area(j,i) &
219  - (dzs_dtau(j,i)-dzb_dtau(j,i))*area(j,i)
220  end if
221 
222 end do
223 end do
224 
225 !-------- Conversion --------
226 
227 #if (defined(ANT) \
228  || defined(grl) \
229  || defined(scand) \
230  || defined(nhem) \
231  || defined(tibet) \
232  || defined(asf) \
233  || defined(emtp2sge) \
234  || defined(xyz)) /* terrestrial ice sheet */
235 
236 a_surf = 3.61132e+14_dp ! global ocean area, in m^2
237 v_sle = (v_grounded-v_gr_redu)*(rho/rho_sw)/a_surf
238  ! m^3 ice equiv./m^2 -> m sea water equiv.
239 
240 #elif (defined(NMARS) || defined(SMARS)) /* Martian ice sheet */
241 
242 a_surf = 1.4441e+14_dp ! surface area of Mars, in m^2
243 v_sle = v_grounded*(rho_i/rho_w)*(1.0_dp-frac_dust)/a_surf
244  ! m^3 (ice+dust) equiv./m^2 -> m water equiv.
245 
246 #endif
247 
248 #if (!defined(OUT_TIMES) || OUT_TIMES==1)
249 time_val = time /year_sec ! s -> a
250 #elif (OUT_TIMES==2)
251 time_val = (time+year_zero) /year_sec ! s -> a
252 #else
253 stop ' output2: OUT_TIMES must be either 1 or 2!'
254 #endif
255 
256 v_tot = v_grounded + v_floating ! in m^3
257 a_tot = a_grounded + a_floating ! in m^2
258 
259 if (zs_max < -1.1e+11_dp) zs_max = 0.0_dp
260 
261 vs_max = vs_max *year_sec ! m/s -> m/a
262 
263 #if (defined(ANT) \
264  || defined(grl) \
265  || defined(scand) \
266  || defined(nhem) \
267  || defined(tibet) \
268  || defined(asf) \
269  || defined(emtp2sge) \
270  || defined(xyz)) /* terrestrial ice sheet */
271 
272 v_fw = v_fw *year_sec *(rho/rho_w)
273  ! m^3/s ice equiv. -> m^3/a water equiv.
274 v_bm = v_bm *year_sec *(rho/rho_w)
275  ! m^3/s ice equiv. -> m^3/a water equiv.
276 v_tld = v_tld *year_sec *(rho/rho_w)
277  ! m^3/s ice equiv. -> m^3/a water equiv.
278 
279 #elif (defined(NMARS) || defined(SMARS)) /* Martian ice sheet */
280 
281 v_fw = v_fw *year_sec *(rho_i/rho_w)*(1.0_dp-frac_dust)
282  ! m^3/s (ice+dust) equiv. -> m^3/a water equiv.
283 v_bm = v_bm *year_sec *(rho_i/rho_w)*(1.0_dp-frac_dust)
284  ! m^3/s (ice+dust) equiv. -> m^3/a water equiv.
285 v_tld = v_tld *year_sec *(rho_i/rho_w)*(1.0_dp-frac_dust)
286  ! m^3/s (ice+dust) equiv. -> m^3/a water equiv.
287 #endif
288 
289 !-------- Writing of data on time-series file --------
290 
291 #if (defined(ANT) \
292  || defined(grl) \
293  || defined(scand) \
294  || defined(nhem) \
295  || defined(tibet) \
296  || defined(asf) \
297  || defined(emtp2sge) \
298  || defined(xyz)) /* terrestrial ice sheet */
299 
300 if (forcing_flag == 1) then
301 
302 #if (!defined(OUTSER_V_A) || OUTSER_V_A==1)
303 
304  write(unit=12, fmt=trim(fmt1)) time_val, delta_ts, z_sl, &
305  h_max, zs_max, v_grounded, v_temp, v_fw, v_sle, &
306  a_grounded, a_temp, v_bm, v_tld, h_t_max, vs_max
307 
308 #elif (OUTSER_V_A==2)
309 
310  write(unit=12, fmt=trim(fmt1)) time_val, delta_ts, z_sl, &
311  v_tot, v_grounded, v_floating, a_tot, a_grounded, a_floating, &
312  h_max, zs_max, v_temp, v_fw, v_sle, &
313  a_temp, v_bm, v_tld, h_t_max, vs_max
314 
315 #else
316  stop ' sico_init: OUTSER_V_A must be either 1 or 2!'
317 #endif
318 
319 else if (forcing_flag == 2) then
320 
321 #if (!defined(OUTSER_V_A) || OUTSER_V_A==1)
322 
323  write(unit=12, fmt=trim(fmt1)) time_val, glac_index, z_sl, &
324  h_max, zs_max, v_grounded, v_temp, v_fw, v_sle, &
325  a_grounded, a_temp, v_bm, v_tld, h_t_max, vs_max
326 
327 #elif (OUTSER_V_A==2)
328 
329  write(unit=12, fmt=trim(fmt1)) time_val, glac_index, z_sl, &
330  v_tot, v_grounded, v_floating, a_tot, a_grounded, a_floating, &
331  h_max, zs_max, v_temp, v_fw, v_sle, &
332  a_temp, v_bm, v_tld, h_t_max, vs_max
333 
334 #else
335  stop ' sico_init: OUTSER_V_A must be either 1 or 2!'
336 #endif
337 
338 else if (forcing_flag == 3) then
339 
340 #if (!defined(OUTSER_V_A) || OUTSER_V_A==1)
341 
342  write(unit=12, fmt=trim(fmt1)) time_val, 1.11e+11_dp, z_sl, &
343  h_max, zs_max, v_grounded, v_temp, v_fw, v_sle, &
344  a_grounded, a_temp, v_bm, v_tld, h_t_max, vs_max
345 
346 #elif (OUTSER_V_A==2)
347 
348  write(unit=12, fmt=trim(fmt1)) time_val, 1.11e+11_dp, z_sl, &
349  v_tot, v_grounded, v_floating, a_tot, a_grounded, a_floating, &
350  h_max, zs_max, v_temp, v_fw, v_sle, &
351  a_temp, v_bm, v_tld, h_t_max, vs_max
352 
353 #else
354  stop ' sico_init: OUTSER_V_A must be either 1 or 2!'
355 #endif
356 
357 end if
358 
359 #elif (defined(NMARS) || defined(SMARS)) /* Martian ice sheet */
360 
361 if (forcing_flag == 1) then
362 
363  write(unit=12, fmt=trim(fmt1)) time_val, delta_ts, z_sl, &
364  h_max, zs_max, v_tot, v_temp, v_fw, tbh_max, &
365  a_tot, a_temp, v_bm, v_tld, h_t_max, vs_max
366 
367 else if (forcing_flag == 2) then
368 
369  write(unit=12, fmt=trim(fmt1)) time_val, glac_index, z_sl, &
370  h_max, zs_max, v_tot, v_temp, v_fw, tbh_max, &
371  a_tot, a_temp, v_bm, v_tld, h_t_max, vs_max
372 
373 else if (forcing_flag == 3) then
374 
375  write(unit=12, fmt=trim(fmt1)) time_val, 1.11e+11_dp, z_sl, &
376  h_max, zs_max, v_tot, v_temp, v_fw, tbh_max, &
377  a_tot, a_temp, v_bm, v_tld, h_t_max, vs_max
378 
379 end if
380 
381 #endif
382 
383 !-------- Special output for various domains --------
384 
385 #if (defined(XYZ))
386 
387 ! ------ Time-series data for the sediment region of HEINO
388 
389 #if (defined(HEINO))
390 
391 ! ---- Average ice thickness, average basal temperature rel. to pmp,
392 ! temperate basal area
393 
394 h_ave_sed = 0.0_dp
395 tbh_ave_sed = 0.0_dp
396 atb_sed = 0.0_dp
397 sum_area_sed = 0.0_dp
398 
399 do i=1, imax-1
400 do j=1, jmax-1
401 
402  if (maske_sedi(j,i) == 7) then ! sediment region
403 
404  sum_area_sed = sum_area_sed + area(j,i)
405 
406  h_ave_sed = h_ave_sed + area(j,i)*h(j,i)
407 
408  if (n_cts(j,i) /= -1) then ! temperate base
409  tbh_help = 0.0_dp
410  else ! cold base
411  tbh_help = min((temp_c(0,j,i)-temp_c_m(0,j,i)), -eps)
412  end if
413  tbh_ave_sed = tbh_ave_sed + area(j,i)*tbh_help
414 
415  if (n_cts(j,i) /= -1) atb_sed = atb_sed + area(j,i)
416 
417  end if
418 
419 end do
420 end do
421 
422 if (sum_area_sed > eps) then
423  h_ave_sed = h_ave_sed / sum_area_sed
424  tbh_ave_sed = tbh_ave_sed / sum_area_sed
425 else
426  stop ' output2: No sediment area found!'
427 end if
428 
429 ! ---- Writing of data on time-series file
430 
431 if (forcing_flag == 1) then
432  write(unit=15, fmt=trim(fmt2)) time_val, delta_ts, z_sl, &
433  h_ave_sed, tbh_ave_sed, atb_sed
434 else if (forcing_flag == 2) then
435  write(unit=15, fmt=trim(fmt2)) time_val, glac_index, z_sl, &
436  h_ave_sed, tbh_ave_sed, atb_sed
437 else if (forcing_flag == 3) then
438  write(unit=15, fmt=trim(fmt2)) time_val, 1.11e+11_dp, z_sl, &
439  h_ave_sed, tbh_ave_sed, atb_sed
440 end if
441 
442 #endif
443 
444 #endif
445 
446 end subroutine output2
447 !
subroutine output2(time, dxi, deta, delta_ts, glac_index, z_sl)
Writing of time-series data on file in ASCII format.
Definition: output2.F90:35
Declarations of kind types for SICOPOLIS.
Definition: sico_types.F90:35
Declarations of global variables for SICOPOLIS (for the ANT domain).
Definition: sico_vars.F90:35
Declarations of global variables for SICOPOLIS.