@@ -1535,17 +1535,17 @@ subroutine init_hist (dt)
15351535
15361536 call define_hist_field(n_sitemptop," sitemptop" ," K" ,tstr2D, tcstr, &
15371537 " sea ice surface temperature" , &
1538- " none" , c1, c0 , &
1538+ " none" , c1, Tffresh , &
15391539 ns1, f_sitemptop, avg_ice_present= .true. , mask_ice_free_points= .true. )
15401540
15411541 call define_hist_field(n_sitempsnic," sitempsnic" ," K" ,tstr2D, tcstr, &
15421542 " snow ice interface temperature" , &
1543- " surface temperature when no snow present" , c1, c0 , &
1543+ " surface temperature when no snow present" , c1, Tffresh , &
15441544 ns1, f_sitempsnic, avg_ice_present= .true. , mask_ice_free_points= .true. )
15451545
15461546 call define_hist_field(n_sitempbot," sitempbot" ," K" ,tstr2D, tcstr, &
15471547 " sea ice bottom temperature" , &
1548- " none" , c1, c0 , &
1548+ " none" , c1, Tffresh , &
15491549 ns1, f_sitempbot, avg_ice_present= .true. , mask_ice_free_points= .true. )
15501550
15511551 call define_hist_field(n_siu," siu" ," m/s" ,ustr2D, ucstr, &
@@ -2753,22 +2753,18 @@ subroutine accum_hist (dt)
27532753 worka(:,:) = c0
27542754 do j = jlo, jhi
27552755 do i = ilo, ihi
2756- if (aice(i,j,iblk) > puny) &
2757- worka(i,j) = aice(i,j,iblk)* (trcr(i,j,nt_Tsfc,iblk)+ Tffresh)
2756+ worka(i,j) = aice(i,j,iblk)* trcr(i,j,nt_Tsfc,iblk)
27582757 enddo
27592758 enddo
27602759 call accum_hist_field(n_sitemptop, iblk, worka(:,:), a2D)
27612760 endif
27622761
2762+ ! Tsnice is already multiplied by aicen in icepack.
27632763 if (f_sitempsnic(1 :1 ) /= ' x' ) then
27642764 worka(:,:) = c0
27652765 do j = jlo, jhi
27662766 do i = ilo, ihi
2767- if (vsno(i,j,iblk) > puny .and. aice_init(i,j,iblk) > puny) then
2768- worka(i,j) = aice(i,j,iblk)* (Tsnice(i,j,iblk)/ aice_init(i,j,iblk)+ Tffresh)
2769- else
2770- worka(i,j) = aice(i,j,iblk)* (trcr(i,j,nt_Tsfc,iblk)+ Tffresh)
2771- endif
2767+ worka(i,j) = Tsnice(i,j,iblk)
27722768 enddo
27732769 enddo
27742770 call accum_hist_field(n_sitempsnic, iblk, worka(:,:), a2D)
@@ -2778,8 +2774,7 @@ subroutine accum_hist (dt)
27782774 worka(:,:) = c0
27792775 do j = jlo, jhi
27802776 do i = ilo, ihi
2781- if (aice_init(i,j,iblk) > puny) &
2782- worka(i,j) = aice(i,j,iblk)* (Tbot(i,j,iblk)/ aice_init(i,j,iblk)+ Tffresh)
2777+ worka(i,j) = aice(i,j,iblk)* Tbot(i,j,iblk)
27832778 enddo
27842779 enddo
27852780 call accum_hist_field(n_sitempbot, iblk, worka(:,:), a2D)
@@ -3705,33 +3700,40 @@ subroutine accum_hist (dt)
37053700 do n = 1 , num_avail_hist_fields_2D
37063701 if (avail_hist_fields(n)% vhistfreq == histfreq(ns)) then
37073702
3708- do j = jlo, jhi
3709- do i = ilo, ihi
3710- if (.not. tmask(i,j,iblk)) then ! mask out land points
3711- a2D(i,j,n,iblk) = spval_dbl
3712- else ! convert units
3713- a2D(i,j,n,iblk) = avail_hist_fields(n)% cona* a2D(i,j,n,iblk) &
3714- * ravgct + avail_hist_fields(n)% conb
3715- endif
3716- enddo ! i
3717- enddo ! j
3718-
3719- ! Only average for timesteps when ice present
3703+ ! Only average when/where ice present
37203704 if (avail_hist_fields(n)% avg_ice_present) then
37213705 do j = jlo, jhi
37223706 do i = ilo, ihi
3723- if (tmask(i,j,iblk)) then
3724- a2D(i,j,n,iblk) = &
3725- a2D(i,j,n,iblk)* avgct(ns)* ravgip(i,j)
3707+ if (.not. tmask(i,j,iblk)) then
3708+ a2D(i,j,n,iblk) = spval_dbl
3709+ else ! convert units
3710+ a2D(i,j,n,iblk) = avail_hist_fields(n)% cona* a2D(i,j,n,iblk) &
3711+ * ravgip(i,j) + avail_hist_fields(n)% conb
37263712 endif
3727- ! Mask ice-free points
3728- if (avail_hist_fields(n)% mask_ice_free_points) then
3729- if (ravgip(i,j) == c0) a2D(i,j,n,iblk) = spval_dbl
3713+ enddo ! i
3714+ enddo ! j
3715+ else
3716+ do j = jlo, jhi
3717+ do i = ilo, ihi
3718+ if (.not. tmask(i,j,iblk)) then ! mask out land points
3719+ a2D(i,j,n,iblk) = spval_dbl
3720+ else ! convert units
3721+ a2D(i,j,n,iblk) = avail_hist_fields(n)% cona* a2D(i,j,n,iblk) &
3722+ * ravgct + avail_hist_fields(n)% conb
37303723 endif
37313724 enddo ! i
37323725 enddo ! j
37333726 endif
37343727
3728+ ! Mask ice-free points
3729+ if (avail_hist_fields(n)% mask_ice_free_points) then
3730+ do j = jlo, jhi
3731+ do i = ilo, ihi
3732+ if (ravgip(i,j) == c0) a2D(i,j,n,iblk) = spval_dbl
3733+ enddo ! i
3734+ enddo ! j
3735+ endif
3736+
37353737 ! CMIP albedo: also mask points below horizon
37363738 if (index (avail_hist_fields(n)% vname,' sialb' ) /= 0 ) then
37373739 do j = jlo, jhi
@@ -3838,30 +3840,33 @@ subroutine accum_hist (dt)
38383840 nn = n2D + n
38393841 if (avail_hist_fields(nn)% vhistfreq == histfreq(ns)) then
38403842
3841- do k = 1 , ncat_hist
3842- do j = jlo, jhi
3843- do i = ilo, ihi
3844- if (.not. tmask(i,j,iblk)) then ! mask out land points
3845- a3Dc(i,j,k,n,iblk) = spval_dbl
3846- else ! convert units
3847- a3Dc(i,j,k,n,iblk) = avail_hist_fields(nn)% cona* a3Dc(i,j,k,n,iblk) &
3848- * ravgct + avail_hist_fields(nn)% conb
3843+ if (avail_hist_fields(nn)% avg_ice_present) then
3844+ do k = 1 , ncat_hist
3845+ do j = jlo, jhi
3846+ do i = ilo, ihi
3847+ if (.not. tmask(i,j,iblk)) then ! mask out land points
3848+ a3Dc(i,j,k,n,iblk) = spval_dbl
3849+ else ! convert units
3850+ a3Dc(i,j,k,n,iblk) = avail_hist_fields(nn)% cona* a3Dc(i,j,k,n,iblk) &
3851+ * ravgipn(i,j,k) + avail_hist_fields(nn)% conb
3852+ endif
3853+ enddo ! i
3854+ enddo ! j
3855+ enddo ! k
3856+ else
3857+ do k = 1 , ncat_hist
3858+ do j = jlo, jhi
3859+ do i = ilo, ihi
3860+ if (.not. tmask(i,j,iblk)) then ! mask out land points
3861+ a3Dc(i,j,k,n,iblk) = spval_dbl
3862+ else ! convert units
3863+ a3Dc(i,j,k,n,iblk) = avail_hist_fields(nn)% cona* a3Dc(i,j,k,n,iblk) &
3864+ * ravgct + avail_hist_fields(nn)% conb
3865+ endif
3866+ enddo ! i
3867+ enddo ! j
3868+ enddo ! k
38493869 endif
3850- enddo ! i
3851- enddo ! j
3852- enddo ! k
3853- if (avail_hist_fields(nn)% avg_ice_present) then
3854- do k = 1 , ncat_hist
3855- do j = jlo, jhi
3856- do i = ilo, ihi
3857- if (tmask(i,j,iblk)) then
3858- a3Dc(i,j,k,n,iblk) = &
3859- a3Dc(i,j,k,n,iblk)* avgct(ns)* ravgipn(i,j,k)
3860- endif
3861- enddo ! i
3862- enddo ! j
3863- enddo ! k
3864- endif
38653870
38663871 endif
38673872
@@ -3885,6 +3890,7 @@ subroutine accum_hist (dt)
38853890 enddo ! k
38863891 endif
38873892 enddo ! n
3893+
38883894 do n = 1 , num_avail_hist_fields_3Db
38893895 nn = n3Dzcum + n
38903896 if (avail_hist_fields(nn)% vhistfreq == histfreq(ns)) then
0 commit comments