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//'/grl/'//zs_present_file, &
57  recl=8192, status='old')
58 
59 if (ios.ne.0) stop ' topography1: Error when opening the zs file!'
60 
61 open(22, iostat=ios, &
62  file=inpath//'/grl/'//zl_present_file, &
63  recl=8192, status='old')
64 
65 if (ios.ne.0) stop ' topography1: Error when opening the zl file!'
66 
67 open(23, iostat=ios, &
68  file=inpath//'/grl/'//zl0_file, &
69  recl=8192, status='old')
70 
71 if (ios.ne.0) stop ' topography1: Error when opening the zl0 file!'
72 
73 open(24, iostat=ios, &
74  file=inpath//'/grl/'//mask_present_file, &
75  recl=1024, status='old')
76 
77 if (ios.ne.0) stop ' topography1: Error when opening the mask file!'
78 
79 do n=1, 6; read(21,'(a)') ch_dummy; end do
80 do n=1, 6; read(22,'(a)') ch_dummy; end do
81 do n=1, 6; read(23,'(a)') ch_dummy; end do
82 do n=1, 6; read(24,'(a)') ch_dummy; end do
83 
84 do j=jmax, 0, -1
85  read(21,*) (zs(j,i), i=0,imax)
86  read(22,*) (zl(j,i), i=0,imax)
87  read(23,*) (zl0(j,i), i=0,imax)
88  read(24,2300) (maske(j,i), i=0,imax)
89 end do
90 
91 close(21, status='keep')
92 close(22, status='keep')
93 close(23, status='keep')
94 close(24, status='keep')
95 
96 2300 format(imax(i1),i1)
97 
98 !-------- Further stuff --------
99 
100 dxi = dx *1000.0_dp ! km -> m
101 deta = dx *1000.0_dp ! km -> m
102 
103 xi0 = x0 *1000.0_dp ! km -> m
104 eta0 = y0 *1000.0_dp ! km -> m
105 
106 freeboard_ratio = (rho_sw-rho)/rho_sw
107 
108 do i=0, imax
109 do j=0, jmax
110 
111  if (maske(j,i) <= 1 ) then
112 
113  zb(j,i) = zl(j,i) ! ensure consistency
114 
115  else if (maske(j,i) == 2 ) then
116 
117 #if ( MARGIN==1 || MARGIN==2 )
118  zs(j,i) = zl(j,i) ! ensure
119  zb(j,i) = zl(j,i) ! consistency
120 #elif ( MARGIN==3 )
121  zs(j,i) = 0.0_dp ! present-day
122  zb(j,i) = 0.0_dp ! sea level
123 #endif
124 
125  else if (maske(j,i) == 3 ) then
126 
127 #if ( MARGIN==1 || ( MARGIN==2 && MARINE_ICE_FORMATION==1 ) )
128  maske(j,i) = 2 ! floating ice cut off
129  zs(j,i) = zl(j,i)
130  zb(j,i) = zl(j,i)
131 #elif ( MARGIN==2 && MARINE_ICE_FORMATION==2 )
132  maske(j,i) = 0 ! floating ice becomes "underwater ice"
133  h_ice = zs(j,i)-zb(j,i) ! ice thickness
134  zs(j,i) = zl(j,i)+h_ice
135  zb(j,i) = zl(j,i)
136 #elif ( MARGIN==3 )
137  h_ice = zs(j,i)-zb(j,i) ! ice thickness
138  zs(j,i) = freeboard_ratio*h_ice ! ensure properly
139  zb(j,i) = zs(j,i)-h_ice ! floating ice
140 #endif
141 
142  end if
143 
144  xi(i) = xi0 + real(i,dp)*dxi
145  eta(j) = eta0 + real(j,dp)*deta
146 
147  call geo_coord(phi(j,i), lambda(j,i), xi(i), eta(j))
148 
149  zm(j,i) = zb(j,i)
150  n_cts(j,i) = -1
151 
152  h_c(j,i) = zs(j,i)-zm(j,i)
153  h_t(j,i) = 0.0_dp
154 
155  dzs_dtau(j,i) = 0.0_dp
156  dzm_dtau(j,i) = 0.0_dp
157  dzb_dtau(j,i) = 0.0_dp
158  dzl_dtau(j,i) = 0.0_dp
159  dh_c_dtau(j,i) = 0.0_dp
160  dh_t_dtau(j,i) = 0.0_dp
161 
162 end do
163 end do
164 
165 !-------- Metric tensor, gradients of the topography --------
166 
167 call metric
168 
169 #if TOPOGRAD==0
170 call topograd_1(dxi, deta, 1)
171 #elif TOPOGRAD==1
172 call topograd_2(dxi, deta, 1)
173 #endif
174 
175  1000 format(a)
176 
177 !-------- Corresponding area of grid points --------
178 
179 do i=0, imax
180 do j=0, jmax
181  area(j,i) = sq_g11_g(j,i)*sq_g22_g(j,i)*dxi*deta
182 end do
183 end do
184 
185 end subroutine topography1
186 !