SICOPOLIS V3.2
 All Classes Files Functions Variables Macros
output4.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : o u t p u t 4
4 !
5 !> @file
6 !!
7 !! Writing of time-series data of the deep ice cores 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 of the deep ice cores on file in ASCII format.
34 !<------------------------------------------------------------------------------
35 subroutine output4(time, dxi, deta, delta_ts, glac_index, z_sl)
36 
37 use sico_types
39 use sico_vars
40 
41 implicit none
42 real(dp), intent(in) :: time, dxi, deta, delta_ts, glac_index, z_sl
43 
44 integer(i4b) :: i, j, n
45 real(dp) :: time_val
46 real(dp), dimension(0:JMAX,0:IMAX) :: field
47 real(dp), dimension(:), allocatable :: h_core, temp_core, &
48  vx_core, vy_core, v_core, &
49  rbx_core, rby_core, rb_core
50 
51 allocate(h_core(n_core), temp_core(n_core), &
52  vx_core(n_core), vy_core(n_core), v_core(n_core), &
53  rbx_core(n_core), rby_core(n_core), rb_core(n_core))
54 
55 !-------- Determination of ice-core data --------
56 
57 do n=1, n_core
58 
59 ! ------ Ice thickness
60 
61  field = h_c + h_t
62  call borehole(field, x_core(n), y_core(n), dxi, deta, 'grid', h_core(n))
63 
64 ! ------ Surface velocity
65 
66  do i=0, imax
67  do j=0, jmax
68  field(j,i) = vx_c(kcmax,j,i)
69  end do
70  end do
71 
72  call borehole(field, x_core(n), y_core(n), dxi, deta, 'sg_x', vx_core(n))
73 
74  do i=0, imax
75  do j=0, jmax
76  field(j,i) = vy_c(kcmax,j,i)
77  end do
78  end do
79 
80  call borehole(field, x_core(n), y_core(n), dxi, deta, 'sg_y', vy_core(n))
81 
82  v_core(n) = sqrt(vx_core(n)**2+vy_core(n)**2)
83 
84 ! ------ Basal temperature
85 
86  do i=0, imax
87  do j=0, jmax
88  field(j,i) = temp_r(krmax,j,i)
89  end do
90  end do
91 
92  call borehole(field, x_core(n), y_core(n), dxi, deta, 'grid', temp_core(n))
93 
94 ! ------ Basal frictional heating
95 
96  do i=0, imax
97  do j=0, jmax
98  field(j,i) = vx_t(0,j,i)*txz_t(0,j,i)
99  end do
100  end do
101 
102  call borehole(field, x_core(n), y_core(n), dxi, deta, 'sg_x', rbx_core(n))
103 
104  do i=0, imax
105  do j=0, jmax
106  field(j,i) = vy_t(0,j,i)*tyz_t(0,j,i)
107  end do
108  end do
109 
110  call borehole(field, x_core(n), y_core(n), dxi, deta, 'sg_y', rby_core(n))
111 
112  rb_core(n) = rbx_core(n) + rby_core(n)
113 
114 end do
115 
116 ! ------ Conversion
117 
118 #if ( !defined(OUT_TIMES) || OUT_TIMES==1 )
119 time_val = time /year_sec ! s -> a
120 #elif OUT_TIMES == 2
121 time_val = (time+year_zero) /year_sec ! s -> a
122 #else
123 stop ' output4: OUT_TIMES must be either 1 or 2!'
124 #endif
125 
126 do n=1, n_core
127  v_core(n) = v_core(n) *year_sec ! m/s -> m/a
128 end do
129 
130 !-------- Writing of data on file --------
131 
132 if (forcing_flag == 1) then
133  write(unit=14, fmt='(1pe13.6,2(1pe13.4))') time_val, delta_ts, z_sl
134 else if (forcing_flag == 2) then
135  write(unit=14, fmt='(1pe13.6,2(1pe13.4))') time_val, glac_index, z_sl
136 else if (forcing_flag == 3) then
137  write(unit=14, fmt='(1pe13.6,2(1pe13.4))') time_val, 1.11e+11_dp, z_sl
138 end if
139 
140 n=1
141 write(unit=14, fmt='(13x,1pe13.4)', advance='no') h_core(n)
142 do n=2, n_core-1
143  write(unit=14, fmt='(1pe13.4)', advance='no') h_core(n)
144 end do
145 n=n_core
146 write(unit=14, fmt='(1pe13.4)') h_core(n)
147 
148 n=1
149 write(unit=14, fmt='(13x,1pe13.4)', advance='no') v_core(n)
150 do n=2, n_core-1
151  write(unit=14, fmt='(1pe13.4)', advance='no') v_core(n)
152 end do
153 n=n_core
154 write(unit=14, fmt='(1pe13.4)') v_core(n)
155 
156 n=1
157 write(unit=14, fmt='(13x,1pe13.4)', advance='no') temp_core(n)
158 do n=2, n_core-1
159  write(unit=14, fmt='(1pe13.4)', advance='no') temp_core(n)
160 end do
161 n=n_core
162 write(unit=14, fmt='(1pe13.4)') temp_core(n)
163 
164 n=1
165 write(unit=14, fmt='(13x,1pe13.4)', advance='no') rb_core(n)
166 do n=2, n_core-1
167  write(unit=14, fmt='(1pe13.4)', advance='no') rb_core(n)
168 end do
169 n=n_core
170 write(unit=14, fmt='(1pe13.4,/)') rb_core(n)
171 
172 deallocate(h_core, vx_core, vy_core, v_core, temp_core, &
173  rbx_core, rby_core, rb_core)
174 
175 end subroutine output4
176 !
subroutine borehole(field, x_pos, y_pos, dxi, deta, ch_grid, field_val)
Computation of an arbitrary field quantity for a given borehole position x_pos, y_pos by weighed aver...
Definition: borehole.F90:39
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
subroutine output4(time, dxi, deta, delta_ts, glac_index, z_sl)
Writing of time-series data of the deep ice cores on file in ASCII format.
Definition: output4.F90:35
Declarations of global variables for SICOPOLIS.