98 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi,ncat), &
102 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi,ncat), &
108 integer (kind=int_kind) :: &
124 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi,0:ncat) :: &
127 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi) :: &
131 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi,ncat) :: &
138 real (kind=
dbl_kind),
dimension(imt_local, jmt_local) :: &
139 vice_init, vice_final &
140 , vsno_init, vsno_final &
141 , eice_init, eice_final &
142 , esno_init, esno_final
146 integer (kind=int_kind),
dimension(ilo:ihi,jlo:jhi,ncat) :: &
149 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi,ncat) :: &
153 logical (kind=log_kind),
dimension(ilo:ihi,jlo:jhi) :: &
156 character (len=char_len) :: &
159 logical (kind=log_kind),
parameter :: &
160 l_conservation_check = .true.
163 integer (kind=int_kind) :: &
167 integer (kind=int_kind),
dimension (1:(ihi-ilo+1)*(jhi-jlo+1)) :: &
171 logical (kind=log_kind) :: &
184 if (l_conservation_check)
then 200 dhicen(i,j,ni) = hicen(i,j,ni) - hicen_old(i,j,ni)
224 remap_flag(i,j) = .true.
229 remap_flag(i,j) = .false.
251 if (hicen_old(i,j,ni) >
puny .and. &
252 hicen_old(i,j,ni+1) >
puny)
then 254 slope = (dhicen(i,j,ni+1)-dhicen(i,j,ni)) / &
257 (hicen_old(i,j,ni+1)-hicen_old(i,j,ni)+epsilon(eps))
258 hbnew(i,j,ni) =
hin_max(ni) + dhicen(i,j,ni) &
259 + slope * (
hin_max(ni) - hicen_old(i,j,ni))
260 elseif (hicen_old(i,j,ni) >
puny)
then 261 hbnew(i,j,ni) =
hin_max(ni) + dhicen(i,j,ni)
262 elseif (hicen_old(i,j,ni+1) >
puny)
then 263 hbnew(i,j,ni) =
hin_max(ni) + dhicen(i,j,ni+1)
274 flag_changed = .false.
280 hicen(i,j,ni) >= hbnew(i,j,ni))
then 281 remap_flag(i,j) = .false.
282 flag_changed = .true.
284 hicen(i,j,ni+1) <= hbnew(i,j,ni))
then 285 remap_flag(i,j) = .false.
286 flag_changed = .true.
296 if (hbnew(i,j,ni) >
hin_max(ni+1))
then 297 remap_flag(i,j) = .false.
298 flag_changed = .true.
301 if (hbnew(i,j,ni) <
hin_max(ni-1))
then 302 remap_flag(i,j) = .false.
303 flag_changed = .true.
312 if (flag_changed)
then 319 hicen(i,j,ni) >= hbnew(i,j,ni))
then 320 write(nu_diag,*)
'istep1 = ',
istep1 321 write(nu_diag,*)
my_task,
':',i,j, &
322 'ITD: hicen(ni) > Hbnew(ni)' 323 write(nu_diag,*)
'cat ',ni
324 write(nu_diag,*)
my_task,
':',i,j, &
325 'hicen(ni) =', hicen(i,j,ni)
326 write(nu_diag,*)
my_task,
':',i,j, &
327 'Hbnew(ni) =', hbnew(i,j,ni)
329 hicen(i,j,ni+1) <= hbnew(i,j,ni))
then 330 write(nu_diag,*)
'istep1 = ',
istep1 331 write(nu_diag,*)
my_task,
':',i,j, &
332 'ITD: hicen(ni+1) < Hbnew(ni)' 333 write(nu_diag,*)
'cat ',ni
334 write(nu_diag,*)
my_task,
':',i,j, &
335 'hicen(ni+1) =', hicen(i,j,ni+1)
336 write(nu_diag,*)
my_task,
':',i,j, &
337 'Hbnew(ni) =', hbnew(i,j,ni)
340 if (hbnew(i,j,ni) >
hin_max(ni+1))
then 341 write(nu_diag,*)
'istep1 = ',
istep1 342 write(nu_diag,*)
my_task,
':',i,j, &
343 'ITD Hbnew(ni) > hin_max(ni+1)' 344 write(nu_diag,*)
'cat ',ni
345 write(nu_diag,*)
my_task,
':',i,j, &
346 'Hbnew(ni) =', hbnew(i,j,ni)
347 write(nu_diag,*)
my_task,
':',i,j, &
348 'hin_max(ni+1) =',
hin_max(ni+1)
351 if (hbnew(i,j,ni) <
hin_max(ni-1))
then 352 write(nu_diag,*)
'istep1 = ',
istep1 353 write(nu_diag,*)
my_task,
':',i,j, &
354 'ITD: Hbnew(ni) < hin_max(ni-1)' 355 write(nu_diag,*)
'cat ',ni
356 write(nu_diag,*)
my_task,
':',i,j, &
357 'Hbnew(ni) =', hbnew(i,j,ni)
358 write(nu_diag,*)
my_task,
':',i,j, &
359 'hin_max(ni-1) =',
hin_max(ni-1)
374 if (remap_flag(i,j))
then 410 call fit_line(1, hb0, hb1, hicen_old(:,:,1), &
411 g0(:,:,1), g1(:,:,1), hl(:,:,1), hr(:,:,1), &
437 etamax = min(dh0,hr(i,j,1)) - hl(i,j,1)
439 if (etamax >
c0i)
then 441 x2 =
p5 * etamax*etamax
442 da0 = g1(i,j,1)*x2 + g0(i,j,1)*x1
445 damax =
aicen(i,j,1) &
446 * (
c1i-hicen(i,j,1)/hicen_old(i,j,1))
447 da0 = min(da0, damax)
450 hicen(i,j,1) = hicen(i,j,1) &
453 *
aicen(i,j,1) / (
aicen(i,j,1)-da0+epsilon(eps))
458 hbnew(i,j,0) = min(dh0,
hin_max(1))
469 call fit_line(ni, hbnew(:,:,ni-1), hbnew(:,:,ni), hicen(:,:,ni),&
470 g0(:,:,ni), g1(:,:,ni), hl(:,:,ni), hr(:,:,ni),&
490 if (hbnew(i,j,ni) >
hin_max(ni))
then 493 etamin = max(
hin_max(ni), hl(i,j,ni)) - hl(i,j,ni)
494 etamax = min(hbnew(i,j,ni), hr(i,j,ni)) - hl(i,j,ni)
501 etamax = min(
hin_max(ni), hr(i,j,ni+1)) - hl(i,j,ni+1)
506 if (etamax > etamin)
then 510 x2 =
p5 * (wk2 - wk1)
513 x3 =
p333 * (wk2 - wk1)
515 daice(i,j,ni) = g1(i,j,nd)*x2 + g0(i,j,nd)*x1
516 if (daice(i,j,ni) >
c0i)
then 517 dvice(i,j,ni) = g1(i,j,nd)*x3 + g0(i,j,nd)*x2 &
518 + daice(i,j,ni)*hl(i,j,nd)
534 if (daice(i,j,ni) <
aicen(i,j,nd)*
puny)
then 540 if (dvice(i,j,ni) <
vicen(i,j,nd)*
puny)
then 550 daice(i,j,ni) =
aicen(i,j,nd)
551 dvice(i,j,ni) =
vicen(i,j,nd)
555 daice(i,j,ni) =
aicen(i,j,nd)
556 dvice(i,j,ni) =
vicen(i,j,nd)
574 call shift_ice (donor, daice, dvice, hicen)
602 if (l_conservation_check)
then 605 fieldid =
'vice, ITD remap' 610 fieldid =
'vsno, ITD remap' 615 fieldid =
'eice, ITD remap' 620 fieldid =
'esno, ITD remap' 635 subroutine fit_line (ni, HbL, HbR, hice, &
636 g0, g1, hL, hR, remap_flag)
654 integer (kind=int_kind),
intent(in) :: ni
656 real (kind=
dbl_kind),
dimension (ilo:ihi,jlo:jhi), &
660 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi),
intent(in) :: &
663 real (kind=
dbl_kind),
dimension(ilo:ihi,jlo:jhi),
intent(out) :: &
668 logical (kind=log_kind),
dimension (ilo:ihi,jlo:jhi), &
674 integer (kind=int_kind) :: &
691 if (remap_flag(i,j) .and.
aicen(i,j,ni) >
puny &
692 .and. hbr(i,j) - hbl(i,j) >
puny)
then 701 h13 =
p333 * (
c2i*hl(i,j) + hr(i,j))
702 h23 =
p333 * (hl(i,j) +
c2i*hr(i,j))
703 if (hice(i,j) < h13)
then 704 hr(i,j) =
c3i*hice(i,j) -
c2i*hl(i,j)
705 elseif (hice(i,j) > h23)
then 706 hl(i,j) =
c3i*hice(i,j) -
c2i*hr(i,j)
713 dhr =
c1i / (hr(i,j) - hl(i,j)+epsilon(eps))
716 wk2 = (hice(i,j) - hl(i,j)) * dhr
717 g0(i,j) = wk1 * (
p666 - wk2)
718 g1(i,j) =
c2i*dhr * wk1 * (wk2 -
p5)
subroutine column_sum(nsum, xin, xout)
real(kind=dbl_kind), dimension(:,:,:), allocatable, target, save esnon
integer, parameter dbl_kind
integer(kind=int_kind) ihi
real(kind=dbl_kind), parameter c0i
real(kind=dbl_kind), parameter c3i
real(kind=dbl_kind), parameter rhos
subroutine linear_itd(hicen_old, hicen)
real(kind=dbl_kind), parameter lfresh
subroutine column_conservation_check(x1, x2, max_err, fieldid)
real(kind=dbl_kind), parameter hi_min
real(kind=dbl_kind), parameter c6i
integer(kind=int_kind) jlo
integer(kind=int_kind) ilo
real(kind=dbl_kind), parameter p5
real(kind=dbl_kind), parameter puny
integer(kind=int_kind) jhi
real(kind=dbl_kind), dimension(:,:,:), allocatable, target, save vicen
real(kind=dbl_kind), dimension(:,:), allocatable, target, save aice
real(kind=dbl_kind), dimension(:,:,:), allocatable, target, save eicen
integer(kind=int_kind), parameter ncat
real(kind=dbl_kind), parameter c2i
real(kind=dbl_kind), dimension(:,:,:), allocatable, target, save aicen
integer(kind=int_kind), save my_task
real(kind=dbl_kind), parameter p666
real(kind=dbl_kind), dimension(0:ncat) hin_max
real(kind=dbl_kind), parameter c1i
subroutine fit_line(ni, HbL, HbR, hice, g0, g1, hL, hR, remap_flag)
real(kind=dbl_kind), parameter rhoi
integer(kind=int_kind), parameter ntilay
real(kind=dbl_kind), parameter p333
integer(kind=int_kind) istep1
subroutine shift_ice(donor, daice, dvice, hicen)
real(kind=dbl_kind), dimension(:,:,:), allocatable, target, save vsnon
subroutine aggregate_area