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
94 open(11, iostat=ios, &
95 file=anfdatpath//
'/'//trim(anfdatname), &
96 status=
'old', form=
'unformatted')
97 if (ios /= 0) stop
' topography3: Error when opening the initial-value file!'
99 read(11) ch_attr_title
100 read(11) ch_attr_institution
101 read(11) ch_attr_source
102 read(11) ch_attr_history
103 read(11) ch_attr_references
109 read(11) sigma_level_c_conv
110 read(11) sigma_level_t_conv
111 read(11) sigma_level_r_conv
115 read(11) as_perp_conv
133 read(11) omega_t_conv
137 read(11) am_perp_conv
142 read(11) dzs_dtau_conv
143 read(11) dzm_dtau_conv
144 read(11) dzb_dtau_conv
145 read(11) dzl_dtau_conv
146 read(11) dh_c_dtau_conv
147 read(11) dh_t_dtau_conv
148 read(11) dh_dtau_conv
149 read(11,end=110) vx_b_g_conv
150 read(11,end=110) vy_b_g_conv
151 read(11,end=110) vz_b_conv
152 read(11,end=110) vx_s_g_conv
153 read(11,end=110) vy_s_g_conv
154 read(11,end=110) vz_s_conv
155 read(11,end=110) temp_b_conv
156 read(11,end=110) temph_b_conv
157 read(11,end=110) p_b_w_conv
158 read(11,end=110) h_w_conv
159 read(11,end=110) q_gl_g_conv
164 write(6,
'(/1x,a)')
'topography3: End-of-file condition while reading *.erg.'
165 write(6,
'(1x,a)')
' Some variables will be undefined.'
169 close(11,status=
'keep')
173 z_sl =
real(z_sl_conv,dp)
175 h_r =
real(h_r_conv,dp)
180 xi(i) =
real(xi_conv(i),dp)
181 eta(j) =
real(eta_conv(j),dp)
182 zs(j,i) =
real(zs_conv(j,i),dp)
183 zm(j,i) =
real(zm_conv(j,i),dp)
184 zb(j,i) =
real(zb_conv(j,i),dp)
185 zl(j,i) =
real(zl_conv(j,i),dp)
186 h_c(j,i) =
real(H_c_conv(j,i),dp)
187 h_t(j,i) =
real(H_t_conv(j,i),dp)
188 q_bm(j,i) =
real(Q_bm_conv(j,i),dp)
189 q_tld(j,i) =
real(Q_tld_conv(j,i),dp)
190 am_perp(j,i) =
real(am_perp_conv(j,i),dp)
191 qx(j,i) =
real(qx_conv(j,i),dp)
192 qy(j,i) =
real(qy_conv(j,i),dp)
193 dzs_dtau(j,i) =
real(dzs_dtau_conv(j,i),dp)
194 dzm_dtau(j,i) =
real(dzm_dtau_conv(j,i),dp)
195 dzb_dtau(j,i) =
real(dzb_dtau_conv(j,i),dp)
196 dzl_dtau(j,i) =
real(dzl_dtau_conv(j,i),dp)
197 dh_c_dtau(j,i) =
real(dH_c_dtau_conv(j,i),dp)
198 dh_t_dtau(j,i) =
real(dH_t_dtau_conv(j,i),dp)
199 vx_b_g(j,i) =
real(vx_b_g_conv(j,i),dp)
200 vy_b_g(j,i) =
real(vy_b_g_conv(j,i),dp)
201 vz_b(j,i) =
real(vz_b_conv(j,i),dp)
202 vx_s_g(j,i) =
real(vx_s_g_conv(j,i),dp)
203 vy_s_g(j,i) =
real(vy_s_g_conv(j,i),dp)
204 vz_s(j,i) =
real(vz_s_conv(j,i),dp)
205 temp_b(j,i) =
real(temp_b_conv(j,i),dp)
206 temph_b(j,i) =
real(temph_b_conv(j,i),dp)
207 p_b_w(j,i) =
real(p_b_w_conv(j,i),dp)
208 h_w(j,i) =
real(H_w_conv(j,i),dp)
209 q_gl_g(j,i) =
real(q_gl_g_conv(j,i),dp)
212 temp_r(kr,j,i) =
real(temp_r_conv(kr,j,i),dp)
216 vx_t(kt,j,i) =
real(vx_t_conv(kt,j,i),dp)
217 vy_t(kt,j,i) =
real(vy_t_conv(kt,j,i),dp)
218 vz_t(kt,j,i) =
real(vz_t_conv(kt,j,i),dp)
219 omega_t(kt,j,i) =
real(omega_t_conv(kt,j,i),dp)
220 age_t(kt,j,i) =
real(age_t_conv(kt,j,i),dp)
224 vx_c(kc,j,i) =
real(vx_c_conv(kc,j,i),dp)
225 vy_c(kc,j,i) =
real(vy_c_conv(kc,j,i),dp)
226 vz_c(kc,j,i) =
real(vz_c_conv(kc,j,i),dp)
227 temp_c(kc,j,i) =
real(temp_c_conv(kc,j,i),dp)
228 age_c(kc,j,i) =
real(age_c_conv(kc,j,i),dp)
236 open(23, iostat=ios, &
237 file=inpath//
'/asf/'//zl0_file, &
238 recl=16384, status=
'old')
240 if (ios /= 0) stop
' topography3: Error when opening the zl0 file!'
242 do n=1, 6;
read(23,
'(a)') ch_dummy;
end do
245 read(23,*) (zl0(j,i), i=0,imax)
248 close(23, status=
'keep')
257 call
geo_coord(phi(j,i), lambda(j,i), xi(i), eta(j))
275 area(j,i) = sq_g11_g(j,i)*sq_g22_g(j,i)*dxi*deta