35 subroutine output1(runname, time, delta_ts, glac_index, z_sl, &
36 flag_3d_output, ndat2d, ndat3d)
42 #if (CALCMOD==1 || CALCMOD==0 || CALCMOD==-1)
48 real(dp),
intent(in) :: time, delta_ts, glac_index, z_sl
49 character(len=100),
intent(in) :: runname
50 logical,
intent(in) :: flag_3d_output
52 integer(i4b),
intent(inout) :: ndat2d, ndat3d
54 integer(i4b) :: i, j, kc, kt, kr
55 integer(i4b) :: ndat, ndat_help, ndat_1000s, ndat_100s, ndat_10s, ndat_1s
56 real(dp),
dimension(0:JMAX,0:IMAX) :: h, h_cold, h_temp, dh_dtau
57 real(dp) :: v_tot, a_grounded, a_floating
58 character(len=256) :: filename
59 character :: ch_1000s, ch_100s, ch_10s, ch_1s
61 integer(i2b),
dimension(0:IMAX,0:JMAX) :: maske_conv, n_cts_conv, kc_cts_conv
62 real(sp) :: time_conv, delta_ts_conv, glac_index_conv, z_sl_conv, &
63 v_tot_conv, a_grounded_conv, a_floating_conv, &
65 xi_conv(0:imax), eta_conv(0:jmax), &
66 sigma_level_c_conv(0:kcmax), sigma_level_t_conv(0:ktmax), &
67 sigma_level_r_conv(0:krmax)
68 real(sp),
dimension(0:IMAX,0:JMAX) :: lambda_conv, phi_conv, &
70 temp_s_conv, as_perp_conv, &
71 zs_conv, zm_conv, zb_conv, zl_conv, &
72 h_cold_conv, h_temp_conv, h_conv, &
73 q_bm_conv, q_tld_conv, &
76 dzs_dtau_conv, dzm_dtau_conv, dzb_dtau_conv, dzl_dtau_conv, &
77 dh_c_dtau_conv, dh_t_dtau_conv, dh_dtau_conv, &
78 vx_b_g_conv, vy_b_g_conv, vz_b_conv, vh_b_conv, &
79 vx_s_g_conv, vy_s_g_conv, vz_s_conv, vh_s_conv, &
80 temp_b_conv, temph_b_conv, &
81 p_b_w_conv, h_w_conv, q_gl_g_conv
82 real(sp),
dimension(0:IMAX,0:JMAX,0:KCMAX) :: vx_c_conv, vy_c_conv, vz_c_conv, &
83 temp_c_conv, age_c_conv, &
84 enth_c_conv, omega_c_conv, &
86 real(sp),
dimension(0:IMAX,0:JMAX,0:KTMAX) :: vx_t_conv, vy_t_conv, vz_t_conv, &
87 omega_t_conv, age_t_conv, &
90 real(sp),
dimension(0:IMAX,0:JMAX,0:KRMAX) :: temp_r_conv
93 character(len= 16) :: ch_date, ch_time, ch_zone
94 character(len=256) :: ch_attr_title, ch_attr_institution, ch_attr_source, &
95 ch_attr_history, ch_attr_references
99 if (flag_3d_output)
then
105 if (ndat > 9999) stop
' output1: Too many time-slice files!'
108 ndat_1000s = ndat_help/1000
109 ndat_help = ndat_help-ndat_1000s*1000
110 ndat_100s = ndat_help/100
111 ndat_help = ndat_help-ndat_100s*100
112 ndat_10s = ndat_help/10
113 ndat_help = ndat_help-ndat_10s*10
116 ch_1000s = char(ndat_1000s+ichar(
'0'))
117 ch_100s = char(ndat_100s +ichar(
'0'))
118 ch_10s = char(ndat_10s +ichar(
'0'))
119 ch_1s = char(ndat_1s +ichar(
'0'))
121 if (flag_3d_output)
then
122 filename = trim(runname)//ch_1000s//ch_100s//ch_10s//ch_1s//
'.erg'
124 filename = trim(runname)//
'_2d_'//ch_1000s//ch_100s//ch_10s//ch_1s//
'.erg'
129 open(unit=11, iostat=ios, &
130 file=outpath//
'/'//trim(filename), &
131 status=
'new', form=
'unformatted')
132 if (ios /= 0) stop
' output1: Error when opening an erg file!'
136 ch_attr_title =
'Time-slice output no. '//ch_1000s//ch_100s//ch_10s//ch_1s// &
137 'of simulation '//trim(runname)
138 write(unit=11) ch_attr_title
140 ch_attr_institution =
'Institute of Low Temperature Science, '// &
141 'Hokkaido University, Sapporo, Japan'
142 write(unit=11) ch_attr_institution
144 ch_attr_source =
'SICOPOLIS Version '//version
145 write(unit=11) ch_attr_source
147 call date_and_time(ch_date, ch_time, ch_zone)
148 ch_attr_history = ch_date(1:4)//
'-'//ch_date(5:6)//
'-'//ch_date(7:8)//
' '// &
149 ch_time(1:2)//
':'//ch_time(3:4)//
':'//ch_time(5:6)//
' '// &
150 ch_zone(1:3)//
':'//ch_zone(4:5)//
' - Data produced'
151 write(unit=11) ch_attr_history
153 ch_attr_references =
'http://www.sicopolis.net/'
154 write(unit=11) ch_attr_references
159 dh_dtau = dh_c_dtau + dh_t_dtau
169 h_temp(j,i) = h_t(j,i)
172 #elif (CALCMOD==0 || CALCMOD==2 || CALCMOD==3 || CALCMOD==-1)
175 h_temp(j,i) = h_c(j,i)*eaz_c_quotient(kc_cts(j,i))
193 if ( (maske(j,i) == 0_i2b).and.(n_cts(j,i) == 1_i2b) )
then
199 enth_t(kt,j,i) = enth_c(0,j,i)
206 #elif (CALCMOD==0 || CALCMOD==-1)
216 enth_t(kt,j,i) = enth_c(0,j,i)
235 if ( (maske(j,i)==0).or.(maske(j,i)==3) ) &
236 v_tot = v_tot + h(j,i)*area(j,i)
239 a_grounded = a_grounded + area(j,i)
242 a_floating = a_floating + area(j,i)
249 #if (!defined(OUT_TIMES) || OUT_TIMES==1)
250 time_conv =
real(time/year_sec,sp)
252 time_conv =
real((time+year_zero)/year_sec,sp)
254 stop
' output1: OUT_TIMES must be either 1 or 2!'
257 delta_ts_conv =
real(delta_ts,sp)
258 glac_index_conv =
real(glac_index,sp)
259 z_sl_conv =
real(z_sl,sp)
260 v_tot_conv =
real(v_tot,sp)
261 a_grounded_conv =
real(a_grounded,sp)
262 a_floating_conv =
real(a_floating,sp)
263 h_r_conv =
real(h_r,sp)
266 xi_conv(i) =
real(xi(i),sp)
270 eta_conv(j) =
real(eta(j),sp)
274 sigma_level_c_conv(kc) =
real(eaz_c_quotient(kc),sp)
278 sigma_level_t_conv(kt) =
real(zeta_t(kt),sp)
282 sigma_level_r_conv(kr) =
real(kr,sp)/
real(krmax,sp)
288 maske_conv(i,j) = maske(j,i)
289 n_cts_conv(i,j) = n_cts(j,i)
290 kc_cts_conv(i,j) = kc_cts(j,i)
292 lambda_conv(i,j) =
real(lambda(j,i),sp)
293 phi_conv(i,j) =
real(phi(j,i),sp)
294 lon_conv(i,j) =
real(lambda(j,i)*pi_180_inv,sp)
295 lon_conv(i,j) = modulo(lon_conv(i,j)+180.0_sp, 360.0_sp)-180.0_sp
297 lat_conv(i,j) =
real(phi(j,i) *pi_180_inv,sp)
298 if (lat_conv(i,j) > 90.0_sp) lat_conv(i,j) = 90.0_sp
299 if (lat_conv(i,j) < -90.0_sp) lat_conv(i,j) = -90.0_sp
301 temp_s_conv(i,j) =
real(temp_s(j,i),sp)
302 as_perp_conv(i,j) =
real(as_perp(j,i)*year_sec,sp)
303 zs_conv(i,j) =
real(zs(j,i),sp)
304 zm_conv(i,j) =
real(zm(j,i),sp)
305 zb_conv(i,j) =
real(zb(j,i),sp)
306 zl_conv(i,j) =
real(zl(j,i),sp)
307 h_cold_conv(i,j) =
real(H_cold(j,i),sp)
308 h_temp_conv(i,j) =
real(H_temp(j,i),sp)
309 h_conv(i,j) =
real(H(j,i),sp)
310 q_bm_conv(i,j) =
real(q_bm(j,i)*year_sec,sp)
311 q_tld_conv(i,j) =
real(q_tld(j,i)*year_sec,sp)
312 am_perp_conv(i,j) =
real(am_perp(j,i)*year_sec,sp)
313 qx_conv(i,j) =
real(qx(j,i)*year_sec,sp)
314 qy_conv(i,j) =
real(qy(j,i)*year_sec,sp)
315 dzs_dtau_conv(i,j) =
real(dzs_dtau(j,i)*year_sec,sp)
316 dzm_dtau_conv(i,j) =
real(dzm_dtau(j,i)*year_sec,sp)
317 dzb_dtau_conv(i,j) =
real(dzb_dtau(j,i)*year_sec,sp)
318 dzl_dtau_conv(i,j) =
real(dzl_dtau(j,i)*year_sec,sp)
319 dh_c_dtau_conv(i,j) =
real(dh_c_dtau(j,i)*year_sec,sp)
320 dh_t_dtau_conv(i,j) =
real(dh_t_dtau(j,i)*year_sec,sp)
321 dh_dtau_conv(i,j) =
real(dh_dtau(j,i)*year_sec,sp)
322 vx_b_g_conv(i,j) =
real(vx_b_g(j,i)*year_sec,sp)
323 vy_b_g_conv(i,j) =
real(vy_b_g(j,i)*year_sec,sp)
324 vz_b_conv(i,j) =
real(vz_b(j,i)*year_sec,sp)
325 vh_b_conv(i,j) = sqrt( vx_b_g_conv(i,j)**2 + vy_b_g_conv(i,j)**2 )
326 vx_s_g_conv(i,j) =
real(vx_s_g(j,i)*year_sec,sp)
327 vy_s_g_conv(i,j) =
real(vy_s_g(j,i)*year_sec,sp)
328 vz_s_conv(i,j) =
real(vz_s(j,i)*year_sec,sp)
329 vh_s_conv(i,j) = sqrt( vx_s_g_conv(i,j)**2 + vy_s_g_conv(i,j)**2 )
330 temp_b_conv(i,j) =
real(temp_b(j,i),sp)
331 temph_b_conv(i,j) =
real(temph_b(j,i),sp)
332 p_b_w_conv(i,j) =
real(p_b_w(j,i),sp)
333 h_w_conv(i,j) =
real(H_w(j,i),sp)
334 q_gl_g_conv(i,j) =
real(q_gl_g(j,i)*year_sec,sp)
337 temp_r_conv(i,j,kr) =
real(temp_r(kr,j,i),sp)
341 vx_t_conv(i,j,kt) =
real(vx_t(kt,j,i)*year_sec,sp)
342 vy_t_conv(i,j,kt) =
real(vy_t(kt,j,i)*year_sec,sp)
343 vz_t_conv(i,j,kt) =
real(vz_t(kt,j,i)*year_sec,sp)
344 omega_t_conv(i,j,kt) =
real(omega_t(kt,j,i),sp)
345 age_t_conv(i,j,kt) =
real(age_t(kt,j,i)/year_sec,sp)
346 enth_t_conv(i,j,kt) =
real(enth_t(kt,j,i),sp)
347 enh_t_conv(i,j,kt) =
real(enh_t(kt,j,i),sp)
351 vx_c_conv(i,j,kc) =
real(vx_c(kc,j,i)*year_sec,sp)
352 vy_c_conv(i,j,kc) =
real(vy_c(kc,j,i)*year_sec,sp)
353 vz_c_conv(i,j,kc) =
real(vz_c(kc,j,i)*year_sec,sp)
354 temp_c_conv(i,j,kc) =
real(temp_c(kc,j,i),sp)
355 age_c_conv(i,j,kc) =
real(age_c(kc,j,i)/year_sec,sp)
356 enth_c_conv(i,j,kc) =
real(enth_c(kc,j,i),sp)
357 omega_c_conv(i,j,kc) =
real(omega_c(kc,j,i),sp)
358 enh_c_conv(i,j,kc) =
real(enh_c(kc,j,i),sp)
366 write(unit=11) time_conv
367 if (forcing_flag == 1)
then
368 write(unit=11) delta_ts_conv
369 else if (forcing_flag == 2)
then
370 write(unit=11) glac_index_conv
371 else if (forcing_flag == 3)
then
372 glac_index_conv = 1.11e+11
373 write(unit=11) glac_index_conv
375 write(unit=11) z_sl_conv
376 write(unit=11) xi_conv
377 write(unit=11) eta_conv
378 write(unit=11) sigma_level_c_conv
379 write(unit=11) sigma_level_t_conv
380 write(unit=11) sigma_level_r_conv
381 write(unit=11) lon_conv
382 write(unit=11) lat_conv
383 write(unit=11) lambda_conv
384 write(unit=11) phi_conv
385 write(unit=11) temp_s_conv
386 write(unit=11) as_perp_conv
387 write(unit=11) maske_conv
388 write(unit=11) n_cts_conv
389 write(unit=11) kc_cts_conv
390 write(unit=11) zs_conv
391 write(unit=11) zm_conv
392 write(unit=11) zb_conv
393 write(unit=11) zl_conv
394 write(unit=11) h_cold_conv
395 write(unit=11) h_temp_conv
396 write(unit=11) h_conv
397 write(unit=11) h_r_conv
398 if (flag_3d_output)
then
399 write(unit=11) vx_c_conv
400 write(unit=11) vy_c_conv
401 write(unit=11) vz_c_conv
402 write(unit=11) vx_t_conv
403 write(unit=11) vy_t_conv
404 write(unit=11) vz_t_conv
405 write(unit=11) temp_c_conv
406 write(unit=11) omega_t_conv
407 write(unit=11) temp_r_conv
408 write(unit=11) enth_c_conv
409 write(unit=11) enth_t_conv
410 write(unit=11) omega_c_conv
411 write(unit=11) enh_c_conv
412 write(unit=11) enh_t_conv
414 write(unit=11) q_bm_conv
415 write(unit=11) q_tld_conv
416 write(unit=11) am_perp_conv
417 write(unit=11) qx_conv
418 write(unit=11) qy_conv
419 if (flag_3d_output)
then
420 write(unit=11) age_c_conv
421 write(unit=11) age_t_conv
423 write(unit=11) dzs_dtau_conv
424 write(unit=11) dzm_dtau_conv
425 write(unit=11) dzb_dtau_conv
426 write(unit=11) dzl_dtau_conv
427 write(unit=11) dh_c_dtau_conv
428 write(unit=11) dh_t_dtau_conv
429 write(unit=11) dh_dtau_conv
430 write(unit=11) vx_b_g_conv
431 write(unit=11) vy_b_g_conv
432 write(unit=11) vz_b_conv
433 write(unit=11) vh_b_conv
434 write(unit=11) vx_s_g_conv
435 write(unit=11) vy_s_g_conv
436 write(unit=11) vz_s_conv
437 write(unit=11) vh_s_conv
438 write(unit=11) temp_b_conv
439 write(unit=11) temph_b_conv
440 write(unit=11) p_b_w_conv
441 write(unit=11) h_w_conv
442 write(unit=11) q_gl_g_conv
443 write(unit=11) v_tot_conv
444 write(unit=11) a_grounded_conv
445 write(unit=11) a_floating_conv
447 close(unit=11, status=
'keep')
453 if (flag_3d_output)
then
Declarations of kind types for SICOPOLIS.
Declarations of global variables for SICOPOLIS (for the ANT domain).
Declarations of global variables for SICOPOLIS.
Conversion from temperature (temp) and water content (omega) to enthalpy (enth) and vice versa...
subroutine output1(runname, time, delta_ts, glac_index, z_sl, flag_3d_output, ndat2d, ndat3d)
Writing of time-slice files in binary format.
real(dp) function, public enth_fct_temp_omega(temp_val, omega_val)
Enthalpy as a function of temperature and water content.