SICOPOLIS V3.2
 All Classes Files Functions Variables Macros
boundary.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Subroutine : b o u n d a r y
4 !
5 !> @file
6 !!
7 !! Computation of the surface temperature (must be less than 0 deg C!)
8 !! and of the accumulation-ablation function.
9 !!
10 !! @section Copyright
11 !!
12 !! Copyright 2009-2016 Ralf Greve
13 !!
14 !! @section License
15 !!
16 !! This file is part of SICOPOLIS.
17 !!
18 !! SICOPOLIS is free software: you can redistribute it and/or modify
19 !! it under the terms of the GNU General Public License as published by
20 !! the Free Software Foundation, either version 3 of the License, or
21 !! (at your option) any later version.
22 !!
23 !! SICOPOLIS is distributed in the hope that it will be useful,
24 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
25 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 !! GNU General Public License for more details.
27 !!
28 !! You should have received a copy of the GNU General Public License
29 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
30 !<
31 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32 
33 !-------------------------------------------------------------------------------
34 !> Computation of the surface temperature (must be less than 0 deg C!)
35 !! and of the accumulation-ablation function.
36 !<------------------------------------------------------------------------------
37 subroutine boundary(time, dtime, dxi, deta, &
38  delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
39 
40 use sico_types
42 use sico_vars
43 #if (NETCDF > 1)
44 use netcdf
45 use nc_check
46 #endif
47 
48 implicit none
49 
50 real(dp), intent(in) :: time, dtime, dxi, deta
51 
52 real(dp), intent(out) :: delta_ts, glac_index, dzsl_dtau, z_mar
53 real(dp), intent(inout) :: z_sl
54 
55 ! Further return variables
56 ! (defined as global variables in module sico_variables):
57 !
58 ! accum(j,i), evap(j,i), runoff(j,i), as_perp(j,i), temp_s(j,i)
59 
60 integer(i4b) :: i, j, n
61 integer(i4b) :: i_gr, i_kl
62 integer(i4b) :: nrec_temp_precip
63 integer(i4b), save :: nrec_temp_precip_save = -1
64 real(dp) :: z_sl_old
65 real(dp) :: z_sl_min, t1, t2, t3, t4, t5, t6
66 real(dp) :: time_gr, time_kl
67 real(dp) :: z_sle_present, z_sle_help
68 real(dp), dimension(0:JMAX,0:IMAX,0:12) :: precip
69 real(dp), dimension(0:JMAX,0:IMAX) :: &
70  snowfall, rainfall, melt, melt_star
71 real(dp), dimension(0:JMAX,0:IMAX,12) :: temp_mm
72 real(dp), dimension(0:JMAX,0:IMAX) :: temp_ma, temp_ampl
73 real(dp), dimension(0:JMAX,0:IMAX) :: temp_ma_anom, temp_mj_anom, precip_ma_anom
74 real(dp), dimension(0:IMAX,0:JMAX), save :: temp_ma_anom_tra, temp_mj_anom_tra, &
75  precip_ma_anom_tra
76  ! These arrays are transposed with respect
77  ! to the usual SICOPOLIS convention;
78  ! they have i as first and j as second index
79 real(dp), dimension(12) :: temp_mm_help
80 real(dp) :: temp_jja_help
81 real(dp), dimension(0:JMAX,0:IMAX) :: et
82 real(dp) :: theta_ma, c_ma, kappa_ma, gamma_ma, &
83  theta_mj, c_mj, kappa_mj, gamma_mj
84 real(dp) :: sine_factor
85 real(dp) :: gamma_p, zs_thresh, &
86  temp_rain, temp_snow, &
87  inv_delta_temp_rain_snow, coeff(0:5), inv_sqrt2_s_stat, &
88  precip_fact, frac_solid
89 real(dp) :: s_stat, &
90  phi_sep, temp_lt, temp_ht, inv_delta_temp_ht_lt, &
91  beta1_lt, beta1_ht, beta2_lt, beta2_ht, &
92  beta1, beta2, pmax, mu, lambda_lti, temp_lti
93 real(dp), dimension(256) :: pdd_mod_lat, delta_pdd_mod_lat_inv, &
94  pdd_mod_fac_w, pdd_mod_fac_e, pdd_mod_fac
95 real(dp) :: lon_w_e_sep, pdd_mod_fac_interpol
96 logical, dimension(0:JMAX,0:IMAX) :: check_point
97 
98 #if (NETCDF > 1)
99 integer(i4b) :: ncv
100 ! ncv: Variable ID
101 integer(i4b) :: nc3cor(3)
102 ! nc3cor(3): Corner of a 3-d array
103 integer(i4b) :: nc3cnt(3)
104 ! nc3cnt(3): Count of a 3-d array
105 #endif
106 
107 real(dp), parameter :: &
108  inv_twelve = 1.0_dp/12.0_dp, one_third = 1.0_dp/3.0_dp
109 
110 character(len=64), parameter :: thisroutine = 'boundary'
111 
112 !-------- Initialization of intent(out) variables --------
113 
114 z_sl_old = z_sl
115 
116 delta_ts = 0.0_dp
117 glac_index = 0.0_dp
118 z_sl = 0.0_dp
119 dzsl_dtau = 0.0_dp
120 z_mar = 0.0_dp
121 
122 !-------- Surface-temperature deviation from present values --------
123 
124 #if TSURFACE==1
125 delta_ts = delta_ts0
126 ! ! Steady state with prescribed constant
127 ! ! air-temperature deviation
128 #elif TSURFACE==3
129 delta_ts = sine_amplit &
130  *cos(2.0_dp*pi*time/(sine_period*year_sec)) &
131  -sine_amplit
132 ! ! Sinusoidal air-temperature forcing
133 #elif TSURFACE==4
134 
135 ! ------ delta_ts from ice-core record
136 
137 if (time/year_sec < real(grip_time_min,dp)) then
138  delta_ts = griptemp(0)
139 else if (time/year_sec < real(grip_time_max,dp)) then
140 
141  i_kl = floor(((time/year_sec) &
142  -real(grip_time_min,dp))/real(grip_time_stp,dp))
143  i_kl = max(i_kl, 0)
144 
145  i_gr = ceiling(((time/year_sec) &
146  -real(grip_time_min,dp))/real(grip_time_stp,dp))
147  i_gr = min(i_gr, ndata_grip)
148 
149  if (i_kl == i_gr) then
150 
151  delta_ts = griptemp(i_kl)
152 
153  else
154 
155  time_kl = (grip_time_min + i_kl*grip_time_stp) *year_sec
156  time_gr = (grip_time_min + i_gr*grip_time_stp) *year_sec
157 
158  delta_ts = griptemp(i_kl) &
159  +(griptemp(i_gr)-griptemp(i_kl)) &
160  *(time-time_kl)/(time_gr-time_kl)
161  ! linear interpolation of the ice-core data
162 
163  end if
164 
165 else
166  delta_ts = griptemp(ndata_grip)
167 end if
168 
169 delta_ts = delta_ts * grip_temp_fact
170 ! ! modification by constant factor
171 
172 !-------- Glacial index --------
173 
174 #elif TSURFACE==5
175 
176 if (time/year_sec < real(gi_time_min,dp)) then
177  glac_index = glacial_index(0)
178 else if (time/year_sec < real(gi_time_max,dp)) then
179 
180  i_kl = floor(((time/year_sec) &
181  -real(gi_time_min,dp))/real(gi_time_stp,dp))
182  i_kl = max(i_kl, 0)
183 
184  i_gr = ceiling(((time/year_sec) &
185  -real(gi_time_min,dp))/real(gi_time_stp,dp))
186  i_gr = min(i_gr, ndata_gi)
187 
188  if (i_kl == i_gr) then
189 
190  glac_index = glacial_index(i_kl)
191 
192  else
193 
194  time_kl = (gi_time_min + i_kl*gi_time_stp) *year_sec
195  time_gr = (gi_time_min + i_gr*gi_time_stp) *year_sec
196 
197  glac_index = glacial_index(i_kl) &
198  +(glacial_index(i_gr)-glacial_index(i_kl)) &
199  *(time-time_kl)/(time_gr-time_kl)
200  ! linear interpolation of the glacial-index data
201 
202  end if
203 
204 else
205  glac_index = glacial_index(ndata_gi)
206 end if
207 
208 !-------- Reading of surface temperature and precipitation
209 ! directly from data --------
210 
211 #elif ( (TSURFACE==6) && (ACCSURFACE==6) )
212 
213 if (time/year_sec <= temp_precip_time_min) then
214  nrec_temp_precip = 0
215 else if (time/year_sec < temp_precip_time_max) then
216  nrec_temp_precip = nint( ((time/year_sec)-temp_precip_time_min) &
217  / temp_precip_time_stp )
218 else
219  nrec_temp_precip = ndata_temp_precip
220 end if
221 
222 if ( nrec_temp_precip < 0 ) then
223  stop ' boundary: nrec_temp_precip < 0, not allowed!'
224 else if ( nrec_temp_precip > ndata_temp_precip ) then
225  stop ' boundary: nrec_temp_precip > ndata_temp_precip, not allowed!'
226 end if
227 
228 if ( nrec_temp_precip /= nrec_temp_precip_save ) then
229 
230  nc3cor(1) = 1
231  nc3cor(2) = 1
232  nc3cor(3) = nrec_temp_precip + 1
233  nc3cnt(1) = imax + 1
234  nc3cnt(2) = jmax + 1
235  nc3cnt(3) = 1
236 
237  call check( nf90_inq_varid(ncid_temp_precip, 'annualtemp_anom', ncv), &
238  thisroutine )
239  call check( nf90_get_var(ncid_temp_precip, ncv, temp_ma_anom_tra, &
240  start=nc3cor, count=nc3cnt), thisroutine )
241 
242  call check( nf90_inq_varid(ncid_temp_precip, 'julytemp_anom', ncv), &
243  thisroutine )
244  call check( nf90_get_var(ncid_temp_precip, ncv, temp_mj_anom_tra, &
245  start=nc3cor, count=nc3cnt), thisroutine )
246 
247  call check( nf90_inq_varid(ncid_temp_precip, 'precipitation_anom', ncv), &
248  thisroutine )
249  call check( nf90_get_var(ncid_temp_precip, ncv, precip_ma_anom_tra, &
250  start=nc3cor, count=nc3cnt), thisroutine )
251 
252 end if
253 
254 temp_ma_anom = transpose(temp_ma_anom_tra)
255 temp_mj_anom = transpose(temp_mj_anom_tra)
256 precip_ma_anom = transpose(precip_ma_anom_tra) *(1.0e-03_dp/year_sec)*(rho_w/rho)
257  ! mm/a water equiv. -> m/s ice equiv.
258 
259 nrec_temp_precip_save = nrec_temp_precip
260 
261 #endif
262 
263 !-------- Sea level --------
264 
265 #if SEA_LEVEL==1
266 ! ------ constant sea level
267 z_sl = z_sl0
268 
269 #elif SEA_LEVEL==2
270 ! ------ saw-tooth-shaped palaeoclimatic sea-level forcing
271 
272 z_sl_min = -130.0_dp
273 
274 t1 = -250000.0_dp *year_sec
275 t2 = -140000.0_dp *year_sec
276 t3 = -125000.0_dp *year_sec
277 t4 = -21000.0_dp *year_sec
278 t5 = -8000.0_dp *year_sec
279 t6 = 0.0_dp *year_sec
280 
281 if (time < t1) then
282  z_sl = 0.0_dp
283 else if (time < t2) then
284  z_sl = z_sl_min*(time-t1)/(t2-t1)
285 else if (time < t3) then
286  z_sl = -z_sl_min*(time-t3)/(t3-t2)
287 else if (time < t4) then
288  z_sl = z_sl_min*(time-t3)/(t4-t3)
289 else if (time < t5) then
290  z_sl = -z_sl_min*(time-t5)/(t5-t4)
291 else if (time < t6) then
292  z_sl = 0.0_dp
293 else
294  z_sl = 0.0_dp
295 end if
296 
297 #elif SEA_LEVEL==3
298 
299 ! ------ z_sl from the SPECMAP record
300 
301 if (time/year_sec < real(specmap_time_min,dp)) then
302  z_sl = specmap_zsl(0)
303 else if (time/year_sec < real(specmap_time_max,dp)) then
304 
305  i_kl = floor(((time/year_sec) &
306  -real(specmap_time_min,dp))/real(specmap_time_stp,dp))
307  i_kl = max(i_kl, 0)
308 
309  i_gr = ceiling(((time/year_sec) &
310  -real(specmap_time_min,dp))/real(specmap_time_stp,dp))
311  i_gr = min(i_gr, ndata_specmap)
312 
313  if (i_kl == i_gr) then
314 
315  z_sl = specmap_zsl(i_kl)
316 
317  else
318 
319  time_kl = (specmap_time_min + i_kl*specmap_time_stp) *year_sec
320  time_gr = (specmap_time_min + i_gr*specmap_time_stp) *year_sec
321 
322  z_sl = specmap_zsl(i_kl) &
323  +(specmap_zsl(i_gr)-specmap_zsl(i_kl)) &
324  *(time-time_kl)/(time_gr-time_kl)
325  ! linear interpolation of the sea-level data
326 
327  end if
328 
329 else
330  z_sl = specmap_zsl(ndata_specmap)
331 end if
332 
333 #endif
334 
335 ! ------ Time derivative of the sea level
336 
337 if ( z_sl_old > -999999.9_dp ) then
338  dzsl_dtau = (z_sl-z_sl_old)/dtime
339 else ! only dummy value for z_sl_old available
340  dzsl_dtau = 0.0_dp
341 end if
342 
343 ! ------ Minimum bedrock elevation for extent of marine ice
344 
345 #if MARGIN==2
346 
347 #if ( MARINE_ICE_CALVING==2 || MARINE_ICE_CALVING==3 )
348 z_mar = z_mar
349 #elif ( MARINE_ICE_CALVING==4 || MARINE_ICE_CALVING==5 )
350 z_mar = fact_z_mar*z_sl
351 #elif ( MARINE_ICE_CALVING==6 || MARINE_ICE_CALVING==7 )
352 if (z_sl >= -80.0_dp) then
353  z_mar = 2.5_dp*z_sl
354 else
355  z_mar = 10.25_dp*(z_sl+80.0_dp)-200.0_dp
356 end if
357 z_mar = fact_z_mar*z_mar
358 #endif
359 
360 #endif
361 
362 ! ------ Update of the mask according to the sea level
363 
364 ! ---- Check all sea and floating-ice points and their direct
365 ! neighbours
366 
367 do i=0, imax
368 do j=0, jmax
369  check_point(j,i) = .false.
370 end do
371 end do
372 
373 do i=1, imax-1
374 do j=1, jmax-1
375  if (maske(j,i) >= 2) then
376  check_point(j ,i ) = .true.
377  check_point(j ,i+1) = .true.
378  check_point(j ,i-1) = .true.
379  check_point(j+1,i ) = .true.
380  check_point(j-1,i ) = .true.
381  end if
382 end do
383 end do
384 
385 do i=1, imax-1
386 do j=1, jmax-1
387  if (check_point(j,i)) then
388  maske_neu(j,i) = mask_update(z_sl, i, j)
389  end if
390 end do
391 end do
392 
393 ! ---- Assign new values of the mask
394 
395 do i=1, imax-1
396 do j=1, jmax-1
397  if (check_point(j,i)) then
398  maske(j,i) = maske_neu(j,i)
399  end if
400 end do
401 end do
402 
403 !-------- Surface air temperatures --------
404 
405 #if TEMP_PRESENT_PARA == 1 /* Parameterization by Ritz et al. (1997) */
406 
407 theta_ma = 49.13_dp
408 gamma_ma = -7.992e-03_dp
409 c_ma = -0.7576_dp
410 kappa_ma = 0.0_dp
411 
412 theta_mj = 30.38_dp
413 gamma_mj = -6.277e-03_dp
414 c_mj = -0.3262_dp
415 kappa_mj = 0.0_dp
416 
417 #elif TEMP_PRESENT_PARA == 2 /* Parameterization by Fausto et al. (2009) */
418 
419 theta_ma = 41.83_dp
420 gamma_ma = -6.309e-03_dp
421 c_ma = -0.7189_dp
422 kappa_ma = -0.0672_dp
423 
424 theta_mj = 14.70_dp
425 gamma_mj = -5.426e-03_dp
426 c_mj = -0.1585_dp
427 kappa_mj = -0.0518_dp
428 
429 #else
430 
431 stop ' boundary: Parameter TEMP_PRESENT_PARA must be either 1 or 2!'
432 
433 #endif
434 
435 do i=0, imax
436 do j=0, jmax
437 
438 ! ------ Present-day mean-annual air temperature
439 
440  temp_ma_present(j,i) = theta_ma &
441  + gamma_ma*zs(j,i) &
442  + c_ma*phi(j,i)*pi_180_inv &
443  + kappa_ma*(modulo(lambda(j,i)+pi,2.0_dp*pi)-pi)*pi_180_inv
444  ! west longitudes counted negatively
445 
446 ! ------ Present-day mean-July (summer) air temperature
447 
448  temp_mj_present(j,i) = theta_mj &
449  + gamma_mj*zs(j,i) &
450  + c_mj*phi(j,i)*pi_180_inv &
451  + kappa_mj*(modulo(lambda(j,i)+pi,2.0_dp*pi)-pi)*pi_180_inv
452  ! west longitudes counted negatively
453 
454 #if (TSURFACE <= 4)
455 
456 ! ------ Correction with deviation delta_ts
457 
458  temp_ma(j,i) = temp_ma_present(j,i) + delta_ts
459  temp_mm(j,i,7) = temp_mj_present(j,i) + delta_ts
460 
461 #elif (TSURFACE == 5)
462 
463 ! ------ Correction with LGM anomaly and glacial index
464 
465  temp_ma(j,i) = temp_ma_present(j,i) + glac_index*temp_ma_lgm_anom(j,i)
466  temp_mm(j,i,7) = temp_mj_present(j,i) + glac_index*temp_mj_lgm_anom(j,i)
467 
468 #elif (TSURFACE == 6)
469 
470 ! ------ Mean-annual and mean-July (summer) surface temperatures
471 ! from data read above --------
472 
473  temp_ma(j,i) = temp_ma_present(j,i) + temp_ma_anom_fact*temp_ma_anom(j,i)
474  temp_mm(j,i,7) = temp_mj_present(j,i) + temp_mj_anom_fact*temp_mj_anom(j,i)
475 
476 #endif
477 
478 ! ------ Amplitude of the annual cycle
479 
480  temp_ampl(j,i) = temp_mm(j,i,7) - temp_ma(j,i)
481 
482  if (temp_ampl(j,i) < eps) then
483  temp_ampl(j,i) = eps ! Correction of amplitude, if required
484  end if
485 
486 end do
487 end do
488 
489 ! ------ Monthly temperatures
490 
491 do n=1, 12 ! month counter
492 
493  sine_factor = sin((real(n,dp)-4.0_dp)*pi/6.0_dp)
494 
495  do i=0, imax
496  do j=0, jmax
497  temp_mm(j,i,n) = temp_ma(j,i) + sine_factor*temp_ampl(j,i)
498  end do
499  end do
500 
501 end do
502 
503 !-------- Accumulation-ablation function as_perp --------
504 
505 #if (ELEV_DESERT == 1)
506 
507 gamma_p = gamma_p*1.0e-03_dp ! Precipitation lapse rate
508  ! for elevation desertification, in m^(-1)
509 zs_thresh = zs_thresh ! Elevation threshold, in m
510 
511 #endif
512 
513 #if (SOLID_PRECIP == 1) /* Marsiat (1994) */
514 
515 temp_rain = 7.0_dp ! Threshold monthly mean temperature for
516  ! precipitation = 100% rain, in deg C
517 temp_snow = -10.0_dp ! Threshold monthly mean temperature for &
518  ! precipitation = 100% snow, in deg C
519 
520 inv_delta_temp_rain_snow = 1.0_dp/(temp_rain-temp_snow)
521 
522 #elif (SOLID_PRECIP == 2) /* Bales et al. (2009) */
523 
524 temp_rain = 7.2_dp ! Threshold monthly mean temperature for &
525  ! precipitation = 100% rain, in deg C
526 temp_snow = -11.6_dp ! Threshold monthly mean temperature for &
527  ! precipitation = 100% snow, in deg C
528 
529 coeff(0) = 5.4714e-01_dp ! Coefficients
530 coeff(1) = -9.1603e-02_dp ! of
531 coeff(2) = -3.314e-03_dp ! the
532 coeff(3) = 4.66e-04_dp ! fifth-order
533 coeff(4) = 3.8e-05_dp ! polynomial
534 coeff(5) = 6.0e-07_dp ! fit
535 
536 #elif (SOLID_PRECIP == 3) /* Huybrechts and de Wolde (1999) */
537 
538 temp_rain = 2.0_dp ! Threshold instantaneous temperature for &
539  ! precipitation = 100% rain, in deg C
540 temp_snow = temp_rain ! Threshold instantaneous temperature for &
541  ! precipitation = 100% snow, in deg C
542 
543 s_stat = s_stat_0 ! Standard deviation of the air termperature
544  ! (same parameter as in the PDD model)
545 
546 inv_sqrt2_s_stat = 1.0_dp/(sqrt(2.0_dp)*s_stat)
547 
548 #endif
549 
550 #if (ABLSURFACE==1 || ABLSURFACE==2)
551 
552 s_stat = s_stat_0
553 
554 phi_sep = phi_sep_0*pi_180 ! separates different domains for computation of
555  ! degree-day factors beta1 and beta2
556  ! deg N --> rad
557 temp_lt = -1.0_dp
558 temp_ht = 10.0_dp
559 inv_delta_temp_ht_lt = 1.0_dp/(temp_ht-temp_lt)
560 
561 beta1_lt = beta1_lt_0 *(0.001_dp/86400.0_dp)*(rho_w/rho)
562  ! (mm WE)/(d*deg C) --> (m IE)/(s*deg C)
563 beta1_ht = beta1_ht_0 *(0.001_dp/86400.0_dp)*(rho_w/rho)
564  ! (mm WE)/(d*deg C) --> (m IE)/(s*deg C)
565 beta2_lt = beta2_lt_0 *(0.001_dp/86400.0_dp)*(rho_w/rho)
566  ! (mm WE)/(d*deg C) --> (m IE)/(s*deg C)
567 beta2_ht = beta2_ht_0 *(0.001_dp/86400.0_dp)*(rho_w/rho)
568  ! (mm WE)/(d*deg C) --> (m IE)/(s*deg C)
569 pmax = pmax_0
570 mu = mu_0 *(1000.0_dp*86400.0_dp)*(rho/rho_w)
571  ! (d*deg C)/(mm WE) --> (s*deg C)/(m IE)
572 #if (PDD_MODIFIER==2)
573 
574 lon_w_e_sep = lon_w_e_sep *pi_180 ! deg N -> rad
575 
576 if (lon_w_e_sep < 0.0_dp) then
577  lon_w_e_sep = lon_w_e_sep + 2.0_dp*pi
578 else if (lon_w_e_sep >= (2.0_dp*pi)) then
579  lon_w_e_sep = lon_w_e_sep - 2.0_dp*pi
580 end if
581 
582 pdd_mod_lat = 0.0_dp ! initialisation
583 pdd_mod_fac_w = 0.0_dp ! initialisation
584 pdd_mod_fac_e = 0.0_dp ! initialisation
585 
586 pdd_mod_lat( 1) = pdd_mod_lat_01 *pi_180 ! deg N -> rad
587 pdd_mod_fac_w( 1) = pdd_mod_fac_w_01
588 pdd_mod_fac_e( 1) = pdd_mod_fac_e_01
589 pdd_mod_lat( 2) = pdd_mod_lat_02 *pi_180 ! deg N -> rad
590 pdd_mod_fac_w( 2) = pdd_mod_fac_w_02
591 pdd_mod_fac_e( 2) = pdd_mod_fac_e_02
592 pdd_mod_lat( 3) = pdd_mod_lat_03 *pi_180 ! deg N -> rad
593 pdd_mod_fac_w( 3) = pdd_mod_fac_w_03
594 pdd_mod_fac_e( 3) = pdd_mod_fac_e_03
595 pdd_mod_lat( 4) = pdd_mod_lat_04 *pi_180 ! deg N -> rad
596 pdd_mod_fac_w( 4) = pdd_mod_fac_w_04
597 pdd_mod_fac_e( 4) = pdd_mod_fac_e_04
598 pdd_mod_lat( 5) = pdd_mod_lat_05 *pi_180 ! deg N -> rad
599 pdd_mod_fac_w( 5) = pdd_mod_fac_w_05
600 pdd_mod_fac_e( 5) = pdd_mod_fac_e_05
601 pdd_mod_lat( 6) = pdd_mod_lat_06 *pi_180 ! deg N -> rad
602 pdd_mod_fac_w( 6) = pdd_mod_fac_w_06
603 pdd_mod_fac_e( 6) = pdd_mod_fac_e_06
604 pdd_mod_lat( 7) = pdd_mod_lat_07 *pi_180 ! deg N -> rad
605 pdd_mod_fac_w( 7) = pdd_mod_fac_w_07
606 pdd_mod_fac_e( 7) = pdd_mod_fac_e_07
607 pdd_mod_lat( 8) = pdd_mod_lat_08 *pi_180 ! deg N -> rad
608 pdd_mod_fac_w( 8) = pdd_mod_fac_w_08
609 pdd_mod_fac_e( 8) = pdd_mod_fac_e_08
610 pdd_mod_lat( 9) = pdd_mod_lat_09 *pi_180 ! deg N -> rad
611 pdd_mod_fac_w( 9) = pdd_mod_fac_w_09
612 pdd_mod_fac_e( 9) = pdd_mod_fac_e_09
613 pdd_mod_lat( 10) = pdd_mod_lat_10 *pi_180 ! deg N -> rad
614 pdd_mod_fac_w(10) = pdd_mod_fac_w_10
615 pdd_mod_fac_e(10) = pdd_mod_fac_e_10
616 
617 delta_pdd_mod_lat_inv = 0.0_dp ! initialisation
618 
619 do n=1, n_pdd_mod-1
620  delta_pdd_mod_lat_inv(n) = 1.0_dp/(pdd_mod_lat(n+1)-pdd_mod_lat(n))
621 end do
622 
623 #endif
624 
625 #elif (ABLSURFACE==3)
626 
627 lambda_lti = lambda_lti *(0.001_dp/year_sec)*(rho_w/rho)
628  ! (mm WE)/(a*deg C) --> (m IE)/(s*deg C)
629 temp_lti = temp_lti
630 mu = 0.0_dp ! no superimposed ice considered
631 
632 #endif
633 
634 do i=0, imax
635 do j=0, jmax
636 
637 #if (ABLSURFACE==1 || ABLSURFACE==2)
638 
639  if (phi(j,i) <= phi_sep) then
640 
641  beta1 = beta1_ht
642  beta2 = beta2_ht
643 
644  else
645 
646  if (temp_mm(j,i,7) >= temp_ht) then
647  beta1 = beta1_ht
648  beta2 = beta2_ht
649  else if (temp_mm(j,i,7) <= temp_lt) then
650  beta1 = beta1_lt
651  beta2 = beta2_lt
652  else
653  beta1 = beta1_lt &
654  + (beta1_ht-beta1_lt) &
655  *inv_delta_temp_ht_lt*(temp_mm(j,i,7)-temp_lt)
656  beta2 = beta2_ht &
657  + (beta2_lt-beta2_ht) &
658  *(inv_delta_temp_ht_lt*(temp_ht-temp_mm(j,i,7)))**3
659  end if
660 
661  end if
662 
663 #if (PDD_MODIFIER==2)
664 
665  if ( lambda(j,i) <= lon_w_e_sep ) then ! West Greenland
666  pdd_mod_fac = pdd_mod_fac_w
667  else ! lambda(j,i) > lon_w_e_sep, East Greenland
668  pdd_mod_fac = pdd_mod_fac_e
669  end if
670 
671  if (phi(j,i) <= pdd_mod_lat(1)) then
672 
673  beta1 = beta1 * pdd_mod_fac(1)
674  beta2 = beta2 * pdd_mod_fac(1)
675 
676  else if (phi(j,i) >= pdd_mod_lat(n_pdd_mod)) then
677 
678  beta1 = beta1 * pdd_mod_fac(n_pdd_mod)
679  beta2 = beta2 * pdd_mod_fac(n_pdd_mod)
680 
681  else
682 
683  do n=1, n_pdd_mod-1
684 
685  if ( (phi(j,i) >= pdd_mod_lat(n)) &
686  .and. &
687  (phi(j,i) <= pdd_mod_lat(n+1)) ) then
688 
689  pdd_mod_fac_interpol = pdd_mod_fac(n) &
690  + (pdd_mod_fac(n+1)-pdd_mod_fac(n)) &
691  *(phi(j,i)-pdd_mod_lat(n)) &
692  *delta_pdd_mod_lat_inv(n)
693 
694  beta1 = beta1 * pdd_mod_fac_interpol
695  beta2 = beta2 * pdd_mod_fac_interpol
696 
697  exit
698 
699  end if
700 
701  end do
702 
703  end if
704 
705 #endif
706 
707 #endif
708 
709 ! ------ Accumulation
710 
711 #if (ACCSURFACE <= 3)
712 
713 ! ---- Elevation desertification of precipitation
714 
715 #if (ELEV_DESERT == 0)
716 
717  precip_fact = 1.0_dp ! no elevation desertification
718 
719 #elif (ELEV_DESERT == 1)
720 
721  if (zs_ref(j,i) < zs_thresh) then
722  precip_fact &
723  = exp(gamma_p*(max(zs(j,i),zs_thresh)-zs_thresh))
724  else
725  precip_fact &
726  = exp(gamma_p*(max(zs(j,i),zs_thresh)-zs_ref(j,i)))
727  end if
728 
729 #else
730  stop ' boundary: Parameter ELEV_DESERT must be either 0 or 1!'
731 #endif
732 
733  do n=1, 12 ! month counter
734  precip(j,i,n) = precip_present(j,i,n)*precip_fact
735  end do
736 
737 #endif
738 
739 ! ---- Precipitation change related to changing climate
740 
741 #if ACCSURFACE==1
742  precip_fact = accfact
743 #elif ACCSURFACE==2
744  precip_fact = 1.0_dp + gamma_s*delta_ts
745 #elif ACCSURFACE==3
746  precip_fact = exp(gamma_s*delta_ts)
747 #endif
748 
749 #if (ACCSURFACE <= 3)
750 
751  precip(j,i,0) = 0.0_dp ! initialisation value for mean annual precip
752 
753  do n=1, 12 ! month counter
754  precip(j,i,n) = precip(j,i,n)*precip_fact ! monthly precip
755  precip(j,i,0) = precip(j,i,0) + precip(j,i,n)*inv_twelve
756  ! mean annual precip
757  end do
758 
759 #elif (ACCSURFACE == 5)
760 
761  precip(j,i,0) = 0.0_dp ! initialisation value for mean annual precip
762 
763  do n=1, 12 ! month counter
764 
765 #if (PRECIP_ANOM_INTERPOL==1)
766  precip_fact = 1.0_dp-glac_index+glac_index*precip_lgm_anom(j,i,n)
767  ! interpolation with a linear function
768 #elif (PRECIP_ANOM_INTERPOL==2)
769  precip_fact = exp(-glac_index*gamma_precip_lgm_anom(j,i,n))
770  ! interpolation with an exponential function
771 #endif
772 
773  precip(j,i,n) = precip_present(j,i,n)*precip_fact ! monthly precip
774  precip(j,i,0) = precip(j,i,0) + precip(j,i,n)*inv_twelve
775  ! mean annual precip
776  end do
777 
778 #elif (ACCSURFACE == 6)
779 
780 ! -- Mean-annual precipitation from data already read above
781 
782  precip(j,i,0) = precip_ma_present(j,i) + precip_anom_fact*precip_ma_anom(j,i)
783  ! mean annual precip
784 
785  do n=1, 12 ! month counter
786  precip(j,i,n) = precip(j,i,0) ! monthly precip, assumed to be equal
787  ! to the mean annual precip
788  end do
789 
790 #endif
791 
792 ! ---- Annual accumulation, snowfall and rainfall rates
793 
794  accum(j,i) = precip(j,i,0)
795 
796  snowfall(j,i) = 0.0_dp ! initialisation value
797 
798  do n=1, 12 ! month counter
799 
800 #if (SOLID_PRECIP == 1) /* Marsiat (1994) */
801 
802  if (temp_mm(j,i,n) >= temp_rain) then
803  frac_solid = 0.0_dp
804  else if (temp_mm(j,i,n) <= temp_snow) then
805  frac_solid = 1.0_dp
806  else
807  frac_solid = (temp_rain-temp_mm(j,i,n))*inv_delta_temp_rain_snow
808  end if
809 
810 #elif (SOLID_PRECIP == 2) /* Bales et al. (2009) */
811 
812  if (temp_mm(j,i,n) >= temp_rain) then
813  frac_solid = 0.0_dp
814  else if (temp_mm(j,i,n) <= temp_snow) then
815  frac_solid = 1.0_dp
816  else
817  frac_solid = coeff(0) + temp_mm(j,i,n) * ( coeff(1) &
818  + temp_mm(j,i,n) * ( coeff(2) &
819  + temp_mm(j,i,n) * ( coeff(3) &
820  + temp_mm(j,i,n) * ( coeff(4) &
821  + temp_mm(j,i,n) * coeff(5) ) ) ) )
822  ! evaluation of 5th-order polynomial by Horner scheme
823  end if
824 
825 #elif (SOLID_PRECIP == 3) /* Huybrechts and de Wolde (1999) */
826 
827  frac_solid = 1.0_dp &
828  - 0.5_dp*erfcc((temp_rain-temp_mm(j,i,n))*inv_sqrt2_s_stat)
829 
830 #endif
831 
832  snowfall(j,i) = snowfall(j,i) + precip(j,i,n)*frac_solid*inv_twelve
833 
834  end do
835 
836  rainfall(j,i) = precip(j,i,0) - snowfall(j,i)
837 
838  if (snowfall(j,i) < 0.0_dp) snowfall(j,i) = 0.0_dp ! correction of
839  if (rainfall(j,i) < 0.0_dp) rainfall(j,i) = 0.0_dp ! negative values
840 
841 ! ------ Ablation
842 
843 ! ---- Runoff
844 
845 #if (ABLSURFACE==1 || ABLSURFACE==2)
846 
847 ! -- Temperature excess ET
848 
849  do n=1, 12 ! month counter
850  temp_mm_help(n) = temp_mm(j,i,n)
851  end do
852 
853  call pdd(temp_mm_help, s_stat, et(j,i))
854 
855 ! -- Formation rate of superimposed ice (melt_star), melt rate (melt)
856 ! and runoff rate (runoff)
857 
858 #if (ABLSURFACE==1)
859 
860  if ((beta1*et(j,i)) <= (pmax*snowfall(j,i))) then
861  melt_star(j,i) = beta1*et(j,i)
862  melt(j,i) = 0.0_dp
863  runoff(j,i) = melt(j,i)+rainfall(j,i)
864  else
865  melt_star(j,i) = pmax*snowfall(j,i)
866  melt(j,i) = beta2*(et(j,i)-melt_star(j,i)/beta1)
867  runoff(j,i) = melt(j,i)+rainfall(j,i)
868  end if
869 
870 #elif (ABLSURFACE==2)
871 
872  if ( rainfall(j,i) <= (pmax*snowfall(j,i)) ) then
873 
874  if ( (rainfall(j,i)+beta1*et(j,i)) <= (pmax*snowfall(j,i)) ) then
875  melt_star(j,i) = rainfall(j,i)+beta1*et(j,i)
876  melt(j,i) = 0.0_dp
877  runoff(j,i) = melt(j,i)
878  else
879  melt_star(j,i) = pmax*snowfall(j,i)
880  melt(j,i) = beta2 &
881  *(et(j,i)-(melt_star(j,i)-rainfall(j,i))/beta1)
882  runoff(j,i) = melt(j,i)
883  end if
884 
885  else
886 
887  melt_star(j,i) = pmax*snowfall(j,i)
888  melt(j,i) = beta2*et(j,i)
889  runoff(j,i) = melt(j,i) + rainfall(j,i)-pmax*snowfall(j,i)
890 
891  end if
892 
893 #endif
894 
895 #elif (ABLSURFACE==3)
896 
897  temp_jja_help = one_third*(temp_mm(j,i,6)+temp_mm(j,i,7)+temp_mm(j,i,8))
898 
899  melt_star(j,i) = 0.0_dp ! no superimposed ice considered
900  melt(j,i) = lambda_lti*max((temp_jja_help-temp_lti), 0.0_dp)
901  runoff(j,i) = melt(j,i) + rainfall(j,i)
902 
903 #endif
904 
905 ! ---- Evaporation
906 
907  evap(j,i) = 0.0_dp
908 
909 ! ------ Accumulation minus ablation
910 
911  as_perp(j,i) = accum(j,i) - evap(j,i) - runoff(j,i)
912 
913 ! ------ Ice-surface temperature (10-m firn temperature) temp_s,
914 ! including empirical firn-warming correction due to
915 ! refreezing meltwater when superimposed ice is formed
916 
917  if (melt_star(j,i) >= melt(j,i)) then
918  temp_s(j,i) = temp_ma(j,i) &
919  +mu*(melt_star(j,i)-melt(j,i))
920  else
921  temp_s(j,i) = temp_ma(j,i)
922  end if
923 
924  if (temp_s(j,i) > -0.001_dp) temp_s(j,i) = -0.001_dp
925  ! Cut-off of positive air temperatures
926 
927 end do
928 end do
929 
930 end subroutine boundary
931 !
NetCDF error capturing.
Definition: nc_check.F90:35
integer(i2b) function mask_update(z_sl, i, j)
Update of the topography mask due to changes of the sea level.
Definition: mask_update.F90:35
Declarations of kind types for SICOPOLIS.
Definition: sico_types.F90:35
subroutine pdd(temp_mm, s_stat, ET)
Computation of the positive degree days (PDD) with statistical temperature fluctuations; based on sem...
Definition: pdd.F90:41
subroutine check(status, ch_calling_routine)
NetCDF error capturing.
Definition: nc_check.F90:45
real(dp) function erfcc(x)
Computation of the complementary error function erfc(x) = 1-erf(x) with a fractional error everywhere...
Definition: erfcc.F90:39
Declarations of global variables for SICOPOLIS (for the ANT domain).
Definition: sico_vars.F90:35
subroutine boundary(time, dtime, dxi, deta, delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
Computation of the surface temperature (must be less than 0 deg C!) and of the accumulation-ablation ...
Definition: boundary.F90:37
Declarations of global variables for SICOPOLIS.