7 !! Definition of the initial surface and bedrock topography
8 !! (including gradients) and of the horizontal grid spacings dxi, deta.
9 !! For initial topography from previous simulation (read in binary format).
13 !! Copyright 2009-2013 Ralf Greve
17 !! This file is part of SICOPOLIS.
19 !! SICOPOLIS is free software: you can redistribute it and/or modify
20 !! it under the terms of the GNU General Public License as published by
21 !! the Free Software Foundation, either version 3 of the License, or
22 !! (at your option) any later version.
24 !! SICOPOLIS is distributed in the hope that it will be useful,
25 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
26 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 !! GNU General Public License for more details.
29 !! You should have received a copy of the GNU General Public License
30 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
32 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35 !> Definition of the initial surface and bedrock topography
36 !! (including gradients) and of the horizontal grid spacings dxi, deta.
37 !! For initial topography from previous simulation (read in binary format).
38 !<------------------------------------------------------------------------------
46 character (len=100),
intent (in) :: anfdatname
48 real(dp),
intent (out) :: dxi, deta, z_sl
50 integer(i4b) :: i, j, kc, kt, kr, n
52 real(sp) :: time_conv, dummy_conv, z_sl_conv, &
53 h_r_conv, xi_conv(0:imax), eta_conv(0:jmax), &
54 sigma_level_c_conv(0:kcmax), sigma_level_t_conv(0:ktmax), &
55 sigma_level_r_conv(0:krmax), &
56 lambda_conv(0:jmax,0:imax), phi_conv(0:jmax,0:imax), &
57 temp_s_conv(0:jmax,0:imax), as_perp_conv(0:jmax,0:imax), &
58 zs_conv(0:jmax,0:imax), zm_conv(0:jmax,0:imax), &
59 zb_conv(0:jmax,0:imax), zl_conv(0:jmax,0:imax), &
60 h_c_conv(0:jmax,0:imax), h_t_conv(0:jmax,0:imax), &
61 h_conv(0:jmax,0:imax), &
62 q_bm_conv(0:jmax,0:imax), q_tld_conv(0:jmax,0:imax), &
63 am_perp_conv(0:jmax,0:imax), &
64 qx_conv(0:jmax,0:imax), qy_conv(0:jmax,0:imax), &
65 temp_r_conv(0:krmax,0:jmax,0:imax), &
66 vx_c_conv(0:kcmax,0:jmax,0:imax), &
67 vy_c_conv(0:kcmax,0:jmax,0:imax), &
68 vz_c_conv(0:kcmax,0:jmax,0:imax), &
69 vx_t_conv(0:ktmax,0:jmax,0:imax), &
70 vy_t_conv(0:ktmax,0:jmax,0:imax), &
71 vz_t_conv(0:ktmax,0:jmax,0:imax), &
72 temp_c_conv(0:kcmax,0:jmax,0:imax), &
73 age_c_conv(0:kcmax,0:jmax,0:imax), &
74 omega_t_conv(0:ktmax,0:jmax,0:imax), &
75 age_t_conv(0:ktmax,0:jmax,0:imax), &
76 dzs_dtau_conv(0:jmax,0:imax), dzm_dtau_conv(0:jmax,0:imax), &
77 dzb_dtau_conv(0:jmax,0:imax), dzl_dtau_conv(0:jmax,0:imax), &
78 dh_c_dtau_conv(0:jmax,0:imax), dh_t_dtau_conv(0:jmax,0:imax), &
79 dh_dtau_conv(0:jmax,0:imax), &
80 vx_b_g_conv(0:jmax,0:imax), vy_b_g_conv(0:jmax,0:imax), &
81 vz_b_conv(0:jmax,0:imax), &
82 vx_s_g_conv(0:jmax,0:imax), vy_s_g_conv(0:jmax,0:imax), &
83 vz_s_conv(0:jmax,0:imax), &
84 temp_b_conv(0:jmax,0:imax), temph_b_conv(0:jmax,0:imax), &
85 p_b_w_conv(0:jmax,0:imax), h_w_conv(0:jmax,0:imax), &
86 q_gl_g_conv(0:jmax,0:imax)
87 character (len=256) :: ch_attr_title, ch_attr_institution, ch_attr_source, &
88 ch_attr_history, ch_attr_references
93 open(11, iostat=ios, &
94 file=anfdatpath//
'/'//trim(anfdatname), &
95 status=
'old', form=
'unformatted')
96 if (ios /= 0) stop
' topography3: Error when opening the initial-value file!'
98 read(11) ch_attr_title
99 read(11) ch_attr_institution
100 read(11) ch_attr_source
101 read(11) ch_attr_history
102 read(11) ch_attr_references
108 read(11) sigma_level_c_conv
109 read(11) sigma_level_t_conv
110 read(11) sigma_level_r_conv
114 read(11) as_perp_conv
132 read(11) omega_t_conv
136 read(11) am_perp_conv
141 read(11) dzs_dtau_conv
142 read(11) dzm_dtau_conv
143 read(11) dzb_dtau_conv
144 read(11) dzl_dtau_conv
145 read(11) dh_c_dtau_conv
146 read(11) dh_t_dtau_conv
147 read(11) dh_dtau_conv
148 read(11,end=110) vx_b_g_conv
149 read(11,end=110) vy_b_g_conv
150 read(11,end=110) vz_b_conv
151 read(11,end=110) vx_s_g_conv
152 read(11,end=110) vy_s_g_conv
153 read(11,end=110) vz_s_conv
154 read(11,end=110) temp_b_conv
155 read(11,end=110) temph_b_conv
156 read(11,end=110) p_b_w_conv
157 read(11,end=110) h_w_conv
158 read(11,end=110) q_gl_g_conv
163 write(6,
'(/1x,a)')
'topography3: End-of-file condition while reading *.erg.'
164 write(6,
'(1x,a)')
' Some variables will be undefined.'
168 close(11,status=
'keep')
172 z_sl =
real(z_sl_conv,dp)
174 h_r =
real(h_r_conv,dp)
179 xi(i) =
real(xi_conv(i),dp)
180 eta(j) =
real(eta_conv(j),dp)
181 zs(j,i) =
real(zs_conv(j,i),dp)
182 zm(j,i) =
real(zm_conv(j,i),dp)
183 zb(j,i) =
real(zb_conv(j,i),dp)
184 zl(j,i) =
real(zl_conv(j,i),dp)
185 h_c(j,i) =
real(H_c_conv(j,i),dp)
186 h_t(j,i) =
real(H_t_conv(j,i),dp)
187 q_bm(j,i) =
real(Q_bm_conv(j,i),dp)
188 q_tld(j,i) =
real(Q_tld_conv(j,i),dp)
189 am_perp(j,i) =
real(am_perp_conv(j,i),dp)
190 qx(j,i) =
real(qx_conv(j,i),dp)
191 qy(j,i) =
real(qy_conv(j,i),dp)
192 dzs_dtau(j,i) =
real(dzs_dtau_conv(j,i),dp)
193 dzm_dtau(j,i) =
real(dzm_dtau_conv(j,i),dp)
194 dzb_dtau(j,i) =
real(dzb_dtau_conv(j,i),dp)
195 dzl_dtau(j,i) =
real(dzl_dtau_conv(j,i),dp)
196 dh_c_dtau(j,i) =
real(dH_c_dtau_conv(j,i),dp)
197 dh_t_dtau(j,i) =
real(dH_t_dtau_conv(j,i),dp)
198 vx_b_g(j,i) =
real(vx_b_g_conv(j,i),dp)
199 vy_b_g(j,i) =
real(vy_b_g_conv(j,i),dp)
200 vz_b(j,i) =
real(vz_b_conv(j,i),dp)
201 vx_s_g(j,i) =
real(vx_s_g_conv(j,i),dp)
202 vy_s_g(j,i) =
real(vy_s_g_conv(j,i),dp)
203 vz_s(j,i) =
real(vz_s_conv(j,i),dp)
204 temp_b(j,i) =
real(temp_b_conv(j,i),dp)
205 temph_b(j,i) =
real(temph_b_conv(j,i),dp)
206 p_b_w(j,i) =
real(p_b_w_conv(j,i),dp)
207 h_w(j,i) =
real(H_w_conv(j,i),dp)
208 q_gl_g(j,i) =
real(q_gl_g_conv(j,i),dp)
211 temp_r(kr,j,i) =
real(temp_r_conv(kr,j,i),dp)
215 vx_t(kt,j,i) =
real(vx_t_conv(kt,j,i),dp)
216 vy_t(kt,j,i) =
real(vy_t_conv(kt,j,i),dp)
217 vz_t(kt,j,i) =
real(vz_t_conv(kt,j,i),dp)
218 omega_t(kt,j,i) =
real(omega_t_conv(kt,j,i),dp)
219 age_t(kt,j,i) =
real(age_t_conv(kt,j,i),dp)
223 vx_c(kc,j,i) =
real(vx_c_conv(kc,j,i),dp)
224 vy_c(kc,j,i) =
real(vy_c_conv(kc,j,i),dp)
225 vz_c(kc,j,i) =
real(vz_c_conv(kc,j,i),dp)
226 temp_c(kc,j,i) =
real(temp_c_conv(kc,j,i),dp)
227 age_c(kc,j,i) =
real(age_c_conv(kc,j,i),dp)
235 open(23, iostat=ios, &
236 file=inpath//
'/ant/'//zl0_file, &
237 recl=8192, status=
'old')
239 if (ios /= 0) stop
' topography3: Error when opening the zl0 file!'
241 do n=1, 6;
read(23,
'(a)') ch_dummy;
end do
244 read(23,*) (zl0(j,i), i=0,imax)
247 close(23, status=
'keep')
256 call
geo_coord(phi(j,i), lambda(j,i), xi(i), eta(j))
274 area(j,i) = sq_g11_g(j,i)*sq_g22_g(j,i)*dxi*deta