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