SICOPOLIS V3.0
 All Classes Files Functions Variables Macros
shift_cts_downward.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : s h i f t _ c t s _ d o w n w a r d
4 !
5 !> @file
6 !!
7 !! Downward shifting of the CTS.
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2009-2013 Ralf Greve
12 !!
13 !! @section License
14 !!
15 !! This file is part of SICOPOLIS.
16 !!
17 !! SICOPOLIS is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! SICOPOLIS is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> Downward shifting of the CTS.
34 !<------------------------------------------------------------------------------
35 subroutine shift_cts_downward(at1, at2_1, at2_2, at3_1, at3_2, &
36  at4_1, at4_2, at5, at6, at7, atr1, am1, am2, alb1, &
37  aw1, aw2, aw3, aw4, aw5, aw7, aw8, aw9, aqtld, &
38  ai1, ai2, ai3, ai4, mean_accum_inv, dzeta_t, &
39  dtime_temp, dtt_2dxi, dtt_2deta, dtime_temp_inv, &
40  i, j)
41 
42 use sico_types
44 
45 implicit none
46 integer(i4b) :: i, j
47 real(dp) :: zm_shift
48 real(dp) :: at1(0:kcmax), at2_1(0:kcmax), at2_2(0:kcmax), &
49  at3_1(0:kcmax), at3_2(0:kcmax), at4_1(0:kcmax), &
50  at4_2(0:kcmax), at5(0:kcmax), at6(0:kcmax), at7, &
51  ai1(0:kcmax), ai2(0:kcmax), ai3, ai4, &
52  atr1, am1, am2, alb1
53 real(dp) :: aw1, aw2, aw3, aw4, aw5, aw7, aw8, aw9, aqtld
54 real(dp) :: mean_accum_inv
55 real(dp) :: dtt_2dxi, dtt_2deta, dtime_temp, dtime_temp_inv, dzeta_t
56 real(dp) :: difftemp_a, difftemp_b, interpol
57 
58 zm_shift = 1.0_dp ! CTS shift in intervals of 1 m
59 
60 !-------- Temperature discrepancy from the computation of the main
61 ! program --------
62 
63 difftemp_a = temp_c_neu(0,j,i)-(-beta*h_c_neu(j,i))
64 if (difftemp_a.ge.0.0_dp) return
65 
66 !-------- Shift CTS downward until it is too low --------
67 
68  10 continue
69 
70  zm_neu(j,i) = zm_neu(j,i) - zm_shift
71 
72 ! ------ Special case: CTS too close to the base
73 
74  if (zm_neu(j,i).le.zb(j,i)) then
75 
76  zm_shift = (zm_neu(j,i)+zm_shift)-(zb(j,i)+0.001_dp)
77  zm_neu(j,i) = zb(j,i)+0.001_dp
78  h_c_neu(j,i) = h_c_neu(j,i)+h_t_neu(j,i)-0.001_dp
79  h_t_neu(j,i) = 0.001_dp
80 ! ! CTS positioned 1 mm above ice base --------
81 
82  dh_t_dtau(j,i) = (zm_neu(j,i)-zm(j,i))*dtime_temp_inv
83  dzm_dtau(j,i) = dzb_dtau(j,i)+dh_t_dtau(j,i)
84  dh_c_dtau(j,i) = dzs_dtau(j,i)-dzm_dtau(j,i)
85 
86  am_perp(j,i) = am_perp_st(j,i) + dzm_dtau(j,i)
87 
88  call calc_temp3(at1, at2_1, at2_2, at3_1, at3_2, &
89  at4_1, at4_2, at5, at6, at7, atr1, &
90  am1, am2, alb1, &
91  aw1, aw2, aw3, aw4, aw5, aw7, aw8, aw9, aqtld, &
92  ai1, ai2, ai3, mean_accum_inv, dzeta_t, &
93  dtime_temp, dtt_2dxi, dtt_2deta, i, j)
94 
95  difftemp_b = difftemp_a
96  difftemp_a = temp_c_neu(0,j,i)-(-beta*h_c_neu(j,i))
97 
98  if (difftemp_a.ge.0.0_dp) then ! CTS remains above the base
99 
100 ! ---- Interpolate the CTS position from the last (_a) and the
101 ! last but one (_b) value, weighed with the temperature
102 ! discrepancies at the CTS --------
103 
104  interpol = difftemp_a/(difftemp_a-difftemp_b)*zm_shift
105 
106  zm_neu(j,i) = zm_neu(j,i) + interpol
107  h_c_neu(j,i) = h_c_neu(j,i) - interpol
108  h_t_neu(j,i) = h_t_neu(j,i) + interpol
109 
110  dh_t_dtau(j,i) = (zm_neu(j,i)-zm(j,i))*dtime_temp_inv
111  dzm_dtau(j,i) = dzb_dtau(j,i)+dh_t_dtau(j,i)
112  dh_c_dtau(j,i) = dzs_dtau(j,i)-dzm_dtau(j,i)
113 
114  am_perp(j,i) = am_perp_st(j,i) + dzm_dtau(j,i)
115 
116  call calc_temp3(at1, at2_1, at2_2, at3_1, at3_2, &
117  at4_1, at4_2, at5, at6, at7, atr1, &
118  am1, am2, alb1, &
119  aw1, aw2, aw3, aw4, aw5, aw7, aw8, aw9, aqtld, &
120  ai1, ai2, ai3, mean_accum_inv, dzeta_t, &
121  dtime_temp, dtt_2dxi, dtt_2deta, i, j)
122 
123  else ! CTS disappears
124 
125  n_cts_neu(j,i) = 0
126  zm_neu(j,i) = zb(j,i)
127  h_c_neu(j,i) = h_c_neu(j,i)+h_t_neu(j,i)
128  h_t_neu(j,i) = 0.0_dp
129 
130  dh_t_dtau(j,i) = (zm_neu(j,i)-zm(j,i))*dtime_temp_inv
131  dzm_dtau(j,i) = dzb_dtau(j,i)+dh_t_dtau(j,i)
132  dh_c_dtau(j,i) = dzs_dtau(j,i)-dzm_dtau(j,i)
133 
134  am_perp(j,i) = am_perp_st(j,i) + dzm_dtau(j,i)
135 
136  call calc_temp2(at1, at2_1, at2_2, at3_1, at3_2, &
137  at4_1, at4_2, at5, at6, at7, atr1, alb1, &
138  ai1, ai2, ai4, mean_accum_inv, &
139  dtime_temp, dtt_2dxi, dtt_2deta, i, j)
140 
141  end if
142 
143  return
144  end if
145 
146 ! ------ End of treatment of special case
147 
148  h_c_neu(j,i) = h_c_neu(j,i) + zm_shift
149  h_t_neu(j,i) = h_t_neu(j,i) - zm_shift
150 
151  dh_t_dtau(j,i) = (zm_neu(j,i)-zm(j,i))*dtime_temp_inv
152  dzm_dtau(j,i) = dzb_dtau(j,i)+dh_t_dtau(j,i)
153  dh_c_dtau(j,i) = dzs_dtau(j,i)-dzm_dtau(j,i)
154 
155  am_perp(j,i) = am_perp_st(j,i) + dzm_dtau(j,i)
156 
157  call calc_temp3(at1, at2_1, at2_2, at3_1, at3_2, &
158  at4_1, at4_2, at5, at6, at7, atr1, &
159  am1, am2, alb1, &
160  aw1, aw2, aw3, aw4, aw5, aw7, aw8, aw9, aqtld, &
161  ai1, ai2, ai3, mean_accum_inv, dzeta_t, &
162  dtime_temp, dtt_2dxi, dtt_2deta, i, j)
163 
164  difftemp_b = difftemp_a
165  difftemp_a = temp_c_neu(0,j,i)-(-beta*h_c_neu(j,i))
166 
167 if (difftemp_a.lt.0.0_dp) go to 10
168 
169 !-------- Interpolate the CTS position from the last (_a) and the
170 ! last but one (_b) value, weighed with the temperature
171 ! discrepancies at the CTS --------
172 
173 interpol = difftemp_a/(difftemp_a-difftemp_b)*zm_shift
174 
175 zm_neu(j,i) = zm_neu(j,i) + interpol
176 h_c_neu(j,i) = h_c_neu(j,i) - interpol
177 h_t_neu(j,i) = h_t_neu(j,i) + interpol
178 
179 dh_t_dtau(j,i) = (zm_neu(j,i)-zm(j,i))*dtime_temp_inv
180 dzm_dtau(j,i) = dzb_dtau(j,i)+dh_t_dtau(j,i)
181 dh_c_dtau(j,i) = dzs_dtau(j,i)-dzm_dtau(j,i)
182 
183 am_perp(j,i) = am_perp_st(j,i) + dzm_dtau(j,i)
184 
185 call calc_temp3(at1, at2_1, at2_2, at3_1, at3_2, &
186  at4_1, at4_2, at5, at6, at7, atr1, &
187  am1, am2, alb1, &
188  aw1, aw2, aw3, aw4, aw5, aw7, aw8, aw9, aqtld, &
189  ai1, ai2, ai3, mean_accum_inv, dzeta_t, &
190  dtime_temp, dtt_2dxi, dtt_2deta, i, j)
191 
192 end subroutine shift_cts_downward
193 !