SICOPOLIS V3.0
 All Classes Files Functions Variables Macros
topography1.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : t o p o g r a p h y 1
4 !
5 !> @file
6 !!
7 !! Definition of the initial surface and bedrock topography
8 !! (including gradients) and of the horizontal grid spacings dxi, deta.
9 !! For present-day initial topography.
10 !!
11 !! @section Copyright
12 !!
13 !! Copyright 2009-2013 Ralf Greve
14 !!
15 !! @section License
16 !!
17 !! This file is part of SICOPOLIS.
18 !!
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.
23 !!
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.
28 !!
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/>.
31 !<
32 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33 
34 !-------------------------------------------------------------------------------
35 !> Definition of the initial surface and bedrock topography
36 !! (including gradients) and of the horizontal grid spacings dxi, deta.
37 !! For present-day initial topography.
38 !<------------------------------------------------------------------------------
39 subroutine topography1(dxi, deta)
40 
41 use sico_types
43 
44 implicit none
45 integer(i4b) :: i, j, n
46 integer(i4b) :: ios, n_dummy
47 real(dp) :: dxi, deta
48 real(dp) :: d_dummy
49 real(dp) :: xi0, eta0
50 real(dp) :: h_ice, freeboard_ratio
51 character :: ch_dummy
52 
53 !-------- Read topography --------
54 
55 open(21, iostat=ios, &
56  file=inpath//'/ant/'//zs_present_file, &
57  recl=8192, status='old')
58 
59 if (ios /= 0) stop ' topography1: Error when opening the zs file!'
60 
61 open(25, iostat=ios, &
62  file=inpath//'/ant/'//zb_present_file, &
63  recl=8192, status='old')
64 
65 if (ios /= 0) stop ' topography1: Error when opening the zb file!'
66 
67 open(22, iostat=ios, &
68  file=inpath//'/ant/'//zl_present_file, &
69  recl=8192, status='old')
70 
71 if (ios /= 0) stop ' topography1: Error when opening the zl file!'
72 
73 open(23, iostat=ios, &
74  file=inpath//'/ant/'//zl0_file, &
75  recl=8192, status='old')
76 
77 if (ios /= 0) stop ' topography1: Error when opening the zl0 file!'
78 
79 open(24, iostat=ios, &
80  file=inpath//'/ant/'//mask_present_file, &
81  recl=1024, status='old')
82 
83 if (ios /= 0) stop ' topography1: Error when opening the mask file!'
84 
85 do n=1, 6; read(21,'(a)') ch_dummy; end do
86 do n=1, 6; read(25,'(a)') ch_dummy; end do
87 do n=1, 6; read(22,'(a)') ch_dummy; end do
88 do n=1, 6; read(23,'(a)') ch_dummy; end do
89 do n=1, 6; read(24,'(a)') ch_dummy; end do
90 
91 do j=jmax, 0, -1
92  read(21,*) (zs(j,i), i=0,imax)
93  read(25,*) (zb(j,i), i=0,imax)
94  read(22,*) (zl(j,i), i=0,imax)
95  read(23,*) (zl0(j,i), i=0,imax)
96  read(24,2300) (maske(j,i), i=0,imax)
97 end do
98 
99 close(21, status='keep')
100 close(25, status='keep')
101 close(22, status='keep')
102 close(23, status='keep')
103 close(24, status='keep')
104 
105 2300 format(imax(i1),i1)
106 
107 !-------- Further stuff --------
108 
109 dxi = dx *1000.0_dp ! km -> m
110 deta = dx *1000.0_dp ! km -> m
111 
112 xi0 = x0 *1000.0_dp ! km -> m
113 eta0 = y0 *1000.0_dp ! km -> m
114 
115 freeboard_ratio = (rho_sw-rho)/rho_sw
116 
117 do i=0, imax
118 do j=0, jmax
119 
120  if (maske(j,i) <= 1 ) then
121 
122  zb(j,i) = zl(j,i) ! ensure consistency
123 
124  else if (maske(j,i) == 2 ) then
125 
126 #if ( MARGIN==1 || MARGIN==2 )
127  zs(j,i) = zl(j,i) ! ensure
128  zb(j,i) = zl(j,i) ! consistency
129 #elif ( MARGIN==3 )
130  zs(j,i) = 0.0_dp ! present-day
131  zb(j,i) = 0.0_dp ! sea level
132 #endif
133 
134  else if (maske(j,i) == 3 ) then
135 
136 #if ( MARGIN==1 || ( MARGIN==2 && MARINE_ICE_FORMATION==1 ) )
137  maske(j,i) = 2 ! floating ice cut off
138  zs(j,i) = zl(j,i)
139  zb(j,i) = zl(j,i)
140 #elif ( MARGIN==2 && MARINE_ICE_FORMATION==2 )
141  maske(j,i) = 0 ! floating ice becomes "underwater ice"
142  h_ice = zs(j,i)-zb(j,i) ! ice thickness
143  zs(j,i) = zl(j,i)+h_ice
144  zb(j,i) = zl(j,i)
145 #elif ( MARGIN==3 )
146  h_ice = zs(j,i)-zb(j,i) ! ice thickness
147  zs(j,i) = freeboard_ratio*h_ice ! ensure properly
148  zb(j,i) = zs(j,i)-h_ice ! floating ice
149 #endif
150 
151  end if
152 
153  xi(i) = xi0 + real(i,dp)*dxi
154  eta(j) = eta0 + real(j,dp)*deta
155 
156  call geo_coord(phi(j,i), lambda(j,i), xi(i), eta(j))
157 
158  zm(j,i) = zb(j,i)
159  n_cts(j,i) = -1
160 
161  h_c(j,i) = zs(j,i)-zm(j,i)
162  h_t(j,i) = 0.0_dp
163 
164  dzs_dtau(j,i) = 0.0_dp
165  dzm_dtau(j,i) = 0.0_dp
166  dzb_dtau(j,i) = 0.0_dp
167  dzl_dtau(j,i) = 0.0_dp
168  dh_c_dtau(j,i) = 0.0_dp
169  dh_t_dtau(j,i) = 0.0_dp
170 
171 end do
172 end do
173 
174 !-------- Metric tensor, gradients of the topography --------
175 
176 call metric
177 
178 #if TOPOGRAD==0
179 call topograd_1(dxi, deta, 1)
180 #elif TOPOGRAD==1
181 call topograd_2(dxi, deta, 1)
182 #endif
183 
184  1000 format(a)
185 
186 !-------- Corresponding area of grid points --------
187 
188 do i=0, imax
189 do j=0, jmax
190  area(j,i) = sq_g11_g(j,i)*sq_g22_g(j,i)*dxi*deta
191 end do
192 end do
193 
194 end subroutine topography1
195 !