7 !! Writing of time-series data on file in ASCII format.
11 !! Copyright 2009-2013 Ralf Greve
15 !! This file is part of SICOPOLIS.
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.
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.
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/>.
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33 !> Writing of time-series data on file in ASCII format.
34 !<------------------------------------------------------------------------------
35 subroutine output2(time, dxi, deta, delta_ts, glac_index, z_sl)
42 real(dp),
intent(in) :: time, dxi, deta, delta_ts, glac_index, z_sl
45 integer(i4b) :: n_base, n_tempbase
46 real(dp) :: time_val, &
47 v_tot, v_grounded, v_floating, &
48 a_tot, a_grounded, a_floating, &
49 h_max, zs_max, v_temp, v_fw, v_sle, &
50 a_temp, v_bm, v_tld, h_t_max, vs_max, tbh_max
51 real(dp) :: x_pos, y_pos
52 real(dp),
dimension(0:JMAX,0:IMAX) :: h_ice, h_t_help
53 real(dp) :: v_gr_redu, a_surf, rhosw_rho_ratio
54 real(dp) :: vs_help, tbh_help
55 real(dp) :: h_ave_sed, tbh_ave_sed, atb_sed
56 real(dp) :: sum_area_sed
67 h_t_help(j,i) = h_t(j,i)
73 h_t_help(j,i) = h_c(j,i)*eaz_c_quotient(kc_cts(j,i))
94 || defined(emtp2sge) \
95 || defined(heino) ) /* terrestrial ice sheet */
97 rhosw_rho_ratio = rho_sw/rho
99 #elif ( defined(NMARS) \
100 || defined(smars) ) /* martian ice sheet */
102 rhosw_rho_ratio = 0.0_dp
106 stop
' output2: No valid domain specified!'
116 zs_max = -1.11e+11_dp
129 if (maske(j,i) == 0)
then
131 if (zs(j,i) > zs_max) zs_max = zs(j,i)
132 if (h_ice(j,i) > h_max ) h_max = h_ice(j,i)
133 if (h_t_help(j,i) > h_t_max) h_t_max = h_t_help(j,i)
135 v_grounded = v_grounded + h_ice(j,i) *area(j,i)
136 v_temp = v_temp + h_t_help(j,i)*area(j,i)
144 || defined(emtp2sge) \
145 || defined(heino) ) /* terrestrial ice sheet */
147 if (zl0(j,i) < z_sl) &
148 v_gr_redu = v_gr_redu + rhosw_rho_ratio*(z_sl-zl0(j,i))*area(j,i)
152 a_grounded = a_grounded + area(j,i)
154 if (n_cts(j,i) /= -1) a_temp = a_temp + area(j,i)
156 v_bm = v_bm + q_bm(j,i) *area(j,i)
157 v_tld = v_tld + q_tld(j,i) *area(j,i)
160 0.25_dp*(vx_c(kcmax,j,i)+vx_c(kcmax,j,i-1))**2 &
161 +0.25_dp*(vy_c(kcmax,j,i)+vy_c(kcmax,j-1,i))**2 )
162 if (vs_help > vs_max) vs_max = vs_help
164 if (n_cts(j,i) >= 0)
then
167 tbh_help = min((temp_c(0,j,i)-temp_c_m(0,j,i)), -eps)
168 if (tbh_help > tbh_max) tbh_max = tbh_help
171 else if (maske(j,i) == 3)
then
175 if (zs(j,i) > zs_max) zs_max = zs(j,i)
176 if (h_ice(j,i) > h_max) h_max = h_ice(j,i)
178 v_floating = v_floating + h_ice(j,i)*area(j,i)
179 a_floating = a_floating + area(j,i)
181 v_bm = v_bm + q_bm(j,i) *area(j,i)
184 0.25_dp*(vx_c(kcmax,j,i)+vx_c(kcmax,j,i-1))**2 &
185 +0.25_dp*(vy_c(kcmax,j,i)+vy_c(kcmax,j-1,i))**2 )
186 if (vs_help > vs_max) vs_max = vs_help
188 tbh_help = min((temp_c(0,j,i)-temp_c_m(0,j,i)), -eps)
189 if (tbh_help > tbh_max) tbh_max = tbh_help
193 if ( (maske(j,i) == 0).or.(maske_help(j,i) == 0) &
194 .or.(maske(j,i) == 3).or.(maske_help(j,i) == 3) )
then
196 v_fw = v_fw + accum(j,i)*area(j,i) &
197 - (dzs_dtau(j,i)-dzb_dtau(j,i))*area(j,i)
211 || defined(emtp2sge) \
212 || defined(heino) ) /* terrestrial ice sheet */
214 a_surf = 3.61132e+14_dp
215 v_sle = (v_grounded-v_gr_redu)*(rho/rho_sw)/a_surf
218 #elif ( defined(NMARS) \
219 || defined(smars) ) /* martian ice sheet */
221 a_surf = 1.4441e+14_dp
222 v_sle = v_grounded*(rho_i/rho_w)*(1.0_dp-frac_dust)/a_surf
227 #if ( !defined(OUT_TIMES) || OUT_TIMES==1 )
228 time_val = time /year_sec
230 time_val = (time+year_zero) /year_sec
232 stop
' output2: OUT_TIMES must be either 1 or 2!'
235 v_tot = v_grounded + v_floating
236 a_tot = a_grounded + a_floating
238 if (zs_max < -1.1e+11_dp) zs_max = 0.0_dp
240 vs_max = vs_max *year_sec
248 || defined(emtp2sge) \
249 || defined(heino) ) /* terrestrial ice sheet */
251 v_fw = v_fw *year_sec *(rho/rho_w)
253 v_bm = v_bm *year_sec *(rho/rho_w)
255 v_tld = v_tld *year_sec *(rho/rho_w)
258 #elif ( defined(NMARS) \
259 || defined(smars) ) /* martian ice sheet */
261 v_fw = v_fw *year_sec *(rho_i/rho_w)*(1.0_dp-frac_dust)
263 v_bm = v_bm *year_sec *(rho_i/rho_w)*(1.0_dp-frac_dust)
265 v_tld = v_tld *year_sec *(rho_i/rho_w)*(1.0_dp-frac_dust)
277 || defined(emtp2sge) \
278 || defined(heino) ) /* terrestrial ice sheet */
280 if (forcing_flag == 1)
then
282 #if ( !defined(OUTSER_V_A) || OUTSER_V_A==1 )
284 write(12,1010) time_val, delta_ts, z_sl, &
285 h_max, zs_max, v_grounded, v_temp, v_fw, v_sle, &
286 a_grounded, a_temp, v_bm, v_tld, h_t_max, vs_max
290 write(12,1010) time_val, delta_ts, z_sl, &
291 v_tot, v_grounded, v_floating, a_tot, a_grounded, a_floating, &
292 h_max, zs_max, v_temp, v_fw, v_sle, &
293 a_temp, v_bm, v_tld, h_t_max, vs_max
296 stop
' sico_init: OUTSER_V_A must be either 1 or 2!'
299 else if (forcing_flag == 2)
then
301 #if ( !defined(OUTSER_V_A) || OUTSER_V_A==1 )
303 write(12,1010) time_val, glac_index, z_sl, &
304 h_max, zs_max, v_grounded, v_temp, v_fw, v_sle, &
305 a_grounded, a_temp, v_bm, v_tld, h_t_max, vs_max
309 write(12,1010) time_val, glac_index, z_sl, &
310 v_tot, v_grounded, v_floating, a_tot, a_grounded, a_floating, &
311 h_max, zs_max, v_temp, v_fw, v_sle, &
312 a_temp, v_bm, v_tld, h_t_max, vs_max
315 stop
' sico_init: OUTSER_V_A must be either 1 or 2!'
318 else if (forcing_flag == 3)
then
320 #if ( !defined(OUTSER_V_A) || OUTSER_V_A==1 )
322 write(12,1010) time_val, 1.11e+11_dp, z_sl, &
323 h_max, zs_max, v_grounded, v_temp, v_fw, v_sle, &
324 a_grounded, a_temp, v_bm, v_tld, h_t_max, vs_max
328 write(12,1010) time_val, 1.11e+11_dp, z_sl, &
329 v_tot, v_grounded, v_floating, a_tot, a_grounded, a_floating, &
330 h_max, zs_max, v_temp, v_fw, v_sle, &
331 a_temp, v_bm, v_tld, h_t_max, vs_max
334 stop
' sico_init: OUTSER_V_A must be either 1 or 2!'
339 #elif ( defined(NMARS) \
340 || defined(smars) ) /* martian ice sheet */
342 if (forcing_flag == 1)
then
344 write(12,1010) time_val, delta_ts, z_sl, &
345 h_max, zs_max, v_tot, v_temp, v_fw, tbh_max, &
346 a_tot, a_temp, v_bm, v_tld, h_t_max, vs_max
348 else if (forcing_flag == 2)
then
350 write(12,1010) time_val, glac_index, z_sl, &
351 h_max, zs_max, v_tot, v_temp, v_fw, tbh_max, &
352 a_tot, a_temp, v_bm, v_tld, h_t_max, vs_max
354 else if (forcing_flag == 3)
then
356 write(12,1010) time_val, 1.11e+11_dp, z_sl, &
357 h_max, zs_max, v_tot, v_temp, v_fw, tbh_max, &
358 a_tot, a_temp, v_bm, v_tld, h_t_max, vs_max
364 #if ( !defined(OUTSER_V_A) || OUTSER_V_A==1 )
366 1010 format(1pe13.6,2(1pe13.4),/,13x,6(1pe13.4),/,13x,6(1pe13.4),/)
370 1010 format(1pe13.6,2(1pe13.4),/,13x,6(1pe13.4),/, &
371 26x,5(1pe13.4),/,26x,5(1pe13.4),/)
374 stop
' sico_init: OUTSER_V_A must be either 1 or 2!'
387 sum_area_sed = 0.0_dp
392 if (maske_sedi(j,i) == 7)
then
394 sum_area_sed = sum_area_sed + area(j,i)
396 h_ave_sed = h_ave_sed + area(j,i)*h_ice(j,i)
398 if (n_cts(j,i) /= -1)
then
401 tbh_help = min((temp_c(0,j,i)-temp_c_m(0,j,i)), -eps)
403 tbh_ave_sed = tbh_ave_sed + area(j,i)*tbh_help
405 if (n_cts(j,i) /= -1) atb_sed = atb_sed + area(j,i)
412 if (sum_area_sed > eps)
then
413 h_ave_sed = h_ave_sed / sum_area_sed
414 tbh_ave_sed = tbh_ave_sed / sum_area_sed
416 stop
' output2: No sediment area found!'
421 if (forcing_flag == 1)
then
422 write(15,1011) time_val, delta_ts, z_sl, h_ave_sed, tbh_ave_sed, atb_sed
423 else if (forcing_flag == 2)
then
424 write(15,1011) time_val, glac_index, z_sl, h_ave_sed, tbh_ave_sed, atb_sed
425 else if (forcing_flag == 3)
then
426 write(15,1011) time_val, 1.11e+11_dp, z_sl, h_ave_sed, tbh_ave_sed, atb_sed
429 1011 format(1pe13.6,2(1pe13.4),/,13x,3(1pe13.4),/)