Skip to content

Commit ec2e2bd

Browse files
authored
Fixes for sitemptop, sitempbot, and sitempsnic. (CICE-Consortium#1054)
Changes in CICE: - move conversion to K into the define_hist_field call - fix the accumulation of sitemptop, sitempsnic, and sitempbot to reflect the "intrinsic" versus "extrinsic" definitions. - redo the avg_ice_present division by aice, so that conb is added at the end - also undo the ravgct multiplication and division for the case of avg_ice_present - add cell_methods as "area: time: mean where sea ice (mask=siconc)" - Update icepack hash to bug fix version of "Tsnice", CICE-Consortium/Icepack#542
1 parent 8e3ef7c commit ec2e2bd

4 files changed

Lines changed: 77 additions & 59 deletions

File tree

cicecore/cicedyn/analysis/ice_history.F90

Lines changed: 59 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -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

cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,9 +1287,15 @@ subroutine ice_hist_field_def(ncid, hfield, lprecision, dimids, ns)
12871287
.and.TRIM(hfield%vname(1:9))/='sistreave' &
12881288
.and.TRIM(hfield%vname(1:9))/='sistremax' &
12891289
.and.TRIM(hfield%vname(1:4))/='sigP') then
1290-
status = nf90_put_att(ncid,varid,'cell_methods','time: mean')
1291-
call ice_check_nc(status, subname// ' ERROR: defining cell methods for '//hfield%vname, &
1292-
file=__FILE__, line=__LINE__)
1290+
if (hfield%avg_ice_present) then
1291+
status = nf90_put_att(ncid,varid,'cell_methods','area: time: mean where sea ice (mask=siconc)')
1292+
call ice_check_nc(status, subname// ' ERROR: defining cell methods for '//hfield%vname, &
1293+
file=__FILE__, line=__LINE__)
1294+
else
1295+
status = nf90_put_att(ncid,varid,'cell_methods','time: mean')
1296+
call ice_check_nc(status, subname// ' ERROR: defining cell methods for '//hfield%vname, &
1297+
file=__FILE__, line=__LINE__)
1298+
endif
12931299
endif
12941300
endif
12951301

cicecore/cicedyn/infrastructure/io/io_pio2/ice_history_write.F90

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,8 +1428,14 @@ subroutine ice_hist_field_def(File, hfield,lprecision, dimids, ns)
14281428
.and.TRIM(hfield%vname(1:9))/='sistreave' &
14291429
.and.TRIM(hfield%vname(1:9))/='sistremax' &
14301430
.and.TRIM(hfield%vname(1:4))/='sigP') then
1431-
call ice_pio_check(pio_put_att(File,varid,'cell_methods','time: mean'), &
1432-
subname//' ERROR: defining att cell_methods',file=__FILE__,line=__LINE__)
1431+
if (hfield%avg_ice_present) then
1432+
call ice_pio_check(pio_put_att(File,varid,'cell_methods', &
1433+
'area: time: mean where sea ice (mask=siconc)'), &
1434+
subname//' ERROR: defining att cell_methods',file=__FILE__,line=__LINE__)
1435+
else
1436+
call ice_pio_check(pio_put_att(File,varid,'cell_methods','time: mean'), &
1437+
subname//' ERROR: defining att cell_methods',file=__FILE__,line=__LINE__)
1438+
endif
14331439
endif
14341440
endif
14351441

0 commit comments

Comments
 (0)