SICOPOLIS V3.1
 All Classes Files Functions Variables Macros
output3.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : o u t p u t 3
4 !
5 !> @file
6 !!
7 !! Writing of time-series data of the ice thickness field on file
8 !! in ASCII format.
9 !!
10 !! @section Copyright
11 !!
12 !! Copyright 2009-2013 Ralf Greve
13 !!
14 !! @section License
15 !!
16 !! This file is part of SICOPOLIS.
17 !!
18 !! SICOPOLIS is free software: you can redistribute it and/or modify
19 !! it under the terms of the GNU General Public License as published by
20 !! the Free Software Foundation, either version 3 of the License, or
21 !! (at your option) any later version.
22 !!
23 !! SICOPOLIS is distributed in the hope that it will be useful,
24 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
25 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 !! GNU General Public License for more details.
27 !!
28 !! You should have received a copy of the GNU General Public License
29 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
30 !<
31 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32 
33 !-------------------------------------------------------------------------------
34 !> Writing of time-series data of the ice thickness field on file
35 !! in ASCII format.
36 !<------------------------------------------------------------------------------
37 
38 subroutine output3(time, delta_ts, glac_index, z_sl)
39 
40 use sico_types
42 
43 implicit none
44 
45 real(dp), intent(in) :: time, delta_ts, glac_index, z_sl
46 
47 integer(i4b) :: i, j
48 real(dp) :: time_val, delta_ts_val, glac_index_val, z_sl_val
49 real(dp) :: h_val(0:jmax,0:imax)
50 
51 character(len= 8) :: ch_imax
52 character(len=128) :: fmt5, fmt6
53 
54 fmt5 = '(/,1pe13.6,2(1pe13.4),/)'
55 
56 write(ch_imax, fmt='(i8)') imax
57 write(fmt6, fmt='(a)') '('//trim(adjustl(ch_imax))//'(f8.1),f8.1)'
58 
59 !-------- Conversion --------
60 
61 #if ( !defined(OUT_TIMES) || OUT_TIMES==1 )
62 time_val = time /year_sec ! s -> a
63 #elif OUT_TIMES == 2
64 time_val = (time+year_zero) /year_sec ! s -> a
65 #else
66 stop ' output3: OUT_TIMES must be either 1 or 2!'
67 #endif
68 
69 delta_ts_val = delta_ts ! in deg C
70 glac_index_val = glac_index
71 z_sl_val = z_sl ! in m
72 
73 h_val = h_c + h_t ! in m
74 
75 !-------- Write data on time-series file --------
76 
77 if (forcing_flag == 1) then
78  write(unit=13, fmt=trim(fmt5)) time_val, delta_ts_val, z_sl_val
79 else if (forcing_flag == 2) then
80  write(unit=13, fmt=trim(fmt5)) time_val, glac_index_val, z_sl_val
81 else if (forcing_flag == 3) then
82  write(unit=13, fmt=trim(fmt5)) time_val, 1.11e+11_dp, z_sl_val
83 end if
84 
85 do j=jmax, 0, -1
86  write(unit=13, fmt=trim(fmt6)) (h_val(j,i), i=0,imax)
87 end do
88 
89 end subroutine output3
90 !