Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
994 changes: 470 additions & 524 deletions cicecore/cicedyn/analysis/ice_history.F90

Large diffs are not rendered by default.

776 changes: 315 additions & 461 deletions cicecore/cicedyn/analysis/ice_history_bgc.F90

Large diffs are not rendered by default.

42 changes: 17 additions & 25 deletions cicecore/cicedyn/analysis/ice_history_drag.F90
Original file line number Diff line number Diff line change
Expand Up @@ -289,31 +289,23 @@ subroutine accum_hist_drag (iblk)
call accum_hist_field(n_Cdn_atm, iblk, Cdn_atm(:,:,iblk), a2D)
if (f_Cdn_ocn (1:1) /= 'x') &
call accum_hist_field(n_Cdn_ocn, iblk, Cdn_ocn(:,:,iblk), a2D)
if (f_drag (1:1) /= 'x') then
call accum_hist_field(n_hfreebd, iblk, hfreebd(:,:,iblk), a2D)
call accum_hist_field(n_hdraft, iblk, hdraft(:,:,iblk), a2D)
call accum_hist_field(n_hridge, iblk, hridge(:,:,iblk), a2D)
call accum_hist_field(n_distrdg, iblk, distrdg(:,:,iblk), a2D)
call accum_hist_field(n_hkeel, iblk, hkeel(:,:,iblk), a2D)
call accum_hist_field(n_dkeel, iblk, dkeel(:,:,iblk), a2D)
call accum_hist_field(n_lfloe, iblk, lfloe(:,:,iblk), a2D)
call accum_hist_field(n_dfloe, iblk, dfloe(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_rdg, &
iblk, Cdn_atm_rdg(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_floe, &
iblk, Cdn_atm_floe(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_pond, &
iblk, Cdn_atm_pond(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_skin, &
iblk, Cdn_atm_skin(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_ratio, &
iblk, Cdn_atm_ratio(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_keel, &
iblk, Cdn_ocn_keel(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_floe, &
iblk, Cdn_ocn_floe(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_skin, &
iblk, Cdn_ocn_skin(:,:,iblk), a2D)
if (f_drag (1:1) /= 'x') then
call accum_hist_field(n_hfreebd , iblk, hfreebd (:,:,iblk), a2D)
call accum_hist_field(n_hdraft , iblk, hdraft (:,:,iblk), a2D)
call accum_hist_field(n_hridge , iblk, hridge (:,:,iblk), a2D)
call accum_hist_field(n_distrdg , iblk, distrdg (:,:,iblk), a2D)
call accum_hist_field(n_hkeel , iblk, hkeel (:,:,iblk), a2D)
call accum_hist_field(n_dkeel , iblk, dkeel (:,:,iblk), a2D)
call accum_hist_field(n_lfloe , iblk, lfloe (:,:,iblk), a2D)
call accum_hist_field(n_dfloe , iblk, dfloe (:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_rdg , iblk, Cdn_atm_rdg (:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_floe , iblk, Cdn_atm_floe (:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_pond , iblk, Cdn_atm_pond (:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_skin , iblk, Cdn_atm_skin (:,:,iblk), a2D)
call accum_hist_field(n_Cdn_atm_ratio, iblk, Cdn_atm_ratio(:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_keel , iblk, Cdn_ocn_keel (:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_floe , iblk, Cdn_ocn_floe (:,:,iblk), a2D)
call accum_hist_field(n_Cdn_ocn_skin , iblk, Cdn_ocn_skin (:,:,iblk), a2D)
end if

endif ! if(allocated(a2D))
Expand Down
137 changes: 76 additions & 61 deletions cicecore/cicedyn/analysis/ice_history_fsd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ end subroutine init_hist_fsd_4Df

subroutine accum_hist_fsd (dt, iblk)

use ice_blocks, only: nx_block, ny_block
use ice_blocks, only: block, get_block, nx_block, ny_block
use ice_constants, only: c0, c1, c2, c4
use ice_domain, only: blocks_ice
use ice_history_shared, only: a2D, a3Df, a4Df, nfsd_hist, &
ncat_hist, accum_hist_field, n3Dacum, n4Dscum
use ice_state, only: trcrn, aicen, vicen, aice
Expand All @@ -326,7 +327,11 @@ subroutine accum_hist_fsd (dt, iblk)

integer (kind=int_kind) :: &
i, j, n, k, & ! loop indices
ilo,ihi,jlo,jhi, & ! beginning and end of physical domain
nt_fsd ! fsd tracer index

type (block) :: &
this_block ! block information for current block
logical (kind=log_kind) :: tr_fsd
real (kind=dbl_kind) :: floeshape, puny

Expand All @@ -337,6 +342,14 @@ subroutine accum_hist_fsd (dt, iblk)

character(len=*), parameter :: subname = '(accum_hist_fsd)'

! Bounds before first use: the work arrays are zeroed over the whole
! block but computed only over the physical domain.
this_block = get_block(blocks_ice(iblk),iblk)
ilo = this_block%ilo
ihi = this_block%ihi
jlo = this_block%jlo
jhi = this_block%jhi

call icepack_query_parameters(floeshape_out=floeshape, puny_out=puny)
call icepack_query_tracer_flags(tr_fsd_out=tr_fsd)
call icepack_query_tracer_indices(nt_fsd_out=nt_fsd)
Expand All @@ -354,32 +367,30 @@ subroutine accum_hist_fsd (dt, iblk)
if (allocated(a2D)) then

if (f_wave_sig_ht(1:1)/= 'x') &
call accum_hist_field(n_wave_sig_ht, iblk, &
wave_sig_ht(:,:,iblk), a2D)
call accum_hist_field(n_wave_sig_ht, iblk, wave_sig_ht(:,:,iblk), a2D)

if (f_aice_ww(1:1)/= 'x') then
do j = 1, ny_block
do i = 1, nx_block
worka(i,j) = c0
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
do n = 1, ncat_hist
do k = 1, nfsd_hist
worka(i,j) = worka(i,j) + aicen(i,j,n,iblk)*trcrn(i,j,nt_fsd+k-1,n,iblk)
end do
end do
end do
end do
call accum_hist_field(n_aice_ww, iblk, worka(:,:), a2D)
call accum_hist_field(n_aice_ww, iblk, worka(:,:), a2D)
endif

if (f_diam_ww (1:1) /= 'x') then
do j = 1, ny_block
do i = 1, nx_block
worka(i,j) = c0
workb = c0
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
workb = c0
do n = 1, ncat_hist
do k = 1, nfsd_hist
workc = aicen(i,j,n,iblk)*trcrn(i,j,nt_fsd+k-1,n,iblk) &
/ (c4*floeshape*floe_rad_c(k)**2)
workc = aicen(i,j,n,iblk)*trcrn(i,j,nt_fsd+k-1,n,iblk) / (c4*floeshape*floe_rad_c(k)**2)
! number-mean radius
worka(i,j) = worka(i,j) + workc * floe_rad_c(k)
! normalization factor
Expand All @@ -395,9 +406,9 @@ subroutine accum_hist_fsd (dt, iblk)
endif

if (f_hice_ww (1:1) /= 'x') then
do j = 1, ny_block
do i = 1, nx_block
worka(i,j) = c0
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
workb = c0
do n = 1, ncat_hist
do k = 1, nfsd_hist
Expand All @@ -416,35 +427,35 @@ subroutine accum_hist_fsd (dt, iblk)
endif

if (f_fsdrad(1:1) /= 'x') then
do j = 1, ny_block
do i = 1, nx_block
worka(i,j) = c0
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
if (aice(i,j,iblk) > puny) then
do k = 1, nfsd_hist
do n = 1, ncat_hist
worka(i,j) = worka(i,j) &
+ (trcrn(i,j,nt_fsd+k-1,n,iblk) * floe_rad_c(k) &
* aicen(i,j,n,iblk)/aice(i,j,iblk))
end do
end do
do k = 1, nfsd_hist
do n = 1, ncat_hist
worka(i,j) = worka(i,j) &
+ (trcrn(i,j,nt_fsd+k-1,n,iblk) * floe_rad_c(k) &
* aicen(i,j,n,iblk)/aice(i,j,iblk))
end do
end do
endif
end do
end do
call accum_hist_field(n_fsdrad, iblk, worka(:,:), a2D)
endif

if (f_fsdperim(1:1) /= 'x') then
do j = 1, ny_block
do i = 1, nx_block
worka(i,j) = c0
worka(:,:) = c0
do j = jlo, jhi
do i = ilo, ihi
if (aice(i,j,iblk) > puny) then
do k = 1, nfsd_hist
do k = 1, nfsd_hist
do n = 1, ncat_hist
worka(i,j) = worka(i,j) &
+ (c8*floeshape*trcrn(i,j,nt_fsd+k-1,n,iblk)*floe_rad_c(k) &
*aicen(i,j,n,iblk)/(c4*floeshape*floe_rad_c(k)**2 *aice(i,j,iblk)))
worka(i,j) = worka(i,j) &
+ (c8*floeshape*trcrn(i,j,nt_fsd+k-1,n,iblk)*floe_rad_c(k) &
*aicen(i,j,n,iblk)/(c4*floeshape*floe_rad_c(k)**2 *aice(i,j,iblk)))
end do
end do
end do
endif
end do
end do
Expand All @@ -455,49 +466,53 @@ subroutine accum_hist_fsd (dt, iblk)

! 3D category fields
if (allocated(a3Df)) then

worke(:,:,:)=c0
if (f_afsd(1:1) /= 'x') then
do j = 1, ny_block
do i = 1, nx_block
do j = jlo, jhi
do i = ilo, ihi
do k = 1, nfsd_hist
worke(i,j,k)=c0
do n = 1, ncat_hist
worke(i,j,k) = worke(i,j,k) + (trcrn(i,j,nt_fsd+k-1,n,iblk) &
* aicen(i,j,n,iblk)/floe_binwidth(k))
end do
do n = 1, ncat_hist
worke(i,j,k) = worke(i,j,k) + (trcrn(i,j,nt_fsd+k-1,n,iblk) &
* aicen(i,j,n,iblk)/floe_binwidth(k))
end do
end do
end do
end do
call accum_hist_field(n_afsd-n3Dacum, iblk, nfsd_hist, worke, a3Df)
endif

if (f_dafsd_newi(1:1)/= 'x') &
call accum_hist_field(n_dafsd_newi-n3Dacum, iblk, nfsd_hist, &
d_afsd_newi(:,:,1:nfsd_hist,iblk)/dt, a3Df)
if (f_dafsd_latg(1:1)/= 'x') &
call accum_hist_field(n_dafsd_latg-n3Dacum, iblk, nfsd_hist, &
d_afsd_latg(:,:,1:nfsd_hist,iblk)/dt, a3Df)
if (f_dafsd_latm(1:1)/= 'x') &
call accum_hist_field(n_dafsd_latm-n3Dacum, iblk, nfsd_hist, &
d_afsd_latm(:,:,1:nfsd_hist,iblk)/dt, a3Df)
if (f_dafsd_wave(1:1)/= 'x') &
call accum_hist_field(n_dafsd_wave-n3Dacum, iblk, nfsd_hist, &
d_afsd_wave(:,:,1:nfsd_hist,iblk)/dt, a3Df)
if (f_dafsd_weld(1:1)/= 'x') &
call accum_hist_field(n_dafsd_weld-n3Dacum, iblk, nfsd_hist, &
d_afsd_weld(:,:,1:nfsd_hist,iblk)/dt, a3Df)
if (f_dafsd_newi(1:1)/= 'x') then
worke(ilo:ihi,jlo:jhi,1:nfsd_hist)= d_afsd_newi(ilo:ihi,jlo:jhi,1:nfsd_hist,iblk)/dt
call accum_hist_field(n_dafsd_newi-n3Dacum, iblk, nfsd_hist, worke, a3Df)
endif
if (f_dafsd_latg(1:1)/= 'x') then
worke(ilo:ihi,jlo:jhi,1:nfsd_hist)= d_afsd_latg(ilo:ihi,jlo:jhi,1:nfsd_hist,iblk)/dt
call accum_hist_field(n_dafsd_latg-n3Dacum, iblk, nfsd_hist, worke, a3Df)
endif
if (f_dafsd_latm(1:1)/= 'x') then
worke(ilo:ihi,jlo:jhi,1:nfsd_hist)= d_afsd_latm(ilo:ihi,jlo:jhi,1:nfsd_hist,iblk)/dt
call accum_hist_field(n_dafsd_latm-n3Dacum, iblk, nfsd_hist, worke, a3Df)
endif
if (f_dafsd_wave(1:1)/= 'x') then
worke(ilo:ihi,jlo:jhi,1:nfsd_hist)= d_afsd_wave(ilo:ihi,jlo:jhi,1:nfsd_hist,iblk)/dt
call accum_hist_field(n_dafsd_wave-n3Dacum, iblk, nfsd_hist, worke, a3Df)
endif
if (f_dafsd_weld(1:1)/= 'x') then
worke(ilo:ihi,jlo:jhi,1:nfsd_hist)= d_afsd_weld(ilo:ihi,jlo:jhi,1:nfsd_hist,iblk)/dt
call accum_hist_field(n_dafsd_weld-n3Dacum, iblk, nfsd_hist, worke, a3Df)
endif
endif ! a3Df allocated

! 4D floe size, thickness category fields
if (allocated(a4Df)) then

if (f_afsdn(1:1) /= 'x') then
workd(:,:,:,:) = c0
do n = 1, ncat_hist
do k = 1, nfsd_hist
do j = 1, ny_block
do i = 1, nx_block
workd(i,j,k,n) = trcrn(i,j,nt_fsd+k-1,n,iblk) &
* aicen(i,j,n,iblk)/floe_binwidth(k)
do j = jlo, jhi
do i = ilo, ihi
workd(i,j,k,n) = trcrn(i,j,nt_fsd+k-1,n,iblk) * aicen(i,j,n,iblk)/floe_binwidth(k)
end do
end do
end do
Expand Down
Loading
Loading