SICOPOLIS V3.0
 All Classes Files Functions Variables Macros
output5.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : o u t p u t 5
4 !
5 !> @file
6 !!
7 !! Writing of time-series data for all defined surface points on file
8 !! in ASCII format. Modification of Tolly's output7 by Thorben Dunse.
9 !!
10 !! @section Copyright
11 !!
12 !! Copyright 2009-2013 Thorben Dunse, 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 for all defined surface points on file
35 !! in ASCII format. Modification of Tolly's output7 by Thorben Dunse.
36 !<------------------------------------------------------------------------------
37 subroutine output5(time, dxi, deta, delta_ts, glac_index, z_sl)
38 
39 use sico_types
41 
42 implicit none
43 real(dp), intent(in) :: time, dxi, deta, delta_ts, glac_index, z_sl
44 
45 integer(i4b) :: n, k
46 real(dp) :: time_val
47 real(dp), dimension(0:JMAX,0:IMAX) :: field
48 real(dp), dimension(:), allocatable :: zl_surf, zs_surf, &
49  accum_surf, as_perp_surf, &
50  snowfall_surf, rainfall_surf, runoff_surf, &
51  vx_surf, vy_surf, vz_surf, &
52  vx_base, vy_base, vz_base, &
53  temp_base_pmp
54 
55 allocate(zl_surf(n_surf), zs_surf(n_surf), &
56  accum_surf(n_surf), &
57  as_perp_surf(n_surf), snowfall_surf(n_surf), &
58  rainfall_surf(n_surf), runoff_surf(n_surf), &
59  vx_surf(n_surf), vy_surf(n_surf), vz_surf(n_surf), &
60  vx_base(n_surf), vy_base(n_surf), vz_base(n_surf), &
61  temp_base_pmp(n_surf))
62 
63 !-------- Determination of ice-core data --------
64 
65 do n=1, n_surf
66 
67 ! ------ Bedrock elevation
68 
69  field = zl
70  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
71  'grid', zl_surf(n))
72 
73 ! ------ Surface elevation
74 
75  field = zs
76  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
77  'grid', zs_surf(n))
78 
79 
80 ! ------ Accumulation
81 
82  field = accum
83  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
84  'grid', accum_surf(n))
85 
86 ! ------ Surface mass balance
87 
88  field = as_perp
89  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
90  'grid', as_perp_surf(n))
91 
92 ! ------ Snowfall
93 
94  field = snowfall
95  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
96  'grid', snowfall_surf(n))
97 
98 ! ------ Rainfall
99 
100  field = rainfall
101  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
102  'grid', rainfall_surf(n))
103 
104 ! ------ Runoff
105 
106  field = runoff
107  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
108  'grid', runoff_surf(n))
109 
110 ! ------ Surface velocities
111 
112  field = vx_s_g
113  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
114  'grid', vx_surf(n))
115 
116  field = vy_s_g
117  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
118  'grid', vy_surf(n))
119 
120  field = vz_s
121  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
122  'grid', vz_surf(n))
123 
124 ! ------ Basal velocities
125 
126  field = vx_b_g
127  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
128  'grid', vx_base(n))
129 
130  field = vy_b_g
131  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
132  'grid', vy_base(n))
133 
134  field = vz_b
135  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
136  'grid', vz_base(n))
137 
138 ! ------ Basal temperature relative to pressure melting point
139 
140  field = temph_b
141  call borehole(field, x_surf(n), y_surf(n), dxi, deta, &
142  'grid', temp_base_pmp(n))
143 
144 
145 end do
146 
147 ! ------ Conversion
148 
149 #if ( !defined(OUT_TIMES) || OUT_TIMES==1 )
150 time_val = time /year_sec ! s -> a
151 #elif OUT_TIMES == 2
152 time_val = (time+year_zero) /year_sec ! s -> a
153 #else
154 stop ' output5: OUT_TIMES must be either 1 or 2!'
155 #endif
156 
157 do n=1, n_surf
158  accum_surf(n) = accum_surf(n) *year_sec ! m/s -> m/a
159  as_perp_surf(n) = as_perp_surf(n) *year_sec ! m/s -> m/a
160  snowfall_surf(n) = snowfall_surf(n) *year_sec ! m/s -> m/a
161  rainfall_surf(n) = rainfall_surf(n) *year_sec ! m/s -> m/a
162  runoff_surf(n) = runoff_surf(n) *year_sec ! m/s -> m/a
163  vx_surf(n) = vx_surf(n) *year_sec ! m/s -> m/a
164  vy_surf(n) = vy_surf(n) *year_sec ! m/s -> m/a
165  vz_surf(n) = vz_surf(n) *year_sec ! m/s -> m/a
166  vx_base(n) = vx_base(n) *year_sec ! m/s -> m/a
167  vy_base(n) = vy_base(n) *year_sec ! m/s -> m/a
168  vz_base(n) = vz_base(n) *year_sec ! m/s -> m/a
169 end do
170 
171 !-------- Writing of data on file --------
172 
173 if (forcing_flag == 1) then
174  write(41,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
175  write(42,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
176  write(43,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
177  write(44,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
178  write(45,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
179  write(46,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
180  write(47,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
181  write(48,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
182  write(49,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
183  write(50,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
184  write(51,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
185  write(52,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
186  write(53,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
187  write(54,'(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
188 else if (forcing_flag == 2) then
189  write(41,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
190  write(42,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
191  write(43,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
192  write(44,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
193  write(45,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
194  write(46,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
195  write(47,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
196  write(48,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
197  write(49,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
198  write(50,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
199  write(51,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
200  write(52,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
201  write(53,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
202  write(54,'(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
203 end if
204 
205 do n=1, n_surf-1
206  write(41,'(1pe13.4)',advance='no') zl_surf(n)
207  write(42,'(1pe13.4)',advance='no') zs_surf(n)
208  write(43,'(1pe13.4)',advance='no') accum_surf(n)
209  write(44,'(1pe13.4)',advance='no') as_perp_surf(n)
210  write(45,'(1pe13.4)',advance='no') snowfall_surf(n)
211  write(46,'(1pe13.4)',advance='no') rainfall_surf(n)
212  write(47,'(1pe13.4)',advance='no') runoff_surf(n)
213  write(48,'(1pe13.4)',advance='no') vx_surf(n)
214  write(49,'(1pe13.4)',advance='no') vy_surf(n)
215  write(50,'(1pe13.4)',advance='no') vz_surf(n)
216  write(51,'(1pe13.4)',advance='no') vx_base(n)
217  write(52,'(1pe13.4)',advance='no') vy_base(n)
218  write(53,'(1pe13.4)',advance='no') vz_base(n)
219  write(54,'(1pe13.4)',advance='no') temp_base_pmp(n)
220 end do
221 
222 n=n_surf
223  write(41,'(1pe13.4)') zl_surf(n)
224  write(42,'(1pe13.4)') zs_surf(n)
225  write(43,'(1pe13.4)') accum_surf(n)
226  write(44,'(1pe13.4)') as_perp_surf(n)
227  write(45,'(1pe13.4)') snowfall_surf(n)
228  write(46,'(1pe13.4)') rainfall_surf(n)
229  write(47,'(1pe13.4)') runoff_surf(n)
230  write(48,'(1pe13.4)') vx_surf(n)
231  write(49,'(1pe13.4)') vy_surf(n)
232  write(50,'(1pe13.4)') vz_surf(n)
233  write(51,'(1pe13.4)') vx_base(n)
234  write(52,'(1pe13.4)') vy_base(n)
235  write(53,'(1pe13.4)') vz_base(n)
236  write(54,'(1pe13.4)') temp_base_pmp(n)
237 
238 deallocate(zl_surf, zs_surf, accum_surf, as_perp_surf, &
239  snowfall_surf, rainfall_surf, runoff_surf, &
240  vx_surf, vy_surf, vz_surf, &
241  vx_base, vy_base, vz_base,temp_base_pmp)
242 
243 end subroutine output5
244 !