Skip to content

Commit

Permalink
CICE: Floe size distribution (CICE-Consortium#382)
Browse files Browse the repository at this point in the history
* machine files for loft laptop

* adding fsd tracer infrastructure

* fsd allocation, initialization, lateral melt, diags

* correct diagnostic, reduce number of fsd arrays

* fsd lateral melt

* fsd add_new_ice

* wave_spec namelist

* history except io_

* allocate fsd arrays

* fix history indexing; call fsd accum; write binary fsd and bgc; netcdf not tested; no pio

* fix a3Df initialization

* fsd netcdf history

* fsd namelist option file

* initialization fixes, fsd diagnostics

* fix divzero

* refactor fsd initialization

* cleanup_fsd, refactor fsd initialization

* fix index array size

* tr_fsd cleanup

* fsd 5-day smoke test

* fixing restarts (only netcdf, binary)

* waves for fsd

* Testing waves

* Testing waves

* Update sg_tracers.rst

* Update ug_case_settings.rst

* Read gx3 forcing data for wave spectrum - not tested

* Working on reading in waves

* Moving calculation of wave_sig_ht to ice_step_mod

* Modifications read in wave spectra

* Add dummy wave spectrum file

* Working on wave fracture

* Tidy up

* Removed concentration limit on wave fracture

* Tidying up

* wave_spec modifications; documentation updates

* switch icepack to ifsd1 branch

* Fixing bug- need to broadcast wave_spec_type to processors

* wave_spectrum is constant in time, for now; update debug driver

* replace hardwired 25s with nfreq

* fsd history, ww3 test case

* update icepack to current master including ifsd1 merge

* revert PIO changes; initialize arrays; compute wave_sig_ht when tr_fsd=T

* avoid missing values in wave forcing file

* add FSD representative radius to history

* Changed units and renamed f to freq in ww3 input file

* add perimeter to fsd history

* Correction to perimeter

* Made representative radius and perimeter 2D fields

* Update ug_case_settings.rst

* Update sg_fundvars.rst

* default fsd history flags

* cice consortium version of icepack

* remove icepack

* switch to Consortium version of Icepack

* update icepack version from master

* update icepack

* update icepack

* update documentation

* correct formatting in doc

* add file option to doc

* update drivers with new fsd code (untested)
  • Loading branch information
eclare108213 authored and apcraig committed Dec 7, 2019
1 parent 38816ba commit 29b99b6
Show file tree
Hide file tree
Showing 53 changed files with 2,372 additions and 320 deletions.
3 changes: 1 addition & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "icepack"]
path = icepack
url = https://github.com/cice-consortium/icepack.git
branch = master
url = https://github.com/cice-consortium/Icepack
124 changes: 80 additions & 44 deletions cicecore/cicedynB/analysis/ice_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module ice_diagnostics

use ice_kinds_mod
use ice_communicate, only: my_task, master_task
use ice_constants, only: c0
use ice_constants, only: c0, c1
use ice_calendar, only: istep1
use ice_fileunits, only: nu_diag
use ice_fileunits, only: flush_fileunit
Expand Down Expand Up @@ -89,8 +89,8 @@ module ice_diagnostics
integer (kind=int_kind), parameter, public :: &
check_step = 999999999, & ! begin printing at istep1=check_step
iblkp = 1, & ! block number
ip = 3, & ! i index
jp = 5, & ! j index
ip = 2, & ! i index
jp = 11, & ! j index
mtask = 0 ! my_task

!=======================================================================
Expand All @@ -107,12 +107,13 @@ module ice_diagnostics

subroutine runtime_diags (dt)

use ice_arrays_column, only: floe_rad_c
use ice_blocks, only: nx_block, ny_block
use ice_broadcast, only: broadcast_scalar
use ice_constants, only: c1, c1000, c2, p001, p5, &
field_loc_center, m2_to_km2
use ice_domain, only: distrb_info, nblocks
use ice_domain_size, only: ncat, n_aero, max_blocks
use ice_domain_size, only: ncat, n_aero, max_blocks, nfsd
use ice_flux, only: alvdr, alidr, alvdf, alidf, evap, fsnow, frazil, &
fswabs, fswthru, flw, flwout, fsens, fsurf, flat, frzmlt_init, frain, fpond, &
fhocn_ai, fsalt_ai, fresh_ai, frazil_diag, &
Expand All @@ -135,12 +136,12 @@ subroutine runtime_diags (dt)
! local variables

integer (kind=int_kind) :: &
i, j, n, iblk, &
i, j, k, n, iblk, nc, &
ktherm, &
nt_tsfc, nt_aero, nt_fbri, nt_apnd, nt_hpnd
nt_tsfc, nt_aero, nt_fbri, nt_apnd, nt_hpnd, nt_fsd

logical (kind=log_kind) :: &
tr_pond_topo, tr_brine, tr_aero, calc_Tsfc
tr_pond_topo, tr_brine, tr_aero, calc_Tsfc, tr_fsd

real (kind=dbl_kind) :: &
rhow, rhos, rhoi, puny, awtvdr, awtidr, awtvdf, awtidf, &
Expand Down Expand Up @@ -177,7 +178,7 @@ subroutine runtime_diags (dt)
paice, pTair, pQa, pfsnow, pfrain, pfsw, pflw, &
pTsfc, pevap, pfswabs, pflwout, pflat, pfsens, &
pfsurf, pfcondtop, psst, psss, pTf, hiavg, hsavg, hbravg, &
pfhocn, psalt, &
pfhocn, psalt, fsdavg, &
pmeltt, pmeltb, pmeltl, psnoice, pdsnow, pfrazil, pcongel

real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: &
Expand All @@ -187,9 +188,10 @@ subroutine runtime_diags (dt)

call icepack_query_parameters(ktherm_out=ktherm, calc_Tsfc_out=calc_Tsfc)
call icepack_query_tracer_flags(tr_brine_out=tr_brine, tr_aero_out=tr_aero, &
tr_pond_topo_out=tr_pond_topo)
tr_pond_topo_out=tr_pond_topo, tr_fsd_out=tr_fsd)
call icepack_query_tracer_indices(nt_fbri_out=nt_fbri, nt_Tsfc_out=nt_Tsfc, &
nt_aero_out=nt_aero, nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd)
nt_aero_out=nt_aero, nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, &
nt_fsd_out=nt_fsd)
call icepack_query_parameters(Tffresh_out=Tffresh, rhos_out=rhos, &
rhow_out=rhow, rhoi_out=rhoi, puny_out=puny, &
awtvdr_out=awtvdr, awtidr_out=awtidr, awtvdf_out=awtvdf, awtidf_out=awtidf, &
Expand Down Expand Up @@ -502,7 +504,7 @@ subroutine runtime_diags (dt)
work1(i,j,iblk) = &
(fswabs(i,j,iblk) - fswthru(i,j,iblk) &
+ fsens (i,j,iblk) + flwout (i,j,iblk)) &
* aice (i,j,iblk) &
* aice (i,j,iblk) &
+ flw (i,j,iblk) * aice_init (i,j,iblk)
enddo
enddo
Expand Down Expand Up @@ -748,13 +750,30 @@ subroutine runtime_diags (dt)
pflw(n) = flw(i,j,iblk) ! longwave radiation
paice(n) = aice(i,j,iblk) ! ice area

fsdavg(n) = c0 ! avg floe effective radius
hiavg(n) = c0 ! avg snow/ice thickness
hsavg(n) = c0
hbravg(n) = c0 ! avg brine thickness
if (paice(n) /= c0) then
hiavg(n) = vice(i,j,iblk)/paice(n)
hsavg(n) = vsno(i,j,iblk)/paice(n)
if (tr_brine) hbravg(n) = trcr(i,j,nt_fbri,iblk)* hiavg(n)
if (tr_fsd) then
! not sure why this does not work
! do k = 1, nfsd
! fsdavg(n) = fsdavg(n) &
! + trcr(i,j,nt_fsd+k-1,iblk) * floe_rad_c(k) &
! / trcr(i,j,nt_fsd+k-1,iblk)
! enddo
! this works
do nc = 1, ncat
do k = 1, nfsd
fsdavg(n) = fsdavg(n) &
+ trcrn(i,j,nt_fsd+k-1,nc,iblk) * floe_rad_c(k) &
* aicen(i,j,nc,iblk) / paice(n)
enddo
enddo
endif
endif
if (vice(i,j,iblk) /= c0) psalt(n) = work2(i,j,iblk)/vice(i,j,iblk)
pTsfc(n) = trcr(i,j,nt_Tsfc,iblk) ! ice/snow sfc temperature
Expand Down Expand Up @@ -782,38 +801,39 @@ subroutine runtime_diags (dt)

endif ! my_task = pmloc

call broadcast_scalar(pTair (n), pmloc(n))
call broadcast_scalar(pQa (n), pmloc(n))
call broadcast_scalar(pfsnow (n), pmloc(n))
call broadcast_scalar(pfrain (n), pmloc(n))
call broadcast_scalar(pfsw (n), pmloc(n))
call broadcast_scalar(pflw (n), pmloc(n))
call broadcast_scalar(paice (n), pmloc(n))
call broadcast_scalar(hsavg (n), pmloc(n))
call broadcast_scalar(hiavg (n), pmloc(n))
call broadcast_scalar(pTair (n), pmloc(n))
call broadcast_scalar(pQa (n), pmloc(n))
call broadcast_scalar(pfsnow (n), pmloc(n))
call broadcast_scalar(pfrain (n), pmloc(n))
call broadcast_scalar(pfsw (n), pmloc(n))
call broadcast_scalar(pflw (n), pmloc(n))
call broadcast_scalar(paice (n), pmloc(n))
call broadcast_scalar(hsavg (n), pmloc(n))
call broadcast_scalar(hiavg (n), pmloc(n))
call broadcast_scalar(fsdavg (n), pmloc(n))
call broadcast_scalar(psalt (n), pmloc(n))
call broadcast_scalar(hbravg (n), pmloc(n))
call broadcast_scalar(pTsfc (n), pmloc(n))
call broadcast_scalar(pevap (n), pmloc(n))
call broadcast_scalar(pfswabs (n), pmloc(n))
call broadcast_scalar(pflwout (n), pmloc(n))
call broadcast_scalar(pflat (n), pmloc(n))
call broadcast_scalar(pfsens (n), pmloc(n))
call broadcast_scalar(pfsurf (n), pmloc(n))
call broadcast_scalar(pfcondtop(n), pmloc(n))
call broadcast_scalar(pmeltt (n), pmloc(n))
call broadcast_scalar(pmeltb (n), pmloc(n))
call broadcast_scalar(pmeltl (n), pmloc(n))
call broadcast_scalar(psnoice (n), pmloc(n))
call broadcast_scalar(pdsnow (n), pmloc(n))
call broadcast_scalar(pfrazil (n), pmloc(n))
call broadcast_scalar(pcongel (n), pmloc(n))
call broadcast_scalar(pdhi (n), pmloc(n))
call broadcast_scalar(pdhs (n), pmloc(n))
call broadcast_scalar(pde (n), pmloc(n))
call broadcast_scalar(psst (n), pmloc(n))
call broadcast_scalar(psss (n), pmloc(n))
call broadcast_scalar(pTf (n), pmloc(n))
call broadcast_scalar(pTsfc (n), pmloc(n))
call broadcast_scalar(pevap (n), pmloc(n))
call broadcast_scalar(pfswabs (n), pmloc(n))
call broadcast_scalar(pflwout (n), pmloc(n))
call broadcast_scalar(pflat (n), pmloc(n))
call broadcast_scalar(pfsens (n), pmloc(n))
call broadcast_scalar(pfsurf (n), pmloc(n))
call broadcast_scalar(pfcondtop(n), pmloc(n))
call broadcast_scalar(pmeltt (n), pmloc(n))
call broadcast_scalar(pmeltb (n), pmloc(n))
call broadcast_scalar(pmeltl (n), pmloc(n))
call broadcast_scalar(psnoice (n), pmloc(n))
call broadcast_scalar(pdsnow (n), pmloc(n))
call broadcast_scalar(pfrazil (n), pmloc(n))
call broadcast_scalar(pcongel (n), pmloc(n))
call broadcast_scalar(pdhi (n), pmloc(n))
call broadcast_scalar(pdhs (n), pmloc(n))
call broadcast_scalar(pde (n), pmloc(n))
call broadcast_scalar(psst (n), pmloc(n))
call broadcast_scalar(psss (n), pmloc(n))
call broadcast_scalar(pTf (n), pmloc(n))
call broadcast_scalar(pfhocn (n), pmloc(n))

enddo ! npnt
Expand Down Expand Up @@ -947,6 +967,8 @@ subroutine runtime_diags (dt)
write(nu_diag,900) 'avg snow depth (m) = ',hsavg(1),hsavg(2)
write(nu_diag,900) 'avg salinity (ppt) = ',psalt(1),psalt(2)
write(nu_diag,900) 'avg brine thickness (m)= ',hbravg(1),hbravg(2)
if (tr_fsd) &
write(nu_diag,900) 'avg fsd rep radius (m) = ',fsdavg(1),fsdavg(2)

if (calc_Tsfc) then
write(nu_diag,900) 'surface temperature(C) = ',pTsfc(1),pTsfc(2)
Expand Down Expand Up @@ -1439,7 +1461,7 @@ subroutine print_state(plabel,i,j,iblk)

use ice_blocks, only: block, get_block
use ice_domain, only: blocks_ice
use ice_domain_size, only: ncat, nilyr, nslyr
use ice_domain_size, only: ncat, nilyr, nslyr, nfsd
use ice_state, only: aice0, aicen, vicen, vsnon, uvel, vvel, trcrn
use ice_flux, only: uatm, vatm, potT, Tair, Qa, flw, frain, fsnow, &
fsens, flat, evap, flwout, swvdr, swvdf, swidr, swidf, rhoa, &
Expand All @@ -1458,15 +1480,18 @@ subroutine print_state(plabel,i,j,iblk)
qi, qs, Tsnow, &
rad_to_deg, puny, rhoi, lfresh, rhos, cp_ice

integer (kind=int_kind) :: n, k, nt_Tsfc, nt_qice, nt_qsno
integer (kind=int_kind) :: n, k, nt_Tsfc, nt_qice, nt_qsno, nt_fsd

logical (kind=log_kind) :: tr_fsd

type (block) :: &
this_block ! block information for current block

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

call icepack_query_tracer_flags(tr_fsd_out=tr_fsd)
call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, nt_qice_out=nt_qice, &
nt_qsno_out=nt_qsno)
nt_qsno_out=nt_qsno, nt_fsd_out=nt_fsd)
call icepack_query_parameters( &
rad_to_deg_out=rad_to_deg, puny_out=puny, rhoi_out=rhoi, lfresh_out=lfresh, &
rhos_out=rhos, cp_ice_out=cp_ice)
Expand Down Expand Up @@ -1495,9 +1520,20 @@ subroutine print_state(plabel,i,j,iblk)
write(nu_diag,*) 'hsn', vsnon(i,j,n,iblk)/aicen(i,j,n,iblk)
endif
write(nu_diag,*) 'Tsfcn',trcrn(i,j,nt_Tsfc,n,iblk)
if (tr_fsd) write(nu_diag,*) 'afsdn',trcrn(i,j,nt_fsd,n,iblk) ! fsd cat 1
write(nu_diag,*) ' '

! dynamics (transport and/or ridging) causes the floe size distribution to become non-normal
! if (tr_fsd) then
! if (abs(sum(trcrn(i,j,nt_fsd:nt_fsd+nfsd-1,n,iblk))-c1) > puny) &
! print*,'afsdn not normal', &
! sum(trcrn(i,j,nt_fsd:nt_fsd+nfsd-1,n,iblk)), &
! trcrn(i,j,nt_fsd:nt_fsd+nfsd-1,n,iblk)
! endif

enddo ! n


eidebug = c0
do n = 1,ncat
do k = 1,nilyr
Expand Down
Loading

0 comments on commit 29b99b6

Please sign in to comment.