Skip to content

Commit

Permalink
update icepack interfaces (CICE-Consortium#282)
Browse files Browse the repository at this point in the history
* update icepack_itd interfaces

* update comment

* update comment

* undo optional arguments, move to keyword=value in interface calls

* update driver interface to use keyword arguments to icepack

* update documentation
  • Loading branch information
apcraig authored Nov 8, 2019
1 parent 6b55dce commit 68bc397
Show file tree
Hide file tree
Showing 8 changed files with 718 additions and 599 deletions.
15 changes: 6 additions & 9 deletions columnphysics/icepack_itd.F90
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ subroutine cleanup_itd (dt, ntrcr, &
tr_pond_topo, & ! topo pond flag
heat_capacity ! if false, ice and snow have zero heat capacity

logical (kind=log_kind), dimension(ncat),intent(inout) :: &
logical (kind=log_kind), dimension(ncat), intent(inout) :: &
first_ice ! For bgc and S tracers. set to true if zapping ice.

! ice-ocean fluxes (required for strict conservation)
Expand All @@ -831,8 +831,7 @@ subroutine cleanup_itd (dt, ntrcr, &
real (kind=dbl_kind), dimension (:), intent(inout), optional :: &
flux_bio ! net tracer flux to ocean from biology (mmol/m^2/s)

real (kind=dbl_kind), dimension (:), &
intent(inout), optional :: &
real (kind=dbl_kind), dimension (:), intent(inout), optional :: &
faero_ocn ! aerosol flux to ocean (kg/m^2/s)

logical (kind=log_kind), intent(in), optional :: &
Expand Down Expand Up @@ -1073,7 +1072,7 @@ subroutine zap_small_areas (dt, ntrcr, &
tr_aero, & ! aerosol flag
tr_pond_topo ! pond flag

logical (kind=log_kind), dimension (:),intent(inout) :: &
logical (kind=log_kind), dimension (:), intent(inout) :: &
first_ice ! For bgc tracers. Set to true if zapping ice

! local variables
Expand Down Expand Up @@ -1439,7 +1438,7 @@ subroutine zap_snow_temperature(dt, ncat, &
real (kind=dbl_kind), dimension (:), intent(inout) :: &
dfaero_ocn ! zapped aerosol flux (kg/m^2/s)

real (kind=dbl_kind), dimension (:),intent(inout) :: &
real (kind=dbl_kind), dimension (:), intent(inout) :: &
dflux_bio ! zapped biology flux (mmol/m^2/s)

logical (kind=log_kind), intent(in) :: &
Expand Down Expand Up @@ -1928,8 +1927,7 @@ subroutine icepack_aggregate (ncat, &
vicen , & ! volume per unit area of ice (m)
vsnon ! volume per unit area of snow (m)

real (kind=dbl_kind), dimension (:,:), &
intent(inout) :: &
real (kind=dbl_kind), dimension (:,:), intent(inout) :: &
trcrn ! ice tracers

integer (kind=int_kind), dimension (:), intent(in) :: &
Expand All @@ -1949,8 +1947,7 @@ subroutine icepack_aggregate (ncat, &
vsno , & ! volume per unit area of snow (m)
aice0 ! concentration of open water

real (kind=dbl_kind), dimension (:), &
intent(out) :: &
real (kind=dbl_kind), dimension (:), intent(out) :: &
trcr ! ice tracers

! local variables
Expand Down
34 changes: 17 additions & 17 deletions configuration/driver/icedrv_InitMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ subroutine icedrv_initialize
call init_calendar ! initialize some calendar stuff
call init_coupler_flux ! initialize fluxes exchanged with coupler
call init_thermo_vertical ! initialize vertical thermodynamics
call icepack_init_itd(ncat, hin_max)
call icepack_init_itd(ncat=ncat, hin_max=hin_max)

call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted(subname)) then
call icedrv_system_abort(file=__FILE__,line=__LINE__)
endif

call icepack_init_itd_hist(ncat, hin_max, c_hi_range) ! output
call icepack_init_itd_hist(ncat=ncat, c_hi_range=c_hi_range, hin_max=hin_max) ! output

call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted(subname)) then
Expand Down Expand Up @@ -178,21 +178,21 @@ subroutine init_restart
!-----------------------------------------------------------------
do i = 1, nx
if (tmask(i)) &
call icepack_aggregate(ncat, &
aicen(i,:), &
trcrn(i,:,:), &
vicen(i,:), &
vsnon(i,:), &
aice (i), &
trcr (i,:), &
vice (i), &
vsno (i), &
aice0(i), &
max_ntrcr, &
trcr_depend, &
trcr_base, &
n_trcr_strata, &
nt_strata)
call icepack_aggregate(ncat=ncat, &
aicen=aicen(i,:), &
vicen=vicen(i,:), &
vsnon=vsnon(i,:), &
trcrn=trcrn(i,:,:), &
aice=aice (i), &
vice=vice (i), &
vsno=vsno (i), &
trcr=trcr (i,:), &
aice0=aice0(i), &
ntrcr=max_ntrcr, &
trcr_depend=trcr_depend, &
trcr_base=trcr_base, &
n_trcr_strata=n_trcr_strata, &
nt_strata=nt_strata)
enddo
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
Expand Down
190 changes: 97 additions & 93 deletions configuration/driver/icedrv_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,30 @@ subroutine input_data
!-----------------------------------------------------------------

call icepack_query_parameters(ustar_min_out=ustar_min, Cf_out=Cf, &
albicev_out=albicev, albicei_out=albicei, &
albsnowv_out=albsnowv, albsnowi_out=albsnowi, &
natmiter_out=natmiter, ahmax_out=ahmax, shortwave_out=shortwave, &
albedo_type_out=albedo_type, R_ice_out=R_ice, R_pnd_out=R_pnd, &
R_snw_out=R_snw, dT_mlt_out=dT_mlt, rsnw_mlt_out=rsnw_mlt, &
kstrength_out=kstrength, krdg_partic_out=krdg_partic, &
krdg_redist_out=krdg_redist, mu_rdg_out=mu_rdg, &
atmbndy_out=atmbndy, calc_strair_out=calc_strair, &
formdrag_out=formdrag, highfreq_out=highfreq, &
emissivity_out=emissivity, &
kitd_out=kitd, kcatbound_out=kcatbound, hs0_out=hs0, &
dpscale_out=dpscale, frzpnd_out=frzpnd, &
rfracmin_out=rfracmin, rfracmax_out=rfracmax, &
pndaspect_out=pndaspect, hs1_out=hs1, hp1_out=hp1, &
ktherm_out=ktherm, calc_Tsfc_out=calc_Tsfc, &
update_ocn_f_out = update_ocn_f, &
conduct_out=conduct, a_rapid_mode_out=a_rapid_mode, &
Rac_rapid_mode_out=Rac_rapid_mode, &
aspect_rapid_mode_out=aspect_rapid_mode, &
dSdt_slow_mode_out=dSdt_slow_mode, &
phi_c_slow_mode_out=phi_c_slow_mode, &
phi_i_mushy_out=phi_i_mushy, &
tfrz_option_out=tfrz_option, kalg_out=kalg, &
fbot_xfer_type_out=fbot_xfer_type, puny_out=puny)
albicev_out=albicev, albicei_out=albicei, &
albsnowv_out=albsnowv, albsnowi_out=albsnowi, &
natmiter_out=natmiter, ahmax_out=ahmax, shortwave_out=shortwave, &
albedo_type_out=albedo_type, R_ice_out=R_ice, R_pnd_out=R_pnd, &
R_snw_out=R_snw, dT_mlt_out=dT_mlt, rsnw_mlt_out=rsnw_mlt, &
kstrength_out=kstrength, krdg_partic_out=krdg_partic, &
krdg_redist_out=krdg_redist, mu_rdg_out=mu_rdg, &
atmbndy_out=atmbndy, calc_strair_out=calc_strair, &
formdrag_out=formdrag, highfreq_out=highfreq, &
emissivity_out=emissivity, &
kitd_out=kitd, kcatbound_out=kcatbound, hs0_out=hs0, &
dpscale_out=dpscale, frzpnd_out=frzpnd, &
rfracmin_out=rfracmin, rfracmax_out=rfracmax, &
pndaspect_out=pndaspect, hs1_out=hs1, hp1_out=hp1, &
ktherm_out=ktherm, calc_Tsfc_out=calc_Tsfc, &
update_ocn_f_out = update_ocn_f, &
conduct_out=conduct, a_rapid_mode_out=a_rapid_mode, &
Rac_rapid_mode_out=Rac_rapid_mode, &
aspect_rapid_mode_out=aspect_rapid_mode, &
dSdt_slow_mode_out=dSdt_slow_mode, &
phi_c_slow_mode_out=phi_c_slow_mode, &
phi_i_mushy_out=phi_i_mushy, &
tfrz_option_out=tfrz_option, kalg_out=kalg, &
fbot_xfer_type_out=fbot_xfer_type, puny_out=puny)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -689,41 +689,41 @@ subroutine input_data
!-----------------------------------------------------------------

call icepack_init_parameters(ustar_min_in=ustar_min, Cf_in=Cf, &
albicev_in=albicev, albicei_in=albicei, &
albsnowv_in=albsnowv, albsnowi_in=albsnowi, &
natmiter_in=natmiter, ahmax_in=ahmax, shortwave_in=shortwave, &
albedo_type_in=albedo_type, R_ice_in=R_ice, R_pnd_in=R_pnd, &
R_snw_in=R_snw, dT_mlt_in=dT_mlt, rsnw_mlt_in=rsnw_mlt, &
kstrength_in=kstrength, krdg_partic_in=krdg_partic, &
krdg_redist_in=krdg_redist, mu_rdg_in=mu_rdg, &
atmbndy_in=atmbndy, calc_strair_in=calc_strair, &
formdrag_in=formdrag, highfreq_in=highfreq, &
emissivity_in=emissivity, &
kitd_in=kitd, kcatbound_in=kcatbound, hs0_in=hs0, &
dpscale_in=dpscale, frzpnd_in=frzpnd, &
rfracmin_in=rfracmin, rfracmax_in=rfracmax, &
pndaspect_in=pndaspect, hs1_in=hs1, hp1_in=hp1, &
ktherm_in=ktherm, calc_Tsfc_in=calc_Tsfc, &
conduct_in=conduct, a_rapid_mode_in=a_rapid_mode, &
Rac_rapid_mode_in=Rac_rapid_mode, &
aspect_rapid_mode_in=aspect_rapid_mode, &
dSdt_slow_mode_in=dSdt_slow_mode, &
phi_c_slow_mode_in=phi_c_slow_mode, &
phi_i_mushy_in=phi_i_mushy, &
tfrz_option_in=tfrz_option, kalg_in=kalg, &
fbot_xfer_type_in=fbot_xfer_type)
albicev_in=albicev, albicei_in=albicei, &
albsnowv_in=albsnowv, albsnowi_in=albsnowi, &
natmiter_in=natmiter, ahmax_in=ahmax, shortwave_in=shortwave, &
albedo_type_in=albedo_type, R_ice_in=R_ice, R_pnd_in=R_pnd, &
R_snw_in=R_snw, dT_mlt_in=dT_mlt, rsnw_mlt_in=rsnw_mlt, &
kstrength_in=kstrength, krdg_partic_in=krdg_partic, &
krdg_redist_in=krdg_redist, mu_rdg_in=mu_rdg, &
atmbndy_in=atmbndy, calc_strair_in=calc_strair, &
formdrag_in=formdrag, highfreq_in=highfreq, &
emissivity_in=emissivity, &
kitd_in=kitd, kcatbound_in=kcatbound, hs0_in=hs0, &
dpscale_in=dpscale, frzpnd_in=frzpnd, &
rfracmin_in=rfracmin, rfracmax_in=rfracmax, &
pndaspect_in=pndaspect, hs1_in=hs1, hp1_in=hp1, &
ktherm_in=ktherm, calc_Tsfc_in=calc_Tsfc, &
conduct_in=conduct, a_rapid_mode_in=a_rapid_mode, &
Rac_rapid_mode_in=Rac_rapid_mode, &
aspect_rapid_mode_in=aspect_rapid_mode, &
dSdt_slow_mode_in=dSdt_slow_mode, &
phi_c_slow_mode_in=phi_c_slow_mode, &
phi_i_mushy_in=phi_i_mushy, &
tfrz_option_in=tfrz_option, kalg_in=kalg, &
fbot_xfer_type_in=fbot_xfer_type)
call icepack_init_tracer_numbers(ntrcr_in=ntrcr)
call icepack_init_tracer_flags(tr_iage_in=tr_iage, &
tr_FY_in=tr_FY, tr_lvl_in=tr_lvl, tr_aero_in=tr_aero, &
tr_pond_in=tr_pond, tr_pond_cesm_in=tr_pond_cesm, &
tr_pond_lvl_in=tr_pond_lvl, &
tr_pond_topo_in=tr_pond_topo)
tr_FY_in=tr_FY, tr_lvl_in=tr_lvl, tr_aero_in=tr_aero, &
tr_pond_in=tr_pond, tr_pond_cesm_in=tr_pond_cesm, &
tr_pond_lvl_in=tr_pond_lvl, &
tr_pond_topo_in=tr_pond_topo)
call icepack_init_tracer_indices(nt_Tsfc_in=nt_Tsfc, &
nt_sice_in=nt_sice, nt_qice_in=nt_qice, &
nt_qsno_in=nt_qsno, nt_iage_in=nt_iage, &
nt_fy_in=nt_fy, nt_alvl_in=nt_alvl, nt_vlvl_in=nt_vlvl, &
nt_apnd_in=nt_apnd, nt_hpnd_in=nt_hpnd, nt_ipnd_in=nt_ipnd, &
nt_aero_in=nt_aero)
nt_sice_in=nt_sice, nt_qice_in=nt_qice, &
nt_qsno_in=nt_qsno, nt_iage_in=nt_iage, &
nt_fy_in=nt_fy, nt_alvl_in=nt_alvl, nt_vlvl_in=nt_vlvl, &
nt_apnd_in=nt_apnd, nt_hpnd_in=nt_hpnd, nt_ipnd_in=nt_ipnd, &
nt_aero_in=nt_aero)

call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
Expand Down Expand Up @@ -819,15 +819,15 @@ subroutine init_state
call icepack_query_parameters(heat_capacity_out=heat_capacity)
call icepack_query_tracer_numbers(ntrcr_out=ntrcr)
call icepack_query_tracer_flags(tr_iage_out=tr_iage, &
tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, tr_aero_out=tr_aero, &
tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, &
tr_pond_topo_out=tr_pond_topo)
tr_FY_out=tr_FY, tr_lvl_out=tr_lvl, tr_aero_out=tr_aero, &
tr_pond_cesm_out=tr_pond_cesm, tr_pond_lvl_out=tr_pond_lvl, &
tr_pond_topo_out=tr_pond_topo)
call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, &
nt_sice_out=nt_sice, nt_qice_out=nt_qice, &
nt_qsno_out=nt_qsno, nt_iage_out=nt_iage, nt_fy_out=nt_fy, &
nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, &
nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, &
nt_ipnd_out=nt_ipnd, nt_aero_out=nt_aero)
nt_sice_out=nt_sice, nt_qice_out=nt_qice, &
nt_qsno_out=nt_qsno, nt_iage_out=nt_iage, nt_fy_out=nt_fy, &
nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, &
nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, &
nt_ipnd_out=nt_ipnd, nt_aero_out=nt_aero)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
file=__FILE__,line= __LINE__)
Expand Down Expand Up @@ -973,21 +973,21 @@ subroutine init_state
enddo

if (tmask(i)) &
call icepack_aggregate (ncat, &
aicen(i,:), &
trcrn(i,1:ntrcr,:), &
vicen(i,:), &
vsnon(i,:), &
aice (i), &
trcr (i,1:ntrcr), &
vice (i), &
vsno (i), &
aice0(i), &
ntrcr, &
trcr_depend (1:ntrcr), &
trcr_base (1:ntrcr,:), &
n_trcr_strata(1:ntrcr), &
nt_strata (1:ntrcr,:))
call icepack_aggregate(ncat=ncat, &
trcrn=trcrn(i,1:ntrcr,:), &
aicen=aicen(i,:), &
vicen=vicen(i,:), &
vsnon=vsnon(i,:), &
trcr=trcr (i,1:ntrcr), &
aice=aice (i), &
vice=vice (i), &
vsno=vsno (i), &
aice0=aice0(i), &
ntrcr=ntrcr, &
trcr_depend=trcr_depend(1:ntrcr), &
trcr_base=trcr_base (1:ntrcr,:), &
n_trcr_strata=n_trcr_strata(1:ntrcr), &
nt_strata=nt_strata (1:ntrcr,:))

aice_init(i) = aice(i)

Expand Down Expand Up @@ -1079,8 +1079,8 @@ subroutine set_state_var (nx, &

call icepack_query_tracer_flags(tr_brine_out=tr_brine, tr_lvl_out=tr_lvl)
call icepack_query_tracer_indices( nt_Tsfc_out=nt_Tsfc, nt_qice_out=nt_qice, &
nt_qsno_out=nt_qsno, nt_sice_out=nt_sice, &
nt_fbri_out=nt_fbri, nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl)
nt_qsno_out=nt_qsno, nt_sice_out=nt_sice, &
nt_fbri_out=nt_fbri, nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl)
call icepack_query_parameters(rhos_out=rhos, Lfresh_out=Lfresh, puny_out=puny)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, &
Expand Down Expand Up @@ -1143,12 +1143,14 @@ subroutine set_state_var (nx, &
vicen(i,n) = hinit(n) * ainit(n) ! m
vsnon(i,n) = c0
! tracers
call icepack_init_trcr(Tair (i ), Tf (i ), &
salinz(i,:), Tmltz(i,:), &
Tsfc, &
nilyr, nslyr, &
qin ( :), qsn ( :))

call icepack_init_trcr(Tair = Tair(i), &
Tf = Tf(i), &
Sprofile = salinz(i,:), &
Tprofile = Tmltz(i,:), &
Tsfc = Tsfc, &
nilyr=nilyr, nslyr=nslyr, &
qin=qin(:), qsn=qsn(:))

! surface temperature
trcrn(i,nt_Tsfc,n) = Tsfc ! deg C
! ice enthalpy, salinity
Expand Down Expand Up @@ -1197,12 +1199,14 @@ subroutine set_state_var (nx, &
vicen(i,n) = hinit(n) * ainit(n) ! m
vsnon(i,n) = min(aicen(i,n)*hsno_init,p2*vicen(i,n))
! tracers
call icepack_init_trcr(Tair (i ), Tf (i ), &
salinz(i,:), Tmltz(i,:), &
Tsfc, &
nilyr, nslyr, &
qin ( :), qsn ( :))

call icepack_init_trcr(Tair = Tair(i), &
Tf = Tf(i), &
Sprofile = salinz(i,:), &
Tprofile = Tmltz(i,:), &
Tsfc = Tsfc, &
nilyr=nilyr, nslyr=nslyr, &
qin=qin(:), qsn=qsn(:))

! surface temperature
trcrn(i,nt_Tsfc,n) = Tsfc ! deg C
! ice enthalpy, salinity
Expand Down
Loading

0 comments on commit 68bc397

Please sign in to comment.