38 delta_ts, glac_index, z_sl, dzsl_dtau, z_mar)
49 real(dp),
intent(in) :: time, dtime, dxi, deta
51 real(dp),
intent(out) :: delta_ts, glac_index, dzsl_dtau, z_mar
52 real(dp),
intent(inout) :: z_sl
59 integer(i4b) :: i, j, n
60 integer(i4b) :: i_gr, i_kl
61 integer(i4b) :: nrec_temp_precip
62 integer(i4b),
save :: nrec_temp_precip_save = -1
64 real(dp) :: z_sl_min, t1, t2, t3, t4, t5, t6
65 real(dp) :: time_gr, time_kl
66 real(dp) :: z_sle_present, z_sle_help
67 real(dp),
dimension(0:JMAX,0:IMAX,0:12) :: precip
68 real(dp),
dimension(0:JMAX,0:IMAX) :: &
69 snowfall, rainfall, melt, melt_star
70 real(dp),
dimension(0:JMAX,0:IMAX,12) :: temp_mm
71 real(dp),
dimension(0:JMAX,0:IMAX) :: temp_ma, temp_ampl
72 real(dp),
dimension(0:JMAX,0:IMAX) :: temp_ma_anom, temp_mj_anom, precip_ma_anom
73 real(dp),
dimension(0:IMAX,0:JMAX),
save :: temp_ma_anom_tra, temp_mj_anom_tra, &
78 real(dp),
dimension(12) :: temp_mm_help
79 real(dp) :: temp_jja_help
80 real(dp),
dimension(0:JMAX,0:IMAX) :: et
81 real(dp) :: theta_ma, c_ma, gamma_ma, &
82 theta_ma_1, c_ma_1, gamma_ma_1, &
83 theta_ma_2, c_ma_2, gamma_ma_2, &
84 theta_ma_3, c_ma_3, gamma_ma_3, &
86 theta_mj, c_mj, gamma_mj
87 real(dp) :: sine_factor
88 real(dp) :: gamma_p, zs_thresh, &
89 alpha_p, beta_p, temp_0, alpha_t, beta_t, &
90 temp_inv, temp_inv_present, &
91 temp_rain, temp_snow, &
92 inv_delta_temp_rain_snow, coeff(0:5), inv_sqrt2_s_stat, &
93 precip_fact, frac_solid
94 real(dp) :: s_stat, beta1, beta2, pmax, mu, lambda_lti, temp_lti
95 logical,
dimension(0:JMAX,0:IMAX) :: check_point
100 integer(i4b) :: nc3cor(3)
102 integer(i4b) :: nc3cnt(3)
106 real(dp),
parameter :: &
107 inv_twelve = 1.0_dp/12.0_dp, one_third = 1.0_dp/3.0_dp
109 character(len=64),
parameter :: thisroutine =
'boundary'
128 delta_ts = sine_amplit &
129 *cos(2.0_dp*pi*time/(sine_period*year_sec)) &
136 if (time/year_sec <
real(grip_time_min,dp)) then
137 delta_ts = griptemp(0)
138 else if (time/year_sec <
real(grip_time_max,dp)) then
140 i_kl = floor(((time/year_sec) &
141 -
real(grip_time_min,dp))/
real(grip_time_stp,dp))
144 i_gr = ceiling(((time/year_sec) &
145 -
real(grip_time_min,dp))/
real(grip_time_stp,dp))
146 i_gr = min(i_gr, ndata_grip)
148 if (i_kl == i_gr)
then
150 delta_ts = griptemp(i_kl)
154 time_kl = (grip_time_min + i_kl*grip_time_stp) *year_sec
155 time_gr = (grip_time_min + i_gr*grip_time_stp) *year_sec
157 delta_ts = griptemp(i_kl) &
158 +(griptemp(i_gr)-griptemp(i_kl)) &
159 *(time-time_kl)/(time_gr-time_kl)
165 delta_ts = griptemp(ndata_grip)
168 delta_ts = delta_ts * grip_temp_fact
175 if (time/year_sec <
real(gi_time_min,dp)) then
176 glac_index = glacial_index(0)
177 else if (time/year_sec <
real(gi_time_max,dp)) then
179 i_kl = floor(((time/year_sec) &
180 -
real(gi_time_min,dp))/
real(gi_time_stp,dp))
183 i_gr = ceiling(((time/year_sec) &
184 -
real(gi_time_min,dp))/
real(gi_time_stp,dp))
185 i_gr = min(i_gr, ndata_gi)
187 if (i_kl == i_gr)
then
189 glac_index = glacial_index(i_kl)
193 time_kl = (gi_time_min + i_kl*gi_time_stp) *year_sec
194 time_gr = (gi_time_min + i_gr*gi_time_stp) *year_sec
196 glac_index = glacial_index(i_kl) &
197 +(glacial_index(i_gr)-glacial_index(i_kl)) &
198 *(time-time_kl)/(time_gr-time_kl)
204 glac_index = glacial_index(ndata_gi)
210 #elif ( (TSURFACE==6) && (ACCSURFACE==6) )
212 if (time/year_sec <= temp_precip_time_min)
then
214 else if (time/year_sec < temp_precip_time_max)
then
215 nrec_temp_precip = nint( ((time/year_sec)-temp_precip_time_min) &
216 / temp_precip_time_stp )
218 nrec_temp_precip = ndata_temp_precip
221 if ( nrec_temp_precip < 0 )
then
222 stop
' boundary: nrec_temp_precip < 0, not allowed!'
223 else if ( nrec_temp_precip > ndata_temp_precip )
then
224 stop
' boundary: nrec_temp_precip > ndata_temp_precip, not allowed!'
227 if ( nrec_temp_precip /= nrec_temp_precip_save )
then
231 nc3cor(3) = nrec_temp_precip + 1
236 call
check( nf90_inq_varid(ncid_temp_precip,
'annualtemp_anom', ncv), &
238 call
check( nf90_get_var(ncid_temp_precip, ncv, temp_ma_anom_tra, &
239 start=nc3cor, count=nc3cnt), thisroutine )
241 call
check( nf90_inq_varid(ncid_temp_precip,
'januarytemp_anom', ncv), &
243 call
check( nf90_get_var(ncid_temp_precip, ncv, temp_mj_anom_tra, &
244 start=nc3cor, count=nc3cnt), thisroutine )
246 call
check( nf90_inq_varid(ncid_temp_precip,
'precipitation_anom', ncv), &
248 call
check( nf90_get_var(ncid_temp_precip, ncv, precip_ma_anom_tra, &
249 start=nc3cor, count=nc3cnt), thisroutine )
253 temp_ma_anom = transpose(temp_ma_anom_tra)
254 temp_mj_anom = transpose(temp_mj_anom_tra)
255 precip_ma_anom = transpose(precip_ma_anom_tra) *(1.0e-03_dp/year_sec)*(rho_w/rho)
258 nrec_temp_precip_save = nrec_temp_precip
273 t1 = -250000.0_dp *year_sec
274 t2 = -140000.0_dp *year_sec
275 t3 = -125000.0_dp *year_sec
276 t4 = -21000.0_dp *year_sec
277 t5 = -8000.0_dp *year_sec
278 t6 = 0.0_dp *year_sec
282 else if (time < t2)
then
283 z_sl = z_sl_min*(time-t1)/(t2-t1)
284 else if (time < t3)
then
285 z_sl = -z_sl_min*(time-t3)/(t3-t2)
286 else if (time < t4)
then
287 z_sl = z_sl_min*(time-t3)/(t4-t3)
288 else if (time < t5)
then
289 z_sl = -z_sl_min*(time-t5)/(t5-t4)
290 else if (time < t6)
then
300 if (time/year_sec <
real(specmap_time_min,dp)) then
301 z_sl = specmap_zsl(0)
302 else if (time/year_sec <
real(specmap_time_max,dp)) then
304 i_kl = floor(((time/year_sec) &
305 -
real(specmap_time_min,dp))/
real(specmap_time_stp,dp))
308 i_gr = ceiling(((time/year_sec) &
309 -
real(specmap_time_min,dp))/
real(specmap_time_stp,dp))
310 i_gr = min(i_gr, ndata_specmap)
312 if (i_kl == i_gr)
then
314 z_sl = specmap_zsl(i_kl)
318 time_kl = (specmap_time_min + i_kl*specmap_time_stp) *year_sec
319 time_gr = (specmap_time_min + i_gr*specmap_time_stp) *year_sec
321 z_sl = specmap_zsl(i_kl) &
322 +(specmap_zsl(i_gr)-specmap_zsl(i_kl)) &
323 *(time-time_kl)/(time_gr-time_kl)
329 z_sl = specmap_zsl(ndata_specmap)
336 if ( z_sl_old > -999999.9_dp )
then
337 dzsl_dtau = (z_sl-z_sl_old)/dtime
346 #if ( MARINE_ICE_CALVING==2 || MARINE_ICE_CALVING==3 )
348 #elif ( MARINE_ICE_CALVING==4 || MARINE_ICE_CALVING==5 )
349 z_mar = fact_z_mar*z_sl
350 #elif ( MARINE_ICE_CALVING==6 || MARINE_ICE_CALVING==7 )
351 if (z_sl >= -80.0_dp)
then
354 z_mar = 10.25_dp*(z_sl+80.0_dp)-200.0_dp
356 z_mar = fact_z_mar*z_mar
368 check_point(j,i) = .false.
374 if (maske(j,i) >= 2)
then
375 check_point(j ,i ) = .true.
376 check_point(j ,i+1) = .true.
377 check_point(j ,i-1) = .true.
378 check_point(j+1,i ) = .true.
379 check_point(j-1,i ) = .true.
386 if (check_point(j,i))
then
396 if (check_point(j,i))
then
397 maske(j,i) = maske_neu(j,i)
404 #if TEMP_PRESENT_PARA == 1 /* Parameterisation by Fortuin and Oerlemans */
408 gamma_ma = -9.14e-03_dp
412 gamma_mj = -6.92e-03_dp
415 #elif TEMP_PRESENT_PARA == 2 /* Parameterisation by Fortuin and Oerlemans */
422 theta_ma_1 = 49.642_dp
426 theta_ma_2 = 36.689_dp
427 gamma_ma_2 = -5.102e-03_dp
430 theta_ma_3 = 7.405_dp
431 gamma_ma_3 = -14.285e-03_dp
435 gamma_mj = -6.92e-03_dp
440 stop
' boundary: Parameter TEMP_PRESENT_PARA must be either 1 or 2!'
449 #if TEMP_PRESENT_PARA == 1
450 temp_ma_present(j,i) = theta_ma + gamma_ma*zs(j,i) &
451 + c_ma*abs(phi(j,i))*pi_180_inv
452 #elif TEMP_PRESENT_PARA == 2
453 if ( zs(j,i) <= zs_sep_1 )
then
454 temp_ma_present(j,i) = theta_ma_1 + gamma_ma_1*zs(j,i) &
455 + c_ma_1*abs(phi(j,i))*pi_180_inv
456 else if ( zs(j,i) <= zs_sep_2 )
then
457 temp_ma_present(j,i) = theta_ma_2 + gamma_ma_2*zs(j,i) &
458 + c_ma_2*abs(phi(j,i))*pi_180_inv
460 temp_ma_present(j,i) = theta_ma_3 + gamma_ma_3*zs(j,i) &
461 + c_ma_3*abs(phi(j,i))*pi_180_inv
467 temp_mj_present(j,i) = theta_mj + gamma_mj*zs(j,i) &
468 + c_mj*abs(phi(j,i))*pi_180_inv
474 temp_ma(j,i) = temp_ma_present(j,i) + delta_ts
475 temp_mm(j,i,7) = temp_mj_present(j,i) + delta_ts
477 #elif (TSURFACE == 5)
481 temp_ma(j,i) = temp_ma_present(j,i) + glac_index*temp_ma_lgm_anom(j,i)
482 temp_mm(j,i,7) = temp_mj_present(j,i) + glac_index*temp_mj_lgm_anom(j,i)
484 #elif (TSURFACE == 6)
489 temp_ma(j,i) = temp_ma_present(j,i) + temp_ma_anom_fact*temp_ma_anom(j,i)
490 temp_mm(j,i,7) = temp_mj_present(j,i) + temp_mj_anom_fact*temp_mj_anom(j,i)
496 temp_ampl(j,i) = temp_mm(j,i,7) - temp_ma(j,i)
498 if (temp_ampl(j,i) < eps)
then
509 sine_factor = sin((
real(n,dp)-4.0_dp)*pi/6.0_dp)
513 temp_mm(j,i,n) = temp_ma(j,i) + sine_factor*temp_ampl(j,i)
521 #if (ACCSURFACE <= 3)
523 #if (ELEV_DESERT == 1)
525 gamma_p = gamma_p*1.0e-03_dp
527 zs_thresh = zs_thresh
531 #elif (ACCSURFACE == 4)
541 #if (SOLID_PRECIP == 1) /* Marsiat (1994) */
548 inv_delta_temp_rain_snow = 1.0_dp/(temp_rain-temp_snow)
550 #elif (SOLID_PRECIP == 2) /* Bales et al. (2009) */
557 coeff(0) = 5.4714e-01_dp
558 coeff(1) = -9.1603e-02_dp
559 coeff(2) = -3.314e-03_dp
560 coeff(3) = 4.66e-04_dp
561 coeff(4) = 3.8e-05_dp
562 coeff(5) = 6.0e-07_dp
564 #elif (SOLID_PRECIP == 3) /* Huybrechts and de Wolde (1999) */
568 temp_snow = temp_rain
574 inv_sqrt2_s_stat = 1.0_dp/(sqrt(2.0_dp)*s_stat)
578 #if (ABLSURFACE==1 || ABLSURFACE==2)
581 beta1 = beta1_0 *(0.001_dp/86400.0_dp)*(rho_w/rho)
583 beta2 = beta2_0 *(0.001_dp/86400.0_dp)*(rho_w/rho)
586 mu = mu_0 *(1000.0_dp*86400.0_dp)*(rho/rho_w)
589 #elif (ABLSURFACE==3)
591 lambda_lti = lambda_lti *(0.001_dp/year_sec)*(rho_w/rho)
603 #if (ACCSURFACE <= 3)
607 #if (ELEV_DESERT == 0)
611 #elif (ELEV_DESERT == 1)
613 if (zs_ref(j,i) < zs_thresh)
then
615 = exp(gamma_p*(max(zs(j,i),zs_thresh)-zs_thresh))
618 = exp(gamma_p*(max(zs(j,i),zs_thresh)-zs_ref(j,i)))
622 stop
' boundary: Parameter ELEV_DESERT must be either 0 or 1!'
626 precip(j,i,n) = precip_present(j,i,n)*precip_fact
634 precip_fact = accfact
636 precip_fact = 1.0_dp + gamma_s*delta_ts
638 precip_fact = exp(gamma_s*delta_ts)
641 #if (ACCSURFACE <= 3)
643 precip(j,i,0) = 0.0_dp
646 precip(j,i,n) = precip(j,i,n)*precip_fact
647 precip(j,i,0) = precip(j,i,0) + precip(j,i,n)*inv_twelve
651 #elif (ACCSURFACE == 4)
653 precip(j,i,0) = 0.0_dp
655 temp_inv = alpha_t * (temp_ma(j,i)+temp_0) + beta_t
656 temp_inv_present = alpha_t * (temp_ma_present(j,i)+temp_0) + beta_t
658 precip_fact = exp(alpha_p*(temp_0/temp_inv_present-temp_0/temp_inv)) &
659 *(temp_inv_present/temp_inv)**2 &
660 *(1.0_dp+beta_p*(temp_inv-temp_inv_present))
663 precip(j,i,n) = precip_present(j,i,n)*precip_fact
664 precip(j,i,0) = precip(j,i,0) + precip(j,i,n)*inv_twelve
668 #elif (ACCSURFACE == 5)
670 precip(j,i,0) = 0.0_dp
674 #if (PRECIP_ANOM_INTERPOL==1)
675 precip_fact = 1.0_dp-glac_index+glac_index*precip_lgm_anom(j,i,n)
677 #elif (PRECIP_ANOM_INTERPOL==2)
678 precip_fact = exp(-glac_index*gamma_precip_lgm_anom(j,i,n))
682 precip(j,i,n) = precip_present(j,i,n)*precip_fact
683 precip(j,i,0) = precip(j,i,0) + precip(j,i,n)*inv_twelve
687 #elif (ACCSURFACE == 6)
691 precip(j,i,0) = precip_ma_present(j,i) + precip_anom_fact*precip_ma_anom(j,i)
695 precip(j,i,n) = precip(j,i,0)
703 accum(j,i) = precip(j,i,0)
705 snowfall(j,i) = 0.0_dp
709 #if (SOLID_PRECIP == 1) /* Marsiat (1994) */
711 if (temp_mm(j,i,n) >= temp_rain)
then
713 else if (temp_mm(j,i,n) <= temp_snow)
then
716 frac_solid = (temp_rain-temp_mm(j,i,n))*inv_delta_temp_rain_snow
719 #elif (SOLID_PRECIP == 2) /* Bales et al. (2009) */
721 if (temp_mm(j,i,n) >= temp_rain)
then
723 else if (temp_mm(j,i,n) <= temp_snow)
then
726 frac_solid = coeff(0) + temp_mm(j,i,n) * ( coeff(1) &
727 + temp_mm(j,i,n) * ( coeff(2) &
728 + temp_mm(j,i,n) * ( coeff(3) &
729 + temp_mm(j,i,n) * ( coeff(4) &
730 + temp_mm(j,i,n) * coeff(5) ) ) ) )
734 #elif (SOLID_PRECIP == 3) /* Huybrechts and de Wolde (1999) */
736 frac_solid = 1.0_dp &
737 - 0.5_dp*
erfcc((temp_rain-temp_mm(j,i,n))*inv_sqrt2_s_stat)
741 snowfall(j,i) = snowfall(j,i) + precip(j,i,n)*frac_solid*inv_twelve
745 rainfall(j,i) = precip(j,i,0) - snowfall(j,i)
747 if (snowfall(j,i) < 0.0_dp) snowfall(j,i) = 0.0_dp
748 if (rainfall(j,i) < 0.0_dp) rainfall(j,i) = 0.0_dp
754 #if (ABLSURFACE==1 || ABLSURFACE==2)
759 temp_mm_help(n) = temp_mm(j,i,n)
762 call
pdd(temp_mm_help, s_stat, et(j,i))
769 if ((beta1*et(j,i)) <= (pmax*snowfall(j,i)))
then
770 melt_star(j,i) = beta1*et(j,i)
772 runoff(j,i) = melt(j,i)+rainfall(j,i)
774 melt_star(j,i) = pmax*snowfall(j,i)
775 melt(j,i) = beta2*(et(j,i)-melt_star(j,i)/beta1)
776 runoff(j,i) = melt(j,i)+rainfall(j,i)
779 #elif (ABLSURFACE==2)
781 if ( rainfall(j,i) <= (pmax*snowfall(j,i)) )
then
783 if ( (rainfall(j,i)+beta1*et(j,i)) <= (pmax*snowfall(j,i)) )
then
784 melt_star(j,i) = rainfall(j,i)+beta1*et(j,i)
786 runoff(j,i) = melt(j,i)
788 melt_star(j,i) = pmax*snowfall(j,i)
790 *(et(j,i)-(melt_star(j,i)-rainfall(j,i))/beta1)
791 runoff(j,i) = melt(j,i)
796 melt_star(j,i) = pmax*snowfall(j,i)
797 melt(j,i) = beta2*et(j,i)
798 runoff(j,i) = melt(j,i) + rainfall(j,i)-pmax*snowfall(j,i)
804 #elif (ABLSURFACE==3)
806 temp_jja_help = one_third*(temp_mm(j,i,6)+temp_mm(j,i,7)+temp_mm(j,i,8))
808 melt_star(j,i) = 0.0_dp
809 melt(j,i) = lambda_lti*max((temp_jja_help-temp_lti), 0.0_dp)
810 runoff(j,i) = melt(j,i) + rainfall(j,i)
820 as_perp(j,i) = accum(j,i) - evap(j,i) - runoff(j,i)
826 if (melt_star(j,i) >= melt(j,i))
then
827 temp_s(j,i) = temp_ma(j,i) &
828 +mu*(melt_star(j,i)-melt(j,i))
830 temp_s(j,i) = temp_ma(j,i)
833 if (temp_s(j,i) > -0.001_dp) temp_s(j,i) = -0.001_dp