diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 4ab4ecadf..8b0fa3a24 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -26,4 +26,4 @@ please refer to: c0) then ar = c1/aicen hs = vsnon*ar - dhs_melts = -melts - dhs_snoice = snoice*rhoi/rhos + hi = vicen*ar else ! ice disappeared during time step ar = c1 - hs = vsnon/aice_old - dhs_melts = -melts - dhs_snoice = snoice*rhoi/rhos + hs = c0 + hi = c0 + if (aice_old > c0) hs = vsnon/aice_old endif - + hilyr = hi/real(nblyr,kind=dbl_kind) + hslyr = hs/real(nslyr,kind=dbl_kind) + dzssl_new = hslyr/c2 + dhs_melts = -melts + dhs_snoice = snoice*rhoi/rhos dhs_evap = hs - (hs_old + dhs_melts - dhs_snoice & + fsnow/rhos*dt) ! trcrn() has units kg/m^3 - if ((vsno_old .le. puny) .or. (vsnon .le. puny)) then - + if (dzssl_new .lt. hs_ssl_min) then ! Put atm BC/dust flux directly into the sea ice do k=1,nbtrcr - flux_bio(k) = flux_bio(k) + & + flux_bio_o(k) = flux_bio(k) + if (hilyr .lt. hs_ssl_min) then + flux_bio(k) = flux_bio(k) + & (trcrn(bio_index(k)+ nblyr+1)*dzssl+ & trcrn(bio_index(k)+ nblyr+2)*dzint)/dt + flux_bio(k) = flux_bio(k) + flux_bio_atm(k) + else + zbgc_snow(k) = zbgc_snow(k) + & + (trcrn(bio_index(k)+ nblyr+1)*dzssl+ & + trcrn(bio_index(k)+ nblyr+2)*dzint) + zbgc_atm(k) = zbgc_atm(k) & + + flux_bio_atm(k)*dt + end if trcrn(bio_index(k) + nblyr+1) = c0 trcrn(bio_index(k) + nblyr+2) = c0 - zbgc_atm(k) = zbgc_atm(k) & - + flux_bio_atm(k)*dt enddo else @@ -565,6 +575,48 @@ subroutine update_snow_bgc (dt, nblyr, & !------------------------------------------------------------------- dzint = dzint + min(dzssl + dhs_evap, c0) dzssl = max(dzssl + dhs_evap, c0) + if (dzssl <= puny) then + do k = 1,nbtrcr + aerosno(k,2) = aerosno(k,2) + aerosno(k,1) + aerosno(k,1) = c0 + end do + end if + if (dzint <= puny) then + do k = 1,nbtrcr + zbgc_snow(k) = zbgc_snow(k) + (aerosno(k,2) + aerosno(k,1)) + aerosno(k,2) = c0 + aerosno(k,1) = c0 + end do + end if + + !------------------------------------------------------------------ + ! snowfall + !------------------------------------------------------------------- + if (fsnow > c0) then + sloss1 = c0 + dz = min(fsnow/rhos*dt,dzssl) + do k = 1, nbtrcr + if (dzssl > puny) & + sloss1 = aerosno(k,1)*dz/dzssl + aerosno(k,1) = max(c0,aerosno(k,1) - sloss1) + aerosno(k,2) = aerosno(k,2) + sloss1 + end do + dzssl = dzssl - dz + fsnow/rhos*dt + dzint = dzint + dz + end if + if (dzssl <= puny) then + do k = 1,nbtrcr + aerosno(k,2) = aerosno(k,2) + aerosno(k,1) + aerosno(k,1) = c0 + end do + end if + if (dzint <= puny) then + do k = 1,nbtrcr + zbgc_snow(k) = zbgc_snow(k) + (aerosno(k,2) + aerosno(k,1)) + aerosno(k,2) = c0 + aerosno(k,1) = c0 + end do + end if !------------------------------------------------------------------- ! surface snow melt @@ -573,38 +625,37 @@ subroutine update_snow_bgc (dt, nblyr, & do k = 1, nbtrcr sloss1 = c0 sloss2 = c0 - if (dzssl > puny) & - sloss1 = kscavz(k)*aerosno(k,1) & - *min(-dhs_melts,dzssl)/dzssl - aerosno(k,1) = aerosno(k,1) - sloss1 - if (dzint > puny) & - sloss2 = kscavz(k)*aerosno(k,2) & - *max(-dhs_melts-dzssl,c0)/dzint - aerosno(k,2) = aerosno(k,2) - sloss2 - zbgc_snow(k) = zbgc_snow(k) + (sloss1+sloss2) - enddo ! + if (dzssl > puny) & + sloss1 = kscavz(bio_index_o(k))*aerosno(k,1) & + *min(-dhs_melts,dzssl)/dzssl + aerosno(k,1) = max(c0,aerosno(k,1) - sloss1) + if (dzint > puny) & + sloss2 = kscavz(bio_index_o(k))*aerosno(k,2) & + *max(-dhs_melts-dzssl,c0)/dzint + aerosno(k,2) = max(c0,aerosno(k,2) - sloss2) + zbgc_snow(k) = zbgc_snow(k) + (sloss1+sloss2) ! all not scavenged ends in ice + enddo ! update snow thickness dzint=dzint+min(dzssl+dhs_melts, c0) dzssl=max(dzssl+dhs_melts, c0) - if ( dzssl <= puny ) then ! ssl melts away - aerosno(:,2) = aerosno(:,1) + aerosno(:,2) - aerosno(:,1) = c0 + if ( dzssl .le. puny ) then ! ssl melts away + do k = 1,nbtrcr + aerosno(k,2) = aerosno(k,1) + aerosno(k,2) + aerosno(k,1) = c0 + end do dzssl = max(dzssl, c0) endif - if (dzint <= puny ) then ! all snow melts away - zbgc_snow(:) = zbgc_snow(:) & - + max(c0,aerosno(:,1) + aerosno(:,2)) - aerosno(:,:) = c0 + if (dzint .le. puny ) then ! all snow melts away + do k = 1,nbtrcr + zbgc_snow(k) = zbgc_snow(k) & + + aerosno(k,1) + aerosno(k,2) + aerosno(k,:) = c0 + enddo dzint = max(dzint, c0) endif - endif - - !------------------------------------------------------------------- - ! snowfall - !------------------------------------------------------------------- - if (fsnow > c0) dzssl = dzssl + fsnow/rhos*dt + endif ! -dhs_melts > puny !------------------------------------------------------------------- ! snow-ice formation @@ -613,39 +664,41 @@ subroutine update_snow_bgc (dt, nblyr, & do k = 1, nbtrcr sloss1 = c0 sloss2 = c0 - if (dzint > puny) & - sloss2 = min(dhs_snoice, dzint) & - *aerosno(k,2)/dzint - aerosno(k,2) = aerosno(k,2) - sloss2 - if (dzssl > puny) & + if (dzint > puny .and. aerosno(k,2) > c0) & + sloss2 = min(dhs_snoice, dzint) & + *aerosno(k,2)/dzint + aerosno(k,2) = max(c0,aerosno(k,2) - sloss2) + if (dzssl > puny .and. aerosno(k,1) > c0) & sloss1 = max(dhs_snoice-dzint, c0) & *aerosno(k,1)/dzssl - aerosno(k,1) = aerosno(k,1) - sloss1 + + aerosno(k,1) = max(c0,aerosno(k,1) - sloss1) + flux_bio(k) = flux_bio(k) & + + kscavz(bio_index_o(k)) * (sloss2+sloss1)/dt zbgc_snow(k) = zbgc_snow(k) & - + (sloss2+sloss1) + + (c1-kscavz(bio_index_o(k)))*(sloss2+sloss1) enddo - dzssl = dzssl - max(dhs_snoice-dzint, c0) + dzssl = max(c0,dzssl - max(dhs_snoice-dzint, c0)) dzint = max(dzint-dhs_snoice, c0) - endif + endif ! dhs_snowice > puny !------------------------------------------------------------------- ! aerosol deposition !------------------------------------------------------------------- - if (aicen > c0) then - hs = vsnon * ar - else - hs = c0 - endif - if (hs >= hs_min) then !should this really be hs_min or 0? - ! should use same hs_min value as in radiation + ! Spread out the atm dust flux in the snow interior for small snow surface layers + if (dzssl .ge. hs_ssl*p5) then + do k=1,nbtrcr aerosno(k,1) = aerosno(k,1) & + flux_bio_atm(k)*dt enddo else + dz = (hs_ssl*p5 - dzssl)/(hs_ssl*p5) do k=1,nbtrcr - zbgc_atm(k) = zbgc_atm(k) & - + flux_bio_atm(k)*dt + aerosno(k,1) = aerosno(k,1) & + + flux_bio_atm(k)*dt*(c1-dz) + aerosno(k,2) = aerosno(k,2) & + + flux_bio_atm(k)*dt*dz enddo endif @@ -665,30 +718,31 @@ subroutine update_snow_bgc (dt, nblyr, & endif if (dzint <= puny) then ! nothing in Snow Int do k = 1, nbtrcr - zbgc_snow(k) = zbgc_snow(k) + max(c0,aerosno(k,2)) + zbgc_snow(k) = zbgc_snow(k) + max(c0,aerosno(k,2)+aerosno(k,1)) + aerosno(k,1) = c0 aerosno(k,2) = c0 enddo endif hslyr = hs/real(nslyr,kind=dbl_kind) - dzssl_new = min(hslyr/c2, hs_ssl) - dzint_new = hs - dzssl_new + dzssl_new = hslyr/c2 + dzint_new = max(c0,hs - dzssl_new) - if (hs > hs_min) then !should this really be hs_min or 0? + if (hs > hs_min) then do k = 1, nbtrcr dznew = min(dzssl_new-dzssl, c0) sloss1 = c0 - if (dzssl > puny) & + if (dzssl > puny .and. aerosno(k,1) > c0) & sloss1 = dznew*aerosno(k,1)/dzssl ! not neccesarily a loss - dznew = max(dzssl_new-dzssl, c0) - if (dzint > puny) & - sloss1 = sloss1 + aerosno(k,2)*dznew/dzint - aerosno(k,1) = aerosno(k,1) + sloss1 - aerosno(k,2) = aerosno(k,2) - sloss1 + dznew = max(dzssl_new-dzssl, c0) + if (dzint > puny .and. aerosno(k,2) > c0) & + sloss1 = aerosno(k,2)*dznew/dzint + aerosno(k,1) = max(c0,aerosno(k,1) + sloss1) + aerosno(k,2) = max(c0,aerosno(k,2) - sloss1) enddo else zbgc_snow(:) = zbgc_snow(:) & - + max(c0,aerosno(:,1) + aerosno(:,2)) + + aerosno(:,1) + aerosno(:,2) aerosno(:,:) = c0 endif @@ -701,6 +755,11 @@ subroutine update_snow_bgc (dt, nblyr, & aero_cons(k) = aerotot(k)-aerotot0(k) & - ( flux_bio_atm(k) & - (flux_bio(k)-flux_bio_o(k))) * dt + if (aerotot0(k) > aerotot(k) .and. aerotot0(k) > c0) then + aero_cons(k) = aero_cons(k)/aerotot0(k) + else if (aerotot(k) > c0) then + aero_cons(k) = aero_cons(k)/aerotot(k) + end if if (aero_cons(k) > puny .or. zbgc_snow(k) + zbgc_atm(k) < c0) then write(warnstr,*) subname, 'Conservation failure: aerosols in snow' call icepack_warnings_add(warnstr) @@ -729,18 +788,18 @@ subroutine update_snow_bgc (dt, nblyr, & !------------------------------------------------------------------- ! reload tracers !------------------------------------------------------------------- - if (vsnon > puny) then + if (dzssl_new > puny .and. dzint_new > puny .and. vsnon > puny) then do k = 1,nbtrcr trcrn(bio_index(k)+nblyr+1)=aerosno(k,1)/dzssl_new trcrn(bio_index(k)+nblyr+2)=aerosno(k,2)/dzint_new enddo else do k = 1,nbtrcr - zbgc_snow(k) = (zbgc_snow(k) + aerosno(k,1) + aerosno(k,2)) trcrn(bio_index(k)+nblyr+1)= c0 trcrn(bio_index(k)+nblyr+2)= c0 enddo endif + !------------------------------------------------------------------- ! check for negative values !------------------------------------------------------------------- diff --git a/columnphysics/icepack_algae.F90 b/columnphysics/icepack_algae.F90 index 0ffd880a2..7a958ee82 100644 --- a/columnphysics/icepack_algae.F90 +++ b/columnphysics/icepack_algae.F90 @@ -10,11 +10,11 @@ module icepack_algae use icepack_kinds - use icepack_parameters, only: p05, p5, c0, c1, c2, c6, c10 + use icepack_parameters, only: p05, p5, c0, c1, c2, c6, c10, p1 use icepack_parameters, only: pi, secday, puny use icepack_parameters, only: hs_ssl, sk_l - use icepack_parameters, only: dEdd_algae, solve_zbgc + use icepack_parameters, only: dEdd_algae, solve_zbgc, use_atm_dust_iron use icepack_parameters, only: R_dFe2dust, dustFe_sol, algal_vel use icepack_parameters, only: bgc_flux_type use icepack_parameters, only: grid_o @@ -27,11 +27,14 @@ module icepack_algae use icepack_parameters, only: y_sk_DMS , t_sk_conv use icepack_parameters, only: t_sk_ox - use icepack_tracers, only: ntrcr, bio_index + use icepack_tracers, only: nblyr, nilyr, nslyr, ntrcr, nbtrcr + use icepack_tracers, only: n_algae, n_doc, n_dic, n_don, n_fed, n_fep, n_zaero + use icepack_tracers, only: bio_index, bio_index_o use icepack_tracers, only: nt_bgc_N, nt_fbri, nt_zbgc_frac use icepack_tracers, only: tr_brine + use icepack_tracers, only: nt_bgc_DON, nt_bgc_hum, nt_bgc_DOC use icepack_tracers, only: tr_bgc_Nit, tr_bgc_Am, tr_bgc_Sil - use icepack_tracers, only: tr_bgc_DMS, tr_bgc_PON + use icepack_tracers, only: tr_bgc_DMS, tr_bgc_PON, tr_bgc_hum use icepack_tracers, only: tr_bgc_N, tr_bgc_C, tr_bgc_chl use icepack_tracers, only: tr_bgc_DON, tr_bgc_Fe, tr_zaero use icepack_tracers, only: nlt_bgc_Nit, nlt_bgc_Am, nlt_bgc_Sil @@ -39,21 +42,23 @@ module icepack_algae use icepack_tracers, only: nlt_bgc_N, nlt_bgc_C, nlt_bgc_chl use icepack_tracers, only: nlt_bgc_DOC, nlt_bgc_DON, nlt_bgc_DIC use icepack_tracers, only: nlt_zaero , nlt_bgc_DMSPp,nlt_bgc_DMSPd - use icepack_tracers, only: nlt_bgc_Fed, nlt_bgc_Fep + use icepack_tracers, only: nlt_bgc_Fed, nlt_bgc_Fep, nlt_bgc_hum use icepack_zbgc_shared, only: remap_zbgc, regrid_stationary use icepack_zbgc_shared, only: merge_bgc_fluxes use icepack_zbgc_shared, only: merge_bgc_fluxes_skl + use icepack_zbgc_shared, only: bgrid, cgrid, igrid, icgrid use icepack_zbgc_shared, only: phi_sk, bgc_tracer_type use icepack_zbgc_shared, only: zbgc_init_frac use icepack_zbgc_shared, only: zbgc_frac_init use icepack_zbgc_shared, only: tau_rel, tau_ret, thinS - use icepack_zbgc_shared, only: r_Si2N, R_Fe2N, R_S2N, R_chl2N + use icepack_zbgc_shared, only: r_Si2N, R_Fe2N, R_S2N, R_C2N_DON use icepack_zbgc_shared, only: chlabs, alpha2max_low, beta2max, mu_max use icepack_zbgc_shared, only: k_exude, K_Nit, K_Am, K_Sil, K_Fe use icepack_zbgc_shared, only: grow_Tdep, fr_graze, mort_pre, mort_Tdep use icepack_zbgc_shared, only: f_don, kn_bac, f_don_Am use icepack_zbgc_shared, only: f_doc, f_exude, k_bac, R_chl2N, R_C2N + use icepack_zbgc_shared, only: graze_exponent, graze_conc, large_bgc use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -66,63 +71,53 @@ module icepack_algae public :: zbio, sklbio real (kind=dbl_kind), parameter :: & - exp_argmax = c10 ! maximum argument of exponential - + exp_argmax = c10, & ! maximum argument of exponential + accuracy = 1.0e-13_dbl_kind ! accuracy parameter for bgc tracers !======================================================================= contains !======================================================================= - subroutine zbio (dt, nblyr, & - nslyr, nilyr, & + subroutine zbio (dt, & meltt, melts, & meltb, congel, & - snoice, nbtrcr, & - fsnow, ntrcr, & + snoice, fsnow, & trcrn, bio_index, & - aice_old, & + bio_index_o, aice_old, & vice_old, vsno_old, & vicen, vsnon, & aicen, flux_bio_atm,& - n_cat, n_algae, & - n_doc, n_dic, & - n_don, & - n_fed, n_fep, & - n_zaero, first_ice, & + n_cat, first_ice, & hice_old, ocean_bio, & + ocean_bio_dh, & bphin, iphin, & - iDin, & + iDin, & fswthrul, & dh_top, dh_bot, & zfswin, & hbri, hbri_old, & -! darcy_V, darcy_V_chl, & - darcy_V, & - bgrid, & - igrid, icgrid, & + darcy_V, & bphi_min, & - iTin, & + iTin, & Zoo, & flux_bio, dh_direct, & upNO, upNH, & fbio_snoice, fbio_atmice, & PP_net, ice_bio_net, & - snow_bio_net, grow_net ) + snow_bio_net, grow_net, & + totalChla, & + flux_bion, iSin, & + bioPorosityIceCell, & + bioSalinityIceCell, & + bioTemperatureIceCell ) integer (kind=int_kind), intent(in) :: & - nblyr, & ! number of bio layers - nslyr, & ! number of snow layers - nilyr, & ! number of ice layers - nbtrcr, & ! number of distinct bio tracers - n_cat, & ! category number - n_algae, & ! number of autotrophs - n_zaero, & ! number of aerosols - n_doc, n_dic, n_don, n_fed, n_fep, & - ntrcr ! number of tracers + n_cat ! category number integer (kind=int_kind), dimension (nbtrcr), intent(in) :: & - bio_index + bio_index, & ! references index of bio tracer (nbtrcr) to tracer array (ntrcr) + bio_index_o ! references index of data arrays (eg. kscavz) real (kind=dbl_kind), intent(in) :: & dt, & ! time step @@ -152,22 +147,19 @@ subroutine zbio (dt, nblyr, & ice_bio_net, & ! net bio tracer in ice (mmol/m^2) fbio_atmice, & ! bio flux from atm to ice (mmol/m^2/s) fbio_snoice, & ! bio flux from snow to ice (mmol/m^2/s) - flux_bio ! total ocean tracer flux (mmol/m^2/s) + flux_bio, & ! total ocean tracer flux (mmol/m^2/s) + flux_bion ! category ocean tracer flux (mmol/m^2/s) - real (kind=dbl_kind), intent(inout) :: & + real (kind=dbl_kind), intent(in) :: & hbri_old ! brine height (m) - real (kind=dbl_kind), dimension (nblyr+2), intent(inout) :: & - bgrid ! biology nondimensional vertical grid points - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - igrid , & ! biology vertical interface points iTin , & ! salinity vertical interface points iphin , & ! Porosity on the igrid - iDin ! Diffusivity/h on the igrid (1/s) + iDin , & ! Diffusivity/h on the igrid (1/s) + iSin ! Salinity on vertical interface points (ppt) real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: & - icgrid , & ! CICE interface coordinate fswthrul ! visible short wave radiation on icgrid (W/m^2) real (kind=dbl_kind), dimension(nbtrcr), intent(in) :: & @@ -187,6 +179,10 @@ subroutine zbio (dt, nblyr, & !change to inout when updating ocean fields ocean_bio ! ocean concentrations (mmol/m^3) + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + !change to inout when updating ocean fields + ocean_bio_dh ! ocean concentrations * hbrine * phi (mmol/m^2) + real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & bphin ! Porosity on the bgrid @@ -196,6 +192,14 @@ subroutine zbio (dt, nblyr, & upNO , & ! tot nitrate uptake rate (mmol/m^2/d) times aice upNH ! tot ammonium uptake rate (mmol/m^2/d) times aice + real (kind=dbl_kind), optional, intent(inout):: & + totalChla ! total chla (mg chla/m^2) + + real (kind=dbl_kind), optional, dimension (:), intent(inout):: & ! diagnostics (nblyr+1) + bioPorosityIceCell , & ! porosity on vertical interface points + bioSalinityIceCell , & ! salinity on vertical interface points (ppt) + bioTemperatureIceCell ! temperature on vertical interface points (oC) + logical (kind=log_kind), intent(in) :: & first_ice ! initialized values should be used @@ -209,9 +213,6 @@ subroutine zbio (dt, nblyr, & upNHn , & ! algal ammonium uptake rate (mmol/m^3/s) grow_alg ! algal growth rate (mmol/m^3/s) - real (kind=dbl_kind), dimension (nbtrcr) :: & - flux_bion !tracer flux to ocean - real (kind=dbl_kind),dimension(nbtrcr) :: & zbgc_snown, & ! aerosol contribution from snow to ice zbgc_atmn ! and atm to ice concentration * volume (mmol/m^3*m) @@ -223,13 +224,17 @@ subroutine zbio (dt, nblyr, & real (kind=dbl_kind) :: & hsnow_i, & ! initial snow thickness (m) - hsnow_f ! final snow thickness (m) - - logical (kind=log_kind) :: & - write_flux_diag + hsnow_f, & ! final snow thickness (m) + carbonError ! carbon conservation error (mmol/m2) real (kind=dbl_kind) :: & - a_ice + carbonInitial, & ! initial carbon content (mmol/m2) + carbonFinal, & ! final carbon content (mmol/m2) + carbonFlux ! carbon flux (mmol/m2/s) + + logical (kind=log_kind) :: & + write_flux_diag, & + write_carbon_errors character(len=*),parameter :: subname='(zbio)' @@ -239,58 +244,55 @@ subroutine zbio (dt, nblyr, & flux_bio_sno(:) = c0 Tot_BGC_i (:) = c0 Tot_BGC_f (:) = c0 + Zoo (:) = c0 hsnow_i = c0 hsnow_f = c0 write_flux_diag = .false. + write_carbon_errors = .true. + if (.not. tr_bgc_C) write_carbon_errors = .false. - if (write_flux_diag) then - if (aice_old > c0) then - hsnow_i = vsno_old/aice_old - do mm = 1,nbtrcr - call bgc_column_sum (nblyr, nslyr, hsnow_i, hbri_old, & + call bgc_carbon_sum(hbri_old, trcrn(:), carbonInitial) + if (icepack_warnings_aborted(subname)) return + + if (aice_old > puny) then + hsnow_i = vsno_old/aice_old + do mm = 1,nbtrcr + call bgc_column_sum (hsnow_i, hbri_old, & trcrn(bio_index(mm):bio_index(mm)+nblyr+2), & Tot_BGC_i(mm)) - if (icepack_warnings_aborted(subname)) return - enddo - endif + if (icepack_warnings_aborted(subname)) return + enddo endif - call update_snow_bgc (dt, nblyr, & - nslyr, & + call update_snow_bgc (dt, & meltt, melts, & meltb, congel, & - snoice, nbtrcr, & - fsnow, ntrcr, & + snoice, fsnow, & trcrn, bio_index, & aice_old, zbgc_snown, & vice_old, vsno_old, & vicen, vsnon, & aicen, flux_bio_atm, & - zbgc_atmn, flux_bio_sno) + zbgc_atmn, flux_bio_sno, & + bio_index_o) + if (icepack_warnings_aborted(subname)) return call z_biogeochemistry (n_cat, dt, & - nilyr, & - nblyr, nbtrcr, & - n_algae, n_doc, & - n_dic, n_don, & - n_fed, n_fep, & - n_zaero, first_ice, & + first_ice, & aicen, vicen, & hice_old, ocean_bio, & + ocean_bio_dh, & flux_bion, bphin, & iphin, trcrn, & - iDin, & + iDin, & fswthrul, grow_alg, & upNOn, upNHn, & dh_top, dh_bot, & zfswin, hbri, & hbri_old, darcy_V, & -! darcy_V_chl, bgrid, & - bgrid, & - igrid, icgrid, & bphi_min, zbgc_snown,& - zbgc_atmn, & + zbgc_atmn, & iTin, dh_direct, & Zoo, meltb, & congel ) @@ -300,11 +302,71 @@ subroutine zbio (dt, nblyr, & flux_bion(mm) = flux_bion(mm) + flux_bio_sno(mm) enddo + call bgc_carbon_sum(hbri, trcrn(:), carbonFinal) + if (icepack_warnings_aborted(subname)) return + call bgc_carbon_flux(flux_bio_atm,flux_bion,carbonFlux) + if (icepack_warnings_aborted(subname)) return + + carbonError = carbonInitial-carbonFlux*dt-carbonFinal + + if (abs(carbonError) > max(puny,accuracy * maxval ((/carbonInitial, carbonFinal/))) .and. write_carbon_errors) then + write(warnstr,*) subname, 'carbonError:', carbonError + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'carbonInitial:', carbonInitial + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'carbonFinal:', carbonFinal + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'carbonFlux (positive into ocean):', carbonFlux + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'accuracy * maxval ((/carbonInitial, carbonFinal/:)', accuracy * maxval ((/carbonInitial, carbonFinal/)) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'puny', puny + call icepack_warnings_add(warnstr) + if (aicen > c0) then + hsnow_f = vsnon/aicen + write(warnstr,*) subname, 'after z_biogeochemistry' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Remaining carbon after algal_dyn: Zoo' + call icepack_warnings_add(warnstr) + do mm = 1,nblyr+1 + write(warnstr,*) subname, 'layer mm, Zoo(mm)' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, mm,Zoo(mm) + call icepack_warnings_add(warnstr) + end do + do mm = 1,nbtrcr + call bgc_column_sum (hsnow_f, hbri, & + trcrn(bio_index(mm):bio_index(mm)+nblyr+2), & + Tot_BGC_f(mm)) + write(warnstr,*) subname, 'mm, Tot_BGC_i(mm), Tot_BGC_f(mm)' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, mm, Tot_BGC_i(mm), Tot_BGC_f(mm) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'flux_bion(mm), flux_bio_atm(mm)' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, flux_bion(mm), flux_bio_atm(mm) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'zbgc_snown(mm),zbgc_atmn(mm)' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, zbgc_snown(mm),zbgc_atmn(mm) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Tot_BGC_i(mm) + flux_bio_atm(mm)*dt - flux_bion(mm)*dt' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, Tot_BGC_i(mm) + flux_bio_atm(mm)*dt - flux_bion(mm)*dt + call icepack_warnings_add(warnstr) + enddo + endif + !call icepack_warnings_add(warnstr) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + call icepack_warnings_add(subname//" zbio: Carbon conservation failure after z_biogeochemistry") + endif + if (icepack_warnings_aborted(subname)) return + if (write_flux_diag) then if (aicen > c0) then hsnow_f = vsnon/aicen do mm = 1,nbtrcr - call bgc_column_sum (nblyr, nslyr, hsnow_f, hbri, & + call bgc_column_sum (hsnow_f, hbri, & trcrn(bio_index(mm):bio_index(mm)+nblyr+2), & Tot_BGC_f(mm)) write(warnstr,*) subname, 'mm, Tot_BGC_i(mm), Tot_BGC_f(mm)' @@ -326,16 +388,14 @@ subroutine zbio (dt, nblyr, & enddo endif endif - if (icepack_warnings_aborted(subname)) return - call merge_bgc_fluxes (dt, nblyr, & - nslyr, & - bio_index, n_algae, & - nbtrcr, aicen, & + call merge_bgc_fluxes (dt, & + bio_index, & + aicen, & vicen, vsnon, & - iphin, & - trcrn, & + iphin, &! ntrcr + trcrn, aice_old, &!aice_old flux_bion, flux_bio, & upNOn, upNHn, & upNO, upNH, & @@ -343,13 +403,15 @@ subroutine zbio (dt, nblyr, & fbio_snoice, fbio_atmice,& PP_net, ice_bio_net,& snow_bio_net, grow_alg, & - grow_net) + grow_net, totalChla, & + iTin, iSin, & + bioPorosityIceCell, & + bioSalinityIceCell, & + bioTemperatureIceCell) if (icepack_warnings_aborted(subname)) return if (write_flux_diag) then if (aicen > c0) then - if (n_cat .eq. 1) a_ice = c0 - a_ice = a_ice + aicen write(warnstr,*) subname, 'after merge_bgc_fluxes, n_cat:', n_cat call icepack_warnings_add(warnstr) do mm = 1,nbtrcr @@ -361,21 +423,18 @@ subroutine zbio (dt, nblyr, & call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'flux_bio_atm(mm)', flux_bio_atm(mm) call icepack_warnings_add(warnstr) - write(warnstr,*) subname, 'flux_bio_atm(mm)*a_ice', flux_bio_atm(mm)*a_ice + write(warnstr,*) subname, 'flux_bio_atm(mm)*aicen', flux_bio_atm(mm)*aicen call icepack_warnings_add(warnstr) enddo endif endif + if (icepack_warnings_aborted(subname)) return end subroutine zbio !======================================================================= - subroutine sklbio (dt, ntrcr, & - nbtrcr, n_algae, & - n_doc, & - n_dic, n_don, & - n_fed, n_fep, & + subroutine sklbio (dt, Tf, & flux_bio, ocean_bio, & aicen, & meltb, congel, & @@ -384,19 +443,12 @@ subroutine sklbio (dt, ntrcr, & PP_net, upNO, & upNH, grow_net ) - integer (kind=int_kind), intent(in) :: & - nbtrcr, & ! number of distinct bio tracers - n_algae, & ! number of autotrophs - n_doc, n_dic, & ! number of dissolved organic, inorganic carbon - n_don, & ! number of dissolved organic nitrogen - n_fed, n_fep, & ! number of iron - ntrcr ! number of tracers - logical (kind=log_kind), intent(in) :: & first_ice ! initialized values should be used real (kind=dbl_kind), intent(in) :: & dt, & ! time step + Tf, & ! basal freezing temperature (C) ! hmix, & ! mixed layer depth (m) aicen, & ! ice area fraction meltb, & ! bottom melt (m) @@ -437,19 +489,16 @@ subroutine sklbio (dt, ntrcr, & grow_alg (:) = c0 call skl_biogeochemistry (dt, & - n_doc, & - n_dic, n_don, & - n_fed, n_fep, & - nbtrcr, n_algae, & flux_bion, ocean_bio, & ! hmix, aicen, & meltb, congel, & fswthru, first_ice, & trcrn, upNOn, & - upNHn, grow_alg) + upNHn, grow_alg, & + Tf) if (icepack_warnings_aborted(subname)) return - call merge_bgc_fluxes_skl (nbtrcr, n_algae, & + call merge_bgc_fluxes_skl ( & aicen, trcrn, & flux_bion, flux_bio, & PP_net, upNOn, & @@ -465,20 +514,13 @@ end subroutine sklbio ! skeletal layer biochemistry ! subroutine skl_biogeochemistry (dt, & - n_doc, & - n_dic, n_don, & - n_fed, n_fep, & - nbtrcr, n_algae, & flux_bio, ocean_bio, & ! hmix, aicen, & meltb, congel, & fswthru, first_ice, & trcrn, upNOn, & - upNHn, grow_alg_skl) - - integer (kind=int_kind), intent(in) :: & - n_doc, n_dic, n_don, n_fed, n_fep, & - nbtrcr , n_algae ! number of bgc tracers and number algae + upNHn, grow_alg_skl, & + Tf) real (kind=dbl_kind), intent(in) :: & dt , & ! time step @@ -486,6 +528,7 @@ subroutine skl_biogeochemistry (dt, & ! aicen , & ! ice area meltb , & ! bottom ice melt congel , & ! bottom ice growth + Tf , & ! bottom freezing temperature fswthru ! shortwave passing through ice to ocean logical (kind=log_kind), intent(in) :: & @@ -530,20 +573,20 @@ subroutine skl_biogeochemistry (dt, & grow_val , & ! (m/x) rphi_sk , & ! 1 / skeletal layer porosity cinit_tmp , & ! temporary variable for concentration (mmol/m^2) - Nerror ! change in total nitrogen from reactions + Cerror , & ! change in total carbon from reactions (mmol/m^3) + nitrification ! nitrate from nitrification (mmol/m^3) real (kind=dbl_kind), parameter :: & PVc = 1.e-6_dbl_kind , & ! type 'constant' piston velocity for interface (m/s) PV_scale_growth = p5 , & ! scale factor in Jin code PV during ice growth PV_scale_melt = p05 , & ! scale factor in Jin code PV during ice melt growth_max = 1.85e-5_dbl_kind , & ! PVt function reaches maximum here. (m/s) - Tin_bot = -1.8_dbl_kind , & ! temperature of the ice bottom (oC) MJ1 = 9.667e-9_dbl_kind , & ! (m/s) coefficients in Jin2008 MJ2 = 38.8_dbl_kind , & ! (1) from:4.49e-4_dbl_kind*secday MJ3 = 1.04e7_dbl_kind , & ! 1/(m/s) from: 1.39e-3_dbl_kind*secday^2 PV_frac_max = 0.9_dbl_kind ! Maximum Piston velocity is 90% of skeletal layer/dt - logical (kind=log_kind) :: conserve_N + logical (kind=log_kind) :: conserve_C character(len=*),parameter :: subname='(skl_biogeochemistry)' @@ -551,11 +594,12 @@ subroutine skl_biogeochemistry (dt, & ! Initialize !----------------------------------------------------------------- - conserve_N = .true. + conserve_C = .true. Zoo_skl = c0 rphi_sk = c1/phi_sk PVt = c0 - iTin = Tin_bot + iTin = Tf + ice_growth = (congel-meltb)/dt do nn = 1, nbtrcr cinit (nn) = c0 @@ -577,10 +621,6 @@ subroutine skl_biogeochemistry (dt, & cling (nn) = c1 endif - ice_growth = (congel-meltb)/dt - if (first_ice) then - trcrn(bio_index(nn)) = ocean_bio(nn) ! * sk_l*rphi_sk - endif ! first_ice cinit (nn) = trcrn(bio_index(nn)) * sk_l * rphi_sk cinit_v(nn) = cinit(nn)/sk_l if (cinit(nn) < c0) then @@ -588,7 +628,7 @@ subroutine skl_biogeochemistry (dt, & nn,nbtrcr,cinit(nn) call icepack_warnings_add(warnstr) call icepack_warnings_add(subname//' cinit < c0') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) return endif enddo ! nbtrcr @@ -657,16 +697,16 @@ subroutine skl_biogeochemistry (dt, & react(:) = c0 grow_alg_skl(:) = c0 - call algal_dyn (dt, & - n_doc, n_dic, n_don, n_fed, n_fep, & - dEdd_algae, & + call algal_dyn (dt, & + dEdd_algae, & fswthru, react, & - cinit_v, & - grow_alg_skl(:), n_algae, & + cinit_v, & + grow_alg_skl(:), & iTin, & - upNOn(:), upNHn(:), & + upNOn(:), upNHn(:), & Zoo_skl, & - Nerror, conserve_N) + Cerror, conserve_C,& + nitrification) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -697,8 +737,8 @@ subroutine skl_biogeochemistry (dt, & ! Currently not coupled with ocean biogeochemistry ! ocean_bio(nn) = ocean_bio(nn) + flux_bio(nn)/hmix*aicen - if (.not. conserve_N) then - write(warnstr,*) subname, 'N not conserved in skl_bgc, Nerror:',Nerror + if (.not. conserve_C) then + write(warnstr,*) subname, 'C not conserved in skl_bgc, Cerror:',Cerror call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'sk_bgc < 0 after algal fluxes, nn,cinit,flux_bio',& nn,cinit(nn),flux_bio(nn) @@ -711,7 +751,7 @@ subroutine skl_biogeochemistry (dt, & write(warnstr,*) subname, 'congel, meltb: ',congel,meltb call icepack_warnings_add(warnstr) call icepack_warnings_add(subname//' N not conserved in skl_bgc') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) elseif (cinit(nn) < c0) then write(warnstr,*) subname, 'sk_bgc < 0 after algal fluxes, nn,cinit,flux_bio',& nn,cinit(nn),flux_bio(nn) @@ -724,7 +764,7 @@ subroutine skl_biogeochemistry (dt, & write(warnstr,*) subname, 'congel, meltb: ',congel,meltb call icepack_warnings_add(warnstr) call icepack_warnings_add(subname//'sk_bgc < 0 after algal fluxes') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) endif if (icepack_warnings_aborted(subname)) return @@ -751,38 +791,26 @@ end subroutine skl_biogeochemistry ! subroutine z_biogeochemistry (n_cat, dt, & - nilyr, & - nblyr, nbtrcr, & - n_algae, n_doc, & - n_dic, n_don, & - n_fed, n_fep, & - n_zaero, first_ice, & + first_ice, & aicen, vicen, & hice_old, ocean_bio, & + ocean_bio_dh, & flux_bio, bphin, & iphin, trcrn, & - iDin, & + iDin, & fswthrul, grow_alg, & upNOn, upNHn, & dh_top, dh_bot, & zfswin, hbri, & hbri_old, darcy_V, & -! darcy_V_chl, bgrid, & - bgrid, & - i_grid, ic_grid, & bphi_min, zbgc_snow, & - zbgc_atm, & + zbgc_atm, & iTin, dh_direct, & Zoo, meltb, & congel ) integer (kind=int_kind), intent(in) :: & - n_cat, & ! category number - nilyr, & ! number of ice layers - nblyr, & ! number of bio layers - nbtrcr, n_algae, & ! number of bgc tracers, number of autotrophs - n_zaero, & ! number of aerosols - n_doc, n_dic, n_don, n_fed, n_fep + n_cat ! category number logical (kind=log_kind), intent(in) :: & first_ice ! initialized values should be used @@ -797,13 +825,11 @@ subroutine z_biogeochemistry (n_cat, dt, & meltb , & ! bottom melt in dt (m) congel , & ! bottom growth in dt (m) darcy_V , & ! darcy velocity -! darcy_V_chl, & ! darcy velocity for algae dh_bot , & ! change in brine bottom (m) dh_top , & ! change in brine top (m) dh_direct ! surface flooding or runoff (m) real (kind=dbl_kind), dimension (:), intent(inout) :: & - bgrid , & ! biology nondimensional vertical grid points flux_bio , & ! total ocean tracer flux (mmol/m^2/s) zfswin , & ! visible Short wave flux on igrid (W/m^2) Zoo , & ! N losses to the system from reaction terms @@ -811,18 +837,19 @@ subroutine z_biogeochemistry (n_cat, dt, & trcrn ! bulk tracer concentration (mmol/m^3) real (kind=dbl_kind), dimension (:), intent(in) :: & - i_grid , & ! biology vertical interface points iTin , & ! salinity vertical interface points iphin , & ! Porosity on the igrid iDin , & ! Diffusivity/h on the igrid (1/s) - ic_grid , & ! CICE interface coordinate fswthrul , & ! visible short wave radiation on icgrid (W/m^2) zbgc_snow , & ! tracer input from snow (mmol/m^3*m) zbgc_atm , & ! tracer input from atm (mmol/m^3 *m) ocean_bio , & ! ocean concentrations (mmol/m^3) bphin ! Porosity on the bgrid - real (kind=dbl_kind), intent(inout) :: & + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + ocean_bio_dh ! ocean concentrations * hbrine * phi (mmol/m^2) + + real (kind=dbl_kind), intent(in) :: & hbri_old ! brine height (m) real (kind=dbl_kind), dimension (:,:), intent(out) :: & @@ -846,6 +873,7 @@ subroutine z_biogeochemistry (n_cat, dt, & hin , & ! ice thickness (m) hin_old , & ! ice thickness before current melt/growth (m) ice_conc , & ! algal concentration in ice above hin > hinS + sum_initial , & ! sum_old , & ! sum_new , & ! sum_tot , & ! @@ -869,7 +897,7 @@ subroutine z_biogeochemistry (n_cat, dt, & D_spdiag , & ! artificial diffusion matrix D_sbdiag , & ! artificial diffusion matrix biomat_low , & ! Low order solution - Nerror ! Change in N after reactions + Cerror ! Change in N after reactions real (kind=dbl_kind), dimension(nblyr+1,nbtrcr):: & react ! biological sources and sinks for equation matrix @@ -897,7 +925,7 @@ subroutine z_biogeochemistry (n_cat, dt, & trtmp ! temporary, remapped tracers logical (kind=log_kind), dimension(nblyr+1) :: & - conserve_N + conserve_C real (kind=dbl_kind), dimension(nblyr+1):: & ! temporary variables for Diff , & ! diffusivity @@ -905,7 +933,9 @@ subroutine z_biogeochemistry (n_cat, dt, & biocons , & ! new concentration dmobile , & ! initcons_mobile,&! - initcons_stationary + initcons_stationary, & + dz , & ! normalized vertical grid spacing + nitrification ! nitrate produced from nitrification (mmol/m3) real (kind=dbl_kind):: & top_conc ! 1% (min_bgc) of surface concentration @@ -924,20 +954,21 @@ subroutine z_biogeochemistry (n_cat, dt, & V_alg ! volume of algae (um^3) real (kind=dbl_kind), dimension(nbtrcr) :: & - mobile ! c1 if mobile, c0 otherwise + mobile , & ! c1 if mobile, c0 otherwise + flux_bio_tmp ! local parameters real (kind=dbl_kind), parameter :: & - accuracy = 1.0e-14_dbl_kind, & r_c = 3.0e3_dbl_kind , & ! ice crystal radius (um) - r_bac= 15.0_dbl_kind , & ! diatom large radius (um) + r_bac= 4.7_dbl_kind , & ! diatom large radius (um) r_alg= 10.0_dbl_kind , & ! diatom small radius (um) - N_vol = 0.04e-12_dbl_kind , & ! (g) Nitrogen per um^3 - Ng_to_mmol =0.0140067_dbl_kind , & ! (g/mmol) Nitrogen - f_s = c1 , & ! fracton of sites available for saturation - f_a = c1 , & ! fraction of collector available for attachment - f_v = 0.7854 ! fraction of algal coverage on area availabel for attachment + Nquota_A = 0.88_dbl_kind, & ! slope in Nitrogen quota to cell volume fit + ! (Lomas et al. 2019, Edwards et al. 2012) + Nquota_I = 0.0408_dbl_kind, & ! Intercept in N quota to cell volume fit + f_s = p1, & ! fracton of sites available for saturation + f_a = 0.3_dbl_kind, & !c1 , & ! fraction of collector available for attachment + f_v = 0.7854_dbl_kind ! fraction of algal coverage on area availabel for attachment ! 4(pi r^2)/(4r)^2 [Johnson et al, 1995, water res. research] integer, parameter :: & @@ -945,19 +976,32 @@ subroutine z_biogeochemistry (n_cat, dt, & character(len=*),parameter :: subname='(z_biogeochemistry)' + logical (kind=log_kind) :: & + write_carbon_errors + !------------------------------------- ! Initialize !----------------------------------- + write_carbon_errors = .true. + if (.not. tr_bgc_C) write_carbon_errors = .false. + zspace = c1/real(nblyr,kind=dbl_kind) + dz(:) = zspace + dz(1) = zspace/c2 + dz(nblyr+1) = zspace/c2 in_init_cons(:,:) = c0 atm_add_cons(:) = c0 dhtop = c0 dhbot = c0 darcyV = c0 C_top(:) = c0 + C_bot(:) = c0 + if (present(ocean_bio_dh)) ocean_bio_dh(:) = c0 mobile(:) = c0 - conserve_N(:) = .true. + conserve_C(:) = .true. + nitrification(:) = c0 + flux_bio_tmp(:) = c0 do m = 1, nbtrcr do k = 1, nblyr+1 @@ -967,15 +1011,13 @@ subroutine z_biogeochemistry (n_cat, dt, & iphin_N(k) = iphin(k) bphin_N(1) = bphi_min - if (first_ice) then - trcrn(bio_index(m) + k-1) = ocean_bio(m)*zbgc_init_frac(m) - in_init_cons(k,m) = trcrn(bio_index(m) + k-1)*hbri_old - elseif (abs(trcrn(bio_index(m) + k-1)) < puny) then + if (abs(trcrn(bio_index(m) + k-1)) < accuracy) then + flux_bio_tmp(m) = trcrn(bio_index(m) + k-1)* hbri_old * dz(k)/dt trcrn(bio_index(m) + k-1) = c0 in_init_cons(k,m) = c0 else in_init_cons(k,m) = trcrn(bio_index(m) + k-1)* hbri_old - endif ! first_ice + endif if (trcrn(bio_index(m) + k-1) < c0 ) then write(warnstr,*) subname,'zbgc initialization error, first ice = ', first_ice @@ -991,7 +1033,7 @@ subroutine z_biogeochemistry (n_cat, dt, & write(warnstr,*) subname, trcrn(bio_index(m) + k-1) call icepack_warnings_add(warnstr) call icepack_warnings_add(subname//' zbgc initialization error') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) endif if (icepack_warnings_aborted(subname)) return enddo !k @@ -1012,18 +1054,17 @@ subroutine z_biogeochemistry (n_cat, dt, & phi_max = maxval(bphin_N(2:nblyr+1)) S_col = 4.0_dbl_kind*pi*r_c**2 P_b = pi*r_bac**2 !*10-6 for colloids - V_c = 4.0_dbl_kind*pi*r_c**3/3.0_dbl_kind*(1.0e-6_dbl_kind)**3 ! (m^3) sphere + V_c = 4.0_dbl_kind*pi*r_c**3/3.0_dbl_kind ! (m^3) sphere V_alg = pi/6.0_dbl_kind*r_bac*r_alg**2 ! prolate spheroid (*10-9 for colloids) - Sat_conc= f_s*f_a*f_v*(c1-phi_max)/V_c*S_col/P_b*N_vol*V_alg/Ng_to_mmol - !mmol/m^3 (algae, don, hum...) and umols/m^3 for colloids - + Sat_conc= f_s*f_a*f_v*(c1-phi_max)/V_c*S_col/P_b*(V_alg)**Nquota_A*Nquota_I * 1.0e9_dbl_kind + !mmol/m^3 (algae, don, hum...) and umols/m^3 for colloids !----------------------------------------------------------------- ! convert surface dust flux (n_zaero > 2) to dFe(1) flux !----------------------------------------------------------------- dust_Fe(:) = c0 - if (tr_zaero .and. n_zaero > 2 .and. tr_bgc_Fe) then + if (tr_zaero .and. n_zaero > 2 .and. tr_bgc_Fe .and. use_atm_dust_iron) then do m = 3,n_zaero dust_Fe(nlt_bgc_Fed(1)) = dust_Fe(nlt_bgc_Fed(1)) + & (zbgc_snow(nlt_zaero(m)) + zbgc_atm(nlt_zaero(m))) * & @@ -1080,6 +1121,7 @@ subroutine z_biogeochemistry (n_cat, dt, & endif C_bot(m) = ocean_bio(m)*hbri_old*iphin_N(nblyr+1) + if (present(ocean_bio_dh)) ocean_bio_dh(m) = C_bot(m) enddo ! m @@ -1103,8 +1145,8 @@ subroutine z_biogeochemistry (n_cat, dt, & trtmp0(1:ntrcr), trtmp(1:ntrcr+2), & 0, nblyr+1, & hin, hbri, & - ic_grid(1:nilyr+1), & - i_grid(1:nblyr+1),ice_conc ) + icgrid(1:nilyr+1), & + igrid(1:nblyr+1),ice_conc ) if (icepack_warnings_aborted(subname)) return @@ -1134,14 +1176,16 @@ subroutine z_biogeochemistry (n_cat, dt, & if (hbri_old > thinS .and. hbri > thinS) then do k = 1,nblyr+1 initcons_mobile(k) = in_init_cons(k,mm)*trcrn(nt_zbgc_frac+mm-1) - initcons_stationary(k) = mobile(mm)*(in_init_cons(k,mm)-initcons_mobile(k)) + initcons_stationary(k) = max(c0,in_init_cons(k,mm)-initcons_mobile(k)) + ! Allow release of Nitrate/silicate to mobile phase, but not adsorption dmobile(k) = mobile(mm)*(initcons_mobile(k)*(exp_ret(mm)-c1) + & - initcons_stationary(k)*(c1-exp_rel(mm))) + initcons_stationary(k)*(c1-exp_rel(mm))) + & + (1-mobile(mm))*initcons_stationary(k)*(c1-exp_rel(mm)) initcons_mobile(k) = max(c0,initcons_mobile(k) + dmobile(k)) initcons_stationary(k) = max(c0,initcons_stationary(k) - dmobile(k)) if (initcons_stationary(k)/hbri_old > Sat_conc) then initcons_mobile(k) = initcons_mobile(k) + initcons_stationary(k) - Sat_conc*hbri_old - initcons_stationary(k) = Sat_conc*hbri_old + initcons_stationary(k) = Sat_conc*hbri_old endif Diff(k) = iDin(k) @@ -1150,9 +1194,9 @@ subroutine z_biogeochemistry (n_cat, dt, & enddo call compute_FCT_matrix & - (initcons,sbdiagz, dt, nblyr, & - diagz, spdiagz, rhsz, bgrid, & - darcyV, dhtop, & + (initcons,sbdiagz, dt, & + diagz, spdiagz, rhsz, & + darcyV, dhtop, & dhbot, iphin_N, & Diff, hbri_old, & atm_add_cons(mm), bphin_N, & @@ -1177,13 +1221,11 @@ subroutine z_biogeochemistry (n_cat, dt, & Sink_bot(mm), & Sink_top(mm), & dt, flux_bio(mm), & - nblyr, & source(mm)) if (icepack_warnings_aborted(subname)) return call compute_FCT_corr & - (initcons, & - biocons, dt, nblyr, & + (initcons, biocons, dt, & D_sbdiag, D_spdiag, ML_diag) if (icepack_warnings_aborted(subname)) return @@ -1196,9 +1238,8 @@ subroutine z_biogeochemistry (n_cat, dt, & call regrid_stationary & (initcons_stationary, hbri_old, & hbri, dt, & - ntrcr, & - nblyr, top_conc, & - i_grid, flux_bio(mm),& + top_conc, & + igrid, flux_bio(mm),& meltb, congel) if (icepack_warnings_aborted(subname)) return @@ -1208,9 +1249,8 @@ subroutine z_biogeochemistry (n_cat, dt, & call regrid_stationary & (initcons_stationary, hbri_old, & hbri, dt, & - ntrcr, & - nblyr, top_conc, & - i_grid, flux_bio(mm),& + top_conc, & + igrid, flux_bio(mm),& meltb, congel) if (icepack_warnings_aborted(subname)) return @@ -1219,40 +1259,38 @@ subroutine z_biogeochemistry (n_cat, dt, & biomat_cons(:,mm) = biocons(:) + initcons_stationary(:) + sum_initial = (in_init_cons(1,mm) + in_init_cons(nblyr+1,mm))*zspace/c2 sum_old = (biomat_low(1) + biomat_low(nblyr+1))*zspace/c2 sum_new = (biocons(1)+ biocons(nblyr+1))*zspace/c2 sum_tot = (biomat_cons(1,mm) + biomat_cons(nblyr+1,mm))*zspace/c2 do k = 2,nblyr + sum_initial = sum_initial + in_init_cons(k,mm)*zspace sum_old = sum_old + biomat_low(k)*zspace sum_new = sum_new + biocons(k)*zspace sum_tot = sum_tot + biomat_cons(k,mm)*zspace enddo trcrn(nt_zbgc_frac+mm-1) = zbgc_frac_init(mm) - if (sum_tot > c0 .and. mobile(mm) > c0) trcrn(nt_zbgc_frac+mm-1) = sum_new/sum_tot + if (sum_tot > c0) trcrn(nt_zbgc_frac+mm-1) = sum_new/sum_tot - if (abs(sum_new-sum_old) > accuracy*sum_old .or. & - minval(biocons(:)) < c0 .or. minval(initcons_stationary(:)) < c0 & + if ((abs((sum_initial-sum_tot+source(mm))/dt-flux_bio(mm)) > max(puny, accuracy*abs(flux_bio(mm)))) & + .or. (minval(biocons(:)) < c0) .or. (minval(initcons_stationary(:)) < c0) & .or. icepack_warnings_aborted()) then - write(warnstr,*) subname,'zbgc FCT tracer solution failed' + write(warnstr,*) subname,'zbgc FCT tracer solution failed, mm:', mm call icepack_warnings_add(warnstr) - write(warnstr,*) subname,'sum_new,sum_old:',sum_new,sum_old + write(warnstr,*)'sum_new,sum_tot,sum_initial,flux_bio(mm),source(mm):' call icepack_warnings_add(warnstr) - write(warnstr,*) subname,'mm,biocons(:):',mm,biocons(:) + write(warnstr,*)sum_new,sum_tot,sum_initial,flux_bio(mm),source(mm) call icepack_warnings_add(warnstr) - write(warnstr,*) subname,'biomat_low:',biomat_low + write(warnstr,*)'error = (sum_initial-sum_tot+source(mm))/dt-flux_bio(mm)' call icepack_warnings_add(warnstr) - write(warnstr,*) subname,'Diff(:):',Diff(:) + write(warnstr,*)(sum_initial-sum_tot+source(mm))/dt-flux_bio(mm) call icepack_warnings_add(warnstr) - write(warnstr,*) subname,'dmobile(:):',dmobile(:) + write(warnstr,*) subname,'sum_new,sum_old:',sum_new,sum_old call icepack_warnings_add(warnstr) write(warnstr,*) subname,'mobile(mm):',mobile(mm) call icepack_warnings_add(warnstr) - write(warnstr,*) subname,'initcons_stationary(:):',initcons_stationary(:) - call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'trcrn(nt_zbgc_frac+mm-1):',trcrn(nt_zbgc_frac+mm-1) call icepack_warnings_add(warnstr) - write(warnstr,*) subname, 'in_init_cons(:,mm):',in_init_cons(:,mm) - call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'exp_ret( mm),exp_rel( mm)',exp_ret( mm),exp_rel( mm) call icepack_warnings_add(warnstr) write(warnstr,*) subname,'darcyV,dhtop,dhbot' @@ -1262,7 +1300,7 @@ subroutine z_biogeochemistry (n_cat, dt, & write(warnstr,*) subname,'Category,mm:',n_cat,mm call icepack_warnings_add(warnstr) call icepack_warnings_add(subname//'zbgc FCT tracer solution failed') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) endif if (icepack_warnings_aborted(subname)) return @@ -1270,7 +1308,7 @@ subroutine z_biogeochemistry (n_cat, dt, & call thin_ice_flux(hbri,hbri_old,biomat_cons(:,mm), & flux_bio(mm),source(mm), & - dt, nblyr,ocean_bio(mm)) + dt, ocean_bio(mm)) if (icepack_warnings_aborted(subname)) return endif ! thin or not @@ -1285,16 +1323,16 @@ subroutine z_biogeochemistry (n_cat, dt, & if (solve_zbgc) then do k = 1, nblyr+1 - call algal_dyn (dt, & - n_doc, n_dic, n_don, n_fed, n_fep, & - dEdd_algae, & + call algal_dyn (dt, & + dEdd_algae, & zfswin(k), react(k,:), & - biomat_brine(k,:), & - grow_alg(k,:), n_algae, & + biomat_brine(k,:), & + grow_alg(k,:), & iTin(k), & upNOn(k,:), upNHn(k,:), & Zoo(k), & - Nerror(k), conserve_N(k)) + Cerror(k), conserve_C(k), & + nitrification(k)) if (icepack_warnings_aborted(subname)) return enddo ! k @@ -1304,14 +1342,46 @@ subroutine z_biogeochemistry (n_cat, dt, & ! Update the tracer variable !----------------------------------------------------------------- + sum_new = c0 + sum_tot = c0 + do m = 1,nbtrcr do k = 1,nblyr+1 ! back to bulk quantity bio_tmp = (biomat_brine(k,m) + react(k,m))*iphin_N(k) - if (.not. conserve_N(k)) then - write(warnstr,*) subname, 'N in algal_dyn not conserved' + if (tr_bgc_C .and. m .eq. nlt_bgc_DIC(1) .and. bio_tmp .le. -accuracy) then ! satisfy DIC demands from ocean + !Uncomment for additional diagnostics + !write(warnstr,*) subname, 'DIC demand from ocean' + !call icepack_warnings_add(warnstr) + !write(warnstr,*) subname, 'm, k, nlt_bgc_DIC(1), bio_tmp, react(k,m):' + !call icepack_warnings_add(warnstr) + !write(warnstr,*) subname, m, k, nlt_bgc_DIC(1), bio_tmp, react(k,m) + !call icepack_warnings_add(warnstr) + !write(warnstr,*) subname, 'flux_bio(m), hbri, hbri_old:' + !call icepack_warnings_add(warnstr) + !write(warnstr,*) subname, flux_bio(m), hbri, hbri_old + !call icepack_warnings_add(warnstr) + flux_bio(m) = flux_bio(m) + bio_tmp*dz(k)*hbri/dt + bio_tmp = c0 + !write(warnstr,*) subname, 'flux_bio(m) Final:' + !call icepack_warnings_add(warnstr) + !write(warnstr,*) subname, flux_bio(m) + !call icepack_warnings_add(warnstr) + end if + if (m .eq. nlt_bgc_Nit) then + initcons_mobile(k) = max(c0,(biomat_brine(k,m)-nitrification(k) + & + react(k,m))*iphin_N(k)*trcrn(nt_zbgc_frac+m-1)) + initcons_stationary(k) = max(c0,((c1-trcrn(nt_zbgc_frac+m-1))*(biomat_brine(k,m)- & + nitrification(k) + react(k,m)) + nitrification(k))*iphin_N(k)) + + sum_new = sum_new + initcons_mobile(k)*dz(k) + sum_tot = sum_tot + (initcons_mobile(k) + initcons_stationary(k))*dz(k) + + end if ! m .eq. nlt_bgc_Nit + if (.not. conserve_C(k) .and. write_carbon_errors) then + write(warnstr,*) subname, 'C in algal_dyn not conserved' call icepack_warnings_add(warnstr) - write(warnstr,*) subname, 'Nerror(k):', Nerror(k) + write(warnstr,*) subname, 'Cerror(k):', Cerror(k) call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'k,m,hbri,hbri_old,bio_tmp,biomat_cons(k,m),ocean_bio(m)' call icepack_warnings_add(warnstr) @@ -1321,11 +1391,12 @@ subroutine z_biogeochemistry (n_cat, dt, & call icepack_warnings_add(warnstr) write(warnstr,*) subname, react(k,m),iphin_N(k),biomat_brine(k,m) call icepack_warnings_add(warnstr) - call icepack_warnings_add(subname//' N in algal_dyn not conserved') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) - elseif (abs(bio_tmp) < puny) then + call icepack_warnings_add(subname//' C in algal_dyn not conserved') + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + elseif (abs(bio_tmp) < accuracy) then + flux_bio(m) = flux_bio(m) + bio_tmp*dz(k)*hbri/dt bio_tmp = c0 - elseif (bio_tmp > 1.0e6_dbl_kind) then + elseif (bio_tmp > large_bgc) then write(warnstr,*) subname, 'very large bgc value' call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'k,m,hbri,hbri_old,bio_tmp,biomat_cons(k,m),ocean_bio(m)' @@ -1337,7 +1408,7 @@ subroutine z_biogeochemistry (n_cat, dt, & write(warnstr,*) subname, react(k,m),iphin_N(k),biomat_brine(k,m) call icepack_warnings_add(warnstr) call icepack_warnings_add(subname//' very large bgc value') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) elseif (bio_tmp < c0) then write(warnstr,*) subname, 'negative bgc' call icepack_warnings_add(warnstr) @@ -1356,38 +1427,28 @@ subroutine z_biogeochemistry (n_cat, dt, & write(warnstr,*) subname, 'exp_ret( m),exp_ret( m)',exp_ret( m),exp_ret( m) call icepack_warnings_add(warnstr) call icepack_warnings_add(subname//'negative bgc') - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) endif + trcrn(bio_index(m)+k-1) = max(c0, bio_tmp) if (icepack_warnings_aborted()) then write(warnstr,*) subname, 'trcrn(nt_zbgc_frac+m-1):',trcrn(nt_zbgc_frac+m-1) call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'in_init_cons(k,m):',in_init_cons(k,m) call icepack_warnings_add(warnstr) - write(warnstr,*) subname, 'trcrn(bio_index(m) + k-1)' + write(warnstr,*) subname, 'trcrn(bio_index(m) + k-1), bio_tmp' call icepack_warnings_add(warnstr) - write(warnstr,*) subname, trcrn(bio_index(m) + k-1) + write(warnstr,*) subname, trcrn(bio_index(m) + k-1), bio_tmp call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'Category,m:',n_cat,m call icepack_warnings_add(warnstr) return endif - trcrn(bio_index(m)+k-1) = max(c0, bio_tmp) - if (ocean_bio(m) .le. c0 .and. flux_bio(m) < c0) then - ! if (flux_bio(m) < -1.0e-12_dbl_kind) then - ! write(warnstr,*) subname, 'no ocean_bio but flux_bio < c0' - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, 'm,ocean_bio(m),flux_bio(m)' - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, m,ocean_bio(m),flux_bio(m) - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, 'setting flux_bio(m) = c0' - ! call icepack_warnings_add(warnstr) - ! call icepack_warnings_add(subname//' flux_bio < 0 when ocean_bio = 0') - ! call icepack_warnings_setabort(.true.,__FILE__,__LINE__) - ! endif - flux_bio(m) = max(c0,flux_bio(m)) - endif enddo ! k + if (m .eq. nlt_bgc_Nit .and. MAXVAL(nitrification) > c0) then + trcrn(nt_zbgc_frac+m-1) = zbgc_frac_init(m) + if (sum_tot > c0) trcrn(nt_zbgc_frac+m-1) = sum_new/sum_tot + end if + flux_bio(m) = flux_bio(m) + flux_bio_tmp(m) enddo ! m end subroutine z_biogeochemistry @@ -1398,20 +1459,16 @@ end subroutine z_biogeochemistry ! authors: Scott Elliott, LANL ! Nicole Jeffery, LANL - subroutine algal_dyn (dt, & - n_doc, n_dic, n_don, n_fed, n_fep, & - dEdd_algae, & + subroutine algal_dyn (dt, & + dEdd_algae, & fswthru, reactb, & - ltrcrn, & - grow_alg, n_algae, & + ltrcrn, & + grow_alg, & T_bot, & upNOn, upNHn, & Zoo, & - Nerror, conserve_N) - - integer (kind=int_kind), intent(in) :: & - n_doc, n_dic, n_don, n_fed, n_fep, & - n_algae ! number of autotrophic types + Cerror, conserve_C, & + nitrification) real (kind=dbl_kind), intent(in) :: & dt , & ! time step @@ -1420,7 +1477,8 @@ subroutine algal_dyn (dt, & real (kind=dbl_kind), intent(inout) :: & Zoo, & ! N losses from zooplankton/bacteria... (mmol/m^3) - Nerror ! Change in N after reactions (mmol/m^3) + Cerror, & ! Change in C after reactions (mmol/m^3) + nitrification ! nitrate produced through nitrification (mmol/m3) real (kind=dbl_kind), dimension (:), intent(out) :: & grow_alg,& ! algal growth rate (mmol/m^3/s) @@ -1434,7 +1492,7 @@ subroutine algal_dyn (dt, & ltrcrn ! brine concentrations in layer (mmol/m^3) logical (kind=log_kind), intent(inout) :: & - conserve_N + conserve_C logical (kind=log_kind), intent(in) :: & dEdd_algae ! .true. chla impact on shortwave computed in dEdd @@ -1451,21 +1509,18 @@ subroutine algal_dyn (dt, & ! nt_bgc_Sil -> silicate, nt_bgc_Fe -> dissolved iron ! -------------------------------------------------------------------------------------- -! real (kind=dbl_kind), parameter, dimension(max_algae) :: & -! alpha2max_high = (/ 0.25_dbl_kind, 0.25_dbl_kind, 0.25_dbl_kind/) ! light limitation (1/(W/m^2)) - integer (kind=int_kind) :: k, n real (kind=dbl_kind), dimension(n_algae) :: & Nin , & ! algal nitrogen concentration on volume (mmol/m^3) -! Cin , & ! algal carbon concentration on volume (mmol/m^3) + Cin , & ! algal carbon concentration on volume (mmol/m^3) chlin ! algal chlorophyll concentration on volume (mg/m^3) real (kind=dbl_kind), dimension(n_doc) :: & DOCin ! dissolved organic carbon concentration on volume (mmolC/m^3) -! real (kind=dbl_kind), dimension(n_dic) :: & -! DICin ! dissolved inorganic carbon concentration on volume (mmolC/m^3) + real (kind=dbl_kind), dimension(n_dic) :: & + DICin ! dissolved inorganic carbon concentration on volume (mmolC/m^3) real (kind=dbl_kind), dimension(n_don) :: & !proteins DONin ! dissolved organic nitrogen concentration on volume (mmolN/m^3) @@ -1483,7 +1538,7 @@ subroutine algal_dyn (dt, & ! DMSPpin , & ! DMSPp concentration on volume (mmol/m^3) DMSPdin , & ! DMSPd concentration on volume (mmol/m^3) DMSin , & ! DMS concentration on volume (mmol/m^3) -! PONin , & ! PON concentration on volume (mmol/m^3) + ! PONin , & ! PON concentration on volume (mmol/m^3) op_dep , & ! bottom layer attenuation exponent (optical depth) Iavg_loc ! bottom layer attenuated Fswthru (W/m^2) @@ -1498,7 +1553,6 @@ subroutine algal_dyn (dt, & fr_Am , & ! fraction of local ecological growth as ammonia growmax_N, & ! maximum growth rate in N currency (mmol/m^3/s) grow_N , & ! true growth rate in N currency (mmol/m^3/s) -! potU_Nit , & ! potential nitrate uptake (mmol/m^3/s) potU_Am , & ! potential ammonium uptake (mmol/m^3/s) U_Nit , & ! actual nitrate uptake (mmol/m^3/s) U_Am , & ! actual ammonium uptake (mmol/m^3/s) @@ -1523,11 +1577,6 @@ subroutine algal_dyn (dt, & exude_C , & ! total carbon exuded by algae (mmol C/m^3) resp_N , & ! total N in respiration (mmol N/m^3) growth_N ! total algal growth (mmol N/m^3) -! fr_graze_p , & ! fraction of N grazed that becomes protein -! ! (rest is assimilated) < (1-fr_graze_a) -! ! and fr_graze_a*fr_graze_e becomes ammonia -! fr_mort_p ! fraction of N mortality that becomes protein -! ! < (1-fr_mort2min) real (kind=dbl_kind), dimension(n_algae) :: & resp , & ! respiration (mmol/m^3/s) @@ -1544,6 +1593,10 @@ subroutine algal_dyn (dt, & DOC_r , & ! net DOC removal (mmol/m^3) DOC_s ! net DOC sources (mmol/m^3) + real (kind=dbl_kind), dimension(n_dic) :: & + DIC_r , & ! net DIC removal (mmol/m^3) + DIC_s ! net DIC sources (mmol/m^3) + real (kind=dbl_kind), dimension(n_don) :: & DON_r , & ! net DON removal (mmol/m^3) DON_s ! net DON sources (mmol/m^3) @@ -1561,12 +1614,12 @@ subroutine algal_dyn (dt, & real (kind=dbl_kind) :: & dN , & ! change in N (mmol/m^3) -! N_s_p , & ! algal nitrogen photosynthesis (mmol/m^3) -! N_r_g , & ! algal nitrogen losses to grazing (mmol/m^3) -! N_r_r , & ! algal nitrogen losses to respiration (mmol/m^3) -! N_r_mo , & ! algal nitrogen losses to mortality (mmol/m^3) + dC , & ! change in Carbon (mmol C/m^3) + N_s_p , & ! algal nitrogen photosynthesis (mmol/m^3) + N_r_g , & ! algal nitrogen losses to grazing (mmol/m^3) + N_r_r , & ! algal nitrogen losses to respiration (mmol/m^3) + N_r_mo , & ! algal nitrogen losses to mortality (mmol/m^3) Nit_s_n , & ! nitrate from nitrification (mmol/m^3) -! Nit_s_r , & ! nitrate from respiration (mmol/m^3) Nit_r_p , & ! nitrate uptake by algae (mmol/m^3) Nit_s , & ! net nitrate sources (mmol/m^3) Nit_r , & ! net nitrate removal (mmol/m^3) @@ -1609,19 +1662,18 @@ subroutine algal_dyn (dt, & ! Initialize !----------------------------------------------------------------------- - conserve_N = .true. + conserve_C = .true. Nin(:) = c0 -! Cin(:) = c0 + Cin(:) = c0 chlin(:) = c0 DOCin(:) = c0 -! DICin(:) = c0 + DICin(:) = c0 DONin(:) = c0 Fedin(:) = c0 Fepin(:) = c0 Nitin = c0 Amin = c0 Silin = c0 -! DMSPpin = c0 DMSPdin = c0 DMSin = c0 U_Am_tot = c0 @@ -1634,7 +1686,6 @@ subroutine algal_dyn (dt, & U_Fe_f(:) = c0 DOC_s(:) = c0 DOC_r(:) = c0 -! DOC_r_c = c0 nitrif = c0 mort_N = c0 mort_C = c0 @@ -1658,9 +1709,11 @@ subroutine algal_dyn (dt, & Fed_tot_s = c0 rFed(:) = c0 Fep_tot = c0 -! Fep_tot_r = c0 Fep_tot_s = c0 rFep(:) = c0 + DIC_r(:) = c0 + DIC_s(:) = c0 + Zoo = c0 Nitin = ltrcrn(nlt_bgc_Nit) op_dep = c0 @@ -1676,9 +1729,9 @@ subroutine algal_dyn (dt, & do k = 1, n_doc DOCin(k)= ltrcrn(nlt_bgc_DOC(k)) enddo -! do k = 1, n_dic -! DICin(k)= ltrcrn(nlt_bgc_DIC(k)) -! enddo + do k = 1, n_dic + DICin(k)= ltrcrn(nlt_bgc_DIC(k)) + enddo endif if (tr_bgc_Am) Amin = ltrcrn(nlt_bgc_Am) if (tr_bgc_Sil) Silin = ltrcrn(nlt_bgc_Sil) @@ -1687,10 +1740,10 @@ subroutine algal_dyn (dt, & DMSPdin = ltrcrn(nlt_bgc_DMSPd) DMSin = ltrcrn(nlt_bgc_DMS) endif -! if (tr_bgc_PON) then +! if (tr_bgc_PON) then ! PONin = c0 ! PONin = ltrcrn(nlt_bgc_PON) -! endif +! endif if (tr_bgc_DON) then do k = 1, n_don DONin(k) = ltrcrn(nlt_bgc_DON(k)) @@ -1773,7 +1826,11 @@ subroutine algal_dyn (dt, & !---------------------------------------------------------------------------- growmax_N(k) = mu_max(k) / secday * exp(grow_Tdep(k) * dTemp)* Nin(k) *fsal - grow_N(k) = min(L_lim(k), N_lim(k), Sil_lim(k), Fe_lim(k)) * growmax_N(k) + if (n_fed == 0) then + grow_N(k) = min(L_lim(k), N_lim(k), Sil_lim(k)) * growmax_N(k) + else + grow_N(k) = min(L_lim(k), N_lim(k), Sil_lim(k), Fe_lim(k)) * growmax_N(k) + endif ! potU_Nit(k) = Nit_lim(k)* growmax_N(k) potU_Am(k) = Am_lim(k)* growmax_N(k) U_Am(k) = min(grow_N(k), potU_Am(k)) @@ -1804,10 +1861,12 @@ subroutine algal_dyn (dt, & U_Sil(k) = U_Sil_f(k)*U_Sil_tot U_Fe(k) = U_Fe_f(k)*U_Fe_tot - if (R_Si2N(k) > c0) then - grow_N(k) = min(U_Sil(k)/R_Si2N(k),U_Nit(k) + U_Am(k), U_Fe(k)/R_Fe2N(k)) - else - grow_N(k) = min(U_Nit(k) + U_Am(k),U_Fe(k)/R_Fe2N(k)) + if (n_fed == 0) then + if (R_Si2N(k) > c0) then + grow_N(k) = min(U_Sil(k)/R_Si2N(k),U_Nit(k) + U_Am(k), U_Fe(k)/R_Fe2N(k)) + else + grow_N(k) = min(U_Nit(k) + U_Am(k),U_Fe(k)/R_Fe2N(k)) + endif endif fr_Am(k) = c0 @@ -1834,11 +1893,13 @@ subroutine algal_dyn (dt, & !-------------------------------------------------------------------- ! Algal reaction term - ! N_react = (grow_N*(c1 - fr_graze-fr_resp) - mort)*dt + ! v1: N_react = (grow_N*(c1 - fr_graze-fr_resp) - mort)*dt + ! v2: N_react = (grow_N*(c1 - fr_graze * (N/graze_conc)**graze_exp-fr_resp) - mort)*dt + ! with maximum grazing less than max_loss * Nin(k)/dt !-------------------------------------------------------------------- resp(k) = fr_resp * grow_N(k) - graze(k) = fr_graze(k) * grow_N(k) + graze(k) = min(max_loss * Nin(k)/dt, grow_N(k) * fr_graze(k) * (Nin(k)/graze_conc)**graze_exponent(k)) mort(k) = min(max_loss * Nin(k)/dt, & mort_pre(k)*exp(mort_Tdep(k)*dTemp) * Nin(k)/secday) @@ -1847,13 +1908,12 @@ subroutine algal_dyn (dt, & upNOn(k) = U_Nit(k) upNHn(k) = U_Am(k) -! N_s_p = grow_N(k) * dt -! N_r_g = graze(k) * dt -! N_r_r = resp(k) * dt -! N_r_mo = mort(k) * dt - N_s(k) = (c1- fr_resp - fr_graze(k)) * grow_N(k) *dt !N_s_p - N_r(k) = mort(k) * dt !N_r_g + N_r_mo + N_r_r - + N_s_p = grow_N(k) * dt + N_r_g = graze(k) * dt + N_r_r = resp(k) * dt + N_r_mo = mort(k) * dt + N_s(k) = N_s_p + N_r(k) = N_r_g + N_r_mo + N_r_r graze_N = graze_N + graze(k) graze_C = graze_C + R_C2N(k)*graze(k) mort_N = mort_N + mort(k) @@ -1885,16 +1945,18 @@ subroutine algal_dyn (dt, & Fe_r_p = U_Fe (k) * dt Fed_tot_r = Fed_tot_r + Fe_r_p exude_C = exude_C + k_exude(k)* R_C2N(k)*Nin(k) / secday + DIC_r(1) = DIC_r(1) + (c1-fr_resp)*grow_N(k) * R_C2N(k) * dt enddo !-------------------------------------------------------------------- ! nitrification !-------------------------------------------------------------------- - nitrif = k_nitrif /secday * Amin - Am_r = Am_r + nitrif*dt - Nit_s_n = nitrif * dt ! source from NH4 - Nit_s = Nit_s_n + nitrification = c0 + nitrif = k_nitrif /secday * Amin + Am_r = Am_r + nitrif*dt + Nit_s_n = nitrif * dt ! source from NH4 + Nit_s = Nit_s_n !-------------------------------------------------------------------- ! PON: currently using PON to shadow nitrate @@ -1928,10 +1990,11 @@ subroutine algal_dyn (dt, & if (tr_bgc_DON) then do n = 1, n_don DON_r(n) = kn_bac(n)/secday * DONin(n) * dt - DON_s(n) = graze_N*f_don(n)*fr_graze_s * dt + DON_s(n) = graze_N*dt - Am_s_e + mort_N*dt - Am_s_mo Zoo_s_s = Zoo_s_s - DON_s(n) Zoo_s_b = Zoo_s_b + DON_r(n)*(c1-f_don_Am(n)) - !Am_s = Am_s + DON_r(n)*f_don_Am(n) + Am_s = Am_s + DON_r(n)*f_don_Am(n) + DIC_s(1) = DIC_s(1) + DON_r(n) * R_C2N_DON(n) enddo endif @@ -1945,8 +2008,10 @@ subroutine algal_dyn (dt, & do n = 1, n_doc DOC_r(n) = k_bac(n)/secday * DOCin(n) * dt - DOC_s(n) = f_doc(n)*(fr_graze_s *graze_C + mort_C)*dt & - + f_exude(n)*exude_C +! DOC_s(n) = f_doc(n)*(fr_graze_s *graze_C + mort_C)*dt & +! + f_exude(n)*exude_C + DOC_s(n) = f_doc(n) * (graze_C*dt + mort_C*dt - DON_s(1) * R_C2N_DON(1)) + DIC_s(1) = DIC_s(1) + DOC_r(n) enddo !-------------------------------------------------------------------- @@ -1963,16 +2028,16 @@ subroutine algal_dyn (dt, & if (tr_bgc_C .and. tr_bgc_Fe) then if (DOCin(1) > c0) then - if (Fed_tot/DOCin(1) > max_dfe_doc1) then - do n = 1,n_fed ! low saccharid:dFe ratio leads to - Fed_r_l(n) = Fedin(n)/t_iron_conv*dt/secday ! loss of bioavailable Fe to particulate fraction - Fep_tot_s = Fep_tot_s + Fed_r_l(n) - Fed_r(n) = Fed_r_l(n) ! removal due to particulate scavenging - enddo - do n = 1,n_fep - Fep_s(n) = rFep(n)* Fep_tot_s ! source from dissolved Fe - enddo - elseif (Fed_tot/DOCin(1) < max_dfe_doc1) then + !if (Fed_tot/DOCin(1) > max_dfe_doc1) then + ! do n = 1,n_fed ! low saccharid:dFe ratio leads to + ! Fed_r_l(n) = Fedin(n)/t_iron_conv*dt/secday ! loss of bioavailable Fe to particulate fraction + ! Fep_tot_s = Fep_tot_s + Fed_r_l(n) + ! Fed_r(n) = Fed_r_l(n) ! removal due to particulate scavenging + ! enddo + ! do n = 1,n_fep + ! Fep_s(n) = rFep(n)* Fep_tot_s ! source from dissolved Fe + ! enddo + if (Fed_tot/DOCin(1) < max_dfe_doc1) then do n = 1,n_fep ! high saccharid:dFe ratio leads to Fep_r(n) = Fepin(n)/t_iron_conv*dt/secday ! gain of bioavailable Fe from particulate fraction Fed_tot_s = Fed_tot_s + Fep_r(n) @@ -1982,7 +2047,8 @@ subroutine algal_dyn (dt, & enddo endif endif !Docin(1) > c0 - elseif (tr_bgc_Fe) then + endif + if (tr_bgc_Fe) then do n = 1,n_fed Fed_r(n) = Fed_r(n) + rFed(n)*Fed_tot_r ! scavenging + uptake enddo @@ -2032,9 +2098,11 @@ subroutine algal_dyn (dt, & !----------------------------------------------------------------------- dN = c0 + dC = c0 do k = 1,n_algae reactb(nlt_bgc_N(k)) = N_s(k) - N_r(k) dN = dN + reactb(nlt_bgc_N(k)) + dC = dC + reactb(nlt_bgc_N(k)) * R_C2N(k) enddo if (tr_bgc_C) then ! do k = 1,n_algae @@ -2042,10 +2110,16 @@ subroutine algal_dyn (dt, & ! enddo do k = 1,n_doc reactb(nlt_bgc_DOC(k))= DOC_s(k) - DOC_r(k) + dC = dC + reactb(nlt_bgc_DOC(k)) + enddo + do k = 1,n_dic + reactb(nlt_bgc_DIC(k))= DIC_s(k) - DIC_r(k) + dC = dC + reactb(nlt_bgc_DIC(k)) enddo endif - reactb(nlt_bgc_Nit) = Nit_s - Nit_r - dN = dN + reactb(nlt_bgc_Nit) + reactb(nlt_bgc_Nit) = Nit_s - Nit_r + nitrification = Nit_s_n + dN = dN + reactb(nlt_bgc_Nit) if (tr_bgc_Am) then reactb(nlt_bgc_Am) = Am_s - Am_r dN = dN + reactb(nlt_bgc_Am) @@ -2057,8 +2131,10 @@ subroutine algal_dyn (dt, & do k = 1,n_don reactb(nlt_bgc_DON(k))= DON_s(k) - DON_r(k) dN = dN + reactb(nlt_bgc_DON(k)) + dC = dC + reactb(nlt_bgc_DON(k)) * R_C2N_DON(k) enddo endif + Cerror = dC if (tr_bgc_Fe ) then do k = 1,n_fed reactb(nlt_bgc_Fed(k))= Fed_s (k) - Fed_r (k) @@ -2071,25 +2147,75 @@ subroutine algal_dyn (dt, & reactb(nlt_bgc_DMSPd) = DMSPd_s - DMSPd_r reactb(nlt_bgc_DMS) = DMS_s - DMS_r endif - Nerror = dN + Zoo - ! if (abs(Nerror) > max(reactb(:))*1.0e-5) then - ! conserve_N = .false. - ! write(warnstr,*) subname, 'Conservation error!' - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, 'Nerror,dN, DONin(1),kn_bac(1),secday,dt,n_doc' - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, Nerror,dN, DONin(1),kn_bac(1),secday,dt,n_doc - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, 'reactb(nlt_bgc_Nit),reactb(nlt_bgc_N(1)),reactb(nlt_bgc_N(2)' - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, reactb(nlt_bgc_Nit),reactb(nlt_bgc_N(1)),reactb(nlt_bgc_N(2)) - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, 'reactb(nlt_bgc_Am),reactb(nlt_bgc_DON(1)), DON_r(1),DON_s(1)' - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, reactb(nlt_bgc_Am),reactb(nlt_bgc_DON(1)),DON_r(1),DON_s(1) - ! call icepack_warnings_add(warnstr) - ! write(warnstr,*) subname, 'Zoo:',Zoo - ! endif + + if (tr_bgc_C) then + if (abs(dC) > max(puny,maxval(abs(reactb(:)))*accuracy) .or. & + abs(dN) > max(puny,maxval(abs(reactb(:)))*accuracy)) then + conserve_C = .false. + write(warnstr,*) subname, 'Conservation error!' + call icepack_warnings_add(warnstr) + if (tr_bgc_DON) then + write(warnstr,*) subname, 'dN,DONin(1), kn_bac(1),secday,dt,n_doc' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, dN, DONin(1),kn_bac(1),secday,dt,n_doc + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'reactb(nlt_bgc_DON(1)), DON_r(1),DON_s(1)' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, reactb(nlt_bgc_DON(1)),DON_r(1),DON_s(1) + call icepack_warnings_add(warnstr) + end if + write(warnstr,*) subname, 'dN,secday,dt,n_doc' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, dN,secday,dt,n_doc + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'reactb(nlt_bgc_Nit),reactb(nlt_bgc_N(n_algae))' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, reactb(nlt_bgc_Nit),reactb(nlt_bgc_N(n_algae)) + call icepack_warnings_add(warnstr) + if (tr_bgc_Am) then + write(warnstr,*) subname, 'reactb(nlt_bgc_Am),Am_r, Am_s' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, reactb(nlt_bgc_Am),Am_r, Am_s + call icepack_warnings_add(warnstr) + end if + write(warnstr,*) subname, 'dC' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, dC + call icepack_warnings_add(warnstr) + do k = 1,n_doc + write(warnstr,*) subname, 'DOCin' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, DOCin(k) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'reactb(nlt_bgc_DOC)' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, reactb(nlt_bgc_DOC(k)) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'DOC_r(k),DOC_s(k),k' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, DOC_r(k),DOC_s(k),k + call icepack_warnings_add(warnstr) + end do + do k = 1,n_dic + write(warnstr,*) subname, 'DICin' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, DICin(k) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'reactb(nlt_bgc_DIC)' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, reactb(nlt_bgc_DIC(k)) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'DIC_r(k),DIC_s(k),k' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, DIC_r(k),DIC_s(k),k + call icepack_warnings_add(warnstr) + end do + write(warnstr,*) subname, 'Zoo' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, Zoo + call icepack_warnings_add(warnstr) + endif + endif end subroutine algal_dyn @@ -2101,11 +2227,7 @@ end subroutine algal_dyn ! authors Nicole Jeffery, LANL subroutine thin_ice_flux (hin, hin_old, Cin, flux_o_tot, & - source, dt, nblyr, & - ocean_bio) - - integer (kind=int_kind), intent(in) :: & - nblyr ! number of bio layers + source, dt, ocean_bio) real (kind=dbl_kind), dimension(nblyr+1), intent(inout) :: & Cin ! initial concentration*hin_old*phin @@ -2141,7 +2263,7 @@ subroutine thin_ice_flux (hin, hin_old, Cin, flux_o_tot, & sum_bio = c0 dh = hin-hin_old - if (dh .le. c0) then ! keep the brine concentration fixed + if (dh .le. c0 .and. hin_old > puny) then ! keep the brine concentration fixed sum_bio = (Cin(1)+Cin(nblyr+1))/hin_old*zspace*p5 Cin(1) = Cin(1)/hin_old*hin Cin(nblyr+1) = Cin(nblyr+1)/hin_old*hin @@ -2149,7 +2271,7 @@ subroutine thin_ice_flux (hin, hin_old, Cin, flux_o_tot, & sum_bio = sum_bio + Cin(k)/hin_old*zspace Cin(k) = Cin(k)/hin_old*hin + dC enddo - else + else ! spread evenly in ice layers dC = dh*ocean_bio do k = 1, nblyr+1 Cin(k) = Cin(k) + dC @@ -2167,21 +2289,18 @@ end subroutine thin_ice_flux ! ! July, 2014 by N. Jeffery ! - subroutine compute_FCT_matrix (C_in, sbdiag, dt, nblyr, & - diag, spdiag, rhs, bgrid, & - darcyV, dhtop, dhbot, & + subroutine compute_FCT_matrix (C_in, sbdiag, dt, & + diag, spdiag, rhs, & + darcyV, dhtop, dhbot, & iphin_N, iDin, hbri_old, & atm_add, bphin_N, & C_top, C_bot, Qbot, Qtop, & Sink_bot, Sink_top, & D_sbdiag, D_spdiag, ML) - integer (kind=int_kind), intent(in) :: & - nblyr ! number of bio layers - real (kind=dbl_kind), dimension(nblyr+1), intent(in) :: & C_in ! Initial (bulk) concentration*hbri_old (mmol/m^2) - ! conserved quantity on i_grid + ! conserved quantity on igrid real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -2193,8 +2312,7 @@ subroutine compute_FCT_matrix (C_in, sbdiag, dt, nblyr, & iphin_N ! Porosity with min condition on igrid real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bphin_N, & ! Porosity with min condition on igrid - bgrid + bphin_N ! Porosity with min condition on igrid real (kind=dbl_kind), dimension (nblyr+1), intent(out) :: & sbdiag , & ! sub-diagonal matrix elements @@ -2366,11 +2484,8 @@ end subroutine compute_FCT_matrix ! ! July, 2014 by N. Jeffery ! - subroutine compute_FCT_corr (C_in, C_low, dt, nblyr, & - D_sbdiag, D_spdiag, ML) - - integer (kind=int_kind), intent(in) :: & - nblyr ! number of bio layers + subroutine compute_FCT_corr(C_in, C_low, dt, & + D_sbdiag, D_spdiag, ML) real (kind=dbl_kind), dimension(nblyr+1), intent(in) :: & C_in ! Initial (bulk) concentration*hbri_old (mmol/m^2) @@ -2494,7 +2609,7 @@ end subroutine compute_FCT_corr ! authors William H. Lipscomb, LANL ! C. M. Bitz, UW ! - subroutine tridiag_solverz (nmat, sbdiag, & + subroutine tridiag_solverz(nmat, sbdiag, & diag, spdiag, & rhs, xout) @@ -2544,11 +2659,7 @@ end subroutine tridiag_solverz subroutine check_conservation_FCT (C_init, C_new, C_low, S_top, & S_bot, L_bot, L_top, dt, & - fluxbio, nblyr, & - source) - - integer (kind=int_kind), intent(in) :: & - nblyr ! number of bio layers + fluxbio, source) real (kind=dbl_kind), dimension(nblyr+1), intent(in) :: & C_init , & ! initial bulk concentration * h_old (mmol/m^2) @@ -2578,7 +2689,8 @@ subroutine check_conservation_FCT (C_init, C_new, C_low, S_top, & C_init_tot , & C_new_tot , & zspace , & !1/nblyr - accuracy ! centered difference is Order(zspace^2) + accuracyC , & ! centered difference is Order(zspace^2) + var_tmp ! temporary variable character(len=*),parameter :: subname='(check_conservation_FCT)' @@ -2598,33 +2710,82 @@ subroutine check_conservation_FCT (C_init, C_new, C_low, S_top, & C_low(k) = C_new(k) enddo - accuracy = 1.0e-14_dbl_kind*max(c1, C_init_tot, C_new_tot) - fluxbio = (C_init_tot - C_new_tot + source)/dt + accuracyC = 1.0e-11_dbl_kind*max(c1, C_init_tot, C_new_tot) + fluxbio = fluxbio + (C_init_tot - C_new_tot + source)/dt diff_dt =C_new_tot - C_init_tot - (S_top+S_bot+L_bot*C_new(nblyr+1)+L_top*C_new(1))*dt if (minval(C_low) < c0) then write(warnstr,*) subname, 'Positivity of zbgc low order solution failed: C_low:',C_low - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + call icepack_warnings_add(warnstr) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) endif - if (abs(diff_dt) > accuracy ) then - call icepack_warnings_setabort(.true.,__FILE__,__LINE__) - write(warnstr,*) subname, 'Conservation of zbgc low order solution failed: diff_dt:',& - diff_dt - write(warnstr,*) subname, 'Total initial tracer', C_init_tot - write(warnstr,*) subname, 'Total final1 tracer', C_new_tot - write(warnstr,*) subname, 'bottom final tracer', C_new(nblyr+1) - write(warnstr,*) subname, 'top final tracer', C_new(1) - write(warnstr,*) subname, 'Near bottom final tracer', C_new(nblyr) - write(warnstr,*) subname, 'Near top final tracer', C_new(2) - write(warnstr,*) subname, 'Top flux*dt into ice:', S_top*dt - write(warnstr,*) subname, 'Bottom flux*dt into ice:', S_bot*dt - write(warnstr,*) subname, 'Remaining bot flux*dt into ice:', L_bot*C_new(nblyr+1)*dt + if (abs(diff_dt) > accuracyC ) then + write(warnstr,*) subname, '' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Conservation of zbgc low order solution failed: diff_dt:' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, diff_dt + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Total initial tracer' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, C_init_tot + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Total final1 tracer' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, C_new_tot + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'bottom final tracer' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, C_new(nblyr+1) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'top final tracer' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, C_new(1) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Near bottom final tracer' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, C_new(nblyr) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Near top final tracer' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, C_new(2) + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Top flux*dt into ice:' + call icepack_warnings_add(warnstr) + var_tmp = S_top*dt + write(warnstr,*) subname, var_tmp + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Bottom flux*dt into ice:' + call icepack_warnings_add(warnstr) + var_tmp = S_bot*dt + write(warnstr,*) subname, var_tmp + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Remaining bot flux*dt into ice:' + call icepack_warnings_add(warnstr) + var_tmp = L_bot*C_new(nblyr+1)*dt + write(warnstr,*) subname, var_tmp + call icepack_warnings_add(warnstr) write(warnstr,*) subname, 'S_bot*dt + L_bot*C_new(nblyr+1)*dt' - write(warnstr,*) subname, S_bot*dt + L_bot*C_new(nblyr+1)*dt - write(warnstr,*) subname, 'fluxbio*dt:', fluxbio*dt - write(warnstr,*) subname, 'fluxbio:', fluxbio - write(warnstr,*) subname, 'Remaining top flux*dt into ice:', L_top*C_new(1)*dt + call icepack_warnings_add(warnstr) + var_tmp = S_bot*dt + L_bot*C_new(nblyr+1)*dt + write(warnstr,*) subname, var_tmp + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'fluxbio*dt:' + call icepack_warnings_add(warnstr) + var_tmp = fluxbio*dt + write(warnstr,*) subname, var_tmp + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'fluxbio:' + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, fluxbio + call icepack_warnings_add(warnstr) + write(warnstr,*) subname, 'Remaining top flux*dt into ice:' + call icepack_warnings_add(warnstr) + var_tmp = L_top*C_new(1)*dt + write(warnstr,*) subname, var_tmp + call icepack_warnings_add(warnstr) + !call icepack_warnings_setabort(.true.,__FILE__,__LINE__) endif end subroutine check_conservation_FCT @@ -2635,11 +2796,7 @@ end subroutine check_conservation_FCT ! ! author: Nicole Jeffery, LANL - subroutine bgc_column_sum (nblyr, nslyr, hsnow, hbrine, xin, xout) - - integer (kind=int_kind), intent(in) :: & - nblyr, & ! number of ice layers - nslyr ! number of snow layers + subroutine bgc_column_sum (hsnow, hbrine, xin, xout) real (kind=dbl_kind), dimension(nblyr+3), intent(in) :: & xin ! input field @@ -2665,7 +2822,7 @@ subroutine bgc_column_sum (nblyr, nslyr, hsnow, hbrine, xin, xout) character(len=*),parameter :: subname='(bgc_column_sum)' hslyr = hsnow/real(nslyr,kind=dbl_kind) - dzssl = min(hslyr*p5, hs_ssl) + dzssl = hslyr*p5 dzint = max(c0,hsnow - dzssl) zspace = c1/real(nblyr,kind=dbl_kind) @@ -2678,6 +2835,138 @@ subroutine bgc_column_sum (nblyr, nslyr, hsnow, hbrine, xin, xout) end subroutine bgc_column_sum +!======================================================================= + +! Find the total carbon concentration by summing the appropriate +! biogeochemical tracers in units of mmol C/m2 +! +! author: Nicole Jeffery, LANL + + subroutine bgc_carbon_sum (hbrine, xin, xout) + + real (kind=dbl_kind), dimension(:), intent(in) :: & + xin ! input field, all tracers and column + + real (kind=dbl_kind), intent(in) :: & + hbrine ! brine height + + real (kind=dbl_kind), intent(out) :: & + xout ! output field mmol/m2 carbon + + ! local variables + + real (kind=dbl_kind), dimension(nblyr+1) :: & + zspace ! brine layer thickness/hbrine + + integer (kind=int_kind) :: & + n, m, iBioCount, iLayer, nBGC ! category/layer index + + character(len=*),parameter :: subname='(bgc_carbon_sum)' + + zspace(:) = c1/real(nblyr,kind=dbl_kind) + zspace(1) = p5*zspace(1) + zspace(nblyr+1) = zspace(1) + + xout = c0 + + if (tr_bgc_N) then + iBioCount = c0 + do m = 1, n_algae + nBGC = nt_bgc_N(1) + do n = 1, nblyr+1 + iLayer = iBioCount + n-1 + xout = xout + xin(nBGC+iLayer)*zspace(n)*hbrine*R_C2N(m) + enddo + iBioCount = iBioCount + nblyr+3 + enddo + endif + if (tr_bgc_C) then + iBioCount = c0 + nBGC = nt_bgc_DOC(1) + do m = 1, n_doc + do n = 1, nblyr+1 + iLayer = iBioCount + n-1 + xout = xout + xin(nBGC+iLayer)*zspace(n)*hbrine + enddo + iBioCount = iBioCount + nblyr+3 + enddo + do m = 1, n_dic + do n = 1, nblyr+1 + iLayer = iBioCount + n-1 + xout = xout + xin(nBGC+iLayer)*zspace(n)*hbrine + enddo + iBioCount = iBioCount + nblyr+3 + enddo + endif + + if (tr_bgc_DON) then + iBioCount = c0 + do m = 1, n_don + nBGC = nt_bgc_DON(1) + do n = 1, nblyr+1 + iLayer = iBioCount + n-1 + xout = xout + xin(nBGC+iLayer)*zspace(n)*hbrine*R_C2N_DON(m) + enddo + iBioCount = iBioCount + nblyr+3 + enddo + endif + if (tr_bgc_hum) then + nBGC = nt_bgc_hum + do n = 1, nblyr+1 + iLayer = n-1 + xout = xout + xin(nBGC+iLayer)*zspace(n)*hbrine + enddo + endif + + end subroutine bgc_carbon_sum + +!======================================================================= + +! Find the total carbon flux by summing the fluxes for the appropriate +! biogeochemical each grid cell, sum field over all ice and snow layers +! +! author: Nicole Jeffery, LANL + + subroutine bgc_carbon_flux (flux_bio_atm, flux_bion, Tot_Carbon_flux) + + real (kind=dbl_kind), dimension(:), intent(in) :: & + flux_bio_atm, & ! input field, all tracers and column + flux_bion + + real (kind=dbl_kind), intent(out) :: & + Tot_Carbon_flux ! output field mmol/m2/s carbon + + ! local variables + integer (kind=int_kind) :: & + m ! biology index + + character(len=*),parameter :: subname='(bgc_carbon_flux)' + + Tot_Carbon_flux = c0 + + if (tr_bgc_N) then + do m = 1, n_algae + Tot_Carbon_flux = Tot_Carbon_flux - (flux_bio_atm(nlt_bgc_N(m)) - flux_bion(nlt_bgc_N(m)))*R_C2N(m) + enddo + endif + if (tr_bgc_C) then + do m = 1, n_doc + Tot_Carbon_flux = Tot_Carbon_flux - flux_bio_atm(nlt_bgc_DOC(m)) + flux_bion(nlt_bgc_DOC(m)) + enddo + do m = 1, n_dic + Tot_Carbon_flux = Tot_Carbon_flux - flux_bio_atm(nlt_bgc_DIC(m)) + flux_bion(nlt_bgc_DIC(m)) + enddo + endif + if (tr_bgc_DON) then + do m = 1, n_don + Tot_Carbon_flux = Tot_Carbon_flux - (flux_bio_atm(nlt_bgc_DON(m)) - flux_bion(nlt_bgc_DON(m)))*R_C2N_DON(m) + enddo + endif + if (tr_bgc_hum) & + Tot_Carbon_flux = Tot_Carbon_flux - flux_bio_atm(nlt_bgc_hum) + flux_bion(nlt_bgc_hum) + + end subroutine bgc_carbon_flux + !======================================================================= end module icepack_algae diff --git a/columnphysics/icepack_atmo.F90 b/columnphysics/icepack_atmo.F90 index b4a97e0a4..f85b7794b 100644 --- a/columnphysics/icepack_atmo.F90 +++ b/columnphysics/icepack_atmo.F90 @@ -21,7 +21,7 @@ module icepack_atmo use icepack_parameters, only: pih, dragio, rhoi, rhos, rhow use icepack_parameters, only: atmbndy, calc_strair, formdrag use icepack_parameters, only: icepack_chkoptargflag - use icepack_tracers, only: n_iso + use icepack_tracers, only: ncat, n_iso use icepack_tracers, only: tr_iso use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -521,13 +521,10 @@ subroutine neutral_drag_coeffs (apnd, hpnd, & hdraft, hridge, & distrdg, hkeel, & dkeel, lfloe, & - dfloe, ncat) + dfloe) use icepack_tracers, only: tr_pond - integer (kind=int_kind), intent(in) :: & - ncat - real (kind=dbl_kind), dimension (:), intent(in) :: & apnd ,& ! melt pond fraction of sea ice hpnd ,& ! mean melt pond depth over sea ice diff --git a/columnphysics/icepack_brine.F90 b/columnphysics/icepack_brine.F90 index 98aea58da..f4738a4d8 100644 --- a/columnphysics/icepack_brine.F90 +++ b/columnphysics/icepack_brine.F90 @@ -7,19 +7,19 @@ module icepack_brine use icepack_kinds - use icepack_parameters, only: p01, p001, p5, c0, c1, c2, c1p5, puny + use icepack_parameters, only: p01, p001, p5, c0, c1, c2, c1p5, puny, p25 use icepack_parameters, only: gravit, rhoi, rhow, rhos, depressT use icepack_parameters, only: salt_loss, min_salin, rhosi use icepack_parameters, only: dts_b, l_sk - use icepack_tracers, only: ntrcr, nt_qice, nt_sice + use icepack_tracers, only: nilyr, nblyr, ntrcr, nt_qice, nt_sice use icepack_tracers, only: nt_Tsfc use icepack_zbgc_shared, only: k_o, exp_h, Dm, Ra_c, viscos_dynamic, thinS + use icepack_zbgc_shared, only: bgrid, cgrid, igrid, swgrid, icgrid use icepack_zbgc_shared, only: remap_zbgc use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted use icepack_mushy_physics, only: icepack_mushy_temperature_mush, icepack_mushy_liquid_fraction - use icepack_therm_shared, only: calculate_Tin_from_qin implicit none @@ -62,7 +62,7 @@ subroutine preflushing_changes (aicen, vicen, vsnon, & meltb, meltt, congel, & snoice, hice_old, dhice, & fbri, dhbr_top, dhbr_bot, & - hbr_old, hin,hsn, firstice ) + hbr_old, hin, hsn) real (kind=dbl_kind), intent(in) :: & aicen , & ! concentration of ice @@ -87,9 +87,6 @@ subroutine preflushing_changes (aicen, vicen, vsnon, & dhbr_bot , & ! brine change in bottom for diagnostics (m) hice_old ! old ice thickness (m) - logical (kind=log_kind), intent(in) :: & - firstice ! if true, initialized values should be used - ! local variables real (kind=dbl_kind) :: & @@ -117,14 +114,6 @@ subroutine preflushing_changes (aicen, vicen, vsnon, & dhbr_top = meltt - snoice - dhice dhbr_bot = congel - meltb - if ((hice_old < puny) .OR. (hin_old < puny) .OR. firstice) then - hice_old = hin - dhbr_top = c0 - dhbr_bot = c0 - dhice = c0 - fbri = c1 - endif - hbr_old = fbri * hice_old end subroutine preflushing_changes @@ -135,28 +124,13 @@ end subroutine preflushing_changes ! NOTE: This subroutine uses thermosaline_vertical output to compute ! average ice permeability and the surface ice porosity - subroutine compute_microS_mushy (nilyr, nblyr, & - bgrid, cgrid, igrid, & - trcrn, hice_old, hbr_old, & + subroutine compute_microS_mushy (trcrn, hice_old, hbr_old, & sss, sst, bTin, & iTin, bphin, & - kperm, bphi_min, & + kperm, bphi_min, & bSin, brine_sal, brine_rho, & iphin, ibrine_rho, ibrine_sal, & - sice_rho, iDin ) - - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nblyr ! number of bio layers - - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bgrid ! biology nondimensional vertical grid points - - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: & - cgrid ! CICE vertical coordinate + iDin, iSin) real (kind=dbl_kind), intent(in) :: & hice_old , & ! previous timestep ice height (m) @@ -170,7 +144,7 @@ subroutine compute_microS_mushy (nilyr, nblyr, & kperm , & ! average ice permeability (m^2) bphi_min ! surface porosity - real (kind=dbl_kind), intent(inout) :: & + real (kind=dbl_kind), intent(in) :: & hbr_old ! previous timestep brine height (m) real (kind=dbl_kind), dimension (nblyr+1), intent(inout) :: & @@ -180,7 +154,8 @@ subroutine compute_microS_mushy (nilyr, nblyr, & iphin , & ! porosity on the igrid ibrine_rho , & ! brine rho on interface ibrine_sal , & ! brine sal on interface - iTin ! Temperature on the igrid (oC) + iTin , & ! Temperature on the igrid (oC) + iSin ! Salinity on the igrid (ppt) real (kind=dbl_kind), dimension (nblyr+2), intent(inout) :: & bSin , & ! bulk salinity (ppt) on bgrid @@ -191,10 +166,15 @@ subroutine compute_microS_mushy (nilyr, nblyr, & bTin , & ! Temperature on bgrid bphin ! porosity on bgrid - real (kind=dbl_kind), intent(inout) :: & - sice_rho ! average ice density + ! local variables + + real (kind=dbl_kind), dimension (nilyr) :: & + cSin , & ! bulk salinity (ppt) + cqin ! enthalpy () real (kind=dbl_kind), dimension (nblyr+2) :: & + zTin , & ! Temperature of ice layers on bgrid (C) + zSin , & ! Salinity of ice layers on bgrid (C) bqin ! enthalpy on the bgrid () real (kind=dbl_kind), dimension (nblyr+1) :: & @@ -205,7 +185,8 @@ subroutine compute_microS_mushy (nilyr, nblyr, & real (kind=dbl_kind) :: & surface_S , & ! salinity of ice above hin > hbr - hinc_old ! mean ice thickness before current melt/growth (m) + hinc_old , & ! mean ice thickness before current melt/growth (m) + hbrc_old ! mean brine thickness before current melt/growth (m) real (kind=dbl_kind), dimension (ntrcr+2) :: & ! nblyr+2) trtmp_s , & ! temporary, remapped tracers @@ -227,9 +208,13 @@ subroutine compute_microS_mushy (nilyr, nblyr, & trtmp_q(:) = c0 iDin(:) = c0 + do k = 1, nilyr + cSin(k) = trcrn(nt_sice+k-1) + cqin(k) = trcrn(nt_qice+k-1) + enddo + ! map Sin and qin (cice) profiles to bgc grid surface_S = min_salin - hbr_old = min(hbr_old, maxhbr*hice_old) hinc_old = hice_old call remap_zbgc(nilyr, & @@ -269,18 +254,15 @@ subroutine compute_microS_mushy (nilyr, nblyr, & ! Define ice multiphase structure !----------------------------------------------------------------- - call prepare_hbrine (nblyr, & - bSin, bTin, iTin, & + call prepare_hbrine (bSin, bTin, iTin, & brine_sal, brine_rho, & ibrine_sal, ibrine_rho, & - sice_rho, & bphin, iphin, & - kperm, bphi_min, & - igrid, sss) + kperm, bphi_min, & + sss, iSin) if (icepack_warnings_aborted(subname)) return - call calculate_drho(nblyr, igrid, bgrid, & - brine_rho, ibrine_rho, drho) + call calculate_drho(brine_rho, ibrine_rho, drho) if (icepack_warnings_aborted(subname)) return do k= 2, nblyr+1 @@ -295,21 +277,16 @@ end subroutine compute_microS_mushy !======================================================================= - subroutine prepare_hbrine (nblyr, & - bSin, bTin, iTin, & + subroutine prepare_hbrine (bSin, bTin, iTin, & brine_sal, brine_rho, & ibrine_sal, ibrine_rho, & - sice_rho, bphin, iphin,& + bphin, iphin, & kperm, bphi_min, & - i_grid, sss) - - integer (kind=int_kind), intent(in) :: & - nblyr ! number of bio layers + sss, iSin) real (kind=dbl_kind), dimension (:), intent(in) :: & bSin , & ! salinity of ice layers on bio grid (ppt) - bTin , & ! temperature of ice layers on bio grid for history (C) - i_grid ! biology grid interface points + bTin ! temperature of ice layers on bio grid for history (C) real (kind=dbl_kind), dimension (:), intent(inout) :: & brine_sal , & ! equilibrium brine salinity (ppt) @@ -318,7 +295,8 @@ subroutine prepare_hbrine (nblyr, & ibrine_sal , & ! brine salinity on interface (ppt) iphin , & ! porosity on interface iTin , & ! Temperature on interface - bphin ! porosity of layers + bphin , & ! porosity of layers + iSin ! Bulk salinity on interface real (kind=dbl_kind), intent(in) :: & sss ! sea surface salinity (ppt) @@ -327,9 +305,6 @@ subroutine prepare_hbrine (nblyr, & kperm , & ! harmonic average permeability (m^2) bphi_min ! minimum porosity - real (kind=dbl_kind), intent(inout) :: & - sice_rho ! avg sea ice density - ! local variables real (kind=dbl_kind), dimension(nblyr+1) :: & @@ -348,14 +323,12 @@ subroutine prepare_hbrine (nblyr, & ! calculate equilibrium brine density and gradients !----------------------------------------------------------------- - sice_rho = c0 - do k = 1, nblyr+1 if (k == 1) then igrm = 0 else - igrm = i_grid(k) - i_grid(k-1) + igrm = igrid(k) - igrid(k-1) endif brine_sal(k) = a1*bTin(k) & @@ -366,8 +339,6 @@ subroutine prepare_hbrine (nblyr, & / (brine_sal(k)*brine_rho(k))) bphin (k) = min(c1, bphin(k)) kin (k) = k_o*bphin(k)**exp_h - sice_rho = sice_rho + (rhoi*(c1-bphin(k)) & - + brine_rho(k)*bphin(k))*igrm enddo ! k brine_sal (nblyr+2) = sss @@ -379,6 +350,8 @@ subroutine prepare_hbrine (nblyr, & ibrine_rho(nblyr+1) = brine_rho (nblyr+2) iTin (1) = bTin(2) iTin (nblyr+1) = bTin(nblyr+1) + iSin (1) = bSin(2) + iSin (nblyr+1) = bSin(nblyr+1) iphin (1) = bphin (2) iphin (nblyr+1) = bphin (nblyr+1) k_min = MINVAL(kin(2:nblyr+1)) @@ -394,13 +367,14 @@ subroutine prepare_hbrine (nblyr, & kperm = k_min endif - igrp = i_grid(k+1) - i_grid(k ) - igrm = i_grid(k ) - i_grid(k-1) - rigr = c1 / (i_grid(k+1)-i_grid(k-1)) + igrp = igrid(k+1) - igrid(k ) + igrm = igrid(k ) - igrid(k-1) + rigr = c1 / (igrid(k+1)-igrid(k-1)) ibrine_sal(k) = (brine_sal(k+1)*igrp + brine_sal(k)*igrm) * rigr ibrine_rho(k) = (brine_rho(k+1)*igrp + brine_rho(k)*igrm) * rigr iTin (k) = (bTin (k+1)*igrp + bTin (k)*igrm) * rigr + iSin (k) = (bSin (k+1)*igrp + bSin (k)*igrm) * rigr iphin (k) = max(puny, & (bphin (k+1)*igrp + bphin (k)*igrm) * rigr) iphin (k) = min(c1, iphin (k)) @@ -426,12 +400,12 @@ end subroutine prepare_hbrine ! ice. This volume fraction may be > 1 in which case there is brine ! above the ice surface (ponds). - subroutine update_hbrine (meltt, & + subroutine update_hbrine (meltt, & melts, dt, & hin, hsn, & hin_old, hbr, & - hbr_old, & - fbri, & + hbr_old, & + fbri, & dhS_top, dhS_bottom, & dh_top_chl, dh_bot_chl, & kperm, bphi_min, & @@ -561,17 +535,7 @@ end subroutine update_hbrine ! Find density difference about interface grid points ! for gravity drainage parameterization - subroutine calculate_drho (nblyr, i_grid, b_grid, & - brine_rho, ibrine_rho, drho) - - integer (kind=int_kind), intent(in) :: & - nblyr ! number of bio layers - - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - b_grid ! biology nondimensional grid layer points - - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - i_grid ! biology grid interface points + subroutine calculate_drho (brine_rho, ibrine_rho, drho) real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & brine_rho ! Internal brine density (kg/m^3) @@ -606,29 +570,29 @@ subroutine calculate_drho (nblyr, i_grid, b_grid, & rho_2b(:) = c0 drho (:) = c0 ! surface is snow or atmosphere - do k = 1, nblyr+1 ! i_grid values + do k = 1, nblyr+1 ! igrid values !---------------------------------------------- - ! h_avg(k) = i_grid(k) - ! Calculate rho_a(k), ie average rho above i_grid(k) + ! h_avg(k) = igrid(k) + ! Calculate rho_a(k), ie average rho above igrid(k) ! first part is good !---------------------------------------------- if (k == 2) then - rho_a(2) = (brine_rho(2)*b_grid(2) & + rho_a(2) = (brine_rho(2)*bgrid(2) & + (ibrine_rho(2) + brine_rho(2)) & - * p5*(i_grid(2)-b_grid(2)) )/i_grid(2) + * p5*(igrid(2)-bgrid(2)) )/igrid(2) rho_b(2) = brine_rho(2) elseif (k > 2 .AND. k < nblyr+1) then - rho_a(k) = (rho_a(k-1)*i_grid(k-1) + (ibrine_rho(k-1) + brine_rho(k)) & - * p5*(b_grid(k)-i_grid(k-1)) + (ibrine_rho(k ) + brine_rho(k)) & - * p5*(i_grid(k)-b_grid(k)))/i_grid(k) + rho_a(k) = (rho_a(k-1)*igrid(k-1) + (ibrine_rho(k-1) + brine_rho(k)) & + * p5*(bgrid(k)-igrid(k-1)) + (ibrine_rho(k ) + brine_rho(k)) & + * p5*(igrid(k)-bgrid(k)))/igrid(k) rho_b(k) = brine_rho(k) else - rho_a(nblyr+1) = (rho_a(nblyr)*i_grid(nblyr) + (ibrine_rho(nblyr) + & - brine_rho(nblyr+1))*p5*(b_grid(nblyr+1)-i_grid(nblyr)) + & - brine_rho(nblyr+1)*(i_grid(nblyr+1)-b_grid(nblyr+1)))/i_grid(nblyr+1) + rho_a(nblyr+1) = (rho_a(nblyr)*igrid(nblyr) + (ibrine_rho(nblyr) + & + brine_rho(nblyr+1))*p5*(bgrid(nblyr+1)-igrid(nblyr)) + & + brine_rho(nblyr+1)*(igrid(nblyr+1)-bgrid(nblyr+1)))/igrid(nblyr+1) rho_a(1) = brine_rho(2) !for k == 1 use grid point value rho_b(nblyr+1) = brine_rho(nblyr+1) rho_b(1) = brine_rho(2) @@ -640,10 +604,10 @@ subroutine calculate_drho (nblyr, i_grid, b_grid, & ! Calculate average above and below k rho_2a !---------------------------------------------- - do k = 1, nblyr+1 !i_grid values + do k = 1, nblyr+1 !igrid values if (k == 1) then - rho_2a(1) = (rho_a(1)*b_grid(2) + p5*(brine_rho(2) + ibrine_rho(2)) & - * (i_grid(2)-b_grid(2)))/i_grid(2) + rho_2a(1) = (rho_a(1)*bgrid(2) + p5*(brine_rho(2) + ibrine_rho(2)) & + * (igrid(2)-bgrid(2)))/igrid(2) rho_2b(1) = brine_rho(2) else mstop = 2*(k-1) + 1 @@ -657,7 +621,7 @@ subroutine calculate_drho (nblyr, i_grid, b_grid, & endif do mm = mstart,mstop - rho_2a(k) =(rho_a(nblyr+1) + rhow*(c2*i_grid(k)-c1))*p5/i_grid(k) + rho_2a(k) =(rho_a(nblyr+1) + rhow*(c2*igrid(k)-c1))*p5/igrid(k) enddo rho_2b(k) = brine_rho(k+1) endif @@ -671,26 +635,22 @@ end subroutine calculate_drho !autodocument_start icepack_init_hbrine ! Initialize brine height tracer - subroutine icepack_init_hbrine(bgrid, igrid, cgrid, & - icgrid, swgrid, nblyr, nilyr, phi_snow) - - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nblyr ! number of bio layers + subroutine icepack_init_hbrine(bgrid_out, igrid_out, cgrid_out, & + icgrid_out, swgrid_out, phi_snow) - real (kind=dbl_kind), intent(inout) :: & + real (kind=dbl_kind), optional, intent(inout) :: & phi_snow ! porosity at the ice-snow interface - real (kind=dbl_kind), dimension (nblyr+2), intent(out) :: & - bgrid ! biology nondimensional vertical grid points + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + bgrid_out ! biology nondimensional vertical grid points - real (kind=dbl_kind), dimension (nblyr+1), intent(out) :: & - igrid ! biology vertical interface points + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + igrid_out ! biology vertical interface points - real (kind=dbl_kind), dimension (nilyr+1), intent(out) :: & - cgrid , & ! CICE vertical coordinate - icgrid , & ! interface grid for CICE (shortwave variable) - swgrid ! grid for ice tracers used in dEdd scheme + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + cgrid_out , & ! CICE vertical coordinate + icgrid_out , & ! interface grid for CICE (shortwave variable) + swgrid_out ! grid for ice tracers used in dEdd scheme !autodocument_end @@ -704,8 +664,17 @@ subroutine icepack_init_hbrine(bgrid, igrid, cgrid, & character(len=*),parameter :: subname='(icepack_init_hbrine)' + !----------------------------------------------------------------- - if (phi_snow .le. c0) phi_snow = c1-rhos/rhoi + if (present(phi_snow)) then + if (phi_snow .le. c0) phi_snow = c1-rhos/rhoi + endif + + allocate(bgrid (nblyr+2)) + allocate(igrid (nblyr+1)) + allocate(cgrid (nilyr+1)) + allocate(icgrid(nilyr+1)) + allocate(swgrid(nilyr+1)) !----------------------------------------------------------------- ! Calculate bio gridn: 0 to 1 corresponds to ice top to bottom @@ -755,12 +724,18 @@ subroutine icepack_init_hbrine(bgrid, igrid, cgrid, & ! swgrid represents the layer index of the delta-eddington ice layer index !------------------------------------------------------------------------ zspace = c1/(real(nilyr,kind=dbl_kind)) ! CICE grid spacing - swgrid(1) = min(c1/60.0_dbl_kind, zspace/c2) + swgrid(1) = min(c1/60.0_dbl_kind, zspace*p25) !p5 to p25. NJ: allows thinner surface layers swgrid(2) = zspace/c2 !+ swgrid(1) do k = 3, nilyr+1 swgrid(k) = zspace * (real(k,kind=dbl_kind)-c1p5) enddo + if (present( bgrid_out)) bgrid_out=bgrid + if (present( cgrid_out)) cgrid_out=cgrid + if (present( igrid_out)) igrid_out=igrid + if (present(icgrid_out)) icgrid_out=icgrid + if (present(swgrid_out)) swgrid_out=swgrid + end subroutine icepack_init_hbrine !======================================================================= @@ -768,14 +743,8 @@ end subroutine icepack_init_hbrine ! **DEPRECATED**, all code removed ! Interface provided for backwards compatibility - subroutine icepack_init_zsalinity(nblyr,ntrcr_o, Rayleigh_criteria, & - Rayleigh_real, trcrn_bgc, nt_bgc_S, ncat, sss) - - integer (kind=int_kind), intent(in) :: & - nblyr , & ! number of biolayers - ntrcr_o, & ! number of non bio tracers - ncat , & ! number of categories - nt_bgc_S ! zsalinity index + subroutine icepack_init_zsalinity(Rayleigh_criteria, & + Rayleigh_real, trcrn_bgc, sss) logical (kind=log_kind), intent(inout) :: & Rayleigh_criteria diff --git a/columnphysics/icepack_flux.F90 b/columnphysics/icepack_flux.F90 index ce0b4b72c..27a9f0f80 100644 --- a/columnphysics/icepack_flux.F90 +++ b/columnphysics/icepack_flux.F90 @@ -68,7 +68,9 @@ subroutine merge_fluxes (aicen, & ! single category fluxes real (kind=dbl_kind), intent(in) :: & - aicen , & ! concentration of ice + aicen ! concentration of ice + + real (kind=dbl_kind), optional, intent(in) :: & flw , & ! downward longwave flux (W/m**2) strairxn, & ! air/ice zonal strss, (N/m**2) strairyn, & ! air/ice merdnl strss, (N/m**2) @@ -95,9 +97,7 @@ subroutine merge_fluxes (aicen, & meltsliqn,& ! mass of snow melt (kg/m^2) dsnown , & ! change in snow depth (m) congeln , & ! congelation ice growth (m) - snoicen ! snow-ice growth (m) - - real (kind=dbl_kind), optional, intent(in):: & + snoicen , & ! snow-ice growth (m) fswthrun_vdr, & ! vis dir sw radiation through ice bot (W/m**2) fswthrun_vdf, & ! vis dif sw radiation through ice bot (W/m**2) fswthrun_idr, & ! nir dir sw radiation through ice bot (W/m**2) @@ -105,7 +105,7 @@ subroutine merge_fluxes (aicen, & Urefn ! air speed reference level (m/s) ! cumulative fluxes - real (kind=dbl_kind), intent(inout) :: & + real (kind=dbl_kind), optional, intent(inout) :: & strairxT, & ! air/ice zonal strss, (N/m**2) strairyT, & ! air/ice merdnl strss, (N/m**2) Cdn_atm_ratio, & ! ratio of total drag over neutral drag @@ -130,28 +130,24 @@ subroutine merge_fluxes (aicen, & melts , & ! snow melt (m) meltsliq, & ! mass of snow melt (kg/m^2) congel , & ! congelation ice growth (m) - snoice ! snow-ice growth (m) - - real (kind=dbl_kind), intent(inout), optional :: & - fswthru_vdr , & ! vis dir sw radiation through ice bot (W/m**2) - fswthru_vdf , & ! vis dif sw radiation through ice bot (W/m**2) - fswthru_idr , & ! nir dir sw radiation through ice bot (W/m**2) - fswthru_idf ! nir dif sw radiation through ice bot (W/m**2) - - real (kind=dbl_kind), intent(inout), optional :: & + snoice , & ! snow-ice growth (m) + fswthru_vdr, & ! vis dir sw radiation through ice bot (W/m**2) + fswthru_vdf, & ! vis dif sw radiation through ice bot (W/m**2) + fswthru_idr, & ! nir dir sw radiation through ice bot (W/m**2) + fswthru_idf, & ! nir dif sw radiation through ice bot (W/m**2) dsnow, & ! change in snow depth (m) Uref ! air speed reference level (m/s) - real (kind=dbl_kind), dimension(:), intent(inout), optional :: & - Qref_iso, & ! isotope air sp hum ref level (kg/kg) - fiso_ocn, & ! isotope fluxes to ocean (kg/m2/s) - fiso_evap ! isotope evaporation (kg/m2/s) - real (kind=dbl_kind), dimension(:), intent(in), optional :: & Qrefn_iso, & ! isotope air sp hum ref level (kg/kg) fiso_ocnn, & ! isotope fluxes to ocean (kg/m2/s) fiso_evapn ! isotope evaporation (kg/m2/s) + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & + Qref_iso, & ! isotope air sp hum ref level (kg/kg) + fiso_ocn, & ! isotope fluxes to ocean (kg/m2/s) + fiso_evap ! isotope evaporation (kg/m2/s) + character(len=*),parameter :: subname='(merge_fluxes)' !----------------------------------------------------------------- @@ -163,23 +159,38 @@ subroutine merge_fluxes (aicen, & ! atmo fluxes - strairxT = strairxT + strairxn * aicen - strairyT = strairyT + strairyn * aicen - Cdn_atm_ratio = Cdn_atm_ratio + & - Cdn_atm_ratio_n * aicen - fsurf = fsurf + fsurfn * aicen - fcondtop = fcondtop + fcondtopn * aicen - fcondbot = fcondbot + fcondbotn * aicen - fsens = fsens + fsensn * aicen - flat = flat + flatn * aicen - fswabs = fswabs + fswabsn * aicen - flwout = flwout & - + (flwoutn - (c1-emissivity)*flw) * aicen - evap = evap + evapn * aicen - evaps = evaps + evapsn * aicen - evapi = evapi + evapin * aicen - Tref = Tref + Trefn * aicen - Qref = Qref + Qrefn * aicen + if (present(strairxn) .and. present(strairxT)) & + strairxT = strairxT + strairxn * aicen + if (present(strairyn) .and. present(strairyT)) & + strairyT = strairyT + strairyn * aicen + if (present(Cdn_atm_ratio_n) .and. present(Cdn_atm_ratio)) & + Cdn_atm_ratio = Cdn_atm_ratio + & + Cdn_atm_ratio_n * aicen + if (present(fsurfn) .and. present(fsurf)) & + fsurf = fsurf + fsurfn * aicen + if (present(fcondtopn) .and. present(fcondtop)) & + fcondtop = fcondtop + fcondtopn * aicen + if (present(fcondbotn) .and. present(fcondbot)) & + fcondbot = fcondbot + fcondbotn * aicen + if (present(fsensn) .and. present(fsens)) & + fsens = fsens + fsensn * aicen + if (present(flatn) .and. present(flat)) & + flat = flat + flatn * aicen + if (present(fswabsn) .and. present(fswabs)) & + fswabs = fswabs + fswabsn * aicen + if (present(flwoutn) .and. present(flwout) .and. present(flw)) & + flwout = flwout & + + (flwoutn - (c1-emissivity)*flw) * aicen + if (present(evapn) .and. present(evap)) & + evap = evap + evapn * aicen + if (present(evapsn) .and. present(evaps)) & + evaps = evaps + evapsn * aicen + if (present(evapin) .and. present(evapi)) & + evapi = evapi + evapin * aicen + if (present(Trefn) .and. present(Tref)) & + Tref = Tref + Trefn * aicen + if (present(Qrefn) .and. present(Qref)) & + Qref = Qref + Qrefn * aicen ! Isotopes if (tr_iso) then @@ -196,35 +207,46 @@ subroutine merge_fluxes (aicen, & ! ocean fluxes if (present(Urefn) .and. present(Uref)) then - Uref = Uref + Urefn * aicen + Uref = Uref + Urefn * aicen endif - fresh = fresh + freshn * aicen - fsalt = fsalt + fsaltn * aicen - fhocn = fhocn + fhocnn * aicen - fswthru = fswthru + fswthrun * aicen - if (present(fswthru_vdr)) & - fswthru_vdr = fswthru_vdr + fswthrun_vdr * aicen - if (present(fswthru_vdf)) & - fswthru_vdf = fswthru_vdf + fswthrun_vdf * aicen - if (present(fswthru_idr)) & - fswthru_idr = fswthru_idr + fswthrun_idr * aicen - if (present(fswthru_idf)) & - fswthru_idf = fswthru_idf + fswthrun_idf * aicen + if (present(freshn) .and. present(fresh)) & + fresh = fresh + freshn * aicen + if (present(fsaltn) .and. present(fsalt)) & + fsalt = fsalt + fsaltn * aicen + if (present(fhocnn) .and. present(fhocn)) & + fhocn = fhocn + fhocnn * aicen + if (present(fswthrun) .and. present(fswthru)) & + fswthru = fswthru + fswthrun * aicen + + if (present(fswthrun_vdr) .and. present(fswthru_vdr)) & + fswthru_vdr = fswthru_vdr + fswthrun_vdr * aicen + if (present(fswthrun_vdf) .and. present(fswthru_vdf)) & + fswthru_vdf = fswthru_vdf + fswthrun_vdf * aicen + if (present(fswthrun_idr) .and. present(fswthru_idr)) & + fswthru_idr = fswthru_idr + fswthrun_idr * aicen + if (present(fswthrun_idf) .and. present(fswthru_idf)) & + fswthru_idf = fswthru_idf + fswthrun_idf * aicen ! ice/snow thickness - meltt = meltt + melttn * aicen - meltb = meltb + meltbn * aicen - melts = melts + meltsn * aicen + if (present(melttn) .and. present(meltt)) & + meltt = meltt + melttn * aicen + if (present(meltbn) .and. present(meltb)) & + meltb = meltb + meltbn * aicen + if (present(meltsn) .and. present(melts)) & + melts = melts + meltsn * aicen if (snwgrain) then - meltsliq = meltsliq + meltsliqn * aicen + if (present(meltsliqn) .and. present(meltsliq)) & + meltsliq = meltsliq + meltsliqn * aicen endif - if (present(dsnow)) then + if (present(dsnown) .and. present(dsnow)) then dsnow = dsnow + dsnown * aicen endif - congel = congel + congeln * aicen - snoice = snoice + snoicen * aicen + if (present(congeln) .and. present(congel)) & + congel = congel + congeln * aicen + if (present(snoicen) .and. present(snoice)) & + snoice = snoice + snoicen * aicen end subroutine merge_fluxes diff --git a/columnphysics/icepack_fsd.F90 b/columnphysics/icepack_fsd.F90 index 1454fdefc..2e5175afa 100644 --- a/columnphysics/icepack_fsd.F90 +++ b/columnphysics/icepack_fsd.F90 @@ -45,7 +45,7 @@ module icepack_fsd use icepack_kinds use icepack_parameters, only: c0, c1, c2, c4, p01, p1, p5, puny use icepack_parameters, only: pi, floeshape, wave_spec, bignum, gravit, rhoi - use icepack_tracers, only: nt_fsd, tr_fsd + use icepack_tracers, only: nt_fsd, tr_fsd, nfsd, ncat use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -55,13 +55,19 @@ module icepack_fsd public :: icepack_init_fsd_bounds, icepack_init_fsd, icepack_cleanup_fsd, & fsd_lateral_growth, fsd_add_new_ice, fsd_weld_thermo, get_subdt_fsd - real(kind=dbl_kind), dimension(:), allocatable :: & + real(kind=dbl_kind), dimension(:), allocatable, public :: & floe_rad_h, & ! fsd size higher bound in m (radius) + floe_rad_c, & ! fsd size center in m (radius) + floe_rad_l, & ! fsd size lower bound in m (radius) + floe_binwidth, & ! fsd size binwidth in m (radius) floe_area_l, & ! fsd area at lower bound (m^2) floe_area_h, & ! fsd area at higher bound (m^2) floe_area_c, & ! fsd area at bin centre (m^2) floe_area_binwidth ! floe area bin width (m^2) + character (len=35), dimension(:), allocatable, public :: & + c_fsd_range ! string for history output + integer(kind=int_kind), dimension(:,:), allocatable, public :: & iweld ! floe size categories that can combine ! during welding (dimensionless) @@ -84,26 +90,23 @@ module icepack_fsd ! ! authors: Lettie Roach, NIWA/VUW and C. M. Bitz, UW - subroutine icepack_init_fsd_bounds(nfsd, & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range, & ! string for history output - write_diags ) ! flag for writing diagnostics - - integer (kind=int_kind), intent(in) :: & - nfsd ! number of floe size categories + subroutine icepack_init_fsd_bounds( & + floe_rad_l_out, & ! fsd size lower bound in m (radius) + floe_rad_c_out, & ! fsd size bin centre in m (radius) + floe_binwidth_out, & ! fsd size bin width in m (radius) + c_fsd_range_out, & ! string for history output + write_diags) ! flag for writing diagnostics - real(kind=dbl_kind), dimension(:), intent(inout) :: & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) + real(kind=dbl_kind), dimension(:), intent(out), optional :: & + floe_rad_l_out, & ! fsd size lower bound in m (radius) + floe_rad_c_out, & ! fsd size bin centre in m (radius) + floe_binwidth_out ! fsd size bin width in m (radius) - character (len=35), intent(out) :: & - c_fsd_range(nfsd) ! string for history output + character (len=35), dimension(:), intent(out), optional :: & + c_fsd_range_out ! string for history output logical (kind=log_kind), intent(in), optional :: & - write_diags ! write diags flag + write_diags ! write diags flag !autodocument_end @@ -114,11 +117,8 @@ subroutine icepack_init_fsd_bounds(nfsd, & real (kind=dbl_kind) :: test - real (kind=dbl_kind), dimension (0:nfsd) :: & - floe_rad - real (kind=dbl_kind), dimension(:), allocatable :: & - lims + lims, floe_rad character(len=8) :: c_fsd1,c_fsd2 character(len=2) :: c_nf @@ -172,10 +172,15 @@ subroutine icepack_init_fsd_bounds(nfsd, & allocate( & floe_rad_h (nfsd), & ! fsd size higher bound in m (radius) + floe_rad_l (nfsd), & ! fsd size lower bound in m (radius) + floe_rad_c (nfsd), & ! fsd size center in m (radius) + floe_rad (0:nfsd), & ! fsd bounds in m (radius) floe_area_l (nfsd), & ! fsd area at lower bound (m^2) floe_area_h (nfsd), & ! fsd area at higher bound (m^2) floe_area_c (nfsd), & ! fsd area at bin centre (m^2) floe_area_binwidth (nfsd), & ! floe area bin width (m^2) + floe_binwidth (nfsd), & ! floe bin width (m) + c_fsd_range (nfsd), & ! iweld (nfsd, nfsd), & ! fsd categories that can weld stat=ierr) if (ierr/=0) then @@ -189,8 +194,11 @@ subroutine icepack_init_fsd_bounds(nfsd, & floe_rad_c = (floe_rad_h+floe_rad_l)/c2 floe_area_l = c4*floeshape*floe_rad_l**2 - floe_area_c = c4*floeshape*floe_rad_c**2 floe_area_h = c4*floeshape*floe_rad_h**2 +! floe_area_c = c4*floeshape*floe_rad_c**2 +! This is exactly in the middle of floe_area_h and floe_area_l +! Whereas the above calculation is closer to floe_area_l. + floe_area_c = (floe_area_h+floe_area_l)/c2 floe_binwidth = floe_rad_h - floe_rad_l @@ -223,20 +231,56 @@ subroutine icepack_init_fsd_bounds(nfsd, & enddo if (present(write_diags)) then - if (write_diags) then - write(warnstr,*) ' ' - call icepack_warnings_add(warnstr) - write(warnstr,*) subname - call icepack_warnings_add(warnstr) - write(warnstr,*) 'floe_rad(n-1) < fsd Cat n < floe_rad(n)' - call icepack_warnings_add(warnstr) - do n = 1, nfsd - write(warnstr,*) floe_rad(n-1),' < fsd Cat ',n, ' < ',floe_rad(n) + if (write_diags) then + write(warnstr,*) ' ' call icepack_warnings_add(warnstr) - enddo - write(warnstr,*) ' ' - call icepack_warnings_add(warnstr) + write(warnstr,*) subname + call icepack_warnings_add(warnstr) + write(warnstr,*) 'floe_rad(n-1) < fsd Cat n < floe_rad(n)' + call icepack_warnings_add(warnstr) + do n = 1, nfsd + write(warnstr,*) floe_rad(n-1),' < fsd Cat ',n, ' < ',floe_rad(n) + call icepack_warnings_add(warnstr) + enddo + write(warnstr,*) ' ' + call icepack_warnings_add(warnstr) + endif endif + + if (present(floe_rad_l_out)) then + if (size(floe_rad_l_out) /= size(floe_rad_l)) then + call icepack_warnings_add(subname//' floe_rad_l_out incorrect size') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + floe_rad_l_out(:) = floe_rad_l(:) + endif + + if (present(floe_rad_c_out)) then + if (size(floe_rad_c_out) /= size(floe_rad_c)) then + call icepack_warnings_add(subname//' floe_rad_c_out incorrect size') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + floe_rad_c_out(:) = floe_rad_c(:) + endif + + if (present(floe_binwidth_out)) then + if (size(floe_binwidth_out) /= size(floe_binwidth)) then + call icepack_warnings_add(subname//' floe_binwidth_out incorrect size') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + floe_binwidth_out(:) = floe_binwidth(:) + endif + + if (present(c_fsd_range_out)) then + if (size(c_fsd_range_out) /= size(c_fsd_range)) then + call icepack_warnings_add(subname//' c_fsd_range_out incorrect size') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + c_fsd_range_out(:) = c_fsd_range(:) endif end subroutine icepack_init_fsd_bounds @@ -259,21 +303,11 @@ end subroutine icepack_init_fsd_bounds ! ! authors: Lettie Roach, NIWA/VUW - subroutine icepack_init_fsd(nfsd, ice_ic, & - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth, & ! fsd size bin width in m (radius) - afsd) ! floe size distribution tracer - - integer(kind=int_kind), intent(in) :: & - nfsd + subroutine icepack_init_fsd(ice_ic, afsd) ! floe size distribution tracer character(len=char_len_long), intent(in) :: & ice_ic ! method of ice cover initialization - real(kind=dbl_kind), dimension(:), intent(inout) :: & - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) - real (kind=dbl_kind), dimension (:), intent(inout) :: & afsd ! floe size tracer: fraction distribution of floes @@ -316,11 +350,7 @@ end subroutine icepack_init_fsd ! ! authors: Elizabeth Hunke, LANL ! - subroutine icepack_cleanup_fsd (ncat, nfsd, afsdn) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nfsd ! number of floe size categories + subroutine icepack_cleanup_fsd (afsdn) real (kind=dbl_kind), dimension(:,:), intent(inout) :: & afsdn ! floe size distribution tracer @@ -333,11 +363,10 @@ subroutine icepack_cleanup_fsd (ncat, nfsd, afsdn) character(len=*), parameter :: subname='(icepack_cleanup_fsd)' - if (tr_fsd) then do n = 1, ncat - call icepack_cleanup_fsdn(nfsd, afsdn(:,n)) + call icepack_cleanup_fsdn(afsdn(:,n)) if (icepack_warnings_aborted(subname)) return enddo @@ -352,10 +381,7 @@ end subroutine icepack_cleanup_fsd ! authors: Elizabeth Hunke, LANL ! - subroutine icepack_cleanup_fsdn (nfsd, afsd) - - integer (kind=int_kind), intent(in) :: & - nfsd ! number of floe size categories + subroutine icepack_cleanup_fsdn (afsd) real (kind=dbl_kind), dimension(:), intent(inout) :: & afsd ! floe size distribution tracer @@ -391,19 +417,11 @@ end subroutine icepack_cleanup_fsdn ! ! authors: Lettie Roach, NIWA/VUW - subroutine partition_area (ncat, nfsd, & - floe_rad_c, aice, & + subroutine partition_area (aice, & aicen, vicen, & afsdn, lead_area, & latsurf_area) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nfsd ! number of floe size categories - - real (kind=dbl_kind), dimension(:), intent(in) :: & - floe_rad_c ! fsd size bin centre in m (radius) - real (kind=dbl_kind), intent(in) :: & aice ! ice concentration @@ -491,20 +509,15 @@ end subroutine partition_area ! ! authors: Lettie Roach, NIWA/VUW ! - subroutine fsd_lateral_growth (ncat, nfsd, & - dt, aice, & + subroutine fsd_lateral_growth (dt, aice, & aicen, vicen, & vi0new, & - frazil, floe_rad_c, & + frazil, & afsdn, & lead_area, latsurf_area, & G_radial, d_an_latg, & tot_latg) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nfsd ! number of floe size categories - real (kind=dbl_kind), intent(in) :: & dt , & ! time step (s) aice ! total concentration of ice @@ -520,10 +533,6 @@ subroutine fsd_lateral_growth (ncat, nfsd, & vi0new , & ! volume of new ice added to cat 1 (m) frazil ! frazil ice growth (m/step-->cm/day) - ! floe size distribution - real (kind=dbl_kind), dimension (:), intent(in) :: & - floe_rad_c ! fsd size bin centre in m (radius) - real (kind=dbl_kind), dimension(ncat), intent(out) :: & d_an_latg ! change in aicen occuring due to lateral growth @@ -552,8 +561,7 @@ subroutine fsd_lateral_growth (ncat, nfsd, & d_an_latg = c0 ! partition volume into lateral growth and frazil - call partition_area (ncat, nfsd, & - floe_rad_c, aice, & + call partition_area (aice, & aicen, vicen, & afsdn, lead_area, & latsurf_area) @@ -564,9 +572,6 @@ subroutine fsd_lateral_growth (ncat, nfsd, & vi0new_lat = vi0new * lead_area / (c1 + aice/latsurf_area) end if - ! for history/diagnostics - frazil = vi0new - vi0new_lat - ! lateral growth increment if (vi0new_lat > puny) then G_radial = vi0new_lat/dt @@ -587,8 +592,6 @@ subroutine fsd_lateral_growth (ncat, nfsd, & endif ! vi0new_lat > 0 ! Use remaining ice volume as in standard model, - ! but ice cannot grow into the area that has grown laterally - vi0new = vi0new - vi0new_lat tot_latg = SUM(d_an_latg(:)) end subroutine fsd_lateral_growth @@ -610,10 +613,9 @@ end subroutine fsd_lateral_growth ! ! authors: Lettie Roach, NIWA/VUW ! - subroutine fsd_add_new_ice (ncat, n, nfsd, & + subroutine fsd_add_new_ice (n, & dt, ai0new, & d_an_latg, d_an_newi, & - floe_rad_c, floe_binwidth, & G_radial, area2, & wave_sig_ht, & wave_spectrum, & @@ -625,9 +627,7 @@ subroutine fsd_add_new_ice (ncat, n, nfsd, & aicen, trcrn) integer (kind=int_kind), intent(in) :: & - n , & ! thickness category number - ncat , & ! number of thickness categories - nfsd ! number of floe size categories + n ! thickness category number real (kind=dbl_kind), intent(in) :: & dt , & ! time step (s) @@ -649,9 +649,7 @@ subroutine fsd_add_new_ice (ncat, n, nfsd, & real (kind=dbl_kind), dimension (:), intent(in) :: & aicen_init , & ! fractional area of ice - aicen , & ! after update - floe_rad_c , & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) + aicen ! after update real (kind=dbl_kind), dimension (:,:), intent(in) :: & afsdn ! floe size distribution tracer @@ -722,7 +720,7 @@ subroutine fsd_add_new_ice (ncat, n, nfsd, & end do ! timestep required for this - subdt = get_subdt_fsd(nfsd, afsdn_latg(:,n), dafsd_tmp(:)) + subdt = get_subdt_fsd(afsdn_latg(:,n), dafsd_tmp(:)) subdt = MIN(subdt, dt) ! update fsd and elapsed time @@ -731,7 +729,7 @@ subroutine fsd_add_new_ice (ncat, n, nfsd, & END DO - call icepack_cleanup_fsdn (nfsd, afsdn_latg(:,n)) + call icepack_cleanup_fsdn (afsdn_latg(:,n)) if (icepack_warnings_aborted(subname)) return trcrn(nt_fsd:nt_fsd+nfsd-1,n) = afsdn_latg(:,n) @@ -748,7 +746,7 @@ subroutine fsd_add_new_ice (ncat, n, nfsd, & if (wave_spec) then if (wave_sig_ht > puny) then - call wave_dep_growth (nfsd, wave_spectrum, & + call wave_dep_growth (wave_spectrum, & wavefreq, dwavefreq, & new_size) if (icepack_warnings_aborted(subname)) return @@ -776,7 +774,7 @@ subroutine fsd_add_new_ice (ncat, n, nfsd, & if (wave_spec) then if (wave_sig_ht > puny) then - call wave_dep_growth (nfsd, wave_spectrum, & + call wave_dep_growth (wave_spectrum, & wavefreq, dwavefreq, & new_size) if (icepack_warnings_aborted(subname)) return @@ -790,7 +788,7 @@ subroutine fsd_add_new_ice (ncat, n, nfsd, & endif ! entirely new ice or not trcrn(nt_fsd:nt_fsd+nfsd-1,n) = afsd_ni(:) - call icepack_cleanup_fsdn (nfsd, trcrn(nt_fsd:nt_fsd+nfsd-1,n)) + call icepack_cleanup_fsdn (trcrn(nt_fsd:nt_fsd+nfsd-1,n)) if (icepack_warnings_aborted(subname)) return endif ! d_an_newi > puny endif ! n = 1 @@ -818,13 +816,10 @@ end subroutine fsd_add_new_ice ! ! authors: Lettie Roach, NIWA/VUW ! - subroutine wave_dep_growth (nfsd, local_wave_spec, & + subroutine wave_dep_growth (local_wave_spec, & wavefreq, dwavefreq, & new_size) - integer (kind=int_kind), intent(in) :: & - nfsd ! number of floe size categories - real (kind=dbl_kind), dimension(:), intent(in) :: & local_wave_spec ! ocean surface wave spectrum as a function of frequency ! power spectral density of surface elevation, E(f) (units m^2 s) @@ -879,15 +874,10 @@ end subroutine wave_dep_growth ! authors: Lettie Roach, NIWA/VUW ! - subroutine fsd_weld_thermo (ncat, nfsd, & - dt, frzmlt, & + subroutine fsd_weld_thermo (dt, frzmlt, & aicen, trcrn, & d_afsd_weld) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nfsd ! number of floe size categories - real (kind=dbl_kind), intent(in) :: & dt ! time step (s) @@ -948,7 +938,7 @@ subroutine fsd_weld_thermo (ncat, nfsd, & d_afsd_weld (:) = c0 d_afsdn_weld(:,n) = c0 afsdn(:,n) = trcrn(nt_fsd:nt_fsd+nfsd-1,n) - call icepack_cleanup_fsdn (nfsd, afsdn(:,n)) + call icepack_cleanup_fsdn (afsdn(:,n)) if (icepack_warnings_aborted(subname)) return ! If there is some ice in the lower (nfsd-1) categories @@ -1010,7 +1000,7 @@ subroutine fsd_weld_thermo (ncat, nfsd, & END DO ! time afsdn(:,n) = afsd_tmp(:) - call icepack_cleanup_fsdn (nfsd, afsdn(:,n)) + call icepack_cleanup_fsdn (afsdn(:,n)) if (icepack_warnings_aborted(subname)) return do k = 1, nfsd @@ -1039,12 +1029,9 @@ end subroutine fsd_weld_thermo ! authors: 2018 Lettie Roach, NIWA/VUW ! ! - function get_subdt_fsd(nfsd, afsd_init, d_afsd) & + function get_subdt_fsd(afsd_init, d_afsd) & result(subdt) - integer (kind=int_kind), intent(in) :: & - nfsd ! number of floe size categories - real (kind=dbl_kind), dimension (nfsd), intent(in) :: & afsd_init, d_afsd ! floe size distribution tracer diff --git a/columnphysics/icepack_intfc.F90 b/columnphysics/icepack_intfc.F90 index 0d8be0b31..2e96a7a9b 100644 --- a/columnphysics/icepack_intfc.F90 +++ b/columnphysics/icepack_intfc.F90 @@ -1,8 +1,8 @@ !======================================================================= -! Copyright (c) 2023, Triad National Security, LLC +! Copyright (c) 2024, Triad National Security, LLC ! All rights reserved. ! -! Copyright 2023. Triad National Security, LLC. This software was +! Copyright 2024. Triad National Security, LLC. This software was ! produced under U.S. Government contract DE-AC52-06NA25396 for Los ! Alamos National Laboratory (LANL), which is operated by Triad ! National Security, LLC for the U.S. Department of Energy. The U.S. @@ -112,9 +112,12 @@ module icepack_intfc use icepack_therm_shared , only: icepack_snow_temperature use icepack_therm_shared , only: icepack_liquidus_temperature use icepack_therm_shared , only: icepack_sea_freezing_temperature - use icepack_therm_shared , only: icepack_init_thermo + use icepack_therm_shared , only: icepack_init_salinity use icepack_therm_shared , only: icepack_salinity_profile - use icepack_therm_shared , only: icepack_init_trcr + use icepack_therm_shared , only: icepack_init_enthalpy + ! for backwards compatibilty, remove in the future + use icepack_therm_shared , only: icepack_init_thermo => icepack_init_salinity + use icepack_therm_shared , only: icepack_init_trcr => icepack_init_enthalpy use icepack_mushy_physics , only: icepack_enthalpy_snow use icepack_mushy_physics , only: icepack_enthalpy_mush diff --git a/columnphysics/icepack_isotope.F90 b/columnphysics/icepack_isotope.F90 index 1db640556..616a28700 100644 --- a/columnphysics/icepack_isotope.F90 +++ b/columnphysics/icepack_isotope.F90 @@ -45,8 +45,7 @@ module icepack_isotope ! ! Increase isotope in ice or snow surface due to deposition and loss ! - subroutine update_isotope (dt, & - nilyr, nslyr, & + subroutine update_isotope(dt, & meltt, melts, & meltb, congel, & snoice, evap, & @@ -63,9 +62,6 @@ subroutine update_isotope (dt, & ! use water_isotopes, only: wiso_alpi use icepack_parameters, only: ktherm, rhoi, rhos, Tffresh - integer (kind=int_kind), intent(in) :: & - nilyr, nslyr - real (kind=dbl_kind), intent(in) :: & dt ! time step diff --git a/columnphysics/icepack_itd.F90 b/columnphysics/icepack_itd.F90 index b86d1cf78..013373ad8 100644 --- a/columnphysics/icepack_itd.F90 +++ b/columnphysics/icepack_itd.F90 @@ -29,6 +29,7 @@ module icepack_itd use icepack_parameters, only: c0, c1, c2, c3, c15, c25, c100, p1, p01, p001, p5, puny use icepack_parameters, only: Lfresh, rhos, ice_ref_salinity, hs_min, cp_ice, rhoi use icepack_parameters, only: rhosi, sk_l, hs_ssl, min_salin, rsnw_fall, rhosnew + use icepack_tracers, only: ncat, nilyr, nslyr, nblyr, ntrcr, nbtrcr, n_aero use icepack_tracers, only: nt_Tsfc, nt_qice, nt_qsno, nt_aero, nt_isosno, nt_isoice use icepack_tracers, only: nt_apnd, nt_hpnd, nt_fbri, tr_brine, bio_index use icepack_tracers, only: n_iso, tr_iso, nt_smice, nt_rsnw, nt_rhos, nt_sice @@ -64,10 +65,7 @@ module icepack_itd ! ! authors: William H. Lipscomb, LANL - subroutine aggregate_area (ncat, aicen, aice, aice0) - - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories + subroutine aggregate_area (aicen, aice, aice0) real (kind=dbl_kind), dimension(:), intent(in) :: & aicen ! concentration of ice @@ -102,17 +100,13 @@ end subroutine aggregate_area ! ! authors: William H. Lipscomb and Elizabeth C. Hunke, LANL - subroutine rebin (ntrcr, trcr_depend, & + subroutine rebin (trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, & aicen, trcrn, & vicen, vsnon, & - ncat, hin_max, Tf ) - - integer (kind=int_kind), intent(in) :: & - ntrcr , & ! number of tracers in use - ncat ! number of thickness categories + hin_max, Tf ) integer (kind=int_kind), dimension (:), intent(in) :: & trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon @@ -135,7 +129,7 @@ subroutine rebin (ntrcr, trcr_depend, & real (kind=dbl_kind), dimension(0:ncat), intent(in) :: & hin_max ! category limits (m) - + real (kind=dbl_kind), intent(in) :: & Tf ! freezing temperature @@ -216,8 +210,7 @@ subroutine rebin (ntrcr, trcr_depend, & ! shift ice between categories !----------------------------------------------------------------- - call shift_ice (ntrcr, ncat, & - trcr_depend, & + call shift_ice (trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, & @@ -264,8 +257,7 @@ subroutine rebin (ntrcr, trcr_depend, & ! shift ice between categories !----------------------------------------------------------------- - call shift_ice (ntrcr, ncat, & - trcr_depend, & + call shift_ice (trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, & @@ -356,8 +348,7 @@ end subroutine reduce_area ! ! authors: William H. Lipscomb and Elizabeth C. Hunke, LANL - subroutine shift_ice (ntrcr, ncat, & - trcr_depend, & + subroutine shift_ice (trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, & @@ -366,10 +357,6 @@ subroutine shift_ice (ntrcr, ncat, & hicen, donor, & daice, dvice, Tf ) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - ntrcr ! number of tracers in use - integer (kind=int_kind), dimension (:), intent(in) :: & trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon n_trcr_strata ! number of underlying tracer layers @@ -665,7 +652,7 @@ subroutine shift_ice (ntrcr, ncat, & ! Compute new tracers !----------------------------------------------------------------- - call icepack_compute_tracers (ntrcr, trcr_depend, & + call icepack_compute_tracers(trcr_depend, & atrcrn(:,n), aicen(n), & vicen(n), vsnon(n), & trcr_base, n_trcr_strata, & @@ -751,22 +738,18 @@ end subroutine column_conservation_check !======================================================================= ! Cleanup subroutine that rebins thickness categories if necessary, -! eliminates very small ice areas while conserving mass and energy, -! aggregates state variables, and does a boundary call. +! eliminates very small ice areas while conserving mass and energy +! and aggregates state variables. ! It is a good idea to call this subroutine after the thermodynamics ! (thermo_vertical/thermo_itd) and again after the dynamics ! (evp/transport/ridging). ! ! author: William H. Lipscomb, LANL - subroutine cleanup_itd (dt, ntrcr, & - nilyr, nslyr, & - ncat, hin_max, & + subroutine cleanup_itd (dt, hin_max, & aicen, trcrn, & vicen, vsnon, & aice0, aice, & - n_aero, & - nbtrcr, nblyr, & tr_aero, & tr_pond_topo, & first_ice, & @@ -775,21 +758,13 @@ subroutine cleanup_itd (dt, ntrcr, & fpond, fresh, & fsalt, fhocn, & faero_ocn, fiso_ocn, & - flux_bio, Tf, limit_aice_in) + flux_bio, Tf, & + limit_aice, dorebin) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nblyr , & ! number of bio layers - nslyr , & ! number of snow layers - ntrcr , & ! number of tracers in use - nbtrcr, & ! number of bio tracers in use - n_aero ! number of aerosol tracers - - real (kind=dbl_kind), intent(in) :: & - dt ! time step - - real (kind=dbl_kind), intent(in) :: & + real (kind=dbl_kind), intent(in) :: & + dt ! time step + + real (kind=dbl_kind), intent(in) :: & Tf ! Freezing temperature real (kind=dbl_kind), dimension(0:ncat), intent(in) :: & @@ -843,8 +818,9 @@ subroutine cleanup_itd (dt, ntrcr, & fiso_ocn ! isotope flux to ocean (kg/m^2/s) logical (kind=log_kind), intent(in), optional :: & - limit_aice_in ! if false, allow aice to be out of bounds - ! may want to allow this for unit tests + dorebin, & ! if false, do not call rebin (default true) + limit_aice ! if false, allow aice to be out of bounds + ! may want to allow this for unit tests (default true) ! local variables @@ -868,7 +844,8 @@ subroutine cleanup_itd (dt, ntrcr, & dflux_bio ! zapped biology flux (mmol/m^2/s) logical (kind=log_kind) :: & - limit_aice ! if true, check for aice out of bounds + ldorebin , & ! if true, call rebin + llimit_aice ! if true, check for aice out of bounds character(len=*),parameter :: subname='(cleanup_itd)' @@ -876,10 +853,16 @@ subroutine cleanup_itd (dt, ntrcr, & ! Initialize !----------------------------------------------------------------- - if (present(limit_aice_in)) then - limit_aice = limit_aice_in + if (present(limit_aice)) then + llimit_aice = limit_aice + else + llimit_aice = .true. + endif + + if (present(dorebin)) then + ldorebin = dorebin else - limit_aice = .true. + ldorebin = .true. endif dfpond = c0 @@ -894,10 +877,10 @@ subroutine cleanup_itd (dt, ntrcr, & ! Compute total ice area. !----------------------------------------------------------------- - call aggregate_area (ncat, aicen, aice, aice0) + call aggregate_area (aicen, aice, aice0) if (icepack_warnings_aborted(subname)) return - if (limit_aice) then ! check for aice out of bounds + if (llimit_aice) then ! check for aice out of bounds if (aice > c1+puny .or. aice < -puny) then call icepack_warnings_setabort(.true.,__FILE__,__LINE__) call icepack_warnings_add(subname//' aggregate ice area out of bounds') @@ -909,13 +892,13 @@ subroutine cleanup_itd (dt, ntrcr, & enddo return endif - endif ! limit_aice + endif ! llimit_aice !----------------------------------------------------------------- ! Identify grid cells with ice. !----------------------------------------------------------------- - if (aice > puny) then + if (ldorebin .and. aice > puny) then !----------------------------------------------------------------- ! Make sure ice in each category is within its thickness bounds. @@ -924,13 +907,13 @@ subroutine cleanup_itd (dt, ntrcr, & ! correctly (e.g., very fast ice growth). !----------------------------------------------------------------- - call rebin (ntrcr, trcr_depend, & + call rebin (trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, & aicen, trcrn, & vicen, vsnon, & - ncat, hin_max, Tf ) + hin_max, Tf ) if (icepack_warnings_aborted(subname)) return endif ! aice > puny @@ -939,22 +922,18 @@ subroutine cleanup_itd (dt, ntrcr, & ! Zero out ice categories with very small areas. !----------------------------------------------------------------- - if (limit_aice) then - call zap_small_areas (dt, ntrcr, & - ncat, & - n_aero, & - nblyr, & - nilyr, nslyr, & + if (llimit_aice) then + call zap_small_areas (dt, & aice, aice0, & aicen, trcrn, & vicen, vsnon, & dfpond, & dfresh, dfsalt, & - dfhocn, & + dfhocn, & dfaero_ocn, dfiso_ocn, & tr_aero, & tr_pond_topo, & - first_ice, nbtrcr, & + first_ice, & dflux_bio, Tf ) if (icepack_warnings_aborted(subname)) then @@ -967,21 +946,18 @@ subroutine cleanup_itd (dt, ntrcr, & return endif - endif ! l_limit_aice + endif ! llimit_aice !------------------------------------------------------------------- ! Zap snow that has out of bounds temperatures !------------------------------------------------------------------- - call zap_snow_temperature(dt, ncat, & - nblyr, & - nslyr, aicen, & + call zap_snow_temperature(dt, aicen, & trcrn, vsnon, & dfresh, dfhocn, & dfaero_ocn, tr_aero, & dfiso_ocn, & - dflux_bio, nbtrcr, & - n_aero) + dflux_bio) if (icepack_warnings_aborted(subname)) return !------------------------------------------------------------------- @@ -1023,11 +999,7 @@ end subroutine cleanup_itd ! ! author: William H. Lipscomb, LANL - subroutine zap_small_areas (dt, ntrcr, & - ncat, & - n_aero, & - nblyr, & - nilyr, nslyr, & + subroutine zap_small_areas (dt, & aice, aice0, & aicen, trcrn, & vicen, vsnon, & @@ -1037,18 +1009,9 @@ subroutine zap_small_areas (dt, ntrcr, & dfaero_ocn, dfiso_ocn, & tr_aero, & tr_pond_topo, & - first_ice, nbtrcr, & + first_ice, & dflux_bio, Tf ) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nblyr , & ! number of bio layers - nslyr , & ! number of snow layers - ntrcr , & ! number of tracers in use - n_aero , & ! number of aerosol tracers - nbtrcr ! number of biology tracers - real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -1096,6 +1059,7 @@ subroutine zap_small_areas (dt, ntrcr, & blevels real (kind=dbl_kind) :: xtmp, sicen ! temporary variables + real (kind=dbl_kind) :: dvssl, dvint ! temporary variables real (kind=dbl_kind) , dimension (1):: trcr_skl real (kind=dbl_kind) , dimension (nblyr+1):: bvol @@ -1146,7 +1110,6 @@ subroutine zap_small_areas (dt, ntrcr, & if (skl_bgc .and. nbtrcr > 0) then blevels = 1 bvol(1) = aicen(n)*sk_l - it = 1 do it = 1, nbtrcr trcr_skl(1) = trcrn(bio_index(it),n) call zap_small_bgc(blevels, dflux_bio(it), & @@ -1202,14 +1165,13 @@ subroutine zap_small_areas (dt, ntrcr, & !----------------------------------------------------------------- ! Zap snow !----------------------------------------------------------------- - call zap_snow(dt, nslyr, & + call zap_snow(dt, & trcrn(:,n), vsnon(n), & dfresh, dfhocn, & dfaero_ocn, tr_aero, & dfiso_ocn, & - dflux_bio, nbtrcr, & - n_aero, & - aicen(n), nblyr) + dflux_bio, & + aicen(n)) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -1273,6 +1235,36 @@ subroutine zap_small_areas (dt, ntrcr, & enddo ! it endif + if (skl_bgc .and. nbtrcr > 0) then + blevels = 1 + bvol(1) = (aice-c1)/aice * sk_l + do it = 1, nbtrcr + trcr_skl(1) = trcrn(bio_index(it),n) + call zap_small_bgc(blevels, dflux_bio(it), & + dt, bvol(1:blevels), trcr_skl(blevels)) + enddo + elseif (z_tracers .and. nbtrcr > 0) then + blevels = nblyr + 1 + bvol(:) = (aice-c1)/aice*vicen(n)/real(nblyr,kind=dbl_kind)*trcrn(nt_fbri,n) + bvol(1) = p5*bvol(1) + bvol(blevels) = p5*bvol(blevels) + do it = 1, nbtrcr + call zap_small_bgc(blevels, dflux_bio(it), & + dt, bvol(1:blevels),trcrn(bio_index(it):bio_index(it)+blevels-1,n)) + if (icepack_warnings_aborted(subname)) return + enddo + ! zap snow zaerosols + dvssl = p5*vsnon(n)/real(nslyr,kind=dbl_kind) ! snow surface layer + dvint = vsnon(n) - dvssl ! snow interior + + do it = 1, nbtrcr + xtmp = (trcrn(bio_index(it)+nblyr+1,n)*dvssl + & + trcrn(bio_index(it)+nblyr+2,n)*dvint)*(aice-c1)/aice/dt + dflux_bio(it) = dflux_bio(it) + xtmp + enddo ! it + + endif + if (tr_iso) then do it = 1, n_iso xtmp = (vsnon(n)*trcrn(nt_isosno+it-1,n) & @@ -1346,20 +1338,12 @@ end subroutine zap_small_areas !======================================================================= - subroutine zap_snow(dt, nslyr, & + subroutine zap_snow(dt, & trcrn, vsnon, & dfresh, dfhocn, & dfaero_ocn, tr_aero, & dfiso_ocn, & - dflux_bio, nbtrcr, & - n_aero, & - aicen, nblyr) - - integer (kind=int_kind), intent(in) :: & - nslyr , & ! number of snow layers - n_aero , & ! number of aerosol tracers - nblyr , & ! number of bio layers - nbtrcr + dflux_bio, aicen) real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -1414,8 +1398,8 @@ subroutine zap_snow(dt, nslyr, & endif ! tr_iso if (z_tracers) then - dvssl = min(p5*vsnon/real(nslyr,kind=dbl_kind), hs_ssl*aicen) ! snow surface layer - dvint = vsnon - dvssl ! snow interior + dvssl = p5*vsnon/real(nslyr,kind=dbl_kind) ! snow surface layer + dvint = vsnon - dvssl ! snow interior do it = 1, nbtrcr xtmp = (trcrn(bio_index(it)+nblyr+1)*dvssl + & @@ -1442,22 +1426,12 @@ end subroutine zap_snow !======================================================================= - subroutine zap_snow_temperature(dt, ncat, & - nblyr, & - nslyr, aicen, & + subroutine zap_snow_temperature(dt, aicen, & trcrn, vsnon, & dfresh, dfhocn, & dfaero_ocn, tr_aero, & dfiso_ocn, & - dflux_bio, nbtrcr, & - n_aero ) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nslyr , & ! number of snow layers - n_aero, & ! number of aerosol tracers - nbtrcr, & ! number of z-tracers in use - nblyr ! number of bio layers in ice + dflux_bio) real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -1560,14 +1534,13 @@ subroutine zap_snow_temperature(dt, ncat, & ! Zap the cells !----------------------------------------------------------------- if (l_zap) & - call zap_snow(dt, nslyr, & + call zap_snow(dt, & trcrn(:,n), vsnon(n), & dfresh, dfhocn, & dfaero_ocn, tr_aero, & dfiso_ocn, & - dflux_bio, nbtrcr, & - n_aero, & - aicen(n), nblyr) + dflux_bio, & + aicen(n)) if (icepack_warnings_aborted(subname)) return enddo ! n @@ -1581,10 +1554,7 @@ end subroutine zap_snow_temperature ! authors: William H. Lipscomb and Elizabeth C. Hunke, LANL ! C. M. Bitz, UW - subroutine icepack_init_itd(ncat, hin_max) - - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories + subroutine icepack_init_itd(hin_max) real (kind=dbl_kind), intent(out) :: & hin_max(0:ncat) ! category limits (m) @@ -1760,10 +1730,7 @@ end subroutine icepack_init_itd ! authors: William H. Lipscomb and Elizabeth C. Hunke, LANL ! C. M. Bitz, UW - subroutine icepack_init_itd_hist (ncat, hin_max, c_hi_range) - - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories + subroutine icepack_init_itd_hist (hin_max, c_hi_range) real (kind=dbl_kind), intent(in) :: & hin_max(0:ncat) ! category limits (m) @@ -1815,22 +1782,16 @@ end subroutine icepack_init_itd_hist ! authors: C. M. Bitz, UW ! W. H. Lipscomb, LANL - subroutine icepack_aggregate (ncat, & - aicen, trcrn, & + subroutine icepack_aggregate(aicen, trcrn, & vicen, vsnon, & aice, trcr, & vice, vsno, & aice0, & - ntrcr, & trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, Tf) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - ntrcr ! number of tracers in use - real (kind=dbl_kind), dimension (:), intent(in) :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) @@ -1919,11 +1880,11 @@ subroutine icepack_aggregate (ncat, & aice0 = max (c1 - aice, c0) ! Tracers - call icepack_compute_tracers (ntrcr, trcr_depend, & + call icepack_compute_tracers(trcr_depend, & atrcr, aice, & vice , vsno, & trcr_base, n_trcr_strata, & - nt_strata, trcr, Tf) + nt_strata, trcr, Tf) if (icepack_warnings_aborted(subname)) return deallocate (atrcr) diff --git a/columnphysics/icepack_mechred.F90 b/columnphysics/icepack_mechred.F90 index 818faa01d..70766cc60 100644 --- a/columnphysics/icepack_mechred.F90 +++ b/columnphysics/icepack_mechred.F90 @@ -40,12 +40,13 @@ module icepack_mechred use icepack_parameters, only: icepack_chkoptargflag use icepack_parameters, only: kstrength, krdg_partic, krdg_redist, mu_rdg - use icepack_parameters, only: conserv_check + use icepack_parameters, only: conserv_check, z_tracers + use icepack_tracers, only: ncat, nilyr, nslyr, nblyr, n_aero use icepack_tracers, only: tr_pond_topo, tr_aero, tr_iso, tr_brine, ntrcr, nbtrcr use icepack_tracers, only: nt_qice, nt_qsno, nt_fbri, nt_sice use icepack_tracers, only: nt_alvl, nt_vlvl, nt_aero, nt_isosno, nt_isoice use icepack_tracers, only: nt_apnd, nt_hpnd - use icepack_tracers, only: n_iso + use icepack_tracers, only: n_iso, bio_index use icepack_tracers, only: icepack_compute_tracers use icepack_warnings, only: warnstr, icepack_warnings_add @@ -68,7 +69,6 @@ module icepack_mechred Gstar = p15 , & ! max value of G(h) that participates ! (krdg_partic = 0) astar = p05 , & ! e-folding scale for G(h) participation -!echmod astar = p1 , & ! e-folding scale for G(h) participation ! (krdg_partic = 1) maxraft= c1 , & ! max value of hrmin - hi = max thickness ! of ice that rafts (m) @@ -88,9 +88,7 @@ module icepack_mechred ! author: William H. Lipscomb, LANL subroutine ridge_ice (dt, ndtd, & - ncat, n_aero, & - nilyr, nslyr, & - ntrcr, hin_max, & + hin_max, & rdg_conv, rdg_shear, & aicen, trcrn, & vicen, vsnon, & @@ -102,7 +100,7 @@ subroutine ridge_ice (dt, ndtd, & mu_rdg, tr_brine, & dardg1dt, dardg2dt, & dvirdgdt, opening, & - fpond, & + fpond, flux_bio, & fresh, fhocn, & faero_ocn, fiso_ocn, & aparticn, krdgn, & @@ -113,12 +111,7 @@ subroutine ridge_ice (dt, ndtd, & closing ) integer (kind=int_kind), intent(in) :: & - ndtd , & ! number of dynamics subcycles - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nslyr , & ! number of snow layers - n_aero, & ! number of aerosol tracers - ntrcr ! number of tracers in use + ndtd ! number of dynamics subcycles real (kind=dbl_kind), intent(in) :: & mu_rdg , & ! gives e-folding scale of ridged ice (m^.5) @@ -188,6 +181,9 @@ subroutine ridge_ice (dt, ndtd, & real (kind=dbl_kind), dimension(:), intent(inout), optional :: & faero_ocn ! aerosol flux to ocean (kg/m^2/s) + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & + flux_bio ! biological and zaerosol flux to ocean (kg/m^2/s) + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & fiso_ocn ! isotope flux to ocean (kg/m^2/s) @@ -221,6 +217,9 @@ subroutine ridge_ice (dt, ndtd, & real (kind=dbl_kind), dimension (n_aero) :: & maero ! aerosol mass added to ocean (kg m-2) + real (kind=dbl_kind), dimension (nbtrcr) :: & + mbio ! bio mass added to ocean (mmol or kg m-2) + real (kind=dbl_kind), dimension (n_iso) :: & miso ! isotope mass added to ocean (kg m-2) @@ -273,6 +272,7 @@ subroutine ridge_ice (dt, ndtd, & msnow_mlt = c0 esnow_mlt = c0 maero (:) = c0 + mbio (:) = c0 miso (:) = c0 mpond = c0 ardg1 = c0 @@ -288,7 +288,7 @@ subroutine ridge_ice (dt, ndtd, & ! Compute area of ice plus open water before ridging. !----------------------------------------------------------------- - call asum_ridging (ncat, aicen, aice0, asum) + call asum_ridging (aicen, aice0, asum) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -303,8 +303,7 @@ subroutine ridge_ice (dt, ndtd, & else - call ridge_prep (dt, & - ncat, hin_max, & + call ridge_prep (dt, hin_max, & rdg_conv, rdg_shear, & asum, closing_net, & divu_adv, opning) @@ -367,10 +366,10 @@ subroutine ridge_ice (dt, ndtd, & ! and various quantities associated with the new ridged ice. !----------------------------------------------------------------- - call ridge_itd (ncat, aice0, & + call ridge_itd (aice0, & aicen, vicen, & - krdg_partic, krdg_redist, & - mu_rdg, & + krdg_partic, krdg_redist,& + mu_rdg, & aksum, apartic, & hrmin, hrmax, & hrexp, krdg, & @@ -382,8 +381,7 @@ subroutine ridge_ice (dt, ndtd, & ! Redistribute area, volume, and energy. !----------------------------------------------------------------- - call ridge_shift (ntrcr, dt, & - ncat, hin_max, & + call ridge_shift (dt, hin_max, & aicen, trcrn, & vicen, vsnon, & aice0, trcr_depend, & @@ -397,11 +395,11 @@ subroutine ridge_ice (dt, ndtd, & virdg, aopen, & ardg1n, ardg2n, & virdgn, & - nslyr, n_aero, & msnow_mlt, esnow_mlt, & maero, miso, & mpond, Tf, & - aredistn, vredistn) + aredistn, vredistn, & + mbio) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -410,7 +408,7 @@ subroutine ridge_ice (dt, ndtd, & ! with new rates. !----------------------------------------------------------------- - call asum_ridging (ncat, aicen, aice0, asum) + call asum_ridging (aicen, aice0, asum) if (icepack_warnings_aborted(subname)) return if (abs(asum - c1) < puny) then @@ -591,6 +589,11 @@ subroutine ridge_ice (dt, ndtd, & faero_ocn(it) = faero_ocn(it) + maero(it)*dti enddo endif + if (present(flux_bio)) then + do it = 1, nbtrcr + flux_bio(it) = flux_bio(it) + mbio(it)*dti + enddo + endif if (present(fiso_ocn)) then if (tr_iso) then ! check size fiso_ocn vs n_iso ??? @@ -640,10 +643,7 @@ end subroutine ridge_ice ! ! author: William H. Lipscomb, LANL - subroutine asum_ridging (ncat, aicen, aice0, asum) - - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories + subroutine asum_ridging (aicen, aice0, asum) real (kind=dbl_kind), dimension (:), intent(in) :: & aicen ! concentration of ice in each category @@ -673,15 +673,11 @@ end subroutine asum_ridging ! ! author: William H. Lipscomb, LANL - subroutine ridge_prep (dt, & - ncat, hin_max, & + subroutine ridge_prep (dt, hin_max, & rdg_conv, rdg_shear, & asum, closing_net, & divu_adv, opning) - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories - real (kind=dbl_kind), intent(in) :: & dt ! time step (s) @@ -775,7 +771,7 @@ end subroutine ridge_prep ! 2006: Changed subroutine name to ridge_itd ! Added new options for ridging participation and redistribution. - subroutine ridge_itd (ncat, aice0, & + subroutine ridge_itd (aice0, & aicen, vicen, & krdg_partic, krdg_redist, & mu_rdg, & @@ -785,9 +781,6 @@ subroutine ridge_itd (ncat, aice0, & aparticn, krdgn, & mraft) - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories - real (kind=dbl_kind), intent(in) :: & mu_rdg , & ! gives e-folding scale of ridged ice (m^.5) aice0 ! concentration of open water @@ -1067,8 +1060,7 @@ end subroutine ridge_itd ! ! author: William H. Lipscomb, LANL - subroutine ridge_shift (ntrcr, dt, & - ncat, hin_max, & + subroutine ridge_shift (dt, hin_max, & aicen, trcrn, & vicen, vsnon, & aice0, trcr_depend, & @@ -1082,17 +1074,13 @@ subroutine ridge_shift (ntrcr, dt, & virdg, aopen, & ardg1nn, ardg2nn, & virdgnn, & - nslyr, n_aero, & msnow_mlt, esnow_mlt, & maero, miso, & mpond, Tf, & - aredistn, vredistn) + aredistn, vredistn, & + mbio) integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nslyr , & ! number of snow layers - ntrcr , & ! number of tracers in use - n_aero, & ! number of aerosol tracers krdg_redist ! selects redistribution function real (kind=dbl_kind), intent(in) :: & @@ -1163,6 +1151,9 @@ subroutine ridge_shift (ntrcr, dt, & real (kind=dbl_kind), dimension(:), intent(inout) :: & miso ! isotope mass added to ocean (kg m-2) + real (kind=dbl_kind), dimension(:), intent(inout) :: & + mbio ! biology and zaerosol mass added to ocean (kg m-2) + real (kind=dbl_kind), dimension (:), intent(inout), optional :: & aredistn , & ! redistribution function: fraction of new ridge area vredistn ! redistribution function: fraction of new ridge volume @@ -1215,7 +1206,9 @@ subroutine ridge_shift (ntrcr, dt, & hL, hR , & ! left and right limits of integration expL, expR , & ! exponentials involving hL, hR tmpfac , & ! factor by which opening/closing rates are cut - wk1 ! work variable + wk1 , & ! work variable + dzssl , & ! fraction of snow surface biotracers + dzint ! fraction of interior snow biotracers character(len=*),parameter :: subname='(ridge_shift)' @@ -1386,6 +1379,16 @@ subroutine ridge_shift (ntrcr, dt, & enddo endif + if (z_tracers .and. nbtrcr > 0) then + dzssl = p5/real(nslyr,kind=dbl_kind) + dzint = c1-dzssl + do it = 1, nbtrcr + mbio(it) = mbio(it) + vsrdgn*(c1-fsnowrdg) & + * (trcrn(bio_index(it) + nblyr + 1,n) * dzssl & + + trcrn(bio_index(it) + nblyr + 2,n) * dzint) + enddo + endif + if (tr_pond_topo) then mpond = mpond + ardg1n * trcrn(nt_apnd,n) & * trcrn(nt_hpnd,n) @@ -1571,7 +1574,7 @@ subroutine ridge_shift (ntrcr, dt, & !----------------------------------------------------------------- do n = 1, ncat - call icepack_compute_tracers (ntrcr, trcr_depend, & + call icepack_compute_tracers (trcr_depend, & atrcrn(:,n), aicen(n), & vicen(n), vsnon(n), & trcr_base, n_trcr_strata, & @@ -1597,15 +1600,11 @@ end subroutine ridge_shift ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_ice_strength (ncat, & - aice, vice, & + subroutine icepack_ice_strength(aice, vice, & aice0, aicen, & vicen, & strength) - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories - real (kind=dbl_kind), intent(in) :: & aice , & ! concentration of ice vice , & ! volume per unit area of ice (m) @@ -1653,13 +1652,13 @@ subroutine icepack_ice_strength (ncat, & ! Compute thickness distribution of ridging and ridged ice. !----------------------------------------------------------------- - call asum_ridging (ncat, aicen, aice0, asum) + call asum_ridging (aicen, aice0, asum) if (icepack_warnings_aborted(subname)) return - call ridge_itd (ncat, aice0, & + call ridge_itd (aice0, & aicen, vicen, & krdg_partic, krdg_redist, & - mu_rdg, & + mu_rdg, & aksum, apartic, & hrmin, hrmax, & hrexp, krdg) @@ -1720,10 +1719,8 @@ end subroutine icepack_ice_strength ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_step_ridge (dt, ndtd, & - nilyr, nslyr, & - nblyr, & - ncat, hin_max, & + subroutine icepack_step_ridge(dt, ndtd, & + hin_max, & rdg_conv, rdg_shear, & aicen, & trcrn, & @@ -1735,7 +1732,6 @@ subroutine icepack_step_ridge (dt, ndtd, & dvirdgdt, opening, & fpond, & fresh, fhocn, & - n_aero, & faero_ocn, fiso_ocn, & aparticn, krdgn, & aredistn, vredistn, & @@ -1744,7 +1740,9 @@ subroutine icepack_step_ridge (dt, ndtd, & araftn, vraftn, & aice, fsalt, & first_ice, fzsal, & - flux_bio, closing, Tf ) + flux_bio, closing, & + Tf, & + docleanup, dorebin) real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -1753,12 +1751,7 @@ subroutine icepack_step_ridge (dt, ndtd, & Tf ! freezing temperature integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - ndtd , & ! number of dynamics supercycles - nblyr , & ! number of bio layers - nilyr , & ! number of ice layers - nslyr , & ! number of snow layers - n_aero ! number of aerosol tracers + ndtd ! number of dynamics supercycles real (kind=dbl_kind), dimension(0:ncat), intent(inout) :: & hin_max ! category limits (m) @@ -1824,6 +1817,10 @@ subroutine icepack_step_ridge (dt, ndtd, & logical (kind=log_kind), dimension(:), intent(inout) :: & first_ice ! true until ice forms + logical (kind=log_kind), intent(in), optional :: & + docleanup, & ! if false, do not call cleanup_itd (default true) + dorebin ! if false, do not call rebin in cleanup_itd (default true) + !autodocument_end ! local variables @@ -1831,6 +1828,10 @@ subroutine icepack_step_ridge (dt, ndtd, & real (kind=dbl_kind) :: & dtt ! thermo time step + logical (kind=log_kind) :: & + ldocleanup, &! if true, call cleanup_itd + ldorebin ! if true, call rebin in cleanup_itd + logical (kind=log_kind), save :: & first_call = .true. ! first call flag @@ -1850,6 +1851,17 @@ subroutine icepack_step_ridge (dt, ndtd, & endif endif + if (present(docleanup)) then + ldocleanup = docleanup + else + ldocleanup = .true. + endif + + if (present(dorebin)) then + ldorebin = dorebin + else + ldorebin = .true. + endif !----------------------------------------------------------------- ! Identify ice-ocean cells. @@ -1859,9 +1871,7 @@ subroutine icepack_step_ridge (dt, ndtd, & !----------------------------------------------------------------- call ridge_ice (dt, ndtd, & - ncat, n_aero, & - nilyr, nslyr, & - ntrcr, hin_max, & + hin_max, & rdg_conv, rdg_shear, & aicen, & trcrn, & @@ -1875,7 +1885,7 @@ subroutine icepack_step_ridge (dt, ndtd, & mu_rdg, tr_brine, & dardg1dt, dardg2dt, & dvirdgdt, opening, & - fpond, & + fpond, flux_bio, & fresh, fhocn, & faero_ocn, fiso_ocn, & aparticn, krdgn, & @@ -1891,15 +1901,12 @@ subroutine icepack_step_ridge (dt, ndtd, & ! categories with very small areas. !----------------------------------------------------------------- - dtt = dt * ndtd ! for proper averaging over thermo timestep - call cleanup_itd (dtt, ntrcr, & - nilyr, nslyr, & - ncat, hin_max, & + if (ldocleanup) then + dtt = dt * ndtd ! for proper averaging over thermo timestep + call cleanup_itd(dtt, hin_max, & aicen, trcrn, & vicen, vsnon, & aice0, aice, & - n_aero, & - nbtrcr, nblyr, & tr_aero, & tr_pond_topo, & first_ice, & @@ -1908,8 +1915,10 @@ subroutine icepack_step_ridge (dt, ndtd, & fpond, fresh, & fsalt, fhocn, & faero_ocn, fiso_ocn, & - flux_bio, Tf) - if (icepack_warnings_aborted(subname)) return + flux_bio, Tf, & + dorebin = ldorebin) + if (icepack_warnings_aborted(subname)) return + endif first_call = .false. diff --git a/columnphysics/icepack_meltpond_topo.F90 b/columnphysics/icepack_meltpond_topo.F90 index 830c7a0b0..23928fef3 100644 --- a/columnphysics/icepack_meltpond_topo.F90 +++ b/columnphysics/icepack_meltpond_topo.F90 @@ -23,6 +23,7 @@ module icepack_meltpond_topo use icepack_parameters, only: c0, c1, c2, p01, p1, p15, p4, p6 use icepack_parameters, only: puny, viscosity_dyn, rhoi, rhos, rhow, Timelt, Lfresh use icepack_parameters, only: gravit, depressT, kice, ice_ref_salinity + use icepack_tracers, only: ncat, nilyr use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted use icepack_therm_shared, only: calculate_Tin_from_qin @@ -38,7 +39,7 @@ module icepack_meltpond_topo !======================================================================= - subroutine compute_ponds_topo(dt, ncat, nilyr, & + subroutine compute_ponds_topo(dt, & ktherm, & aice, aicen, & vice, vicen, & @@ -50,8 +51,6 @@ subroutine compute_ponds_topo(dt, ncat, nilyr, & apnd, hpnd, ipnd ) integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr, & ! number of ice layers ktherm ! type of thermodynamics (0 0-layer, 1 BL99, 2 mushy) real (kind=dbl_kind), intent(in) :: & @@ -159,7 +158,7 @@ subroutine compute_ponds_topo(dt, ncat, nilyr, & !-------------------------------------------------------------- ! calculate pond area and depth !-------------------------------------------------------------- - call pond_area(dt, ncat, nilyr, & + call pond_area(dt, & ktherm, & aice, vice, vsno, & aicen, vicen, vsnon, & @@ -291,7 +290,7 @@ end subroutine compute_ponds_topo ! Computes melt pond area, pond depth and melting rates - subroutine pond_area(dt, ncat, nilyr,& + subroutine pond_area(dt, & ktherm, & aice, vice, vsno, & aicen, vicen, vsnon,& @@ -300,8 +299,6 @@ subroutine pond_area(dt, ncat, nilyr,& apondn,hpondn,dvolp ) integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr, & ! number of ice layers ktherm ! type of thermodynamics (-1 none, 1 BL99, 2 mushy) real (kind=dbl_kind), intent(in) :: & @@ -469,7 +466,7 @@ subroutine pond_area(dt, ncat, nilyr,& ! height and area corresponding to the remaining volume - call calc_hpond(ncat, reduced_aicen, asnon, hsnon, & + call calc_hpond(reduced_aicen, asnon, hsnon, & alfan, volp, cum_max_vol, hpond, m_index) if (icepack_warnings_aborted(subname)) return @@ -495,7 +492,7 @@ subroutine pond_area(dt, ncat, nilyr,& if (ktherm /= 2 .and. pressure_head > c0) then do n = 1, ncat-1 if (hicen(n) > c0) then - call permeability_phi(nilyr, qicen(:,n), sicen(:,n), perm) + call permeability_phi(qicen(:,n), sicen(:,n), perm) if (icepack_warnings_aborted(subname)) return if (perm > c0) permflag = 1 drain = perm*apondn(n)*pressure_head*dt / (viscosity_dyn*hicen(n)) @@ -511,7 +508,7 @@ subroutine pond_area(dt, ncat, nilyr,& ! adjust melt pond dimensions if (permflag > 0) then ! recompute pond depth - call calc_hpond(ncat, reduced_aicen, asnon, hsnon, & + call calc_hpond(reduced_aicen, asnon, hsnon, & alfan, volp, cum_max_vol, hpond, m_index) if (icepack_warnings_aborted(subname)) return do n=1, m_index @@ -569,12 +566,9 @@ end subroutine pond_area !======================================================================= - subroutine calc_hpond(ncat, aicen, asnon, hsnon, & + subroutine calc_hpond(aicen, asnon, hsnon, & alfan, volp, cum_max_vol, hpond, m_index) - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories - real (kind=dbl_kind), dimension(:), intent(in) :: & aicen, & asnon, & @@ -734,10 +728,7 @@ end subroutine calc_hpond ! determine the liquid fraction of brine in the ice and the permeability - subroutine permeability_phi(nilyr, qicen, sicen, perm) - - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers + subroutine permeability_phi(qicen, sicen, perm) real (kind=dbl_kind), dimension(:), intent(in) :: & qicen, & ! energy of melting for each ice layer (J/m2) diff --git a/columnphysics/icepack_mushy_physics.F90 b/columnphysics/icepack_mushy_physics.F90 index 8ab819768..244faa725 100644 --- a/columnphysics/icepack_mushy_physics.F90 +++ b/columnphysics/icepack_mushy_physics.F90 @@ -5,6 +5,7 @@ module icepack_mushy_physics use icepack_parameters, only: puny use icepack_parameters, only: rhow, rhoi, rhos, cp_ocn, cp_ice, Lfresh use icepack_parameters, only: ksno + use icepack_tracers, only: nilyr use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -70,10 +71,7 @@ module icepack_mushy_physics !======================================================================= ! Detemine the conductivity of the mush from enthalpy and salinity - subroutine conductivity_mush_array(nilyr, zqin, zSin, km) - - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers + subroutine conductivity_mush_array(zqin, zSin, km) real(kind=dbl_kind), dimension(:), intent(in) :: & zqin, & ! ice layer enthalpy (J m-3) diff --git a/columnphysics/icepack_parameters.F90 b/columnphysics/icepack_parameters.F90 index 02deaae9a..ed76b6b41 100644 --- a/columnphysics/icepack_parameters.F90 +++ b/columnphysics/icepack_parameters.F90 @@ -117,8 +117,8 @@ module icepack_parameters Timelt = 0.0_dbl_kind ,&! melting temperature, ice top surface (C) Tsmelt = 0.0_dbl_kind ,&! melting temperature, snow top surface (C) ice_ref_salinity =4._dbl_kind,&! (ppt) - ! kice is not used for mushy thermo kice = 2.03_dbl_kind ,&! thermal conductivity of fresh ice(W/m/deg) + ! kice is only used with ktherm=1 (BL99) and conduct='MU71' ksno = 0.30_dbl_kind ,&! thermal conductivity of snow (W/m/deg) hs_min = 1.e-4_dbl_kind ,&! min snow thickness for computing zTsn (m) snowpatch = 0.02_dbl_kind ,&! parameter for fractional snow area (m) @@ -161,6 +161,11 @@ module icepack_parameters ! only for use with tr_aero or tr_zaero conserv_check = .false. ! if true, do conservations checks and abort + character(len=char_len), public :: & + congel_freeze = 'two-step' ! congelation computation + ! 'two-step' = original formulation + ! 'one-step' = Plante et al, The Cryosphere, 2024 + character(len=char_len), public :: & tfrz_option = 'mushy' ! form of ocean freezing temperature ! 'minus1p8' = -1.8 C @@ -187,6 +192,7 @@ module icepack_parameters kappav = 1.4_dbl_kind ,&! vis extnctn coef in ice, wvlngth<700nm (1/m) hi_ssl = 0.050_dbl_kind,&! ice surface scattering layer thickness (m) hs_ssl = 0.040_dbl_kind,&! snow surface scattering layer thickness (m) + hs_ssl_min = 5.e-4_dbl_kind,&! minimum snow surface scattering layer thickness for aerosol (m) ! baseline albedos for ccsm3 shortwave, set in namelist albicev = 0.78_dbl_kind ,&! visible ice albedo for h > ahmax albicei = 0.36_dbl_kind ,&! near-ir ice albedo for h > ahmax @@ -200,8 +206,9 @@ module icepack_parameters dT_mlt = c1p5 ,&! change in temp for non-melt to melt snow grain ! radius change (C) rsnw_mlt = 1500._dbl_kind,&! maximum melting snow grain radius (10^-6 m) - kalg = 0.60_dbl_kind ! algae absorption coefficient for 0.5 m thick layer + kalg = 0.60_dbl_kind, &! algae absorption coefficient for 0.5 m thick layer ! 0.5 m path of 75 mg Chl a / m2 + R_gC2molC = 12.0107_dbl_kind! g carbon per mol carbon ! weights for albedos ! 4 Jan 2007 BPB Following are appropriate for complete cloud ! in a summer polar atmosphere with 1.5m bare sea ice surface: @@ -309,7 +316,7 @@ module icepack_parameters nfreq = 25 ! number of frequencies real (kind=dbl_kind), public :: & - floeshape = 0.66_dbl_kind ! constant from Steele (unitless) + floeshape = 0.66_dbl_kind ! constant from Rothrock 1984 (unitless) real (kind=dbl_kind), public :: & floediam = 300.0_dbl_kind ! effective floe diameter for lateral melt (m) @@ -393,19 +400,23 @@ module icepack_parameters scale_bgc = .false., & ! if .true., initialize bgc tracers proportionally with salinity solve_zbgc = .false., & ! if .true., solve vertical biochemistry portion of code dEdd_algae = .false., & ! if .true., algal absorption of shortwave is computed in the - skl_bgc = .false. ! if true, solve skeletal biochemistry + skl_bgc = .false., & ! if true, solve skeletal biochemistry + use_macromolecules = .false., & ! if true, ocean DOC already split into + ! polysaccharids, lipid and protein fractions + use_atm_dust_iron = .false., & ! if .true., compute iron contribution from dust + restartbgc = .false. real (kind=dbl_kind), public :: & - phi_snow = p5 , & ! snow porosity - grid_o = c5 , & ! for bottom flux + phi_snow = -1.0_dbl_kind , & ! snow porosity (compute from snow density if negative) + grid_o = 0.006_dbl_kind , & ! for bottom flux initbio_frac = c1 , & ! fraction of ocean trcr concentration in bio trcrs - l_sk = 7.0_dbl_kind , & ! characteristic diffusive scale (m) - grid_oS = c5 , & ! for bottom flux - l_skS = 7.0_dbl_kind , & ! characteristic skeletal layer thickness (m) (zsalinity) - algal_vel = 1.11e-8_dbl_kind, & ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day + l_sk = 2.0_dbl_kind , & ! characteristic diffusive scale (m) + grid_oS = c0 , & ! for bottom flux + l_skS = 0.028_dbl_kind , & ! characteristic skeletal layer thickness (m) (zsalinity) + algal_vel = 1.0e-7_dbl_kind , & ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day R_dFe2dust = 0.035_dbl_kind , & ! g/g (3.5% content) Tagliabue 2009 dustFe_sol = 0.005_dbl_kind , & ! solubility fraction - frazil_scav = c1 , & ! fraction or multiple of bgc concentrated in frazil ice + frazil_scav = 0.8_dbl_kind , & ! fraction or multiple of bgc concentrated in frazil ice sk_l = 0.03_dbl_kind , & ! skeletal layer thickness (m) min_bgc = 0.01_dbl_kind , & ! fraction of ocean bgc concentration in surface melt T_max = c0 , & ! maximum temperature (C) @@ -413,20 +424,116 @@ module icepack_parameters op_dep_min = p1 , & ! light attenuates for optical depths exceeding min fr_graze_s = p5 , & ! fraction of grazing spilled or slopped fr_graze_e = p5 , & ! fraction of assimilation excreted - fr_mort2min = p5 , & ! fractionation of mortality to Am - fr_dFe = 0.3_dbl_kind , & ! fraction of remineralized nitrogen + fr_mort2min = 0.9_dbl_kind , & ! fractionation of mortality to Am + fr_dFe = 1.0_dbl_kind , & ! fraction of remineralized nitrogen ! (in units of algal iron) - k_nitrif = c0 , & ! nitrification rate (1/day) + k_nitrif = 0.046_dbl_kind , & ! nitrification rate (1/day) t_iron_conv = 3065.0_dbl_kind , & ! desorption loss pFe to dFe (day) max_loss = 0.9_dbl_kind , & ! restrict uptake to % of remaining value max_dfe_doc1 = 0.2_dbl_kind , & ! max ratio of dFe to saccharides in the ice ! (nM Fe/muM C) fr_resp = 0.05_dbl_kind , & ! fraction of algal growth lost due to respiration - fr_resp_s = 0.75_dbl_kind , & ! DMSPd fraction of respiration loss as DMSPd - y_sk_DMS = p5 , & ! fraction conversion given high yield - t_sk_conv = 3.0_dbl_kind , & ! Stefels conversion time (d) - t_sk_ox = 10.0_dbl_kind ! DMS oxidation time (d) - + fr_resp_s = 0.90_dbl_kind , & ! DMSPd fraction of respiration loss as DMSPd + y_sk_DMS = 0.7_dbl_kind , & ! fraction conversion given high yield + t_sk_conv = 5.0_dbl_kind , & ! Stefels conversion time (d) + t_sk_ox = 12.0_dbl_kind , & ! DMS oxidation time (d) + grid_o_t = 0.006_dbl_kind , & ! ice surface molecular sublayer thickness (m) + ratio_Si2N_diatoms = 1.8_dbl_kind , & ! algal Si to N (mol/mol) + ratio_Si2N_sp = c0 , & + ratio_Si2N_phaeo = c0 , & + ratio_S2N_diatoms = 0.03_dbl_kind , & ! algal S to N (mol/mol) + ratio_S2N_sp = 0.03_dbl_kind , & + ratio_S2N_phaeo = 0.03_dbl_kind , & + ratio_Fe2C_diatoms = 0.0033_dbl_kind, & ! algal Fe to C (umol/mol) + ratio_Fe2C_sp = 0.0033_dbl_kind, & + ratio_Fe2C_phaeo = 0.1_dbl_kind , & + ratio_Fe2N_diatoms = 0.023_dbl_kind , & ! algal Fe to N (umol/mol) + ratio_Fe2N_sp = 0.023_dbl_kind , & + ratio_Fe2N_phaeo = 0.7_dbl_kind , & + ratio_Fe2DON = 0.023_dbl_kind , & ! Fe to N of DON (nmol/umol) + ratio_Fe2DOC_s = 0.1_dbl_kind , & ! Fe to C of DOC (nmol/umol) saccharids + ratio_Fe2DOC_l = 0.033_dbl_kind , & ! Fe to C of DOC (nmol/umol) lipids + tau_min = 3600.0_dbl_kind, & ! rapid timescale for mobile to stationary exchanges (s) + tau_max = 604800.0_dbl_kind, & ! short timescale for mobile to stationary exchanges (s) + chlabs_diatoms = 0.03_dbl_kind , & ! absorptivity for diatoms (1/m/(mg/m3)) + chlabs_sp = 0.01_dbl_kind , & ! absorptivity for small plankton (1/m/(mg/m3)) + chlabs_phaeo = 0.05_dbl_kind , & ! absorptivity for phaeocystis (1/m/(mg/m3)) + alpha2max_low_diatoms = 0.3_dbl_kind, & ! light limitation for diatoms (1/(W/m2)) + alpha2max_low_sp = 0.2_dbl_kind , & ! light limitation for small plankton (1/(W/m2)) + alpha2max_low_phaeo = 0.17_dbl_kind , & ! light limitation for phaeocystis(1/(W/m2)) + beta2max_diatoms = 0.001_dbl_kind , & ! light inhibition (1/(W/m^2)) + beta2max_sp = 0.001_dbl_kind , & + beta2max_phaeo = 0.04_dbl_kind , & + mu_max_diatoms = 1.44_dbl_kind , & ! maximum growth rate (1/day) + mu_max_sp = 0.41_dbl_kind , & + mu_max_phaeo = 0.63_dbl_kind , & + grow_Tdep_diatoms = 0.063_dbl_kind , & ! Temperature dependence of growth (1/C) + grow_Tdep_sp = 0.063_dbl_kind , & + grow_Tdep_phaeo = 0.063_dbl_kind , & + fr_graze_diatoms = 0.19_dbl_kind , & ! Fraction grazed + fr_graze_sp = 0.19_dbl_kind , & + fr_graze_phaeo = 0.19_dbl_kind , & + mort_pre_diatoms = 0.007_dbl_kind , & ! Mortality (1/day) + mort_pre_sp = 0.007_dbl_kind , & + mort_pre_phaeo = 0.007_dbl_kind , & + mort_Tdep_diatoms = 0.03_dbl_kind , & ! T dependence of mortality (1/C) + mort_Tdep_sp = 0.03_dbl_kind , & + mort_Tdep_phaeo = 0.03_dbl_kind , & + k_exude_diatoms = c0 , & ! algal exudation (1/d) + k_exude_sp = c0 , & + k_exude_phaeo = c0 , & + K_Nit_diatoms = c1 , & ! nitrate half saturation (mmol/m^3) + K_Nit_sp = c1 , & + K_Nit_phaeo = c1 , & + K_Am_diatoms = 0.3_dbl_kind , & ! ammonium half saturation (mmol/m^3) + K_Am_sp = 0.3_dbl_kind , & + K_Am_phaeo = 0.3_dbl_kind , & + K_Sil_diatoms = 4.0_dbl_kind , & ! silicate half saturation (mmol/m^3) + K_Sil_sp = c0 , & + K_Sil_phaeo = c0 , & + K_Fe_diatoms = c1 , & ! iron half saturation (nM) + K_Fe_sp = 0.2_dbl_kind , & + K_Fe_phaeo = 0.1_dbl_kind , & + f_don_protein = 0.6_dbl_kind , & ! fraction of spilled grazing to proteins + kn_bac_protein = 0.2_dbl_kind , & ! Bacterial degredation of DON (1/d) + f_don_Am_protein = c1 , & ! fraction of remineralized DON to ammonium + f_doc_s = 0.5_dbl_kind , & ! fraction of mortality to DOC + f_doc_l = 0.5_dbl_kind , & + f_exude_s = c1 , & ! fraction of exudation to DOC + f_exude_l = c1 , & + k_bac_s = 0.03_dbl_kind , & ! Bacterial degredation of DOC (1/d) + k_bac_l = 0.03_dbl_kind , & + algaltype_diatoms = c0 , & ! mobility type + algaltype_sp = c0 , & ! algal groups + algaltype_phaeo = c0 , & ! + nitratetype = -1.0_dbl_kind , & ! nitrate + ammoniumtype = c0 , & ! ammonium + silicatetype = -1.0_dbl_kind , & ! silicate + dmspptype = 0.5_dbl_kind , & ! DMS + dmspdtype = c0 , & ! + humtype = c0 , & ! humics + doctype_s = c0 , & ! DOC + doctype_l = c0 , & ! + dictype_1 = -1.0_dbl_kind , & ! DIC + dontype_protein = c0 , & ! DON + fedtype_1 = c0 , & ! Iron + feptype_1 = 0.5_dbl_kind , & ! + zaerotype_bc1 = -1.0_dbl_kind , & ! Aerosols + zaerotype_bc2 = -1.0_dbl_kind , & ! + zaerotype_dust1 = -1.0_dbl_kind , & ! + zaerotype_dust2 = -1.0_dbl_kind , & ! + zaerotype_dust3 = -1.0_dbl_kind , & ! + zaerotype_dust4 = -1.0_dbl_kind , & ! + ratio_C2N_diatoms = 7.0_dbl_kind , & ! algal carbon to nitrogen mole ratio + ratio_C2N_sp = 7.0_dbl_kind , & + ratio_C2N_phaeo = 7.0_dbl_kind , & + ratio_chl2N_diatoms = 2.1_dbl_kind , & ! algal chlorophyll to nitrogen ratio (g chla/mol) + ratio_chl2N_sp = 1.1_dbl_kind , & + ratio_chl2N_phaeo = 0.84_dbl_kind , & + ratio_C2N_proteins = 5.0_dbl_kind , &! Ratio of carbon to nitrogen in proteins + F_abs_chl_diatoms = 2.0_dbl_kind , & ! scales absorbed radiation for dEdd + F_abs_chl_sp = 4.0_dbl_kind , & ! + F_abs_chl_phaeo = 5.0_dbl_kind !======================================================================= contains @@ -450,7 +557,7 @@ subroutine icepack_init_parameters( & zref_in, hs_min_in, snowpatch_in, rhosi_in, sk_l_in, & saltmax_in, phi_init_in, min_salin_in, salt_loss_in, & Tliquidus_max_in, & - min_bgc_in, dSin0_frazil_in, hi_ssl_in, hs_ssl_in, & + min_bgc_in, dSin0_frazil_in, hi_ssl_in, hs_ssl_in, hs_ssl_min_in, & awtvdr_in, awtidr_in, awtvdf_in, awtidf_in, & qqqice_in, TTTice_in, qqqocn_in, TTTocn_in, & ktherm_in, conduct_in, fbot_xfer_type_in, calc_Tsfc_in, dts_b_in, & @@ -461,17 +568,18 @@ subroutine icepack_init_parameters( & phi_i_mushy_in, shortwave_in, albedo_type_in, albsnowi_in, & albicev_in, albicei_in, albsnowv_in, & ahmax_in, R_ice_in, R_pnd_in, R_snw_in, dT_mlt_in, rsnw_mlt_in, & - kalg_in, kstrength_in, krdg_partic_in, krdg_redist_in, mu_rdg_in, & + kalg_in, R_gC2molC_in, kstrength_in, krdg_partic_in, krdg_redist_in, mu_rdg_in, & atmbndy_in, calc_strair_in, formdrag_in, highfreq_in, natmiter_in, & atmiter_conv_in, calc_dragio_in, & tfrz_option_in, kitd_in, kcatbound_in, hs0_in, frzpnd_in, & - saltflux_option_in, & + saltflux_option_in, congel_freeze_in, & floeshape_in, wave_spec_in, wave_spec_type_in, nfreq_in, & dpscale_in, rfracmin_in, rfracmax_in, pndaspect_in, hs1_in, hp1_in, & bgc_flux_type_in, z_tracers_in, scale_bgc_in, solve_zbgc_in, & - modal_aero_in, skl_bgc_in, solve_zsal_in, grid_o_in, l_sk_in, & + modal_aero_in, use_macromolecules_in, restartbgc_in, skl_bgc_in, & + solve_zsal_in, grid_o_in, l_sk_in, & initbio_frac_in, grid_oS_in, l_skS_in, dEdd_algae_in, & - phi_snow_in, T_max_in, fsal_in, & + phi_snow_in, T_max_in, fsal_in, use_atm_dust_iron_in, & fr_resp_in, algal_vel_in, R_dFe2dust_in, dustFe_sol_in, & op_dep_min_in, fr_graze_s_in, fr_graze_e_in, fr_mort2min_in, & fr_dFe_in, k_nitrif_in, t_iron_conv_in, max_loss_in, & @@ -483,7 +591,38 @@ subroutine icepack_init_parameters( & snwlvlfac_in, isnw_T_in, isnw_Tgrd_in, isnw_rhos_in, & snowage_rhos_in, snowage_Tgrd_in, snowage_T_in, & snowage_tau_in, snowage_kappa_in, snowage_drdt0_in, & - snw_aging_table_in, snw_ssp_table_in ) + snw_aging_table_in, snw_ssp_table_in, grid_o_t_in, tau_min_in, tau_max_in, & + f_don_protein_in, kn_bac_protein_in, f_don_Am_protein_in, & + ratio_Si2N_diatoms_in, & + ratio_Si2N_sp_in, ratio_Si2N_phaeo_in, ratio_S2N_diatoms_in, & + ratio_S2N_sp_in, ratio_S2N_phaeo_in, ratio_Fe2C_diatoms_in, & + ratio_Fe2C_sp_in, ratio_Fe2C_phaeo_in, ratio_Fe2N_diatoms_in, & + ratio_Fe2N_sp_in, ratio_Fe2N_phaeo_in, ratio_Fe2DON_in, & + ratio_Fe2DOC_s_in, ratio_Fe2DOC_l_in, & + chlabs_diatoms_in, chlabs_sp_in, chlabs_phaeo_in, alpha2max_low_diatoms_in, & + alpha2max_low_sp_in, alpha2max_low_phaeo_in, beta2max_diatoms_in, & + beta2max_sp_in, beta2max_phaeo_in, mu_max_diatoms_in, mu_max_sp_in, & + mu_max_phaeo_in, grow_Tdep_diatoms_in, grow_Tdep_sp_in, & + grow_Tdep_phaeo_in, fr_graze_diatoms_in, fr_graze_sp_in, & + fr_graze_phaeo_in, mort_pre_diatoms_in, mort_pre_sp_in, & + mort_pre_phaeo_in, mort_Tdep_diatoms_in, mort_Tdep_sp_in, & + mort_Tdep_phaeo_in, k_exude_diatoms_in, k_exude_sp_in, k_exude_phaeo_in, & + K_Nit_diatoms_in, K_Nit_sp_in, K_Nit_phaeo_in, & + K_Am_diatoms_in, K_Am_sp_in, K_Am_phaeo_in, & + K_Sil_diatoms_in, K_Sil_sp_in, K_Sil_phaeo_in, & + K_Fe_diatoms_in, K_Fe_sp_in, K_Fe_phaeo_in, & + f_doc_s_in, f_doc_l_in, f_exude_s_in, f_exude_l_in, & + k_bac_s_in, k_bac_l_in, algaltype_diatoms_in, & + algaltype_sp_in, algaltype_phaeo_in, nitratetype_in, & + ammoniumtype_in, silicatetype_in, dmspptype_in, & + dmspdtype_in, humtype_in, doctype_s_in, doctype_l_in, & + dictype_1_in, dontype_protein_in, fedtype_1_in, feptype_1_in, & + zaerotype_bc1_in, zaerotype_bc2_in, zaerotype_dust1_in, & + zaerotype_dust2_in, zaerotype_dust3_in, zaerotype_dust4_in, & + ratio_C2N_diatoms_in, ratio_C2N_sp_in, ratio_C2N_phaeo_in, & + ratio_chl2N_diatoms_in, ratio_chl2N_sp_in, ratio_chl2N_phaeo_in, & + F_abs_chl_diatoms_in, F_abs_chl_sp_in, F_abs_chl_phaeo_in, & + ratio_C2N_proteins_in ) !----------------------------------------------------------------- ! control settings @@ -575,15 +714,20 @@ subroutine icepack_init_parameters( & phi_i_mushy_in ! liquid fraction of congelation ice character(len=*), intent(in), optional :: & - tfrz_option_in ! form of ocean freezing temperature - ! 'minus1p8' = -1.8 C - ! 'linear_salt' = -depressT * sss - ! 'mushy' conforms with ktherm=2 + congel_freeze_in ! congelation computation + ! 'two-step' = original formulation + ! 'one-step' = Plante et al, The Cryosphere, 2024 + + character(len=*), intent(in), optional :: & + tfrz_option_in ! form of ocean freezing temperature + ! 'minus1p8' = -1.8 C + ! 'linear_salt' = -depressT * sss + ! 'mushy' conforms with ktherm=2 character(len=*), intent(in), optional :: & - saltflux_option_in ! Salt flux computation - ! 'constant' reference value of ice_ref_salinity - ! 'prognostic' prognostic salt flux + saltflux_option_in ! Salt flux computation + ! 'constant' reference value of ice_ref_salinity + ! 'prognostic' prognostic salt flux !----------------------------------------------------------------------- ! Parameters for radiation @@ -596,7 +740,8 @@ subroutine icepack_init_parameters( & stefan_boltzmann_in, & ! W/m^2/K^4 kappav_in, & ! vis extnctn coef in ice, wvlngth<700nm (1/m) hi_ssl_in, & ! ice surface scattering layer thickness (m) - hs_ssl_in, & ! visible, direct + hs_ssl_in, & ! snow surface scattering layer thickness (m) + hs_ssl_min_in, & ! minimum snow surface scattering layer thickness for aerosols (m) awtvdr_in, & ! visible, direct ! for history and awtidr_in, & ! near IR, direct ! diagnostics awtvdf_in, & ! visible, diffuse @@ -623,7 +768,8 @@ subroutine icepack_init_parameters( & dT_mlt_in , & ! change in temp for non-melt to melt snow grain ! radius change (C) rsnw_mlt_in , & ! maximum melting snow grain radius (10^-6 m) - kalg_in ! algae absorption coefficient for 0.5 m thick layer + kalg_in , & ! algae absorption coefficient for 0.5 m thick layer + R_gC2molC_in ! g carbon per mol logical (kind=log_kind), intent(in), optional :: & sw_redist_in ! redistribute shortwave @@ -710,7 +856,7 @@ subroutine icepack_init_parameters( & nfreq_in ! number of frequencies real (kind=dbl_kind), intent(in), optional :: & - floeshape_in ! constant from Steele (unitless) + floeshape_in ! constant from Rothrock 1984 (unitless) logical (kind=log_kind), intent(in), optional :: & wave_spec_in ! if true, use wave forcing @@ -732,6 +878,10 @@ subroutine icepack_init_parameters( & solve_zbgc_in, & ! if .true., solve vertical biochemistry portion of code dEdd_algae_in, & ! if .true., algal absorptionof Shortwave is computed in the modal_aero_in, & ! if .true., use modal aerosol formulation in shortwave + use_macromolecules_in, & ! if .true., ocean DOC is already split into + ! polysaccharid, lipid and protein fractions + use_atm_dust_iron_in, & ! if .true., compute iron contribution from dust + restartbgc_in, & conserv_check_in ! if .true., run conservation checks and abort if checks fail logical (kind=log_kind), intent(in), optional :: & @@ -741,12 +891,112 @@ subroutine icepack_init_parameters( & real (kind=dbl_kind), intent(in), optional :: & grid_o_in , & ! for bottom flux l_sk_in , & ! characteristic diffusive scale (zsalinity) (m) + grid_o_t_in , & ! top grid point length scale initbio_frac_in, & ! fraction of ocean tracer concentration used to initialize tracer phi_snow_in ! snow porosity at the ice/snow interface real (kind=dbl_kind), intent(in), optional :: & grid_oS_in , & ! for bottom flux (zsalinity) l_skS_in ! 0.02 characteristic skeletal layer thickness (m) (zsalinity) + + real (kind=dbl_kind), intent(in), optional :: & + ratio_Si2N_diatoms_in, & ! algal Si to N (mol/mol) + ratio_Si2N_sp_in , & + ratio_Si2N_phaeo_in , & + ratio_S2N_diatoms_in , & ! algal S to N (mol/mol) + ratio_S2N_sp_in , & + ratio_S2N_phaeo_in , & + ratio_Fe2C_diatoms_in, & ! algal Fe to C (umol/mol) + ratio_Fe2C_sp_in , & + ratio_Fe2C_phaeo_in , & + ratio_Fe2N_diatoms_in, & ! algal Fe to N (umol/mol) + ratio_Fe2N_sp_in , & + ratio_Fe2N_phaeo_in , & + ratio_Fe2DON_in , & ! Fe to N of DON (nmol/umol) + ratio_Fe2DOC_s_in , & ! Fe to C of DOC (nmol/umol) saccharids + ratio_Fe2DOC_l_in , & ! Fe to C of DOC (nmol/umol) lipids + tau_min_in , & ! rapid mobile to stationary exchanges (s) = 1.5 hours + tau_max_in , & ! long time mobile to stationary exchanges (s) = 2 days + chlabs_diatoms_in , & ! chl absorption (1/m/(mg/m^3)) + chlabs_sp_in , & ! + chlabs_phaeo_in , & ! + alpha2max_low_diatoms_in , & ! light limitation (1/(W/m^2)) + alpha2max_low_sp_in , & + alpha2max_low_phaeo_in , & + beta2max_diatoms_in , & ! light inhibition (1/(W/m^2)) + beta2max_sp_in , & + beta2max_phaeo_in , & + mu_max_diatoms_in , & ! maximum growth rate (1/day) + mu_max_sp_in , & + mu_max_phaeo_in , & + grow_Tdep_diatoms_in, & ! Temperature dependence of growth (1/C) + grow_Tdep_sp_in , & + grow_Tdep_phaeo_in , & + fr_graze_diatoms_in , & ! Fraction grazed + fr_graze_sp_in , & + fr_graze_phaeo_in , & + mort_pre_diatoms_in , & ! Mortality (1/day) + mort_pre_sp_in , & + mort_pre_phaeo_in , & + mort_Tdep_diatoms_in, & ! T dependence of mortality (1/C) + mort_Tdep_sp_in , & + mort_Tdep_phaeo_in , & + k_exude_diatoms_in , & ! algal exudation (1/d) + k_exude_sp_in , & + k_exude_phaeo_in , & + K_Nit_diatoms_in , & ! nitrate half saturation (mmol/m^3) + K_Nit_sp_in , & + K_Nit_phaeo_in , & + K_Am_diatoms_in , & ! ammonium half saturation (mmol/m^3) + K_Am_sp_in , & + K_Am_phaeo_in , & + K_Sil_diatoms_in , & ! silicate half saturation (mmol/m^3) + K_Sil_sp_in , & + K_Sil_phaeo_in , & + K_Fe_diatoms_in , & ! iron half saturation (nM) + K_Fe_sp_in , & + K_Fe_phaeo_in , & + f_don_protein_in , & ! fraction of spilled grazing to proteins + kn_bac_protein_in , & ! Bacterial degredation of DON (1/d) + f_don_Am_protein_in , & ! fraction of remineralized DON to ammonium + f_doc_s_in , & ! fraction of mortality to DOC + f_doc_l_in , & + f_exude_s_in , & ! fraction of exudation to DOC + f_exude_l_in , & + k_bac_s_in , & ! Bacterial degredation of DOC (1/d) + k_bac_l_in , & + algaltype_diatoms_in , & ! mobility type + algaltype_sp_in , & ! + algaltype_phaeo_in , & ! + nitratetype_in , & ! + ammoniumtype_in , & ! + silicatetype_in , & ! + dmspptype_in , & ! + dmspdtype_in , & ! + humtype_in , & ! + doctype_s_in , & ! + doctype_l_in , & ! + dictype_1_in , & ! + dontype_protein_in , & ! + fedtype_1_in , & ! + feptype_1_in , & ! + zaerotype_bc1_in , & ! + zaerotype_bc2_in , & ! + zaerotype_dust1_in , & ! + zaerotype_dust2_in , & ! + zaerotype_dust3_in , & ! + zaerotype_dust4_in , & ! + ratio_C2N_diatoms_in , & ! algal C to N ratio (mol/mol) + ratio_C2N_sp_in , & ! + ratio_C2N_phaeo_in , & ! + ratio_chl2N_diatoms_in, & ! algal chlorophyll to N ratio (mg/mmol) + ratio_chl2N_sp_in , & ! + ratio_chl2N_phaeo_in , & ! + F_abs_chl_diatoms_in , & ! scales absorbed radiation for dEdd + F_abs_chl_sp_in , & ! + F_abs_chl_phaeo_in , & ! + ratio_C2N_proteins_in ! ratio of C to N in proteins (mol/mol) + real (kind=dbl_kind), intent(in), optional :: & fr_resp_in , & ! fraction of algal growth lost due to respiration algal_vel_in , & ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day @@ -902,6 +1152,7 @@ subroutine icepack_init_parameters( & if (present(dSin0_frazil_in) ) dSin0_frazil = dSin0_frazil_in if (present(hi_ssl_in) ) hi_ssl = hi_ssl_in if (present(hs_ssl_in) ) hs_ssl = hs_ssl_in + if (present(hs_ssl_min_in) ) hs_ssl_min = hs_ssl_min_in if (present(awtvdr_in) ) awtvdr = awtvdr_in if (present(awtidr_in) ) awtidr = awtidr_in if (present(awtvdf_in) ) awtvdf = awtvdf_in @@ -939,6 +1190,7 @@ subroutine icepack_init_parameters( & if (present(dT_mlt_in) ) dT_mlt = dT_mlt_in if (present(rsnw_mlt_in) ) rsnw_mlt = rsnw_mlt_in if (present(kalg_in) ) kalg = kalg_in + if (present(R_gC2molC_in) ) R_gC2molC = R_gC2molC_in if (present(kstrength_in) ) kstrength = kstrength_in if (present(krdg_partic_in) ) krdg_partic = krdg_partic_in if (present(krdg_redist_in) ) krdg_redist = krdg_redist_in @@ -949,6 +1201,7 @@ subroutine icepack_init_parameters( & if (present(highfreq_in) ) highfreq = highfreq_in if (present(natmiter_in) ) natmiter = natmiter_in if (present(atmiter_conv_in) ) atmiter_conv = atmiter_conv_in + if (present(congel_freeze_in) ) congel_freeze = congel_freeze_in if (present(tfrz_option_in) ) tfrz_option = tfrz_option_in if (present(saltflux_option_in) ) saltflux_option = saltflux_option_in if (present(kitd_in) ) kitd = kitd_in @@ -1104,6 +1357,9 @@ subroutine icepack_init_parameters( & if (present(solve_zbgc_in) ) solve_zbgc = solve_zbgc_in if (present(dEdd_algae_in) ) dEdd_algae = dEdd_algae_in if (present(modal_aero_in) ) modal_aero = modal_aero_in + if (present(use_macromolecules_in)) use_macromolecules = use_macromolecules_in + if (present(use_atm_dust_iron_in) ) use_atm_dust_iron = use_atm_dust_iron_in + if (present(restartbgc_in) ) restartbgc = restartbgc_in if (present(conserv_check_in) ) conserv_check = conserv_check_in if (present(skl_bgc_in) ) skl_bgc = skl_bgc_in if (present(solve_zsal_in)) then @@ -1114,10 +1370,145 @@ subroutine icepack_init_parameters( & endif if (present(grid_o_in) ) grid_o = grid_o_in if (present(l_sk_in) ) l_sk = l_sk_in + if (present(grid_o_t_in) ) grid_o_t = grid_o_t_in + if (present(frazil_scav_in) ) frazil_scav = frazil_scav_in if (present(initbio_frac_in) ) initbio_frac = initbio_frac_in if (present(grid_oS_in) ) grid_oS = grid_oS_in if (present(l_skS_in) ) l_skS = l_skS_in if (present(phi_snow_in) ) phi_snow = phi_snow_in + + if (present(ratio_Si2N_diatoms_in) ) ratio_Si2N_diatoms = ratio_Si2N_diatoms_in + if (present(ratio_Si2N_sp_in) ) ratio_Si2N_sp = ratio_Si2N_sp_in + if (present(ratio_Si2N_phaeo_in) ) ratio_Si2N_phaeo = ratio_Si2N_phaeo_in + if (present(ratio_S2N_diatoms_in) ) ratio_S2N_diatoms = ratio_S2N_diatoms_in + if (present(ratio_S2N_sp_in ) ) ratio_S2N_sp = ratio_S2N_sp_in + if (present(ratio_S2N_phaeo_in) ) ratio_S2N_phaeo = ratio_S2N_phaeo_in + if (present(ratio_Fe2C_diatoms_in) ) ratio_Fe2C_diatoms = ratio_Fe2C_diatoms_in + if (present(ratio_Fe2C_sp_in) ) ratio_Fe2C_sp = ratio_Fe2C_sp_in + if (present(ratio_Fe2C_phaeo_in) ) ratio_Fe2C_phaeo = ratio_Fe2C_phaeo_in + if (present(ratio_Fe2N_diatoms_in) ) ratio_Fe2N_diatoms = ratio_Fe2N_diatoms_in + if ((solve_zbgc .or. skl_bgc) .and. (ratio_Fe2N_diatoms .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: ratio_Fe2N_diatoms < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(ratio_Fe2N_sp_in) ) ratio_Fe2N_sp = ratio_Fe2N_sp_in + if ((solve_zbgc .or. skl_bgc) .and. (ratio_Fe2N_sp .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: ratio_Fe2N_sp < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(ratio_Fe2N_phaeo_in) ) ratio_Fe2N_phaeo = ratio_Fe2N_phaeo_in + if ((solve_zbgc .or. skl_bgc) .and. (ratio_Fe2N_phaeo .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: ratio_Fe2N_phaeo < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(ratio_Fe2DON_in) ) ratio_Fe2DON = ratio_Fe2DON_in + if (present(ratio_Fe2DOC_s_in) ) ratio_Fe2DOC_s = ratio_Fe2DOC_s_in + if (present(ratio_Fe2DOC_l_in) ) ratio_Fe2DOC_l = ratio_Fe2DOC_l_in + if (present(tau_min_in) ) tau_min = tau_min_in + if (present(tau_max_in) ) tau_max = tau_max_in + if (present(chlabs_diatoms_in) ) chlabs_diatoms = chlabs_diatoms_in + if (present(chlabs_sp_in) ) chlabs_sp = chlabs_sp_in + if (present(chlabs_phaeo_in) ) chlabs_phaeo = chlabs_phaeo_in + if (present(alpha2max_low_diatoms_in) ) alpha2max_low_diatoms = alpha2max_low_diatoms_in + if (present(alpha2max_low_sp_in) ) alpha2max_low_sp = alpha2max_low_sp_in + if (present(alpha2max_low_phaeo_in) ) alpha2max_low_phaeo = alpha2max_low_phaeo_in + if (present(beta2max_diatoms_in) ) beta2max_diatoms = beta2max_diatoms_in + if (present(beta2max_sp_in) ) beta2max_sp = beta2max_sp_in + if (present(beta2max_phaeo_in) ) beta2max_phaeo = beta2max_phaeo_in + if (present(mu_max_diatoms_in) ) mu_max_diatoms = mu_max_diatoms_in + if (present(mu_max_sp_in) ) mu_max_sp = mu_max_sp_in + if (present(mu_max_phaeo_in) ) mu_max_phaeo = mu_max_phaeo_in + if (present(grow_Tdep_diatoms_in) ) grow_Tdep_diatoms = grow_Tdep_diatoms_in + if (present(grow_Tdep_sp_in) ) grow_Tdep_sp = grow_Tdep_sp_in + if (present(grow_Tdep_phaeo_in) ) grow_Tdep_phaeo = grow_Tdep_phaeo_in + if (present(fr_graze_diatoms_in) ) fr_graze_diatoms = fr_graze_diatoms_in + if (present(fr_graze_sp_in) ) fr_graze_sp = fr_graze_sp_in + if (present(fr_graze_phaeo_in) ) fr_graze_phaeo = fr_graze_phaeo_in + if (present(mort_pre_diatoms_in) ) mort_pre_diatoms = mort_pre_diatoms_in + if (present(mort_pre_sp_in) ) mort_pre_sp = mort_pre_sp_in + if (present(mort_pre_phaeo_in) ) mort_pre_phaeo = mort_pre_phaeo_in + if (present(mort_Tdep_diatoms_in) ) mort_Tdep_diatoms = mort_Tdep_diatoms_in + if (present(mort_Tdep_sp_in) ) mort_Tdep_sp = mort_Tdep_sp_in + if (present(mort_Tdep_phaeo_in) ) mort_Tdep_phaeo = mort_Tdep_phaeo_in + if (present(k_exude_diatoms_in) ) k_exude_diatoms = k_exude_diatoms_in + if (present(k_exude_sp_in) ) k_exude_sp = k_exude_sp_in + if (present(k_exude_phaeo_in) ) k_exude_phaeo = k_exude_phaeo_in + if (present(K_Nit_diatoms_in) ) K_Nit_diatoms = K_Nit_diatoms_in + if ((solve_zbgc .or. skl_bgc) .and. (K_Nit_diatoms .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: K_Nit_diatoms < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(K_Nit_sp_in) ) K_Nit_sp = K_Nit_sp_in + if ((solve_zbgc .or. skl_bgc) .and. (K_Nit_sp .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: K_Nit_sp < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(K_Nit_phaeo_in) ) K_Nit_phaeo = K_Nit_phaeo_in + if ((solve_zbgc .or. skl_bgc) .and. (K_Nit_phaeo .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: K_Nit_phaeo < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(K_Am_diatoms_in) ) K_Am_diatoms = K_Am_diatoms_in + if ((solve_zbgc .or. skl_bgc) .and. (K_Am_diatoms .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: K_Am_diatoms < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(K_Am_sp_in) ) K_Am_sp = K_Am_sp_in + if ((solve_zbgc .or. skl_bgc) .and. (K_Am_sp .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: K_Am_sp < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(K_Am_phaeo_in) ) K_Am_phaeo = K_Am_phaeo_in + if ((solve_zbgc .or. skl_bgc) .and. (K_Am_phaeo .LE. c0)) then + call icepack_warnings_add(subname//' WARNING: K_Am_phaeo < = 0') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + if (present(K_Sil_diatoms_in) ) K_Sil_diatoms = K_Sil_diatoms_in + if (present(K_Sil_sp_in) ) K_Sil_sp = K_Sil_sp_in + if (present(K_Sil_phaeo_in) ) K_Sil_phaeo = K_Sil_phaeo_in + if (present(K_Fe_diatoms_in) ) K_Fe_diatoms = K_Fe_diatoms_in + if (present(K_Fe_sp_in) ) K_Fe_sp = K_Fe_sp_in + if (present(K_Fe_phaeo_in) ) K_Fe_phaeo = K_Fe_phaeo_in + if (present(f_don_protein_in) ) f_don_protein = f_don_protein_in + if (present(kn_bac_protein_in) ) kn_bac_protein = kn_bac_protein_in + if (present(f_don_Am_protein_in) ) f_don_Am_protein = f_don_Am_protein_in + if (present(f_doc_s_in) ) f_doc_s = f_doc_s_in + if (present(f_doc_l_in) ) f_doc_l = f_doc_l_in + if (present(f_exude_s_in) ) f_exude_s = f_exude_s_in + if (present(f_exude_l_in) ) f_exude_l = f_exude_l_in + if (present(k_bac_s_in) ) k_bac_s = k_bac_s_in + if (present(k_bac_l_in) ) k_bac_l = k_bac_l_in + if (present(algaltype_diatoms_in) ) algaltype_diatoms = algaltype_diatoms_in + if (present(algaltype_sp_in) ) algaltype_sp = algaltype_sp_in + if (present(algaltype_phaeo_in) ) algaltype_phaeo = algaltype_phaeo_in + if (present(nitratetype_in) ) nitratetype = nitratetype_in + if (present(ammoniumtype_in) ) ammoniumtype = ammoniumtype_in + if (present(silicatetype_in) ) silicatetype = silicatetype_in + if (present(dmspptype_in) ) dmspptype = dmspptype_in + if (present(dmspdtype_in) ) dmspdtype = dmspdtype_in + if (present(humtype_in) ) humtype = humtype_in + if (present(doctype_s_in) ) doctype_s = doctype_s_in + if (present(doctype_l_in) ) doctype_l = doctype_l_in + if (present(dictype_1_in) ) dictype_1 = dictype_1_in + if (present(dontype_protein_in) ) dontype_protein = dontype_protein_in + if (present(fedtype_1_in) ) fedtype_1 = fedtype_1_in + if (present(feptype_1_in) ) feptype_1 = feptype_1_in + if (present(zaerotype_bc1_in) ) zaerotype_bc1 = zaerotype_bc1_in + if (present(zaerotype_bc2_in) ) zaerotype_bc2 = zaerotype_bc2_in + if (present(zaerotype_dust1_in) ) zaerotype_dust1 = zaerotype_dust1_in + if (present(zaerotype_dust2_in) ) zaerotype_dust2 = zaerotype_dust2_in + if (present(zaerotype_dust3_in) ) zaerotype_dust3 = zaerotype_dust3_in + if (present(zaerotype_dust4_in) ) zaerotype_dust4 = zaerotype_dust4_in + if (present(ratio_C2N_diatoms_in) ) ratio_C2N_diatoms = ratio_C2N_diatoms_in + if (present(ratio_C2N_sp_in) ) ratio_C2N_sp = ratio_C2N_sp_in + if (present(ratio_C2N_phaeo_in) ) ratio_C2N_phaeo = ratio_C2N_phaeo_in + if (present(ratio_chl2N_diatoms_in)) ratio_chl2N_diatoms = ratio_chl2N_diatoms_in + if (present(ratio_chl2N_sp_in) ) ratio_chl2N_sp = ratio_chl2N_sp_in + if (present(ratio_chl2N_phaeo_in) ) ratio_chl2N_phaeo = ratio_chl2N_phaeo_in + if (present(F_abs_chl_diatoms_in) ) F_abs_chl_diatoms = F_abs_chl_diatoms_in + if (present(F_abs_chl_sp_in) ) F_abs_chl_sp = F_abs_chl_sp_in + if (present(F_abs_chl_phaeo_in) ) F_abs_chl_phaeo = F_abs_chl_phaeo_in + if (present(ratio_C2N_proteins_in) ) ratio_C2N_proteins = ratio_C2N_proteins_in if (present(fr_resp_in) ) fr_resp = fr_resp_in if (present(algal_vel_in) ) algal_vel = algal_vel_in if (present(R_dFe2dust_in) ) R_dFe2dust = R_dFe2dust_in @@ -1137,7 +1528,6 @@ subroutine icepack_init_parameters( & if (present(y_sk_DMS_in) ) y_sk_DMS = y_sk_DMS_in if (present(t_sk_conv_in) ) t_sk_conv = t_sk_conv_in if (present(t_sk_ox_in) ) t_sk_ox = t_sk_ox_in - if (present(frazil_scav_in) ) frazil_scav = frazil_scav_in if (present(sw_redist_in) ) sw_redist = sw_redist_in if (present(sw_frac_in) ) sw_frac = sw_frac_in if (present(sw_dtemp_in) ) sw_dtemp = sw_dtemp_in @@ -1178,7 +1568,7 @@ subroutine icepack_query_parameters( & zref_out, hs_min_out, snowpatch_out, rhosi_out, sk_l_out, & saltmax_out, phi_init_out, min_salin_out, salt_loss_out, & Tliquidus_max_out, & - min_bgc_out, dSin0_frazil_out, hi_ssl_out, hs_ssl_out, & + min_bgc_out, dSin0_frazil_out, hi_ssl_out, hs_ssl_out, hs_ssl_min_out, & awtvdr_out, awtidr_out, awtvdf_out, awtidf_out, cpl_frazil_out, & qqqice_out, TTTice_out, qqqocn_out, TTTocn_out, update_ocn_f_out, & Lfresh_out, cprho_out, Cp_out, ustar_min_out, hi_min_out, a_rapid_mode_out, & @@ -1188,15 +1578,16 @@ subroutine icepack_query_parameters( & albedo_type_out, albicev_out, albicei_out, albsnowv_out, & albsnowi_out, ahmax_out, R_ice_out, R_pnd_out, R_snw_out, dT_mlt_out, & rsnw_mlt_out, dEdd_algae_out, & - kalg_out, kstrength_out, krdg_partic_out, krdg_redist_out, mu_rdg_out, & + kalg_out, R_gC2molC_out, kstrength_out, krdg_partic_out, krdg_redist_out, mu_rdg_out, & atmbndy_out, calc_strair_out, formdrag_out, highfreq_out, natmiter_out, & atmiter_conv_out, calc_dragio_out, & tfrz_option_out, kitd_out, kcatbound_out, hs0_out, frzpnd_out, & - saltflux_option_out, & + saltflux_option_out, congel_freeze_out, & floeshape_out, wave_spec_out, wave_spec_type_out, nfreq_out, & dpscale_out, rfracmin_out, rfracmax_out, pndaspect_out, hs1_out, hp1_out, & bgc_flux_type_out, z_tracers_out, scale_bgc_out, solve_zbgc_out, & - modal_aero_out, skl_bgc_out, solve_zsal_out, grid_o_out, l_sk_out, & + modal_aero_out, use_macromolecules_out, restartbgc_out, use_atm_dust_iron_out, & + skl_bgc_out, solve_zsal_out, grid_o_out, l_sk_out, & initbio_frac_out, grid_oS_out, l_skS_out, & phi_snow_out, conserv_check_out, & fr_resp_out, algal_vel_out, R_dFe2dust_out, dustFe_sol_out, & @@ -1210,7 +1601,37 @@ subroutine icepack_query_parameters( & snwlvlfac_out, isnw_T_out, isnw_Tgrd_out, isnw_rhos_out, & snowage_rhos_out, snowage_Tgrd_out, snowage_T_out, & snowage_tau_out, snowage_kappa_out, snowage_drdt0_out, & - snw_aging_table_out, snw_ssp_table_out ) + snw_aging_table_out, snw_ssp_table_out, ratio_Si2N_diatoms_out, & + ratio_Si2N_sp_out, ratio_Si2N_phaeo_out, ratio_S2N_diatoms_out, & + ratio_S2N_sp_out, ratio_S2N_phaeo_out, ratio_Fe2C_diatoms_out, & + ratio_Fe2C_sp_out, ratio_Fe2C_phaeo_out, ratio_Fe2N_diatoms_out, & + ratio_Fe2N_sp_out, ratio_Fe2N_phaeo_out, ratio_Fe2DON_out, & + ratio_Fe2DOC_s_out, ratio_Fe2DOC_l_out, grid_o_t_out, tau_min_out, tau_max_out, & + chlabs_diatoms_out, chlabs_sp_out, chlabs_phaeo_out, alpha2max_low_diatoms_out, & + alpha2max_low_sp_out, alpha2max_low_phaeo_out, beta2max_diatoms_out, & + beta2max_sp_out, beta2max_phaeo_out, mu_max_diatoms_out, mu_max_sp_out, & + mu_max_phaeo_out, grow_Tdep_diatoms_out, grow_Tdep_sp_out, & + grow_Tdep_phaeo_out, fr_graze_diatoms_out, fr_graze_sp_out, & + fr_graze_phaeo_out, mort_pre_diatoms_out, mort_pre_sp_out, & + mort_pre_phaeo_out, mort_Tdep_diatoms_out, mort_Tdep_sp_out, & + mort_Tdep_phaeo_out, k_exude_diatoms_out, k_exude_sp_out, k_exude_phaeo_out, & + K_Nit_diatoms_out, K_Nit_sp_out, K_Nit_phaeo_out, & + K_Am_diatoms_out, K_Am_sp_out, K_Am_phaeo_out, & + K_Sil_diatoms_out, K_Sil_sp_out, K_Sil_phaeo_out, & + K_Fe_diatoms_out, K_Fe_sp_out, K_Fe_phaeo_out, & + f_don_protein_out, kn_bac_protein_out, f_don_Am_protein_out, & + f_doc_s_out, f_doc_l_out, f_exude_s_out, f_exude_l_out, & + k_bac_s_out, k_bac_l_out, algaltype_diatoms_out, & + algaltype_sp_out, algaltype_phaeo_out, nitratetype_out, & + ammoniumtype_out, silicatetype_out, dmspptype_out, & + dmspdtype_out, humtype_out, doctype_s_out, doctype_l_out, & + dictype_1_out, dontype_protein_out, fedtype_1_out, feptype_1_out, & + zaerotype_bc1_out, zaerotype_bc2_out, zaerotype_dust1_out, & + zaerotype_dust2_out, zaerotype_dust3_out, zaerotype_dust4_out, & + ratio_C2N_diatoms_out, ratio_C2N_sp_out, ratio_C2N_phaeo_out, & + ratio_chl2N_diatoms_out, ratio_chl2N_sp_out, ratio_chl2N_phaeo_out, & + F_abs_chl_diatoms_out, F_abs_chl_sp_out, F_abs_chl_phaeo_out, & + ratio_C2N_proteins_out ) !----------------------------------------------------------------- ! control settings @@ -1311,16 +1732,21 @@ subroutine icepack_query_parameters( & phi_i_mushy_out ! liquid fraction of congelation ice character(len=*), intent(out), optional :: & - tfrz_option_out ! form of ocean freezing temperature - ! 'minus1p8' = -1.8 C - ! 'constant' = Tocnfrz - ! 'linear_salt' = -depressT * sss - ! 'mushy' conforms with ktherm=2 + congel_freeze_out ! congelation computation + ! 'two-step' = original formulation + ! 'one-step' = Plante et al, The Cryosphere, 2024 + + character(len=*), intent(out), optional :: & + tfrz_option_out ! form of ocean freezing temperature + ! 'minus1p8' = -1.8 C + ! 'constant' = Tocnfrz + ! 'linear_salt' = -depressT * sss + ! 'mushy' conforms with ktherm=2 character(len=*), intent(out), optional :: & - saltflux_option_out ! Salt flux computation - ! 'constant' reference value of ice_ref_salinity - ! 'prognostic' prognostic salt flux + saltflux_option_out ! Salt flux computation + ! 'constant' reference value of ice_ref_salinity + ! 'prognostic' prognostic salt flux !----------------------------------------------------------------------- @@ -1334,7 +1760,8 @@ subroutine icepack_query_parameters( & stefan_boltzmann_out, & ! W/m^2/K^4 kappav_out, & ! vis extnctn coef in ice, wvlngth<700nm (1/m) hi_ssl_out, & ! ice surface scattering layer thickness (m) - hs_ssl_out, & ! visible, direct + hs_ssl_out, & ! snow surface scattering layer thickness (m) + hs_ssl_min_out, & ! minimum snow surface scattering layer thickness for aerosols (m) awtvdr_out, & ! visible, direct ! for history and awtidr_out, & ! near IR, direct ! diagnostics awtvdf_out, & ! visible, diffuse @@ -1361,7 +1788,8 @@ subroutine icepack_query_parameters( & dT_mlt_out , & ! change in temp for non-melt to melt snow grain ! radius change (C) rsnw_mlt_out , & ! maximum melting snow grain radius (10^-6 m) - kalg_out ! algae absorption coefficient for 0.5 m thick layer + kalg_out , & ! algae absorption coefficient for 0.5 m thick layer + R_gC2molC_out ! grams carbon per mol logical (kind=log_kind), intent(out), optional :: & sw_redist_out ! redistribute shortwave @@ -1448,7 +1876,7 @@ subroutine icepack_query_parameters( & nfreq_out ! number of frequencies real (kind=dbl_kind), intent(out), optional :: & - floeshape_out ! constant from Steele (unitless) + floeshape_out ! constant from Rothrock 1984 (unitless) logical (kind=log_kind), intent(out), optional :: & wave_spec_out ! if true, use wave forcing @@ -1470,6 +1898,10 @@ subroutine icepack_query_parameters( & solve_zbgc_out, & ! if .true., solve vertical biochemistry portion of code dEdd_algae_out, & ! if .true., algal absorptionof Shortwave is computed in the modal_aero_out, & ! if .true., use modal aerosol formulation in shortwave + use_macromolecules_out, & ! if .true., ocean DOC is already split + ! into polysaccharid, lipid and protein fractions + use_atm_dust_iron_out, & ! if .true., compute iron contribution from dust + restartbgc_out, & conserv_check_out ! if .true., run conservation checks and abort if checks fail logical (kind=log_kind), intent(out), optional :: & @@ -1479,12 +1911,112 @@ subroutine icepack_query_parameters( & real (kind=dbl_kind), intent(out), optional :: & grid_o_out , & ! for bottom flux l_sk_out , & ! characteristic diffusive scale (zsalinity) (m) + grid_o_t_out , & ! top grid point length scale initbio_frac_out, & ! fraction of ocean tracer concentration used to initialize tracer phi_snow_out ! snow porosity at the ice/snow interface real (kind=dbl_kind), intent(out), optional :: & grid_oS_out , & ! for bottom flux (zsalinity) l_skS_out ! 0.02 characteristic skeletal layer thickness (m) (zsalinity) + + real (kind=dbl_kind), intent(out), optional :: & + ratio_Si2N_diatoms_out, & ! algal Si to N (mol/mol) + ratio_Si2N_sp_out , & + ratio_Si2N_phaeo_out , & + ratio_S2N_diatoms_out , & ! algal S to N (mol/mol) + ratio_S2N_sp_out , & + ratio_S2N_phaeo_out , & + ratio_Fe2C_diatoms_out, & ! algal Fe to C (umol/mol) + ratio_Fe2C_sp_out , & + ratio_Fe2C_phaeo_out , & + ratio_Fe2N_diatoms_out, & ! algal Fe to N (umol/mol) + ratio_Fe2N_sp_out , & + ratio_Fe2N_phaeo_out , & + ratio_Fe2DON_out , & ! Fe to N of DON (nmol/umol) + ratio_Fe2DOC_s_out , & ! Fe to C of DOC (nmol/umol) saccharids + ratio_Fe2DOC_l_out , & ! Fe to C of DOC (nmol/umol) lipids + tau_min_out , & ! rapid mobile to stationary exchanges (s) = 1.5 hours + tau_max_out , & ! long time mobile to stationary exchanges (s) = 2 days + chlabs_diatoms_out , & ! chl absorption (1/m/(mg/m^3)) + chlabs_sp_out , & ! + chlabs_phaeo_out , & ! + alpha2max_low_diatoms_out , & ! light limitation (1/(W/m^2)) + alpha2max_low_sp_out , & + alpha2max_low_phaeo_out , & + beta2max_diatoms_out , & ! light inhibition (1/(W/m^2)) + beta2max_sp_out , & + beta2max_phaeo_out , & + mu_max_diatoms_out , & ! maximum growth rate (1/day) + mu_max_sp_out , & + mu_max_phaeo_out , & + grow_Tdep_diatoms_out, & ! Temperature dependence of growth (1/C) + grow_Tdep_sp_out , & + grow_Tdep_phaeo_out , & + fr_graze_diatoms_out , & ! Fraction grazed + fr_graze_sp_out , & + fr_graze_phaeo_out , & + mort_pre_diatoms_out , & ! Mortality (1/day) + mort_pre_sp_out , & + mort_pre_phaeo_out , & + mort_Tdep_diatoms_out, & ! T dependence of mortality (1/C) + mort_Tdep_sp_out , & + mort_Tdep_phaeo_out , & + k_exude_diatoms_out , & ! algal exudation (1/d) + k_exude_sp_out , & + k_exude_phaeo_out , & + K_Nit_diatoms_out , & ! nitrate half saturation (mmol/m^3) + K_Nit_sp_out , & + K_Nit_phaeo_out , & + K_Am_diatoms_out , & ! ammonium half saturation (mmol/m^3) + K_Am_sp_out , & + K_Am_phaeo_out , & + K_Sil_diatoms_out , & ! silicate half saturation (mmol/m^3) + K_Sil_sp_out , & + K_Sil_phaeo_out , & + K_Fe_diatoms_out , & ! iron half saturation (nM) + K_Fe_sp_out , & + K_Fe_phaeo_out , & + f_don_protein_out , & ! fraction of spilled grazing to proteins + kn_bac_protein_out , & ! Bacterial degredation of DON (1/d) + f_don_Am_protein_out , & ! fraction of remineralized DON to ammonium + f_doc_s_out , & ! fraction of mortality to DOC + f_doc_l_out , & + f_exude_s_out , & ! fraction of exudation to DOC + f_exude_l_out , & + k_bac_s_out , & ! Bacterial degredation of DOC (1/d) + k_bac_l_out , & + algaltype_diatoms_out , & ! mobility type + algaltype_sp_out , & ! + algaltype_phaeo_out , & ! + nitratetype_out , & ! + ammoniumtype_out , & ! + silicatetype_out , & ! + dmspptype_out , & ! + dmspdtype_out , & ! + humtype_out , & ! + doctype_s_out , & ! + doctype_l_out , & ! + dictype_1_out , & ! + dontype_protein_out , & ! + fedtype_1_out , & ! + feptype_1_out , & ! + zaerotype_bc1_out , & ! + zaerotype_bc2_out , & ! + zaerotype_dust1_out , & ! + zaerotype_dust2_out , & ! + zaerotype_dust3_out , & ! + zaerotype_dust4_out , & ! + ratio_C2N_diatoms_out , & ! algal C to N ratio (mol/mol) + ratio_C2N_sp_out , & ! + ratio_C2N_phaeo_out , & ! + ratio_chl2N_diatoms_out, & ! algal chlorophyll to N ratio (mg/mmol) + ratio_chl2N_sp_out , & ! + ratio_chl2N_phaeo_out , & ! + F_abs_chl_diatoms_out , & ! scales absorbed radiation for dEdd + F_abs_chl_sp_out , & ! + F_abs_chl_phaeo_out , & ! + ratio_C2N_proteins_out ! ratio of C to N in proteins (mol/mol) + real (kind=dbl_kind), intent(out), optional :: & fr_resp_out , & ! fraction of algal growth lost due to respiration algal_vel_out , & ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day @@ -1672,6 +2204,7 @@ subroutine icepack_query_parameters( & if (present(dSin0_frazil_out) ) dSin0_frazil_out = dSin0_frazil if (present(hi_ssl_out) ) hi_ssl_out = hi_ssl if (present(hs_ssl_out) ) hs_ssl_out = hs_ssl + if (present(hs_ssl_min_out) ) hs_ssl_min_out = hs_ssl_min if (present(awtvdr_out) ) awtvdr_out = awtvdr if (present(awtidr_out) ) awtidr_out = awtidr if (present(awtvdf_out) ) awtvdf_out = awtvdf @@ -1709,6 +2242,7 @@ subroutine icepack_query_parameters( & if (present(dT_mlt_out) ) dT_mlt_out = dT_mlt if (present(rsnw_mlt_out) ) rsnw_mlt_out = rsnw_mlt if (present(kalg_out) ) kalg_out = kalg + if (present(R_gC2molC_out) ) R_gC2molC_out = R_gC2molC if (present(kstrength_out) ) kstrength_out = kstrength if (present(krdg_partic_out) ) krdg_partic_out = krdg_partic if (present(krdg_redist_out) ) krdg_redist_out = krdg_redist @@ -1719,6 +2253,7 @@ subroutine icepack_query_parameters( & if (present(highfreq_out) ) highfreq_out = highfreq if (present(natmiter_out) ) natmiter_out = natmiter if (present(atmiter_conv_out) ) atmiter_conv_out = atmiter_conv + if (present(congel_freeze_out) ) congel_freeze_out = congel_freeze if (present(tfrz_option_out) ) tfrz_option_out = tfrz_option if (present(saltflux_option_out) ) saltflux_option_out = saltflux_option if (present(kitd_out) ) kitd_out = kitd @@ -1763,15 +2298,116 @@ subroutine icepack_query_parameters( & if (present(solve_zbgc_out) ) solve_zbgc_out = solve_zbgc if (present(dEdd_algae_out) ) dEdd_algae_out = dEdd_algae if (present(modal_aero_out) ) modal_aero_out = modal_aero + if (present(use_macromolecules_out)) use_macromolecules_out = use_macromolecules + if (present(use_atm_dust_iron_out) ) use_atm_dust_iron_out = use_atm_dust_iron + if (present(restartbgc_out) ) restartbgc_out= restartbgc if (present(conserv_check_out) ) conserv_check_out= conserv_check if (present(skl_bgc_out) ) skl_bgc_out = skl_bgc if (present(solve_zsal_out) ) solve_zsal_out = solve_zsal if (present(grid_o_out) ) grid_o_out = grid_o if (present(l_sk_out) ) l_sk_out = l_sk if (present(initbio_frac_out) ) initbio_frac_out = initbio_frac + if (present(frazil_scav_out) ) frazil_scav_out = frazil_scav if (present(grid_oS_out) ) grid_oS_out = grid_oS if (present(l_skS_out) ) l_skS_out = l_skS + if (present(grid_o_t_out) ) grid_o_t_out = grid_o_t if (present(phi_snow_out) ) phi_snow_out = phi_snow + if (present(ratio_Si2N_diatoms_out) ) ratio_Si2N_diatoms_out = ratio_Si2N_diatoms + if (present(ratio_Si2N_sp_out) ) ratio_Si2N_sp_out = ratio_Si2N_sp + if (present(ratio_Si2N_phaeo_out) ) ratio_Si2N_phaeo_out = ratio_Si2N_phaeo + if (present(ratio_S2N_diatoms_out) ) ratio_S2N_diatoms_out = ratio_S2N_diatoms + if (present(ratio_S2N_sp_out) ) ratio_S2N_sp_out = ratio_S2N_sp + if (present(ratio_S2N_phaeo_out) ) ratio_S2N_phaeo_out = ratio_S2N_phaeo + if (present(ratio_Fe2C_diatoms_out) ) ratio_Fe2C_diatoms_out = ratio_Fe2C_diatoms + if (present(ratio_Fe2C_sp_out) ) ratio_Fe2C_sp_out = ratio_Fe2C_sp + if (present(ratio_Fe2C_phaeo_out) ) ratio_Fe2C_phaeo_out = ratio_Fe2C_phaeo + if (present(ratio_Fe2N_diatoms_out) ) ratio_Fe2N_diatoms_out = ratio_Fe2N_diatoms + if (present(ratio_Fe2N_sp_out) ) ratio_Fe2N_sp_out = ratio_Fe2N_sp + if (present(ratio_Fe2N_phaeo_out) ) ratio_Fe2N_phaeo_out = ratio_Fe2N_phaeo + if (present(ratio_Fe2DON_out) ) ratio_Fe2DON_out = ratio_Fe2DON + if (present(ratio_Fe2DOC_s_out) ) ratio_Fe2DOC_s_out = ratio_Fe2DOC_s + if (present(ratio_Fe2DOC_l_out) ) ratio_Fe2DOC_l_out = ratio_Fe2DOC_l + if (present(tau_min_out) ) tau_min_out = tau_min + if (present(tau_max_out) ) tau_max_out = tau_max + if (present(chlabs_diatoms_out) ) chlabs_diatoms_out = chlabs_diatoms + if (present(chlabs_sp_out) ) chlabs_sp_out = chlabs_sp + if (present(chlabs_phaeo_out) ) chlabs_phaeo_out = chlabs_phaeo + if (present(alpha2max_low_diatoms_out) ) alpha2max_low_diatoms_out = alpha2max_low_diatoms + if (present(alpha2max_low_sp_out) ) alpha2max_low_sp_out = alpha2max_low_sp + if (present(alpha2max_low_phaeo_out) ) alpha2max_low_phaeo_out = alpha2max_low_phaeo + if (present(beta2max_diatoms_out) ) beta2max_diatoms_out = beta2max_diatoms + if (present(beta2max_sp_out) ) beta2max_sp_out = beta2max_sp + if (present(beta2max_phaeo_out) ) beta2max_phaeo_out = beta2max_phaeo + if (present(mu_max_diatoms_out) ) mu_max_diatoms_out = mu_max_diatoms + if (present(mu_max_sp_out) ) mu_max_sp_out = mu_max_sp + if (present(mu_max_phaeo_out) ) mu_max_phaeo_out = mu_max_phaeo + if (present(grow_Tdep_diatoms_out) ) grow_Tdep_diatoms_out = grow_Tdep_diatoms + if (present(grow_Tdep_sp_out) ) grow_Tdep_sp_out = grow_Tdep_sp + if (present(grow_Tdep_phaeo_out) ) grow_Tdep_phaeo_out = grow_Tdep_phaeo + if (present(fr_graze_diatoms_out) ) fr_graze_diatoms_out = fr_graze_diatoms + if (present(fr_graze_sp_out) ) fr_graze_sp_out = fr_graze_sp + if (present(fr_graze_phaeo_out) ) fr_graze_phaeo_out = fr_graze_phaeo + if (present(mort_pre_diatoms_out) ) mort_pre_diatoms_out = mort_pre_diatoms + if (present(mort_pre_sp_out) ) mort_pre_sp_out = mort_pre_sp + if (present(mort_pre_phaeo_out) ) mort_pre_phaeo_out = mort_pre_phaeo + if (present(mort_Tdep_diatoms_out) ) mort_Tdep_diatoms_out = mort_Tdep_diatoms + if (present(mort_Tdep_sp_out) ) mort_Tdep_sp_out = mort_Tdep_sp + if (present(mort_Tdep_phaeo_out) ) mort_Tdep_phaeo_out = mort_Tdep_phaeo + if (present(k_exude_diatoms_out) ) k_exude_diatoms_out = k_exude_diatoms + if (present(k_exude_sp_out) ) k_exude_sp_out = k_exude_sp + if (present(k_exude_phaeo_out) ) k_exude_phaeo_out = k_exude_phaeo + if (present(K_Nit_diatoms_out) ) K_Nit_diatoms_out = K_Nit_diatoms + if (present(K_Nit_sp_out) ) K_Nit_sp_out = K_Nit_sp + if (present(K_Nit_phaeo_out) ) K_Nit_phaeo_out = K_Nit_phaeo + if (present(K_Am_diatoms_out) ) K_Am_diatoms_out = K_Am_diatoms + if (present(K_Am_sp_out) ) K_Am_sp_out = K_Am_sp + if (present(K_Am_phaeo_out) ) K_Am_phaeo_out = K_Am_phaeo + if (present(K_Sil_diatoms_out) ) K_Sil_diatoms_out = K_Sil_diatoms + if (present(K_Sil_sp_out) ) K_Sil_sp_out = K_Sil_sp + if (present(K_Sil_phaeo_out) ) K_Sil_phaeo_out = K_Sil_phaeo + if (present(K_Fe_diatoms_out) ) K_Fe_diatoms_out = K_Fe_diatoms + if (present(K_Fe_sp_out) ) K_Fe_sp_out = K_Fe_sp + if (present(K_Fe_phaeo_out) ) K_Fe_phaeo_out = K_Fe_phaeo + if (present(f_don_protein_out) ) f_don_protein_out = f_don_protein + if (present(kn_bac_protein_out) ) kn_bac_protein_out = kn_bac_protein + if (present(f_don_Am_protein_out) ) f_don_Am_protein_out = f_don_Am_protein + if (present(f_doc_s_out) ) f_doc_s_out = f_doc_s + if (present(f_doc_l_out) ) f_doc_l_out = f_doc_l + if (present(f_exude_s_out) ) f_exude_s_out = f_exude_s + if (present(f_exude_l_out) ) f_exude_l_out = f_exude_l + if (present(k_bac_s_out) ) k_bac_s_out = k_bac_s + if (present(k_bac_l_out) ) k_bac_l_out = k_bac_l + if (present(algaltype_diatoms_out) ) algaltype_diatoms_out = algaltype_diatoms + if (present(algaltype_sp_out) ) algaltype_sp_out = algaltype_sp + if (present(algaltype_phaeo_out) ) algaltype_phaeo_out = algaltype_phaeo + if (present(nitratetype_out) ) nitratetype_out = nitratetype + if (present(ammoniumtype_out) ) ammoniumtype_out = ammoniumtype + if (present(silicatetype_out) ) silicatetype_out = silicatetype + if (present(dmspptype_out) ) dmspptype_out = dmspptype + if (present(dmspdtype_out) ) dmspdtype_out = dmspdtype + if (present(humtype_out) ) humtype_out = humtype + if (present(doctype_s_out) ) doctype_s_out = doctype_s + if (present(doctype_l_out) ) doctype_l_out = doctype_l + if (present(dictype_1_out) ) dictype_1_out = dictype_1 + if (present(dontype_protein_out) ) dontype_protein_out = dontype_protein + if (present(fedtype_1_out) ) fedtype_1_out = fedtype_1 + if (present(feptype_1_out) ) feptype_1_out = feptype_1 + if (present(zaerotype_bc1_out) ) zaerotype_bc1_out = zaerotype_bc1 + if (present(zaerotype_bc2_out) ) zaerotype_bc2_out = zaerotype_bc2 + if (present(zaerotype_dust1_out) ) zaerotype_dust1_out = zaerotype_dust1 + if (present(zaerotype_dust2_out) ) zaerotype_dust2_out = zaerotype_dust2 + if (present(zaerotype_dust3_out) ) zaerotype_dust3_out = zaerotype_dust3 + if (present(zaerotype_dust4_out) ) zaerotype_dust4_out = zaerotype_dust4 + if (present(ratio_C2N_diatoms_out) ) ratio_C2N_diatoms_out = ratio_C2N_diatoms + if (present(ratio_C2N_sp_out) ) ratio_C2N_sp_out = ratio_C2N_sp + if (present(ratio_C2N_phaeo_out) ) ratio_C2N_phaeo_out = ratio_C2N_phaeo + if (present(ratio_chl2N_diatoms_out)) ratio_chl2N_diatoms_out = ratio_chl2N_diatoms + if (present(ratio_chl2N_sp_out) ) ratio_chl2N_sp_out = ratio_chl2N_sp + if (present(ratio_chl2N_phaeo_out) ) ratio_chl2N_phaeo_out = ratio_chl2N_phaeo + if (present(F_abs_chl_diatoms_out) ) F_abs_chl_diatoms_out = F_abs_chl_diatoms + if (present(F_abs_chl_sp_out) ) F_abs_chl_sp_out = F_abs_chl_sp + if (present(F_abs_chl_phaeo_out) ) F_abs_chl_phaeo_out = F_abs_chl_phaeo + if (present(ratio_C2N_proteins_out) ) ratio_C2N_proteins_out = ratio_C2N_proteins if (present(fr_resp_out) ) fr_resp_out = fr_resp if (present(algal_vel_out) ) algal_vel_out = algal_vel if (present(R_dFe2dust_out) ) R_dFe2dust_out = R_dFe2dust @@ -1791,7 +2427,6 @@ subroutine icepack_query_parameters( & if (present(y_sk_DMS_out) ) y_sk_DMS_out = y_sk_DMS if (present(t_sk_conv_out) ) t_sk_conv_out = t_sk_conv if (present(t_sk_ox_out) ) t_sk_ox_out = t_sk_ox - if (present(frazil_scav_out) ) frazil_scav_out = frazil_scav if (present(Lfresh_out) ) Lfresh_out = Lfresh if (present(cprho_out) ) cprho_out = cprho if (present(Cp_out) ) Cp_out = Cp @@ -1799,9 +2434,6 @@ subroutine icepack_query_parameters( & if (present(sw_frac_out) ) sw_frac_out = sw_frac if (present(sw_dtemp_out) ) sw_dtemp_out = sw_dtemp - call icepack_recompute_constants() - if (icepack_warnings_aborted(subname)) return - end subroutine icepack_query_parameters !======================================================================= @@ -1871,6 +2503,7 @@ subroutine icepack_write_parameters(iounit) write(iounit,*) " dSin0_frazil = ",dSin0_frazil write(iounit,*) " hi_ssl = ",hi_ssl write(iounit,*) " hs_ssl = ",hs_ssl + write(iounit,*) " hs_ssl_min = ",hs_ssl_min write(iounit,*) " awtvdr = ",awtvdr write(iounit,*) " awtidr = ",awtidr write(iounit,*) " awtvdf = ",awtvdf @@ -1919,6 +2552,7 @@ subroutine icepack_write_parameters(iounit) write(iounit,*) " dT_mlt = ", dT_mlt write(iounit,*) " rsnw_mlt = ", rsnw_mlt write(iounit,*) " kalg = ", kalg + write(iounit,*) " R_gC2molC = ", R_gC2molC write(iounit,*) " kstrength = ", kstrength write(iounit,*) " krdg_partic= ", krdg_partic write(iounit,*) " krdg_redist= ", krdg_redist @@ -1929,6 +2563,7 @@ subroutine icepack_write_parameters(iounit) write(iounit,*) " highfreq = ", highfreq write(iounit,*) " natmiter = ", natmiter write(iounit,*) " atmiter_conv = ", atmiter_conv + write(iounit,*) " congel_freeze = ", trim(congel_freeze) write(iounit,*) " tfrz_option= ", trim(tfrz_option) write(iounit,*) " saltflux_option = ", trim(saltflux_option) write(iounit,*) " kitd = ", kitd @@ -1973,15 +2608,117 @@ subroutine icepack_write_parameters(iounit) write(iounit,*) " solve_zbgc = ", solve_zbgc write(iounit,*) " dEdd_algae = ", dEdd_algae write(iounit,*) " modal_aero = ", modal_aero + write(iounit,*) " use_macromolecules = ", use_macromolecules + write(iounit,*) " use_atm_dust_iron = ", use_atm_dust_iron + write(iounit,*) " restartbgc = ", restartbgc write(iounit,*) " conserv_check = ", conserv_check write(iounit,*) " skl_bgc = ", skl_bgc write(iounit,*) " solve_zsal = ", solve_zsal write(iounit,*) " grid_o = ", grid_o write(iounit,*) " l_sk = ", l_sk + write(iounit,*) " grid_o_t = ", grid_o_t write(iounit,*) " initbio_frac = ", initbio_frac + write(iounit,*) " frazil_scav= ", frazil_scav write(iounit,*) " grid_oS = ", grid_oS write(iounit,*) " l_skS = ", l_skS write(iounit,*) " phi_snow = ", phi_snow + + write(iounit,*) " ratio_Si2N_diatoms = ", ratio_Si2N_diatoms + write(iounit,*) " ratio_Si2N_sp = ", ratio_Si2N_sp + write(iounit,*) " ratio_Si2N_phaeo = ", ratio_Si2N_phaeo + write(iounit,*) " ratio_S2N_diatoms = ", ratio_S2N_diatoms + write(iounit,*) " ratio_S2N_sp = ", ratio_S2N_sp + write(iounit,*) " ratio_S2N_phaeo = ", ratio_S2N_phaeo + write(iounit,*) " ratio_Fe2C_diatoms = ", ratio_Fe2C_diatoms + write(iounit,*) " ratio_Fe2C_sp = ", ratio_Fe2C_sp + write(iounit,*) " ratio_Fe2C_phaeo = ", ratio_Fe2C_phaeo + write(iounit,*) " ratio_Fe2N_diatoms = ", ratio_Fe2N_diatoms + write(iounit,*) " ratio_Fe2N_sp = ", ratio_Fe2N_sp + write(iounit,*) " ratio_Fe2N_phaeo = ", ratio_Fe2N_phaeo + write(iounit,*) " ratio_Fe2DON = ", ratio_Fe2DON + write(iounit,*) " ratio_Fe2DOC_s = ", ratio_Fe2DOC_s + write(iounit,*) " ratio_Fe2DOC_l = ", ratio_Fe2DOC_l + write(iounit,*) " tau_min = ", tau_min + write(iounit,*) " tau_max = ", tau_max + write(iounit,*) " chlabs_diatoms = ", chlabs_diatoms + write(iounit,*) " chlabs_sp = ", chlabs_sp + write(iounit,*) " chlabs_phaeo = ", chlabs_phaeo + write(iounit,*) " alpha2max_low_diatoms = ", alpha2max_low_diatoms + write(iounit,*) " alpha2max_low_sp = ", alpha2max_low_sp + write(iounit,*) " alpha2max_low_phaeo = ", alpha2max_low_phaeo + write(iounit,*) " beta2max_diatoms = ", beta2max_diatoms + write(iounit,*) " beta2max_sp = ", beta2max_sp + write(iounit,*) " beta2max_phaeo = ", beta2max_phaeo + write(iounit,*) " mu_max_diatoms = ", mu_max_diatoms + write(iounit,*) " mu_max_sp = ", mu_max_sp + write(iounit,*) " mu_max_phaeo = ", mu_max_phaeo + write(iounit,*) " grow_Tdep_diatoms = ", grow_Tdep_diatoms + write(iounit,*) " grow_Tdep_sp = ", grow_Tdep_sp + write(iounit,*) " grow_Tdep_phaeo = ", grow_Tdep_phaeo + write(iounit,*) " fr_graze_diatoms = ", fr_graze_diatoms + write(iounit,*) " fr_graze_sp = ", fr_graze_sp + write(iounit,*) " fr_graze_phaeo = ", fr_graze_phaeo + write(iounit,*) " mort_pre_diatoms = ", mort_pre_diatoms + write(iounit,*) " mort_pre_sp = ", mort_pre_sp + write(iounit,*) " mort_pre_phaeo = ", mort_pre_phaeo + write(iounit,*) " mort_Tdep_diatoms = ", mort_Tdep_diatoms + write(iounit,*) " mort_Tdep_sp = ", mort_Tdep_sp + write(iounit,*) " mort_Tdep_phaeo = ", mort_Tdep_phaeo + write(iounit,*) " k_exude_diatoms = ", k_exude_diatoms + write(iounit,*) " k_exude_sp = ", k_exude_sp + write(iounit,*) " k_exude_phaeo = ", k_exude_phaeo + write(iounit,*) " K_Nit_diatoms = ", K_Nit_diatoms + write(iounit,*) " K_Nit_sp = ", K_Nit_sp + write(iounit,*) " K_Nit_phaeo = ", K_Nit_phaeo + write(iounit,*) " K_Am_diatoms = ", K_Am_diatoms + write(iounit,*) " K_Am_sp = ", K_Am_sp + write(iounit,*) " K_Am_phaeo = ", K_Am_phaeo + write(iounit,*) " K_Sil_diatoms = ", K_Sil_diatoms + write(iounit,*) " K_Sil_sp = ", K_Sil_sp + write(iounit,*) " K_Sil_phaeo = ", K_Sil_phaeo + write(iounit,*) " K_Fe_diatoms = ", K_Fe_diatoms + write(iounit,*) " K_Fe_sp = ", K_Fe_sp + write(iounit,*) " K_Fe_phaeo = ", K_Fe_phaeo + write(iounit,*) " f_don_protein = ", f_don_protein + write(iounit,*) " kn_bac_protein = ", kn_bac_protein + write(iounit,*) " f_don_Am_protein = ", f_don_Am_protein + write(iounit,*) " f_doc_s = ", f_doc_s + write(iounit,*) " f_doc_l = ", f_doc_l + write(iounit,*) " f_exude_s = ", f_exude_s + write(iounit,*) " f_exude_l = ", f_exude_l + write(iounit,*) " k_bac_s = ", k_bac_s + write(iounit,*) " k_bac_l = ", k_bac_l + write(iounit,*) " algaltype_diatoms = ", algaltype_diatoms + write(iounit,*) " algaltype_sp = ", algaltype_sp + write(iounit,*) " algaltype_phaeo = ", algaltype_phaeo + write(iounit,*) " nitratetype = ", nitratetype + write(iounit,*) " ammoniumtype = ", ammoniumtype + write(iounit,*) " silicatetype = ", silicatetype + write(iounit,*) " dmspptype = ", dmspptype + write(iounit,*) " dmspdtype = ", dmspdtype + write(iounit,*) " humtype = ", humtype + write(iounit,*) " doctype_s = ", doctype_s + write(iounit,*) " doctype_l = ", doctype_l + write(iounit,*) " dictype_1 = ", dictype_1 + write(iounit,*) " dontype_protein = ", dontype_protein + write(iounit,*) " fedtype_1 = ", fedtype_1 + write(iounit,*) " feptype_1 = ", feptype_1 + write(iounit,*) " zaerotype_bc1 = ", zaerotype_bc1 + write(iounit,*) " zaerotype_bc2 = ", zaerotype_bc2 + write(iounit,*) " zaerotype_dust1 = ", zaerotype_dust1 + write(iounit,*) " zaerotype_dust2 = ", zaerotype_dust2 + write(iounit,*) " zaerotype_dust3 = ", zaerotype_dust3 + write(iounit,*) " zaerotype_dust4 = ", zaerotype_dust4 + write(iounit,*) " ratio_C2N_diatoms = ", ratio_C2N_diatoms + write(iounit,*) " ratio_C2N_sp = ", ratio_C2N_sp + write(iounit,*) " ratio_C2N_phaeo = ", ratio_C2N_phaeo + write(iounit,*) " ratio_chl2N_diatoms = ", ratio_chl2N_diatoms + write(iounit,*) " ratio_chl2N_sp = ", ratio_chl2N_sp + write(iounit,*) " ratio_chl2N_phaeo = ", ratio_chl2N_phaeo + write(iounit,*) " F_abs_chl_diatoms = ", F_abs_chl_diatoms + write(iounit,*) " F_abs_chl_sp = ", F_abs_chl_sp + write(iounit,*) " F_abs_chl_phaeo = ", F_abs_chl_phaeo + write(iounit,*) " ratio_C2N_proteins = ", ratio_C2N_proteins write(iounit,*) " fr_resp = ", fr_resp write(iounit,*) " algal_vel = ", algal_vel write(iounit,*) " R_dFe2dust = ", R_dFe2dust @@ -2001,7 +2738,6 @@ subroutine icepack_write_parameters(iounit) write(iounit,*) " y_sk_DMS = ", y_sk_DMS write(iounit,*) " t_sk_conv = ", t_sk_conv write(iounit,*) " t_sk_ox = ", t_sk_ox - write(iounit,*) " frazil_scav= ", frazil_scav write(iounit,*) " sw_redist = ", sw_redist write(iounit,*) " sw_frac = ", sw_frac write(iounit,*) " sw_dtemp = ", sw_dtemp diff --git a/columnphysics/icepack_shortwave.F90 b/columnphysics/icepack_shortwave.F90 index f6c1a7223..7a3e5a4e5 100644 --- a/columnphysics/icepack_shortwave.F90 +++ b/columnphysics/icepack_shortwave.F90 @@ -62,9 +62,9 @@ module icepack_shortwave use icepack_tracers, only: tr_zaero, nlt_chl_sw, nlt_zaero_sw use icepack_tracers, only: n_algae, n_aero, n_zaero use icepack_tracers, only: nmodal1, nmodal2, max_aero - use icepack_shortwave_data, only: nspint_3bd, nspint_5bd + use icepack_shortwave_data, only: nspint_3bd, nspint_5bd, rsnw_datatype use icepack_zbgc_shared,only: R_chl2N, F_abs_chl - use icepack_zbgc_shared,only: remap_zbgc + use icepack_zbgc_shared,only: remap_zbgc, igrid, swgrid use icepack_orbital, only: compute_coszen use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -101,9 +101,8 @@ module icepack_shortwave gaer_5bd, kaer_5bd, waer_5bd use icepack_shortwave_data, only: & nmbrad_snicar , & ! number of snow grain radii in SNICAR SSP tables - rsnw_snicar_min, & ! minimum snow radius - integer value used for indexing - rsnw_snicar_max ! maximum snow radius - integer value used for indexing - use icepack_shortwave_data, only: & + rsnw_snicar_min, & ! minimum snow radius + rsnw_snicar_max, & ! maximum snow radius ssp_snwextdr, ssp_snwalbdr, ssp_sasymmdr, & ssp_snwextdf, ssp_snwalbdf, ssp_sasymmdf, & rsnw_snicar_tab @@ -1845,7 +1844,7 @@ subroutine compute_dEdd_3bd( & delr , & ! snow grain radius interpolation parameter ! inherent optical properties (iop) for snow Qs , & ! Snow extinction efficiency - ks , & ! Snow mass extinction coefficient (m^2/kg) ! echmod - CHECK units and usage + ks , & ! Snow mass extinction coefficient (1/m) ws , & ! Snow single scattering albedo gs ! Snow asymmetry parameter @@ -2135,7 +2134,7 @@ subroutine compute_dEdd_3bd( & ! Cheng: note that aerosol IOPs are related to snow grain radius. ! CICE adjusted snow grain radius rsnw to frsnw in the original 3-band ! scheme, while for SNICAR the snow grain radius is used directly. - ksnow = k - min(k-1,0) + ksnow = max(k,1) tmp_gs = frsnw(ksnow) ! grain size index @@ -2268,7 +2267,7 @@ subroutine compute_dEdd_3bd( & do k = 0, nslyr ! use top rsnw, rhosnw for snow ssl and rest of top layer - ksnow = k - min(k-1,0) + ksnow = max(k,1) ! find snow iops using input snow density and snow grain radius: if (frsnw(ksnow) < rsnw_tab(1)) then Qs = Qs_tab(ns,1) @@ -2279,20 +2278,16 @@ subroutine compute_dEdd_3bd( & ws = ws_tab(ns,nmbrad_snw) gs = gs_tab(ns,nmbrad_snw) else - ! linear interpolation in rsnw - do nr = 2, nmbrad_snw - if (rsnw_tab(nr-1) <= frsnw(ksnow) .and. & - frsnw(ksnow) < rsnw_tab(nr)) then - delr = (frsnw(ksnow) - rsnw_tab(nr-1)) / & - (rsnw_tab(nr) - rsnw_tab(nr-1)) - Qs = Qs_tab(ns,nr-1)*(c1-delr) + & - Qs_tab(ns,nr )* delr - ws = ws_tab(ns,nr-1)*(c1-delr) + & - ws_tab(ns,nr )* delr - gs = gs_tab(ns,nr-1)*(c1-delr) + & - gs_tab(ns,nr )* delr - endif - enddo ! nr + call shortwave_search(frsnw(ksnow),rsnw_tab,nr) + if (icepack_warnings_aborted(subname)) return + delr = (frsnw(ksnow) - rsnw_tab(nr-1)) / & + (rsnw_tab(nr) - rsnw_tab(nr-1)) + Qs = Qs_tab(ns,nr-1)*(c1-delr) + & + Qs_tab(ns,nr )* delr + ws = ws_tab(ns,nr-1)*(c1-delr) + & + ws_tab(ns,nr )* delr + gs = gs_tab(ns,nr-1)*(c1-delr) + & + gs_tab(ns,nr )* delr endif ks = Qs*((rhosnw(ksnow)/rhoi)*3._dbl_kind / & (4._dbl_kind*frsnw(ksnow)*1.0e-6_dbl_kind)) @@ -3497,9 +3492,10 @@ subroutine compute_shortwave_trcr(bgcN, zaero, & do k = 1,nilyr+1 icegrid(k) = sw_grid(k) enddo - if (sw_grid(1)*hin*c2 > hi_ssl) then + if (sw_grid(1)*hin*c2 > hi_ssl .and. hin > puny) then icegrid(1) = hi_ssl/c2/hin endif + icegrid(2) = c2*sw_grid(1) + (sw_grid(2) - sw_grid(1)) if (z_tracers) then if (tr_bgc_N) then @@ -3709,7 +3705,6 @@ end subroutine icepack_prep_radiation ! Elizabeth C. Hunke, LANL subroutine icepack_step_radiation (dt, & - swgrid, igrid, & fbri, & aicen, vicen, & vsnon, Tsfcn, & @@ -3771,12 +3766,6 @@ subroutine icepack_step_radiation (dt, & real (kind=dbl_kind), intent(inout) :: & coszen ! cosine solar zenith angle, < 0 for sun below horizon - real (kind=dbl_kind), dimension (:), intent(in) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (:), intent(in) :: & - swgrid ! grid for ice tracers used in dEdd scheme - real (kind=dbl_kind), dimension(:), intent(in) :: & aicen , & ! ice area fraction in each category vicen , & ! ice volume in each category (m) @@ -4513,7 +4502,7 @@ subroutine compute_dEdd_5bd( & ! copy/point to table data for local names asm_prm_ice_drc => ssp_sasymmdr asm_prm_ice_dfs => ssp_sasymmdf - ss_alb_ice_drc => ssp_snwalbdr + ss_alb_ice_drc => ssp_snwalbdr ss_alb_ice_dfs => ssp_snwalbdf ext_cff_mss_ice_drc => ssp_snwextdr ext_cff_mss_ice_dfs => ssp_snwextdf @@ -4677,7 +4666,7 @@ subroutine compute_dEdd_5bd( & ! CICE adjusted snow grain radius rsnw to frsnw, while for ! SNICAR there is no need, the tmp_gs is therefore calculated ! differently from code in subroutine compute_dEdd - ksnow = k - min(k-1,0) + ksnow = max(k,1) tmp_gs = rsnw(ksnow) ! use rsnw not frsnw ! grain size index @@ -4806,7 +4795,7 @@ subroutine compute_dEdd_5bd( & if (nsky == 1) then ! direct incident do k = 0, nslyr ! use top rsnw, rhosnw for snow ssl and rest of top layer - ksnow = k - min(k-1,0) + ksnow = max(k,1) if (rsnw(ksnow) <= rsnw_snicar_min) then ks = ext_cff_mss_ice_drc(ns,1) ws = ss_alb_ice_drc (ns,1) @@ -4815,16 +4804,18 @@ subroutine compute_dEdd_5bd( & ks = ext_cff_mss_ice_drc(ns,nmbrad_snicar) ws = ss_alb_ice_drc (ns,nmbrad_snicar) gs = asm_prm_ice_drc (ns,nmbrad_snicar) - elseif (ceiling(rsnw(ksnow)) - rsnw(ksnow) < 1.0e-3_dbl_kind) then - ! radius = 30 --> nr = 1 in SNICAR table ! NOTE - nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30 - ks = ext_cff_mss_ice_drc(ns,nr) - ws = ss_alb_ice_drc (ns,nr) - gs = asm_prm_ice_drc (ns,nr) - else ! linear interpolation in rsnw - nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30 - delr = (rsnw(ksnow) - floor(rsnw(ksnow))) & ! hardwired delta radius = 1 in table - / (ceiling(rsnw(ksnow)) - floor(rsnw(ksnow))) ! denom always = 1 + else + ! linear interpolation + if (trim(rsnw_datatype) == 'sorted_idelta1') then + ! NOTE: Assumes delta rsnw_snicar_tab is 1 and rsnw_snicar_tab are integers + ! This is just for performance, could call shortwave_search + nr = ceiling(rsnw(ksnow)) - nint(rsnw_snicar_min) + 1 + else + call shortwave_search(rsnw(ksnow),rsnw_snicar_tab,nr) + if (icepack_warnings_aborted(subname)) return + endif + delr = (rsnw(ksnow) - rsnw_snicar_tab(nr-1)) & + / (rsnw_snicar_tab(nr) - rsnw_snicar_tab(nr-1)) ks = ext_cff_mss_ice_drc(ns,nr-1)*(c1-delr) & + ext_cff_mss_ice_drc(ns,nr )* delr ws = ss_alb_ice_drc (ns,nr-1)*(c1-delr) & @@ -4839,7 +4830,7 @@ subroutine compute_dEdd_5bd( & elseif (nsky == 2) then ! diffuse incident do k = 0, nslyr ! use top rsnw, rhosnw for snow ssl and rest of top layer - ksnow = k - min(k-1,0) + ksnow = max(k,1) if (rsnw(ksnow) < rsnw_snicar_min) then ks = ext_cff_mss_ice_dfs(ns,1) ws = ss_alb_ice_dfs (ns,1) @@ -4848,16 +4839,18 @@ subroutine compute_dEdd_5bd( & ks = ext_cff_mss_ice_dfs(ns,nmbrad_snicar) ws = ss_alb_ice_dfs (ns,nmbrad_snicar) gs = asm_prm_ice_dfs (ns,nmbrad_snicar) - elseif (ceiling(rsnw(ksnow)) - rsnw(ksnow) < 1.0e-3_dbl_kind) then - ! radius = 30 --> nr = 1 in SNICAR table ! NOTE - nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30 - ks = ext_cff_mss_ice_dfs(ns,nr) - ws = ss_alb_ice_dfs (ns,nr) - gs = asm_prm_ice_dfs (ns,nr) - else ! linear interpolation in rsnw - nr = ceiling(rsnw(ksnow)) - 30 + 1 ! hardwired min radius = 30 - delr = (rsnw(ksnow) - floor(rsnw(ksnow))) & ! hardwired delta radius = 1 in table - / (ceiling(rsnw(ksnow)) - floor(rsnw(ksnow))) + else + ! linear interpolation + if (trim(rsnw_datatype) == 'sorted_idelta1') then + ! NOTE: delta rsnw_snicar_tab is 1 and rsnw_snicar_tab are integers + ! This is just for performance, could call shortwave_search + nr = ceiling(rsnw(ksnow)) - nint(rsnw_snicar_min) + 1 + else + call shortwave_search(rsnw(ksnow),rsnw_snicar_tab,nr) + if (icepack_warnings_aborted(subname)) return + endif + delr = (rsnw(ksnow) - rsnw_snicar_tab(nr-1)) & + / (rsnw_snicar_tab(nr) - rsnw_snicar_tab(nr-1)) ks = ext_cff_mss_ice_dfs(ns,nr-1)*(c1-delr) & + ext_cff_mss_ice_dfs(ns,nr )* delr ws = ss_alb_ice_dfs (ns,nr-1)*(c1-delr) & @@ -5400,6 +5393,110 @@ subroutine compute_dEdd_5bd( & end subroutine compute_dEdd_5bd +!======================================================================= +! This subroutine searches array for val and returns nr such that +! array(nr-1) < val <= array(nr) +! If nr cannot be found, an error is thrown +! This does NOT check that array is sorted because it would be too expensive, +! but it must be sorted to work properly. + + subroutine shortwave_search(val,array,nr) + + real (kind=dbl_kind), intent(in) :: & + val ! search value + + real (kind=dbl_kind), dimension (:), intent(in) :: & + array ! sorted array + + integer (kind=int_kind), intent(out) :: & + nr ! index in array >= val + + ! local variables + + integer (kind=int_kind) :: & + nrcnt, & ! counter + nrp, & ! prior nr + nrl, nru, & ! lower and upper search indices + nrsize ! size of array + + logical (kind=log_kind) :: & + found ! search flag + + character (len=512) :: & + tmpstr ! temporary string + + character(len=*),parameter :: subname='(shortwave_search)' + + + if (rsnw_datatype(1:6) /= 'sorted') then + call icepack_warnings_add(subname//' rsnw_datatype not valid: '//trim(rsnw_datatype)) + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + + nrsize = size(array) + +!debug write(tmpstr,*) "val = ",val +! call icepack_warnings_add(subname//trim(tmpstr)) +! write(tmpstr,*) "nrsize = ",nrsize +! call icepack_warnings_add(subname//trim(tmpstr)) +! write(tmpstr,*) "array1 = ",array(1) +! call icepack_warnings_add(subname//trim(tmpstr)) +! write(tmpstr,*) "arrayn = ",array(nrsize) +! call icepack_warnings_add(subname//trim(tmpstr)) + + if (nrsize > 10) then + ! binary search + nrl = 1 + nru = nrsize + nr = (nrl + nru) / 2 + found = .false. + nrcnt = 0 + do while (.not.found .and. nrcnt < nrsize) + nrcnt = nrcnt + 1 + nrp = nr + if (val > array(nr)) then + if (val < array(nr+1)) then + found = .true. + nr = nr + 1 + else + nrl = nr + 1 + nr = (nrl + nru) / 2 + endif + else + if (val > array(nr-1)) then + found = .true. + else + nru = nr - 1 + nr = (nrl + nru) / 2 + endif + endif +!debug write(tmpstr,*) "iter = ",nrcnt,nrp,nr +! call icepack_warnings_add(subname//trim(tmpstr)) +! call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + enddo + if (.not. found) then + call icepack_warnings_add(subname//' ERROR: binary search failed') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + else + ! linear search + nr = -1 + do nrcnt = 2,nrsize + if (val > array(nrcnt-1) .and. val < array(nrcnt)) then + nr = nrcnt + exit + endif + enddo + if (nr < 1) then + call icepack_warnings_add(subname//' ERROR: linear search failed') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + endif + + end subroutine shortwave_search + !======================================================================= end module icepack_shortwave diff --git a/columnphysics/icepack_shortwave_data.F90 b/columnphysics/icepack_shortwave_data.F90 index d37df293d..fb41c415c 100644 --- a/columnphysics/icepack_shortwave_data.F90 +++ b/columnphysics/icepack_shortwave_data.F90 @@ -15,6 +15,9 @@ module icepack_shortwave_data nspint_3bd = 3, & ! number of solar spectral bands nspint_5bd = 5 ! number of solar spectral bands (snicar snow) + character (len=char_len), public :: & + rsnw_datatype = 'unknown' + ! dEdd 3-band data real (kind=dbl_kind), dimension (nspint_3bd), public :: & ! inherent optical properties (iop) @@ -63,7 +66,9 @@ module icepack_shortwave_data ! dEdd 5-band data SSP SNICAR integer (kind=int_kind), public :: & - nmbrad_snicar , & ! number of snow grain radii in SNICAR SSP tables + nmbrad_snicar ! number of snow grain radii in SNICAR SSP tables + + real (kind=dbl_kind), public :: & rsnw_snicar_min, & ! minimum snow radius - integer value used for indexing rsnw_snicar_max ! maximum snow radius - integer value used for indexing @@ -107,6 +112,7 @@ subroutine icepack_shortwave_init_dEdd3band allocate(gs_tab (nspint_3bd,nmbrad_snw)) ! snow grain radii (micro-meters) for table + rsnw_datatype = 'sorted' rsnw_tab = (/ & ! snow grain radius for each table entry (micro-meters) 5._dbl_kind, 7._dbl_kind, 10._dbl_kind, 15._dbl_kind, & 20._dbl_kind, 30._dbl_kind, 40._dbl_kind, 50._dbl_kind, & @@ -442,14 +448,6 @@ subroutine icepack_shortwave_init_dEdd5band character (len=*),parameter :: subname='(icepack_shortwave_init_dEdd5band)' - ! 5-bands ice surface scattering layer (ssl) iops to match SNICAR calculations - ! note by Cheng Dang: - ! for now these data are not needed since the sea ice layer IOPs can be directly - ! assigned based on the 3 bands data after adjustment based on tuning parameter R_ice - ! In the future, when 5-band sea ice IOPs are available, these data shall be updated - ! and the sea ice layer IOPs shall be calculated based on updated 5band iops* -!echmod - the comment above says these are not needed but they are nevertheless used below - ! ! The 5band data given in this section are based on CICE and SNICAR band choice: ! SNICAR band 1 = CICE band 1 ! SNICAR band 2 + SNICAR band 3 = CICE band 2 @@ -646,6 +644,7 @@ subroutine icepack_shortwave_init_snicartest() 6._dbl_kind, 37._dbl_kind, 221._dbl_kind, 600._dbl_kind, 1340._dbl_kind/) rsnw_snicar_min = rsnw_snicar_tab(1) ! minimum snow radius - integer value used for indexing rsnw_snicar_max = rsnw_snicar_tab(nmbrad_snicar) ! maximum snow radius - integer value used for indexing + rsnw_datatype = 'sorted' allocate(ssp_snwextdr(nspint_5bd,nmbrad_snicar)) ! extinction coefficient, direct allocate(ssp_snwextdf(nspint_5bd,nmbrad_snicar)) ! extinction coefficient, diffuse @@ -711,11 +710,12 @@ end subroutine icepack_shortwave_init_snicartest subroutine icepack_shortwave_init_snicar() -! USE_SNICARHC turns on big hardcoded tables but also increases compile time -#ifndef USE_SNICARHC +! NO_SNICARHC turns off hardcoded tables to reduce compile time +#ifdef NO_SNICARHC character(len=*),parameter :: subname='(icepack_shortwave_init_snicar)' + call icepack_warnings_add(subname//' ERROR: large shortwave snicar tables not compiled') + call icepack_warnings_add(subname//' ERROR: NO_SNICARHC CPP should be turned off') call icepack_warnings_setabort(.true.,__FILE__,__LINE__) - call icepack_warnings_add(subname//' ERROR: USE_SNICARHC CPP required') return #else integer (kind=int_kind) :: & @@ -9585,11 +9585,11 @@ subroutine icepack_shortwave_init_snicar() ! Copy to local variables -!echmod - this might not be needed - rsnw_snicar_min = 30 ! minimum snow grain radius - rsnw_snicar_max = 1500 ! maximum snow grain radius + rsnw_snicar_min = 30._dbl_kind ! minimum snow grain radius + rsnw_snicar_max = 1500._dbl_kind ! maximum snow grain radius + rsnw_datatype = 'sorted_idelta1' ! sorted "integers" with constant delta 1 allocate(rsnw_snicar_tab(nmbrad_snicar)) - rsnw_snicar_tab(1) = real(rsnw_snicar_min,dbl_kind) + rsnw_snicar_tab(1) = rsnw_snicar_min do n = 1, nmbrad_snicar-1 rsnw_snicar_tab(n+1) = rsnw_snicar_tab(n) + 1.0_dbl_kind enddo diff --git a/columnphysics/icepack_snow.F90 b/columnphysics/icepack_snow.F90 index 8def9b45f..3987d2922 100644 --- a/columnphysics/icepack_snow.F90 +++ b/columnphysics/icepack_snow.F90 @@ -17,6 +17,7 @@ module icepack_snow use icepack_parameters, only: snowage_rhos, snowage_Tgrd, snowage_T use icepack_parameters, only: snowage_tau, snowage_kappa, snowage_drdt0 use icepack_parameters, only: snw_aging_table, use_smliq_pnd + use icepack_tracers, only: ncat, nilyr, nslyr use icepack_therm_shared, only: icepack_ice_temperature use icepack_therm_shared, only: adjust_enthalpy @@ -240,8 +241,7 @@ end subroutine icepack_init_snow ! authors: Elizabeth C. Hunke, LANL ! Nicole Jeffery, LANL - subroutine icepack_step_snow(dt, nilyr, & - nslyr, ncat, & + subroutine icepack_step_snow(dt, & wind, aice, & aicen, vicen, & vsnon, Tsfc, & @@ -253,11 +253,6 @@ subroutine icepack_step_snow(dt, nilyr, & fresh, fhocn, & fsloss, fsnow) - integer (kind=int_kind), intent(in) :: & - nslyr, & ! number of snow layers - nilyr, & ! number of ice layers - ncat ! number of thickness categories - real (kind=dbl_kind), intent(in) :: & dt , & ! time step wind , & ! wind speed (m/s) @@ -329,7 +324,6 @@ subroutine icepack_step_snow(dt, nilyr, & if (snwredist(1:3) == 'ITD' .and. aice > puny) then call snow_redist(dt, & - nslyr, ncat, & wind, aicen(:), & vicen(:), vsnon(:), & zqsn(:,:), & @@ -368,8 +362,7 @@ subroutine icepack_step_snow(dt, nilyr, & endif enddo - call update_snow_radius (dt, ncat, & - nslyr, nilyr, & + call update_snow_radius (dt, & rsnw, hin, & Tsfc, zTin1, & hsn, zqsn, & @@ -397,13 +390,9 @@ end subroutine icepack_step_snow ! volume, mass and energy include factor of ain ! thickness does not - subroutine snow_redist(dt, nslyr, ncat, wind, ain, vin, vsn, zqsn, & + subroutine snow_redist(dt, wind, ain, vin, vsn, zqsn, & alvl, vlvl, fresh, fhocn, fsloss, rhos_cmpn, fsnow) - integer (kind=int_kind), intent(in) :: & - nslyr , & ! number of snow layers - ncat ! number of thickness categories - real (kind=dbl_kind), intent(in) :: & dt , & ! time step (s) wind , & ! wind speed (m/s) @@ -682,13 +671,13 @@ subroutine snow_redist(dt, nslyr, ncat, wind, ain, vin, vsn, zqsn, & zs2(k+1) = zs2(k) + hslyr ! new layer depths (equal thickness) enddo - call adjust_enthalpy (nslyr, & - zs1(:), zs2(:), & - hslyr, hsn_new(n), & + call adjust_enthalpy (nslyr, & + zs1(:), zs2(:), & + hslyr , hsn_new(n), & zqsn(:,n)) if (icepack_warnings_aborted(subname)) return else - hsn_new(1) = hsn_new(1) + dhsn + hsn_new(n) = hsn_new(n) + dhsn endif ! nslyr > 1 endif ! |dhsn| > puny endif ! ain > puny @@ -824,14 +813,9 @@ end subroutine snow_redist ! Snow grain metamorphism - subroutine update_snow_radius (dt, ncat, nslyr, nilyr, rsnw, hin, & + subroutine update_snow_radius (dt, rsnw, hin, & Tsfc, zTin, hsn, zqsn, smice, smliq) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of categories - nslyr , & ! number of snow layers - nilyr ! number of ice layers - real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -871,7 +855,7 @@ subroutine update_snow_radius (dt, ncat, nslyr, nilyr, rsnw, hin, & !----------------------------------------------------------------- ! dry metamorphism !----------------------------------------------------------------- - call snow_dry_metamorph (nslyr, nilyr, dt, rsnw(:,n), & + call snow_dry_metamorph (dt, rsnw(:,n), & drsnw_dry, zqsn(:,n), Tsfc(n), & zTin(n), hsn(n), hin(n)) if (icepack_warnings_aborted(subname)) return @@ -902,7 +886,7 @@ end subroutine update_snow_radius ! Snow grain metamorphism - subroutine snow_dry_metamorph (nslyr,nilyr, dt, rsnw, drsnw_dry, zqsn, & + subroutine snow_dry_metamorph (dt, rsnw, drsnw_dry, zqsn, & Tsfc, zTin1, hsn, hin) ! Vapor redistribution: Method is to retrieve 3 best-fit parameters that @@ -918,10 +902,6 @@ subroutine snow_dry_metamorph (nslyr,nilyr, dt, rsnw, drsnw_dry, zqsn, & ! dr_fresh is the difference between the current and fresh snow states ! (r_current - r_fresh). - integer (kind=int_kind), intent(in) :: & - nslyr, & ! number of snow layers - nilyr ! number of ice layers - real (kind=dbl_kind), intent(in) :: & dt ! time step (s) @@ -1175,12 +1155,9 @@ end subroutine snowtable_check_dimension ! Conversions between ice mass, liquid water mass in snow - subroutine drain_snow (nslyr, vsnon, aicen, & + subroutine drain_snow (vsnon, aicen, & massice, massliq, meltsliq) - integer (kind=int_kind), intent(in) :: & - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & vsnon, & ! snow volume (m) aicen ! aice area fraction diff --git a/columnphysics/icepack_therm_bl99.F90 b/columnphysics/icepack_therm_bl99.F90 index 36ec12681..30c247ac7 100644 --- a/columnphysics/icepack_therm_bl99.F90 +++ b/columnphysics/icepack_therm_bl99.F90 @@ -16,6 +16,7 @@ module icepack_therm_bl99 use icepack_parameters, only: rhoi, rhos, hs_min, cp_ice, cp_ocn, depressT, Lfresh, ksno, kice use icepack_parameters, only: conduct, calc_Tsfc use icepack_parameters, only: sw_redist, sw_frac, sw_dtemp + use icepack_tracers, only: nilyr, nslyr use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -53,7 +54,6 @@ module icepack_therm_bl99 ! C. M. Bitz, UW subroutine temperature_changes (dt, & - nilyr, nslyr, & rhoa, flw, & potT, Qa, & shcoef, lhcoef, & @@ -69,10 +69,6 @@ subroutine temperature_changes (dt, & fcondtopn,fcondbot, & einit ) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -243,7 +239,6 @@ subroutine temperature_changes (dt, & !----------------------------------------------------------------- call conductivity (l_snow, & - nilyr, nslyr, & hilyr, hslyr, & zTin, kh, zSin) if (icepack_warnings_aborted(subname)) return @@ -405,7 +400,7 @@ subroutine temperature_changes (dt, & ! Compute elements of tridiagonal matrix. !----------------------------------------------------------------- - call get_matrix_elements_calc_Tsfc (nilyr, nslyr, & + call get_matrix_elements_calc_Tsfc ( & l_snow, l_cold, & Tsf, Tbot, & fsurfn, dfsurf_dT, & @@ -419,7 +414,7 @@ subroutine temperature_changes (dt, & else - call get_matrix_elements_know_Tsfc (nilyr, nslyr, & + call get_matrix_elements_know_Tsfc ( & l_snow, Tbot, & Tin_init, Tsn_init, & kh, Sswabs, & @@ -801,17 +796,12 @@ end subroutine temperature_changes ! C. M. Bitz, UW subroutine conductivity (l_snow, & - nilyr, nslyr, & hilyr, hslyr, & zTin, kh, zSin) logical (kind=log_kind), intent(in) :: & l_snow ! true if snow temperatures are computed - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & hilyr , & ! ice layer thickness (same for all ice layers) hslyr ! snow layer thickness (same for all snow layers) @@ -969,7 +959,7 @@ end subroutine surface_fluxes ! March 2004 by William H. Lipscomb for multiple snow layers ! April 2008 by E. C. Hunke, divided into two routines based on calc_Tsfc - subroutine get_matrix_elements_calc_Tsfc (nilyr, nslyr, & + subroutine get_matrix_elements_calc_Tsfc ( & l_snow, l_cold, & Tsf, Tbot, & fsurfn, dfsurf_dT, & @@ -980,10 +970,6 @@ subroutine get_matrix_elements_calc_Tsfc (nilyr, nslyr, & sbdiag, diag, & spdiag, rhs) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - logical (kind=log_kind), intent(in) :: & l_snow , & ! true if snow temperatures are computed l_cold ! true if surface temperature is computed @@ -1216,7 +1202,7 @@ end subroutine get_matrix_elements_calc_Tsfc ! March 2004 by William H. Lipscomb for multiple snow layers ! April 2008 by E. C. Hunke, divided into two routines based on calc_Tsfc - subroutine get_matrix_elements_know_Tsfc (nilyr, nslyr, & + subroutine get_matrix_elements_know_Tsfc ( & l_snow, Tbot, & Tin_init, Tsn_init, & kh, Sswabs, & @@ -1226,10 +1212,6 @@ subroutine get_matrix_elements_know_Tsfc (nilyr, nslyr, & spdiag, rhs, & fcondtopn) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - logical (kind=log_kind), intent(in) :: & l_snow ! true if snow temperatures are computed diff --git a/columnphysics/icepack_therm_itd.F90 b/columnphysics/icepack_therm_itd.F90 index b6048dbce..0fcc96738 100644 --- a/columnphysics/icepack_therm_itd.F90 +++ b/columnphysics/icepack_therm_itd.F90 @@ -20,10 +20,13 @@ module icepack_therm_itd use icepack_kinds + + use icepack_fsd, only: floe_rad_c, floe_binwidth + use icepack_parameters, only: c0, c1, c2, c3, c4, c6, c10 use icepack_parameters, only: p001, p1, p333, p5, p666, puny, bignum use icepack_parameters, only: rhos, rhoi, Lfresh, ice_ref_salinity - use icepack_parameters, only: phi_init, dsin0_frazil, hs_ssl, salt_loss + use icepack_parameters, only: phi_init, dsin0_frazil, salt_loss use icepack_parameters, only: Tliquidus_max use icepack_parameters, only: rhosi, conserv_check, rhosmin, snwredist use icepack_parameters, only: kitd, ktherm @@ -31,7 +34,7 @@ module icepack_therm_itd use icepack_parameters, only: cpl_frazil, update_ocn_f, saltflux_option use icepack_parameters, only: icepack_chkoptargflag - use icepack_tracers, only: ntrcr, nbtrcr + use icepack_tracers, only: ncat, nilyr, nslyr, nblyr, ntrcr, nbtrcr, nfsd use icepack_tracers, only: nt_qice, nt_qsno, nt_fbri, nt_sice use icepack_tracers, only: nt_apnd, nt_hpnd, nt_aero, nt_isosno, nt_isoice use icepack_tracers, only: nt_Tsfc, nt_iage, nt_FY, nt_fsd, nt_rhos, nt_sice @@ -52,6 +55,7 @@ module icepack_therm_itd use icepack_mushy_physics, only: liquidus_temperature_mush, icepack_enthalpy_mush use icepack_zbgc, only: add_new_ice_bgc use icepack_zbgc, only: lateral_melt_bgc + use icepack_zbgc_shared, only: bgrid, cgrid, igrid implicit none @@ -87,23 +91,15 @@ module icepack_therm_itd ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine linear_itd (ncat, hin_max, & - nilyr, nslyr, & - ntrcr, trcr_depend, & + subroutine linear_itd (hin_max, trcr_depend, & trcr_base, n_trcr_strata,& nt_strata, & - aicen_init, vicen_init, & - aicen, trcrn, & - vicen, vsnon, & - aice, aice0, & + aicen_init, vicen_init, & + aicen, trcrn, & + vicen, vsnon, & + aice, aice0, & fpond, Tf ) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nslyr , & ! number of snow layers - ntrcr ! number of tracers in use - real (kind=dbl_kind), dimension(0:ncat), intent(in) :: & hin_max ! category boundaries (m) @@ -318,7 +314,7 @@ subroutine linear_itd (ncat, hin_max, & write(warnstr,*) subname, & 'ITD Thermodynamics: hicen_init(n+1) <= hicen_init(n)' - call icepack_warnings_setabort(.true.) + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) call icepack_warnings_add(warnstr) endif @@ -579,8 +575,7 @@ subroutine linear_itd (ncat, hin_max, & enddo endif - call shift_ice (ntrcr, ncat, & - trcr_depend, & + call shift_ice (trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, & @@ -626,7 +621,7 @@ subroutine linear_itd (ncat, hin_max, & ! Update fractional ice area in each grid cell. !----------------------------------------------------------------- - call aggregate_area (ncat, aicen, aice, aice0) + call aggregate_area (aicen, aice, aice0) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -795,10 +790,7 @@ end subroutine fit_line ! ! author: A. K. Turner, LANL ! - subroutine update_vertical_tracers(nilyr, trc, h1, h2, trc0) - - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers + subroutine update_vertical_tracers(trc, h1, h2, trc0) real (kind=dbl_kind), dimension(:), intent(inout) :: & trc ! vertical tracer @@ -877,36 +869,19 @@ end subroutine update_vertical_tracers ! 2003: Modified by William H. Lipscomb and Elizabeth C. Hunke, LANL ! 2016 Lettie Roach, NIWA/VUW, added floe size dependence ! - subroutine lateral_melt (dt, ncat, & - nilyr, nslyr, & - n_aero, & - fpond, & + subroutine lateral_melt (dt, fpond, & fresh, fsalt, & fhocn, faero_ocn, & fiso_ocn, & - rside, meltl, & - fside, wlat, & + rsiden, meltl, & + wlat, & aicen, vicen, & vsnon, trcrn, & - flux_bio, & - nbtrcr, nblyr, & - nfsd, d_afsd_latm,& - floe_rad_c, floe_binwidth) + flux_bio, d_afsd_latm) real (kind=dbl_kind), intent(in) :: & dt ! time step (s) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nblyr , & ! number of bio layers - nslyr , & ! number of snow layers - n_aero , & ! number of aerosol tracers - nbtrcr ! number of bio tracers - - integer (kind=int_kind), intent(in), optional :: & - nfsd ! number of floe size categories - real (kind=dbl_kind), dimension (:), intent(inout) :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) @@ -915,15 +890,12 @@ subroutine lateral_melt (dt, ncat, & real (kind=dbl_kind), dimension (:,:), intent(inout) :: & trcrn ! tracer array - real (kind=dbl_kind), intent(in) :: & - rside ! fraction of ice that melts laterally + real (kind=dbl_kind), dimension (:), intent(in) :: & + rsiden ! fraction of ice that melts laterally real (kind=dbl_kind), intent(in), optional :: & wlat ! lateral melt rate (m/s) - real (kind=dbl_kind), intent(inout) :: & - fside ! lateral heat flux (W/m^2) - real (kind=dbl_kind), intent(inout) :: & fpond , & ! fresh water flux to ponds (kg/m^2/s) fresh , & ! fresh water flux to ocean (kg/m^2/s) @@ -940,10 +912,6 @@ subroutine lateral_melt (dt, ncat, & real (kind=dbl_kind), dimension(:), intent(inout), optional :: & fiso_ocn ! isotope flux to ocean (kg/m^2/s) - real (kind=dbl_kind), dimension (:), intent(in), optional :: & - floe_rad_c , & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) - real (kind=dbl_kind), dimension (:), intent(out), optional :: & d_afsd_latm ! change in fsd due to lateral melt (m) @@ -961,17 +929,13 @@ subroutine lateral_melt (dt, ncat, & dfsalt , & ! change in fsalt dvssl , & ! snow surface layer volume dvint , & ! snow interior layer - bin1_arealoss, tmp ! - - logical (kind=log_kind) :: & - flag ! .true. if there could be lateral melting + tmp real (kind=dbl_kind), dimension (ncat) :: & aicen_init, & ! initial area fraction vicen_init, & ! volume per unit area of ice (m) - G_radialn , & ! rate of lateral melt (m/s) - delta_an , & ! change in the ITD - rsiden ! delta_an/aicen + vsnon_init, & ! volume per unit area of snow (m) + G_radialn ! rate of lateral melt (m/s) real (kind=dbl_kind), dimension (:,:), allocatable :: & afsdn , & ! floe size distribution tracer @@ -991,22 +955,21 @@ subroutine lateral_melt (dt, ncat, & character(len=*), parameter :: subname='(lateral_melt)' - flag = .false. + if (tr_fsd) d_afsd_latm = c0 + + if (.not. any(rsiden(:) > c0)) return ! no lateral melt, get out now + dfhocn = c0 dfpond = c0 dfresh = c0 dfsalt = c0 dvssl = c0 dvint = c0 - bin1_arealoss = c0 - tmp = c0 - vicen_init = c0 - G_radialn = c0 - delta_an = c0 - rsiden = c0 + vicen_init(:) = vicen(:) + vsnon_init(:) = vsnon(:) if (tr_fsd) then - call icepack_cleanup_fsd (ncat, nfsd, trcrn(nt_fsd:nt_fsd+nfsd-1,:)) + call icepack_cleanup_fsd (trcrn(nt_fsd:nt_fsd+nfsd-1,:)) if (icepack_warnings_aborted(subname)) return allocate(afsdn(nfsd,ncat)) @@ -1020,216 +983,149 @@ subroutine lateral_melt (dt, ncat, & afsdn = trcrn(nt_fsd:nt_fsd+nfsd-1,:) afsdn_init = afsdn ! for diagnostics df_flx = c0 - d_afsd_latm = c0 f_flx = c0 end if - if (tr_fsd .and. wlat > puny) then - flag = .true. - - ! for FSD rside and fside not yet computed correctly, redo here - fside = c0 - do n = 1, ncat - - G_radialn(n) = -wlat ! negative - - if (any(afsdn(:,n) < c0)) then - write(warnstr,*) subname, 'lateral_melt B afsd < 0 ',n - call icepack_warnings_add(warnstr) - endif - - bin1_arealoss = -trcrn(nt_fsd+1-1,n) * aicen(n) * dt & - * G_radialn(n) / floe_binwidth(1) - - delta_an(n) = c0 - do k = 1, nfsd - delta_an(n) = delta_an(n) + ((c2/floe_rad_c(k))*aicen(n) & - * trcrn(nt_fsd+k-1,n)*G_radialn(n)*dt) ! delta_an < 0 - end do - - ! add negative area loss from fsd - delta_an(n) = delta_an(n) - bin1_arealoss - - if (delta_an(n) > c0) then - write(warnstr,*) subname, 'ERROR delta_an > 0 ',delta_an(n) - call icepack_warnings_add(warnstr) - endif - - ! following original code, not necessary for fsd - if (aicen(n) > c0) rsiden(n) = MIN(-delta_an(n)/aicen(n),c1) - - if (rsiden(n) < c0) then - write(warnstr,*) subname, 'ERROR rsiden < 0 ',rsiden(n) - call icepack_warnings_add(warnstr) - endif - - ! melting energy/unit area in each column, etot < 0 - etot = c0 - do k = 1, nslyr - etot = etot + trcrn(nt_qsno+k-1,n) * vsnon(n)/real(nslyr,kind=dbl_kind) - enddo - - do k = 1, nilyr - etot = etot + trcrn(nt_qice+k-1,n) * vicen(n)/real(nilyr,kind=dbl_kind) - enddo ! nilyr - - ! lateral heat flux, fside < 0 - fside = fside + rsiden(n)*etot/dt - - enddo ! ncat - - else if (rside > c0) then ! original, non-fsd implementation - - flag = .true. - rsiden(:) = rside ! initialize - - endif - - if (flag) then ! grid cells with lateral melting. - - do n = 1, ncat + do n = 1, ncat !----------------------------------------------------------------- ! Melt the ice and increment fluxes. !----------------------------------------------------------------- - ! fluxes to coupler - ! dfresh > 0, dfsalt > 0, dfpond > 0 + ! fluxes to coupler + ! dfresh > 0, dfsalt > 0, dfpond > 0 - dfresh = (rhoi*vicen(n) + rhos*vsnon(n)) * rsiden(n) / dt - if (saltflux_option == 'prognostic') then - sicen = c0 - do k=1,nilyr - sicen = sicen + trcrn(nt_sice+k-1,n) / real(nilyr,kind=dbl_kind) - enddo - dfsalt = rhoi*vicen(n)*sicen*p001 * rsiden(n) / dt - else - dfsalt = rhoi*vicen(n)*ice_ref_salinity*p001 * rsiden(n) / dt - endif - fresh = fresh + dfresh - fsalt = fsalt + dfsalt - - if (tr_pond_topo) then - dfpond = aicen(n)*trcrn(nt_apnd,n)*trcrn(nt_hpnd,n)*rsiden(n) - fpond = fpond - dfpond - endif - - ! history diagnostics - meltl = meltl + vicen(n)*rsiden(n) + dfresh = (rhoi*vicen(n) + rhos*vsnon(n)) * rsiden(n) / dt + if (saltflux_option == 'prognostic') then + sicen = c0 + do k=1,nilyr + sicen = sicen + trcrn(nt_sice+k-1,n) / real(nilyr,kind=dbl_kind) + enddo + dfsalt = rhoi*vicen(n)*sicen*p001 * rsiden(n) / dt + else + dfsalt = rhoi*vicen(n)*ice_ref_salinity*p001 * rsiden(n) / dt + endif + fresh = fresh + dfresh + fsalt = fsalt + dfsalt - ! state variables - vicen_init(n) = vicen(n) - aicen(n) = aicen(n) * (c1 - rsiden(n)) - vicen(n) = vicen(n) * (c1 - rsiden(n)) - vsnon(n) = vsnon(n) * (c1 - rsiden(n)) + if (tr_pond_topo) then + dfpond = aicen(n)*trcrn(nt_apnd,n)*trcrn(nt_hpnd,n)*rsiden(n) + fpond = fpond - dfpond + endif - ! floe size distribution - if (tr_fsd) then - if (rsiden(n) > puny) then - if (aicen(n) > puny) then + ! history diagnostics + meltl = meltl + vicen_init(n)*rsiden(n) - ! adaptive subtimestep - elapsed_t = c0 - afsd_tmp(:) = afsdn_init(:,n) - d_afsd_tmp(:) = c0 - nsubt = 0 + ! state variables + aicen(n) = aicen(n) * (c1 - rsiden(n)) + vicen(n) = vicen(n) * (c1 - rsiden(n)) + vsnon(n) = vsnon(n) * (c1 - rsiden(n)) - DO WHILE (elapsed_t.lt.dt) + ! floe size distribution + if (tr_fsd) then + if (rsiden(n) > puny) then + if (aicen(n) > puny) then - nsubt = nsubt + 1 - if (nsubt.gt.100) then - write(warnstr,*) subname, 'latm not converging' - call icepack_warnings_add(warnstr) - endif + ! adaptive subtimestep + elapsed_t = c0 + afsd_tmp(:) = afsdn_init(:,n) + d_afsd_tmp(:) = c0 + nsubt = 0 - ! finite differences - df_flx(:) = c0 - f_flx (:) = c0 - do k = 2, nfsd - f_flx(k) = G_radialn(n) * afsd_tmp(k) / floe_binwidth(k) - end do + DO WHILE (elapsed_t.lt.dt) - do k = 1, nfsd - df_flx(k) = f_flx(k+1) - f_flx(k) - end do + nsubt = nsubt + 1 + if (nsubt.gt.100) then + write(warnstr,*) subname, 'latm not converging' + call icepack_warnings_add(warnstr) + endif - if (abs(sum(df_flx(:))) > puny) then - write(warnstr,*) subname, 'sum(df_flx) /= 0' - call icepack_warnings_add(warnstr) - endif + ! finite differences + df_flx(:) = c0 + f_flx (:) = c0 + G_radialn(n) = -wlat + do k = 2, nfsd + f_flx(k) = G_radialn(n) * afsd_tmp(k) / floe_binwidth(k) + end do - ! this term ensures area conservation - tmp = SUM(afsd_tmp(:)/floe_rad_c(:)) + do k = 1, nfsd + df_flx(k) = f_flx(k+1) - f_flx(k) + end do - ! fsd tendency - do k = 1, nfsd - d_afsd_tmp(k) = -df_flx(k) + c2 * G_radialn(n) * afsd_tmp(k) & - * (c1/floe_rad_c(k) - tmp) - end do + if (abs(sum(df_flx(:))) > puny) then + write(warnstr,*) subname, 'sum(df_flx) /= 0' + call icepack_warnings_add(warnstr) + endif - ! timestep required for this - subdt = get_subdt_fsd(nfsd, afsd_tmp(:), d_afsd_tmp(:)) - subdt = MIN(subdt, dt) + ! this term ensures area conservation + tmp = SUM(afsd_tmp(:)/floe_rad_c(:)) - ! update fsd and elapsed time - afsd_tmp(:) = afsd_tmp(:) + subdt*d_afsd_tmp(:) - elapsed_t = elapsed_t + subdt + ! fsd tendency + do k = 1, nfsd + d_afsd_tmp(k) = -df_flx(k) + c2 * G_radialn(n) * afsd_tmp(k) & + * (c1/floe_rad_c(k) - tmp) + end do + ! timestep required for this + subdt = get_subdt_fsd(afsd_tmp(:), d_afsd_tmp(:)) + subdt = MIN(subdt, dt) - END DO + ! update fsd and elapsed time + afsd_tmp(:) = afsd_tmp(:) + subdt*d_afsd_tmp(:) + elapsed_t = elapsed_t + subdt - afsdn(:,n) = afsd_tmp(:) + END DO + afsdn(:,n) = afsd_tmp(:) - end if ! aicen - end if ! rside > 0, otherwise do nothing + end if ! aicen + end if ! rside > 0, otherwise do nothing - end if ! tr_fsd + end if ! tr_fsd - ! fluxes - do k = 1, nilyr - ! enthalpy tracers do not change (e/v constant) - ! heat flux to coupler for ice melt (dfhocn < 0) - dfhocn = trcrn(nt_qice+k-1,n)*rsiden(n) / dt & - * vicen(n)/real(nilyr,kind=dbl_kind) - fhocn = fhocn + dfhocn - enddo ! nilyr - - do k = 1, nslyr - ! heat flux to coupler for snow melt (dfhocn < 0) - dfhocn = trcrn(nt_qsno+k-1,n)*rsiden(n) / dt & - * vsnon(n)/real(nslyr,kind=dbl_kind) - fhocn = fhocn + dfhocn - enddo ! nslyr + ! fluxes + do k = 1, nilyr + ! enthalpy tracers do not change (e/v constant) + ! heat flux to coupler for ice melt (dfhocn < 0) + dfhocn = trcrn(nt_qice+k-1,n)*rsiden(n) / dt & + * vicen_init(n)/real(nilyr,kind=dbl_kind) + fhocn = fhocn + dfhocn + enddo ! nilyr - if (tr_aero) then - do k = 1, n_aero - faero_ocn(k) = faero_ocn(k) + (vsnon(n) & - *(trcrn(nt_aero +4*(k-1),n) & - + trcrn(nt_aero+1+4*(k-1),n)) & - + vicen(n) & - *(trcrn(nt_aero+2+4*(k-1),n) & - + trcrn(nt_aero+3+4*(k-1),n))) & - * rsiden(n) / dt - enddo ! k - endif ! tr_aero - - if (tr_iso) then - do k = 1, n_iso - fiso_ocn(k) = fiso_ocn(k) & - + (vsnon(n)*trcrn(nt_isosno+k-1,n) & - + vicen(n)*trcrn(nt_isoice+k-1,n)) & - * rside / dt - enddo ! k - endif ! tr_iso + do k = 1, nslyr + ! heat flux to coupler for snow melt (dfhocn < 0) + dfhocn = trcrn(nt_qsno+k-1,n)*rsiden(n) / dt & + * vsnon_init(n)/real(nslyr,kind=dbl_kind) + fhocn = fhocn + dfhocn + enddo ! nslyr + + if (tr_aero) then + do k = 1, n_aero + faero_ocn(k) = faero_ocn(k) & + + (vsnon_init(n) * (trcrn(nt_aero +4*(k-1),n) & + + trcrn(nt_aero+1+4*(k-1),n)) & + + vicen_init(n) * (trcrn(nt_aero+2+4*(k-1),n) & + + trcrn(nt_aero+3+4*(k-1),n))) & + * rsiden(n) / dt + enddo ! k + endif ! tr_aero + + if (tr_iso) then + do k = 1, n_iso + fiso_ocn(k) = fiso_ocn(k) & + + (vsnon_init(n)*trcrn(nt_isosno+k-1,n) & + + vicen_init(n)*trcrn(nt_isoice+k-1,n)) & + * rsiden(n) / dt + enddo ! k + endif ! tr_iso !----------------------------------------------------------------- ! Biogeochemistry !----------------------------------------------------------------- if (z_tracers) then ! snow tracers - dvssl = min(p5*vsnon(n)/real(nslyr,kind=dbl_kind), hs_ssl*aicen(n)) ! snow surface layer - dvint = vsnon(n) - dvssl ! snow interior + dvssl = p5*vsnon_init(n)/real(nslyr,kind=dbl_kind) ! snow surface layer + dvint = vsnon_init(n) - dvssl ! snow interior do k = 1, nbtrcr flux_bio(k) = flux_bio(k) & + (trcrn(bio_index(k)+nblyr+1,n)*dvssl & @@ -1242,38 +1138,35 @@ subroutine lateral_melt (dt, ncat, & if (z_tracers) & call lateral_melt_bgc(dt, & - ncat, nblyr, & - rside, vicen_init, & !echmod: use rsiden - trcrn, & - flux_bio, nbtrcr) + rsiden, vicen_init, & + trcrn, flux_bio) if (icepack_warnings_aborted(subname)) return - endif ! flag - if (tr_fsd) then + if (tr_fsd) then - trcrn(nt_fsd:nt_fsd+nfsd-1,:) = afsdn + trcrn(nt_fsd:nt_fsd+nfsd-1,:) = afsdn - call icepack_cleanup_fsd (ncat, nfsd, trcrn(nt_fsd:nt_fsd+nfsd-1,:) ) - if (icepack_warnings_aborted(subname)) return + call icepack_cleanup_fsd (trcrn(nt_fsd:nt_fsd+nfsd-1,:) ) + if (icepack_warnings_aborted(subname)) return - ! diagnostics - do k = 1, nfsd - d_afsd_latm(k) = c0 - do n = 1, ncat - d_afsd_latm(k) = d_afsd_latm(k) & - + afsdn(k,n)*aicen(n) - afsdn_init(k,n)*aicen_init(n) - end do - end do + ! diagnostics + do k = 1, nfsd + d_afsd_latm(k) = c0 + do n = 1, ncat + d_afsd_latm(k) = d_afsd_latm(k) & + + afsdn(k,n)*aicen(n) - afsdn_init(k,n)*aicen_init(n) + end do + end do - deallocate(afsdn) - deallocate(afsdn_init) - deallocate(df_flx) - deallocate(afsd_tmp) - deallocate(d_afsd_tmp) - deallocate(f_flx) + deallocate(afsdn) + deallocate(afsdn_init) + deallocate(df_flx) + deallocate(afsd_tmp) + deallocate(d_afsd_tmp) + deallocate(f_flx) - end if + end if end subroutine lateral_melt @@ -1298,13 +1191,10 @@ end subroutine lateral_melt ! Adrian Turner, LANL ! Lettie Roach, NIWA/VUW ! - subroutine add_new_ice (ncat, nilyr, & - nfsd, nblyr, & - n_aero, dt, & - ntrcr, nltrcr, & + subroutine add_new_ice (dt, & hin_max, ktherm, & aicen, trcrn, & - vicen, vsnon1, & + vicen, & aice0, aice, & frzmlt, frazil, & frz_onset, yday, & @@ -1312,8 +1202,7 @@ subroutine add_new_ice (ncat, nilyr, & Tf, sss, & salinz, phi_init, & dSin0_frazil, & - bgrid, cgrid, igrid, & - nbtrcr, flux_bio, & + flux_bio, & ocean_bio, & frazil_diag, & fiso_ocn, & @@ -1324,23 +1213,13 @@ subroutine add_new_ice (ncat, nilyr, & wavefreq, & dwavefreq, & d_afsd_latg, & - d_afsd_newi, & - floe_rad_c, floe_binwidth) + d_afsd_newi) use icepack_fsd, only: fsd_lateral_growth, fsd_add_new_ice integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nblyr , & ! number of bio layers - ntrcr , & ! number of tracers - nltrcr, & ! number of zbgc tracers - n_aero, & ! number of aerosol tracers ktherm ! type of thermodynamics (-1 none, 1 BL99, 2 mushy) - integer (kind=int_kind), intent(in), optional :: & - nfsd ! number of floe size categories - real (kind=dbl_kind), dimension(0:ncat), intent(in) :: & hin_max ! category boundaries (m) @@ -1349,8 +1228,7 @@ subroutine add_new_ice (ncat, nilyr, & aice , & ! total concentration of ice frzmlt, & ! freezing/melting potential (W/m^2) Tf , & ! freezing temperature (C) - sss , & ! sea surface salinity (ppt) - vsnon1 ! category 1 snow volume per ice area (m) + sss ! sea surface salinity (ppt) real (kind=dbl_kind), dimension (:), intent(inout) :: & aicen , & ! concentration of ice @@ -1381,17 +1259,6 @@ subroutine add_new_ice (ncat, nilyr, & dSin0_frazil ! initial frazil bulk salinity reduction from sss ! BGC - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bgrid ! biology nondimensional vertical grid points - - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: & - cgrid ! CICE vertical coordinate - - integer (kind=int_kind), intent(in) :: & - nbtrcr ! number of biology tracers real (kind=dbl_kind), dimension (:), intent(inout) :: & flux_bio ! tracer flux to ocean from biology (mmol/m^2/s) @@ -1420,10 +1287,6 @@ subroutine add_new_ice (ncat, nilyr, & wavefreq, & ! wave frequencies (s^-1) dwavefreq ! wave frequency bin widths (s^-1) - real (kind=dbl_kind), dimension (:), intent(in), optional :: & - floe_rad_c , & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) - real (kind=dbl_kind), dimension(:), intent(out), optional :: & ! change in thickness distribution (area) d_afsd_latg , & ! due to fsd lateral growth @@ -1531,7 +1394,7 @@ subroutine add_new_ice (ncat, nilyr, & if (tr_fsd) then allocate(afsdn(nfsd,ncat)) afsdn(:,:) = c0 - call icepack_cleanup_fsd (ncat, nfsd, trcrn(nt_fsd:nt_fsd+nfsd-1,:)) + call icepack_cleanup_fsd (trcrn(nt_fsd:nt_fsd+nfsd-1,:)) if (icepack_warnings_aborted(subname)) return endif @@ -1627,8 +1490,8 @@ subroutine add_new_ice (ncat, nilyr, & vi0tmp = fnew*dt / (rhoi*Lfresh) ! ocn/cpl assumes frazil volume is pure, fresh ice dfresh = -rhoi*(vi0new - vi0tmp)/dt frazil_diag = frazil - vi0tmp -! else -! do nothing - other correction options could be implemented in the future +! else +! do nothing - other correction options could be implemented in the future endif if (saltflux_option == 'prognostic') then @@ -1637,7 +1500,7 @@ subroutine add_new_ice (ncat, nilyr, & dfsalt = ice_ref_salinity*p001*dfresh endif fresh = fresh + dfresh - fsalt = fsalt + dfsalt + fsalt = fsalt + dfsalt endif !----------------------------------------------------------------- @@ -1649,15 +1512,33 @@ subroutine add_new_ice (ncat, nilyr, & if (tr_fsd) then ! lateral growth of existing ice ! calculate change in conc due to lateral growth ! update vi0new, without change to afsdn or aicen - call fsd_lateral_growth (ncat, nfsd, & - dt, aice, & + call fsd_lateral_growth(dt, aice, & aicen, vicen, & vi0new, frazil, & - floe_rad_c, afsdn, & + afsdn, & lead_area, latsurf_area, & G_radial, d_an_latg, & tot_latg) if (icepack_warnings_aborted(subname)) return + + ! volume added to each category from lateral growth + do n = 1, ncat + if (aicen(n) > puny) then + vin0new(n) = d_an_latg(n) * vicen(n)/aicen(n) + endif + end do + + ! check lateral growth doesn't exceed total growth + ! if it does, adjust it + if (SUM(vin0new)>vi0new) then + write(warnstr,*) subname,'lateral growth warning ',vi0new,SUM(vin0new) + call icepack_warnings_add(warnstr) + vin0new(:) = vin0new(:)*vi0new/SUM(vin0new) + end if + + vi0new = vi0new - SUM(vin0new) + frazil = frazil - SUM(vin0new) + endif ai0mod = aice0 @@ -1684,11 +1565,6 @@ subroutine add_new_ice (ncat, nilyr, & vi0new = c0 endif ! aice0 > puny - ! volume added to each category from lateral growth - do n = 1, ncat - if (aicen(n) > c0) vin0new(n) = d_an_latg(n) * vicen(n)/aicen(n) - end do - ! combine areal change from new ice growth and lateral growth d_an_newi(1) = ai0new d_an_tot(2:ncat) = d_an_latg(2:ncat) @@ -1769,11 +1645,11 @@ subroutine add_new_ice (ncat, nilyr, & vsurp = hsurp * aicen(n) ! note - save this above? vtmp = vicen(n) - vsurp ! vicen is the new volume if (vicen(n) > c0) then - call update_vertical_tracers(nilyr, & + call update_vertical_tracers( & trcrn(nt_qice:nt_qice+nilyr-1,n), & vtmp, vicen(n), qi0new) if (icepack_warnings_aborted(subname)) return - call update_vertical_tracers(nilyr, & + call update_vertical_tracers( & trcrn(nt_sice:nt_sice+nilyr-1,n), & vtmp, vicen(n), Si0new) if (icepack_warnings_aborted(subname)) return @@ -1810,7 +1686,6 @@ subroutine add_new_ice (ncat, nilyr, & ncats = 1 ! add new ice to category 1 by default if (tr_fsd) ncats = ncat ! add new ice laterally to all categories - do n = 1, ncats if (d_an_tot(n) > c0 .and. vin0new(n) > c0) then ! add ice to category n @@ -1833,10 +1708,9 @@ subroutine add_new_ice (ncat, nilyr, & if (tr_fsd) then ! evolve the floe size distribution ! both new frazil ice and lateral growth - call fsd_add_new_ice (ncat, n, nfsd, & + call fsd_add_new_ice (n, & dt, ai0new, & d_an_latg, d_an_newi, & - floe_rad_c, floe_binwidth, & G_radial, area2, & wave_sig_ht, & wave_spectrum, & @@ -1879,7 +1753,7 @@ subroutine add_new_ice (ncat, nilyr, & fiso_ocn(it) = fiso_ocn(it) & - frazil_conc*rhoi*vi0new/dt enddo - endif + endif ! if iso if (tr_lvl) then alvl = trcrn(nt_alvl,n) @@ -1898,7 +1772,7 @@ subroutine add_new_ice (ncat, nilyr, & trcrn(nt_apnd,n) * alvl*area1 / (trcrn(nt_alvl,n)*aicen(n)) endif endif - endif + endif ! vicen > 0 do k = 1, nilyr if (vicen(n) > c0) then @@ -1910,11 +1784,9 @@ subroutine add_new_ice (ncat, nilyr, & trcrn(nt_sice+k-1,n) = & (trcrn(nt_sice+k-1,n)*vice1 + Sprofile(k)*vin0new(n))/vicen(n) endif - enddo - - endif ! vi0new > 0 - - enddo ! ncats + enddo ! nilyr + endif ! vin0new > c0 + enddo ! n if (conserv_check) then @@ -1947,14 +1819,12 @@ subroutine add_new_ice (ncat, nilyr, & ! Biogeochemistry !----------------------------------------------------------------- if (tr_brine .or. nbtrcr > 0) then - call add_new_ice_bgc(dt, nblyr, & - ncat, nilyr, nltrcr, & - bgrid, cgrid, igrid, & + call add_new_ice_bgc(dt, ncats, & aicen_init, vicen_init, vi0_init, & - aicen, vicen, vsnon1, & - vi0new, ntrcr, trcrn, & - nbtrcr, sss, ocean_bio,& - flux_bio, hsurp) + aicen, vicen, vin0new, & + trcrn, & + ocean_bio, flux_bio, hsurp, & + d_an_tot) if (icepack_warnings_aborted(subname)) return endif @@ -1972,9 +1842,7 @@ end subroutine add_new_ice ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_step_therm2 (dt, ncat, nltrcr, & - nilyr, nslyr, & - hin_max, nblyr, & + subroutine icepack_step_therm2(dt, hin_max, & aicen, & vicen, vsnon, & aicen_init, vicen_init, & @@ -1985,40 +1853,28 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & nt_strata, & Tf, sss, & salinz, & - rside, meltl, & - fside, wlat, & + rsiden, meltl, & + wlat, & frzmlt, frazil, & frain, fpond, & fresh, fsalt, & fhocn, update_ocn_f, & - bgrid, cgrid, & - igrid, faero_ocn, & + faero_ocn, & first_ice, fzsal, & flux_bio, ocean_bio, & frazil_diag, & frz_onset, yday, & fiso_ocn, HDO_ocn, & H2_16O_ocn, H2_18O_ocn, & - nfsd, wave_sig_ht, & + wave_sig_ht, & wave_spectrum, & wavefreq, & dwavefreq, & d_afsd_latg, d_afsd_newi, & - d_afsd_latm, d_afsd_weld, & - floe_rad_c, floe_binwidth) + d_afsd_latm, d_afsd_weld) use icepack_parameters, only: icepack_init_parameters - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nltrcr , & ! number of zbgc tracers - nblyr , & ! number of bio layers - nilyr , & ! number of ice layers - nslyr ! number of snow layers - - integer (kind=int_kind), intent(in), optional :: & - nfsd ! number of floe size categories - logical (kind=log_kind), intent(in), optional :: & update_ocn_f ! if true, update fresh water and salt fluxes @@ -2029,7 +1885,6 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & dt , & ! time step Tf , & ! freezing temperature (C) sss , & ! sea surface salinity (ppt) - rside , & ! fraction of ice that melts laterally frzmlt ! freezing/melting potential (W/m^2) integer (kind=int_kind), dimension (:), intent(in) :: & @@ -2043,23 +1898,14 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & integer (kind=int_kind), dimension (:,:), intent(in) :: & nt_strata ! indices of underlying tracer layers - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bgrid ! biology nondimensional vertical grid points - - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: & - cgrid ! CICE vertical coordinate - real (kind=dbl_kind), dimension(:), intent(in) :: & + rsiden , & ! fraction of ice that melts laterally salinz , & ! initial salinity profile ocean_bio ! ocean concentration of biological tracer real (kind=dbl_kind), intent(inout) :: & aice , & ! sea ice concentration aice0 , & ! concentration of open water - fside , & ! lateral heat flux (W/m^2) frain , & ! rainfall rate (kg/m^2 s) fpond , & ! fresh water flux to ponds (kg/m^2/s) fresh , & ! fresh water flux to ocean (kg/m^2/s) @@ -2122,10 +1968,6 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & d_afsd_latm, & ! lateral melt d_afsd_weld ! welding - real (kind=dbl_kind), dimension (:), intent(in), optional :: & - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) - !autodocument_end ! local variables @@ -2154,8 +1996,7 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & endif endif if (tr_fsd) then - if (.not.(present(nfsd) .and. & - present(wlat) .and. & + if (.not.(present(wlat) .and. & present(wave_sig_ht) .and. & present(wave_spectrum) .and. & present(wavefreq) .and. & @@ -2163,9 +2004,7 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & present(d_afsd_latg) .and. & present(d_afsd_newi) .and. & present(d_afsd_latm) .and. & - present(d_afsd_weld) .and. & - present(floe_rad_c) .and. & - present(floe_binwidth))) then + present(d_afsd_weld))) then call icepack_warnings_add(subname//' error in FSD arguments, tr_fsd=T') call icepack_warnings_setabort(.true.,__FILE__,__LINE__) return @@ -2190,7 +2029,9 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & ! Compute fractional ice area in each grid cell. !----------------------------------------------------------------- - call aggregate_area (ncat, aicen, aice, aice0) + flux_bio(:) = c0 + + call aggregate_area (aicen, aice, aice0) if (icepack_warnings_aborted(subname)) return if (kitd == 1) then @@ -2201,9 +2042,8 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & if (aice > puny) then - call linear_itd (ncat, hin_max, & - nilyr, nslyr, & - ntrcr, trcr_depend, & + call linear_itd (hin_max, & + trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, & @@ -2230,22 +2070,18 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & ! identify ice-ocean cells - call add_new_ice (ncat, nilyr, & - nfsd, nblyr, & - n_aero, dt, & - ntrcr, nltrcr, & + call add_new_ice (dt, & hin_max, ktherm, & aicen, trcrn, & - vicen, vsnon(1), & + vicen, & aice0, aice, & frzmlt, frazil, & frz_onset, yday, & fresh, fsalt, & Tf, sss, & salinz, phi_init, & - dSin0_frazil, bgrid, & - cgrid, igrid, & - nbtrcr, flux_bio, & + dSin0_frazil, & + flux_bio, & ocean_bio, & frazil_diag, fiso_ocn, & HDO_ocn, H2_16O_ocn, & @@ -2253,8 +2089,7 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & wave_sig_ht, & wave_spectrum, & wavefreq, dwavefreq, & - d_afsd_latg, d_afsd_newi, & - floe_rad_c, floe_binwidth) + d_afsd_latg, d_afsd_newi) if (icepack_warnings_aborted(subname)) return @@ -2262,26 +2097,21 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & ! Melt ice laterally. !----------------------------------------------------------------- - call lateral_melt (dt, ncat, & - nilyr, nslyr, & - n_aero, fpond, & + call lateral_melt (dt, fpond, & fresh, fsalt, & fhocn, faero_ocn, & fiso_ocn, & - rside, meltl, & - fside, wlat, & + rsiden, meltl, & + wlat, & aicen, vicen, & vsnon, trcrn, & flux_bio, & - nbtrcr, nblyr, & - nfsd, d_afsd_latm, & - floe_rad_c,floe_binwidth) + d_afsd_latm) if (icepack_warnings_aborted(subname)) return ! Floe welding during freezing conditions if (tr_fsd) then - call fsd_weld_thermo (ncat, nfsd, & - dt, frzmlt, & + call fsd_weld_thermo (dt, frzmlt, & aicen, trcrn, & d_afsd_weld) if (icepack_warnings_aborted(subname)) return @@ -2293,7 +2123,6 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & ! thickness, and the other half decreases the area). !----------------------------------------------------------------- -!echmod: test this if (ncat==1) & call reduce_area (hin_max (0), & aicen (1), vicen (1), & @@ -2305,14 +2134,10 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & ! categories with very small areas. !----------------------------------------------------------------- - call cleanup_itd (dt, ntrcr, & - nilyr, nslyr, & - ncat, hin_max, & + call cleanup_itd (dt, hin_max, & aicen, trcrn(1:ntrcr,:), & vicen, vsnon, & aice0, aice, & - n_aero, & - nbtrcr, nblyr, & tr_aero, & tr_pond_topo, & first_ice, & diff --git a/columnphysics/icepack_therm_mushy.F90 b/columnphysics/icepack_therm_mushy.F90 index 2ec95cde0..00438e8de 100644 --- a/columnphysics/icepack_therm_mushy.F90 +++ b/columnphysics/icepack_therm_mushy.F90 @@ -10,13 +10,13 @@ module icepack_therm_mushy use icepack_parameters, only: a_rapid_mode, Rac_rapid_mode, tscale_pnd_drain use icepack_parameters, only: aspect_rapid_mode, dSdt_slow_mode, phi_c_slow_mode use icepack_parameters, only: sw_redist, sw_frac, sw_dtemp + use icepack_tracers, only: nilyr, nslyr, tr_pond use icepack_mushy_physics, only: icepack_mushy_density_brine, enthalpy_brine, icepack_enthalpy_snow use icepack_mushy_physics, only: enthalpy_mush_liquid_fraction use icepack_mushy_physics, only: icepack_mushy_temperature_mush, icepack_mushy_liquid_fraction use icepack_mushy_physics, only: temperature_snow, temperature_mush_liquid_fraction use icepack_mushy_physics, only: liquidus_brine_salinity_mush, liquidus_temperature_mush use icepack_mushy_physics, only: conductivity_mush_array, conductivity_snow_array - use icepack_tracers, only: tr_pond use icepack_therm_shared, only: surface_heat_flux, dsurface_heat_flux_dTsf use icepack_therm_shared, only: ferrmax use icepack_warnings, only: warnstr, icepack_warnings_add @@ -40,7 +40,6 @@ module icepack_therm_mushy !======================================================================= subroutine temperature_changes_salinity(dt, & - nilyr, nslyr, & rhoa, flw, & potT, Qa, & shcoef, lhcoef, & @@ -61,10 +60,6 @@ subroutine temperature_changes_salinity(dt, & ! solve the enthalpy and bulk salinity of the ice for a single column - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & dt ! time step (s) @@ -185,8 +180,7 @@ subroutine temperature_changes_salinity(dt, & enddo ! k ! calculate vertical bulk darcy flow - call flushing_velocity(zTin, & - phi, nilyr, & + call flushing_velocity(zTin, phi, & hin, hsn, & hilyr, & hpond, apond, & @@ -194,7 +188,7 @@ subroutine temperature_changes_salinity(dt, & if (icepack_warnings_aborted(subname)) return ! calculate quantities related to drainage - call explicit_flow_velocities(nilyr, zSin, & + call explicit_flow_velocities(zSin, & zTin, Tsf, & Tbot, q, & dSdt, Sbr, & @@ -204,7 +198,7 @@ subroutine temperature_changes_salinity(dt, & if (icepack_warnings_aborted(subname)) return ! calculate the conductivities - call conductivity_mush_array(nilyr, zqin0, zSin0, km) + call conductivity_mush_array(zqin0, zSin0, km) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -251,8 +245,7 @@ subroutine temperature_changes_salinity(dt, & if (icepack_warnings_aborted(subname)) return ! run the two stage solver - call two_stage_solver_snow(nilyr, nslyr, & - Tsf, Tsf0, & + call two_stage_solver_snow(Tsf, Tsf0, & zqsn, zqsn0, & zqin, zqin0, & zSin, zSin0, & @@ -296,8 +289,7 @@ subroutine temperature_changes_salinity(dt, & ! case without snow ! run the two stage solver - call two_stage_solver_nosnow(nilyr, nslyr, & - Tsf, Tsf0, & + call two_stage_solver_nosnow(Tsf, Tsf0, & zqsn, & zqin, zqin0, & zSin, zSin0, & @@ -341,7 +333,6 @@ subroutine temperature_changes_salinity(dt, & ! flood snow ice call flood_ice(hsn, hin, & - nslyr, nilyr, & hslyr, hilyr, & zqsn, zqin, & phi, dt, & @@ -355,8 +346,7 @@ end subroutine temperature_changes_salinity !======================================================================= - subroutine two_stage_solver_snow(nilyr, nslyr, & - Tsf, Tsf0, & + subroutine two_stage_solver_snow(Tsf, Tsf0, & zqsn, zqsn0, & zqin, zqin0, & zSin, zSin0, & @@ -386,10 +376,6 @@ subroutine two_stage_solver_snow(nilyr, nslyr, & ! 4) If the surface condition is inconsistent resolve for the other surface condition ! 5) If neither solution is consistent the resolve the inconsistency - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), intent(inout) :: & Tsf ! snow surface temperature (C) @@ -463,8 +449,7 @@ subroutine two_stage_solver_snow(nilyr, nslyr, & ! initially cold ! solve the system for cold and snow - call picard_solver(nilyr, nslyr, & - .true., .true., & + call picard_solver(.true., .true., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -508,8 +493,7 @@ subroutine two_stage_solver_snow(nilyr, nslyr, & zSin = zSin0 ! solve the system for melting and snow - call picard_solver(nilyr, nslyr, & - .true., .false., & + call picard_solver(.true., .false., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -561,8 +545,7 @@ subroutine two_stage_solver_snow(nilyr, nslyr, & Tsf = c0 ! solve the system for melting and snow - call picard_solver(nilyr, nslyr, & - .true., .false., & + call picard_solver(.true., .false., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -610,8 +593,7 @@ subroutine two_stage_solver_snow(nilyr, nslyr, & zSin = zSin0 ! solve the system for cold and snow - call picard_solver(nilyr, nslyr, & - .true., .true., & + call picard_solver(.true., .true., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -662,8 +644,7 @@ end subroutine two_stage_solver_snow !======================================================================= - subroutine two_stage_solver_nosnow(nilyr, nslyr, & - Tsf, Tsf0, & + subroutine two_stage_solver_nosnow(Tsf, Tsf0, & zqsn, & zqin, zqin0, & zSin, zSin0, & @@ -693,10 +674,6 @@ subroutine two_stage_solver_nosnow(nilyr, nslyr, & ! 4) If the surface condition is inconsistent resolve for the other surface condition ! 5) If neither solution is consistent the resolve the inconsistency - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), intent(inout) :: & Tsf ! ice surface temperature (C) @@ -772,8 +749,7 @@ subroutine two_stage_solver_nosnow(nilyr, nslyr, & ! initially cold ! solve the system for cold and no snow - call picard_solver(nilyr, nslyr, & - .false., .true., & + call picard_solver(.false., .true., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -815,8 +791,7 @@ subroutine two_stage_solver_nosnow(nilyr, nslyr, & zSin = zSin0 ! solve the system for melt and no snow - call picard_solver(nilyr, nslyr, & - .false., .false., & + call picard_solver(.false., .false., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -869,8 +844,7 @@ subroutine two_stage_solver_nosnow(nilyr, nslyr, & ! solve the system for melt and no snow Tsf = Tmlt - call picard_solver(nilyr, nslyr, & - .false., .false., & + call picard_solver(.false., .false., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -917,8 +891,7 @@ subroutine two_stage_solver_nosnow(nilyr, nslyr, & zSin = zSin0 ! solve the system for cold and no snow - call picard_solver(nilyr, nslyr, & - .false., .true., & + call picard_solver(.false., .true., & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -1039,8 +1012,7 @@ end subroutine two_stage_inconsistency ! Picard/TDMA based solver !======================================================================= - subroutine prep_picard(nilyr, nslyr, & - lsnow, zqsn, & + subroutine prep_picard(lsnow, zqsn, & zqin, zSin, & hilyr, hslyr, & km, ks, & @@ -1049,10 +1021,6 @@ subroutine prep_picard(nilyr, nslyr, & dxp, kcstar, & einit) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - logical, intent(in) :: & lsnow ! snow presence: T: has snow, F: no snow @@ -1098,17 +1066,15 @@ subroutine prep_picard(nilyr, nslyr, & endif ! lsnow ! interface distances - call calc_intercell_thickness(nilyr, nslyr, lsnow, hilyr, hslyr, dxp) + call calc_intercell_thickness(lsnow, hilyr, hslyr, dxp) if (icepack_warnings_aborted(subname)) return ! interface conductivities - call calc_intercell_conductivity(lsnow, nilyr, nslyr, & - km, ks, hilyr, hslyr, kcstar) + call calc_intercell_conductivity(lsnow, km, ks, hilyr, hslyr, kcstar) if (icepack_warnings_aborted(subname)) return ! total energy content call total_energy_content(lsnow, & - nilyr, nslyr, & zqin, zqsn, & hilyr, hslyr, & einit) @@ -1118,8 +1084,7 @@ end subroutine prep_picard !======================================================================= - subroutine picard_solver(nilyr, nslyr, & - lsnow, lcold, & + subroutine picard_solver(lsnow, lcold, & Tsf, zqsn, & zqin, zSin, & zTin, zTsn, & @@ -1141,10 +1106,6 @@ subroutine picard_solver(nilyr, nslyr, & q, dSdt, & w ) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - logical, intent(in) :: & lsnow , & ! snow presence: T: has snow, F: no snow lcold ! surface cold: T: surface is cold, F: surface is melting @@ -1243,8 +1204,7 @@ subroutine picard_solver(nilyr, nslyr, & lconverged = .false. ! prepare quantities for picard iteration - call prep_picard(nilyr, nslyr, & - lsnow, zqsn, & + call prep_picard(lsnow, zqsn, & zqin, zSin, & hilyr, hslyr, & km, ks, & @@ -1287,7 +1247,6 @@ subroutine picard_solver(nilyr, nslyr, & ! tridiagonal solve of new temperatures call solve_heat_conduction(lsnow, lcold, & - nilyr, nslyr, & Tsf, Tbot, & zqin0, zqsn0, & phi, dt, & @@ -1301,26 +1260,22 @@ subroutine picard_solver(nilyr, nslyr, & if (icepack_warnings_aborted(subname)) return ! update brine enthalpy - call picard_updates_enthalpy(nilyr, zTin, qbr) + call picard_updates_enthalpy(zTin, qbr) if (icepack_warnings_aborted(subname)) return ! drainage fluxes call picard_drainage_fluxes(fadvheat_nit, q, & - qbr, qocn, & - nilyr) + qbr, qocn) if (icepack_warnings_aborted(subname)) return ! flushing fluxes - call picard_flushing_fluxes(nilyr, & - fadvheat_nit, w, & + call picard_flushing_fluxes(fadvheat_nit, w, & qbr, & qpond) if (icepack_warnings_aborted(subname)) return ! perform convergence check - call check_picard_convergence(nilyr, nslyr, & - lsnow, & - lconverged, & + call check_picard_convergence(lsnow, lconverged, & Tsf, Tsf_prev, & zTin, zTin_prev,& zTsn, zTsn_prev,& @@ -1345,8 +1300,7 @@ subroutine picard_solver(nilyr, nslyr, & fadvheat = fadvheat_nit ! update the picard iterants - call picard_updates(nilyr, zTin, & - Sbr, qbr) + call picard_updates(zTin, Sbr, qbr) if (icepack_warnings_aborted(subname)) return ! solve for the salinity @@ -1354,7 +1308,7 @@ subroutine picard_solver(nilyr, nslyr, & Spond, sss, & q, dSdt, & w, hilyr, & - dt, nilyr) + dt) if (icepack_warnings_aborted(subname)) return ! final surface heat flux @@ -1369,14 +1323,30 @@ subroutine picard_solver(nilyr, nslyr, & ! if not converged if (.not. lconverged) then - call picard_nonconvergence(nilyr, nslyr,& - Tsf0, Tsf, & - zTsn0, zTsn, & - zTin0, zTin, & - zSin0, zSin, & - zqsn0, zqsn, & - zqin0, zqin, & - phi) + call picard_nonconvergence(Tsf0, Tsf, & + zTsn0, zTsn, & + zTin0, zTin, & + zSin0, zSin, & + zqsn0, zqsn, & + zqin0, phi, & + dt, & + hilyr, hslyr, & + km, ks, & + Iswabs, Sswabs, & + Tbot, & + fswint, fswsfc, & + rhoa, flw, & + potT, Qa, & + shcoef, lhcoef, & + fcondtop, fcondbot, & + fadvheat, & + flwoutn, fsensn, & + flatn, fsurfn, & + qpond, qocn, & + Spond, sss, & + q, dSdt, & + w) + if (icepack_warnings_aborted(subname)) return call icepack_warnings_add(subname//" picard_solver: Picard solver non-convergence" ) call icepack_warnings_setabort(.true.,__FILE__,__LINE__) @@ -1388,17 +1358,29 @@ end subroutine picard_solver !======================================================================= - subroutine picard_nonconvergence(nilyr, nslyr,& - Tsf0, Tsf, & - zTsn0, zTsn, & - zTin0, zTin, & - zSin0, zSin, & - zqsn0, zqsn, & - zqin0, zqin, phi) - - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers + subroutine picard_nonconvergence(Tsf0, Tsf, & + zTsn0, zTsn, & + zTin0, zTin, & + zSin0, zSin, & + zqsn0, zqsn, & + zqin0, phi, & + dt, & + hilyr, hslyr, & + km, ks, & + Iswabs, Sswabs, & + Tbot, & + fswint, fswsfc, & + rhoa, flw, & + potT, Qa, & + shcoef, lhcoef, & + fcondtop, fcondbot, & + fadvheat, & + flwoutn, fsensn, & + flatn, fsurfn, & + qpond, qocn, & + Spond, sss, & + q, dSdt, & + w) real(kind=dbl_kind), intent(in) :: & Tsf0 , & ! snow surface temperature (C) at beginning of timestep @@ -1414,41 +1396,163 @@ subroutine picard_nonconvergence(nilyr, nslyr,& zSin0 , & ! ice layer bulk salinity (ppt) zSin , & ! ice layer bulk salinity (ppt) zqin0 , & - zqin , & phi ! ice layer liquid fraction + real(kind=dbl_kind), intent(in) :: & + dt , & ! time step (s) + hilyr , & ! ice layer thickness (m) + hslyr , & ! snow layer thickness (m) + Tbot , & ! ice bottom surfce temperature (deg C) + fswint , & ! SW absorbed in ice interior below surface (W m-2) + fswsfc , & ! SW absorbed at ice/snow surface (W m-2) + rhoa , & ! air density (kg/m^3) + flw , & ! incoming longwave radiation (W/m^2) + potT , & ! air potential temperature (K) + Qa , & ! specific humidity (kg/kg) + shcoef , & ! transfer coefficient for sensible heat + lhcoef , & ! transfer coefficient for latent heat + qpond , & ! melt pond brine enthalpy (J m-3) + qocn , & ! ocean brine enthalpy (J m-3) + Spond , & ! melt pond salinity (ppt) + sss , & ! sea surface salinity (ppt) + w ! vertical flushing Darcy velocity (m/s) + + real(kind=dbl_kind), dimension(:), intent(in) :: & + km , & ! ice conductivity (W m-1 K-1) + Iswabs , & ! SW radiation absorbed in ice layers (W m-2) + dSdt ! gravity drainage desalination rate for slow mode (ppt s-1) + + real(kind=dbl_kind), dimension(0:nilyr), intent(in) :: & + q ! upward interface vertical Darcy flow (m s-1) + + real(kind=dbl_kind), dimension(:), intent(in) :: & + ks , & ! snow conductivity (W m-1 K-1) + Sswabs ! SW radiation absorbed in snow layers (W m-2) + + real(kind=dbl_kind), intent(in) :: & + flwoutn , & ! upward LW at surface (W m-2) + fsensn , & ! surface downward sensible heat (W m-2) + flatn , & ! surface downward latent heat (W m-2) + fsurfn ! net flux to top surface, excluding fcondtop + + real(kind=dbl_kind), intent(in) :: & + fcondtop , & ! downward cond flux at top surface (W m-2) + fcondbot , & ! downward cond flux at bottom surface (W m-2) + fadvheat ! flow of heat to ocean due to advection (W m-2) + integer :: & k ! vertical layer index - character(len=*),parameter :: subname='(picard_nonconvergence)' - - write(warnstr,*) subname, "-------------------------------------" - call icepack_warnings_add(warnstr) + character(len=char_len_long) :: & + warning ! warning message - write(warnstr,*) subname, "picard convergence failed!" - call icepack_warnings_add(warnstr) - write(warnstr,*) subname, 0, Tsf0, Tsf - call icepack_warnings_add(warnstr) + character(len=*),parameter :: subname='(picard_nonconvergence)' + write(warning,*) "-------------------------------------" + call icepack_warnings_add(warning) + write(warning,*) + call icepack_warnings_add(warning) + + write(warning,*) trim(subname)//":picard convergence failed!" + call icepack_warnings_add(warning) + write(warning,*) "==========================" + call icepack_warnings_add(warning) + write(warning,*) + call icepack_warnings_add(warning) + + write(warning,*) "Surface: Tsf0, Tsf" + call icepack_warnings_add(warning) + write(warning,*) 0, Tsf0, Tsf + call icepack_warnings_add(warning) + write(warning,*) + call icepack_warnings_add(warning) + + write(warning,*) "Snow: zTsn0(k), zTsn(k), zqsn0(k), ks(k), Sswabs(k)" + call icepack_warnings_add(warning) do k = 1, nslyr - write(warnstr,*) subname, k, zTsn0(k), zTsn(k), zqsn(k), zqsn0(k) - call icepack_warnings_add(warnstr) + write(warning,*) k, zTsn0(k), zTsn(k), zqsn0(k), ks(k), Sswabs(k) + call icepack_warnings_add(warning) enddo ! k + write(warning,*) + call icepack_warnings_add(warning) + write(warning,*) "Ice: zTin0(k), zTin(k), zSin0(k), zSin(k), phi(k), zqin0(k), km(k), Iswabs(k), dSdt(k)" + call icepack_warnings_add(warning) do k = 1, nilyr - write(warnstr,*) subname, k, zTin0(k), zTin(k), zSin0(k), zSin(k), phi(k), zqin(k), zqin0(k) - call icepack_warnings_add(warnstr) + write(warning,*) k, zTin0(k), zTin(k), zSin0(k), zSin(k), phi(k), zqin0(k), km(k), Iswabs(k), dSdt(k) + call icepack_warnings_add(warning) enddo ! k - - write(warnstr,*) subname, "-------------------------------------" - call icepack_warnings_add(warnstr) + write(warning,*) + call icepack_warnings_add(warning) + + write(warning,*) "Ice boundary: q(k)" + call icepack_warnings_add(warning) + do k = 0, nilyr + write(warning,*) k, q(k) + call icepack_warnings_add(warning) + enddo ! k + write(warning,*) + call icepack_warnings_add(warning) + + write(warning,*) "dt: ", dt + call icepack_warnings_add(warning) + write(warning,*) "hilyr: ", hilyr + call icepack_warnings_add(warning) + write(warning,*) "hslyr: ", hslyr + call icepack_warnings_add(warning) + write(warning,*) "Tbot: ", Tbot + call icepack_warnings_add(warning) + write(warning,*) "fswint: ", fswint + call icepack_warnings_add(warning) + write(warning,*) "fswsfc: ", fswsfc + call icepack_warnings_add(warning) + write(warning,*) "rhoa: ", rhoa + call icepack_warnings_add(warning) + write(warning,*) "flw: ", flw + call icepack_warnings_add(warning) + write(warning,*) "potT: ", potT + call icepack_warnings_add(warning) + write(warning,*) "Qa: ", Qa + call icepack_warnings_add(warning) + write(warning,*) "shcoef: ", shcoef + call icepack_warnings_add(warning) + write(warning,*) "lhcoef: ", lhcoef + call icepack_warnings_add(warning) + write(warning,*) "qpond: ", qpond + call icepack_warnings_add(warning) + write(warning,*) "qocn: ", qocn + call icepack_warnings_add(warning) + write(warning,*) "Spond: ", Spond + call icepack_warnings_add(warning) + write(warning,*) "sss: ", sss + call icepack_warnings_add(warning) + write(warning,*) "w: ", w + call icepack_warnings_add(warning) + write(warning,*) "flwoutn: ", flwoutn + call icepack_warnings_add(warning) + write(warning,*) "fsensn: ", fsensn + call icepack_warnings_add(warning) + write(warning,*) "flatn: ", flatn + call icepack_warnings_add(warning) + write(warning,*) "fsurfn: ", fsurfn + call icepack_warnings_add(warning) + write(warning,*) "fcondtop: ", fcondtop + call icepack_warnings_add(warning) + write(warning,*) "fcondbot: ", fcondbot + call icepack_warnings_add(warning) + write(warning,*) "fadvheat: ", fadvheat + call icepack_warnings_add(warning) + write(warning,*) + call icepack_warnings_add(warning) + + write(warning,*) "-------------------------------------" + call icepack_warnings_add(warning) end subroutine picard_nonconvergence !======================================================================= - subroutine check_picard_convergence(nilyr, nslyr, & - lsnow, & + subroutine check_picard_convergence(lsnow, & lconverged, & Tsf, Tsf_prev, & zTin, zTin_prev,& @@ -1462,10 +1566,6 @@ subroutine check_picard_convergence(nilyr, nslyr, & fcondtop, fcondbot, & fadvheat) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - logical, intent(inout) :: & lconverged ! has Picard solver converged? @@ -1514,14 +1614,12 @@ subroutine check_picard_convergence(nilyr, nslyr, & character(len=*),parameter :: subname='(check_picard_convergence)' call picard_final(lsnow, & - nilyr, nslyr, & zqin, zqsn, & zTin, zTsn, & phi) if (icepack_warnings_aborted(subname)) return call total_energy_content(lsnow, & - nilyr, nslyr, & zqin, zqsn, & hilyr, hslyr, & efinal) @@ -1553,11 +1651,7 @@ end subroutine check_picard_convergence !======================================================================= subroutine picard_drainage_fluxes(fadvheat, q, & - qbr, qocn, & - nilyr) - - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers + qbr, qocn) real(kind=dbl_kind), intent(out) :: & fadvheat ! flow of heat to ocean due to advection (W m-2) @@ -1593,14 +1687,10 @@ end subroutine picard_drainage_fluxes !======================================================================= - subroutine picard_flushing_fluxes(nilyr, & - fadvheat, w, & + subroutine picard_flushing_fluxes(fadvheat, w, & qbr, & qpond) - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), intent(inout) :: & fadvheat ! flow of heat to ocean due to advection (W m-2) @@ -1659,7 +1749,6 @@ end subroutine maximum_variables_changes !======================================================================= subroutine total_energy_content(lsnow, & - nilyr, nslyr, & zqin, zqsn, & hilyr, hslyr, & energy) @@ -1667,10 +1756,6 @@ subroutine total_energy_content(lsnow, & logical, intent(in) :: & lsnow ! snow presence: T: has snow, F: no snow - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zqin , & ! ice layer enthalpy (J m-3) zqsn ! snow layer enthalpy (J m-3) @@ -1709,14 +1794,11 @@ end subroutine total_energy_content !======================================================================= - subroutine picard_updates(nilyr, zTin, & + subroutine picard_updates(zTin, & Sbr, qbr) ! update brine salinity and liquid fraction based on new temperatures - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zTin ! ice layer temperature (C) @@ -1740,13 +1822,10 @@ end subroutine picard_updates !======================================================================= - subroutine picard_updates_enthalpy(nilyr, zTin, qbr) + subroutine picard_updates_enthalpy(zTin, qbr) ! update brine salinity and liquid fraction based on new temperatures - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zTin ! ice layer temperature (C) @@ -1769,15 +1848,10 @@ end subroutine picard_updates_enthalpy !======================================================================= subroutine picard_final(lsnow, & - nilyr, nslyr, & zqin, zqsn, & zTin, zTsn, & phi) - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nslyr ! number of snow layers - logical, intent(in) :: & lsnow ! snow presence: T: has snow, F: no snow @@ -1811,11 +1885,7 @@ end subroutine picard_final !======================================================================= - subroutine calc_intercell_thickness(nilyr, nslyr, lsnow, hilyr, hslyr, dxp) - - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nslyr ! number of snow layers + subroutine calc_intercell_thickness(lsnow, hilyr, hslyr, dxp) logical, intent(in) :: & lsnow ! snow presence: T: has snow, F: no snow @@ -1877,15 +1947,10 @@ end subroutine calc_intercell_thickness !======================================================================= subroutine calc_intercell_conductivity(lsnow, & - nilyr, nslyr, & km, ks, & hilyr, hslyr, & kcstar) - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nslyr ! number of snow layers - logical, intent(in) :: & lsnow ! snow presence: T: has snow, F: no snow @@ -1958,7 +2023,6 @@ end subroutine calc_intercell_conductivity !======================================================================= subroutine solve_heat_conduction(lsnow, lcold, & - nilyr, nslyr, & Tsf, Tbot, & zqin0, zqsn0, & phi, dt, & @@ -1974,10 +2038,6 @@ subroutine solve_heat_conduction(lsnow, lcold, & lsnow , & ! snow presence: T: has snow, F: no snow lcold ! surface cold: T: surface is cold, F: surface is melting - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zqin0 , & ! ice layer enthalpy (J m-3) at beggining of timestep Iswabs , & ! SW radiation absorbed in ice layers (W m-2) @@ -2030,7 +2090,6 @@ subroutine solve_heat_conduction(lsnow, lcold, & if (lcold) then call matrix_elements_snow_cold(Ap, As, An, b, nyn, & - nilyr, nslyr, & Tsf, Tbot, & zqin0, zqsn0, & qpond, qocn, & @@ -2046,7 +2105,6 @@ subroutine solve_heat_conduction(lsnow, lcold, & else ! lcold call matrix_elements_snow_melt(Ap, As, An, b, nyn, & - nilyr, nslyr, & Tsf, Tbot, & zqin0, zqsn0, & qpond, qocn, & @@ -2065,7 +2123,6 @@ subroutine solve_heat_conduction(lsnow, lcold, & if (lcold) then call matrix_elements_nosnow_cold(Ap, As, An, b, nyn, & - nilyr, & Tsf, Tbot, & zqin0, & qpond, qocn, & @@ -2081,7 +2138,6 @@ subroutine solve_heat_conduction(lsnow, lcold, & else ! lcold call matrix_elements_nosnow_melt(Ap, As, An, b, nyn, & - nilyr, & Tsf, Tbot, & zqin0, & qpond, qocn, & @@ -2098,12 +2154,11 @@ subroutine solve_heat_conduction(lsnow, lcold, & endif ! lsnow ! tridiag to get new temperatures - call tdma_solve_sparse(nilyr, nslyr, & + call tdma_solve_sparse( & An(1:nyn), Ap(1:nyn), As(1:nyn), b(1:nyn), T(1:nyn), nyn) if (icepack_warnings_aborted(subname)) return call update_temperatures(lsnow, lcold, & - nilyr, nslyr, & T, Tsf, & zTin, zTsn) if (icepack_warnings_aborted(subname)) return @@ -2113,7 +2168,6 @@ end subroutine solve_heat_conduction !======================================================================= subroutine update_temperatures(lsnow, lcold, & - nilyr, nslyr, & T, Tsf, & zTin, zTsn) @@ -2121,10 +2175,6 @@ subroutine update_temperatures(lsnow, lcold, & lsnow , & ! snow presence: T: has snow, F: no snow lcold ! surface cold: T: surface is cold, F: surface is melting - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), dimension(:), intent(in) :: & T ! matrix solution vector @@ -2198,7 +2248,6 @@ end subroutine update_temperatures !======================================================================= subroutine matrix_elements_nosnow_melt(Ap, As, An, b, nyn, & - nilyr, & Tsf, Tbot, & zqin0, & qpond, qocn, & @@ -2218,9 +2267,6 @@ subroutine matrix_elements_nosnow_melt(Ap, As, An, b, nyn, & integer, intent(out) :: & nyn ! matrix size - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zqin0 , & ! ice layer enthalpy (J m-3) at beggining of timestep Iswabs , & ! SW radiation absorbed in ice layers (W m-2) @@ -2305,7 +2351,6 @@ end subroutine matrix_elements_nosnow_melt !======================================================================= subroutine matrix_elements_nosnow_cold(Ap, As, An, b, nyn, & - nilyr, & Tsf, Tbot, & zqin0, & qpond, qocn, & @@ -2326,9 +2371,6 @@ subroutine matrix_elements_nosnow_cold(Ap, As, An, b, nyn, & integer, intent(out) :: & nyn ! matrix size - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zqin0 , & ! ice layer enthalpy (J m-3) at beggining of timestep Iswabs , & ! SW radiation absorbed in ice layers (W m-2) @@ -2421,7 +2463,6 @@ end subroutine matrix_elements_nosnow_cold !======================================================================= subroutine matrix_elements_snow_melt(Ap, As, An, b, nyn, & - nilyr, nslyr, & Tsf, Tbot, & zqin0, zqsn0, & qpond, qocn, & @@ -2441,10 +2482,6 @@ subroutine matrix_elements_snow_melt(Ap, As, An, b, nyn, & integer, intent(out) :: & nyn ! matrix size - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zqin0 , & ! ice layer enthalpy (J m-3) at beggining of timestep Iswabs , & ! SW radiation absorbed in ice layers (W m-2) @@ -2557,7 +2594,6 @@ end subroutine matrix_elements_snow_melt !======================================================================= subroutine matrix_elements_snow_cold(Ap, As, An, b, nyn, & - nilyr, nslyr, & Tsf, Tbot, & zqin0, zqsn0, & qpond, qocn, & @@ -2578,10 +2614,6 @@ subroutine matrix_elements_snow_cold(Ap, As, An, b, nyn, & integer, intent(out) :: & nyn ! matrix size - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zqin0 , & ! ice layer enthalpy (J m-3) at beggining of timestep Iswabs , & ! SW radiation absorbed in ice layers (W m-2) @@ -2707,14 +2739,11 @@ end subroutine matrix_elements_snow_cold !======================================================================= - subroutine solve_salinity(zSin, Sbr, & + subroutine solve_salinity(zSin, Sbr, & Spond, sss, & q, dSdt, & w, hilyr, & - dt, nilyr) - - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers + dt) real(kind=dbl_kind), dimension(:), intent(inout) :: & zSin ! ice layer bulk salinity (ppt) @@ -2792,14 +2821,10 @@ end subroutine solve_salinity !======================================================================= - subroutine tdma_solve_sparse(nilyr, nslyr, a, b, c, d, x, n) + subroutine tdma_solve_sparse(a, b, c, d, x, n) ! perform a tri-diagonal solve with TDMA using a sparse tridiagoinal matrix - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nslyr ! number of snow layers - integer(kind=int_kind), intent(in) :: & n ! matrix size @@ -2866,7 +2891,7 @@ end function permeability !======================================================================= - subroutine explicit_flow_velocities(nilyr, zSin, & + subroutine explicit_flow_velocities(zSin, & zTin, Tsf, & Tbot, q, & dSdt, Sbr, & @@ -2877,9 +2902,6 @@ subroutine explicit_flow_velocities(nilyr, zSin, & ! calculate the rapid gravity drainage mode Darcy velocity and the ! slow mode drainage rate - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zSin, & ! ice layer bulk salinity (ppt) zTin ! ice layer temperature (C) @@ -3040,8 +3062,7 @@ end subroutine explicit_flow_velocities ! Flushing !======================================================================= - subroutine flushing_velocity(zTin, & - phi, nilyr, & + subroutine flushing_velocity(zTin, phi, & hin, hsn, & hilyr, & hpond, apond, & @@ -3049,9 +3070,6 @@ subroutine flushing_velocity(zTin, & ! calculate the vertical flushing Darcy velocity (positive downward) - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), dimension(:), intent(in) :: & zTin , & ! ice layer temperature (C) phi ! ice layer liquid fraction @@ -3196,7 +3214,6 @@ end subroutine flush_pond !======================================================================= subroutine flood_ice(hsn, hin, & - nslyr, nilyr, & hslyr, hilyr, & zqsn, zqin, & phi, dt, & @@ -3208,10 +3225,6 @@ subroutine flood_ice(hsn, hin, & ! given upwards flushing brine flow calculate amount of snow ice and ! convert snow to ice with appropriate properties - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real(kind=dbl_kind), intent(in) :: & dt , & ! time step (s) hsn , & ! snow thickness (m) @@ -3319,7 +3332,7 @@ subroutine flood_ice(hsn, hin, & dh = max(min(dh,hsn),c0) ! enthalpy of snow that becomes snow-ice - call enthalpy_snow_snowice(nslyr, dh, hsn, zqsn, zqsn_snowice) + call enthalpy_snow_snowice(dh, hsn, zqsn, zqsn_snowice) if (icepack_warnings_aborted(subname)) return ! change thicknesses @@ -3334,23 +3347,23 @@ subroutine flood_ice(hsn, hin, & zqin_snowice = phi_snowice * qocn + zqsn_snowice ! change snow properties - call update_vertical_tracers_snow(nslyr, zqsn, hslyr, hslyr2) + call update_vertical_tracers_snow(zqsn, hslyr, hslyr2) if (icepack_warnings_aborted(subname)) return if (snwgrain .and. hslyr2 > puny) then - call update_vertical_tracers_snow(nslyr, smice, hslyr, hslyr2) - call update_vertical_tracers_snow(nslyr, smliq, hslyr, hslyr2) + call update_vertical_tracers_snow(smice, hslyr, hslyr2) + call update_vertical_tracers_snow(smliq, hslyr, hslyr2) if (icepack_warnings_aborted(subname)) return endif ! change ice properties - call update_vertical_tracers_ice(nilyr, zqin, hilyr, hilyr2, & + call update_vertical_tracers_ice(zqin, hilyr, hilyr2, & hin, hin2, zqin_snowice) if (icepack_warnings_aborted(subname)) return - call update_vertical_tracers_ice(nilyr, zSin, hilyr, hilyr2, & + call update_vertical_tracers_ice(zSin, hilyr, hilyr2, & hin, hin2, zSin_snowice) if (icepack_warnings_aborted(subname)) return - call update_vertical_tracers_ice(nilyr, phi, hilyr, hilyr2, & + call update_vertical_tracers_ice(phi, hilyr, hilyr2, & hin, hin2, phi_snowice) if (icepack_warnings_aborted(subname)) return @@ -3375,13 +3388,10 @@ end subroutine flood_ice !======================================================================= - subroutine enthalpy_snow_snowice(nslyr, dh, hsn, zqsn, zqsn_snowice) + subroutine enthalpy_snow_snowice(dh, hsn, zqsn, zqsn_snowice) ! determine enthalpy of the snow being converted to snow ice - integer (kind=int_kind), intent(in) :: & - nslyr ! number of snow layers - real(kind=dbl_kind), intent(in) :: & dh , & ! thickness of new snowice formation (m) hsn ! initial snow thickness @@ -3423,13 +3433,10 @@ end subroutine enthalpy_snow_snowice !======================================================================= - subroutine update_vertical_tracers_snow(nslyr, trc, hlyr1, hlyr2) + subroutine update_vertical_tracers_snow(trc, hlyr1, hlyr2) ! given some snow ice formation regrid snow layers - integer (kind=int_kind), intent(in) :: & - nslyr ! number of snow layers - real(kind=dbl_kind), dimension(:), intent(inout) :: & trc ! vertical tracer @@ -3491,14 +3498,11 @@ end subroutine update_vertical_tracers_snow !======================================================================= - subroutine update_vertical_tracers_ice(nilyr, trc, hlyr1, hlyr2, & + subroutine update_vertical_tracers_ice(trc, hlyr1, hlyr2, & h1, h2, trc0) ! given some snow ice formation regrid ice layers - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers - real(kind=dbl_kind), dimension(:), intent(inout) :: & trc ! vertical tracer diff --git a/columnphysics/icepack_therm_shared.F90 b/columnphysics/icepack_therm_shared.F90 index 32fa2ae96..858e6c560 100644 --- a/columnphysics/icepack_therm_shared.F90 +++ b/columnphysics/icepack_therm_shared.F90 @@ -14,6 +14,7 @@ module icepack_therm_shared use icepack_parameters, only: saltmax, min_salin, depressT use icepack_parameters, only: ktherm, tfrz_option use icepack_parameters, only: calc_Tsfc + use icepack_tracers, only: nilyr, nslyr use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -28,9 +29,9 @@ module icepack_therm_shared public :: calculate_Tin_from_qin, & surface_heat_flux, & dsurface_heat_flux_dTsf, & - icepack_init_thermo, & + icepack_init_salinity, & icepack_salinity_profile, & - icepack_init_trcr, & + icepack_init_enthalpy, & icepack_ice_temperature, & icepack_snow_temperature, & icepack_liquidus_temperature, & @@ -64,12 +65,12 @@ function calculate_Tin_from_qin (qin, Tmltk) & Tmltk ! melting temperature at one level real (kind=dbl_kind) :: & - Tin ! internal temperature + Tin ! internal temperature ! local variables real (kind=dbl_kind) :: & - aa1,bb1,cc1 ! quadratic solvers + aa1,bb1,cc1,csqrt ! quadratic solvers character(len=*),parameter :: subname='(calculate_Tin_from_qin)' @@ -77,8 +78,13 @@ function calculate_Tin_from_qin (qin, Tmltk) & aa1 = cp_ice bb1 = (cp_ocn-cp_ice)*Tmltk - qin/rhoi - Lfresh cc1 = Lfresh * Tmltk - Tin = min((-bb1 - sqrt(bb1*bb1 - c4*aa1*cc1)) / & - (c2*aa1),Tmltk) + csqrt = bb1*bb1 - c4*aa1*cc1 + if (csqrt < c0) then + call icepack_warnings_add(subname//' sqrt error: ') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + Tin = min((-bb1 - sqrt(csqrt)) / (c2*aa1),Tmltk) else ! fresh ice Tin = (Lfresh + qin/rhoi) / cp_ice @@ -209,16 +215,14 @@ subroutine dsurface_heat_flux_dTsf(Tsf, rhoa, & end subroutine dsurface_heat_flux_dTsf !======================================================================= -!autodocument_start icepack_init_thermo -! Initialize the vertical profile of ice salinity and melting temperature. +!autodocument_start icepack_init_salinity +! Initialize the vertical profile of ice salinity. +! This subroutine was renamed from icepack_init_thermo in Oct 2024 ! ! authors: C. M. Bitz, UW ! William H. Lipscomb, LANL - subroutine icepack_init_thermo(nilyr, sprofile) - - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers + subroutine icepack_init_salinity(sprofile) real (kind=dbl_kind), dimension(:), intent(out) :: & sprofile ! vertical salinity profile @@ -228,7 +232,7 @@ subroutine icepack_init_thermo(nilyr, sprofile) integer (kind=int_kind) :: k ! ice layer index real (kind=dbl_kind) :: zn ! normalized ice thickness - character(len=*),parameter :: subname='(icepack_init_thermo)' + character(len=*),parameter :: subname='(icepack_init_salinity)' !----------------------------------------------------------------- ! Determine l_brine based on saltmax. @@ -241,7 +245,7 @@ subroutine icepack_init_thermo(nilyr, sprofile) if (saltmax > min_salin) l_brine = .true. !----------------------------------------------------------------- - ! Prescibe vertical profile of salinity and melting temperature. + ! Prescibe vertical profile of salinity. ! Note this profile is only used for BL99 thermodynamics. !----------------------------------------------------------------- @@ -261,7 +265,7 @@ subroutine icepack_init_thermo(nilyr, sprofile) enddo endif ! l_brine - end subroutine icepack_init_thermo + end subroutine icepack_init_salinity !======================================================================= !autodocument_start icepack_salinity_profile @@ -284,25 +288,21 @@ function icepack_salinity_profile(zn) result(salinity) nsal = 0.407_dbl_kind, & msal = 0.573_dbl_kind - character(len=*),parameter :: subname='(icepack_init_thermo)' + character(len=*),parameter :: subname='(icepack_salinity_profile)' salinity = (saltmax/c2)*(c1-cos(pi*zn**(nsal/(msal+zn)))) end function icepack_salinity_profile !======================================================================= -!autodocument_start icepack_init_trcr +!autodocument_start icepack_init_enthalpy +! This subroutine was renamed from icepack_init_trcr in Oct 2024 ! - subroutine icepack_init_trcr(Tair, Tf, & + subroutine icepack_init_enthalpy(Tair, Tf, & Sprofile, Tprofile, & Tsfc, & - nilyr, nslyr, & qin, qsn) - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & Tair, & ! air temperature (K) Tf ! freezing temperature (C) @@ -327,7 +327,7 @@ subroutine icepack_init_trcr(Tair, Tf, & real (kind=dbl_kind) :: & slope, Ti - character(len=*),parameter :: subname='(icepack_init_trcr)' + character(len=*),parameter :: subname='(icepack_init_enthalpy)' ! surface temperature Tsfc = Tf ! default @@ -353,7 +353,7 @@ subroutine icepack_init_trcr(Tair, Tf, & qsn(k) = -rhos*(Lfresh - cp_ice*Ti) enddo ! nslyr - end subroutine icepack_init_trcr + end subroutine icepack_init_enthalpy !======================================================================= !autodocument_start icepack_liquidus_temperature @@ -393,22 +393,28 @@ function icepack_sea_freezing_temperature(sss) result(Tf) character(len=*),parameter :: subname='(icepack_sea_freezing_temperature)' - if (trim(tfrz_option(1:5)) == 'mushy') then + if (trim(tfrz_option) == 'mushy') then Tf = icepack_liquidus_temperature(sss) ! deg C - elseif (trim(tfrz_option(1:11)) == 'linear_salt') then + elseif (trim(tfrz_option) == 'linear_salt') then Tf = -depressT * sss ! deg C - elseif (trim(tfrz_option(1:8)) == 'constant') then + elseif (trim(tfrz_option) == 'constant') then Tf = Tocnfrz - else + elseif (trim(tfrz_option) == 'minus1p8') then Tf = -1.8_dbl_kind + else + + call icepack_warnings_add(subname//' tfrz_option unsupported: '//trim(tfrz_option)) + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif end function icepack_sea_freezing_temperature diff --git a/columnphysics/icepack_therm_vertical.F90 b/columnphysics/icepack_therm_vertical.F90 index 2d0c20cea..a0aa6b84a 100644 --- a/columnphysics/icepack_therm_vertical.F90 +++ b/columnphysics/icepack_therm_vertical.F90 @@ -20,16 +20,20 @@ module icepack_therm_vertical use icepack_kinds - use icepack_parameters, only: c0, c1, p001, p5, puny + + use icepack_fsd, only: floe_rad_c, floe_binwidth + + use icepack_parameters, only: c0, c1, c2, p001, p5, puny use icepack_parameters, only: pi, depressT, Lvap, hs_min, cp_ice, min_salin use icepack_parameters, only: cp_ocn, rhow, rhoi, rhos, Lfresh, rhofresh, ice_ref_salinity use icepack_parameters, only: ktherm, calc_Tsfc, rsnw_fall, rsnw_tmax use icepack_parameters, only: ustar_min, fbot_xfer_type, formdrag, calc_strair use icepack_parameters, only: rfracmin, rfracmax, dpscale, frzpnd, snwgrain, snwlvlfac use icepack_parameters, only: phi_i_mushy, floeshape, floediam, use_smliq_pnd, snwredist - use icepack_parameters, only: saltflux_option + use icepack_parameters, only: saltflux_option, congel_freeze use icepack_parameters, only: icepack_chkoptargflag + use icepack_tracers, only: ncat, nilyr, nslyr, nfsd use icepack_tracers, only: tr_iage, tr_FY, tr_aero, tr_pond, tr_fsd, tr_iso use icepack_tracers, only: tr_pond_lvl, tr_pond_topo use icepack_tracers, only: n_aero, n_iso @@ -46,6 +50,7 @@ module icepack_therm_vertical use icepack_mushy_physics, only: icepack_mushy_temperature_mush use icepack_mushy_physics, only: liquidus_temperature_mush use icepack_mushy_physics, only: icepack_enthalpy_mush, enthalpy_of_melting + use icepack_mushy_physics, only: enthalpy_mush_liquid_fraction, enthalpy_brine use icepack_aerosol, only: update_aerosol use icepack_isotope, only: update_isotope @@ -74,8 +79,7 @@ module icepack_therm_vertical ! authors: William H. Lipscomb, LANL ! C. M. Bitz, UW - subroutine thermo_vertical (nilyr, nslyr, & - dt, aicen, & + subroutine thermo_vertical (dt, aicen, & vicen, vsnon, & Tsf, zSin, & zqin, zqsn, & @@ -85,7 +89,7 @@ subroutine thermo_vertical (nilyr, nslyr, & fsnow, fpond, & fbot, Tbot, & Tsnice, sss, & - rsnw, & + sst, rsnw, & lhcoef, shcoef, & fswsfc, fswint, & Sswabs, Iswabs, & @@ -105,10 +109,6 @@ subroutine thermo_vertical (nilyr, nslyr, & yday, dsnow, & prescribed_ice) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & dt , & ! time step frain ! rainfall rate (kg/m2/s) @@ -164,6 +164,7 @@ subroutine thermo_vertical (nilyr, nslyr, & real (kind=dbl_kind), intent(in) :: & fbot , & ! ice-ocean heat flux at bottom surface (W/m^2) Tbot , & ! ice bottom surface temperature (deg C) + sst , & ! sea surface temperature (C) sss ! ocean salinity ! coupler fluxes to atmosphere @@ -277,8 +278,7 @@ subroutine thermo_vertical (nilyr, nslyr, & ! Compute variables needed for vertical thermo calculation !----------------------------------------------------------------- - call init_vertical_profile (nilyr, nslyr, & - aicen, & + call init_vertical_profile (aicen, & vicen, vsnon, & hin, hilyr, & hsn, hslyr, & @@ -308,7 +308,6 @@ subroutine thermo_vertical (nilyr, nslyr, & if (ktherm == 2) then call temperature_changes_salinity(dt, & - nilyr, nslyr, & rhoa, flw, & potT, Qa, & shcoef, lhcoef, & @@ -331,7 +330,6 @@ subroutine thermo_vertical (nilyr, nslyr, & else ! ktherm call temperature_changes(dt, & - nilyr, nslyr, & rhoa, flw, & potT, Qa, & shcoef, lhcoef, & @@ -383,8 +381,7 @@ subroutine thermo_vertical (nilyr, nslyr, & ! Repartition ice into equal-thickness layers, conserving energy. !----------------------------------------------------------------- - call thickness_changes(nilyr, nslyr, & - dt, yday, & + call thickness_changes(dt, yday, & efinal, & hin, hilyr, & hsn, hslyr, & @@ -403,6 +400,7 @@ subroutine thermo_vertical (nilyr, nslyr, & congel, snoice, & mlt_onset, frz_onset, & zSin, sss, & + sst, & dsnow, rsnw) if (icepack_warnings_aborted(subname)) return @@ -461,8 +459,7 @@ subroutine thermo_vertical (nilyr, nslyr, & ! state variables. !----------------------------------------------------------------- - call update_state_vthermo(nilyr, nslyr, & - Tbot, Tsf, & + call update_state_vthermo(Tbot, Tsf, & hin, hsn, & zqin, zSin, & zqsn, & @@ -481,8 +478,7 @@ end subroutine thermo_vertical ! William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine frzmlt_bottom_lateral (dt, ncat, & - nilyr, nslyr, & + subroutine frzmlt_bottom_lateral (dt, & aice, frzmlt, & vicen, vsnon, & qicen, qsnon, & @@ -491,13 +487,9 @@ subroutine frzmlt_bottom_lateral (dt, ncat, & fbot_xfer_type, & strocnxT, strocnyT, & Tbot, fbot, & - rside, Cdn_ocn, & - fside, wlat) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nslyr ! number of snow layers + rsiden, Cdn_ocn, & + wlat, aicen, & + afsdn) real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -525,14 +517,28 @@ subroutine frzmlt_bottom_lateral (dt, ncat, & real (kind=dbl_kind), intent(out) :: & Tbot , & ! ice bottom surface temperature (deg C) - fbot , & ! heat flux to ice bottom (W/m^2) - rside , & ! fraction of ice that melts laterally - fside ! lateral heat flux (W/m^2) + fbot ! heat flux to ice bottom (W/m^2) + + real (kind=dbl_kind), dimension(:), intent(out) :: & + rsiden ! fraction of ice that melts laterally real (kind=dbl_kind), intent(out), optional :: & wlat ! lateral melt rate (m/s) + real (kind=dbl_kind), dimension(:), intent(in) :: & + aicen ! ice concentration + + real (kind=dbl_kind), dimension (:,:), intent(in), optional :: & + afsdn ! area floe size distribution + ! local variables + real (kind=dbl_kind), dimension (ncat) :: & + delta_an , & ! change in the ITD + G_radialn ! lateral melt rate in FSD (m/s) + + real (kind=dbl_kind) :: & + rside , & ! + fside ! lateral heat flux (W/m^2) integer (kind=int_kind) :: & n , & ! thickness category index @@ -546,6 +552,7 @@ subroutine frzmlt_bottom_lateral (dt, ncat, & real (kind=dbl_kind) :: & deltaT , & ! SST - Tbot >= 0 ustar , & ! skin friction velocity for fbot (m/s) + bin1_arealoss, & xtmp ! temporary variable ! Parameters for bottom melting @@ -567,11 +574,11 @@ subroutine frzmlt_bottom_lateral (dt, ncat, & ! Identify grid cells where ice can melt. !----------------------------------------------------------------- - rside = c0 - fside = c0 + rsiden(:) = c0 Tbot = Tf fbot = c0 wlat_loc = c0 + if (present(wlat)) wlat=c0 if (aice > puny .and. frzmlt < c0) then ! ice can melt @@ -611,10 +618,52 @@ subroutine frzmlt_bottom_lateral (dt, ncat, & rside = wlat_loc*dt*pi/(floeshape*floediam) ! Steele rside = max(c0,min(rside,c1)) + if (rside == c0) return ! nothing more to do so get out + + rsiden(:) = rside + + if (tr_fsd) then ! alter rsiden now since floes are not of size floediam + + do n = 1, ncat + G_radialn(n) = -wlat_loc ! negative + + ! afsdn present check up the calling tree + if (any(afsdn(:,n) < c0)) then + write(warnstr,*) subname, 'lateral_melt B afsd < 0 ',n + call icepack_warnings_add(warnstr) + endif + + bin1_arealoss = -afsdn(1,n) / floe_binwidth(1) ! when scaled by *G_radialn(n)*dt*aicen(n) + + delta_an(n) = c0 + do k = 1, nfsd + ! this is delta_an(n) when scaled by *G_radialn(n)*dt*aicen(n) + delta_an(n) = delta_an(n) + ((c2/floe_rad_c(k)) * afsdn(k,n)) ! delta_an < 0 + end do + + ! add negative area loss from fsd + delta_an(n) = (delta_an(n) - bin1_arealoss)*G_radialn(n)*dt + + if (delta_an(n) > c0) then + write(warnstr,*) subname, 'ERROR delta_an > 0 ',delta_an(n) + call icepack_warnings_add(warnstr) + endif + + ! following original code, not necessary for fsd + if (aicen(n) > c0) rsiden(n) = MIN(-delta_an(n),c1) + + if (rsiden(n) < c0) then + write(warnstr,*) subname, 'ERROR rsiden < 0 ',rsiden(n) + call icepack_warnings_add(warnstr) + endif + enddo ! ncat + + endif ! if tr_fsd + !----------------------------------------------------------------- ! Compute heat flux associated with this value of rside. !----------------------------------------------------------------- - + fside = c0 do n = 1, ncat etot = c0 @@ -629,20 +678,23 @@ subroutine frzmlt_bottom_lateral (dt, ncat, & enddo ! nilyr ! lateral heat flux, fside < 0 - fside = fside + rside*etot/dt + fside = fside + rsiden(n)*etot/dt enddo ! n !----------------------------------------------------------------- ! Limit bottom and lateral heat fluxes if necessary. - ! FYI: fside is not yet correct for fsd, may need to adjust fbot further + ! Limit rside so we don't melt laterally more ice than frzmlt permits !----------------------------------------------------------------- - xtmp = frzmlt/(fbot + fside + puny) + xtmp = frzmlt/(fbot + fside - puny) xtmp = min(xtmp, c1) + xtmp = max(xtmp, c0) fbot = fbot * xtmp - rside = rside * xtmp - fside = fside * xtmp + + do n = 1, ncat + rsiden(n) = rsiden(n) * xtmp ! xtmp is almost always 1 so usually nothing happens here + enddo ! ncat endif @@ -659,8 +711,7 @@ end subroutine frzmlt_bottom_lateral ! authors William H. Lipscomb, LANL ! C. M. Bitz, UW - subroutine init_vertical_profile(nilyr, nslyr, & - aicen, vicen, & + subroutine init_vertical_profile(aicen, vicen, & vsnon, & hin, hilyr, & hsn, hslyr, & @@ -669,10 +720,6 @@ subroutine init_vertical_profile(nilyr, nslyr, & zSin, & einit ) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) @@ -962,21 +1009,18 @@ subroutine init_vertical_profile(nilyr, nslyr, & !----------------------------------------------------------------- if (ktherm /= 2) then - if (zTin(k) > c0) then - zTin(k) = c0 - zqin(k) = -rhoi*Lfresh + zTin(k) = c0 + zqin(k) = -rhoi*Lfresh endif - endif -! echmod: is this necessary? -! if (ktherm == 1) then -! if (zTin(k)>= -zSin(k)*depressT) then -! zTin(k) = -zSin(k)*depressT - puny -! zqin(k) = -rhoi*cp_ocn*zSin(k)*depressT -! endif -! endif + if (ktherm == 1) then + if (zTin(k)>= -zSin(k)*depressT) then + zTin(k) = -zSin(k)*depressT - puny + zqin(k) = -zSin(k)*depressT*rhoi*cp_ocn + endif + endif !----------------------------------------------------------------- ! initial energy per unit area of ice/snow, relative to 0 C @@ -996,8 +1040,7 @@ end subroutine init_vertical_profile ! authors William H. Lipscomb, LANL ! C. M. Bitz, UW - subroutine thickness_changes (nilyr, nslyr, & - dt, yday, & + subroutine thickness_changes (dt, yday, & efinal, & hin, hilyr, & hsn, hslyr, & @@ -1016,12 +1059,9 @@ subroutine thickness_changes (nilyr, nslyr, & congel, snoice, & mlt_onset, frz_onset,& zSin, sss, & + sst, & dsnow, rsnw) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & dt , & ! time step yday ! day of the year @@ -1085,6 +1125,7 @@ subroutine thickness_changes (nilyr, nslyr, & zSin ! ice layer salinity (ppt) real (kind=dbl_kind), intent(in) :: & + sst , & ! sea surface temperature (C) sss ! ocean salinity (PSU) ! local variables @@ -1134,9 +1175,9 @@ subroutine thickness_changes (nilyr, nslyr, & qmlt ! enthalpy of melted ice (J m-3) = zero in BL99 formulation real (kind=dbl_kind) :: & - qbotm , & - qbotp , & - qbot0 , & + qbotm , & ! enthalpy of newly formed congelation ice + qbotp , & ! enthalpy needed to grow new congelation ice (includes ocean enthalpy) + qbotw , & ! enthalpy transferred to ocean during congelation freezing mass , & ! total mass from snow density tracers (kg/m^2) massi , & ! ice mass change factor tmp1 ! temporary scalar @@ -1257,15 +1298,24 @@ subroutine thickness_changes (nilyr, nslyr, & if (ktherm == 2) then - qbotm = icepack_enthalpy_mush(Tbot, sss) - qbotp = -Lfresh * rhoi * (c1 - phi_i_mushy) - qbot0 = qbotm - qbotp - - dhi = ebot_gro / qbotp ! dhi > 0 - - hqtot = dzi(nilyr)*zqin(nilyr) + dhi*qbotm - hstot = dzi(nilyr)*zSin(nilyr) + dhi*sss - emlt_ocn = emlt_ocn - qbot0 * dhi + if (congel_freeze == 'one-step') then + ! Plante et al., The Cryosphere, 18, 1685-1708, 2024 + qbotm = enthalpy_mush_liquid_fraction(Tbot, phi_i_mushy) + qbotw = enthalpy_brine(sst) + qbotp = qbotm - qbotw + dhi = ebot_gro / qbotp ! dhi > 0 + hstot = dzi(nilyr)*zSin(nilyr) + dhi*sss*phi_i_mushy + hqtot = dzi(nilyr)*zqin(nilyr) + dhi*qbotm + emlt_ocn = emlt_ocn - qbotw * dhi + else ! two-step + qbotm = icepack_enthalpy_mush(Tbot, sss) + qbotp = -Lfresh * rhoi * (c1 - phi_i_mushy) + qbotw = qbotm - qbotp + dhi = ebot_gro / qbotp ! dhi > 0 + hstot = dzi(nilyr)*zSin(nilyr) + dhi*sss + hqtot = dzi(nilyr)*zqin(nilyr) + dhi*qbotm + emlt_ocn = emlt_ocn - qbotw * dhi + endif else @@ -1524,7 +1574,7 @@ subroutine thickness_changes (nilyr, nslyr, & !------------------------------------------------------------------- if (ktherm /= 2) & - call freeboard (nslyr, snoice, & + call freeboard (snoice, & hin, hsn, & zqin, zqsn, & dzi, dzs, & @@ -1759,17 +1809,13 @@ end subroutine thickness_changes ! authors William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine freeboard (nslyr, & - snoice, & + subroutine freeboard (snoice, & hin, hsn, & zqin, zqsn, & dzi, dzs, & dsnow, & massice, massliq) - integer (kind=int_kind), intent(in) :: & - nslyr ! number of snow layers - ! real (kind=dbl_kind), intent(in) :: & ! dt ! time step @@ -2002,18 +2048,13 @@ end subroutine conservation_check_vthermo ! C. M. Bitz, UW ! Elizabeth C. Hunke, LANL - subroutine update_state_vthermo(nilyr, nslyr, & - Tf, Tsf, & + subroutine update_state_vthermo(Tf, Tsf, & hin, hsn, & zqin, zSin, & zqsn, & aicen, vicen, & vsnon) - integer (kind=int_kind), intent(in) :: & - nilyr , & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & Tf ! freezing temperature (C) @@ -2073,7 +2114,7 @@ end subroutine update_state_vthermo ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + subroutine icepack_step_therm1(dt, & aicen_init , & vicen_init , vsnon_init , & aice , aicen , & @@ -2112,8 +2153,8 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & strocnxT , strocnyT , & fbot , & Tbot , Tsnice , & - frzmlt , rside , & - fside , wlat , & + frzmlt , rsiden , & + wlat , & fsnow , frain , & fpond , fsloss , & fsurf , fsurfn , & @@ -2160,12 +2201,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & lmask_n , lmask_s , & mlt_onset , frz_onset , & yday , prescribed_ice, & - zlvs) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nslyr ! number of snow layers + zlvs , afsdn) real (kind=dbl_kind), intent(in) :: & dt , & ! time step @@ -2241,8 +2277,6 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & strocnyT , & ! ice-ocean stress, y-direction fbot , & ! ice-ocean heat flux at bottom surface (W/m^2) frzmlt , & ! freezing/melting potential (W/m^2) - rside , & ! fraction of ice that melts laterally - fside , & ! lateral heat flux (W/m^2) sst , & ! sea surface temperature (C) Tf , & ! freezing temperature (C) Tbot , & ! ice bottom surface temperature (deg C) @@ -2255,7 +2289,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & frz_onset ! day of year that freezing begins (congel or frazil) real (kind=dbl_kind), intent(out), optional :: & - wlat ! lateral melt rate (m/s) + wlat ! lateral melt rate (m/s) real (kind=dbl_kind), intent(inout), optional :: & fswthru_vdr , & ! vis dir shortwave penetrating to ocean (W/m^2) @@ -2289,6 +2323,9 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & H2_18O_ocn , & ! ocean concentration of H2_18O (kg/kg) zlvs ! atm level height for scalars (if different than zlvl) (m) + real (kind=dbl_kind), dimension(:,:), intent(in), optional :: & + afsdn ! afsd tracer + real (kind=dbl_kind), dimension(:), intent(inout) :: & aicen_init , & ! fractional area of ice vicen_init , & ! volume per unit area of ice (m) @@ -2304,6 +2341,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & ipnd , & ! melt pond refrozen lid thickness (m) iage , & ! volume-weighted ice age FY , & ! area-weighted first-year ice area + rsiden , & ! fraction of ice that melts laterally fsurfn , & ! net flux to top surface, excluding fcondtop fcondtopn , & ! downward cond flux at top surface (W m-2) fcondbotn , & ! downward cond flux at bottom surface (W m-2) @@ -2323,12 +2361,14 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & melttn , & ! top ice melt (m) meltbn , & ! bottom ice melt (m) congeln , & ! congelation ice growth (m) - snoicen , & ! snow-ice growth (m) - dsnown ! change in snow thickness (m/step-->cm/day) + snoicen ! snow-ice growth (m) real (kind=dbl_kind), dimension(:), intent(in) :: & fswthrun ! SW through ice to ocean (W/m^2) + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & + dsnown ! change in snow thickness (m/step-->cm/day) + real (kind=dbl_kind), dimension(:), intent(in), optional :: & fswthrun_vdr , & ! vis dir SW through ice to ocean (W/m^2) fswthrun_vdf , & ! vis dif SW through ice to ocean (W/m^2) @@ -2404,6 +2444,8 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & l_fswthrun_vdf, & ! vis dif SW local n ice to ocean (W/m^2) l_fswthrun_idr, & ! nir dir SW local n ice to ocean (W/m^2) l_fswthrun_idf, & ! nir dif SW local n ice to ocean (W/m^2) + l_dsnow, & ! local snow change + l_dsnown, & ! local snow change category l_meltsliq ! mass of snow melt local (kg/m^2) real (kind=dbl_kind) :: & @@ -2447,9 +2489,20 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & call icepack_warnings_setabort(.true.,__FILE__,__LINE__) return endif + if ((present(dsnow) .and. .not.present(dsnown)) .or. & + (present(dsnown) .and. .not.present(dsnow))) then + call icepack_warnings_add(subname//' error in dsnow arguments') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif if (tr_fsd) then - if (.not.(present(wlat))) then - call icepack_warnings_add(subname//' error in FSD arguments, tr_fsd=T') + if (.not.present(afsdn)) then + call icepack_warnings_add(subname//' error missing afsdn argument, tr_fsd=T') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + return + endif + if (size(afsdn,dim=1) /= nfsd .or. size(afsdn,dim=2) /= ncat) then + call icepack_warnings_add(subname//' error size of afsdn argument, tr_fsd=T') call icepack_warnings_setabort(.true.,__FILE__,__LINE__) return endif @@ -2466,6 +2519,8 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & l_meltsliq = c0 l_meltsliqn = c0 + l_dsnow = c0 + if (present(dsnow)) l_dsnow = dsnow ! solid and liquid components of snow mass massicen(:,:) = c0 @@ -2495,22 +2550,6 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & fsnow = fsnow*(c1-worka) endif ! snwredist -!echmod - remove all of this code - non-BFB because of values carried in tracer arrays when the snow physics options are not active - !----------------------------------------------------------------- - ! solid and liquid components of snow mass - !----------------------------------------------------------------- -! massicen(:,:) = c0 -! massliqn(:,:) = c0 -! if (snwgrain) then -! rnslyr = c1 / real(nslyr, dbl_kind) -! do n = 1, ncat -! do k = 1, nslyr -! massicen(k,n) = smicen(k,n) * vsnon(n) * rnslyr ! kg/m^2 -! massliqn(k,n) = smliqn(k,n) * vsnon(n) * rnslyr -! enddo -! enddo -! endif - !----------------------------------------------------------------- ! Update the neutral drag coefficients to account for form drag ! Oceanic and atmospheric drag coefficients @@ -2531,18 +2570,17 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & hdraft , hridge , & distrdg , hkeel , & dkeel , lfloe , & - dfloe , ncat) + dfloe) if (icepack_warnings_aborted(subname)) return endif !----------------------------------------------------------------- - ! Adjust frzmlt to account for ice-ocean heat fluxes since last + ! Use frzmlt to account for ice-ocean heat fluxes since last ! call to coupler. ! Compute lateral and bottom heat fluxes. !----------------------------------------------------------------- - call frzmlt_bottom_lateral (dt, ncat, & - nilyr, nslyr, & + call frzmlt_bottom_lateral (dt, & aice, frzmlt, & vicen, vsnon, & zqin, zqsn, & @@ -2551,8 +2589,9 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & fbot_xfer_type, & strocnxT, strocnyT, & Tbot, fbot, & - rside, Cdn_ocn, & - fside, wlat) + rsiden, Cdn_ocn, & + wlat, aicen, & + afsdn) if (icepack_warnings_aborted(subname)) return @@ -2562,7 +2601,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & meltbn (n) = c0 congeln(n) = c0 snoicen(n) = c0 - dsnown (n) = c0 + l_dsnown = c0 Trefn = c0 Qrefn = c0 @@ -2661,8 +2700,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & smliq(:) = smliqn(:,n) endif - call thermo_vertical(nilyr=nilyr, nslyr=nslyr, & - dt=dt, aicen=aicen (n), & + call thermo_vertical(dt=dt, aicen=aicen (n), & vicen=vicen (n), vsnon=vsnon (n), & Tsf=Tsfc (n), zSin=zSin (:,n), & zqin=zqin (:,n), zqsn=zqsn (:,n), & @@ -2672,7 +2710,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & fsnow=fsnow, fpond=fpond, & fbot=fbot, Tbot=Tbot, & Tsnice=Tsnice, sss=sss, & - rsnw=rsnw, & + sst=sst, rsnw=rsnw, & lhcoef=lhcoef, shcoef=shcoef, & fswsfc=fswsfcn (n), fswint=fswintn (n), & Sswabs=Sswabsn(:,n), Iswabs=Iswabsn (:,n), & @@ -2688,8 +2726,8 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & smice=smice, massice=massicen (:,n), & smliq=smliq, massliq=massliqn (:,n), & congel=congeln (n), snoice=snoicen (n), & - mlt_onset=mlt_onset, frz_onset=frz_onset, & - yday=yday, dsnow=dsnown (n), & + mlt_onset=mlt_onset, frz_onset=frz_onset , & + yday=yday, dsnow=l_dsnown , & prescribed_ice=prescribed_ice) if (icepack_warnings_aborted(subname)) then @@ -2716,7 +2754,6 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & if (tr_aero) then call update_aerosol (dt, & - nilyr, nslyr, n_aero, & melttn (n), meltsn (n), & meltbn (n), congeln (n), & snoicen (n), fsnow, & @@ -2731,7 +2768,6 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & if (tr_iso) then call update_isotope (dt = dt, & - nilyr = nilyr, nslyr = nslyr, & meltt = melttn(n),melts = meltsn(n), & meltb = meltbn(n),congel=congeln(n), & snoice=snoicen(n),evap=evapn, & @@ -2756,8 +2792,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & endif ! aicen_init if (snwgrain) then - call drain_snow (nslyr = nslyr, & - vsnon = vsnon(n), & + call drain_snow (vsnon = vsnon(n), & aicen = aicen(n), & massice = massicen(:,n), & massliq = massliqn(:,n), & @@ -2880,7 +2915,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & meltbn=meltbn (n), congeln=congeln(n),& meltt=meltt, melts=melts, & meltb=meltb, snoicen=snoicen(n),& - dsnow=dsnow, dsnown=dsnown(n), & + dsnow=l_dsnow, dsnown=l_dsnown, & congel=congel, snoice=snoice, & meltsliq=l_meltsliq, & meltsliqn=l_meltsliqn(n), & @@ -2896,6 +2931,8 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & endif + if (present(dsnown )) dsnown(n) = l_dsnown + enddo ! ncat !----------------------------------------------------------------- @@ -2921,18 +2958,19 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & if (present(meltsliqn )) meltsliqn = l_meltsliqn if (present(meltsliq )) meltsliq = l_meltsliq + if (present(dsnow )) dsnow = l_dsnow !----------------------------------------------------------------- ! Calculate ponds from the topographic scheme !----------------------------------------------------------------- !call ice_timer_start(timer_ponds) if (tr_pond_topo) then - call compute_ponds_topo(dt, ncat, nilyr, & + call compute_ponds_topo(dt, & ktherm, & aice, aicen, & vice, vicen, & vsno, vsnon, & - meltt, & + meltt, & fsurf, fpond, & Tsfc, Tf, & zqin, zSin, & diff --git a/columnphysics/icepack_tracers.F90 b/columnphysics/icepack_tracers.F90 index 3057ad57b..fc3fafa8b 100644 --- a/columnphysics/icepack_tracers.F90 +++ b/columnphysics/icepack_tracers.F90 @@ -7,7 +7,7 @@ module icepack_tracers use icepack_kinds - use icepack_parameters, only: c0, c1, puny, rhos, rsnw_fall, rhosnew, Tocnfrz, tfrz_option + use icepack_parameters, only: c0, c1, puny, rhos, rsnw_fall, rhosnew use icepack_parameters, only: snwredist, snwgrain use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -31,15 +31,14 @@ module icepack_tracers !----------------------------------------------------------------- integer (kind=int_kind), parameter, public :: & max_iso = 3 , & ! maximum number of isotopes + nmodal1 = 10 , & ! dimension for modal aerosol radiation parameters + nmodal2 = 8 , & ! dimension for modal aerosol radiation parameters max_algae = 3 , & ! maximum number of algal types max_dic = 1 , & ! maximum number of dissolved inorganic carbon types max_doc = 3 , & ! maximum number of dissolved organic carbon types max_don = 1 , & ! maximum number of dissolved organic nitrogen types max_fe = 2 , & ! maximum number of iron types - nmodal1 = 10 , & ! dimension for modal aerosol radiation parameters - nmodal2 = 8 , & ! dimension for modal aerosol radiation parameters max_aero = 6 , & ! maximum number of aerosols - max_nbtrcr = max_algae*2 & ! algal nitrogen and chlorophyll + max_dic & ! dissolved inorganic carbon + max_doc & ! dissolved organic carbon @@ -1198,15 +1197,12 @@ end subroutine icepack_write_tracer_sizes ! Compute tracer fields. ! Given atrcrn = aicen*trcrn (or vicen*trcrn, vsnon*trcrn), compute trcrn. - subroutine icepack_compute_tracers (ntrcr, trcr_depend, & + subroutine icepack_compute_tracers (trcr_depend, & atrcrn, aicen, & vicen, vsnon, & trcr_base, n_trcr_strata, & nt_strata, trcrn, Tf) - integer (kind=int_kind), intent(in) :: & - ntrcr ! number of tracers in use - integer (kind=int_kind), dimension (ntrcr), intent(in) :: & trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon n_trcr_strata ! number of underlying tracer layers @@ -1265,16 +1261,7 @@ subroutine icepack_compute_tracers (ntrcr, trcr_depend, & else trcrn(it) = c0 if (it == nt_Tsfc) then -! tcraig, these old options should be deprecated -! exist for bit-for-bit backwards compatibility in testing - if (tfrz_option == "mushy_old" .or. & - tfrz_option == "linear_salt_old" .or. & - tfrz_option == "constant_old" .or. & - tfrz_option == "minus1p8_old") then - trcrn(it) = Tocnfrz ! surface temperature - else - trcrn(it) = Tf ! surface temperature - endif + trcrn(it) = Tf ! surface temperature endif endif diff --git a/columnphysics/icepack_warnings.F90 b/columnphysics/icepack_warnings.F90 index 459f2dc80..76858e9a1 100644 --- a/columnphysics/icepack_warnings.F90 +++ b/columnphysics/icepack_warnings.F90 @@ -1,8 +1,20 @@ module icepack_warnings - use icepack_kinds +! Provides a logging and abort package for Icepack. +! Icepack has no idea about MPI, OpenMP, or IO. +! Store error message and provide methods for the driver +! to write these messages to a Fortran unit number. +! Needs to be thread safe. This could be called within +! a threaded or non-threaded region or both. Need to make +! sure multiple threads are not adding to the warnings +! buffer at the same time. Also need to make sure warnings +! buffers are not added at the same time messages are +! cleared by a different thread. Use multiple critical +! regions using the same ID to allow threads to block +! each other during multiple operations. + use icepack_kinds implicit none private @@ -10,7 +22,7 @@ module icepack_warnings ! warning messages character(len=char_len_long), dimension(:), allocatable :: warnings integer :: nWarnings = 0 - integer, parameter :: nWarningsBuffer = 10 ! incremental number of messages + integer :: nWarningsBuffer = 10 ! incremental number of messages ! abort flag, accessed via icepack_warnings_setabort and icepack_warnings_aborted logical :: warning_abort = .false. @@ -30,6 +42,10 @@ module icepack_warnings private :: & icepack_warnings_getone +! variables are shared by default +! have warnstr be private +!$OMP THREADPRIVATE(warnstr) + !======================================================================= contains @@ -68,9 +84,15 @@ subroutine icepack_warnings_setabort(abortflag,file,line) if (abortflag) then write(warnstr,*) subname,abortflag - if (present(file)) write(warnstr,*) trim(warnstr)//' :file '//trim(file) - if (present(line)) write(warnstr,*) trim(warnstr)//' :line ',line call icepack_warnings_add(warnstr) + if (present(file)) then + write(warnstr,*) trim(warnstr)//' :file '//trim(file) + call icepack_warnings_add(warnstr) + endif + if (present(line)) then + write(warnstr,*) trim(warnstr)//' :line ',line + call icepack_warnings_add(warnstr) + endif endif warning_abort = abortflag @@ -127,14 +149,9 @@ subroutine icepack_warnings_print(iounit) integer :: iWarning character(len=*),parameter :: subname='(icepack_warnings_print)' -! tcraig -! this code intermittenly aborts on recursive IO errors with intel -! not sure if it's OMP or something else causing this -!$OMP MASTER do iWarning = 1, nWarnings write(iounit,*) trim(icepack_warnings_getone(iWarning)) enddo -!$OMP END MASTER end subroutine icepack_warnings_print @@ -150,10 +167,12 @@ subroutine icepack_warnings_flush(iounit) character(len=*),parameter :: subname='(icepack_warnings_flush)' +!$OMP CRITICAL (omp_warnings) if (nWarnings > 0) then call icepack_warnings_print(iounit) endif call icepack_warnings_clear() +!$OMP END CRITICAL (omp_warnings) end subroutine icepack_warnings_flush @@ -171,7 +190,7 @@ subroutine icepack_warnings_add(warning) iWarning ! warning index character(len=*),parameter :: subname='(icepack_warnings_add)' -!$OMP CRITICAL (omp_warnings_add) +!$OMP CRITICAL (omp_warnings) ! check if warnings array is not allocated if (.not. allocated(warnings)) then @@ -181,7 +200,6 @@ subroutine icepack_warnings_add(warning) ! set initial number of nWarnings nWarnings = 0 - ! already allocated else ! find the size of the warnings array at the start @@ -210,16 +228,18 @@ subroutine icepack_warnings_add(warning) ! deallocate the temporary storage deallocate(warningsTmp) + ! increase nWarningsBuffer for next reallocation + nWarningsBuffer = nWarningsBuffer * 2 endif endif ! increase warning number nWarnings = nWarnings + 1 -!$OMP END CRITICAL (omp_warnings_add) ! add the new warning warnings(nWarnings) = trim(warning) +!$OMP END CRITICAL (omp_warnings) end subroutine icepack_warnings_add diff --git a/columnphysics/icepack_wavefracspec.F90 b/columnphysics/icepack_wavefracspec.F90 index 540ab6722..34c4e448f 100644 --- a/columnphysics/icepack_wavefracspec.F90 +++ b/columnphysics/icepack_wavefracspec.F90 @@ -31,7 +31,7 @@ module icepack_wavefracspec use icepack_kinds use icepack_parameters, only: p01, p5, c0, c1, c2, c3, c4, c10 use icepack_parameters, only: bignum, puny, gravit, pi - use icepack_tracers, only: nt_fsd + use icepack_tracers, only: nt_fsd, ncat, nfsd use icepack_warnings, only: warnstr, icepack_warnings_add, icepack_warnings_aborted use icepack_fsd @@ -128,12 +128,9 @@ end subroutine icepack_init_wave ! ! authors: 2017 Lettie Roach, NIWA/VUW ! - function get_dafsd_wave(nfsd, afsd_init, fracture_hist, frac) & + function get_dafsd_wave(afsd_init, fracture_hist, frac) & result(d_afsd) - integer (kind=int_kind), intent(in) :: & - nfsd ! number of floe size categories - real (kind=dbl_kind), dimension (:), intent(in) :: & afsd_init, fracture_hist @@ -183,21 +180,17 @@ end function get_dafsd_wave ! authors: 2018 Lettie Roach, NIWA/VUW ! subroutine icepack_step_wavefracture(wave_spec_type, & - dt, ncat, nfsd, & - nfreq, & + dt, nfreq, & aice, vice, aicen, & - floe_rad_l, floe_rad_c, & wave_spectrum, wavefreq, dwavefreq, & trcrn, d_afsd_wave) character (len=char_len), intent(in) :: & - wave_spec_type ! type of wave spectrum forcing + wave_spec_type ! type of wave spectrum forcing integer (kind=int_kind), intent(in) :: & - nfreq, & ! number of wave frequency categories - ncat, & ! number of thickness categories - nfsd ! number of floe size categories + nfreq ! number of wave frequency categories real (kind=dbl_kind), intent(in) :: & dt, & ! time step @@ -207,10 +200,6 @@ subroutine icepack_step_wavefracture(wave_spec_type, & real (kind=dbl_kind), dimension(ncat), intent(in) :: & aicen ! ice area fraction (categories) - real(kind=dbl_kind), dimension(:), intent(in) :: & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c ! fsd size bin centre in m (radius) - real (kind=dbl_kind), dimension (:), intent(in) :: & wavefreq, & ! wave frequencies (s^-1) dwavefreq ! wave frequency bin widths (s^-1) @@ -249,6 +238,9 @@ subroutine icepack_step_wavefracture(wave_spec_type, & afsd_tmp , & ! tracer array d_afsd_tmp ! change + real (kind=dbl_kind) :: & + local_sig_ht + character(len=*),parameter :: & subname='(icepack_step_wavefracture)' @@ -262,15 +254,15 @@ subroutine icepack_step_wavefracture(wave_spec_type, & ! if all ice is not in first floe size category if (.NOT. ALL(trcrn(nt_fsd,:).ge.c1-puny)) then - + local_sig_ht = c4*SQRT(SUM(wave_spectrum(:)*dwavefreq(:))) ! do not try to fracture for minimal ice concentration or zero wave spectrum - if ((aice > p01).and.(MAXVAL(wave_spectrum(:)) > puny)) then +! if ((aice > p01).and.(MAXVAL(wave_spectrum(:)) > puny)) then + if ((aice > p01).and.(local_sig_ht>0.1_dbl_kind)) then hbar = vice / aice ! calculate fracture histogram - call wave_frac(nfsd, nfreq, wave_spec_type, & - floe_rad_l, floe_rad_c, & + call wave_frac(nfreq, wave_spec_type, & wavefreq, dwavefreq, & hbar, wave_spectrum, fracture_hist) @@ -279,7 +271,7 @@ subroutine icepack_step_wavefracture(wave_spec_type, & ! if fracture occurs if (MAXVAL(fracture_hist) > puny) then ! protect against small numerical errors - call icepack_cleanup_fsd (ncat, nfsd, trcrn(nt_fsd:nt_fsd+nfsd-1,:) ) + call icepack_cleanup_fsd (trcrn(nt_fsd:nt_fsd+nfsd-1,:) ) if (icepack_warnings_aborted(subname)) return do n = 1, ncat @@ -312,7 +304,7 @@ subroutine icepack_step_wavefracture(wave_spec_type, & if (afsd_tmp(1).ge.c1-puny) EXIT ! calculate d_afsd using current afstd - d_afsd_tmp = get_dafsd_wave(nfsd, afsd_tmp, fracture_hist, frac) + d_afsd_tmp = get_dafsd_wave(afsd_tmp, fracture_hist, frac) ! check in case wave fracture struggles to converge if (nsubt>100) then @@ -322,7 +314,7 @@ subroutine icepack_step_wavefracture(wave_spec_type, & endif ! required timestep - subdt = get_subdt_fsd(nfsd, afsd_tmp, d_afsd_tmp) + subdt = get_subdt_fsd(afsd_tmp, d_afsd_tmp) subdt = MIN(subdt, dt) ! update afsd @@ -367,7 +359,7 @@ subroutine icepack_step_wavefracture(wave_spec_type, & ! update trcrn trcrn(nt_fsd:nt_fsd+nfsd-1,n) = afsd_tmp/SUM(afsd_tmp) - call icepack_cleanup_fsd (ncat, nfsd, trcrn(nt_fsd:nt_fsd+nfsd-1,:) ) + call icepack_cleanup_fsd (trcrn(nt_fsd:nt_fsd+nfsd-1,:) ) if (icepack_warnings_aborted(subname)) return ! for diagnostics @@ -398,13 +390,11 @@ end subroutine icepack_step_wavefracture ! ! authors: 2018 Lettie Roach, NIWA/VUW - subroutine wave_frac(nfsd, nfreq, wave_spec_type, & - floe_rad_l, floe_rad_c, & + subroutine wave_frac(nfreq, wave_spec_type, & wavefreq, dwavefreq, & hbar, spec_efreq, frac_local) integer (kind=int_kind), intent(in) :: & - nfsd, & ! number of floe size categories nfreq ! number of wave frequency categories character (len=char_len), intent(in) :: & @@ -413,10 +403,6 @@ subroutine wave_frac(nfsd, nfreq, wave_spec_type, & real (kind=dbl_kind), intent(in) :: & hbar ! mean ice thickness (m) - real(kind=dbl_kind), dimension(:), intent(in) :: & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c ! fsd size bin centre in m (radius) - real (kind=dbl_kind), dimension (:), intent(in) :: & wavefreq, & ! wave frequencies (s^-1) dwavefreq, & ! wave frequency bin widths (s^-1) diff --git a/columnphysics/icepack_zbgc.F90 b/columnphysics/icepack_zbgc.F90 index 928b4ca65..1cb7a6c34 100644 --- a/columnphysics/icepack_zbgc.F90 +++ b/columnphysics/icepack_zbgc.F90 @@ -9,24 +9,42 @@ module icepack_zbgc use icepack_kinds - use icepack_parameters, only: c0, c1, c2, p001, p1, p5, puny - use icepack_parameters, only: depressT, rhosi, min_salin, salt_loss - use icepack_parameters, only: fr_resp, algal_vel, R_dFe2dust, dustFe_sol, T_max - use icepack_parameters, only: op_dep_min, fr_graze_s, fr_graze_e, fr_mort2min, fr_dFe - use icepack_parameters, only: k_nitrif, t_iron_conv, max_loss, max_dfe_doc1 - use icepack_parameters, only: fr_resp_s, y_sk_DMS, t_sk_conv, t_sk_ox - use icepack_parameters, only: scale_bgc, ktherm, skl_bgc - use icepack_parameters, only: z_tracers, fsal, conserv_check - - use icepack_tracers, only: nt_sice, bio_index + use icepack_parameters + + !use icepack_parameters, only: c0, c1, c2, p001, p1, p5, puny + !use icepack_parameters, only: depressT, rhosi, min_salin, salt_loss + !use icepack_parameters, only: fr_resp, algal_vel, R_dFe2dust, dustFe_sol, T_max + !use icepack_parameters, only: op_dep_min, fr_graze_s, fr_graze_e, fr_mort2min, fr_dFe + !use icepack_parameters, only: k_nitrif, t_iron_conv, max_loss, max_dfe_doc1 + !use icepack_parameters, only: fr_resp_s, y_sk_DMS, t_sk_conv, t_sk_ox + !use icepack_parameters, only: scale_bgc, ktherm, skl_bgc + !use icepack_parameters, only: z_tracers, fsal, conserv_check + + use icepack_tracers, only: max_algae, max_dic, max_doc, max_don, max_fe + use icepack_tracers, only: max_aero, max_nbtrcr + use icepack_tracers, only: ncat, nilyr, nslyr, nblyr, nbtrcr, ntrcr, ntrcr_o use icepack_tracers, only: tr_brine, nt_fbri, nt_qice, nt_Tsfc - use icepack_tracers, only: nt_zbgc_frac - use icepack_tracers, only: bio_index_o, bio_index + use icepack_tracers, only: tr_zaero, tr_bgc_Nit, tr_bgc_N + use icepack_tracers, only: tr_bgc_DON, tr_bgc_C, tr_bgc_chl + use icepack_tracers, only: tr_bgc_Am, tr_bgc_Sil, tr_bgc_DMS + use icepack_tracers, only: tr_bgc_Fe, tr_bgc_hum, tr_bgc_PON + use icepack_tracers, only: nt_bgc_Nit, nlt_bgc_Nit + use icepack_tracers, only: nt_bgc_N, nlt_bgc_N, nt_bgc_Am, nlt_bgc_Am + use icepack_tracers, only: nt_bgc_DMSPp, nlt_bgc_DMSPp, nt_bgc_Sil, nlt_bgc_Sil + use icepack_tracers, only: nt_bgc_DMSPd, nlt_bgc_DMSPd, nt_bgc_DMS, nlt_bgc_DMS + use icepack_tracers, only: nt_bgc_hum, nlt_bgc_hum, nt_bgc_PON, nlt_bgc_PON + use icepack_tracers, only: nt_bgc_C, nlt_bgc_C, nt_bgc_chl, nlt_bgc_chl + use icepack_tracers, only: nt_bgc_DOC, nlt_bgc_DOC, nt_bgc_DON, nlt_bgc_DON + use icepack_tracers, only: nt_bgc_DIC, nlt_bgc_DIC, nt_bgc_Fed, nlt_bgc_Fed + use icepack_tracers, only: nt_sice, bio_index, bio_index_o + use icepack_tracers, only: nt_zaero, nlt_zaero, nt_bgc_Fep, nlt_bgc_Fep + use icepack_tracers, only: nlt_zaero_sw, nlt_chl_sw, nt_zbgc_frac + use icepack_tracers, only: n_algae, n_doc, n_dic, n_don, n_fed, n_fep, n_zaero use icepack_zbgc_shared, only: zbgc_init_frac use icepack_zbgc_shared, only: zbgc_frac_init + use icepack_zbgc_shared, only: bgrid, cgrid, igrid, icgrid use icepack_zbgc_shared, only: bgc_tracer_type, remap_zbgc - use icepack_zbgc_shared, only: regrid_stationary use icepack_zbgc_shared, only: R_S2N, R_Si2N, R_Fe2C, R_Fe2N, R_Fe2DON, R_Fe2DOC use icepack_zbgc_shared, only: chlabs, alpha2max_low, beta2max use icepack_zbgc_shared, only: mu_max, grow_Tdep, fr_graze @@ -35,7 +53,10 @@ module icepack_zbgc use icepack_zbgc_shared, only: f_don, kn_bac, f_don_Am, f_doc use icepack_zbgc_shared, only: f_exude, k_bac use icepack_zbgc_shared, only: tau_ret, tau_rel - use icepack_zbgc_shared, only: R_C2N, R_CHL2N, f_abs_chl, R_C2N_DON + use icepack_zbgc_shared, only: R_C2N, R_chl2N, f_abs_chl, R_C2N_DON + use icepack_zbgc_shared, only: doc_pool_fractions + use icepack_zbgc_shared, only: algaltype, doctype, dictype + use icepack_zbgc_shared, only: dontype, fedtype, feptype, zaerotype use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -65,54 +86,34 @@ module icepack_zbgc ! Adjust biogeochemical tracers when new frazil ice forms - subroutine add_new_ice_bgc (dt, nblyr, & - ncat, nilyr, nltrcr, & - bgrid, cgrid, igrid, & + subroutine add_new_ice_bgc (dt, ncats, & aicen_init, vicen_init, vi0_init, & - aicen, vicen, vsnon1, & - vi0new, & - ntrcr, trcrn, nbtrcr, & - sss, ocean_bio, flux_bio, & - hsurp) + aicen, vicen, vin0new, & + trcrn, & + ocean_bio, flux_bio, hsurp, & + d_an_tot) integer (kind=int_kind), intent(in) :: & - nblyr , & ! number of bio layers - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nltrcr , & ! number of zbgc tracers - nbtrcr , & ! number of biology tracers - ntrcr ! number of tracers in use - - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bgrid ! biology nondimensional vertical grid points - - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: & - cgrid ! CICE vertical coordinate + ncats ! 1 without floe size distribution or ncat real (kind=dbl_kind), intent(in) :: & dt ! time step (s) real (kind=dbl_kind), dimension (:), intent(in) :: & aicen_init , & ! initial concentration of ice - vicen_init , & ! intiial volume per unit area of ice (m) + vicen_init , & ! initial volume per unit area of ice (m) aicen , & ! concentration of ice - vicen ! volume per unit area of ice (m) - - real (kind=dbl_kind), intent(in) :: & - vsnon1 ! category 1 snow volume per unit area (m) + vicen , & ! volume per unit area of ice (m) + d_an_tot real (kind=dbl_kind), dimension (:,:), intent(inout) :: & trcrn ! ice tracers - real (kind=dbl_kind), intent(in) :: & - sss !sea surface salinity (ppt) + real (kind=dbl_kind), dimension (:), intent(in) :: & + vin0new ! ice tracers real (kind=dbl_kind), intent(in) :: & - vi0_init , & ! volume of new ice added to cat 1 (intial) - vi0new ! volume of new ice added to cat 1 + vi0_init ! volume of new ice added to cat 1 (intial) real (kind=dbl_kind), intent(in) :: & hsurp ! thickness of new ice added to each cat @@ -127,8 +128,10 @@ subroutine add_new_ice_bgc (dt, nblyr, & integer (kind=int_kind) :: & location , & ! 1 (add frazil to bottom), 0 (add frazil throughout) + m , & ! bio index n , & ! ice category index - k ! ice layer index + k , & ! ice layer index + nbiolayer real (kind=dbl_kind) :: & vbri1 , & ! starting volume of existing brine @@ -143,7 +146,8 @@ subroutine add_new_ice_bgc (dt, nblyr, & vbrin ! trcrn(nt_fbri,n)*vicen(n) real (kind=dbl_kind) :: & - vice_new ! vicen_init + vsurp + vice_new , & ! vicen_init + vsurp + bio0new ! ocean_bio * zbgc_init_fac real (kind=dbl_kind) :: & Tmlts ! melting temperature (oC) @@ -153,9 +157,15 @@ subroutine add_new_ice_bgc (dt, nblyr, & character(len=*),parameter :: subname='(add_new_ice_bgc)' + real (kind=dbl_kind), dimension (nblyr+1) :: & + zspace ! vertical grid spacing !----------------------------------------------------------------- ! brine !----------------------------------------------------------------- + + zspace(:) = c1/real(nblyr,kind=dbl_kind) + zspace(1) = p5*zspace(2) + zspace(nblyr+1) = zspace(1) vbrin(:) = c0 do n = 1, ncat vbrin(n) = vicen_init(n) @@ -190,67 +200,57 @@ subroutine add_new_ice_bgc (dt, nblyr, & vsurp = hsurp * aicen_init(n) vbrin(n) = vbrin(n) + vsurp vice_new = vicen_init(n) + vsurp - if (tr_brine .and. vicen(n) > c0) then - trcrn(nt_fbri,n) = vbrin(n)/vicen(n) + + if (tr_brine .and. vice_new > puny) then !c0) then + trcrn(nt_fbri,n) = vbrin(n)/vice_new elseif (tr_brine .and. vicen(n) <= c0) then trcrn(nt_fbri,n) = c1 endif - if (nltrcr > 0) then - location = 1 - call adjust_tracer_profile(nbtrcr, dt, ntrcr, & - aicen_init(n), & - vbrin(n), & - vice_new, & - trcrn(:,n), & - vtmp, & - vsurp, sss, & - nilyr, nblyr, & - bgrid, & - cgrid, & - ocean_bio, igrid, & - location) + if (nbtrcr > 0) then + do m = 1, nbtrcr + bio0new = ocean_bio(m)*zbgc_init_frac(m) + nbiolayer = nblyr+1 + call update_vertical_bio_tracers(nbiolayer, trcrn(bio_index(m):bio_index(m) + nblyr,n), & + vtmp, vbrin(n), bio0new,zspace(:)) + enddo !nbtrcr if (icepack_warnings_aborted(subname)) return - endif ! nltrcr + endif ! nbtrcr endif ! hsurp > 0 enddo ! n !----------------------------------------------------------------- ! Combine bgc in new ice grown in open water with category 1 ice. !----------------------------------------------------------------- + do n = 1, ncats + if (vin0new(n) > c0 .and. d_an_tot(n) > c0) then - if (vi0new > c0) then - - vbri1 = vbrin(1) - vbrin(1) = vbrin(1) + vi0new - if (tr_brine .and. vicen(1) > c0) then - trcrn(nt_fbri,1) = vbrin(1)/vicen(1) - elseif (tr_brine .and. vicen(1) <= c0) then - trcrn(nt_fbri,1) = c1 + vbri1 = vbrin(n) + vbrin(n) = vbrin(n) + vin0new(n) + if (tr_brine .and. vicen(n) > puny) then + trcrn(nt_fbri,n) = vbrin(n)/vicen(n) + elseif (tr_brine .and. vicen(n) <= puny) then + trcrn(nt_fbri,n) = c1 endif ! Diffuse_bio handles concentration changes from ice growth/melt ! ice area changes ! add salt throughout, location = 0 - if (nltrcr > 0) then - location = 0 - call adjust_tracer_profile(nbtrcr, dt, ntrcr, & - aicen(1), & - vbrin(1), & - vicen(1), & - trcrn(:,1), & - vbri1, & - vi0new, sss, & - nilyr, nblyr, & - bgrid, & - cgrid, & - ocean_bio, igrid, & - location) + if (nbtrcr > 0 .and. vbrin(n) > puny) then + do m = 1, nbtrcr + bio0new = ocean_bio(m)*zbgc_init_frac(m) + do k = 1, nblyr+1 + trcrn(bio_index(m) + k-1,n) = & + (trcrn(bio_index(m) + k-1,n)*vbri1 + bio0new * vin0new(n))/vbrin(n) + enddo + enddo + if (icepack_warnings_aborted(subname)) return - endif ! nltrcr > 0 - endif ! vi0new > 0 + endif ! nbtrcr > 0 + endif ! vin0new(n) > 0 + enddo ! n = 1,ncats if (tr_brine .and. conserv_check) then call column_sum (ncat, vbrin, vbri_final) @@ -270,196 +270,62 @@ end subroutine add_new_ice_bgc ! When sea ice melts laterally, flux bgc to ocean - subroutine lateral_melt_bgc (dt, & - ncat, nblyr, & - rside, vicen, & - trcrn, & - flux_bio, nbltrcr) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nblyr , & ! number of bio layers - nbltrcr ! number of biology tracers + subroutine lateral_melt_bgc (dt, & + rsiden, vicen_init,& + trcrn, flux_bio) real (kind=dbl_kind), intent(in) :: & dt ! time step (s) real (kind=dbl_kind), dimension(:), intent(in) :: & - vicen ! volume per unit area of ice (m) + vicen_init! volume per unit area of ice (m) real (kind=dbl_kind), dimension (:,:), intent(in) :: & trcrn ! tracer array - real (kind=dbl_kind), intent(in) :: & - rside ! fraction of ice that melts laterally + real (kind=dbl_kind), dimension(:), intent(in) :: & + rsiden ! fraction of ice that melts laterally real (kind=dbl_kind), dimension(:), intent(inout) :: & flux_bio ! biology tracer flux from layer bgc (mmol/m^2/s) ! local variables + real (kind=dbl_kind) :: & + total_bio_initial, & ! initial column tracer concentration (mmol/m2) + total_bio_final ! final column tracer concentration (mmol/m20 + integer (kind=int_kind) :: & k , & ! layer index m , & ! n ! category index - real (kind=dbl_kind) :: & - zspace ! bio grid spacing + real (kind=dbl_kind), dimension (nblyr+1) :: & + zspace ! vertical grid spacing character(len=*),parameter :: subname='(lateral_melt_bgc)' - zspace = c1/(real(nblyr,kind=dbl_kind)) + zspace(:) = c1/real(nblyr,kind=dbl_kind) + zspace(1) = p5*zspace(2) + zspace(nblyr+1) = zspace(1) - do m = 1, nbltrcr + do m = 1, nbtrcr do n = 1, ncat do k = 1, nblyr+1 flux_bio(m) = flux_bio(m) + trcrn(nt_fbri,n) & - * vicen(n)*zspace*trcrn(bio_index(m)+k-1,n) & - * rside/dt + * vicen_init(n)*zspace(k)*trcrn(bio_index(m)+k-1,n) & + * rsiden(n)/dt enddo enddo enddo end subroutine lateral_melt_bgc -!======================================================================= -! -! Add new ice tracers to the ice bottom and adjust the vertical profile -! -! author: Nicole Jeffery, LANL - - subroutine adjust_tracer_profile (nbtrcr, dt, ntrcr, & - aicen, vbrin, & - vicen, trcrn, & - vtmp, & - vsurp, sss, & - nilyr, nblyr, & - bgrid, & - cgrid, ocean_bio, & - igrid, location) - - integer (kind=int_kind), intent(in) :: & - location , & ! 1 (add frazil to bottom), 0 (add frazil throughout) - ntrcr , & ! number of tracers in use - nilyr , & ! number of ice layers - nbtrcr , & ! number of biology tracers - nblyr ! number of biology layers - - real (kind=dbl_kind), intent(in) :: & - dt ! timestep (s) - - real (kind=dbl_kind), intent(in) :: & - aicen , & ! concentration of ice - vicen , & ! volume of ice - sss , & ! ocean salinity (ppt) - ! hsurp , & ! flags new ice added to each cat - vsurp , & ! volume of new ice added to each cat - vtmp ! total volume of new and old ice - - real (kind=dbl_kind), dimension (nbtrcr), intent(in) :: & - ocean_bio - - real (kind=dbl_kind), intent(in) :: & - vbrin ! fbri*volume per unit area of ice (m) - - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - igrid ! zbio grid - - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bgrid ! zsal grid - - real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: & - cgrid ! CICE grid - - real (kind=dbl_kind), dimension (ntrcr), intent(inout) :: & - trcrn ! ice tracers - - ! local variables - - real (kind=dbl_kind), dimension (ntrcr+2) :: & - trtmp0, & ! temporary, remapped tracers - trtmp ! temporary, remapped tracers - - real (kind=dbl_kind) :: & - hin , & ! ice height - hinS_new, & ! brine height - temp_S - - integer (kind=int_kind) :: & - k, m - - real (kind=dbl_kind), dimension (nblyr+1) :: & - C_stationary ! stationary bulk concentration*h (mmol/m^2) - - real (kind=dbl_kind), dimension (nblyr) :: & - S_stationary ! stationary bulk concentration*h (ppt*m) - - real(kind=dbl_kind) :: & - top_conc , & ! salinity or bgc ocean concentration of frazil - fluxb , & ! needed for regrid (set to zero here) - hbri_old , & ! previous timestep brine height - hbri ! brine height - - character(len=*),parameter :: subname='(adjust_tracer_profile)' - - trtmp0(:) = c0 - trtmp(:) = c0 - fluxb = c0 - - if (location == 1 .and. vbrin > c0) then ! add frazil to bottom - - hbri = vbrin - hbri_old = vtmp - - do m = 1, nbtrcr - top_conc = ocean_bio(m)*zbgc_init_frac(m) - do k = 1, nblyr+1 - C_stationary(k) = trcrn(bio_index(m) + k-1)* hbri_old - enddo !k - call regrid_stationary (C_stationary, hbri_old, & - hbri, dt, & - ntrcr, & - nblyr, top_conc, & - igrid, fluxb ) - if (icepack_warnings_aborted(subname)) return - do k = 1, nblyr+1 - trcrn(bio_index(m) + k-1) = C_stationary(k)/hbri - enddo !k - enddo !m - - elseif (vbrin > c0) then ! add frazil throughout location == 0 .and. - - do k = 1, nblyr+1 - do m = 1, nbtrcr - trcrn(bio_index(m) + k-1) = (trcrn(bio_index(m) + k-1) * vtmp & - + ocean_bio(m)*zbgc_init_frac(m) * vsurp) / vbrin - enddo - enddo - - endif ! location - - end subroutine adjust_tracer_profile - !======================================================================= !autodocument_start icepack_init_bgc ! - subroutine icepack_init_bgc(ncat, nblyr, nilyr, ntrcr_o, & - cgrid, igrid, ntrcr, nbtrcr, & - sicen, trcrn, sss, ocean_bio_all) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nblyr , & ! number of bio layers - ntrcr_o,& ! number of tracers not including bgc - ntrcr , & ! number of tracers in use - nbtrcr ! number of bio tracers in use - - real (kind=dbl_kind), dimension (nblyr+1), intent(inout) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), intent(inout) :: & - cgrid ! CICE vertical coordinate + subroutine icepack_init_bgc( & + sicen, trcrn, sss, ocean_bio_all, DOCPoolFractions) real (kind=dbl_kind), dimension(nilyr, ncat), intent(in) :: & sicen ! salinity on the cice grid @@ -470,9 +336,12 @@ subroutine icepack_init_bgc(ncat, nblyr, nilyr, ntrcr_o, & real (kind=dbl_kind), intent(in) :: & sss ! sea surface salinity (ppt) - real (kind=dbl_kind), dimension (:), intent(inout) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & ocean_bio_all ! fixed order, all values even for tracers false + real (kind=dbl_kind), dimension (:), optional, intent(out) :: & + DOCPoolFractions ! Fraction of DOC in polysacharids, lipids, and proteins + !autodocument_end ! local variables @@ -493,6 +362,8 @@ subroutine icepack_init_bgc(ncat, nblyr, nilyr, ntrcr_o, & ! The skeletal layer model assumes a constant ! layer depth (sk_l) and porosity (phi_sk) !----------------------------------------------------------------------------- + if (.not. restartbgc) then + if (skl_bgc) then do n = 1,ncat @@ -547,6 +418,16 @@ subroutine icepack_init_bgc(ncat, nblyr, nilyr, ntrcr_o, & endif ! scale_bgc endif ! skl_bgc + endif ! restart + + if (present(DOCPoolFractions)) then + DOCPoolFractions(:) = c1 + if (.not. use_macromolecules) then + do mm = 1,max_doc + DOCPoolFractions(mm) = doc_pool_fractions(mm) + end do + end if + endif end subroutine icepack_init_bgc @@ -554,76 +435,14 @@ end subroutine icepack_init_bgc !autodocument_start icepack_init_zbgc ! - subroutine icepack_init_zbgc ( & - R_Si2N_in, R_S2N_in, R_Fe2C_in, R_Fe2N_in, R_C2N_in, R_C2N_DON_in, & - R_chl2N_in, F_abs_chl_in, R_Fe2DON_in, R_Fe2DOC_in, chlabs_in, & - alpha2max_low_in, beta2max_in, mu_max_in, fr_graze_in, mort_pre_in, & - mort_Tdep_in, k_exude_in, K_Nit_in, K_Am_in, K_sil_in, K_Fe_in, & - f_don_in, kn_bac_in, f_don_Am_in, f_doc_in, f_exude_in, k_bac_in, & - grow_Tdep_in, zbgc_frac_init_in, & - zbgc_init_frac_in, tau_ret_in, tau_rel_in, bgc_tracer_type_in, & - fr_resp_in, algal_vel_in, R_dFe2dust_in, dustFe_sol_in, T_max_in, & - op_dep_min_in, fr_graze_s_in, fr_graze_e_in, fr_mort2min_in, fr_dFe_in, & - k_nitrif_in, t_iron_conv_in, max_loss_in, max_dfe_doc1_in, & - fr_resp_s_in, y_sk_DMS_in, t_sk_conv_in, t_sk_ox_in, fsal_in) - - real (kind=dbl_kind), optional :: R_C2N_in(:) ! algal C to N (mole/mole) - real (kind=dbl_kind), optional :: R_chl2N_in(:) ! 3 algal chlorophyll to N (mg/mmol) - real (kind=dbl_kind), optional :: F_abs_chl_in(:) ! to scale absorption in Dedd - real (kind=dbl_kind), optional :: R_C2N_DON_in(:) ! increase compare to algal R_Fe2C - real (kind=dbl_kind), optional :: R_Si2N_in(:) ! algal Sil to N (mole/mole) - real (kind=dbl_kind), optional :: R_S2N_in(:) ! algal S to N (mole/mole) - real (kind=dbl_kind), optional :: R_Fe2C_in(:) ! algal Fe to carbon (umol/mmol) - real (kind=dbl_kind), optional :: R_Fe2N_in(:) ! algal Fe to N (umol/mmol) - real (kind=dbl_kind), optional :: R_Fe2DON_in(:) ! Fe to N of DON (nmol/umol) - real (kind=dbl_kind), optional :: R_Fe2DOC_in(:) ! Fe to C of DOC (nmol/umol) - - real (kind=dbl_kind), optional :: fr_resp_in ! frac of algal growth lost due to respiration - real (kind=dbl_kind), optional :: algal_vel_in ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day - real (kind=dbl_kind), optional :: R_dFe2dust_in ! g/g (3.5% content) Tagliabue 2009 - real (kind=dbl_kind), optional :: dustFe_sol_in ! solubility fraction - real (kind=dbl_kind), optional :: T_max_in ! maximum temperature (C) - real (kind=dbl_kind), optional :: op_dep_min_in ! Light attenuates for optical depths exceeding min - real (kind=dbl_kind), optional :: fr_graze_s_in ! fraction of grazing spilled or slopped - real (kind=dbl_kind), optional :: fr_graze_e_in ! fraction of assimilation excreted - real (kind=dbl_kind), optional :: fr_mort2min_in ! fractionation of mortality to Am - real (kind=dbl_kind), optional :: fr_dFe_in ! fraction of remineralized nitrogen - ! (in units of algal iron) - real (kind=dbl_kind), optional :: k_nitrif_in ! nitrification rate (1/day) - real (kind=dbl_kind), optional :: t_iron_conv_in ! desorption loss pFe to dFe (day) - real (kind=dbl_kind), optional :: max_loss_in ! restrict uptake to % of remaining value - real (kind=dbl_kind), optional :: max_dfe_doc1_in ! max ratio of dFe to saccharides in the ice (nM Fe/muM C) - real (kind=dbl_kind), optional :: fr_resp_s_in ! DMSPd fraction of respiration loss as DMSPd - real (kind=dbl_kind), optional :: y_sk_DMS_in ! fraction conversion given high yield - real (kind=dbl_kind), optional :: t_sk_conv_in ! Stefels conversion time (d) - real (kind=dbl_kind), optional :: t_sk_ox_in ! DMS oxidation time (d) - real (kind=dbl_kind), optional :: fsal_in ! salinity limitation factor (1) - - real (kind=dbl_kind), optional :: chlabs_in(:) ! chla absorption 1/m/(mg/m^3) - real (kind=dbl_kind), optional :: alpha2max_low_in(:) ! light limitation (1/(W/m^2)) - real (kind=dbl_kind), optional :: beta2max_in(:) ! light inhibition (1/(W/m^2)) - real (kind=dbl_kind), optional :: mu_max_in(:) ! maximum growth rate (1/d) - real (kind=dbl_kind), optional :: grow_Tdep_in(:) ! T dependence of growth (1/C) - real (kind=dbl_kind), optional :: fr_graze_in(:) ! fraction of algae grazed - real (kind=dbl_kind), optional :: mort_pre_in(:) ! mortality (1/day) - real (kind=dbl_kind), optional :: mort_Tdep_in(:) ! T dependence of mortality (1/C) - real (kind=dbl_kind), optional :: k_exude_in(:) ! algal carbon exudation rate (1/d) - real (kind=dbl_kind), optional :: K_Nit_in(:) ! nitrate half saturation (mmol/m^3) - real (kind=dbl_kind), optional :: K_Am_in(:) ! ammonium half saturation (mmol/m^3) - real (kind=dbl_kind), optional :: K_Sil_in(:) ! silicon half saturation (mmol/m^3) - real (kind=dbl_kind), optional :: K_Fe_in(:) ! iron half saturation or micromol/m^3 - real (kind=dbl_kind), optional :: f_don_in(:) ! fraction of spilled grazing to DON - real (kind=dbl_kind), optional :: kn_bac_in(:) ! Bacterial degredation of DON (1/d) - real (kind=dbl_kind), optional :: f_don_Am_in(:) ! fraction of remineralized DON to Am - real (kind=dbl_kind), optional :: f_doc_in(:) ! fraction of mort_N that goes to each doc pool - real (kind=dbl_kind), optional :: f_exude_in(:) ! fraction of exuded carbon to each DOC pool - real (kind=dbl_kind), optional :: k_bac_in(:) ! Bacterial degredation of DOC (1/d) - - real (kind=dbl_kind), optional :: zbgc_frac_init_in(:) ! initializes mobile fraction - real (kind=dbl_kind), optional :: bgc_tracer_type_in(:) ! described tracer in mobile or stationary phases - real (kind=dbl_kind), optional :: zbgc_init_frac_in(:) ! fraction of ocean tracer concentration in new ice - real (kind=dbl_kind), optional :: tau_ret_in(:) ! retention timescale (s), mobile to stationary phase - real (kind=dbl_kind), optional :: tau_rel_in(:) ! release timescale (s), stationary to mobile phase + subroutine icepack_init_zbgc (& + zbgc_frac_init_in, zbgc_init_frac_in, tau_ret_in, tau_rel_in, bgc_tracer_type_in) + + real (kind=dbl_kind), dimension (:), intent(in), optional :: zbgc_frac_init_in(:) ! initializes mobile fraction + real (kind=dbl_kind), dimension (:), intent(in), optional :: bgc_tracer_type_in(:) ! described tracer in mobile or stationary phases + real (kind=dbl_kind), dimension (:), intent(in), optional :: zbgc_init_frac_in(:) ! fraction of ocean tracer concentration in new ice + real (kind=dbl_kind), dimension (:), intent(in), optional :: tau_ret_in(:) ! retention timescale (s), mobile to stationary phase + real (kind=dbl_kind), dimension (:), intent(in), optional :: tau_rel_in(:) ! release timescale (s), stationary to mobile phase !autodocument_end @@ -631,117 +450,176 @@ subroutine icepack_init_zbgc ( & !-------- - if (present(R_C2N_in)) R_C2N(:) = R_C2N_in(:) - if (present(R_chl2N_in)) R_chl2N(:) = R_chl2N_in(:) - if (present(F_abs_chl_in)) F_abs_chl(:) = F_abs_chl_in(:) - if (present(R_C2N_DON_in)) R_C2N_DON(:) = R_C2N_DON_in(:) - if (present(R_Si2N_in)) R_Si2N(:) = R_Si2N_in(:) - if (present(R_S2N_in)) R_S2N(:) = R_S2N_in(:) - if (present(R_Fe2C_in)) R_Fe2C(:) = R_Fe2C_in(:) - if (present(R_Fe2N_in)) R_Fe2N(:) = R_Fe2N_in(:) - if (present(R_Fe2DON_in)) R_Fe2DON(:) = R_Fe2DON_in(:) - if (present(R_Fe2DOC_in)) R_Fe2DOC(:) = R_Fe2DOC_in(:) - - if (present(fr_resp_in)) fr_resp = fr_resp_in - if (present(algal_vel_in)) algal_vel = algal_vel_in - if (present(R_dFe2dust_in)) R_dFe2dust = R_dFe2dust_in - if (present(dustFe_sol_in)) dustFe_sol = dustFe_sol_in - if (present(T_max_in)) T_max = T_max_in - if (present(op_dep_min_in)) op_dep_min = op_dep_min_in - if (present(fr_graze_s_in)) fr_graze_s = fr_graze_s_in - if (present(fr_graze_e_in)) fr_graze_e = fr_graze_e_in - if (present(fr_mort2min_in)) fr_mort2min = fr_mort2min_in - if (present(fr_dFe_in)) fr_dFe = fr_dFe_in - if (present(k_nitrif_in)) k_nitrif = k_nitrif_in - if (present(t_iron_conv_in)) t_iron_conv = t_iron_conv_in - if (present(max_loss_in)) max_loss = max_loss_in - if (present(max_dfe_doc1_in)) max_dfe_doc1 = max_dfe_doc1_in - if (present(fr_resp_s_in)) fr_resp_s = fr_resp_s_in - if (present(y_sk_DMS_in)) y_sk_DMS = y_sk_DMS_in - if (present(t_sk_conv_in)) t_sk_conv = t_sk_conv_in - if (present(t_sk_ox_in)) t_sk_ox = t_sk_ox_in - if (present(fsal_in)) fsal = fsal_in - - if (present(chlabs_in)) chlabs(:) = chlabs_in(:) - if (present(alpha2max_low_in)) alpha2max_low(:) = alpha2max_low_in(:) - if (present(beta2max_in)) beta2max(:) = beta2max_in(:) - if (present(mu_max_in)) mu_max(:) = mu_max_in(:) - if (present(grow_Tdep_in)) grow_Tdep(:) = grow_Tdep_in(:) - if (present(fr_graze_in)) fr_graze(:) = fr_graze_in(:) - if (present(mort_pre_in)) mort_pre(:) = mort_pre_in(:) - if (present(mort_Tdep_in)) mort_Tdep(:) = mort_Tdep_in(:) - if (present(k_exude_in)) k_exude(:) = k_exude_in(:) - if (present(K_Nit_in)) K_Nit(:) = K_Nit_in(:) - if (present(K_Am_in)) K_Am(:) = K_Am_in(:) - if (present(K_Sil_in)) K_Sil(:) = K_Sil_in(:) - if (present(K_Fe_in)) K_Fe(:) = K_Fe_in(:) - if (present(f_don_in)) f_don(:) = f_don_in(:) - if (present(kn_bac_in)) kn_bac(:) = kn_bac_in(:) - if (present(f_don_Am_in)) f_don_Am(:) = f_don_Am_in(:) - if (present(f_doc_in)) f_doc(:) = f_doc_in(:) - if (present(f_exude_in)) f_exude(:) = f_exude_in(:) - if (present(k_bac_in)) k_bac(:) = k_bac_in(:) - if (present(zbgc_frac_init_in)) zbgc_frac_init(:) = zbgc_frac_init_in(:) if (present(bgc_tracer_type_in)) bgc_tracer_type(:) = bgc_tracer_type_in(:) if (present(zbgc_init_frac_in)) zbgc_init_frac(:) = zbgc_init_frac_in(:) if (present(tau_ret_in)) tau_ret(:) = tau_ret_in(:) if (present(tau_rel_in)) tau_rel(:) = tau_rel_in(:) + R_Si2N(1) = ratio_Si2N_diatoms + R_Si2N(2) = ratio_Si2N_sp + R_Si2N(3) = ratio_Si2N_phaeo + + R_S2N(1) = ratio_S2N_diatoms + R_S2N(2) = ratio_S2N_sp + R_S2N(3) = ratio_S2N_phaeo + + R_Fe2C(1) = ratio_Fe2C_diatoms + R_Fe2C(2) = ratio_Fe2C_sp + R_Fe2C(3) = ratio_Fe2C_phaeo + + R_Fe2N(1) = ratio_Fe2N_diatoms + R_Fe2N(2) = ratio_Fe2N_sp + R_Fe2N(3) = ratio_Fe2N_phaeo + + R_C2N(1) = ratio_C2N_diatoms + R_C2N(2) = ratio_C2N_sp + R_C2N(3) = ratio_C2N_phaeo + + R_chl2N(1) = ratio_chl2N_diatoms + R_chl2N(2) = ratio_chl2N_sp + R_chl2N(3) = ratio_chl2N_phaeo + + F_abs_chl(1) = F_abs_chl_diatoms + F_abs_chl(2) = F_abs_chl_sp + F_abs_chl(3) = F_abs_chl_phaeo + + R_Fe2DON(1) = ratio_Fe2DON + R_C2N_DON(1) = ratio_C2N_proteins + + R_Fe2DOC(1) = ratio_Fe2DOC_s + R_Fe2DOC(2) = ratio_Fe2DOC_l + R_Fe2DOC(3) = c0 + + chlabs(1) = chlabs_diatoms + chlabs(2) = chlabs_sp + chlabs(3) = chlabs_phaeo + + alpha2max_low(1) = alpha2max_low_diatoms + alpha2max_low(2) = alpha2max_low_sp + alpha2max_low(3) = alpha2max_low_phaeo + + beta2max(1) = beta2max_diatoms + beta2max(2) = beta2max_sp + beta2max(3) = beta2max_phaeo + + mu_max(1) = mu_max_diatoms + mu_max(2) = mu_max_sp + mu_max(3) = mu_max_phaeo + + grow_Tdep(1) = grow_Tdep_diatoms + grow_Tdep(2) = grow_Tdep_sp + grow_Tdep(3) = grow_Tdep_phaeo + + fr_graze(1) = fr_graze_diatoms + fr_graze(2) = fr_graze_sp + fr_graze(3) = fr_graze_phaeo + + mort_pre(1) = mort_pre_diatoms + mort_pre(2) = mort_pre_sp + mort_pre(3) = mort_pre_phaeo + + mort_Tdep(1) = mort_Tdep_diatoms + mort_Tdep(2) = mort_Tdep_sp + mort_Tdep(3) = mort_Tdep_phaeo + + k_exude(1) = k_exude_diatoms + k_exude(2) = k_exude_sp + k_exude(3) = k_exude_phaeo + + K_Nit(1) = K_Nit_diatoms + K_Nit(2) = K_Nit_sp + K_Nit(3) = K_Nit_phaeo + + K_Am(1) = K_Am_diatoms + K_Am(2) = K_Am_sp + K_Am(3) = K_Am_phaeo + + K_Sil(1) = K_Sil_diatoms + K_Sil(2) = K_Sil_sp + K_Sil(3) = K_Sil_phaeo + + K_Fe(1) = K_Fe_diatoms + K_Fe(2) = K_Fe_sp + K_Fe(3) = K_Fe_phaeo + + f_doc(:) = c0 + f_doc(1) = f_doc_s + f_doc(2) = f_doc_l + + f_don(1) = f_don_protein + kn_bac(1) = kn_bac_protein + f_don_Am(1) = f_don_Am_protein + + f_exude(:) = c0 + f_exude(1) = f_exude_s + f_exude(2) = f_exude_l + + k_bac(:) = c0 + k_bac(1) = k_bac_s + k_bac(2) = k_bac_l + + algaltype(1) = algaltype_diatoms + algaltype(2) = algaltype_sp + algaltype(3) = algaltype_phaeo + + doctype(:) = c0 + doctype(1) = doctype_s + doctype(2) = doctype_l + + dictype(:) = dictype_1 + + dontype(:) = dontype_protein + + fedtype(:) = fedtype_1 + feptype(:) = feptype_1 + + zaerotype(1) = zaerotype_bc1 + zaerotype(2) = zaerotype_bc2 + zaerotype(3) = zaerotype_dust1 + zaerotype(4) = zaerotype_dust2 + zaerotype(5) = zaerotype_dust3 + zaerotype(6) = zaerotype_dust4 end subroutine icepack_init_zbgc !======================================================================= !autodocument_start icepack_biogeochemistry ! - subroutine icepack_biogeochemistry(dt, & - ntrcr, nbtrcr, & upNO, upNH, iDi, iki, zfswin, & - zsal_tot, darcy_V, grow_net, & + darcy_V, grow_net, & PP_net, hbri,dhbr_bot, dhbr_top, Zoo,& - fbio_snoice, fbio_atmice, ocean_bio, & + fbio_snoice, fbio_atmice, ocean_bio_dh, ocean_bio, & first_ice, fswpenln, bphi, bTiz, ice_bio_net, & - snow_bio_net, fswthrun, Rayleigh_criteria, & - sice_rho, fzsal, fzsal_g, & - bgrid, igrid, icgrid, cgrid, & - nblyr, nilyr, nslyr, n_algae, n_zaero, ncat, & - n_doc, n_dic, n_don, n_fed, n_fep, & + snow_bio_net, totalChla, fswthrun, & meltbn, melttn, congeln, snoicen, & - sst, sss, fsnow, meltsn, & + sst, sss, Tf, fsnow, meltsn, & !hmix, & hin_old, flux_bio, flux_bio_atm, & aicen_init, vicen_init, aicen, vicen, vsnon, & - aice0, trcrn, vsnon_init, skl_bgc) + aice0, trcrn, vsnon_init, & + flux_bion, bioPorosityIceCell, & + bioSalinityIceCell, bioTemperatureIceCell) real (kind=dbl_kind), intent(in) :: & dt ! time step - integer (kind=int_kind), intent(in) :: & - ncat, & - nilyr, & - nslyr, & - nblyr, & - ntrcr, & - nbtrcr, & - n_algae, n_zaero, & - n_doc, n_dic, n_don, n_fed, n_fep - real (kind=dbl_kind), dimension (:), intent(inout) :: & - bgrid , & ! biology nondimensional vertical grid points - igrid , & ! biology vertical interface points - cgrid , & ! CICE vertical coordinate - icgrid , & ! interface grid for CICE (shortwave variable) - ocean_bio , & ! contains all the ocean bgc tracer concentrations fbio_snoice , & ! fluxes from snow to ice fbio_atmice , & ! fluxes from atm to ice dhbr_top , & ! brine top change dhbr_bot , & ! brine bottom change darcy_V , & ! darcy velocity positive up (m/s) hin_old , & ! old ice thickness - sice_rho , & ! avg sea ice density (kg/m^3) ice_bio_net , & ! depth integrated tracer (mmol/m^2) snow_bio_net , & ! depth integrated snow tracer (mmol/m^2) - flux_bio ! all bio fluxes to ocean + flux_bio ! all bio fluxes to ocean + + real (kind=dbl_kind), dimension (:), intent(in) :: & + ocean_bio ! contains the ocean bgc tracer concentrations in use (mmol/m^3) + + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + ocean_bio_dh ! The ocean bgc tracer concentrations in use * brine thickness * phi (mmol/m^2) logical (kind=log_kind), dimension (:), intent(inout) :: & first_ice ! distinguishes ice that disappears (e.g. melts) @@ -749,6 +627,14 @@ subroutine icepack_biogeochemistry(dt, & ! during a single time step from ice that was ! there the entire time step (true until ice forms) + real (kind=dbl_kind), optional, dimension (:,:), intent(out) :: & + flux_bion ! per categeory ice to ocean biogeochemistry flux (mmol/m2/s) + + real (kind=dbl_kind), optional, dimension (:), intent(inout) :: & + bioPorosityIceCell, & ! category average porosity on the interface bio grid + bioSalinityIceCell, & ! (ppt) category average porosity on the interface bio grid + bioTemperatureIceCell ! (oC) category average porosity on the interface bio grid + real (kind=dbl_kind), dimension (:,:), intent(inout) :: & Zoo , & ! N losses accumulated in timestep (ie. zooplankton/bacteria) ! mmol/m^3 @@ -766,15 +652,8 @@ subroutine icepack_biogeochemistry(dt, & upNO , & ! nitrate uptake rate (mmol/m^2/d) times aice upNH ! ammonium uptake rate (mmol/m^2/d) times aice - real (kind=dbl_kind), intent(inout), optional :: & - zsal_tot ! Total ice salinity in per grid cell (g/m^2) (deprecated) - - real (kind=dbl_kind), intent(inout), optional :: & - fzsal , & ! Total flux of salt to ocean at time step for conservation (deprecated) - fzsal_g ! Total gravity drainage flux (deprecated) - - logical (kind=log_kind), intent(inout), optional :: & - Rayleigh_criteria ! .true. means Ra_c was reached (deprecated) + real (kind=dbl_kind), optional, intent(inout) :: & + totalChla ! ice integrated chla and summed over all algal groups (mg/m^2) real (kind=dbl_kind), dimension (:,:), intent(in) :: & fswpenln ! visible SW entering ice layers (W m-2) @@ -798,17 +677,17 @@ subroutine icepack_biogeochemistry(dt, & aice0 , & ! open water area fraction sss , & ! sea surface salinity (ppt) sst , & ! sea surface temperature (C) + !hmix , & ! mixed layer depth (m) + Tf , & ! basal freezing temperature (C) fsnow ! snowfall rate (kg/m^2 s) - logical (kind=log_kind), intent(in) :: & - skl_bgc ! if true, solve skeletal biochemistry - !autodocument_end ! local variables integer (kind=int_kind) :: & - n, mm ! thickness category index + k , & ! vertical index + n, mm ! thickness category index real (kind=dbl_kind) :: & hin , & ! new ice thickness @@ -831,10 +710,14 @@ subroutine icepack_biogeochemistry(dt, & iphin , & ! porosity ibrine_sal , & ! brine salinity (ppt) ibrine_rho , & ! brine_density (kg/m^3) + iSin , & ! Salinity on the interface grid (ppt) iTin ! Temperature on the interface grid (oC) real (kind=dbl_kind) :: & - sloss ! brine flux contribution from surface runoff (g/m^2) + sloss ! brine flux contribution from surface runoff (g/m^2) + + real (kind=dbl_kind), dimension (nbtrcr) :: & + flux_bion_n ! temporary ! for bgc sk real (kind=dbl_kind) :: & @@ -842,14 +725,25 @@ subroutine icepack_biogeochemistry(dt, & dh_top_chl , & ! Chlorophyll may or may not flush darcy_V_chl + real (kind=dbl_kind), dimension (nblyr+1) :: & + zspace ! vertical grid spacing + character(len=*),parameter :: subname='(icepack_biogeochemistry)' + zspace(:) = c1/real(nblyr,kind=dbl_kind) + zspace(1) = p5*zspace(2) + zspace(nblyr+1) = zspace(1) + + if (present(bioPorosityIceCell)) bioPorosityIceCell(:) = c0 + if (present(bioSalinityIceCell)) bioSalinityIceCell(:) = c0 + if (present(bioTemperatureIceCell)) bioTemperatureIceCell(:) = c0 do n = 1, ncat !----------------------------------------------------------------- ! initialize !----------------------------------------------------------------- + flux_bion_n(:) = c0 hin_old(n) = c0 if (aicen_init(n) > puny) then hin_old(n) = vicen_init(n) & @@ -896,7 +790,7 @@ subroutine icepack_biogeochemistry(dt, & trcrn(nt_fbri,n), & dhbr_top(n), dhbr_bot(n), & hbr_old, hin, & - hsn, first_ice(n) ) + hsn) if (icepack_warnings_aborted(subname)) return ! Requires the average ice permeability = kavg(:) @@ -905,22 +799,20 @@ subroutine icepack_biogeochemistry(dt, & iDi(:,n) = c0 - call compute_microS_mushy (nilyr, nblyr, & - bgrid, cgrid, igrid, & + call compute_microS_mushy ( & trcrn(:,n), hin_old(n), hbr_old, & sss, sst, bTiz(:,n), & iTin(:), bphi(:,n), kavg, & bphi_o, bSin(:), & brine_sal(:), brine_rho(:), iphin(:), & - ibrine_rho(:), ibrine_sal(:), sice_rho(n), & - iDi(:,n) ) + ibrine_rho(:), ibrine_sal(:), & + iDi(:,n) , iSin(:)) if (icepack_warnings_aborted(subname)) return call update_hbrine (melttn(n), & meltsn (n), dt, & hin, hsn, & hin_old (n), hbrin, & - hbr_old, & trcrn(nt_fbri,n), & dhbr_top(n), dhbr_bot(n), & @@ -941,50 +833,49 @@ subroutine icepack_biogeochemistry(dt, & if (z_tracers) then - call zbio (dt, nblyr, & - nslyr, nilyr, & + call zbio (dt, & melttn(n), & meltsn(n), meltbn (n), & congeln(n), snoicen(n), & - nbtrcr, fsnow, & - ntrcr, trcrn(1:ntrcr,n), & - bio_index(1:nbtrcr), aicen_init(n), & + fsnow, trcrn(1:ntrcr,n), & + bio_index(1:nbtrcr), bio_index_o(:), & + aicen_init(n), & vicen_init(n), vsnon_init(n), & vicen(n), vsnon(n), & aicen(n), flux_bio_atm(1:nbtrcr), & - n, n_algae, & - n_doc, n_dic, & - n_don, & - n_fed, n_fep, & - n_zaero, first_ice(n), & + n, first_ice(n), & hin_old(n), ocean_bio(1:nbtrcr), & + ocean_bio_dh, & bphi(:,n), iphin, & - iDi(:,n), & + iDi(:,n), & fswpenln(:,n), & dhbr_top(n), dhbr_bot(n), & zfswin(:,n), & hbrin, hbr_old, & -! darcy_V(n), darcy_V_chl, & - darcy_V(n), & - bgrid, & - igrid, icgrid, & + darcy_V(n), & bphi_o, & - iTin, & + iTin, & Zoo(:,n), & flux_bio(1:nbtrcr), dh_direct, & upNO, upNH, & fbio_snoice, fbio_atmice, & PP_net, ice_bio_net (1:nbtrcr), & - snow_bio_net(1:nbtrcr),grow_net ) + snow_bio_net(1:nbtrcr),grow_net, & + totalChla, & + flux_bion_n(1:nbtrcr), iSin, & + bioPorosityIceCell, bioSalinityIceCell, & + bioTemperatureIceCell ) if (icepack_warnings_aborted(subname)) return + if (present(flux_bion)) then + do mm = 1, nbtrcr + flux_bion(mm,n) = flux_bion_n(mm) + enddo + endif + elseif (skl_bgc) then - call sklbio (dt, ntrcr, & - nbtrcr, n_algae, & - n_doc, & - n_dic, n_don, & - n_fed, n_fep, & + call sklbio (dt, Tf, & flux_bio (1:nbtrcr), ocean_bio(1:nbtrcr), & aicen (n), & meltbn (n), congeln (n), & @@ -998,6 +889,20 @@ subroutine icepack_biogeochemistry(dt, & first_ice(n) = .false. + else + if (z_tracers) then + do mm = 1, nbtrcr + do k = 1, nblyr+1 + if (present(flux_bion)) then + flux_bion(mm,n) = flux_bion(mm,n) + trcrn(bio_index(mm) + k-1,n) * & + hin_old(n) * zspace(k)/dt * trcrn(nt_fbri,n) + endif + flux_bio(mm) = flux_bio(mm) + trcrn(bio_index(mm) + k-1,n) * & + vicen_init(n) * zspace(k)/dt * trcrn(nt_fbri,n) + trcrn(bio_index(mm) + k-1,n) = c0 + enddo + enddo + endif endif ! aicen > puny enddo ! ncat @@ -1007,20 +912,10 @@ end subroutine icepack_biogeochemistry !autodocument_start icepack_load_ocean_bio_array ! basic initialization for ocean_bio_all - subroutine icepack_load_ocean_bio_array(max_nbtrcr, & - max_algae, max_don, max_doc, max_dic, max_aero, max_fe, & + subroutine icepack_load_ocean_bio_array(& nit, amm, sil, dmsp, dms, algalN, & doc, don, dic, fed, fep, zaeros, ocean_bio_all, hum) - integer (kind=int_kind), intent(in) :: & - max_algae , & ! maximum number of algal types - max_dic , & ! maximum number of dissolved inorganic carbon types - max_doc , & ! maximum number of dissolved organic carbon types - max_don , & ! maximum number of dissolved organic nitrogen types - max_fe , & ! maximum number of iron types - max_aero , & ! maximum number of aerosols - max_nbtrcr ! maximum number of bio tracers - real (kind=dbl_kind), intent(in) :: & nit , & ! ocean nitrate (mmol/m^3) amm , & ! ammonia/um (mmol/m^3) @@ -1029,25 +924,25 @@ subroutine icepack_load_ocean_bio_array(max_nbtrcr, & dms , & ! dms (mmol/m^3) hum ! humic material (mmol/m^3) - real (kind=dbl_kind), dimension (max_algae), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & algalN ! ocean algal nitrogen (mmol/m^3) (diatoms, phaeo, pico) - real (kind=dbl_kind), dimension (max_doc), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & doc ! ocean doc (mmol/m^3) (proteins, EPS, lipid) - real (kind=dbl_kind), dimension (max_don), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & don ! ocean don (mmol/m^3) - real (kind=dbl_kind), dimension (max_dic), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & dic ! ocean dic (mmol/m^3) - real (kind=dbl_kind), dimension (max_fe), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & fed, fep ! ocean disolved and particulate fe (nM) - real (kind=dbl_kind), dimension (max_aero), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & zaeros ! ocean aerosols (mmol/m^3) - real (kind=dbl_kind), dimension (max_nbtrcr), intent(inout) :: & + real (kind=dbl_kind), dimension (:), intent(out) :: & ocean_bio_all ! fixed order, all values even for tracers false !autodocument_end @@ -1120,16 +1015,9 @@ end subroutine icepack_load_ocean_bio_array ! Initialize ocean concentration subroutine icepack_init_ocean_bio (amm, dmsp, dms, algalN, doc, dic, don, & - fed, fep, hum, nit, sil, zaeros, max_dic, max_don, max_fe, max_aero,& - CToN, CToN_DON) - - integer (kind=int_kind), intent(in) :: & - max_dic, & - max_don, & - max_fe, & - max_aero + fed, fep, hum, nit, sil, zaeros,CToN, CToN_DON) - real (kind=dbl_kind), intent(out):: & + real (kind=dbl_kind), intent(out), optional:: & amm , & ! ammonium dmsp , & ! DMSPp dms , & ! DMS @@ -1137,7 +1025,7 @@ subroutine icepack_init_ocean_bio (amm, dmsp, dms, algalN, doc, dic, don, & nit , & ! nitrate sil ! silicate - real (kind=dbl_kind), dimension(:), intent(out):: & + real (kind=dbl_kind), dimension(:), intent(out), optional:: & algalN , & ! algae doc , & ! DOC dic , & ! DIC @@ -1146,7 +1034,7 @@ subroutine icepack_init_ocean_bio (amm, dmsp, dms, algalN, doc, dic, don, & fep , & ! Particulate Iron zaeros ! BC and dust - real (kind=dbl_kind), dimension(:), intent(inout), optional :: & + real (kind=dbl_kind), dimension(:), intent(out), optional :: & CToN , & ! carbon to nitrogen ratio for algae CToN_DON ! nitrogen to carbon ratio for proteins @@ -1160,50 +1048,153 @@ subroutine icepack_init_ocean_bio (amm, dmsp, dms, algalN, doc, dic, don, & character(len=*),parameter :: subname='(icepack_init_ocean_bio)' if (present(CToN)) then - CToN(1) = R_C2N(1) - CToN(2) = R_C2N(2) - CToN(3) = R_C2N(3) + CToN(:) = c0 + CToN(1) = R_C2N(1) + CToN(2) = R_C2N(2) + CToN(3) = R_C2N(3) endif if (present(CToN_DON)) then - CToN_DON(1) = R_C2N_DON(1) + CToN_DON(:) = c0 + CToN_DON(1) = R_C2N_DON(1) endif - amm = c1 ! ISPOL < 1 mmol/m^3 - dmsp = p1 - dms = p1 - algalN(1) = c1 !0.0026_dbl_kind ! ISPOL, Lannuzel 2013(pennate) - algalN(2) = 0.0057_dbl_kind ! ISPOL, Lannuzel 2013(small plankton) - algalN(3) = 0.0027_dbl_kind ! ISPOL, Lannuzel 2013(Phaeocystis) - ! 0.024_dbl_kind ! 5% of 1 mgchl/m^3 - doc(1) = 16.2_dbl_kind ! 18% saccharides - doc(2) = 9.0_dbl_kind ! lipids - doc(3) = c1 ! - do k = 1, max_dic - dic(k) = c1 - enddo - do k = 1, max_don - don(k) = 12.9_dbl_kind - ! 64.3_dbl_kind ! 72% Total DOC~90 mmolC/m^3 ISPOL with N:C of 0.2 - enddo - !ki = 1 - !if (trim(fe_data_type) == 'clim') ki = 2 - do k = 1, max_fe ! ki, max_fe - fed(k) = 0.4_dbl_kind ! c1 (nM) Lannuzel2007 DFe, - ! range 0.14-2.6 (nM) van der Merwe 2011 - ! Tagliabue 2012 (0.4 nM) - fep(k) = c2 ! (nM) van der Merwe 2011 - ! (0.6 to 2.9 nM ocean) - enddo - hum = c1 ! mmol C/m^3 - nit = 12.0_dbl_kind - sil = 25.0_dbl_kind - do k = 1, max_aero - zaeros(k) = c0 - enddo - + if (present(amm)) & + amm = c1 ! ISPOL < 1 mmol/m^3 + if (present(dmsp)) & + dmsp = p1 + if (present(dms)) & + dms = p1 + if (present(algalN)) then + algalN(:) = c0 + algalN(1) = c1 !0.0026_dbl_kind ! ISPOL, Lannuzel 2013(pennate) + algalN(2) = 0.0057_dbl_kind ! ISPOL, Lannuzel 2013(small plankton) + algalN(3) = 0.0027_dbl_kind ! ISPOL, Lannuzel 2013(Phaeocystis) + endif + if (present(doc))then + doc(:) = c0 + doc(1) = 16.2_dbl_kind ! 18% saccharides + doc(2) = 9.0_dbl_kind ! lipids + doc(3) = c1 ! + endif + if (present(dic)) then + dic(:) = c0 + dic(1) = 1950.0_dbl_kind ! 1950-2260 mmol C/m3 (Tynan et al. 2015) + endif + if (present(don)) then + don(:) = c0 + don(1) = 12.9_dbl_kind ! 64.3_dbl_kind ! 72% Total DOC~90 mmolC/m^3 ISPOL with N:C of 0.2 + endif + if (present(fed)) then + fed(:) = c0 + fed(1) = 0.4_dbl_kind ! c1 (nM) Lannuzel2007 DFe,! range 0.14-2.6 (nM) van der Merwe 2011 + ! Tagliabue 2012 (0.4 nM) + endif + if (present(fep)) then + fep(:) = c0 + fep(1) = c2 ! (nM) van der Merwe 2011 + ! (0.6 to 2.9 nM ocean) + endif + if (present(hum)) & + hum = c1 ! mmol C/m^3 + if (present(nit)) & + nit = 12.0_dbl_kind + if (present(sil)) & + sil = 25.0_dbl_kind + if (present(zaeros)) & + zaeros(:) = c0 end subroutine icepack_init_ocean_bio +! +!======================================================================= +! +! Given some added new ice to the base of the existing ice, recalculate +! vertical bio tracer so that new grid cells are all the same size. +! +! author: N. Jeffery, LANL +! date : Mar 3, 2024 +! +! Based on update_vertical_tracers modified for vertical biogeochemistry +! + subroutine update_vertical_bio_tracers(nbiolyr, trc, h1, h2, trc0, zspace) + + integer (kind=int_kind), intent(in) :: & + nbiolyr ! number of bio layers nblyr+1 + + real (kind=dbl_kind), dimension(:), intent(inout) :: & + trc ! vertical tracer + + real (kind=dbl_kind), intent(in) :: & + h1, & ! old thickness + h2, & ! new thickness + trc0 ! tracer value of added ice on ice bottom + + real (kind=dbl_kind), dimension(nbiolyr), intent(in) :: & + zspace + + ! local variables + + real(kind=dbl_kind), dimension(nbiolyr) :: trc2 ! updated tracer temporary + + ! vertical indices for old and new grid + integer :: k1, k2 + + real (kind=dbl_kind) :: & + z1a, z1b, & ! upper, lower boundary of old cell/added new ice at bottom + z2a, z2b, & ! upper, lower boundary of new cell + overlap , & ! overlap between old and new cell + rnilyr + + !rnilyr = real(nilyr,dbl_kind) + z2a = c0 + z2b = c0 + if (h2 > puny) then + ! loop over new grid cells + do k2 = 1, nbiolyr + + ! initialize new tracer + trc2(k2) = c0 + + ! calculate upper and lower boundary of new cell + z2a = z2b !((k2 - 1) * h2) * zspace(k2)+z2b ! / rnilyr + z2b = z2b + h2 * zspace(k2) !(k2 * h2) * zspace(k2)+z2a !/ rnilyr + + z1a = c0 + z1b = c0 + ! loop over old grid cells + do k1 = 1, nbiolyr + + ! calculate upper and lower boundary of old cell + z1a = z1b !((k1 - 1) * h1) * zspace(k1)+z1b !/ rnilyr + z1b = z1b + h1 * zspace(k1) !(k1 * h1) * zspace(k1)+z1a !/ rnilyr + + ! calculate overlap between old and new cell + overlap = max(min(z1b, z2b) - max(z1a, z2a), c0) + + ! aggregate old grid cell contribution to new cell + trc2(k2) = trc2(k2) + overlap * trc(k1) + + enddo ! k1 + + ! calculate upper and lower boundary of added new ice at bottom + z1a = h1 + z1b = h2 + + ! calculate overlap between added ice and new cell + overlap = max(min(z1b, z2b) - max(z1a, z2a), c0) + ! aggregate added ice contribution to new cell + trc2(k2) = trc2(k2) + overlap * trc0 + ! renormalize new grid cell + trc2(k2) = trc2(k2)/zspace(k2)/h2 !(rnilyr * trc2(k2)) / h2 + + enddo ! k2 + else + trc2 = trc + endif + ! update vertical tracer array with the adjusted tracer + trc = trc2 + + end subroutine update_vertical_bio_tracers !======================================================================= diff --git a/columnphysics/icepack_zbgc_shared.F90 b/columnphysics/icepack_zbgc_shared.F90 index 757044a89..08c6753d5 100644 --- a/columnphysics/icepack_zbgc_shared.F90 +++ b/columnphysics/icepack_zbgc_shared.F90 @@ -14,9 +14,11 @@ module icepack_zbgc_shared use icepack_parameters, only: rhoi, cp_ocn, cp_ice, Lfresh use icepack_parameters, only: solve_zbgc use icepack_parameters, only: fr_resp - use icepack_tracers, only: max_nbtrcr, max_algae, max_doc - use icepack_tracers, only: max_don - use icepack_tracers, only: nt_bgc_N, nt_fbri + use icepack_tracers, only: nbtrcr, ntrcr, nblyr, nilyr, nslyr + use icepack_tracers, only: n_algae + use icepack_tracers, only: max_nbtrcr, max_algae, max_doc, max_fe + use icepack_tracers, only: max_don, max_aero, max_dic + use icepack_tracers, only: nt_bgc_N, nt_fbri, nlt_bgc_N use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -57,7 +59,7 @@ module icepack_zbgc_shared real (kind=dbl_kind), dimension(max_don), public :: & ! increase compare to algal R_Fe2C R_C2N_DON - real (kind=dbl_kind), dimension(max_algae), public :: & + real (kind=dbl_kind), dimension(max_algae), public :: & R_Si2N , & ! algal Sil to N (mole/mole) R_S2N , & ! algal S to N (mole/mole) ! Marchetti et al 2006, 3 umol Fe/mol C for iron limited Pseudo-nitzschia @@ -100,6 +102,15 @@ module icepack_zbgc_shared ! general biogeochemistry !----------------------------------------------------------------- + real (kind=dbl_kind), parameter, dimension(max_algae), public :: & + graze_exponent = (/ 0.333_dbl_kind, c1, c1/) ! Implicit grazing exponent (Dunneet al. 2005) + + real (kind=dbl_kind), parameter, public :: & + graze_conc = 1.36_dbl_kind, & ! (mmol N/m^3) converted from Dunne et al 2005 + ! data fit for phytoplankton (1.9 mmol C/m^3) to + ! ice algal N with 20% porosity and C/N = 7 + large_bgc = 1.0e8_dbl_kind ! warning value for large bgc concentrations (mmol/m^3) + real (kind=dbl_kind), dimension(max_nbtrcr), public :: & zbgc_frac_init,&! initializes mobile fraction bgc_tracer_type ! described tracer in mobile or stationary phases @@ -141,6 +152,29 @@ module icepack_zbgc_shared f_exude , & ! fraction of exuded carbon to each DOC pool k_bac ! Bacterial degredation of DOC (1/d) + ! polysaccharids, lipids, proteins+nucleic acids (Lonborg et al. 2020) + real (kind=dbl_kind), dimension(max_doc), parameter, public :: & + doc_pool_fractions = (/0.26_dbl_kind, 0.17_dbl_kind, 0.57_dbl_kind/) + + real (kind=dbl_kind), dimension(max_algae), public :: & + algaltype ! mobility type for algae + + real (kind=dbl_kind), dimension(max_doc), public :: & + doctype ! mobility type for DOC + + real (kind=dbl_kind), dimension(max_dic), public :: & + dictype ! mobility type for DIC + + real (kind=dbl_kind), dimension(max_don), public :: & + dontype ! mobility type for DON + + real (kind=dbl_kind), dimension(max_fe), public :: & + fedtype, & ! mobility type for iron + feptype + + real (kind=dbl_kind), dimension(max_aero), public :: & + zaerotype ! mobility type for aerosols + !----------------------------------------------------------------- ! brine !----------------------------------------------------------------- @@ -163,6 +197,13 @@ module icepack_zbgc_shared Dm = 1.0e-9_dbl_kind, & ! molecular diffusion (m^2/s) Ra_c = 0.05_dbl_kind ! critical Rayleigh number for bottom convection + real (kind=dbl_kind), dimension (:), allocatable, public :: & + bgrid , & ! biology nondimensional vertical grid points + igrid , & ! biology vertical interface points + cgrid , & ! CICE vertical coordinate + icgrid , & ! interface grid for CICE (shortwave variable) + swgrid ! grid for ice tracers used in dEdd scheme + !======================================================================= contains @@ -397,15 +438,10 @@ end subroutine zap_small_bgc subroutine regrid_stationary (C_stationary, hbri_old, & hbri, dt, & - ntrcr, nblyr, & top_conc, igrid, & flux_bio, & melt_b, con_gel) - integer (kind=int_kind), intent(in) :: & - ntrcr, & ! number of tracers - nblyr ! number of bio layers - real (kind=dbl_kind), intent(inout) :: & flux_bio ! ocean tracer flux (mmol/m^2/s) positive into ocean @@ -548,13 +584,12 @@ end subroutine regrid_stationary ! Aggregate flux information from all ice thickness categories ! for z layer biogeochemistry ! - subroutine merge_bgc_fluxes (dt, nblyr, & - nslyr, & - bio_index, n_algae, & - nbtrcr, aicen, & + subroutine merge_bgc_fluxes (dt, & + bio_index, & + aicen, & vicen, vsnon, & - iphin, & - trcrn, & + iphin, & + trcrn, aice_init, & flux_bion, flux_bio, & upNOn, upNHn, & upNO, upNH, & @@ -562,28 +597,29 @@ subroutine merge_bgc_fluxes (dt, nblyr, & zbgc_snow, zbgc_atm, & PP_net, ice_bio_net,& snow_bio_net, grow_alg, & - grow_net) + grow_net, totalChla, & + iTin, iSin, & + bioPorosityIceCell, & + bioSalinityIceCell, & + bioTemperatureIceCell) real (kind=dbl_kind), intent(in) :: & dt ! timestep (s) - integer (kind=int_kind), intent(in) :: & - nblyr , & ! number of bio layers - nslyr , & ! number of snow layers - n_algae , & ! number of algal tracers - nbtrcr ! number of biology tracer tracers - integer (kind=int_kind), dimension(:), intent(in) :: & bio_index ! relates bio indices, ie. nlt_bgc_N to nt_bgc_N real (kind=dbl_kind), dimension (:), intent(in) :: & trcrn , & ! input tracer fields - iphin ! porosity + iphin , & ! porosity + iTin , & ! temperature per cat on vertical bio interface points (oC) + iSin ! salinity per cat on vertical bio interface points (ppt) real (kind=dbl_kind), intent(in):: & aicen , & ! concentration of ice vicen , & ! volume of ice (m) - vsnon ! volume of snow(m) + vsnon , & ! volume of snow(m) + aice_init ! initial concentration of ice ! single category rates real (kind=dbl_kind), dimension(:), intent(in):: & @@ -605,6 +641,11 @@ subroutine merge_bgc_fluxes (dt, nblyr, & ice_bio_net, & ! integrated ice tracers mmol or mg/m^2) snow_bio_net ! integrated snow tracers mmol or mg/m^2) + real (kind=dbl_kind), optional, dimension(:), intent(inout):: & + bioPorosityIceCell, & ! average cell porosity on interface points + bioSalinityIceCell, & ! average cell salinity on interface points (ppt) + bioTemperatureIceCell ! average cell temperature on interface points (oC) + ! cumulative variables and rates real (kind=dbl_kind), intent(inout):: & PP_net , & ! net PP (mg C/m^2/d) times aice @@ -612,6 +653,10 @@ subroutine merge_bgc_fluxes (dt, nblyr, & upNO , & ! tot nitrate uptake rate (mmol/m^2/d) times aice upNH ! tot ammonium uptake rate (mmol/m^2/d) times aice + ! cumulative variables and rates + real (kind=dbl_kind), optional, intent(inout):: & + totalChla ! total Chla (mg chla/m^2) + ! local variables real (kind=dbl_kind) :: & @@ -645,18 +690,25 @@ subroutine merge_bgc_fluxes (dt, nblyr, & !----------------------------------------------------------------- ! Merge fluxes !----------------------------------------------------------------- - dvssl = min(p5*vsnon/real(nslyr,kind=dbl_kind), hs_ssl*aicen) ! snow surface layer - dvint = vsnon - dvssl ! snow interior + dvssl = p5*vsnon/real(nslyr,kind=dbl_kind) !snow surface layer + dvint = vsnon - dvssl ! snow interior snow_bio_net(mm) = snow_bio_net(mm) & + trcrn(bio_index(mm)+nblyr+1)*dvssl & + trcrn(bio_index(mm)+nblyr+2)*dvint flux_bio (mm) = flux_bio (mm) + flux_bion (mm)*aicen zbgc_snow (mm) = zbgc_snow(mm) + zbgc_snown(mm)*aicen/dt zbgc_atm (mm) = zbgc_atm (mm) + zbgc_atmn (mm)*aicen/dt - enddo ! mm + enddo ! mm + ! diagnostics : mean cell bio interface grid profiles + do k = 1, nblyr+1 + if (present(bioPorosityIceCell)) bioPorosityIceCell(k) = bioPorosityIceCell(k) + iphin(k)*vicen + if (present(bioSalinityIceCell)) bioSalinityIceCell(k) = bioSalinityIceCell(k) + iSin(k)*vicen + if (present(bioTemperatureIceCell)) bioTemperatureIceCell(k) = bioTemperatureIceCell(k) + iTin(k)*vicen + end do if (solve_zbgc) then do mm = 1, n_algae + if (present(totalChla)) totalChla = totalChla + ice_bio_net(nlt_bgc_N(mm))*R_chl2N(mm) do k = 1, nblyr+1 tmp = iphin(k)*trcrn(nt_fbri)*vicen*zspace(k)*secday PP_net = PP_net + grow_alg(k,mm)*tmp & @@ -678,7 +730,7 @@ end subroutine merge_bgc_fluxes ! ! author: Elizabeth C. Hunke and William H. Lipscomb, LANL - subroutine merge_bgc_fluxes_skl (nbtrcr, n_algae, & + subroutine merge_bgc_fluxes_skl ( & aicen, trcrn, & flux_bion, flux_bio, & PP_net, upNOn, & @@ -686,10 +738,6 @@ subroutine merge_bgc_fluxes_skl (nbtrcr, n_algae, & upNH, grow_net, & grow_alg) - integer (kind=int_kind), intent(in) :: & - nbtrcr , & ! number of bgc tracers - n_algae ! number of autotrophs - ! single category fluxes real (kind=dbl_kind), intent(in):: & aicen ! category ice area fraction diff --git a/columnphysics/version.txt b/columnphysics/version.txt index 739229a40..f46731dc6 100644 --- a/columnphysics/version.txt +++ b/columnphysics/version.txt @@ -1 +1 @@ -ICEPACK 1.3.4 +ICEPACK 1.5.0 diff --git a/configuration/driver/icedrv_InitMod.F90 b/configuration/driver/icedrv_InitMod.F90 index 107ffdc7f..ba1b1de6f 100644 --- a/configuration/driver/icedrv_InitMod.F90 +++ b/configuration/driver/icedrv_InitMod.F90 @@ -11,9 +11,10 @@ module icedrv_InitMod use icedrv_constants, only: nu_diag use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_flags + use icepack_intfc, only: icepack_query_tracer_sizes use icepack_intfc, only: icepack_write_tracer_flags, icepack_write_tracer_indices use icepack_intfc, only: icepack_write_tracer_sizes, icepack_write_parameters - use icedrv_system, only: icedrv_system_abort + use icedrv_system, only: icedrv_system_abort, icedrv_system_flush implicit none private @@ -30,16 +31,14 @@ module icedrv_InitMod subroutine icedrv_initialize - use icedrv_arrays_column, only: hin_max, c_hi_range - use icedrv_arrays_column, only: floe_rad_l, floe_rad_c, & - floe_binwidth, c_fsd_range + use icedrv_arrays_column, only: hin_max, c_hi_range, floe_rad_c use icedrv_calendar, only: dt, time, istep, istep1, & init_calendar, calendar use icepack_intfc, only: icepack_init_itd, icepack_init_itd_hist use icepack_intfc, only: icepack_init_fsd_bounds use icepack_intfc, only: icepack_init_snow use icepack_intfc, only: icepack_warnings_flush - use icedrv_domain_size, only: ncat, nfsd + use icedrv_domain_size, only: ncat ! use icedrv_diagnostics, only: icedrv_diagnostics_debug use icedrv_flux, only: init_coupler_flux, init_history_therm, & init_flux_atm_ocn @@ -81,14 +80,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=ncat, hin_max=hin_max) + call icepack_init_itd(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=ncat, c_hi_range=c_hi_range, hin_max=hin_max) ! output + call icepack_init_itd_hist(c_hi_range=c_hi_range, hin_max=hin_max) ! output call icepack_query_tracer_flags(tr_fsd_out=tr_fsd) call icepack_warnings_flush(nu_diag) @@ -97,13 +96,7 @@ subroutine icedrv_initialize endif if (tr_fsd) then - call icepack_init_fsd_bounds( & - nfsd=nfsd, & ! floe size distribution - floe_rad_l=floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c=floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth=floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range=c_fsd_range , & ! string for history output - write_diags=.true.) + call icepack_init_fsd_bounds(floe_rad_c_out=floe_rad_c, write_diags=.true. ) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted(subname)) then call icedrv_system_abort(file=__FILE__,line=__LINE__) @@ -166,6 +159,8 @@ subroutine icedrv_initialize call init_flux_atm_ocn ! initialize atmosphere, ocean fluxes + call icedrv_system_flush(nu_diag) + end subroutine icedrv_initialize !======================================================================= @@ -186,12 +181,13 @@ subroutine init_restart use icedrv_state ! almost everything integer(kind=int_kind) :: & - i ! horizontal indices + i, & ! horizontal indices + ntrcr ! tracer count logical (kind=log_kind) :: & - skl_bgc, & ! from icepack - z_tracers, & ! from icepack - tr_brine, & ! from icepack + skl_bgc, & ! from icepack + z_tracers, & ! from icepack + tr_brine, & ! from icepack tr_fsd ! from icepack character(len=*), parameter :: subname='(init_restart)' @@ -203,6 +199,7 @@ subroutine init_restart call icepack_query_parameters(skl_bgc_out=skl_bgc) call icepack_query_parameters(z_tracers_out=z_tracers) call icepack_query_tracer_flags(tr_brine_out=tr_brine, tr_fsd_out=tr_fsd) + call icepack_query_tracer_sizes(ntrcr_out=ntrcr) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__,line= __LINE__) @@ -234,22 +231,20 @@ subroutine init_restart !----------------------------------------------------------------- do i = 1, nx if (tmask(i)) & - 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, & - Tf=Tf(i)) + call icepack_aggregate(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), & + 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,:), & + Tf = Tf(i)) enddo call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & diff --git a/configuration/driver/icedrv_MAIN.F90 b/configuration/driver/icedrv_MAIN.F90 index 5c84695f2..c8564d4e8 100644 --- a/configuration/driver/icedrv_MAIN.F90 +++ b/configuration/driver/icedrv_MAIN.F90 @@ -1,8 +1,8 @@ !======================================================================= -! Copyright (c) 2023, Triad National Security, LLC +! Copyright (c) 2024, Triad National Security, LLC ! All rights reserved. ! -! Copyright 2023. Triad National Security, LLC. This software was +! Copyright 2024. Triad National Security, LLC. This software was ! produced under U.S. Government contract DE-AC52-06NA25396 for Los ! Alamos National Laboratory (LANL), which is operated by Triad ! National Security, LLC for the U.S. Department of Energy. The U.S. @@ -30,11 +30,12 @@ program icedrv use icedrv_constants, only: ice_stdout, nu_diag, nu_diag_out use icedrv_domain_size, only: nx use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icedrv_system, only: icedrv_system_abort + use icedrv_system, only: icedrv_system_abort, icedrv_system_flush implicit none integer n + logical openflag character(len=*), parameter :: subname='(icedrv)' !----------------------------------------------------------------- @@ -55,10 +56,24 @@ program icedrv write(ice_stdout, *) "ICEPACK COMPLETED SUCCESSFULLY " - close (ice_stdout) - close (nu_diag) + inquire(unit=ice_stdout,opened=openflag) + if (openflag) then + call icedrv_system_flush(ice_stdout) + close (ice_stdout) + endif + + inquire(unit=nu_diag,opened=openflag) + if (openflag) then + call icedrv_system_flush(nu_diag) + close (nu_diag) + endif + do n = 1, nx - close (nu_diag_out+n-1) + inquire(unit=nu_diag_out+n-1,opened=openflag) + if (openflag) then + call icedrv_system_flush(nu_diag_out+n-1) + close (nu_diag_out+n-1) + endif enddo end program icedrv diff --git a/configuration/driver/icedrv_RunMod.F90 b/configuration/driver/icedrv_RunMod.F90 index e20ebf87b..a7bc82bde 100644 --- a/configuration/driver/icedrv_RunMod.F90 +++ b/configuration/driver/icedrv_RunMod.F90 @@ -13,7 +13,7 @@ module icedrv_RunMod use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags use icepack_intfc, only: icepack_query_tracer_sizes - use icedrv_system, only: icedrv_system_abort + use icedrv_system, only: icedrv_system_abort, icedrv_system_flush implicit none private @@ -83,6 +83,8 @@ subroutine icedrv_run call init_flux_atm_ocn ! initialize atmosphere, ocean fluxes + call icedrv_system_flush(nu_diag) + enddo timeLoop end subroutine icedrv_run diff --git a/configuration/driver/icedrv_arrays_column.F90 b/configuration/driver/icedrv_arrays_column.F90 index 61017c6b8..dbe1ab56a 100644 --- a/configuration/driver/icedrv_arrays_column.F90 +++ b/configuration/driver/icedrv_arrays_column.F90 @@ -122,17 +122,6 @@ module icedrv_arrays_column ! biogeochemistry components - real (kind=dbl_kind), dimension (nblyr+2), public :: & - bgrid ! biology nondimensional vertical grid points - - real (kind=dbl_kind), dimension (nblyr+1), public :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), public :: & - cgrid , & ! CICE vertical coordinate - icgrid , & ! interface grid for CICE (shortwave variable) - swgrid ! grid for ice tracers used in dEdd scheme - real (kind=dbl_kind), dimension (nx,ncat), public :: & first_ice_real ! .true. = c1, .false. = c0 @@ -209,10 +198,6 @@ module icedrv_arrays_column chl_net , & ! Total chla (mg chla/m^2) per grid cell NO_net ! Total nitrate per grid cell - real (kind=dbl_kind), & - dimension (nx,ncat), public :: & - sice_rho ! avg sea ice density (kg/m^3) ! ech: diagnostic only? - real (kind=dbl_kind), dimension (nx,nblyr+1,ncat), public :: & zfswin ! Shortwave flux into layers interpolated on bio grid (W/m^2) @@ -236,29 +221,22 @@ module icedrv_arrays_column ! floe size distribution real(kind=dbl_kind), dimension(nfsd), public :: & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) + floe_rad_c ! fsd size bin centre in m (radius) real (kind=dbl_kind), dimension (nx), public :: & - wave_sig_ht ! significant height of waves (m) + wave_sig_ht ! significant height of waves (m) real (kind=dbl_kind), dimension (nfreq), public :: & - wavefreq, & ! wave frequencies - dwavefreq ! wave frequency bin widths + wavefreq, & ! wave frequencies + dwavefreq ! wave frequency bin widths real (kind=dbl_kind), dimension (nx,nfreq), public :: & - wave_spectrum ! wave spectrum + wave_spectrum ! wave spectrum real (kind=dbl_kind), dimension (nx,nfsd), public :: & ! change in floe size distribution due to processes d_afsd_newi, d_afsd_latg, d_afsd_latm, d_afsd_wave, d_afsd_weld - character (len=35), public, dimension(nfsd) :: & - c_fsd_range ! fsd floe_rad bounds (m) - - - !======================================================================= end module icedrv_arrays_column diff --git a/configuration/driver/icedrv_diagnostics.F90 b/configuration/driver/icedrv_diagnostics.F90 index eaa44d5e1..4ca0cb825 100644 --- a/configuration/driver/icedrv_diagnostics.F90 +++ b/configuration/driver/icedrv_diagnostics.F90 @@ -14,7 +14,7 @@ module icedrv_diagnostics use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_indices - use icedrv_system, only: icedrv_system_abort + use icedrv_system, only: icedrv_system_abort, icedrv_system_flush implicit none private @@ -267,6 +267,7 @@ subroutine runtime_diags (dt) write(nu_diag_out+n-1,901) 'isotopic conc chg = ',pdiso(n,k),k enddo endif + call icedrv_system_flush(nu_diag_out+n-1) end do 899 format (43x,a24) 900 format (a25,2x,f24.17) @@ -612,6 +613,7 @@ subroutine print_state(plabel,i) write(nu_diag,*) ' ' call icepack_warnings_flush(nu_diag) + call icedrv_system_flush(nu_diag) end subroutine print_state diff --git a/configuration/driver/icedrv_domain_size.F90 b/configuration/driver/icedrv_domain_size.F90 index 75bb4d28e..514045558 100644 --- a/configuration/driver/icedrv_domain_size.F90 +++ b/configuration/driver/icedrv_domain_size.F90 @@ -34,7 +34,6 @@ module icedrv_domain_size ! *** add to kscavz in icepack_zbgc_shared.F90 n_bgc = (n_algae*2 + n_doc + n_dic + n_don + n_fed + n_fep + n_zaero & + 8) , & ! nit, am, sil, dmspp, dmspd, dms, pon, humic - nltrcr = (n_bgc*TRBGCZ)*TRBRI, & ! number of zbgc (includes zaero) max_nsw = (nilyr+nslyr+2) & ! total chlorophyll plus aerosols * (1+TRZAERO),& ! number of tracers active in shortwave calculation max_ntrcr = 1 & ! 1 = surface temperature diff --git a/configuration/driver/icedrv_flux.F90 b/configuration/driver/icedrv_flux.F90 index 39c090818..321a84912 100644 --- a/configuration/driver/icedrv_flux.F90 +++ b/configuration/driver/icedrv_flux.F90 @@ -248,6 +248,7 @@ module icedrv_flux real (kind=dbl_kind), & dimension (nx,ncat), public :: & + rsiden, & ! fraction of ice that melts laterally fsurfn, & ! category fsurf fcondtopn,& ! category fcondtop fcondbotn,& ! category fcondbot @@ -272,8 +273,6 @@ module icedrv_flux !----------------------------------------------------------------- real (kind=dbl_kind), dimension (nx), public :: & - rside , & ! fraction of ice that melts laterally - fside , & ! lateral heat flux (W/m^2) wlat , & ! lateral melt rate (m/s) fsw , & ! incoming shortwave radiation (W/m^2) coszen , & ! cosine solar zenith angle, < 0 for sun below horizon diff --git a/configuration/driver/icedrv_forcing.F90 b/configuration/driver/icedrv_forcing.F90 index f7cfb01ff..98e390e22 100644 --- a/configuration/driver/icedrv_forcing.F90 +++ b/configuration/driver/icedrv_forcing.F90 @@ -97,7 +97,7 @@ module icedrv_forcing oceanmixed_ice , & ! if true, use internal ocean mixed layer restore_ocn ! restore sst if true - real (kind=dbl_kind), public :: & + real (kind=dbl_kind), public :: & trest, & ! restoring time scale (sec) trestore ! restoring time scale (days) @@ -1077,7 +1077,7 @@ end subroutine ocn_ISPOL subroutine finish_ocn_forcing(sst_temp) ! Compute ocean freezing temperature Tf based on tfrz_option -! 'minus1p8' Tf = -1.8 C +! 'minus1p8' Tf = -1.8 C ! 'constant' Tf = Tocnfrz ! 'linear_salt' Tf = -depressT * sss ! 'mushy' Tf conforms with mushy layer thermo (ktherm=2) @@ -1150,6 +1150,7 @@ subroutine get_wave_spec ! wave spectrum and frequencies ! get hardwired frequency bin info and a dummy wave spectrum profile + call icepack_init_wave(nfreq=nfreq, & wave_spectrum_profile=wave_spectrum_profile, & wavefreq=wavefreq, dwavefreq=dwavefreq) diff --git a/configuration/driver/icedrv_init.F90 b/configuration/driver/icedrv_init.F90 index c1e738ce6..f342d74fe 100644 --- a/configuration/driver/icedrv_init.F90 +++ b/configuration/driver/icedrv_init.F90 @@ -15,13 +15,13 @@ module icedrv_init use icepack_intfc, only: icepack_init_tracer_flags use icepack_intfc, only: icepack_init_tracer_sizes use icepack_intfc, only: icepack_init_tracer_indices - use icepack_intfc, only: icepack_init_trcr + use icepack_intfc, only: icepack_init_enthalpy use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_query_tracer_flags use icepack_intfc, only: icepack_query_tracer_sizes use icepack_intfc, only: icepack_query_tracer_indices use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted - use icedrv_system, only: icedrv_system_abort + use icedrv_system, only: icedrv_system_abort, icedrv_system_flush implicit none private @@ -99,7 +99,7 @@ subroutine input_data natmiter, kitd, kcatbound character (len=char_len) :: shortwave, albedo_type, conduct, fbot_xfer_type, & - cpl_frazil, tfrz_option, saltflux_option, & + cpl_frazil, congel_freeze, tfrz_option, saltflux_option, & frzpnd, atmbndy, wave_spec_type, snwredist, snw_aging_table logical (kind=log_kind) :: sw_redist, use_smliq_pnd, snwgrain, update_ocn_f @@ -174,12 +174,12 @@ subroutine input_data update_ocn_f, l_mpond_fresh, ustar_min, & fbot_xfer_type, oceanmixed_ice, emissivity, & formdrag, highfreq, natmiter, & - atmiter_conv, calc_dragio, & + atmiter_conv, calc_dragio, congel_freeze, & tfrz_option, saltflux_option, ice_ref_salinity, & default_season, wave_spec_type, cpl_frazil, & precip_units, fyear_init, ycycle, & atm_data_type, ocn_data_type, bgc_data_type, & - lateral_flux_type, & + lateral_flux_type, & atm_data_file, ocn_data_file, bgc_data_file, & ice_data_file, & atm_data_format, ocn_data_format, bgc_data_format, & @@ -225,6 +225,7 @@ subroutine input_data dSdt_slow_mode_out=dSdt_slow_mode, & phi_c_slow_mode_out=phi_c_slow_mode, Tliquidus_max_out=Tliquidus_max, & phi_i_mushy_out=phi_i_mushy, conserv_check_out=conserv_check, & + congel_freeze_out=congel_freeze, & tfrz_option_out=tfrz_option, saltflux_option_out=saltflux_option, & ice_ref_salinity_out=ice_ref_salinity, kalg_out=kalg, & fbot_xfer_type_out=fbot_xfer_type, puny_out=puny, & @@ -791,6 +792,7 @@ subroutine input_data write(nu_diag,1005) ' hi_min = ', hi_min write(nu_diag,1030) ' fbot_xfer_type = ', trim(fbot_xfer_type) write(nu_diag,1010) ' oceanmixed_ice = ', oceanmixed_ice + write(nu_diag,1030) ' congel_freeze = ', trim(congel_freeze) write(nu_diag,1030) ' tfrz_option = ', trim(tfrz_option) write(nu_diag,*) ' saltflux_option = ', & trim(saltflux_option) @@ -923,6 +925,8 @@ subroutine input_data write(nu_diag,1020) 'nx = ', nx write(nu_diag,*)' ' + call icedrv_system_flush(nu_diag) + 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements 1005 format (a30,2x,f10.6) ! float 1010 format (a30,2x,l6) ! logical @@ -979,6 +983,7 @@ subroutine input_data dSdt_slow_mode_in=dSdt_slow_mode, & phi_c_slow_mode_in=phi_c_slow_mode, Tliquidus_max_in=Tliquidus_max, & phi_i_mushy_in=phi_i_mushy, conserv_check_in=conserv_check, & + congel_freeze_in=congel_freeze, & tfrz_option_in=tfrz_option, saltflux_option_in=saltflux_option, & ice_ref_salinity_in=ice_ref_salinity, kalg_in=kalg, & fbot_xfer_type_in=fbot_xfer_type, & @@ -1250,8 +1255,7 @@ subroutine init_state enddo if (tmask(i)) & - call icepack_aggregate(ncat=ncat, & - trcrn=trcrn(i,1:ntrcr,:), & + call icepack_aggregate(trcrn=trcrn(i,1:ntrcr,:), & aicen=aicen(i,:), & vicen=vicen(i,:), & vsnon=vsnon(i,:), & @@ -1260,7 +1264,6 @@ subroutine init_state 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), & @@ -1293,32 +1296,28 @@ subroutine set_state_var (nx, & use icedrv_arrays_column, only: hin_max use icedrv_domain_size, only: nilyr, nslyr, max_ntrcr, ncat, nfsd - use icedrv_arrays_column, only: floe_rad_c, floe_binwidth integer (kind=int_kind), intent(in) :: & nx ! number of grid cells - real (kind=dbl_kind), dimension (nx), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & Tair ! air temperature (K) ! ocean values may be redefined here, unlike in CICE - real (kind=dbl_kind), dimension (nx), intent(inout) :: & + real (kind=dbl_kind), dimension (:), intent(inout) :: & Tf , & ! freezing temperature (C) sst ! sea surface temperature (C) - real (kind=dbl_kind), dimension (nx,nilyr), & - intent(in) :: & + real (kind=dbl_kind), dimension (:,:), intent(in) :: & salinz , & ! initial salinity profile Tmltz ! initial melting temperature profile - real (kind=dbl_kind), dimension (nx,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (:,:), intent(out) :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), dimension (nx,max_ntrcr,ncat), & - intent(out) :: & + real (kind=dbl_kind), dimension (:,:,:), intent(out) :: & trcrn ! ice tracers ! 1: surface temperature of ice/snow (C) @@ -1428,18 +1427,15 @@ subroutine set_state_var (nx, & vicen(i,n) = hinit(n) * ainit(n) ! m vsnon(i,n) = c0 ! tracers - call icepack_init_trcr(Tair = Tair(i), & + call icepack_init_enthalpy(Tair = Tair(i), & Tf = Tf(i), & Sprofile = salinz(i,:), & Tprofile = Tmltz(i,:), & Tsfc = Tsfc, & - nilyr=nilyr, nslyr=nslyr, & qin=qin(:), qsn=qsn(:)) ! floe size distribution - if (tr_fsd) call icepack_init_fsd(nfsd=nfsd, ice_ic=ice_ic, & - floe_rad_c=floe_rad_c, & - floe_binwidth=floe_binwidth, & + if (tr_fsd) call icepack_init_fsd(ice_ic=ice_ic, & afsd=trcrn(i,nt_fsd:nt_fsd+nfsd-1,n)) ! surface temperature trcrn(i,nt_Tsfc,n) = Tsfc ! deg C @@ -1500,17 +1496,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 = Tair(i), & + call icepack_init_enthalpy(Tair = Tair(i), & Tf = Tf(i), & Sprofile = salinz(i,:), & Tprofile = Tmltz(i,:), & Tsfc = Tsfc, & - nilyr=nilyr, nslyr=nslyr, & qin=qin(:), qsn=qsn(:)) ! floe size distribution - if (tr_fsd) call icepack_init_fsd(nfsd=nfsd, ice_ic=ice_ic, & - floe_rad_c=floe_rad_c, & - floe_binwidth=floe_binwidth, & + if (tr_fsd) call icepack_init_fsd(ice_ic=ice_ic, & afsd=trcrn(i,nt_fsd:nt_fsd+nfsd-1,n)) ! surface temperature diff --git a/configuration/driver/icedrv_init_column.F90 b/configuration/driver/icedrv_init_column.F90 index 15a795bcc..ce1d1bbd0 100644 --- a/configuration/driver/icedrv_init_column.F90 +++ b/configuration/driver/icedrv_init_column.F90 @@ -24,12 +24,12 @@ module icedrv_init_column use icepack_intfc, only: icepack_query_tracer_indices use icepack_intfc, only: icepack_query_parameters use icepack_intfc, only: icepack_init_zbgc - use icepack_intfc, only: icepack_init_thermo, icepack_init_radiation + use icepack_intfc, only: icepack_init_salinity, icepack_init_radiation use icepack_intfc, only: icepack_step_radiation, icepack_init_orbit use icepack_intfc, only: icepack_init_bgc use icepack_intfc, only: icepack_init_ocean_bio, icepack_load_ocean_bio_array use icepack_intfc, only: icepack_init_hbrine - use icedrv_system, only: icedrv_system_abort + use icedrv_system, only: icedrv_system_abort, icedrv_system_flush implicit none @@ -69,7 +69,7 @@ subroutine init_thermo_vertical !----------------------------------------------------------------- call icepack_query_parameters(depressT_out=depressT) - call icepack_init_thermo(nilyr=nilyr, sprofile=sprofile) + call icepack_init_salinity(sprofile=sprofile) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__, line=__LINE__) @@ -99,7 +99,6 @@ subroutine init_shortwave use icedrv_arrays_column, only: fswsfcn, ffracn, snowfracn use icedrv_arrays_column, only: fswthrun, fswthrun_vdr, fswthrun_vdf, fswthrun_idr, fswthrun_idf use icedrv_arrays_column, only: fswintn, albpndn, apeffn, trcrn_sw, dhsn - use icedrv_arrays_column, only: swgrid, igrid use icedrv_calendar, only: istep1, dt, yday, sec use icedrv_system, only: icedrv_system_abort use icedrv_forcing, only: snw_ssp_table @@ -247,8 +246,6 @@ subroutine init_shortwave if (tmask(i)) then call icepack_step_radiation ( & dt=dt, & - swgrid=swgrid(:), & - igrid=igrid(:), & fbri=fbri(:), & aicen=aicen(i,:), & vicen=vicen(i,:), & @@ -368,7 +365,7 @@ subroutine init_bgc() use icedrv_arrays_column, only: zfswin, trcrn_sw use icedrv_arrays_column, only: ocean_bio_all, ice_bio_net, snow_bio_net - use icedrv_arrays_column, only: cgrid, igrid, bphi, iDi, bTiz, iki + use icedrv_arrays_column, only: bphi, iDi, bTiz, iki use icedrv_calendar, only: istep1 use icedrv_system, only: icedrv_system_abort use icedrv_flux, only: sss, nit, amm, sil, dmsp, dms, algalN, & @@ -439,9 +436,7 @@ subroutine init_bgc() fed=fed(i,:), fep =fep(i,:), hum=hum(i), & nit=nit(i), sil =sil(i), & zaeros=zaeros(i,:), & - algalN=algalN(i,:), & - max_dic=max_dic, max_don =max_don, & - max_fe =max_fe, max_aero=max_aero) + algalN=algalN(i,:)) enddo ! i call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & @@ -451,9 +446,7 @@ subroutine init_bgc() do i = 1, nx - call icepack_load_ocean_bio_array(max_nbtrcr=max_nbtrcr, & - max_algae=max_algae, max_don=max_don, max_doc=max_doc, & - max_aero =max_aero, max_dic=max_dic, max_fe =max_fe, & + call icepack_load_ocean_bio_array( & nit =nit(i), amm=amm(i), sil =sil(i), & dmsp=dmsp(i), dms=dms(i), algalN=algalN(i,:), & doc =doc(i,:), don=don(i,:), dic =dic(i,:), & @@ -476,10 +469,10 @@ subroutine init_bgc() enddo enddo - call icepack_init_bgc(ncat=ncat, nblyr=nblyr, nilyr=nilyr, ntrcr_o=ntrcr_o, & - cgrid=cgrid, igrid=igrid, ntrcr=ntrcr, nbtrcr=nbtrcr, & - sicen=sicen(:,:), trcrn=trcrn_bgc(:,:), & + call icepack_init_bgc( & + sicen=sicen(:,:), trcrn=trcrn_bgc(:,:), & sss=sss(i), ocean_bio_all=ocean_bio_all(i,:)) +! optional DOCPoolFractions=DOCPoolFractions) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(i, istep1, subname, & __FILE__, __LINE__) @@ -493,8 +486,7 @@ end subroutine init_bgc subroutine init_hbrine() - use icedrv_arrays_column, only: first_ice, bgrid, igrid, cgrid - use icedrv_arrays_column, only: icgrid, swgrid + use icedrv_arrays_column, only: first_ice use icedrv_state, only: trcrn real (kind=dbl_kind) :: phi_snow @@ -515,8 +507,7 @@ subroutine init_hbrine() !----------------------------------------------------------------- - call icepack_init_hbrine(bgrid=bgrid, igrid=igrid, cgrid=cgrid, icgrid=icgrid, & - swgrid=swgrid, nblyr=nblyr, nilyr=nilyr, phi_snow=phi_snow) + call icepack_init_hbrine(phi_snow=phi_snow) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__, line=__LINE__) @@ -618,9 +609,6 @@ subroutine init_zbgc tr_bgc_DON, tr_bgc_Fe, tr_zaero, & tr_bgc_hum, tr_aero - integer (kind=int_kind) :: & - ktherm - logical (kind=log_kind) :: & solve_zsal, skl_bgc, z_tracers, scale_bgc, solve_zbgc, dEdd_algae, & modal_aero, restore_bgc @@ -629,7 +617,7 @@ subroutine init_zbgc bgc_flux_type real (kind=dbl_kind) :: & - grid_o, l_sk, initbio_frac, & + grid_o, grid_o_t, l_sk, initbio_frac, & frazil_scav, grid_oS, l_skS, & phi_snow, & ratio_Si2N_diatoms , ratio_Si2N_sp , ratio_Si2N_phaeo , & @@ -663,6 +651,7 @@ subroutine init_zbgc algaltype_diatoms , algaltype_sp , algaltype_phaeo , & nitratetype , ammoniumtype , silicatetype , & dmspptype , dmspdtype , humtype , & + dictype_1 , & doctype_s , doctype_l , dontype_protein , & fedtype_1 , feptype_1 , zaerotype_bc1 , & zaerotype_bc2 , zaerotype_dust1 , zaerotype_dust2 , & @@ -779,10 +768,10 @@ subroutine init_zbgc namelist /zbgc_nml/ & tr_brine, tr_zaero, modal_aero, skl_bgc, & z_tracers, dEdd_algae, solve_zbgc, bgc_flux_type, & - restore_bgc, scale_bgc, solve_zsal, bgc_data_type, & + restore_bgc, scale_bgc, solve_zsal, & tr_bgc_Nit, tr_bgc_C, tr_bgc_chl, tr_bgc_Am, tr_bgc_Sil, & tr_bgc_DMS, tr_bgc_PON, tr_bgc_hum, tr_bgc_DON, tr_bgc_Fe, & - grid_o, l_sk, grid_oS, & + grid_o, grid_o_t, l_sk, grid_oS, & l_skS, phi_snow, initbio_frac, frazil_scav, & ratio_Si2N_diatoms , ratio_Si2N_sp , ratio_Si2N_phaeo , & ratio_S2N_diatoms , ratio_S2N_sp , ratio_S2N_phaeo , & @@ -815,6 +804,7 @@ subroutine init_zbgc algaltype_diatoms , algaltype_sp , algaltype_phaeo , & nitratetype , ammoniumtype , silicatetype , & dmspptype , dmspdtype , humtype , & + dictype_1 , & doctype_s , doctype_l , dontype_protein , & fedtype_1 , feptype_1 , zaerotype_bc1 , & zaerotype_bc2 , zaerotype_dust1 , zaerotype_dust2 , & @@ -828,20 +818,138 @@ subroutine init_zbgc !----------------------------------------------------------------- call icepack_query_tracer_sizes(ntrcr_out=ntrcr) - call icepack_query_tracer_flags(tr_aero_out=tr_aero) - call icepack_query_parameters(ktherm_out=ktherm, shortwave_out=shortwave, & + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & + file=__FILE__, line=__LINE__) + + call icepack_query_parameters(shortwave_out=shortwave, & scale_bgc_out=scale_bgc, skl_bgc_out=skl_bgc, z_tracers_out=z_tracers, & - dEdd_algae_out=dEdd_algae, solve_zbgc_out=solve_zbgc, phi_snow_out=phi_snow, & + dEdd_algae_out=dEdd_algae, solve_zbgc_out=solve_zbgc, grid_o_t_out=grid_o_t, & bgc_flux_type_out=bgc_flux_type, grid_o_out=grid_o, l_sk_out=l_sk, & initbio_frac_out=initbio_frac, frazil_scav_out=frazil_scav, & + grid_oS_out=grid_oS, l_skS_out=l_skS, phi_snow_out=phi_snow, & algal_vel_out=algal_vel, R_dFe2dust_out=R_dFe2dust, & dustFe_sol_out=dustFe_sol, T_max_out=T_max, fsal_out=fsal, & op_dep_min_out=op_dep_min, fr_graze_s_out=fr_graze_s, & fr_graze_e_out=fr_graze_e, fr_mort2min_out=fr_mort2min, & fr_dFe_out=fr_dFe, k_nitrif_out=k_nitrif, t_iron_conv_out=t_iron_conv, & - max_loss_out=max_loss, max_dfe_doc1_out=max_dfe_doc1, & + max_loss_out=max_loss, max_dfe_doc1_out=max_dfe_doc1, fr_resp_out=fr_resp, & fr_resp_s_out=fr_resp_s, y_sk_DMS_out=y_sk_DMS, t_sk_conv_out=t_sk_conv, & - t_sk_ox_out=t_sk_ox) + t_sk_ox_out=t_sk_ox, modal_aero_out=modal_aero, solve_zsal_out = solve_zsal) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & + file=__FILE__, line=__LINE__) + + call icepack_query_parameters ( & + ratio_Si2N_diatoms_out = ratio_Si2N_diatoms, & + ratio_Si2N_sp_out = ratio_Si2N_sp , & + ratio_Si2N_phaeo_out = ratio_Si2N_phaeo , & + ratio_S2N_diatoms_out = ratio_S2N_diatoms , & + ratio_S2N_sp_out = ratio_S2N_sp , & + ratio_S2N_phaeo_out = ratio_S2N_phaeo , & + ratio_Fe2C_diatoms_out = ratio_Fe2C_diatoms, & + ratio_Fe2C_sp_out = ratio_Fe2C_sp , & + ratio_Fe2C_phaeo_out = ratio_Fe2C_phaeo , & + ratio_Fe2N_diatoms_out = ratio_Fe2N_diatoms, & + ratio_Fe2N_sp_out = ratio_Fe2N_sp , & + ratio_Fe2N_phaeo_out = ratio_Fe2N_phaeo , & + ratio_C2N_diatoms_out = ratio_C2N_diatoms , & + ratio_C2N_sp_out = ratio_C2N_sp , & + ratio_C2N_phaeo_out = ratio_C2N_phaeo , & + ratio_C2N_proteins_out = ratio_C2N_proteins, & + ratio_chl2N_diatoms_out = ratio_chl2N_diatoms, & + ratio_chl2N_sp_out = ratio_chl2N_sp , & + ratio_chl2N_phaeo_out = ratio_chl2N_phaeo , & + ratio_Fe2DON_out = ratio_Fe2DON , & + ratio_Fe2DOC_s_out = ratio_Fe2DOC_s , & + ratio_Fe2DOC_l_out = ratio_Fe2DOC_l , & + F_abs_chl_diatoms_out = F_abs_chl_diatoms , & + F_abs_chl_sp_out = F_abs_chl_sp , & + F_abs_chl_phaeo_out = F_abs_chl_phaeo , & + tau_min_out = tau_min , & + tau_max_out = tau_max , & + chlabs_diatoms_out = chlabs_diatoms , & + chlabs_sp_out = chlabs_sp , & + chlabs_phaeo_out = chlabs_phaeo , & + alpha2max_low_diatoms_out = alpha2max_low_diatoms, & + alpha2max_low_sp_out = alpha2max_low_sp , & + alpha2max_low_phaeo_out = alpha2max_low_phaeo, & + beta2max_diatoms_out = beta2max_diatoms , & + beta2max_sp_out = beta2max_sp , & + beta2max_phaeo_out = beta2max_phaeo , & + mu_max_diatoms_out = mu_max_diatoms , & + mu_max_sp_out = mu_max_sp , & + mu_max_phaeo_out = mu_max_phaeo , & + grow_Tdep_diatoms_out = grow_Tdep_diatoms , & + grow_Tdep_sp_out = grow_Tdep_sp , & + grow_Tdep_phaeo_out = grow_Tdep_phaeo , & + fr_graze_diatoms_out = fr_graze_diatoms , & + fr_graze_sp_out = fr_graze_sp , & + fr_graze_phaeo_out = fr_graze_phaeo , & + mort_pre_diatoms_out = mort_pre_diatoms , & + mort_pre_sp_out = mort_pre_sp , & + mort_pre_phaeo_out = mort_pre_phaeo , & + mort_Tdep_diatoms_out = mort_Tdep_diatoms , & + mort_Tdep_sp_out = mort_Tdep_sp , & + mort_Tdep_phaeo_out = mort_Tdep_phaeo , & + k_exude_diatoms_out = k_exude_diatoms , & + k_exude_sp_out = k_exude_sp , & + k_exude_phaeo_out = k_exude_phaeo , & + K_Nit_diatoms_out = K_Nit_diatoms , & + K_Nit_sp_out = K_Nit_sp , & + K_Nit_phaeo_out = K_Nit_phaeo , & + K_Am_diatoms_out = K_Am_diatoms , & + K_Am_sp_out = K_Am_sp , & + K_Am_phaeo_out = K_Am_phaeo , & + K_Sil_diatoms_out = K_Sil_diatoms , & + K_Sil_sp_out = K_Sil_sp , & + K_Sil_phaeo_out = K_Sil_phaeo , & + K_Fe_diatoms_out = K_Fe_diatoms , & + K_Fe_sp_out = K_Fe_sp , & + K_Fe_phaeo_out = K_Fe_phaeo , & + f_doc_s_out = f_doc_s , & + f_doc_l_out = f_doc_l , & + f_don_protein_out = f_don_protein , & + kn_bac_protein_out = kn_bac_protein , & + f_don_Am_protein_out = f_don_Am_protein , & + f_exude_s_out = f_exude_s , & + f_exude_l_out = f_exude_l , & + k_bac_s_out = k_bac_s , & + k_bac_l_out = k_bac_l , & + algaltype_diatoms_out = algaltype_diatoms , & + algaltype_sp_out = algaltype_sp , & + algaltype_phaeo_out = algaltype_phaeo , & + dictype_1_out = dictype_1 , & + doctype_s_out = doctype_s , & + doctype_l_out = doctype_l , & + dontype_protein_out = dontype_protein , & + fedtype_1_out = fedtype_1 , & + feptype_1_out = feptype_1 , & + nitratetype_out = nitratetype , & + ammoniumtype_out = ammoniumtype , & + silicatetype_out = silicatetype , & + dmspptype_out = dmspptype , & + dmspdtype_out = dmspdtype , & + humtype_out = humtype , & + zaerotype_bc1_out = zaerotype_bc1 , & + zaerotype_bc2_out = zaerotype_bc2 , & + zaerotype_dust1_out = zaerotype_dust1 , & + zaerotype_dust2_out = zaerotype_dust2 , & + zaerotype_dust3_out = zaerotype_dust3 , & + zaerotype_dust4_out = zaerotype_dust4) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & + file=__FILE__, line=__LINE__) + + call icepack_query_tracer_flags(tr_aero_out = tr_aero, & + tr_zaero_out = tr_zaero, & + tr_brine_out = tr_brine , tr_bgc_Nit_out = tr_bgc_Nit, & + tr_bgc_Am_out = tr_bgc_Am , tr_bgc_Sil_out = tr_bgc_Sil, & + tr_bgc_DMS_out = tr_bgc_DMS, tr_bgc_PON_out = tr_bgc_PON, & + tr_bgc_N_out = tr_bgc_N , tr_bgc_C_out = tr_bgc_C , & + tr_bgc_chl_out = tr_bgc_chl, & + tr_bgc_DON_out = tr_bgc_DON, tr_bgc_Fe_out = tr_bgc_Fe , & + tr_bgc_hum_out = tr_bgc_hum) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__, line=__LINE__) @@ -849,120 +957,8 @@ subroutine init_zbgc !----------------------------------------------------------------- ! default values !----------------------------------------------------------------- - tr_brine = .false. ! brine height differs from ice height - tr_zaero = .false. ! z aerosol tracers - modal_aero = .false. ! use modal aerosol treatment of aerosols - restore_bgc = .false. ! restore bgc if true - solve_zsal = .false. ! update salinity tracer profile from solve_S_dt - bgc_data_type = 'default'! source of bgc data - tr_bgc_PON = .false. !--------------------------------------------- - tr_bgc_Nit = .false. ! biogeochemistry (skl or zbgc) - tr_bgc_C = .false. ! if skl_bgc = .true. then skl - tr_bgc_chl = .false. ! if z_tracers = .true. then vertically resolved - tr_bgc_Sil = .false. ! if z_tracers + solve_zbgc = .true. then - tr_bgc_Am = .false. ! vertically resolved with reactions - tr_bgc_DMS = .false. !------------------------------------------------ - tr_bgc_DON = .false. ! - tr_bgc_hum = .false. ! - tr_bgc_Fe = .false. ! - tr_bgc_N = .true. ! - - ! z biology parameters - ratio_Si2N_diatoms = 1.8_dbl_kind ! algal Si to N (mol/mol) - ratio_Si2N_sp = c0 ! diatoms, small plankton, phaeocystis - ratio_Si2N_phaeo = c0 - ratio_S2N_diatoms = 0.03_dbl_kind ! algal S to N (mol/mol) - ratio_S2N_sp = 0.03_dbl_kind - ratio_S2N_phaeo = 0.03_dbl_kind - ratio_Fe2C_diatoms = 0.0033_dbl_kind ! algal Fe to C (umol/mol) - ratio_Fe2C_sp = 0.0033_dbl_kind - ratio_Fe2C_phaeo = p1 - ratio_Fe2N_diatoms = 0.023_dbl_kind ! algal Fe to N (umol/mol) - ratio_Fe2N_sp = 0.023_dbl_kind - ratio_Fe2N_phaeo = 0.7_dbl_kind - ratio_Fe2DON = 0.023_dbl_kind ! Fe to N of DON (nmol/umol) - ratio_Fe2DOC_s = p1 ! Fe to C of DOC (nmol/umol) saccharids - ratio_Fe2DOC_l = 0.033_dbl_kind ! Fe to C of DOC (nmol/umol) lipids - tau_min = 5200.0_dbl_kind ! rapid mobile to stationary exchanges (s) - tau_max = 1.73e5_dbl_kind ! long time mobile to stationary exchanges (s) - chlabs_diatoms = 0.03_dbl_kind ! chl absorption (1/m/(mg/m^3)) - chlabs_sp = 0.01_dbl_kind - chlabs_phaeo = 0.05_dbl_kind - alpha2max_low_diatoms = 0.8_dbl_kind ! light limitation (1/(W/m^2)) - alpha2max_low_sp = 0.67_dbl_kind - alpha2max_low_phaeo = 0.67_dbl_kind - beta2max_diatoms = 0.018_dbl_kind ! light inhibition (1/(W/m^2)) - beta2max_sp = 0.0025_dbl_kind - beta2max_phaeo = 0.01_dbl_kind - mu_max_diatoms = 1.2_dbl_kind ! maximum growth rate (1/day) - mu_max_sp = 0.851_dbl_kind - mu_max_phaeo = 0.851_dbl_kind - grow_Tdep_diatoms = 0.06_dbl_kind ! Temperature dependence of growth (1/C) - grow_Tdep_sp = 0.06_dbl_kind - grow_Tdep_phaeo = 0.06_dbl_kind - fr_graze_diatoms = 0.01_dbl_kind ! Fraction grazed - fr_graze_sp = p1 - fr_graze_phaeo = p1 - mort_pre_diatoms = 0.007_dbl_kind! Mortality (1/day) - mort_pre_sp = 0.007_dbl_kind - mort_pre_phaeo = 0.007_dbl_kind - mort_Tdep_diatoms = 0.03_dbl_kind ! T dependence of mortality (1/C) - mort_Tdep_sp = 0.03_dbl_kind - mort_Tdep_phaeo = 0.03_dbl_kind - k_exude_diatoms = c0 ! algal exudation (1/d) - k_exude_sp = c0 - k_exude_phaeo = c0 - K_Nit_diatoms = c1 ! nitrate half saturation (mmol/m^3) - K_Nit_sp = c1 - K_Nit_phaeo = c1 - K_Am_diatoms = 0.3_dbl_kind ! ammonium half saturation (mmol/m^3) - K_Am_sp = 0.3_dbl_kind - K_Am_phaeo = 0.3_dbl_kind - K_Sil_diatoms = 4.0_dbl_kind ! silicate half saturation (mmol/m^3) - K_Sil_sp = c0 - K_Sil_phaeo = c0 - K_Fe_diatoms = c1 ! iron half saturation (nM) - K_Fe_sp = 0.2_dbl_kind - K_Fe_phaeo = p1 - f_don_protein = 0.6_dbl_kind ! fraction of spilled grazing to proteins - kn_bac_protein = 0.03_dbl_kind ! Bacterial degredation of DON (1/d) - f_don_Am_protein = 0.25_dbl_kind ! fraction of remineralized DON to ammonium - f_doc_s = 0.4_dbl_kind ! fraction of mortality to DOC - f_doc_l = 0.4_dbl_kind - f_exude_s = c1 ! fraction of exudation to DOC - f_exude_l = c1 - k_bac_s = 0.03_dbl_kind ! Bacterial degredation of DOC (1/d) - k_bac_l = 0.03_dbl_kind - algaltype_diatoms = c0 ! ------------------ - algaltype_sp = p5 ! - algaltype_phaeo = p5 ! - nitratetype = -c1 ! mobility type between - ammoniumtype = c1 ! stationary <--> mobile - silicatetype = -c1 ! - dmspptype = p5 ! - dmspdtype = -c1 ! - humtype = c1 ! - doctype_s = p5 ! - doctype_l = p5 ! - dontype_protein = p5 ! - fedtype_1 = p5 ! - feptype_1 = p5 ! - zaerotype_bc1 = c1 ! - zaerotype_bc2 = c1 ! - zaerotype_dust1 = c1 ! - zaerotype_dust2 = c1 ! - zaerotype_dust3 = c1 ! - zaerotype_dust4 = c1 !-------------------- - ratio_C2N_diatoms = 7.0_dbl_kind ! algal C to N ratio (mol/mol) - ratio_C2N_sp = 7.0_dbl_kind - ratio_C2N_phaeo = 7.0_dbl_kind - ratio_chl2N_diatoms= 2.1_dbl_kind ! algal chlorophyll to N ratio (mg/mmol) - ratio_chl2N_sp = 1.1_dbl_kind - ratio_chl2N_phaeo = 0.84_dbl_kind - F_abs_chl_diatoms = 2.0_dbl_kind ! scales absorbed radiation for dEdd - F_abs_chl_sp = 4.0_dbl_kind - F_abs_chl_phaeo = 5.0_dbl_kind - ratio_C2N_proteins = 7.0_dbl_kind ! ratio of C to N in proteins (mol/mol) + + tr_bgc_N = .true. ! not a namelist?? !----------------------------------------------------------------- ! read from input file @@ -1022,6 +1018,14 @@ subroutine init_zbgc ! biogeochemistry !----------------------------------------------------------------- + ! deprecate skl bgc (Aug 2024) + ! no skl code removed yet + if (skl_bgc) then + write(nu_diag,*) 'ERROR: skl_bgc is not validate and temporarily DEPRECATED' + write(nu_diag,*) 'ERROR: if you would like to use skl_bgc, please contact the Consortium' + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + if (.not. tr_brine) then if (solve_zbgc) then write(nu_diag,*) 'WARNING: tr_brine = F and solve_zbgc = T' @@ -1041,7 +1045,7 @@ subroutine init_zbgc endif if ((skl_bgc .AND. solve_zbgc) .or. (skl_bgc .AND. z_tracers)) then - print*, 'ERROR: skl_bgc and (solve_zbgc or z_tracers) are both true' + write(nu_diag,*) 'ERROR: skl_bgc and (solve_zbgc or z_tracers) are both true' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif @@ -1066,34 +1070,34 @@ subroutine init_zbgc if (modal_aero .AND. (.NOT. tr_zaero) .AND. (.NOT. tr_aero)) then modal_aero = .false. endif - + if (modal_aero .AND. trim(shortwave(1:4)) /= 'dEdd') then write(nu_diag,*) 'WARNING: modal_aero = T but shortwave /= dEdd' write(nu_diag,*) 'WARNING: setting modal_aero = F' modal_aero = .false. endif if (n_algae > icepack_max_algae) then - print*, 'error:number of algal types exceeds icepack_max_algae' + write(nu_diag,*) 'error:number of algal types exceeds icepack_max_algae' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif if (n_doc > icepack_max_doc) then - print*, 'error:number of algal types exceeds icepack_max_doc' + write(nu_diag,*) 'error:number of algal types exceeds icepack_max_doc' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif if (n_dic > icepack_max_dic) then - print*, 'error:number of dic types exceeds icepack_max_dic' + write(nu_diag,*) 'error:number of dic types exceeds icepack_max_dic' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif if (n_don > icepack_max_don) then - print*, 'error:number of don types exceeds icepack_max_don' + write(nu_diag,*) 'error:number of don types exceeds icepack_max_don' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif if (n_fed > icepack_max_fe) then - print*, 'error:number of dissolved fe types exceeds icepack_max_fe' + write(nu_diag,*) 'error:number of dissolved fe types exceeds icepack_max_fe' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif if (n_fep > icepack_max_fe) then - print*, 'error:number of particulate fe types exceeds icepack_max_fe' + write(nu_diag,*) 'error:number of particulate fe types exceeds icepack_max_fe' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif @@ -1137,7 +1141,7 @@ subroutine init_zbgc if (tr_zaero .and. .not. z_tracers) z_tracers = .true. if (n_zaero > icepack_max_aero) then - print*, 'error:number of z aerosols exceeds icepack_max_aero' + write(nu_diag,*) 'error:number of z aerosols exceeds icepack_max_aero' call icedrv_system_abort(file=__FILE__,line=__LINE__) endif @@ -1169,9 +1173,9 @@ subroutine init_zbgc ! set Icepack values !----------------------------------------------------------------- - call icepack_init_parameters(ktherm_in=ktherm, shortwave_in=shortwave, & + call icepack_init_parameters( & scale_bgc_in=scale_bgc, skl_bgc_in=skl_bgc, z_tracers_in=z_tracers, & - dEdd_algae_in=dEdd_algae, solve_zbgc_in=solve_zbgc, & + dEdd_algae_in=dEdd_algae, solve_zbgc_in=solve_zbgc, grid_o_t_in=grid_o_t, & bgc_flux_type_in=bgc_flux_type, grid_o_in=grid_o, l_sk_in=l_sk, & initbio_frac_in=initbio_frac, frazil_scav_in=frazil_scav, & grid_oS_in=grid_oS, l_skS_in=l_skS, phi_snow_in=phi_snow, & @@ -1182,7 +1186,108 @@ subroutine init_zbgc fr_dFe_in=fr_dFe, k_nitrif_in=k_nitrif, t_iron_conv_in=t_iron_conv, & max_loss_in=max_loss, max_dfe_doc1_in=max_dfe_doc1, fr_resp_in=fr_resp, & fr_resp_s_in=fr_resp_s, y_sk_DMS_in=y_sk_DMS, t_sk_conv_in=t_sk_conv, & - t_sk_ox_in=t_sk_ox, modal_aero_in=modal_aero) + t_sk_ox_in=t_sk_ox, modal_aero_in=modal_aero, solve_zsal_in = solve_zsal) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & + file=__FILE__, line=__LINE__) + + call icepack_init_parameters ( & + ratio_Si2N_diatoms_in = ratio_Si2N_diatoms, & + ratio_Si2N_sp_in = ratio_Si2N_sp , & + ratio_Si2N_phaeo_in = ratio_Si2N_phaeo , & + ratio_S2N_diatoms_in = ratio_S2N_diatoms , & + ratio_S2N_sp_in = ratio_S2N_sp , & + ratio_S2N_phaeo_in = ratio_S2N_phaeo , & + ratio_Fe2C_diatoms_in = ratio_Fe2C_diatoms, & + ratio_Fe2C_sp_in = ratio_Fe2C_sp , & + ratio_Fe2C_phaeo_in = ratio_Fe2C_phaeo , & + ratio_Fe2N_diatoms_in = ratio_Fe2N_diatoms, & + ratio_Fe2N_sp_in = ratio_Fe2N_sp , & + ratio_Fe2N_phaeo_in = ratio_Fe2N_phaeo , & + ratio_C2N_diatoms_in = ratio_C2N_diatoms , & + ratio_C2N_sp_in = ratio_C2N_sp , & + ratio_C2N_phaeo_in = ratio_C2N_phaeo , & + ratio_C2N_proteins_in = ratio_C2N_proteins, & + ratio_chl2N_diatoms_in = ratio_chl2N_diatoms, & + ratio_chl2N_sp_in = ratio_chl2N_sp , & + ratio_chl2N_phaeo_in = ratio_chl2N_phaeo , & + ratio_Fe2DON_in = ratio_Fe2DON , & + ratio_Fe2DOC_s_in = ratio_Fe2DOC_s , & + ratio_Fe2DOC_l_in = ratio_Fe2DOC_l , & + F_abs_chl_diatoms_in = F_abs_chl_diatoms , & + F_abs_chl_sp_in = F_abs_chl_sp , & + F_abs_chl_phaeo_in = F_abs_chl_phaeo , & + tau_min_in = tau_min , & + tau_max_in = tau_max , & + chlabs_diatoms_in = chlabs_diatoms , & + chlabs_sp_in = chlabs_sp , & + chlabs_phaeo_in = chlabs_phaeo , & + alpha2max_low_diatoms_in = alpha2max_low_diatoms, & + alpha2max_low_sp_in = alpha2max_low_sp , & + alpha2max_low_phaeo_in = alpha2max_low_phaeo, & + beta2max_diatoms_in = beta2max_diatoms , & + beta2max_sp_in = beta2max_sp , & + beta2max_phaeo_in = beta2max_phaeo , & + mu_max_diatoms_in = mu_max_diatoms , & + mu_max_sp_in = mu_max_sp , & + mu_max_phaeo_in = mu_max_phaeo , & + grow_Tdep_diatoms_in = grow_Tdep_diatoms , & + grow_Tdep_sp_in = grow_Tdep_sp , & + grow_Tdep_phaeo_in = grow_Tdep_phaeo , & + fr_graze_diatoms_in = fr_graze_diatoms , & + fr_graze_sp_in = fr_graze_sp , & + fr_graze_phaeo_in = fr_graze_phaeo , & + mort_pre_diatoms_in = mort_pre_diatoms , & + mort_pre_sp_in = mort_pre_sp , & + mort_pre_phaeo_in = mort_pre_phaeo , & + mort_Tdep_diatoms_in = mort_Tdep_diatoms , & + mort_Tdep_sp_in = mort_Tdep_sp , & + mort_Tdep_phaeo_in = mort_Tdep_phaeo , & + k_exude_diatoms_in = k_exude_diatoms , & + k_exude_sp_in = k_exude_sp , & + k_exude_phaeo_in = k_exude_phaeo , & + K_Nit_diatoms_in = K_Nit_diatoms , & + K_Nit_sp_in = K_Nit_sp , & + K_Nit_phaeo_in = K_Nit_phaeo , & + K_Am_diatoms_in = K_Am_diatoms , & + K_Am_sp_in = K_Am_sp , & + K_Am_phaeo_in = K_Am_phaeo , & + K_Sil_diatoms_in = K_Sil_diatoms , & + K_Sil_sp_in = K_Sil_sp , & + K_Sil_phaeo_in = K_Sil_phaeo , & + K_Fe_diatoms_in = K_Fe_diatoms , & + K_Fe_sp_in = K_Fe_sp , & + K_Fe_phaeo_in = K_Fe_phaeo , & + f_doc_s_in = f_doc_s , & + f_doc_l_in = f_doc_l , & + f_don_protein_in = f_don_protein , & + kn_bac_protein_in = kn_bac_protein , & + f_don_Am_protein_in = f_don_Am_protein , & + f_exude_s_in = f_exude_s , & + f_exude_l_in = f_exude_l , & + k_bac_s_in = k_bac_s , & + k_bac_l_in = k_bac_l , & + algaltype_diatoms_in = algaltype_diatoms , & + algaltype_sp_in = algaltype_sp , & + algaltype_phaeo_in = algaltype_phaeo , & + dictype_1_in = dictype_1 , & + doctype_s_in = doctype_s , & + doctype_l_in = doctype_l , & + dontype_protein_in = dontype_protein , & + fedtype_1_in = fedtype_1 , & + feptype_1_in = feptype_1 , & + nitratetype_in = nitratetype , & + ammoniumtype_in = ammoniumtype , & + silicatetype_in = silicatetype , & + dmspptype_in = dmspptype , & + dmspdtype_in = dmspdtype , & + humtype_in = humtype , & + zaerotype_bc1_in = zaerotype_bc1 , & + zaerotype_bc2_in = zaerotype_bc2 , & + zaerotype_dust1_in = zaerotype_dust1 , & + zaerotype_dust2_in = zaerotype_dust2 , & + zaerotype_dust3_in = zaerotype_dust3 , & + zaerotype_dust4_in = zaerotype_dust4) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__, line=__LINE__) @@ -1219,7 +1324,8 @@ subroutine init_zbgc nlt_bgc_N(:) = 0 nlt_bgc_C(:) = 0 nlt_bgc_chl(:) = 0 - nt_bgc_N(:) = 0 + ! need some valid array indices if unset + nt_bgc_N(:) = max_ntrcr - n_algae*(nblyr+3) nt_bgc_C(:) = 0 nt_bgc_chl(:) = 0 @@ -1244,7 +1350,8 @@ subroutine init_zbgc ! vectors of size icepack_max_aero nlt_zaero(:) = 0 nlt_zaero_sw(:) = 0 - nt_zaero(:) = 0 + ! need some valid array indices if unset + nt_zaero(:) = max_ntrcr - n_zaero*(nblyr+3) nt_zaero_sw(:) = 0 nlt_bgc_Nit = 0 @@ -1269,106 +1376,6 @@ subroutine init_zbgc nt_bgc_hum = 0 nt_zbgc_frac = 0 - !----------------------------------------------------------------- - ! Define array parameters - !----------------------------------------------------------------- - - R_Si2N(1) = ratio_Si2N_diatoms - R_Si2N(2) = ratio_Si2N_sp - R_Si2N(3) = ratio_Si2N_phaeo - - R_S2N(1) = ratio_S2N_diatoms - R_S2N(2) = ratio_S2N_sp - R_S2N(3) = ratio_S2N_phaeo - - R_Fe2C(1) = ratio_Fe2C_diatoms - R_Fe2C(2) = ratio_Fe2C_sp - R_Fe2C(3) = ratio_Fe2C_phaeo - - R_Fe2N(1) = ratio_Fe2N_diatoms - R_Fe2N(2) = ratio_Fe2N_sp - R_Fe2N(3) = ratio_Fe2N_phaeo - - R_C2N(1) = ratio_C2N_diatoms - R_C2N(2) = ratio_C2N_sp - R_C2N(3) = ratio_C2N_phaeo - - R_chl2N(1) = ratio_chl2N_diatoms - R_chl2N(2) = ratio_chl2N_sp - R_chl2N(3) = ratio_chl2N_phaeo - - F_abs_chl(1) = F_abs_chl_diatoms - F_abs_chl(2) = F_abs_chl_sp - F_abs_chl(3) = F_abs_chl_phaeo - - R_Fe2DON(1) = ratio_Fe2DON - R_C2N_DON(1) = ratio_C2N_proteins - - R_Fe2DOC(1) = ratio_Fe2DOC_s - R_Fe2DOC(2) = ratio_Fe2DOC_l - R_Fe2DOC(3) = c0 - - chlabs(1) = chlabs_diatoms - chlabs(2) = chlabs_sp - chlabs(3) = chlabs_phaeo - - alpha2max_low(1) = alpha2max_low_diatoms - alpha2max_low(2) = alpha2max_low_sp - alpha2max_low(3) = alpha2max_low_phaeo - - beta2max(1) = beta2max_diatoms - beta2max(2) = beta2max_sp - beta2max(3) = beta2max_phaeo - - mu_max(1) = mu_max_diatoms - mu_max(2) = mu_max_sp - mu_max(3) = mu_max_phaeo - - grow_Tdep(1) = grow_Tdep_diatoms - grow_Tdep(2) = grow_Tdep_sp - grow_Tdep(3) = grow_Tdep_phaeo - - fr_graze(1) = fr_graze_diatoms - fr_graze(2) = fr_graze_sp - fr_graze(3) = fr_graze_phaeo - - mort_pre(1) = mort_pre_diatoms - mort_pre(2) = mort_pre_sp - mort_pre(3) = mort_pre_phaeo - - mort_Tdep(1) = mort_Tdep_diatoms - mort_Tdep(2) = mort_Tdep_sp - mort_Tdep(3) = mort_Tdep_phaeo - - k_exude(1) = k_exude_diatoms - k_exude(2) = k_exude_sp - k_exude(3) = k_exude_phaeo - - K_Nit(1) = K_Nit_diatoms - K_Nit(2) = K_Nit_sp - K_Nit(3) = K_Nit_phaeo - - K_Am(1) = K_Am_diatoms - K_Am(2) = K_Am_sp - K_Am(3) = K_Am_phaeo - - K_Sil(1) = K_Sil_diatoms - K_Sil(2) = K_Sil_sp - K_Sil(3) = K_Sil_phaeo - - K_Fe(1) = K_Fe_diatoms - K_Fe(2) = K_Fe_sp - K_Fe(3) = K_Fe_phaeo - - f_don(1) = f_don_protein - kn_bac(1) = kn_bac_protein - f_don_Am(1) = f_don_Am_protein - - f_exude(1) = f_exude_s - f_exude(2) = f_exude_l - k_bac(1) = k_bac_s - k_bac(2) = k_bac_l - dictype(:) = -c1 algaltype(1) = algaltype_diatoms @@ -1381,6 +1388,7 @@ subroutine init_zbgc dontype(1) = dontype_protein fedtype(1) = fedtype_1 + feptype(1) = feptype_1 zaerotype(1) = zaerotype_bc1 @@ -1390,31 +1398,6 @@ subroutine init_zbgc zaerotype(5) = zaerotype_dust3 zaerotype(6) = zaerotype_dust4 - call icepack_init_zbgc ( & - R_Si2N_in=R_Si2N, & - R_S2N_in=R_S2N, R_Fe2C_in=R_Fe2C, R_Fe2N_in=R_Fe2N, R_C2N_in=R_C2N, & - R_chl2N_in=R_chl2N, F_abs_chl_in=F_abs_chl, R_Fe2DON_in=R_Fe2DON, & - R_C2N_DON_in=R_C2N_DON, & - R_Fe2DOC_in=R_Fe2DOC, & - chlabs_in=chlabs, alpha2max_low_in=alpha2max_low, beta2max_in=beta2max, & - mu_max_in=mu_max, grow_Tdep_in=grow_Tdep, fr_graze_in=fr_graze, & - mort_pre_in=mort_pre, & - mort_Tdep_in=mort_Tdep, k_exude_in=k_exude, & - K_Nit_in=K_Nit, K_Am_in=K_Am, K_sil_in=K_Sil, K_Fe_in=K_Fe, & - f_don_in=f_don, kn_bac_in=kn_bac, f_don_Am_in=f_don_Am, f_exude_in=f_exude, & - k_bac_in=k_bac, & - fr_resp_in=fr_resp, algal_vel_in=algal_vel, R_dFe2dust_in=R_dFe2dust, & - dustFe_sol_in=dustFe_sol, T_max_in=T_max, fr_mort2min_in=fr_mort2min, & - fr_dFe_in=fr_dFe, op_dep_min_in=op_dep_min, & - fr_graze_s_in=fr_graze_s, fr_graze_e_in=fr_graze_e, & - k_nitrif_in=k_nitrif, t_iron_conv_in=t_iron_conv, & - max_loss_in=max_loss, max_dfe_doc1_in=max_dfe_doc1, & - fr_resp_s_in=fr_resp_s, y_sk_DMS_in=y_sk_DMS, & - t_sk_conv_in=t_sk_conv, t_sk_ox_in=t_sk_ox, fsal_in=fsal) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & - file=__FILE__, line=__LINE__) - if (skl_bgc) then nk = 1 @@ -1780,7 +1763,6 @@ subroutine init_zbgc write(nu_diag,1010) ' skl_bgc = ', skl_bgc write(nu_diag,1030) ' bgc_flux_type = ', bgc_flux_type - write(nu_diag,1010) ' restore_bgc = ', restore_bgc write(nu_diag,*) ' bgc_data_type = ', & trim(bgc_data_type) write(nu_diag,1020) ' number of bio tracers = ', nbtrcr @@ -1832,11 +1814,14 @@ subroutine init_zbgc write(nu_diag,1010) ' tr_bgc_DON = ', tr_bgc_DON write(nu_diag,1010) ' tr_bgc_Fe = ', tr_bgc_Fe write(nu_diag,1000) ' grid_o = ', grid_o + write(nu_diag,1000) ' grid_o_t = ', grid_o_t write(nu_diag,1005) ' l_sk = ', l_sk write(nu_diag,1000) ' initbio_frac = ', initbio_frac write(nu_diag,1000) ' frazil_scav = ', frazil_scav - endif ! skl_bgc or solve_bgc + endif ! skl_bgc or z_tracers + + call icedrv_system_flush(nu_diag) 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements 1005 format (a30,2x,f9.6) ! float diff --git a/configuration/driver/icedrv_restart.F90 b/configuration/driver/icedrv_restart.F90 index 762d1b388..c9b076677 100644 --- a/configuration/driver/icedrv_restart.F90 +++ b/configuration/driver/icedrv_restart.F90 @@ -13,7 +13,7 @@ module icedrv_restart use icedrv_restart_shared, only: restart_format use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted use icepack_intfc, only: icepack_query_tracer_flags, icepack_query_tracer_indices - use icepack_intfc, only: icepack_query_parameters + use icepack_intfc, only: icepack_query_parameters, icepack_query_tracer_sizes use icedrv_system, only: icedrv_system_abort #ifdef USE_NETCDF use netcdf @@ -261,7 +261,6 @@ subroutine restartfile (ice_ic) use icedrv_restart_shared, only: restart_format use icedrv_arrays_column, only: dhsn, ffracn, hin_max use icedrv_arrays_column, only: first_ice, first_ice_real - use icepack_tracers, only: ntrcr, nbtrcr character (*), optional :: ice_ic @@ -270,6 +269,9 @@ subroutine restartfile (ice_ic) integer (kind=int_kind) :: & i, k ! counting indices + integer (kind=int_kind) :: & + ntrcr + integer (kind=int_kind) :: & nt_Tsfc, nt_sice, nt_qice, nt_qsno @@ -287,7 +289,7 @@ subroutine restartfile (ice_ic) ! Query tracers 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) - + call icepack_query_tracer_sizes(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_iso_out=tr_iso, & tr_brine_out=tr_brine, & @@ -415,22 +417,20 @@ subroutine restartfile (ice_ic) do i = 1, nx if (tmask(i)) & - call icepack_aggregate (ncat=ncat, & - aicen=aicen(i,:), & - trcrn=trcrn(i,:,:), & - vicen=vicen(i,:), & - vsnon=vsnon(i,:), & - aice=aice (i), & - trcr=trcr (i,:), & - vice=vice (i), & - vsno=vsno (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, & - Tf = Tf(i)) + call icepack_aggregate(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), & + 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,:), & + Tf = Tf(i)) aice_init(i) = aice(i) enddo diff --git a/configuration/driver/icedrv_state.F90 b/configuration/driver/icedrv_state.F90 index 1a9ca66f5..74ae11f7e 100644 --- a/configuration/driver/icedrv_state.F90 +++ b/configuration/driver/icedrv_state.F90 @@ -42,14 +42,12 @@ module icedrv_state ! state of the ice aggregated over all categories !----------------------------------------------------------------- - real (kind=dbl_kind), dimension(nx), & - public :: & + real (kind=dbl_kind), dimension(nx), public :: & aice , & ! concentration of ice vice , & ! volume per unit area of ice (m) vsno ! volume per unit area of snow (m) - real (kind=dbl_kind), & - dimension(nx,max_ntrcr), public :: & + real (kind=dbl_kind), dimension(nx,max_ntrcr), public :: & trcr ! ice tracers ! 1: surface temperature of ice/snow (C) @@ -57,18 +55,15 @@ module icedrv_state ! state of the ice for each category !----------------------------------------------------------------- - real (kind=dbl_kind), dimension (nx), & - public:: & + real (kind=dbl_kind), dimension (nx), public:: & aice0 ! concentration of open water - real (kind=dbl_kind), & - dimension (nx,ncat), public :: & + real (kind=dbl_kind), dimension (nx,ncat), public :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) vsnon ! volume per unit area of snow (m) - real (kind=dbl_kind), public, & - dimension (nx,max_ntrcr,ncat) :: & + real (kind=dbl_kind), dimension (nx,max_ntrcr,ncat), public :: & trcrn ! tracers ! 1: surface temperature of ice/snow (C) diff --git a/configuration/driver/icedrv_step.F90 b/configuration/driver/icedrv_step.F90 index dc86ac398..13f6f2f83 100644 --- a/configuration/driver/icedrv_step.F90 +++ b/configuration/driver/icedrv_step.F90 @@ -112,8 +112,8 @@ subroutine step_therm1 (dt) use icedrv_arrays_column, only: fswthrun, fswthrun_vdr, fswthrun_vdf, fswthrun_idr, fswthrun_idf use icedrv_arrays_column, only: meltsliqn, meltsliq use icedrv_calendar, only: yday - use icedrv_domain_size, only: ncat, nilyr, nslyr, n_aero, n_iso, nx - use icedrv_flux, only: frzmlt, sst, Tf, strocnxT, strocnyT, rside, fside, wlat, & + use icedrv_domain_size, only: ncat, nilyr, nslyr, n_aero, n_iso, nfsd, nx + use icedrv_flux, only: frzmlt, sst, Tf, strocnxT, strocnyT, rsiden, wlat, & fbot, Tbot, Tsnice use icedrv_flux, only: meltsn, melttn, meltbn, congeln, snoicen, uatm, vatm use icedrv_flux, only: wind, rhoa, potT, Qa, Qa_iso, zlvl, strax, stray, flatn @@ -151,7 +151,7 @@ subroutine step_therm1 (dt) integer (kind=int_kind) :: & ntrcr, nt_apnd, nt_hpnd, nt_ipnd, nt_alvl, nt_vlvl, nt_Tsfc, & - nt_iage, nt_FY, nt_qice, nt_sice, nt_qsno, & + nt_iage, nt_FY, nt_qice, nt_sice, nt_qsno, nt_fsd, & nt_aero, nt_isosno, nt_isoice, nt_rsnw, nt_smice, nt_smliq logical (kind=log_kind) :: & @@ -202,7 +202,7 @@ subroutine step_therm1 (dt) nt_qice_out=nt_qice, nt_sice_out=nt_sice, & nt_aero_out=nt_aero, nt_qsno_out=nt_qsno, & nt_rsnw_out=nt_rsnw, nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, & - nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice) + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice, nt_fsd_out=nt_fsd) call icepack_warnings_flush(nu_diag) if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & file=__FILE__,line= __LINE__) @@ -237,7 +237,6 @@ subroutine step_therm1 (dt) enddo ! i do i = 1, nx -!echmod do i = 3,3 if (tr_aero) then ! trcrn(nt_aero) has units kg/m^3 do n = 1, ncat @@ -272,7 +271,7 @@ subroutine step_therm1 (dt) enddo endif ! snwgrain - call icepack_step_therm1(dt=dt, ncat=ncat, nilyr=nilyr, nslyr=nslyr, & + call icepack_step_therm1(dt=dt, & aicen_init = aicen_init(i,:), & vicen_init = vicen_init(i,:), & vsnon_init = vsnon_init(i,:), & @@ -326,7 +325,7 @@ subroutine step_therm1 (dt) strocnxT = strocnxT(i), strocnyT = strocnyT(i), & fbot = fbot(i), frzmlt = frzmlt(i), & Tbot = Tbot(i), Tsnice = Tsnice(i), & - rside = rside(i), fside = fside(i), & + rsiden = rsiden(i,:), & wlat = wlat(i), & fsnow = fsnow(i), frain = frain(i), & fpond = fpond(i), fsloss = fsloss(i), & @@ -371,6 +370,7 @@ subroutine step_therm1 (dt) snoice = snoice(i), snoicen = snoicen(i,:), & dsnow = dsnow(i), dsnown = dsnown(i,:), & meltsliqn= meltsliqn(i,:), & + afsdn = trcrn (i,nt_fsd:nt_fsd+nfsd-1,:), & lmask_n = lmask_n(i), lmask_s = lmask_s(i), & mlt_onset=mlt_onset(i), frz_onset = frz_onset(i), & yday = yday, prescribed_ice = prescribed_ice) @@ -430,14 +430,13 @@ subroutine step_therm2 (dt) use icedrv_arrays_column, only: hin_max, ocean_bio, & wave_sig_ht, wave_spectrum, & wavefreq, dwavefreq, & - floe_rad_c, floe_binwidth, & d_afsd_latg, d_afsd_newi, d_afsd_latm, d_afsd_weld - use icedrv_arrays_column, only: first_ice, bgrid, cgrid, igrid + use icedrv_arrays_column, only: first_ice use icedrv_calendar, only: yday use icedrv_domain_size, only: ncat, nilyr, nslyr, n_aero, nblyr, & - nltrcr, nx, nfsd + nx use icedrv_flux, only: fresh, frain, fpond, frzmlt, frazil, frz_onset - use icedrv_flux, only: fsalt, Tf, sss, salinz, fhocn, rside, fside, wlat + use icedrv_flux, only: fsalt, Tf, sss, salinz, fhocn, rsiden, wlat use icedrv_flux, only: meltl, frazil_diag, flux_bio, faero_ocn, fiso_ocn use icedrv_flux, only: HDO_ocn, H2_16O_ocn, H2_18O_ocn use icedrv_init, only: tmask @@ -483,9 +482,8 @@ subroutine step_therm2 (dt) if (tr_fsd) & wave_sig_ht(i) = c4*SQRT(SUM(wave_spectrum(i,:)*dwavefreq(:))) - call icepack_step_therm2(dt=dt, ncat=ncat, & - nltrcr=nltrcr, nilyr=nilyr, nslyr=nslyr, & - hin_max=hin_max(:), nblyr=nblyr, & + call icepack_step_therm2(dt=dt, & + hin_max=hin_max(:), & aicen=aicen(i,:), & vicen=vicen(i,:), & vsnon=vsnon(i,:), & @@ -499,15 +497,14 @@ subroutine step_therm2 (dt) n_trcr_strata=n_trcr_strata(1:ntrcr), & nt_strata=nt_strata(1:ntrcr,:), & Tf=Tf(i), sss=sss(i), & - salinz=salinz(i,:), fside=fside(i), & + salinz=salinz(i,:), & wlat=wlat(i), & - rside=rside(i), meltl=meltl(i), & + rsiden=rsiden(i,:), meltl=meltl(i), & frzmlt=frzmlt(i), frazil=frazil(i), & frain=frain(i), fpond=fpond(i), & fresh=fresh(i), fsalt=fsalt(i), & fhocn=fhocn(i), & - bgrid=bgrid, cgrid=cgrid, & - igrid=igrid, faero_ocn=faero_ocn(i,:), & + faero_ocn=faero_ocn(i,:), & first_ice=first_ice(i,:), & flux_bio=flux_bio(i,1:nbtrcr), & ocean_bio=ocean_bio(i,1:nbtrcr), & @@ -518,16 +515,14 @@ subroutine step_therm2 (dt) HDO_ocn=HDO_ocn(i), & H2_16O_ocn=H2_16O_ocn(i), & H2_18O_ocn=H2_18O_ocn(i), & - nfsd=nfsd, wave_sig_ht=wave_sig_ht(i), & + wave_sig_ht=wave_sig_ht(i), & wave_spectrum=wave_spectrum(i,:), & wavefreq=wavefreq(:), & dwavefreq=dwavefreq(:), & d_afsd_latg=d_afsd_latg(i,:), & d_afsd_newi=d_afsd_newi(i,:), & d_afsd_latm=d_afsd_latm(i,:), & - d_afsd_weld=d_afsd_weld(i,:), & - floe_rad_c=floe_rad_c(:), & - floe_binwidth=floe_binwidth(:)) + d_afsd_weld=d_afsd_weld(i,:)) endif ! tmask @@ -603,20 +598,21 @@ subroutine update_state (dt, daidt, dvidt, dagedt, offset) ! Aggregate the updated state variables (includes ghost cells). !----------------------------------------------------------------- - if (tmask(i)) then - call icepack_aggregate (ncat=ncat, & - aicen=aicen(i,:), trcrn=trcrn(i,1:ntrcr,:), & - vicen=vicen(i,:), vsnon=vsnon(i,:), & - aice =aice (i), trcr =trcr (i,1:ntrcr), & - 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,:), & - Tf=Tf(i)) - endif + if (tmask(i)) & + call icepack_aggregate(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), & + 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,:), & + Tf = Tf(i)) if (present(offset)) then @@ -656,8 +652,8 @@ end subroutine update_state subroutine step_dyn_wave (dt) use icedrv_arrays_column, only: wave_spectrum, wave_sig_ht, & - d_afsd_wave, floe_rad_l, floe_rad_c, wavefreq, dwavefreq - use icedrv_domain_size, only: ncat, nfsd, nfreq, nx + d_afsd_wave, wavefreq, dwavefreq + use icedrv_domain_size, only: ncat, nfreq, nx use icedrv_state, only: trcrn, aicen, aice, vice use icepack_intfc, only: icepack_step_wavefracture @@ -683,15 +679,13 @@ subroutine step_dyn_wave (dt) do i = 1, nx d_afsd_wave(i,:) = c0 call icepack_step_wavefracture (wave_spec_type=wave_spec_type, & - dt=dt, ncat=ncat, nfsd=nfsd, nfreq=nfreq, & + dt=dt, nfreq=nfreq, & aice = aice (i), & vice = vice (i), & aicen = aicen (i,:), & - floe_rad_l = floe_rad_l (:), & - floe_rad_c = floe_rad_c (:), & wave_spectrum = wave_spectrum(i,:), & - wavefreq = wavefreq (:), & - dwavefreq = dwavefreq (:), & + wavefreq = wavefreq (:), & + dwavefreq = dwavefreq (:), & trcrn = trcrn (i,:,:), & d_afsd_wave = d_afsd_wave (i,:)) end do ! i @@ -868,9 +862,7 @@ subroutine step_dyn_ridge (dt, ndtd) if (tmask(i)) then call icepack_step_ridge(dt=dt, ndtd=ndtd, & - nilyr=nilyr, nslyr=nslyr, & - nblyr=nblyr, & - ncat=ncat, hin_max=hin_max(:), & + hin_max=hin_max(:), & rdg_conv=rdg_conv(i), rdg_shear=rdg_shear(i), & aicen=aicen(i,:), & trcrn=trcrn(i,1:ntrcr,:), & @@ -884,7 +876,6 @@ subroutine step_dyn_ridge (dt, ndtd) dvirdgdt=dvirdgdt(i), opening=opening(i), & fpond=fpond(i), & fresh=fresh(i), fhocn=fhocn(i), & - n_aero=n_aero, & faero_ocn=faero_ocn(i,:), fiso_ocn=fiso_ocn(i,:), & aparticn=aparticn(i,:), krdgn=krdgn(i,:), & aredistn=aredistn(i,:), vredistn=vredistn(i,:), & @@ -911,9 +902,7 @@ subroutine step_dyn_ridge (dt, ndtd) if (tmask(i)) then call icepack_step_ridge (dt=dt, ndtd=ndtd, & - nilyr=nilyr, nslyr=nslyr, & - nblyr=nblyr, & - ncat=ncat, hin_max=hin_max(:), & + hin_max=hin_max(:), & rdg_conv=rdg_conv(i), rdg_shear=rdg_shear(i), & aicen=aicen(i,:), & trcrn=trcrn(i,1:ntrcr,:), & @@ -927,7 +916,6 @@ subroutine step_dyn_ridge (dt, ndtd) dvirdgdt=dvirdgdt(i), opening=opening(i), & fpond=fpond(i), & fresh=fresh(i), fhocn=fhocn(i), & - n_aero=n_aero, & faero_ocn=faero_ocn(i,:), fiso_ocn=fiso_ocn(i,:), & aparticn=aparticn(i,:), krdgn=krdgn(i,:), & aredistn=aredistn(i,:), vredistn=vredistn(i,:), & @@ -998,8 +986,7 @@ subroutine step_snow (dt) do i = 1, nx - call icepack_step_snow (dt, nilyr, & - nslyr, ncat, & + call icepack_step_snow (dt, & wind (i), aice (i), & aicen(i,:), vicen (i,:), & vsnon(i,:), trcrn(i,nt_Tsfc,:), & @@ -1032,7 +1019,6 @@ subroutine step_radiation (dt) use icedrv_arrays_column, only: fswthrun, fswthrun_vdr, fswthrun_vdf, fswthrun_idr, fswthrun_idf use icedrv_arrays_column, only: albicen, albsnon, albpndn use icedrv_arrays_column, only: alvdrn, alidrn, alvdfn, alidfn, apeffn, trcrn_sw, snowfracn - use icedrv_arrays_column, only: swgrid, igrid use icedrv_calendar, only: yday, sec use icedrv_domain_size, only: ncat, n_aero, nilyr, nslyr, n_zaero, n_algae, nblyr, nx use icedrv_flux, only: swvdr, swvdf, swidr, swidf, coszen, fsnow @@ -1132,7 +1118,6 @@ subroutine step_radiation (dt) if (tmask(i)) then call icepack_step_radiation(dt=dt, & - swgrid=swgrid(:), igrid=igrid(:), & fbri=fbri(:), & aicen=aicen(i,:), vicen=vicen(i,:), & vsnon=vsnon(i,:), & @@ -1333,13 +1318,12 @@ subroutine biogeochemistry (dt) use icedrv_arrays_column, only: fbio_snoice, fbio_atmice, ocean_bio use icedrv_arrays_column, only: first_ice, fswpenln, bphi, bTiz, ice_bio_net use icedrv_arrays_column, only: snow_bio_net, fswthrun - use icedrv_arrays_column, only: ocean_bio_all, sice_rho - use icedrv_arrays_column, only: bgrid, igrid, icgrid, cgrid + use icedrv_arrays_column, only: ocean_bio_all use icepack_intfc, only: icepack_biogeochemistry, icepack_load_ocean_bio_array use icedrv_domain_size, only: nblyr, nilyr, nslyr, n_algae, n_zaero, ncat use icedrv_domain_size, only: n_doc, n_dic, n_don, n_fed, n_fep, nx use icedrv_flux, only: meltbn, melttn, congeln, snoicen - use icedrv_flux, only: sst, sss, fsnow, meltsn + use icedrv_flux, only: sst, sss, Tf, fsnow, meltsn use icedrv_flux, only: hin_old, flux_bio, flux_bio_atm, faero_atm use icedrv_flux, only: nit, amm, sil, dmsp, dms, algalN, doc, don, dic, fed, fep, zaeros, hum use icedrv_state, only: aicen_init, vicen_init, aicen, vicen, vsnon @@ -1417,10 +1401,7 @@ subroutine biogeochemistry (dt) ! Define ocean concentrations for tracers used in simulation do i = 1, nx - call icepack_load_ocean_bio_array(max_nbtrcr=max_nbtrcr,& - max_algae = max_algae, max_don = max_don, & - max_doc = max_doc, max_dic = max_dic, & - max_aero = max_aero, max_fe = max_fe, & + call icepack_load_ocean_bio_array( & nit = nit(i), amm = amm(i), & sil = sil(i), dmsp = dmsp(i), & dms = dms(i), algalN = algalN(i,:), & @@ -1429,6 +1410,7 @@ subroutine biogeochemistry (dt) fep = fep(i,:), zaeros = zaeros(i,:), & ocean_bio_all=ocean_bio_all(i,:), & hum=hum(i)) +! handled below ! call icepack_warnings_flush(nu_diag) ! if (icepack_warnings_aborted()) call icedrv_system_abort(i, istep1, subname, & ! file=__FILE__,line= __LINE__) @@ -1442,12 +1424,7 @@ subroutine biogeochemistry (dt) enddo ! mm endif - call icepack_biogeochemistry(dt=dt, ntrcr=ntrcr, nbtrcr=nbtrcr, & - ncat=ncat, nblyr=nblyr, nilyr=nilyr, nslyr=nslyr, & - n_algae=n_algae, n_zaero=n_zaero, & - n_doc=n_doc, n_dic=n_dic, n_don=n_don, & - n_fed=n_fed, n_fep=n_fep, & - bgrid=bgrid, igrid=igrid, icgrid=icgrid, cgrid=cgrid, & + call icepack_biogeochemistry(dt=dt, & upNO = upNO(i), & upNH = upNH(i), & iDi = iDi(i,:,:), & @@ -1470,13 +1447,13 @@ subroutine biogeochemistry (dt) ice_bio_net = ice_bio_net(i,1:nbtrcr), & snow_bio_net = snow_bio_net(i,1:nbtrcr), & fswthrun = fswthrun(i,:), & - sice_rho = sice_rho(i,:), & meltbn = meltbn(i,:), & melttn = melttn(i,:), & congeln = congeln(i,:), & snoicen = snoicen(i,:), & sst = sst(i), & sss = sss(i), & + Tf = Tf(i), & fsnow = fsnow(i), & meltsn = meltsn(i,:), & hin_old = hin_old(i,:), & @@ -1489,9 +1466,8 @@ subroutine biogeochemistry (dt) vsnon = vsnon(i,:), & aice0 = aice0(i), & trcrn = trcrn(i,1:ntrcr,:), & - vsnon_init = vsnon_init(i,:), & - skl_bgc = skl_bgc) - + vsnon_init = vsnon_init(i,:)) +! handled below ! call icepack_warnings_flush(nu_diag) ! if (icepack_warnings_aborted()) call icedrv_system_abort(i, istep1, subname, & ! __FILE__, __LINE__) diff --git a/configuration/driver/icedrv_system.F90 b/configuration/driver/icedrv_system.F90 index 46203735f..ddd293d08 100644 --- a/configuration/driver/icedrv_system.F90 +++ b/configuration/driver/icedrv_system.F90 @@ -13,7 +13,8 @@ module icedrv_system implicit none private - public :: icedrv_system_abort + public :: icedrv_system_abort, & + icedrv_system_flush !======================================================================= @@ -46,10 +47,29 @@ subroutine icedrv_system_abort(icell, istep, string, file, line) if (present(istep)) write (nu_diag,*) subname,' istep =', istep if (present(icell)) write (nu_diag,*) subname,' i, aice =', icell, aice(icell) if (present(string)) write (nu_diag,*) subname,' string = ',trim(string) + call icedrv_system_flush(nu_diag) stop end subroutine icedrv_system_abort +!======================================================================= +! flushes iunit IO buffer + + subroutine icedrv_system_flush(iunit) + + integer (kind=int_kind), intent(in) :: & + iunit ! unit number to flush + + ! local variables + + character(len=*), parameter :: subname='(icedrv_system_flush)' + +#ifndef NO_F2003 + flush(iunit) +#endif + + end subroutine icedrv_system_flush + !======================================================================= end module icedrv_system diff --git a/configuration/scripts/icepack.batch.csh b/configuration/scripts/icepack.batch.csh index a104b8ff3..8a077969d 100755 --- a/configuration/scripts/icepack.batch.csh +++ b/configuration/scripts/icepack.batch.csh @@ -55,6 +55,21 @@ cat >> ${jobfile} << EOFB #PBS -l job_priority=regular #PBS -N ${ICE_CASENAME} #PBS -A ${acct} +#PBS -l select=${nnodes}:ncpus=${corespernode}:mpiprocs=${taskpernodelimit}:ompthreads=${nthrds}:mem=5GB +#PBS -l walltime=${ICE_RUNLENGTH} +#PBS -j oe +#PBS -W umask=022 +#PBS -o ${ICE_CASEDIR} +###PBS -M username@domain.com +###PBS -m be +EOFB + +else if (${ICE_MACHINE} =~ casper*) then +cat >> ${jobfile} << EOFB +#PBS -q ${ICE_MACHINE_QUEUE} +#PBS -l job_priority=regular +#PBS -N ${ICE_CASENAME} +#PBS -A ${acct} #PBS -l select=${nnodes}:ncpus=${corespernode}:mpiprocs=${taskpernodelimit}:ompthreads=${nthrds} #PBS -l walltime=${ICE_RUNLENGTH} #PBS -j oe @@ -127,6 +142,23 @@ cat >> ${jobfile} << EOFB ###SBATCH --mail-user username@domain.com EOFB +else if (${ICE_MACHINE} =~ perlmutter*) then +@ nthrds2 = ${nthrds} * 2 +cat >> ${jobfile} << EOFB +#SBATCH -J ${ICE_CASENAME} +#SBATCH -A ${acct} +#SBATCH --qos ${ICE_MACHINE_QUEUE} +#SBATCH --time ${ICE_RUNLENGTH} +#SBATCH --nodes ${nnodes} +#SBATCH --ntasks ${ncores} +#SBATCH --cpus-per-task ${nthrds2} +#SBATCH --constraint cpu +###SBATCH -e filename +###SBATCH -o filename +###SBATCH --mail-type FAIL +###SBATCH --mail-user username@domain.com +EOFB + else if (${ICE_MACHINE} =~ compy*) then cat >> ${jobfile} << EOFB #SBATCH -J ${ICE_CASENAME} diff --git a/configuration/scripts/icepack.build b/configuration/scripts/icepack.build index 2dd444fde..f897de471 100755 --- a/configuration/scripts/icepack.build +++ b/configuration/scripts/icepack.build @@ -68,8 +68,8 @@ setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DNXGLOB=${ICE_NXGLOB} -DNICELYR=${NICELYR} - if (${ICE_IOTYPE} == 'netcdf') then setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DUSE_NETCDF" endif -if (${ICE_SNICARHC} == 'true') then - setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DUSE_SNICARHC" +if (${ICE_SNICARHC} == 'false') then + setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DNO_SNICARHC" endif ### List of source code directories (in order of importance). diff --git a/configuration/scripts/icepack.launch.csh b/configuration/scripts/icepack.launch.csh index dc7ddd489..5218f0c9c 100755 --- a/configuration/scripts/icepack.launch.csh +++ b/configuration/scripts/icepack.launch.csh @@ -14,6 +14,13 @@ cat >> ${jobfile} << EOFR aprun -n 1 -N 1 -d 1 ./icepack >&! \$ICE_RUNLOG_FILE EOFR +#========================================== + +else if (${ICE_MACHINE} =~ perlmutter) then +cat >> ${jobfile} << EOFR +srun --cpu-bind=cores ./icepack >&! \$ICE_RUNLOG_FILE +EOFR + #========================================== else cat >> ${jobfile} << EOFR diff --git a/configuration/scripts/icepack_in b/configuration/scripts/icepack_in index bbf7a5973..d831c2d53 100644 --- a/configuration/scripts/icepack_in +++ b/configuration/scripts/icepack_in @@ -113,6 +113,7 @@ cpl_frazil = 'fresh_ice_correction' update_ocn_f = .false. l_mpond_fresh = .false. + congel_freeze = 'two-step' tfrz_option = 'mushy' ice_ref_salinity = 4.0 saltflux_option = 'constant' @@ -155,7 +156,6 @@ dEdd_algae = .false. solve_zbgc = .false. bgc_flux_type = 'Jin2006' - restore_bgc = .false. scale_bgc = .false. solve_zsal = .false. tr_bgc_Nit = .false. @@ -169,11 +169,12 @@ tr_bgc_DON = .false. tr_bgc_Fe = .false. grid_o = 0.006 - l_sk = 0.024 + grid_o_t = 0.006 + l_sk = 2.0 grid_oS = 0.0 l_skS = 0.028 - phi_snow = -0.3 - initbio_frac = 0.8 + phi_snow = -1.0 + initbio_frac = 1.0 frazil_scav = 0.8 ratio_Si2N_diatoms = 1.8 ratio_Si2N_sp = 0.0 @@ -191,29 +192,29 @@ ratio_Fe2DOC_s = 0.1 ratio_Fe2DOC_l = 0.033 fr_resp = 0.05 - tau_min = 5200.0 - tau_max = 173000.0 - algal_vel = 0.0000000111 + tau_min = 3600.0 + tau_max = 604800.0 + algal_vel = 0.0000001 R_dFe2dust = 0.035 dustFe_sol = 0.005 chlabs_diatoms = 0.03 chlabs_sp = 0.01 chlabs_phaeo = 0.05 - alpha2max_low_diatoms = 0.8 - alpha2max_low_sp = 0.67 - alpha2max_low_phaeo = 0.67 - beta2max_diatoms = 0.018 - beta2max_sp = 0.0025 - beta2max_phaeo = 0.01 + alpha2max_low_diatoms = 0.3 + alpha2max_low_sp = 0.2 + alpha2max_low_phaeo = 0.17 + beta2max_diatoms = 0.001 + beta2max_sp = 0.001 + beta2max_phaeo = 0.04 mu_max_diatoms = 1.44 - mu_max_sp = 0.851 - mu_max_phaeo = 0.851 - grow_Tdep_diatoms = 0.06 - grow_Tdep_sp = 0.06 - grow_Tdep_phaeo = 0.06 - fr_graze_diatoms = 0.0 - fr_graze_sp = 0.1 - fr_graze_phaeo = 0.1 + mu_max_sp = 0.41 + mu_max_phaeo = 0.63 + grow_Tdep_diatoms = 0.063 + grow_Tdep_sp = 0.063 + grow_Tdep_phaeo = 0.063 + fr_graze_diatoms = 0.19 + fr_graze_sp = 0.19 + fr_graze_phaeo = 0.19 mort_pre_diatoms = 0.007 mort_pre_sp = 0.007 mort_pre_phaeo = 0.007 @@ -236,10 +237,10 @@ K_Fe_sp = 0.2 K_Fe_phaeo = 0.1 f_don_protein = 0.6 - kn_bac_protein = 0.03 - f_don_Am_protein = 0.25 - f_doc_s = 0.4 - f_doc_l = 0.4 + kn_bac_protein = 0.2 + f_don_Am_protein = 1.0 + f_doc_s = 0.5 + f_doc_l = 0.5 f_exude_s = 1.0 f_exude_l = 1.0 k_bac_s = 0.03 @@ -249,36 +250,36 @@ op_dep_min = 0.1 fr_graze_s = 0.5 fr_graze_e = 0.5 - fr_mort2min = 0.5 - fr_dFe = 0.3 - k_nitrif = 0.0 + fr_mort2min = 0.9 + fr_dFe = 1.0 + k_nitrif = 0.046 t_iron_conv = 3065.0 max_loss = 0.9 max_dfe_doc1 = 0.2 - fr_resp_s = 0.75 - y_sk_DMS = 0.5 - t_sk_conv = 3.0 - t_sk_ox = 10.0 + fr_resp_s = 0.9 + y_sk_DMS = 0.7 + t_sk_conv = 5.0 + t_sk_ox = 12.0 algaltype_diatoms = 0.0 - algaltype_sp = 0.5 - algaltype_phaeo = 0.5 + algaltype_sp = 0.0 + algaltype_phaeo = 0.0 nitratetype = -1.0 - ammoniumtype = 1.0 + ammoniumtype = 0.0 silicatetype = -1.0 dmspptype = 0.5 - dmspdtype = -1.0 - humtype = 1.0 - doctype_s = 0.5 - doctype_l = 0.5 - dontype_protein = 0.5 - fedtype_1 = 0.5 + dmspdtype = 0.0 + humtype = 0.0 + doctype_s = 0.0 + doctype_l = 0.0 + dontype_protein = 0.0 + fedtype_1 = 0.0 feptype_1 = 0.5 - zaerotype_bc1 = 1.0 - zaerotype_bc2 = 1.0 - zaerotype_dust1 = 1.0 - zaerotype_dust2 = 1.0 - zaerotype_dust3 = 1.0 - zaerotype_dust4 = 1.0 + zaerotype_bc1 = -1.0 + zaerotype_bc2 = -1.0 + zaerotype_dust1 = -1.0 + zaerotype_dust2 = -1.0 + zaerotype_dust3 = -1.0 + zaerotype_dust4 = -1.0 ratio_C2N_diatoms = 7.0 ratio_C2N_sp = 7.0 ratio_C2N_phaeo = 7.0 @@ -288,6 +289,6 @@ F_abs_chl_diatoms = 2.0 F_abs_chl_sp = 4.0 F_abs_chl_phaeo = 5.0 - ratio_C2N_proteins = 7.0 + ratio_C2N_proteins = 5.0 / diff --git a/configuration/scripts/machines/Macros.casper_gnu b/configuration/scripts/machines/Macros.casper_gnu new file mode 100644 index 000000000..103ff8cdf --- /dev/null +++ b/configuration/scripts/machines/Macros.casper_gnu @@ -0,0 +1,47 @@ +#============================================================================== +# Makefile macros for NCAR derecho, gnu compiler +#============================================================================== + +CPP := ftn -E +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c + +FIXEDFLAGS := -ffixed-line-length-132 +FREEFLAGS := -ffree-form +FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none -fallow-argument-mismatch +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow --std f2008 +# FFLAGS += -O0 -g -fcheck=all -finit-real=snan -fimplicit-none -ffpe-trap=invalid,zero,overflow + CFLAGS += -O0 +endif + +SCC := gcc +SFC := gfortran +CC := $(SCC) +FC := $(SFC) +LD := $(FC) + +NETCDF_PATH := $(NETCDF) + +#PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs + +#PNETCDF_PATH := $(PNETCDF) +#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF)/lib +#LIB_PNETCDF := $(PNETCDF_PATH)/lib +#LIB_MPI := $(IMPILIBDIR) + +#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif + diff --git a/configuration/scripts/machines/Macros.casper_intel b/configuration/scripts/machines/Macros.casper_intel new file mode 100644 index 000000000..d8d5efc78 --- /dev/null +++ b/configuration/scripts/machines/Macros.casper_intel @@ -0,0 +1,49 @@ +#============================================================================== +# Makefile macros for NCAR derecho, intel compiler +#============================================================================== + +CPP := fpp +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise -march=core-avx2 + +FIXEDFLAGS := -fixed -132 +FREEFLAGS := -free +FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -march=core-avx2 +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -link_mpi=dbg +# FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -link_mpi=dbg -stand f08 +# FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -init=snan,arrays -link_mpi=dbg +else + FFLAGS += -O2 +endif + +SCC := icx +SFC := ifort +CC := $(SCC) +FC := $(SFC) +LD := $(FC) + +NETCDF_PATH := $(NETCDF) + +#PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs + +#PNETCDF_PATH := $(PNETCDF) +#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF)/lib +#LIB_PNETCDF := $(PNETCDF_PATH)/lib +#LIB_MPI := $(IMPILIBDIR) + +#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif + diff --git a/configuration/scripts/machines/Macros.casper_inteloneapi b/configuration/scripts/machines/Macros.casper_inteloneapi new file mode 100644 index 000000000..40a10bc6d --- /dev/null +++ b/configuration/scripts/machines/Macros.casper_inteloneapi @@ -0,0 +1,51 @@ +#============================================================================== +# Makefile macros for NCAR derecho, inteloneapi compiler +#============================================================================== + +CPP := fpp +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise -march=core-avx2 + +FIXEDFLAGS := -fixed -132 +FREEFLAGS := -free +FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -march=core-avx2 +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check bounds -check pointers -fpe0 -check noarg_temp_created -link_mpi=dbg +# FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -link_mpi=dbg +# FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -link_mpi=dbg -stand f08 +# FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -init=snan,arrays -link_mpi=dbg +# LDFLAGS += -check uninit +else + FFLAGS += -O2 +endif + +SCC := icx +SFC := ifx +CC := $(SCC) +FC := $(SFC) +LD := $(FC) + +NETCDF_PATH := $(NETCDF) + +#PIO_CONFIG_OPTS:= --enable-filesystem-hints=gpfs + +#PNETCDF_PATH := $(PNETCDF) +#PNETCDF_PATH := /glade/u/apps/ch/opt/pio/2.2/mpt/2.15f/intel/17.0.1/lib + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF)/lib +#LIB_PNETCDF := $(PNETCDF_PATH)/lib +#LIB_MPI := $(IMPILIBDIR) + +#SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -L$(LIB_PNETCDF) -lpnetcdf -lgptl +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif + diff --git a/configuration/scripts/machines/Macros.conda_macos b/configuration/scripts/machines/Macros.conda_macos index a9381791f..915ebc22c 100644 --- a/configuration/scripts/machines/Macros.conda_macos +++ b/configuration/scripts/machines/Macros.conda_macos @@ -14,7 +14,9 @@ FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none # Additional flags for the Fortran compiler when compiling in debug mode ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow +# new version of conda gnu compiler has a bug in ffpe-trap=invalid with nf90_create +# FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=zero,overflow else FFLAGS += -O2 endif diff --git a/configuration/scripts/machines/Macros.derecho_cray b/configuration/scripts/machines/Macros.derecho_cray index 1ead7f5c8..1e95da90c 100644 --- a/configuration/scripts/machines/Macros.derecho_cray +++ b/configuration/scripts/machines/Macros.derecho_cray @@ -14,7 +14,8 @@ FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) FFLAGS += -O0 -hfp0 -g -Rbcdps -Ktrap=fp else - FFLAGS += -O2 -hfp0 # -eo + # -Rp is needed to work around SAME_TBS compiler bug in cce/16, cce/17 + FFLAGS += -O2 -hfp0 -Rp # -eo endif SCC := cc diff --git a/configuration/scripts/machines/Macros.derecho_inteloneapi b/configuration/scripts/machines/Macros.derecho_inteloneapi index df7d5b42f..e073f8c21 100644 --- a/configuration/scripts/machines/Macros.derecho_inteloneapi +++ b/configuration/scripts/machines/Macros.derecho_inteloneapi @@ -12,11 +12,12 @@ FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -trace FFLAGS_NOOPT:= -O0 ifeq ($(ICE_BLDDEBUG), true) - FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -link_mpi=dbg +# -check uninit is needed on the ld step but it still throws errors in 2023.* and 2024.0.*, likely compiler bug + FFLAGS += -O0 -g -check bounds -check pointers -fpe0 -check noarg_temp_created -link_mpi=dbg # FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -link_mpi=dbg -stand f08 # FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -init=snan,arrays -link_mpi=dbg else - FFLAGS += -O2 + FFLAGS += -O1 endif SCC := icx diff --git a/configuration/scripts/machines/Macros.perlmutter_cray b/configuration/scripts/machines/Macros.perlmutter_cray new file mode 100644 index 000000000..da073cac4 --- /dev/null +++ b/configuration/scripts/machines/Macros.perlmutter_cray @@ -0,0 +1,38 @@ +#============================================================================== +# Makefile macros for NERSC perlmutter, cray compiler +#============================================================================== + +CPP := ftn -e P +CPPDEFS := -DFORTRANUNDERSCORE -DNO_R16 ${ICE_CPPDEFS} +CFLAGS := -c -O2 + +FIXEDFLAGS := -132 +FREEFLAGS := +FFLAGS := -hbyteswapio +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -hfp0 -g -Rbcdps -Ktrap=fp +else + FFLAGS += -O2 -hfp0 # -eo +endif + +SCC := cc +SFC := ftn +CC := $(SCC) +FC := $(SFC) +LD := $(FC) + +NETCDF_PATH := $(NETCDF_DIR) + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF_PATH)/lib +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -fopenmp + CFLAGS += -fopenmp + FFLAGS += -fopenmp +endif + diff --git a/configuration/scripts/machines/Macros.perlmutter_gnu b/configuration/scripts/machines/Macros.perlmutter_gnu new file mode 100644 index 000000000..d9eef27bb --- /dev/null +++ b/configuration/scripts/machines/Macros.perlmutter_gnu @@ -0,0 +1,38 @@ +#============================================================================== +# Makefile macros for NERSC perlmutter, gnu compiler +#============================================================================== + +CPP := ftn -E +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c + +FIXEDFLAGS := -ffixed-line-length-132 +FREEFLAGS := -ffree-form +FFLAGS := -fconvert=big-endian -fbacktrace -ffree-line-length-none -fallow-argument-mismatch +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -fcheck=bounds -finit-real=nan -fimplicit-none -ffpe-trap=invalid,zero,overflow --std f2008 +# FFLAGS += -O0 -g -fcheck=all -finit-real=snan -fimplicit-none -ffpe-trap=invalid,zero,overflow + CFLAGS += -O0 +endif + +SCC := gcc +SFC := gfortran +CC := $(SCC) +FC := $(SFC) +LD := $(FC) + +NETCDF_PATH := $(NETCDF_DIR) + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF_PATH)/lib +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -fopenmp + CFLAGS += -fopenmp + FFLAGS += -fopenmp +endif + diff --git a/configuration/scripts/machines/Macros.perlmutter_intel b/configuration/scripts/machines/Macros.perlmutter_intel new file mode 100644 index 000000000..48a4782ea --- /dev/null +++ b/configuration/scripts/machines/Macros.perlmutter_intel @@ -0,0 +1,40 @@ +#============================================================================== +# Makefile macros for NERSC perlmutter, intel compiler +#============================================================================== + +CPP := fpp +CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS} +CFLAGS := -c -O2 -fp-model precise -march=core-avx2 + +FIXEDFLAGS := -fixed -132 +FREEFLAGS := -free +FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -march=core-avx2 +FFLAGS_NOOPT:= -O0 + +ifeq ($(ICE_BLDDEBUG), true) + FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created -link_mpi=dbg +# FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -link_mpi=dbg -stand f08 +# FFLAGS += -O0 -g -check all -fpe0 -ftrapuv -fp-model except -check noarg_temp_created -init=snan,arrays -link_mpi=dbg +else + FFLAGS += -O2 +endif + +SCC := icx +SFC := ifort +CC := $(SCC) +FC := $(SFC) +LD := $(FC) + +NETCDF_PATH := $(NETCDF_DIR) + +INCLDIR := $(INCLDIR) + +LIB_NETCDF := $(NETCDF_PATH)/lib +SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff + +ifeq ($(ICE_THREADED), true) + LDFLAGS += -qopenmp + CFLAGS += -qopenmp + FFLAGS += -qopenmp +endif + diff --git a/configuration/scripts/machines/env.casper_gnu b/configuration/scripts/machines/env.casper_gnu new file mode 100644 index 000000000..bcf881057 --- /dev/null +++ b/configuration/scripts/machines/env.casper_gnu @@ -0,0 +1,51 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +module --force purge +module load ncarenv/23.10 +#module load craype +module load gcc/12.2.0 +module load ncarcompilers +#module load cray-mpich/8.1.25 +#module load hdf5/1.12.2 +module load netcdf/4.9.2 +#module load cray-libsci/23.02.1.1 + +# For perftools with mpiexec +# module load perftools-base +# module load perftools +#setenv PALS_TRANSFER FALSE + +endif + +limit coredumpsize unlimited +limit stacksize unlimited +setenv PALS_QUIET TRUE + +# May be needed for OpenMP memory +setenv OMP_STACKSIZE 64M +# OMP runtime diagnostics +#setenv OMP_DISPLAY_ENV TRUE + +setenv ICE_MACHINE_MACHNAME casper +setenv ICE_MACHINE_MACHINFO "NCAR cluster with Intel Cascade Lake 36 core nodes with Mellanox ConnectX-5" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "gcc 12.2.0 20220819, netcdf4.9.2" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg +setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "casper" +setenv ICE_MACHINE_TPNODE 36 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.casper_intel b/configuration/scripts/machines/env.casper_intel new file mode 100644 index 000000000..fdd55976c --- /dev/null +++ b/configuration/scripts/machines/env.casper_intel @@ -0,0 +1,51 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +module --force purge +module load ncarenv/23.10 +#module load craype +module load intel/2023.2.1 +module load ncarcompilers +#module load cray-mpich/8.1.25 +#module load hdf5/1.12.2 +module load netcdf/4.9.2 +#module load cray-libsci/23.02.1.1 + +# For perftools with mpiexec +# module load perftools-base +# module load perftools +#setenv PALS_TRANSFER FALSE + +endif + +limit coredumpsize unlimited +limit stacksize unlimited +setenv PALS_QUIET TRUE + +# May be needed for OpenMP memory +setenv OMP_STACKSIZE 64M +# OMP runtime diagnostics +#setenv OMP_DISPLAY_ENV TRUE + +setenv ICE_MACHINE_MACHNAME casper +setenv ICE_MACHINE_MACHINFO "NCAR cluster with Intel Cascade Lake 36 core nodes with Mellanox ConnectX-5" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 2021.10.0 20230609, netcdf4.9.2" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg +setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "casper" +setenv ICE_MACHINE_TPNODE 36 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.casper_inteloneapi b/configuration/scripts/machines/env.casper_inteloneapi new file mode 100644 index 000000000..3fec15b9a --- /dev/null +++ b/configuration/scripts/machines/env.casper_inteloneapi @@ -0,0 +1,51 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +module --force purge +module load ncarenv/23.10 +#module load craype +module load intel-oneapi/2023.2.1 +module load ncarcompilers +#module load cray-mpich/8.1.25 +#module load hdf5/1.12.2 +module load netcdf/4.9.2 +#module load cray-libsci/23.02.1.1 + +# For perftools with mpiexec +# module load perftools-base +# module load perftools +#setenv PALS_TRANSFER FALSE + +endif + +limit coredumpsize unlimited +limit stacksize unlimited +setenv PALS_QUIET TRUE + +# May be needed for OpenMP memory +setenv OMP_STACKSIZE 64M +# OMP runtime diagnostics +#setenv OMP_DISPLAY_ENV TRUE + +setenv ICE_MACHINE_MACHNAME casper +setenv ICE_MACHINE_MACHINFO "NCAR cluster with Intel Cascade Lake 36 core nodes with Mellanox ConnectX-5" +setenv ICE_MACHINE_ENVNAME inteloneapi +setenv ICE_MACHINE_ENVINFO "oneAPI DPC++/C++/ifx 2023.2.0 20230721, netcdf4.9.2" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg +setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE +setenv ICE_MACHINE_SUBMIT "qsub" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "casper" +setenv ICE_MACHINE_TPNODE 36 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.chicoma_intel b/configuration/scripts/machines/env.chicoma_intel index 182280f95..cb7f12679 100755 --- a/configuration/scripts/machines/env.chicoma_intel +++ b/configuration/scripts/machines/env.chicoma_intel @@ -63,7 +63,7 @@ setenv ICE_MACHINE_WKDIR /lustre/scratch5/$user/ICEPACK_RUNS setenv ICE_MACHINE_INPUTDATA /usr/projects/climate/eclare/DATA/Consortium setenv ICE_MACHINE_BASELINE /lustre/scratch5/$user/ICEPACK_BASELINE setenv ICE_MACHINE_SUBMIT "sbatch " -setenv ICE_MACHINE_ACCT t23_cice +setenv ICE_MACHINE_ACCT t24_cice setenv ICE_MACHINE_QUEUE "debug" setenv ICE_MACHINE_TPNODE 128 # tasks per node setenv ICE_MACHINE_BLDTHRDS 12 diff --git a/configuration/scripts/machines/env.derecho_cray b/configuration/scripts/machines/env.derecho_cray index 1fc814594..332c68e67 100644 --- a/configuration/scripts/machines/env.derecho_cray +++ b/configuration/scripts/machines/env.derecho_cray @@ -10,14 +10,14 @@ if ("$inp" != "-nomodules") then source ${MODULESHOME}/init/csh module --force purge -module load ncarenv/23.06 +module load ncarenv/23.09 module load craype -module load cce/15.0.1 +module load cce/16.0.1 module load ncarcompilers #module load cray-mpich/8.1.25 #module load hdf5/1.12.2 module load netcdf/4.9.2 -module load cray-libsci/23.02.1.1 +module load cray-libsci/23.09.1.1 # For perftools with mpiexec # module load perftools-base @@ -38,14 +38,14 @@ setenv OMP_STACKSIZE 64M setenv ICE_MACHINE_MACHNAME derecho setenv ICE_MACHINE_MACHINFO "HPE Cray EX Milan Slingshot 11" setenv ICE_MACHINE_ENVNAME cray -setenv ICE_MACHINE_ENVINFO "cce 15.0.1, netcdf4.9.2" +setenv ICE_MACHINE_ENVINFO "Cray clang/fortran cce 16.0.1, netcdf4.9.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS -setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE setenv ICE_MACHINE_SUBMIT "qsub" setenv ICE_MACHINE_ACCT P00000000 -setenv ICE_MACHINE_QUEUE "main" +setenv ICE_MACHINE_QUEUE "develop" setenv ICE_MACHINE_TPNODE 128 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.derecho_gnu b/configuration/scripts/machines/env.derecho_gnu index 3c45d71bf..0b5121c12 100644 --- a/configuration/scripts/machines/env.derecho_gnu +++ b/configuration/scripts/machines/env.derecho_gnu @@ -41,11 +41,11 @@ setenv ICE_MACHINE_ENVNAME gnu setenv ICE_MACHINE_ENVINFO "gcc 12.2.0 20220819, netcdf4.9.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS -setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE setenv ICE_MACHINE_SUBMIT "qsub" setenv ICE_MACHINE_ACCT P00000000 -setenv ICE_MACHINE_QUEUE "main" +setenv ICE_MACHINE_QUEUE "develop" setenv ICE_MACHINE_TPNODE 128 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.derecho_intel b/configuration/scripts/machines/env.derecho_intel index 6067556e8..3c6bed2c0 100644 --- a/configuration/scripts/machines/env.derecho_intel +++ b/configuration/scripts/machines/env.derecho_intel @@ -10,14 +10,14 @@ if ("$inp" != "-nomodules") then source ${MODULESHOME}/init/csh module --force purge -module load ncarenv/23.06 +module load ncarenv/23.09 module load craype -module load intel/2023.0.0 +module load intel/2023.2.1 module load ncarcompilers #module load cray-mpich/8.1.25 #module load hdf5/1.12.2 module load netcdf/4.9.2 -module load cray-libsci/23.02.1.1 +module load cray-libsci/23.09.1.1 # For perftools with mpiexec # module load perftools-base @@ -38,14 +38,14 @@ setenv OMP_STACKSIZE 64M setenv ICE_MACHINE_MACHNAME derecho setenv ICE_MACHINE_MACHINFO "HPE Cray EX Milan Slingshot 11" setenv ICE_MACHINE_ENVNAME intel -setenv ICE_MACHINE_ENVINFO "ifort 2021.8.0 20221119, netcdf4.9.2" +setenv ICE_MACHINE_ENVINFO "ifort 2021.10.0 20230609, netcdf4.9.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS -setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE setenv ICE_MACHINE_SUBMIT "qsub" setenv ICE_MACHINE_ACCT P00000000 -setenv ICE_MACHINE_QUEUE "main" +setenv ICE_MACHINE_QUEUE "develop" setenv ICE_MACHINE_TPNODE 128 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.derecho_intelclassic b/configuration/scripts/machines/env.derecho_intelclassic index 7bd8e5dff..b7ef39efe 100644 --- a/configuration/scripts/machines/env.derecho_intelclassic +++ b/configuration/scripts/machines/env.derecho_intelclassic @@ -41,11 +41,11 @@ setenv ICE_MACHINE_ENVNAME intelclassic setenv ICE_MACHINE_ENVINFO "icc/ifort 2021.8.0 20221119, netcdf4.9.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS -setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE setenv ICE_MACHINE_SUBMIT "qsub" setenv ICE_MACHINE_ACCT P00000000 -setenv ICE_MACHINE_QUEUE "main" +setenv ICE_MACHINE_QUEUE "develop" setenv ICE_MACHINE_TPNODE 128 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.derecho_inteloneapi b/configuration/scripts/machines/env.derecho_inteloneapi index 09cdf7291..70c98c68b 100644 --- a/configuration/scripts/machines/env.derecho_inteloneapi +++ b/configuration/scripts/machines/env.derecho_inteloneapi @@ -10,14 +10,14 @@ if ("$inp" != "-nomodules") then source ${MODULESHOME}/init/csh module --force purge -module load ncarenv/23.06 +module load ncarenv/23.09 module load craype -module load intel-oneapi/2023.0.0 +module load intel-oneapi/2023.2.1 module load ncarcompilers #module load cray-mpich/8.1.25 #module load hdf5/1.12.2 module load netcdf/4.9.2 -module load cray-libsci/23.02.1.1 +module load cray-libsci/23.09.1.1 # For perftools with mpiexec # module load perftools-base @@ -38,14 +38,14 @@ setenv OMP_STACKSIZE 64M setenv ICE_MACHINE_MACHNAME derecho setenv ICE_MACHINE_MACHINFO "HPE Cray EX Milan Slingshot 11" setenv ICE_MACHINE_ENVNAME inteloneapi -setenv ICE_MACHINE_ENVINFO "ifx 2023.0.0 20221201, netcdf4.9.2" +setenv ICE_MACHINE_ENVINFO "ifx 2023.2.0 20230721, netcdf4.9.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS -setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE setenv ICE_MACHINE_SUBMIT "qsub" setenv ICE_MACHINE_ACCT P00000000 -setenv ICE_MACHINE_QUEUE "main" +setenv ICE_MACHINE_QUEUE "develop" setenv ICE_MACHINE_TPNODE 128 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.derecho_nvhpc b/configuration/scripts/machines/env.derecho_nvhpc index 32f4d1aca..04c5ac456 100644 --- a/configuration/scripts/machines/env.derecho_nvhpc +++ b/configuration/scripts/machines/env.derecho_nvhpc @@ -10,14 +10,14 @@ if ("$inp" != "-nomodules") then source ${MODULESHOME}/init/csh module --force purge -module load ncarenv/23.06 +module load ncarenv/23.09 module load craype -module load nvhpc/23.5 +module load nvhpc/23.7 module load ncarcompilers #module load cray-mpich/8.1.25 #module load hdf5/1.12.2 module load netcdf/4.9.2 -module load cray-libsci/23.02.1.1 +module load cray-libsci/23.09.1.1 # For perftools with mpiexec # module load perftools-base @@ -38,14 +38,14 @@ setenv OMP_STACKSIZE 64M setenv ICE_MACHINE_MACHNAME derecho setenv ICE_MACHINE_MACHINFO "HPE Cray EX Milan Slingshot 11" setenv ICE_MACHINE_ENVNAME nvhpc -setenv ICE_MACHINE_ENVINFO "nvc 23.5-0, netcdf4.9.2" +setenv ICE_MACHINE_ENVINFO "nvfortran 23.7-0, netcdf4.9.2" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /glade/derecho/scratch/$user/ICEPACK_RUNS -setenv ICE_MACHINE_INPUTDATA /glade/p/cesm/pcwg_dev +setenv ICE_MACHINE_INPUTDATA /glade/campaign/cesm/development/pcwg setenv ICE_MACHINE_BASELINE /glade/derecho/scratch/$user/ICEPACK_BASELINE setenv ICE_MACHINE_SUBMIT "qsub" setenv ICE_MACHINE_ACCT P00000000 -setenv ICE_MACHINE_QUEUE "main" +setenv ICE_MACHINE_QUEUE "develop" setenv ICE_MACHINE_TPNODE 128 setenv ICE_MACHINE_BLDTHRDS 1 setenv ICE_MACHINE_QSTAT "qstat " diff --git a/configuration/scripts/machines/env.perlmutter_cray b/configuration/scripts/machines/env.perlmutter_cray new file mode 100644 index 000000000..6cafd0153 --- /dev/null +++ b/configuration/scripts/machines/env.perlmutter_cray @@ -0,0 +1,50 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +#module unload PrgEnv-aocc +#module unload PrgEnv-cray +#module unload PrgEnv-gnu +#module unload PrgEnv-intel +#module unload PrgEnv-nvidia +#module unload cpe +#module load cpe/23.03 +#module unload gpu +module load cpu +module load PrgEnv-cray +module unload cce +module load cce/15.0.1 +module unload cray-netcdf +module unload cray-hdf5 +module load cray-hdf5/1.12.2.3 +module load cray-netcdf/4.9.0.3 +#module unload cray-pals +#module load cray-pals/1.2.2 + +endif + +limit coredumpsize unlimited +limit stacksize unlimited +setenv PALS_QUIET TRUE + +setenv ICE_MACHINE_MACHNAME perlmutter +setenv ICE_MACHINE_MACHINFO "HPE Cray EX AMD EPYC 7763 Milan, Slingshot-11 Interconnect" +setenv ICE_MACHINE_ENVNAME cray +setenv ICE_MACHINE_ENVINFO "Cray clang/Fortran 15.0.1, netcdf4.9.0.3" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR $SCRATCH/ICEPACK_RUNS +setenv ICE_MACHINE_INPUTDATA /global/cfs/cdirs/e3sm/tcraig/cice-consortium +setenv ICE_MACHINE_BASELINE $SCRATCH/ICEPACK_BASELINE +setenv ICE_MACHINE_SUBMIT "sbatch" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "shared" +setenv ICE_MACHINE_TPNODE 128 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "squeue --jobs= " diff --git a/configuration/scripts/machines/env.perlmutter_gnu b/configuration/scripts/machines/env.perlmutter_gnu new file mode 100644 index 000000000..417cdc897 --- /dev/null +++ b/configuration/scripts/machines/env.perlmutter_gnu @@ -0,0 +1,50 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +#module unload PrgEnv-aocc +#module unload PrgEnv-cray +#module unload PrgEnv-gnu +#module unload PrgEnv-intel +#module unload PrgEnv-nvidia +#module unload cpe +#module load cpe/23.03 +#module unload gpu +module load cpu +module load PrgEnv-gnu +module unload gcc +module load gcc/11.2.0 +module unload cray-netcdf +module unload cray-hdf5 +module load cray-hdf5/1.12.2.3 +module load cray-netcdf/4.9.0.3 +#module unload cray-pals +#module load cray-pals/1.2.2 + +endif + +limit coredumpsize unlimited +limit stacksize unlimited +setenv PALS_QUIET TRUE + +setenv ICE_MACHINE_MACHNAME perlmutter +setenv ICE_MACHINE_MACHINFO "HPE Cray EX AMD EPYC 7763 Milan, Slingshot-11 Interconnect" +setenv ICE_MACHINE_ENVNAME gnu +setenv ICE_MACHINE_ENVINFO "gcc/gfortran 11.2.0 20210728, netcdf4.9.0.3" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR $SCRATCH/ICEPACK_RUNS +setenv ICE_MACHINE_INPUTDATA /global/cfs/cdirs/e3sm/tcraig/cice-consortium +setenv ICE_MACHINE_BASELINE $SCRATCH/ICEPACK_BASELINE +setenv ICE_MACHINE_SUBMIT "sbatch" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "shared" +setenv ICE_MACHINE_TPNODE 128 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "squeue --jobs= " diff --git a/configuration/scripts/machines/env.perlmutter_intel b/configuration/scripts/machines/env.perlmutter_intel new file mode 100644 index 000000000..85b6989af --- /dev/null +++ b/configuration/scripts/machines/env.perlmutter_intel @@ -0,0 +1,50 @@ +#!/bin/csh -f + +set inp = "undefined" +if ($#argv == 1) then + set inp = $1 +endif + +if ("$inp" != "-nomodules") then + +source ${MODULESHOME}/init/csh + +#module unload PrgEnv-aocc +#module unload PrgEnv-cray +#module unload PrgEnv-gnu +#module unload PrgEnv-intel +#module unload PrgEnv-nvidia +#module unload cpe +#module load cpe/23.03 +#module unload gpu +module load cpu +module load PrgEnv-intel +module unload intel +module load intel/2023.1.0 +module unload cray-netcdf +module unload cray-hdf5 +module load cray-hdf5/1.12.2.3 +module load cray-netcdf/4.9.0.3 +#module unload cray-pals +#module load cray-pals/1.2.2 + +endif + +limit coredumpsize unlimited +limit stacksize unlimited +setenv PALS_QUIET TRUE + +setenv ICE_MACHINE_MACHNAME perlmutter +setenv ICE_MACHINE_MACHINFO "HPE Cray EX AMD EPYC 7763 Milan, Slingshot-11 Interconnect" +setenv ICE_MACHINE_ENVNAME intel +setenv ICE_MACHINE_ENVINFO "ifort 2021.9.0 20230302, netcdf4.9.0.3" +setenv ICE_MACHINE_MAKE gmake +setenv ICE_MACHINE_WKDIR $SCRATCH/ICEPACK_RUNS +setenv ICE_MACHINE_INPUTDATA /global/cfs/cdirs/e3sm/tcraig/cice-consortium +setenv ICE_MACHINE_BASELINE $SCRATCH/ICEPACK_BASELINE +setenv ICE_MACHINE_SUBMIT "sbatch" +setenv ICE_MACHINE_ACCT P00000000 +setenv ICE_MACHINE_QUEUE "shared" +setenv ICE_MACHINE_TPNODE 128 +setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_QSTAT "squeue --jobs= " diff --git a/configuration/scripts/machines/environment.yml b/configuration/scripts/machines/environment.yml index dfbcaf85e..d2adbf009 100644 --- a/configuration/scripts/machines/environment.yml +++ b/configuration/scripts/machines/environment.yml @@ -8,6 +8,8 @@ dependencies: - netcdf-fortran - netcdf4 - make +# Plotting dependencies + - gnuplot # Python dependencies for building the HTML documentation - sphinx - sphinxcontrib-bibtex diff --git a/configuration/scripts/options/set_env.bgcispol b/configuration/scripts/options/set_env.bgcispol index c38635a70..1ab2fa2e6 100644 --- a/configuration/scripts/options/set_env.bgcispol +++ b/configuration/scripts/options/set_env.bgcispol @@ -1,6 +1,6 @@ ### Layers setenv NICELYR 7 # number of vertical layers in the ice -setenv NSNWLYR 1 # number of vertical layers in the snow +setenv NSNWLYR 5 # number of vertical layers in the snow setenv NICECAT 5 # number of ice thickness categories ### Tracers # match icepack_in tracer_nml to conserve memory @@ -8,7 +8,8 @@ setenv TRAGE 1 # set to 1 for ice age tracer setenv TRFY 1 # set to 1 for first-year ice area tracer setenv TRLVL 1 # set to 1 for level and deformed ice tracers setenv TRPND 1 # set to 1 for melt pond tracers -setenv NTRAERO 0 # number of aerosol tracers +setenv TRSNOW 1 # set to 1 for snow metamorphism tracers +setenv NTRAERO 1 # number of aerosol tracers # (up to max_aero in ice_domain_size.F90) # CESM uses 3 aerosol tracers setenv TRBRI 1 # set to 1 for brine height tracer @@ -23,7 +24,7 @@ setenv TRALG 3 # number of algal tracers # (up to max_algae = 3) setenv TRDOC 2 # number of dissolve organic carbon # (up to max_doc = 3) -setenv TRDIC 0 # number of dissolve inorganic carbon +setenv TRDIC 1 # number of dissolve inorganic carbon # (up to max_dic = 1) setenv TRDON 1 # number of dissolve organic nitrogen # (up to max_don = 1) diff --git a/configuration/scripts/options/set_env.bgcnice b/configuration/scripts/options/set_env.bgcnice index 1d6efc405..8d51abaaa 100644 --- a/configuration/scripts/options/set_env.bgcnice +++ b/configuration/scripts/options/set_env.bgcnice @@ -1,6 +1,6 @@ ### Layers setenv NICELYR 7 # number of vertical layers in the ice -setenv NSNWLYR 1 # number of vertical layers in the snow +setenv NSNWLYR 5 # number of vertical layers in the snow setenv NICECAT 5 # number of ice thickness categories ### Tracers # match icepack_in tracer_nml to conserve memory @@ -8,7 +8,7 @@ setenv TRAGE 1 # set to 1 for ice age tracer setenv TRFY 1 # set to 1 for first-year ice area tracer setenv TRLVL 1 # set to 1 for level and deformed ice tracers setenv TRPND 1 # set to 1 for melt pond tracers -setenv NTRAERO 0 # number of aerosol tracers +setenv NTRAERO 1 # number of aerosol tracers # (up to max_aero in ice_domain_size.F90) # CESM uses 3 aerosol tracers setenv TRBRI 1 # set to 1 for brine height tracer @@ -17,13 +17,13 @@ setenv TRBGCS 0 # set to 1 for skeletal layer tracers setenv TRBGCZ 1 # set to 1 for zbgc tracers # (needs TRBGCS = 0 and TRBRI = 1) setenv NBGCLYR 7 # number of zbgc layers -setenv TRZAERO 0 # number of z aerosol tracers +setenv TRZAERO 3 # number of z aerosol tracers # (up to max_aero = 6) setenv TRALG 3 # number of algal tracers # (up to max_algae = 3) setenv TRDOC 2 # number of dissolve organic carbon # (up to max_doc = 3) -setenv TRDIC 0 # number of dissolve inorganic carbon +setenv TRDIC 1 # number of dissolve inorganic carbon # (up to max_dic = 1) setenv TRDON 1 # number of dissolve organic nitrogen # (up to max_don = 1) diff --git a/configuration/scripts/options/set_env.bgcsklnice b/configuration/scripts/options/set_env.bgcsklnice index 985bacbf4..f51e75ab4 100644 --- a/configuration/scripts/options/set_env.bgcsklnice +++ b/configuration/scripts/options/set_env.bgcsklnice @@ -23,7 +23,7 @@ setenv TRALG 3 # number of algal tracers # (up to max_algae = 3) setenv TRDOC 2 # number of dissolve organic carbon # (up to max_doc = 3) -setenv TRDIC 0 # number of dissolve inorganic carbon +setenv TRDIC 1 # number of dissolve inorganic carbon # (up to max_dic = 1) setenv TRDON 1 # number of dissolve organic nitrogen # (up to max_don = 1) diff --git a/configuration/scripts/options/set_env.snicar b/configuration/scripts/options/set_env.snicar index 13cd94861..91c70cb4b 100644 --- a/configuration/scripts/options/set_env.snicar +++ b/configuration/scripts/options/set_env.snicar @@ -1,3 +1 @@ -setenv ICE_IOTYPE netcdf -setenv ICE_NXGLOB 1 setenv ICE_SNICARHC true diff --git a/configuration/scripts/options/set_env.snicartest b/configuration/scripts/options/set_env.snicartest deleted file mode 100644 index 7ac74351d..000000000 --- a/configuration/scripts/options/set_env.snicartest +++ /dev/null @@ -1,2 +0,0 @@ -setenv ICE_IOTYPE netcdf -setenv ICE_NXGLOB 1 diff --git a/configuration/scripts/options/set_env.zaero b/configuration/scripts/options/set_env.zaero new file mode 100644 index 000000000..d434f092d --- /dev/null +++ b/configuration/scripts/options/set_env.zaero @@ -0,0 +1,6 @@ +### Tracers # match icepack_in tracer_nml to conserve memory +setenv NBGCLYR 7 # number of zbgc layers +setenv NTRAERO 0 # number of aerosol tracers +setenv TRBRI 1 # set to 1 for brine height tracer +setenv TRBGCZ 1 # set to 1 for zbgc tracers +setenv TRZAERO 3 # number of z aerosol tracers diff --git a/configuration/scripts/options/set_nml.alt03 b/configuration/scripts/options/set_nml.alt03 index bd51c8561..3fa70399f 100644 --- a/configuration/scripts/options/set_nml.alt03 +++ b/configuration/scripts/options/set_nml.alt03 @@ -5,7 +5,7 @@ sw_redist = .true. sw_frac = 0.9d0 sw_dtemp = 0.02d0 - tfrz_option = 'linear_salt_old' + tfrz_option = 'linear_salt' conduct = 'bubbly' conserv_check = .true. restore_ocn = .true. diff --git a/configuration/scripts/options/set_nml.alt04 b/configuration/scripts/options/set_nml.alt04 index c416a2729..c468c4661 100644 --- a/configuration/scripts/options/set_nml.alt04 +++ b/configuration/scripts/options/set_nml.alt04 @@ -8,7 +8,7 @@ sw_redist = .true. sw_frac = 0.9d0 sw_dtemp = 0.02d0 - tfrz_option = 'linear_salt_old' + tfrz_option = 'linear_salt' conduct = 'bubbly' krdg_partic = 0 krdg_redist = 0 diff --git a/configuration/scripts/options/set_nml.bgcispol b/configuration/scripts/options/set_nml.bgcispol index 8c530fd2f..0c1cad4e5 100644 --- a/configuration/scripts/options/set_nml.bgcispol +++ b/configuration/scripts/options/set_nml.bgcispol @@ -23,5 +23,13 @@ tr_bgc_PON = .true. tr_bgc_hum = .true. tr_bgc_DON = .true. - tr_bgc_Fe = .false. - tfrz_option = 'mushy_old' + tr_bgc_Fe = .true. + tfrz_option = 'mushy' + tr_FY = .true. + kcatbound = 0 + tr_snow = .true. + use_smliq_pnd = .true. + snwgrain = .true. + snwredist = 'ITDrdg' + rsnw_fall = 54.526 + rsnw_tmax = 2800.0 diff --git a/configuration/scripts/options/set_nml.bgcnice b/configuration/scripts/options/set_nml.bgcnice index 5062b1699..11ca8e1c0 100644 --- a/configuration/scripts/options/set_nml.bgcnice +++ b/configuration/scripts/options/set_nml.bgcnice @@ -11,7 +11,7 @@ ocn_data_file = 'oceanmixed_daily_3.txt' bgc_data_file = 'nutrients_daily_ISPOL_WOA_field3.txt' tr_brine = .true. - tr_zaero = .false. + tr_zaero = .true. z_tracers = .true. solve_zbgc = .true. bgc_flux_type = 'Jin2006' @@ -24,4 +24,12 @@ tr_bgc_hum = .true. tr_bgc_DON = .true. tr_bgc_Fe = .true. - tfrz_option = 'mushy_old' + tfrz_option = 'mushy' + tr_FY = .true. + kcatbound = 0 + tr_snow = .true. + use_smliq_pnd = .true. + snwgrain = .true. + snwredist = 'ITDrdg' + rsnw_fall = 54.526 + rsnw_tmax = 2800.0 diff --git a/configuration/scripts/options/set_nml.bgcsklnice b/configuration/scripts/options/set_nml.bgcsklnice index ef3fb435f..12ac85505 100644 --- a/configuration/scripts/options/set_nml.bgcsklnice +++ b/configuration/scripts/options/set_nml.bgcsklnice @@ -22,4 +22,4 @@ year_init = 2015 tr_bgc_hum = .true. tr_bgc_DON = .true. tr_bgc_Fe = .true. - tfrz_option = 'mushy_old' + tfrz_option = 'mushy' diff --git a/configuration/scripts/options/set_nml.congel b/configuration/scripts/options/set_nml.congel new file mode 100644 index 000000000..a71cda48b --- /dev/null +++ b/configuration/scripts/options/set_nml.congel @@ -0,0 +1 @@ + congel_freeze = 'one-step' diff --git a/configuration/scripts/options/set_nml.fsd12 b/configuration/scripts/options/set_nml.fsd12 index 1692e95b2..ac5a02bba 100644 --- a/configuration/scripts/options/set_nml.fsd12 +++ b/configuration/scripts/options/set_nml.fsd12 @@ -1,3 +1,3 @@ tr_fsd = .true. wave_spec_type = 'constant' -tfrz_option = 'mushy_old' +tfrz_option = 'mushy' diff --git a/configuration/scripts/options/set_nml.leap b/configuration/scripts/options/set_nml.leap index 4802b6eea..4c20718da 100644 --- a/configuration/scripts/options/set_nml.leap +++ b/configuration/scripts/options/set_nml.leap @@ -1,3 +1,3 @@ days_per_year = 365 use_leap_years = .true. -tfrz_option = 'mushy_old' +tfrz_option = 'mushy' diff --git a/configuration/scripts/options/set_nml.modal b/configuration/scripts/options/set_nml.modal index 22e670ca6..8e9db0eb4 100644 --- a/configuration/scripts/options/set_nml.modal +++ b/configuration/scripts/options/set_nml.modal @@ -5,5 +5,5 @@ tr_aero = .true. modal_aero = .true. rfracmin = 0.15 rfracmax = 1.0 -tfrz_option = 'mushy_old' +tfrz_option = 'mushy' diff --git a/configuration/scripts/options/set_nml.swccsm3 b/configuration/scripts/options/set_nml.swccsm3 index ae4d64d96..4ec03fddb 100644 --- a/configuration/scripts/options/set_nml.swccsm3 +++ b/configuration/scripts/options/set_nml.swccsm3 @@ -1,3 +1,4 @@ +ktherm = 1 shortwave = 'ccsm3' albedo_type = 'ccsm3' calc_tsfc = .true. diff --git a/configuration/scripts/options/set_nml.thermo1 b/configuration/scripts/options/set_nml.thermo1 index e1c3c2aac..4ed48a77a 100644 --- a/configuration/scripts/options/set_nml.thermo1 +++ b/configuration/scripts/options/set_nml.thermo1 @@ -6,5 +6,5 @@ sw_redist = .true. sw_frac = 0.9d0 sw_dtemp = 0.02d0 conduct = 'MU71' -tfrz_option = 'linear_salt_old' +tfrz_option = 'linear_salt' atm_data_type = 'clim' diff --git a/configuration/scripts/options/set_nml.zaero b/configuration/scripts/options/set_nml.zaero new file mode 100644 index 000000000..6d81ae9bb --- /dev/null +++ b/configuration/scripts/options/set_nml.zaero @@ -0,0 +1,3 @@ + tr_brine = .true. + tr_zaero = .true. + z_tracers = .true. diff --git a/configuration/scripts/tests/base_suite.ts b/configuration/scripts/tests/base_suite.ts index ce98270fd..9ca134097 100644 --- a/configuration/scripts/tests/base_suite.ts +++ b/configuration/scripts/tests/base_suite.ts @@ -3,7 +3,8 @@ smoke col 1x1 diag1,run1year smoke col 1x1 debug,run1year smoke col 1x1 debug,bgcispol smoke col 1x1 debug,bgcnice -smoke col 1x1 debug,bgcsklnice +smoke col 1x1 debug,zaero +#smoke col 1x1 debug,bgcsklnice smoke col 1x1 debug,run1year,thermo1 smoke col 1x1 debug,run1year,swredist smoke col 1x1 debug,run1year,swccsm3 @@ -21,11 +22,17 @@ smoke col 1x1 debug,run1year,calcdragio smoke col 1x1 debug,run1year,modal smoke col 1x1 debug,run1year,fluxopenw smoke col 1x1 debug,run1year,dyn,fluxopenw +smoke col 1x1 debug,run1year,debug,snicartest +smoke col 1x1 debug,run1year,debug,snicar +smoke col 1x1 debug,run1year,debug,congel restart col 1x1 debug restart col 1x1 diag1 restart col 1x1 pondlvl restart col 1x1 pondtopo restart col 1x1 bgcispol +restart col 1x1 bgcnice +restart col 1x1 zaero,snwitdrdg,snwgrain +#restart col 1x1 bgcsklnice restart col 1x1 thermo1 restart col 1x1 swccsm3 restart col 1x1 isotope @@ -39,4 +46,7 @@ restart col 1x1 fsd12,short restart col 1x1 snwitdrdg,snwgrain restart col 1x1 modal restart col 1x1 fluxopenw +restart col 1x1 snicartest +restart col 1x1 snicar +restart col 1x1 congel diff --git a/configuration/scripts/tests/run_testoutput.csh b/configuration/scripts/tests/run_testoutput.csh new file mode 100644 index 000000000..cbb2a91ec --- /dev/null +++ b/configuration/scripts/tests/run_testoutput.csh @@ -0,0 +1,14 @@ +#/bin/csh -f + +./icepack.setup -m conda -e macos --case basecase -s diag1,run1year +cd basecase +./icepack.build +./icepack.submit +cd logs +foreach file (ice*[0-9]) + cp ${file} ${file}.txt +end +conda activate icepack +../../configuration/scripts/tests/timeseries.csh ice_diag.full_ITD.*[0-9] + +echo "run_testoutput DONE" diff --git a/configuration/scripts/tests/snicar_suite.ts b/configuration/scripts/tests/snicar_suite.ts deleted file mode 100644 index 2eb4c9b32..000000000 --- a/configuration/scripts/tests/snicar_suite.ts +++ /dev/null @@ -1,7 +0,0 @@ -# Test Grid PEs Sets BFB-compare -smoke col 1x1 diag1,run1year -smoke col 1x1 debug,run1year -smoke col 1x1 diag1,run1year,snicartest -smoke col 1x1 debug,run1year,snicartest -smoke col 1x1 diag1,run1year,snicar -smoke col 1x1 debug,run1year,snicar diff --git a/configuration/scripts/tests/timeseries.csh b/configuration/scripts/tests/timeseries.csh index 75faa81a6..459c905b8 100755 --- a/configuration/scripts/tests/timeseries.csh +++ b/configuration/scripts/tests/timeseries.csh @@ -71,9 +71,10 @@ foreach field ($fieldlist:q) endif set output = `echo $fieldname | sed 's/ /_/g'` - set casename = `echo $basename | rev | cut -d / -f 1-2 | rev | sed 's/\//, /'` - set fname_base = "${casename}_${output}" + set logfileonly = `echo $basename | rev | cut -d / -f 1 | rev` + set title = "${logfileonly}" set output_fname = "${basename}_${output}.png" + rm ${output_fname} echo "Plotting data for '$fieldname' and saving to $output_fname" @@ -85,7 +86,7 @@ set style data points set datafile separator "," # Term type and background color, canvas size -set terminal png size 1920,960 +set terminal png size 1920,960 font "default,20" # x-axis set xdata time @@ -95,9 +96,9 @@ set format x "%Y/%m/%d" # Axis tick marks set xtics rotate -set title "$fname_base" -set ylabel "$field" -set xlabel "Simulation Day" +set title "$title" noenhanced font "default,30" +set ylabel "$field" font "default,30" +set xlabel "Simulation Day" font "default,30" # Set y-axis limits $yrange diff --git a/configuration/scripts/tests/travis_suite.ts b/configuration/scripts/tests/travis_suite.ts index 8c22ba46c..31d749487 100644 --- a/configuration/scripts/tests/travis_suite.ts +++ b/configuration/scripts/tests/travis_suite.ts @@ -3,7 +3,8 @@ smoke col 1x1 diag1,run1year smoke col 1x1 debug,run1year smoke col 1x1 debug,bgcispol smoke col 1x1 debug,bgcnice -smoke col 1x1 debug,bgcsklnice +smoke col 1x1 debug,zaero +#smoke col 1x1 debug,bgcsklnice smoke col 1x1 debug,run1year,thermo1 smoke col 1x1 debug,run1year,swccsm3 smoke col 1x1 debug,run1year,alt01 diff --git a/doc/source/appendices/fluff.diff b/doc/source/appendices/fluff.diff new file mode 100644 index 000000000..03f745b74 --- /dev/null +++ b/doc/source/appendices/fluff.diff @@ -0,0 +1,975 @@ +diff --git a/columnphysics/icepack_fluff.F90 b/columnphysics/icepack_fluff.F90 +new file mode 100644 +index 0000000..f938ea8 +--- /dev/null ++++ b/columnphysics/icepack_fluff.F90 +@@ -0,0 +1,52 @@ ++!======================================================================= ++ ++ module icepack_fluff ++ ++ use icepack_kinds ++ use icepack_parameters, only: puny ++ use icepack_warnings, only: warnstr, icepack_warnings_add ++ use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted ++ ++ implicit none ++ ++ private ++ public :: update_fluff ++ ++!======================================================================= ++ ++ contains ++ ++!======================================================================= ++ ++! Increase ice fluffball tracer ++ ++ subroutine update_fluff (dt, rfluff, fatm, focn, aicen) ++ ++ real (kind=dbl_kind), intent(in) :: & ++ dt ! time step (s) ++ ++ real (kind=dbl_kind), intent(in) :: & ++ aicen, & ! ice area (m2) ++ fatm, & ! atm forcing (kg/m2/s) ++ focn ! ocn forcing (kg/m2/s) ++ ++ real (kind=dbl_kind), intent(inout) :: & ++ rfluff ! fluff tracer (kg) ++ ++ character(len=*),parameter :: subname='(update_fluff)' ++ ++ if (aicen > puny) then ++ rfluff = rfluff + fatm*aicen*dt ! atm forcing ++ rfluff = rfluff + focn*aicen*dt ! ocn forcing ++ endif ++! rfluff = rfluff + dt/86400._dbl_kind ! by timestep ++! other physics ... ++! rfluff = ... ++ ++ end subroutine update_fluff ++ ++!======================================================================= ++ ++ end module icepack_fluff ++ ++!======================================================================= +diff --git a/columnphysics/icepack_therm_vertical.F90 b/columnphysics/icepack_therm_vertical.F90 +index 7cd9f25..e231e8f 100644 +--- a/columnphysics/icepack_therm_vertical.F90 ++++ b/columnphysics/icepack_therm_vertical.F90 +@@ -31,7 +31,7 @@ module icepack_therm_vertical + use icepack_parameters, only: icepack_chkoptargflag + + use icepack_tracers, only: tr_iage, tr_FY, tr_aero, tr_pond, tr_fsd, tr_iso +- use icepack_tracers, only: tr_pond_lvl, tr_pond_topo ++ use icepack_tracers, only: tr_pond_lvl, tr_pond_topo, tr_fluff + use icepack_tracers, only: n_aero, n_iso + + use icepack_therm_shared, only: ferrmax, l_brine +@@ -51,6 +51,7 @@ module icepack_therm_vertical + use icepack_isotope, only: update_isotope + use icepack_atmo, only: neutral_drag_coeffs, icepack_atm_boundary + use icepack_age, only: increment_age ++ use icepack_fluff, only: update_fluff + use icepack_firstyear, only: update_FYarea + use icepack_flux, only: set_sfcflux, merge_fluxes + use icepack_meltpond_lvl, only: compute_ponds_lvl +@@ -2081,7 +2082,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + zqin , zSin , & + alvl , vlvl , & + apnd , hpnd , & +- ipnd , & ++ ipnd , fluff , & + iage , FY , & + aerosno , aeroice , & + isosno , isoice , & +@@ -2142,6 +2143,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + faero_atm , faero_ocn , & + fiso_atm , fiso_ocn , & + fiso_evap , & ++ ffluff_atm , ffluff_ocn , & + HDO_ocn , H2_16O_ocn , & + H2_18O_ocn , & + dhsn , ffracn , & +@@ -2266,6 +2268,7 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + meltsliq ! mass of snow melt (kg/m^2) + + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & ++ fluff , & ! fluffballs + Qa_iso , & ! isotope specific humidity (kg/kg) + Qref_iso , & ! isotope 2m atm ref spec humidity (kg/kg) + fiso_atm , & ! isotope deposition rate (kg/m^2 s) +@@ -2281,6 +2284,8 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + smliqn ! tracer for mass of liq in snow (kg/m^3) + + real (kind=dbl_kind), intent(in), optional :: & ++ ffluff_atm , & ! fluff atm forcing (kg/m^2 s) ++ ffluff_ocn , & ! fluff ocn forcing (kg/m^2/s) + HDO_ocn , & ! ocean concentration of HDO (kg/kg) + H2_16O_ocn , & ! ocean concentration of H2_16O (kg/kg) + H2_18O_ocn , & ! ocean concentration of H2_18O (kg/kg) +@@ -2451,6 +2456,14 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + return + endif + endif ++ if (tr_fluff) then ++ if (.not.(present(fluff) .and. present(ffluff_atm) .and. & ++ present(ffluff_ocn))) then ++ call icepack_warnings_add(subname//' error in fluff arguments, tr_fluff=T') ++ call icepack_warnings_setabort(.true.,__FILE__,__LINE__) ++ return ++ endif ++ endif + endif + + !----------------------------------------------------------------- +@@ -2615,6 +2628,17 @@ subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + yday, FY(n)) + if (icepack_warnings_aborted(subname)) return + ++ !----------------------------------------------------------------- ++ ! Update ice fluffballs ++ !----------------------------------------------------------------- ++ ++ if (tr_fluff) call update_fluff (dt = dt, & ++ rfluff = fluff(n), & ++ fatm = ffluff_atm, & ++ focn = ffluff_ocn, & ++ aicen = aicen(n)) ++ if (icepack_warnings_aborted(subname)) return ++ + !----------------------------------------------------------------- + ! Vertical thermodynamics: Heat conduction, growth and melting. + !----------------------------------------------------------------- +diff --git a/columnphysics/icepack_tracers.F90 b/columnphysics/icepack_tracers.F90 +index 8414e0c..84e4981 100644 +--- a/columnphysics/icepack_tracers.F90 ++++ b/columnphysics/icepack_tracers.F90 +@@ -58,6 +58,7 @@ module icepack_tracers + nblyr = 0, & ! number of bio/brine layers per category + nfsd = 0, & ! number of fsd layers + n_iso = 0, & ! number of isotopes in use ++ n_fluff = 0, & ! number of fluffballs in use + n_aero = 0, & ! number of aerosols in use + n_zaero = 0, & ! number of z aerosols in use + n_algae = 0, & ! number of algae in use +@@ -87,6 +88,7 @@ module icepack_tracers + nt_rsnw = 0, & ! snow grain radius + nt_isosno = 0, & ! starting index for isotopes in snow + nt_isoice = 0, & ! starting index for isotopes in ice ++ nt_fluff = 0, & ! starting index for fluffballs + nt_aero = 0, & ! starting index for aerosols in ice + nt_bgc_Nit = 0, & ! nutrients + nt_bgc_Am = 0, & ! +@@ -110,6 +112,7 @@ module icepack_tracers + tr_iso = .false., & ! if .true., use isotope tracers + tr_aero = .false., & ! if .true., use aerosol tracers + tr_brine = .false., & ! if .true., brine height differs from ice thickness ++ tr_fluff = .false., & ! if .true., use fluffballs + tr_fsd = .false. ! if .true., use floe size distribution + + !----------------------------------------------------------------- +@@ -207,7 +210,7 @@ module icepack_tracers + + subroutine icepack_init_tracer_flags(& + tr_iage_in, tr_FY_in, tr_lvl_in, tr_snow_in, & +- tr_pond_in, tr_pond_lvl_in, tr_pond_topo_in, & ++ tr_pond_in, tr_pond_lvl_in, tr_pond_topo_in, tr_fluff_in, & + tr_fsd_in, tr_aero_in, tr_iso_in, tr_brine_in, tr_zaero_in, & + tr_bgc_Nit_in, tr_bgc_N_in, tr_bgc_DON_in, tr_bgc_C_in, tr_bgc_chl_in, & + tr_bgc_Am_in, tr_bgc_Sil_in, tr_bgc_DMS_in, tr_bgc_Fe_in, tr_bgc_hum_in, & +@@ -223,6 +226,7 @@ subroutine icepack_init_tracer_flags(& + tr_snow_in , & ! if .true., use snow redistribution or metamorphosis tracers + tr_fsd_in , & ! if .true., use floe size distribution tracers + tr_iso_in , & ! if .true., use isotope tracers ++ tr_fluff_in , & ! if .true., use fluffball tracers + tr_aero_in , & ! if .true., use aerosol tracers + tr_brine_in , & ! if .true., brine height differs from ice thickness + tr_zaero_in , & ! if .true., black carbon is tracers (n_zaero) +@@ -251,6 +255,7 @@ subroutine icepack_init_tracer_flags(& + if (present(tr_snow_in) ) tr_snow = tr_snow_in + if (present(tr_fsd_in) ) tr_fsd = tr_fsd_in + if (present(tr_iso_in) ) tr_iso = tr_iso_in ++ if (present(tr_fluff_in) ) tr_fluff = tr_fluff_in + if (present(tr_aero_in) ) tr_aero = tr_aero_in + if (present(tr_brine_in) ) tr_brine = tr_brine_in + if (present(tr_zaero_in) ) tr_zaero = tr_zaero_in +@@ -274,7 +279,7 @@ end subroutine icepack_init_tracer_flags + + subroutine icepack_query_tracer_flags(& + tr_iage_out, tr_FY_out, tr_lvl_out, tr_snow_out, & +- tr_pond_out, tr_pond_lvl_out, tr_pond_topo_out, & ++ tr_pond_out, tr_pond_lvl_out, tr_pond_topo_out, tr_fluff_out, & + tr_fsd_out, tr_aero_out, tr_iso_out, tr_brine_out, tr_zaero_out, & + tr_bgc_Nit_out, tr_bgc_N_out, tr_bgc_DON_out, tr_bgc_C_out, tr_bgc_chl_out, & + tr_bgc_Am_out, tr_bgc_Sil_out, tr_bgc_DMS_out, tr_bgc_Fe_out, tr_bgc_hum_out, & +@@ -290,6 +295,7 @@ subroutine icepack_query_tracer_flags(& + tr_snow_out , & ! if .true., use snow redistribution or metamorphosis tracers + tr_fsd_out , & ! if .true., use floe size distribution + tr_iso_out , & ! if .true., use isotope tracers ++ tr_fluff_out , & ! if .true., use fluffball tracers + tr_aero_out , & ! if .true., use aerosol tracers + tr_brine_out , & ! if .true., brine height differs from ice thickness + tr_zaero_out , & ! if .true., black carbon is tracers (n_zaero) +@@ -318,6 +324,7 @@ subroutine icepack_query_tracer_flags(& + if (present(tr_snow_out) ) tr_snow_out = tr_snow + if (present(tr_fsd_out) ) tr_fsd_out = tr_fsd + if (present(tr_iso_out) ) tr_iso_out = tr_iso ++ if (present(tr_fluff_out) ) tr_fluff_out = tr_fluff + if (present(tr_aero_out) ) tr_aero_out = tr_aero + if (present(tr_brine_out) ) tr_brine_out = tr_brine + if (present(tr_zaero_out) ) tr_zaero_out = tr_zaero +@@ -357,6 +364,7 @@ subroutine icepack_write_tracer_flags(iounit) + write(iounit,*) " tr_snow = ",tr_snow + write(iounit,*) " tr_fsd = ",tr_fsd + write(iounit,*) " tr_iso = ",tr_iso ++ write(iounit,*) " tr_fluff = ",tr_fluff + write(iounit,*) " tr_aero = ",tr_aero + write(iounit,*) " tr_brine = ",tr_brine + write(iounit,*) " tr_zaero = ",tr_zaero +@@ -383,7 +391,7 @@ subroutine icepack_init_tracer_indices(& + nt_fbri_in, nt_iage_in, nt_FY_in, & + nt_alvl_in, nt_vlvl_in, nt_apnd_in, nt_hpnd_in, nt_ipnd_in, & + nt_smice_in, nt_smliq_in, nt_rhos_in, nt_rsnw_in, & +- nt_fsd_in, nt_isosno_in, nt_isoice_in, & ++ nt_fsd_in, nt_isosno_in, nt_isoice_in, nt_fluff_in, & + nt_aero_in, nt_zaero_in, nt_bgc_C_in, & + nt_bgc_N_in, nt_bgc_chl_in, nt_bgc_DOC_in, nt_bgc_DON_in, & + nt_bgc_DIC_in, nt_bgc_Fed_in, nt_bgc_Fep_in, nt_bgc_Nit_in, nt_bgc_Am_in, & +@@ -416,6 +424,7 @@ subroutine icepack_init_tracer_indices(& + nt_fsd_in, & ! floe size distribution + nt_isosno_in, & ! starting index for isotopes in snow + nt_isoice_in, & ! starting index for isotopes in ice ++ nt_fluff_in, & ! starting index for fluffballs + nt_aero_in, & ! starting index for aerosols in ice + nt_bgc_Nit_in, & ! nutrients + nt_bgc_Am_in, & ! +@@ -497,6 +506,7 @@ subroutine icepack_init_tracer_indices(& + if (present(nt_rsnw_in) ) nt_rsnw = nt_rsnw_in + if (present(nt_isosno_in) ) nt_isosno = nt_isosno_in + if (present(nt_isoice_in) ) nt_isoice = nt_isoice_in ++ if (present(nt_fluff_in) ) nt_fluff = nt_fluff_in + if (present(nt_aero_in) ) nt_aero = nt_aero_in + if (present(nt_bgc_Nit_in) ) nt_bgc_Nit = nt_bgc_Nit_in + if (present(nt_bgc_Am_in) ) nt_bgc_Am = nt_bgc_Am_in +@@ -745,7 +755,7 @@ subroutine icepack_query_tracer_indices(& + nt_fbri_out, nt_iage_out, nt_FY_out, & + nt_alvl_out, nt_vlvl_out, nt_apnd_out, nt_hpnd_out, nt_ipnd_out, & + nt_smice_out, nt_smliq_out, nt_rhos_out, nt_rsnw_out, & +- nt_fsd_out, nt_isosno_out, nt_isoice_out, & ++ nt_fsd_out, nt_isosno_out, nt_isoice_out, nt_fluff_out, & + nt_aero_out, nt_zaero_out, nt_bgc_C_out, & + nt_bgc_N_out, nt_bgc_chl_out, nt_bgc_DOC_out, nt_bgc_DON_out, & + nt_bgc_DIC_out, nt_bgc_Fed_out, nt_bgc_Fep_out, nt_bgc_Nit_out, nt_bgc_Am_out, & +@@ -778,6 +788,7 @@ subroutine icepack_query_tracer_indices(& + nt_fsd_out, & ! floe size distribution + nt_isosno_out, & ! starting index for isotopes in snow + nt_isoice_out, & ! starting index for isotopes in ice ++ nt_fluff_out, & ! starting index for fluffballs + nt_aero_out, & ! starting index for aerosols in ice + nt_bgc_Nit_out, & ! nutrients + nt_bgc_Am_out, & ! +@@ -857,6 +868,7 @@ subroutine icepack_query_tracer_indices(& + if (present(nt_rsnw_out) ) nt_rsnw_out = nt_rsnw + if (present(nt_isosno_out) ) nt_isosno_out = nt_isosno + if (present(nt_isoice_out) ) nt_isoice_out = nt_isoice ++ if (present(nt_fluff_out) ) nt_fluff_out = nt_fluff + if (present(nt_aero_out) ) nt_aero_out = nt_aero + if (present(nt_bgc_Nit_out) ) nt_bgc_Nit_out = nt_bgc_Nit + if (present(nt_bgc_Am_out) ) nt_bgc_Am_out = nt_bgc_Am +@@ -936,6 +948,7 @@ subroutine icepack_write_tracer_indices(iounit) + write(iounit,*) " nt_rsnw = ",nt_rsnw + write(iounit,*) " nt_isosno = ",nt_isosno + write(iounit,*) " nt_isoice = ",nt_isoice ++ write(iounit,*) " nt_fluff = ",nt_fluff + write(iounit,*) " nt_aero = ",nt_aero + write(iounit,*) " nt_bgc_Nit = ",nt_bgc_Nit + write(iounit,*) " nt_bgc_Am = ",nt_bgc_Am +@@ -1014,7 +1027,7 @@ end subroutine icepack_write_tracer_indices + + subroutine icepack_init_tracer_sizes(& + ncat_in, nilyr_in, nslyr_in, nblyr_in, nfsd_in , & +- n_algae_in, n_DOC_in, n_aero_in, n_iso_in, & ++ n_algae_in, n_DOC_in, n_aero_in, n_iso_in, n_fluff_in, & + n_DON_in, n_DIC_in, n_fed_in, n_fep_in, n_zaero_in, & + ntrcr_in, ntrcr_o_in, nbtrcr_in, nbtrcr_sw_in) + +@@ -1032,6 +1045,7 @@ subroutine icepack_init_tracer_sizes(& + n_fep_in , & ! + n_zaero_in, & ! + n_iso_in , & ! ++ n_fluff_in, & ! + n_aero_in , & ! + ntrcr_in , & ! number of tracers in use + ntrcr_o_in, & ! number of non-bio tracers in use +@@ -1056,6 +1070,7 @@ subroutine icepack_init_tracer_sizes(& + if (present(n_fep_in) ) n_fep = n_fep_in + if (present(n_zaero_in) ) n_zaero = n_zaero_in + if (present(n_iso_in) ) n_iso = n_iso_in ++ if (present(n_fluff_in) ) n_fluff = n_fluff_in + if (present(n_aero_in) ) n_aero = n_aero_in + + if (present(ntrcr_in) ) ntrcr = ntrcr_in +@@ -1074,7 +1089,7 @@ subroutine icepack_query_tracer_sizes(& + max_don_out , max_fe_out , nmodal1_out , & + nmodal2_out , max_aero_out , max_nbtrcr_out , & + ncat_out, nilyr_out, nslyr_out, nblyr_out, nfsd_out, & +- n_algae_out, n_DOC_out, n_aero_out, n_iso_out, & ++ n_algae_out, n_DOC_out, n_aero_out, n_iso_out, n_fluff_out, & + n_DON_out, n_DIC_out, n_fed_out, n_fep_out, n_zaero_out, & + ntrcr_out, ntrcr_o_out, nbtrcr_out, nbtrcr_sw_out) + +@@ -1103,6 +1118,7 @@ subroutine icepack_query_tracer_sizes(& + n_fep_out , & ! + n_zaero_out, & ! + n_iso_out , & ! ++ n_fluff_out, & ! + n_aero_out , & ! + ntrcr_out , & ! number of tracers in use + ntrcr_o_out, & ! number of non-bio tracers in use +@@ -1138,6 +1154,7 @@ subroutine icepack_query_tracer_sizes(& + if (present(n_zaero_out) ) n_zaero_out = n_zaero + if (present(n_aero_out) ) n_aero_out = n_aero + if (present(n_iso_out) ) n_iso_out = n_iso ++ if (present(n_fluff_out) ) n_fluff_out = n_fluff + + if (present(ntrcr_out) ) ntrcr_out = ntrcr + if (present(ntrcr_o_out) ) ntrcr_o_out = ntrcr_o +@@ -1186,6 +1203,7 @@ subroutine icepack_write_tracer_sizes(iounit) + write(iounit,*) " n_zaero = ",n_zaero + write(iounit,*) " n_aero = ",n_aero + write(iounit,*) " n_iso = ",n_iso ++ write(iounit,*) " n_fluff = ",n_fluff + write(iounit,*) " ntrcr = ",ntrcr + write(iounit,*) " ntrcr_o = ",ntrcr_o + write(iounit,*) " nbtrcr = ",nbtrcr +diff --git a/configuration/driver/icedrv_InitMod.F90 b/configuration/driver/icedrv_InitMod.F90 +index 107ffdc..8a34f61 100644 +--- a/configuration/driver/icedrv_InitMod.F90 ++++ b/configuration/driver/icedrv_InitMod.F90 +@@ -44,7 +44,8 @@ subroutine icedrv_initialize + use icedrv_flux, only: init_coupler_flux, init_history_therm, & + init_flux_atm_ocn + use icedrv_forcing, only: init_forcing, get_forcing, get_wave_spec +- use icedrv_forcing_bgc, only: get_forcing_bgc, faero_default, fiso_default, init_forcing_bgc ++ use icedrv_forcing_bgc, only: get_forcing_bgc, faero_default, fiso_default, & ++ init_forcing_bgc, ffluff_default + use icedrv_restart_shared, only: restart + use icedrv_init, only: input_data, init_state, init_grid2, init_fsd + use icedrv_init_column, only: init_thermo_vertical, init_shortwave, init_zbgc +@@ -56,6 +57,7 @@ subroutine icedrv_initialize + tr_snow, & ! from icepack + tr_aero, & ! from icepack + tr_iso, & ! from icepack ++ tr_fluff, & ! from icepack + tr_zaero, & ! from icepack + tr_fsd, wave_spec + +@@ -135,7 +137,7 @@ subroutine icedrv_initialize + call icepack_query_parameters(wave_spec_out=wave_spec) + call icepack_query_tracer_flags(tr_snow_out=tr_snow) + call icepack_query_tracer_flags(tr_aero_out=tr_aero) +- call icepack_query_tracer_flags(tr_iso_out=tr_iso) ++ call icepack_query_tracer_flags(tr_iso_out=tr_iso, tr_fluff_out=tr_fluff) + call icepack_query_tracer_flags(tr_zaero_out=tr_zaero) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & +@@ -155,6 +157,7 @@ subroutine icedrv_initialize + endif + + if (tr_iso) call fiso_default ! default values ++ if (tr_fluff) call ffluff_default ! fluffball forcing + ! aerosols + ! if (tr_aero) call faero_data ! data file + ! if (tr_zaero) call fzaero_data ! data file (gx1) +diff --git a/configuration/driver/icedrv_RunMod.F90 b/configuration/driver/icedrv_RunMod.F90 +index e20ebf8..81fd86a 100644 +--- a/configuration/driver/icedrv_RunMod.F90 ++++ b/configuration/driver/icedrv_RunMod.F90 +@@ -33,12 +33,13 @@ subroutine icedrv_run + + use icedrv_calendar, only: istep, istep1, time, dt, stop_now, calendar + use icedrv_forcing, only: get_forcing, get_wave_spec +- use icedrv_forcing_bgc, only: faero_default, fiso_default, get_forcing_bgc ++ use icedrv_forcing_bgc, only: faero_default, fiso_default, get_forcing_bgc, & ++ ffluff_default + use icedrv_flux, only: init_flux_atm_ocn + use icedrv_history, only: history_format, history_close + + logical (kind=log_kind) :: skl_bgc, z_tracers, tr_aero, tr_zaero, & +- wave_spec, tr_fsd, tr_iso ++ wave_spec, tr_fsd, tr_iso, tr_fluff + + character(len=*), parameter :: subname='(icedrv_run)' + +@@ -47,7 +48,8 @@ subroutine icedrv_run + !-------------------------------------------------------------------- + + call icepack_query_tracer_flags(tr_aero_out=tr_aero, tr_zaero_out=tr_zaero, & +- tr_fsd_out=tr_fsd, tr_iso_out=tr_iso) ++ tr_fsd_out=tr_fsd, tr_iso_out=tr_iso, & ++ tr_fluff_out=tr_fluff) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & + file=__FILE__,line= __LINE__) +@@ -78,6 +80,7 @@ subroutine icedrv_run + + ! biogeochemistry forcing + if (tr_iso) call fiso_default ! default values ++ if (tr_fluff) call ffluff_default ! fluffball forcing + if (tr_aero .or. tr_zaero) call faero_default ! default values + if (skl_bgc .or. z_tracers) call get_forcing_bgc ! biogeochemistry + +diff --git a/configuration/driver/icedrv_diagnostics.F90 b/configuration/driver/icedrv_diagnostics.F90 +index eaa44d5..cd59cde 100644 +--- a/configuration/driver/icedrv_diagnostics.F90 ++++ b/configuration/driver/icedrv_diagnostics.F90 +@@ -87,7 +87,8 @@ subroutine runtime_diags (dt) + pTair, pfsnow, pfrain, & + paice, hiavg, hsavg, hbravg, psalt, pTsfc, & + pevap, pfhocn, fsdavg, & +- rsnwavg, rhosavg, smicetot, smliqtot, smtot ++ rsnwavg, rhosavg, smicetot, smliqtot, smtot, & ++ fluffavg + + real (kind=dbl_kind), dimension (nx) :: & + work1, work2, work3 +@@ -95,9 +96,9 @@ subroutine runtime_diags (dt) + real (kind=dbl_kind) :: & + Tffresh, rhos, rhow, rhoi + +- logical (kind=log_kind) :: tr_brine, tr_fsd, tr_iso, tr_snow ++ logical (kind=log_kind) :: tr_brine, tr_fsd, tr_iso, tr_snow, tr_fluff + integer (kind=int_kind) :: nt_fbri, nt_Tsfc, nt_fsd, nt_isosno, nt_isoice +- integer (kind=int_kind) :: nt_rsnw, nt_rhos, nt_smice, nt_smliq ++ integer (kind=int_kind) :: nt_rsnw, nt_rhos, nt_smice, nt_smliq, nt_fluff + + character(len=*), parameter :: subname='(runtime_diags)' + +@@ -107,11 +108,11 @@ subroutine runtime_diags (dt) + + call icepack_query_parameters(calc_Tsfc_out=calc_Tsfc, & + snwredist_out=snwredist, snwgrain_out=snwgrain) +- call icepack_query_tracer_flags(tr_brine_out=tr_brine, & ++ call icepack_query_tracer_flags(tr_brine_out=tr_brine, tr_fluff_out=tr_fluff, & + tr_fsd_out=tr_fsd,tr_iso_out=tr_iso,tr_snow_out=tr_snow) + call icepack_query_tracer_indices(nt_fbri_out=nt_fbri, nt_Tsfc_out=nt_Tsfc,& + nt_fsd_out=nt_fsd, nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice, & +- nt_rsnw_out=nt_rsnw, nt_rhos_out=nt_rhos, & ++ nt_rsnw_out=nt_rsnw, nt_rhos_out=nt_rhos, nt_fluff_out=nt_fluff, & + nt_smice_out=nt_smice, nt_smliq_out=nt_smliq) + call icepack_query_parameters(Tffresh_out=Tffresh, rhos_out=rhos, & + rhow_out=rhow, rhoi_out=rhoi) +@@ -138,6 +139,7 @@ subroutine runtime_diags (dt) + hbravg = c0 ! avg brine thickness + rsnwavg = c0 ! avg snow grain radius + rhosavg = c0 ! avg snow density ++ fluffavg = c0 ! fluffball avg + smicetot = c0 ! total mass of ice in snow (kg/m2) + smliqtot = c0 ! total mass of liquid in snow (kg/m2) + smtot = c0 ! total mass of snow volume (kg/m2) +@@ -172,6 +174,11 @@ subroutine runtime_diags (dt) + smicetot = smicetot / real(nslyr,kind=dbl_kind) ! mass of ice in snow + smliqtot = smliqtot / real(nslyr,kind=dbl_kind) ! mass of liquid in snow + end if ++ if (tr_fluff) then ! fluffballs ++ do nc = 1, ncat ++ fluffavg = fluffavg + trcrn(n,nt_fluff,nc)*aicen(n,nc)/paice ! fluffballs ++ end do ++ end if + + endif + if (vice(n) /= c0) psalt = work2(n)/vice(n) +@@ -252,6 +259,10 @@ subroutine runtime_diags (dt) + endif + endif + ++ if (tr_fluff) then ++ write(nu_diag_out+n-1,900) 'fluffballs (kg) = ',fluffavg ++ endif ++ + write(nu_diag_out+n-1,*) '----------ocn----------' + write(nu_diag_out+n-1,900) 'sst (C) = ',sst(n) ! sea surface temperature + write(nu_diag_out+n-1,900) 'sss (ppt) = ',sss(n) ! sea surface salinity +@@ -267,6 +278,7 @@ subroutine runtime_diags (dt) + write(nu_diag_out+n-1,901) 'isotopic conc chg = ',pdiso(n,k),k + enddo + endif ++ + end do + 899 format (43x,a24) + 900 format (a25,2x,f24.17) +diff --git a/configuration/driver/icedrv_domain_size.F90 b/configuration/driver/icedrv_domain_size.F90 +index 75bb4d2..57b9c08 100644 +--- a/configuration/driver/icedrv_domain_size.F90 ++++ b/configuration/driver/icedrv_domain_size.F90 +@@ -28,6 +28,7 @@ module icedrv_domain_size + n_don = TRDON , & ! number of DON pools in use + n_fed = TRFED , & ! number of Fe pools in use dissolved Fe + n_fep = TRFEP , & ! number of Fe pools in use particulate Fe ++ n_fluff = NFLUFF , & ! number of fluffballs + nfreq = 25 , & ! number of wave frequencies ! HARDWIRED FOR NOW + nblyr = NBGCLYR , & ! number of bio/brine layers per category + ! maximum number of biology tracers + aerosols +@@ -43,6 +44,7 @@ module icedrv_domain_size + + nslyr & ! snow enthalpy + !!!!! optional tracers: + + nfsd & ! number of floe size categories ++ + n_fluff & ! number of fluffball tracers + + TRAGE & ! age + + TRFY & ! first-year area + + TRLVL*2 & ! level/deformed ice +diff --git a/configuration/driver/icedrv_flux.F90 b/configuration/driver/icedrv_flux.F90 +index 39c0908..8e32ec0 100644 +--- a/configuration/driver/icedrv_flux.F90 ++++ b/configuration/driver/icedrv_flux.F90 +@@ -299,6 +299,10 @@ module icedrv_flux + fiso_atm , & ! isotope deposition rate (kg/m^2 s) + fiso_evap ! isotope evaporation rate (kg/m^2 s) + ++ real (kind=dbl_kind), dimension(nx), public :: & ! coupling variable for tr_fluff ++ ffluff_atm, & ! fluffball source from atm (kg/m^2 s) ++ ffluff_ocn ! fluffball source from ocn (kg/m^2 s) ++ + real (kind=dbl_kind), & + dimension (nx,icepack_max_nbtrcr), public :: & + flux_bio_atm ! all bio fluxes to ice from atmosphere +@@ -476,6 +480,8 @@ subroutine init_coupler_flux + + fiso_atm (:,:) = c0 ! isotope deposition rate (kg/m2/s) + fiso_evap (:,:) = c0 ! isotope evaporation rate (kg/m2/s) ++ ffluff_atm (:) = c0 ! fluffball forcing from atm (kg/m2/s) ++ ffluff_ocn (:) = c0 ! fluffball forcing from ocean (kg/m2/s) + faero_atm (:,:) = c0 ! aerosol deposition rate (kg/m2/s) + flux_bio_atm (:,:) = c0 ! zaero and bio deposition rate (kg/m2/s) + +diff --git a/configuration/driver/icedrv_forcing_bgc.F90 b/configuration/driver/icedrv_forcing_bgc.F90 +index f471022..70eacbe 100644 +--- a/configuration/driver/icedrv_forcing_bgc.F90 ++++ b/configuration/driver/icedrv_forcing_bgc.F90 +@@ -10,7 +10,7 @@ module icedrv_forcing_bgc + use icedrv_kinds + use icedrv_domain_size, only: nx + use icedrv_calendar, only: secday +- use icedrv_constants, only: nu_forcing, nu_diag ++ use icedrv_constants, only: nu_forcing, nu_diag, c0 + use icepack_intfc, only: icepack_max_algae, icepack_max_doc + use icepack_intfc, only: icepack_max_dic + use icepack_intfc, only: icepack_query_tracer_flags +@@ -19,7 +19,8 @@ module icedrv_forcing_bgc + + implicit none + private +- public :: get_forcing_bgc, faero_default, fiso_default, init_forcing_bgc ++ public :: get_forcing_bgc, faero_default, fiso_default, init_forcing_bgc, & ++ ffluff_default + + real (kind=dbl_kind), dimension(365) :: & ! hardwired for now + sil_data, nit_data +@@ -182,6 +183,21 @@ subroutine fiso_default + + end subroutine fiso_default + ++!======================================================================= ++ ++! constant values for atmospheric and ocean fluffballs ++ ++ subroutine ffluff_default ++ ++ use icedrv_flux, only: ffluff_atm, ffluff_ocn ++ character(len=*), parameter :: subname='(ffluff_default)' ++ ++! ffluff_atm(:) = c0 ! kg/m^2 s ++ ffluff_atm(:) = 1.e-8_dbl_kind ! kg/m^2 s ++ ffluff_ocn(:) = c0 ! kg/m^2 s ++ ++ end subroutine ffluff_default ++ + !======================================================================= + + end module icedrv_forcing_bgc +diff --git a/configuration/driver/icedrv_init.F90 b/configuration/driver/icedrv_init.F90 +index c1e738c..ed69c07 100644 +--- a/configuration/driver/icedrv_init.F90 ++++ b/configuration/driver/icedrv_init.F90 +@@ -58,7 +58,7 @@ subroutine input_data + + use icedrv_diagnostics, only: diag_file, nx_names + use icedrv_domain_size, only: nilyr, nslyr, nblyr, max_ntrcr, ncat +- use icedrv_domain_size, only: n_iso, n_aero, nfsd ++ use icedrv_domain_size, only: n_iso, n_aero, nfsd, n_fluff + use icedrv_calendar, only: year_init, istep0 + use icedrv_calendar, only: dumpfreq, diagfreq, dump_last + use icedrv_calendar, only: npt, dt, ndtd, days_per_year, use_leap_years +@@ -116,12 +116,12 @@ subroutine input_data + + integer (kind=int_kind) :: ntrcr + logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_pond, tr_snow +- logical (kind=log_kind) :: tr_iso, tr_aero, tr_fsd ++ logical (kind=log_kind) :: tr_iso, tr_aero, tr_fsd, tr_fluff + logical (kind=log_kind) :: tr_pond_lvl, tr_pond_topo, wave_spec + integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_FY + integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & + nt_smice, nt_smliq, nt_rhos, nt_rsnw, & +- nt_aero, nt_fsd, nt_isosno, nt_isoice ++ nt_aero, nt_fsd, nt_isosno, nt_isoice, nt_fluff + + real (kind=real_kind) :: rplvl, rptopo + real (kind=dbl_kind) :: Cf, puny +@@ -194,6 +194,7 @@ subroutine input_data + tr_snow, & + tr_aero, & + tr_fsd, & ++ tr_fluff, & + tr_iso + + !----------------------------------------------------------------- +@@ -300,6 +301,7 @@ subroutine input_data + tr_aero = .false. ! aerosols + tr_fsd = .false. ! floe size distribution + tr_iso = .false. ! isotopes ++ tr_fluff = .false. ! fluffballs + + !----------------------------------------------------------------- + ! read from input file +@@ -549,6 +551,13 @@ subroutine input_data + call icedrv_system_abort(file=__FILE__,line=__LINE__) + endif + ++ if (tr_fluff .and. n_fluff==0) then ++ write (nu_diag,*) 'WARNING: fluffballs activated but' ++ write (nu_diag,*) 'WARNING: not allocated in tracer array.' ++ write (nu_diag,*) 'WARNING: Activate in compilation script.' ++ call icedrv_system_abort(file=__FILE__,line=__LINE__) ++ endif ++ + if (tr_aero .and. n_aero==0) then + write (nu_diag,*) 'WARNING: aerosols activated but' + write (nu_diag,*) 'WARNING: not allocated in tracer array.' +@@ -892,6 +901,12 @@ subroutine input_data + ntrcr = ntrcr + n_iso ! n_iso species in ice + end if + ++ nt_fluff = max_ntrcr ++ if (tr_fluff) then ! fluffballs ++ nt_fluff = ntrcr + 1 ++ ntrcr = ntrcr + n_fluff ++ end if ++ + nt_aero = max_ntrcr - 4*n_aero + if (tr_aero) then + nt_aero = ntrcr + 1 +@@ -918,6 +933,7 @@ subroutine input_data + write(nu_diag,1020) 'nblyr = ', nblyr + write(nu_diag,1020) 'nfsd = ', nfsd + write(nu_diag,1020) 'n_iso = ', n_iso ++ write(nu_diag,1020) 'n_fluff = ', n_fluff + write(nu_diag,1020) 'n_aero = ', n_aero + write(nu_diag,*)' ' + write(nu_diag,1020) 'nx = ', nx +@@ -991,10 +1007,10 @@ subroutine input_data + windmin_in=windmin, drhosdwind_in=drhosdwind, snwlvlfac_in=snwlvlfac) + call icepack_init_tracer_sizes(ntrcr_in=ntrcr, & + ncat_in=ncat, nilyr_in=nilyr, nslyr_in=nslyr, nblyr_in=nblyr, & +- nfsd_in=nfsd, n_iso_in=n_iso, n_aero_in=n_aero) ++ nfsd_in=nfsd, n_iso_in=n_iso, n_aero_in=n_aero, n_fluff_in=n_fluff) + 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_iso_in=tr_iso, tr_snow_in=tr_snow, & ++ tr_iso_in=tr_iso, tr_snow_in=tr_snow, tr_fluff_in=tr_fluff, & + tr_pond_in=tr_pond, & + tr_pond_lvl_in=tr_pond_lvl, & + tr_pond_topo_in=tr_pond_topo, tr_fsd_in=tr_fsd) +@@ -1005,7 +1021,7 @@ subroutine input_data + nt_apnd_in=nt_apnd, nt_hpnd_in=nt_hpnd, nt_ipnd_in=nt_ipnd, & + nt_smice_in=nt_smice, nt_smliq_in=nt_smliq, & + nt_rhos_in=nt_rhos, nt_rsnw_in=nt_rsnw, & +- nt_aero_in=nt_aero, nt_fsd_in=nt_fsd, & ++ nt_aero_in=nt_aero, nt_fsd_in=nt_fsd, nt_fluff_in=nt_fluff, & + nt_isosno_in=nt_isosno, nt_isoice_in=nt_isoice) + + call icepack_warnings_flush(nu_diag) +@@ -1073,7 +1089,7 @@ subroutine init_state + + use icepack_intfc, only: icepack_aggregate + use icedrv_domain_size, only: ncat, nilyr, nslyr, nblyr, max_ntrcr +- use icedrv_domain_size, only: n_iso, n_aero, nfsd ++ use icedrv_domain_size, only: n_iso, n_aero, nfsd, n_fluff + use icedrv_flux, only: sst, Tf, Tair, salinz, Tmltz + use icedrv_state, only: trcr_depend, aicen, trcrn, vicen, vsnon + use icedrv_state, only: aice0, aice, vice, vsno, trcr, aice_init +@@ -1086,10 +1102,10 @@ subroutine init_state + + integer (kind=int_kind) :: ntrcr + logical (kind=log_kind) :: tr_iage, tr_FY, tr_lvl, tr_aero, tr_fsd, tr_iso +- logical (kind=log_kind) :: tr_pond_lvl, tr_pond_topo, tr_snow ++ logical (kind=log_kind) :: tr_pond_lvl, tr_pond_topo, tr_snow, tr_fluff + integer (kind=int_kind) :: nt_Tsfc, nt_sice, nt_qice, nt_qsno, nt_iage, nt_fy + integer (kind=int_kind) :: nt_alvl, nt_vlvl, nt_apnd, nt_hpnd, nt_ipnd, & +- nt_smice, nt_smliq, nt_rhos, nt_rsnw, & ++ nt_smice, nt_smliq, nt_rhos, nt_rsnw, nt_fluff, & + nt_aero, nt_fsd, nt_isosno, nt_isoice + + character(len=*), parameter :: subname='(init_state)' +@@ -1102,7 +1118,7 @@ subroutine init_state + 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_iso_out=tr_iso, tr_snow_out=tr_snow, & +- tr_pond_lvl_out=tr_pond_lvl, & ++ tr_pond_lvl_out=tr_pond_lvl, tr_fluff_out=tr_fluff, & + tr_pond_topo_out=tr_pond_topo, tr_fsd_out=tr_fsd) + call icepack_query_tracer_indices(nt_Tsfc_out=nt_Tsfc, & + nt_sice_out=nt_sice, nt_qice_out=nt_qice, & +@@ -1111,7 +1127,7 @@ subroutine init_state + nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, & + nt_ipnd_out=nt_ipnd, & + nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, & +- nt_rhos_out=nt_rhos, nt_rsnw_out=nt_rsnw, & ++ nt_rhos_out=nt_rhos, nt_rsnw_out=nt_rsnw, nt_fluff_out=nt_fluff, & + nt_isosno_out=nt_isosno, nt_isoice_out=nt_isoice, & + nt_aero_out=nt_aero, nt_fsd_out=nt_fsd) + call icepack_warnings_flush(nu_diag) +@@ -1178,6 +1194,12 @@ subroutine init_state + trcr_depend(nt_isoice) = 1 ! ice + enddo + endif ++ if (tr_fluff) then ! isotopes ++ do it = 1, n_fluff ++! trcr_depend(nt_fluff + it -1) = 0 ! area ++ trcr_depend(nt_fluff + it -1) = 1 ! ice volume ++ enddo ++ endif + if (tr_aero) then ! volume-weighted aerosols + do it = 1, n_aero + trcr_depend(nt_aero+(it-1)*4 ) = 2 ! snow +diff --git a/configuration/driver/icedrv_restart.F90 b/configuration/driver/icedrv_restart.F90 +index 762d1b3..5a687e8 100644 +--- a/configuration/driver/icedrv_restart.F90 ++++ b/configuration/driver/icedrv_restart.F90 +@@ -29,6 +29,7 @@ module icedrv_restart + write_restart_snow, read_restart_snow, & + write_restart_fsd, read_restart_fsd, & + write_restart_iso, read_restart_iso, & ++ write_restart_fluff, read_restart_fluff, & + write_restart_aero, read_restart_aero + + character (len=3), private :: nchar ! +@@ -89,7 +90,7 @@ subroutine dumpfile + + logical (kind=log_kind) :: & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_brine, & +- tr_pond_topo, tr_pond_lvl, tr_snow, tr_fsd ++ tr_pond_topo, tr_pond_lvl, tr_snow, tr_fsd, tr_fluff + ! skl_bgc, z_tracers + + integer (kind=int_kind) :: dims(2) +@@ -115,7 +116,7 @@ subroutine dumpfile + + 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_iso_out=tr_iso, & +- tr_brine_out=tr_brine, & ++ tr_brine_out=tr_brine, tr_fluff_out=tr_fluff, & + tr_pond_topo_out=tr_pond_topo, & + tr_pond_lvl_out=tr_pond_lvl,tr_snow_out=tr_snow,tr_fsd_out=tr_fsd) + ! call icepack_query_parameters(skl_bgc_out=skl_bgc, z_tracers_out=z_tracers) +@@ -224,6 +225,7 @@ subroutine dumpfile + if (tr_aero) call write_restart_aero(dims) ! ice aerosols + if (tr_brine) call write_restart_hbrine(dims) ! brine height + if (tr_fsd) call write_restart_fsd(dims) ! floe size distribution ++ if (tr_fluff) call write_restart_fluff(dims) ! fluffballs + ! called in icedrv_RunMod.F90 to prevent circular dependencies + ! if (skl_bgc .or. z_tracers) & + ! call write_restart_bgc ! biogeochemistry +@@ -275,7 +277,7 @@ subroutine restartfile (ice_ic) + + logical (kind=log_kind) :: & + tr_iage, tr_FY, tr_lvl, tr_iso, tr_aero, tr_brine, & +- tr_pond_topo, tr_pond_lvl, tr_snow, tr_fsd ++ tr_pond_topo, tr_pond_lvl, tr_snow, tr_fsd, tr_fluff + + character(len=char_len_long) :: filename + character(len=*), parameter :: subname='(restartfile)' +@@ -290,7 +292,7 @@ subroutine restartfile (ice_ic) + + 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_iso_out=tr_iso, & +- tr_brine_out=tr_brine, & ++ tr_brine_out=tr_brine, tr_fluff_out=tr_fluff, & + tr_pond_topo_out=tr_pond_topo, & + tr_pond_lvl_out=tr_pond_lvl,tr_snow_out=tr_snow,tr_fsd_out=tr_fsd) + call icepack_warnings_flush(nu_diag) +@@ -399,6 +401,7 @@ subroutine restartfile (ice_ic) + if (tr_aero) call read_restart_aero() ! ice aerosols + if (tr_brine) call read_restart_hbrine ! brine height + if (tr_fsd) call read_restart_fsd() ! floe size distribution ++ if (tr_fluff) call read_restart_fluff() ! fluffballs + + !----------------------------------------------------------------- + ! Ensure ice is binned in correct categories +@@ -768,6 +771,52 @@ end subroutine read_restart_age + + !======================================================================= + ++! Dumps all values needed for restarting ++ ++ subroutine write_restart_fluff(dims) ++ ++ use icedrv_state, only: trcrn ++ use icedrv_domain_size, only: ncat ++ ++ integer (kind=int_kind), intent(in), optional :: & ++ dims(:) ! netcdf dimension IDs ++ ++ integer (kind=int_kind) :: nt_fluff ++ character(len=*), parameter :: subname='(write_restart_fluff)' ++ ++ call icepack_query_tracer_indices(nt_fluff_out=nt_fluff) ++ call icepack_warnings_flush(nu_diag) ++ if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & ++ file=__FILE__,line= __LINE__) ++ ++ call write_restart_field(nu_dump,trcrn(:,nt_fluff,:),ncat,'fluff',dims) ++ ++ end subroutine write_restart_fluff ++ ++!======================================================================= ++ ++! Reads all values needed for an ice fluff restart ++ ++ subroutine read_restart_fluff() ++ ++ use icedrv_state, only: trcrn ++ use icedrv_domain_size, only: ncat ++ integer (kind=int_kind) :: nt_fluff ++ character(len=*), parameter :: subname='(read_restart_fluff)' ++ ++ write(nu_diag,*) 'min/max fluff (s)' ++ ++ call icepack_query_tracer_indices(nt_fluff_out=nt_fluff) ++ call icepack_warnings_flush(nu_diag) ++ if (icepack_warnings_aborted()) call icedrv_system_abort(string=subname, & ++ file=__FILE__,line= __LINE__) ++ ++ call read_restart_field(nu_restart,trcrn(:,nt_fluff,:),ncat,'fluff') ++ ++ end subroutine read_restart_fluff ++ ++!======================================================================= ++ + ! Dumps all values needed for restarting + ! author Elizabeth C. Hunke, LANL + +diff --git a/configuration/driver/icedrv_step.F90 b/configuration/driver/icedrv_step.F90 +index 0f25b56..1dc844d 100644 +--- a/configuration/driver/icedrv_step.F90 ++++ b/configuration/driver/icedrv_step.F90 +@@ -127,7 +127,7 @@ subroutine step_therm1 (dt) + use icedrv_flux, only: fswthru, fswthru_vdr, fswthru_vdf, fswthru_idr, fswthru_idf + use icedrv_flux, only: flatn_f, fsensn_f, fsurfn_f, fcondtopn_f + use icedrv_flux, only: dsnow, dsnown, faero_atm, faero_ocn +- use icedrv_flux, only: fiso_atm, fiso_ocn, fiso_evap ++ use icedrv_flux, only: fiso_atm, fiso_ocn, fiso_evap, ffluff_atm, ffluff_ocn + use icedrv_flux, only: HDO_ocn, H2_16O_ocn, H2_18O_ocn + use icedrv_init, only: lmask_n, lmask_s + use icedrv_state, only: aice, aicen, aice_init, aicen_init, vicen_init +@@ -151,7 +151,7 @@ subroutine step_therm1 (dt) + + integer (kind=int_kind) :: & + ntrcr, nt_apnd, nt_hpnd, nt_ipnd, nt_alvl, nt_vlvl, nt_Tsfc, & +- nt_iage, nt_FY, nt_qice, nt_sice, nt_qsno, & ++ nt_iage, nt_FY, nt_qice, nt_sice, nt_qsno, nt_fluff, & + nt_aero, nt_isosno, nt_isoice, nt_rsnw, nt_smice, nt_smliq + + logical (kind=log_kind) :: & +@@ -198,7 +198,7 @@ subroutine step_therm1 (dt) + call icepack_query_tracer_indices( & + nt_apnd_out=nt_apnd, nt_hpnd_out=nt_hpnd, nt_ipnd_out=nt_ipnd, & + nt_alvl_out=nt_alvl, nt_vlvl_out=nt_vlvl, nt_Tsfc_out=nt_Tsfc, & +- nt_iage_out=nt_iage, nt_FY_out=nt_FY, & ++ nt_iage_out=nt_iage, nt_FY_out=nt_FY, nt_fluff_out=nt_fluff, & + nt_qice_out=nt_qice, nt_sice_out=nt_sice, & + nt_aero_out=nt_aero, nt_qsno_out=nt_qsno, & + nt_rsnw_out=nt_rsnw, nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, & +@@ -289,6 +289,7 @@ subroutine step_therm1 (dt) + hpnd = trcrn(i,nt_hpnd,:), & + ipnd = trcrn(i,nt_ipnd,:), & + iage = trcrn(i,nt_iage,:), & ++ fluff= trcrn(i,nt_fluff,:), & + FY = trcrn(i,nt_FY,:), & + rsnwn = rsnwn (:,:), & + smicen = smicen(:,:), & +@@ -356,6 +357,8 @@ subroutine step_therm1 (dt) + faero_ocn = faero_ocn(i,1:n_aero), & + fiso_atm = fiso_atm (i,:), & + fiso_ocn = fiso_ocn (i,:), & ++ ffluff_atm = ffluff_atm (i), & ++ ffluff_ocn = ffluff_ocn (i), & + fiso_evap = fiso_evap (i,:), & + HDO_ocn = HDO_ocn (i), & + H2_16O_ocn = H2_16O_ocn (i), & +diff --git a/configuration/scripts/icepack.build b/configuration/scripts/icepack.build +index f897de4..10e9d23 100755 +--- a/configuration/scripts/icepack.build ++++ b/configuration/scripts/icepack.build +@@ -63,7 +63,7 @@ endif + if !(-d ${ICE_OBJDIR}) mkdir -p ${ICE_OBJDIR} + cd ${ICE_OBJDIR} + +-setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DNXGLOB=${ICE_NXGLOB} -DNICELYR=${NICELYR} -DNSNWLYR=${NSNWLYR} -DNICECAT=${NICECAT} -DNFSDCAT=${NFSDCAT} -DTRAGE=${TRAGE} -DTRFY=${TRFY} -DTRLVL=${TRLVL} -DTRPND=${TRPND} -DTRSNOW=${TRSNOW} -DTRBRI=${TRBRI} -DNTRISO=${NTRISO} -DNTRAERO=${NTRAERO} -DNBGCLYR=${NBGCLYR} -DTRALG=${TRALG} -DTRBGCZ=${TRBGCZ} -DTRDOC=${TRDOC} -DTRDOC=${TRDOC} -DTRDIC=${TRDIC} -DTRDON=${TRDON} -DTRFED=${TRFED} -DTRFEP=${TRFEP} -DTRZAERO=${TRZAERO} -DTRBGCS=${TRBGCS} " ++setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DNXGLOB=${ICE_NXGLOB} -DNICELYR=${NICELYR} -DNSNWLYR=${NSNWLYR} -DNICECAT=${NICECAT} -DNFSDCAT=${NFSDCAT} -DTRAGE=${TRAGE} -DTRFY=${TRFY} -DTRLVL=${TRLVL} -DTRPND=${TRPND} -DTRSNOW=${TRSNOW} -DTRBRI=${TRBRI} -DNTRISO=${NTRISO} -DNTRAERO=${NTRAERO} -DNBGCLYR=${NBGCLYR} -DTRALG=${TRALG} -DTRBGCZ=${TRBGCZ} -DTRDOC=${TRDOC} -DTRDOC=${TRDOC} -DTRDIC=${TRDIC} -DTRDON=${TRDON} -DTRFED=${TRFED} -DTRFEP=${TRFEP} -DTRZAERO=${TRZAERO} -DTRBGCS=${TRBGCS} -DNFLUFF=${NFLUFF}" + + if (${ICE_IOTYPE} == 'netcdf') then + setenv ICE_CPPDEFS "${ICE_CPPDEFS} -DUSE_NETCDF" +diff --git a/configuration/scripts/icepack.settings b/configuration/scripts/icepack.settings +index 5c536f8..e5ec95f 100755 +--- a/configuration/scripts/icepack.settings ++++ b/configuration/scripts/icepack.settings +@@ -74,6 +74,7 @@ setenv TRFEP 0 # number of particulate iron tracers + # (up to max_fe = 2) + setenv TRFED 0 # number of dissolved iron tracers + # (up to max_fe = 2) ++setenv NFLUFF 0 # number of fluffball tracers + + ### Specialty code + setenv ICE_SNICARHC false # include hardcoded (HC) snicar tables +diff --git a/configuration/scripts/icepack_in b/configuration/scripts/icepack_in +index bbf7a59..88f76b0 100644 +--- a/configuration/scripts/icepack_in ++++ b/configuration/scripts/icepack_in +@@ -33,6 +33,7 @@ + tr_aero = .false. + tr_fsd = .false. + tr_iso = .false. ++ tr_fluff = .false. + / + + &thermo_nml +diff --git a/configuration/scripts/options/set_env.fluff b/configuration/scripts/options/set_env.fluff +new file mode 100644 +index 0000000..49ac114 +--- /dev/null ++++ b/configuration/scripts/options/set_env.fluff +@@ -0,0 +1 @@ ++setenv NFLUFF 1 # number of fluff tracers +diff --git a/configuration/scripts/options/set_nml.fluff b/configuration/scripts/options/set_nml.fluff +new file mode 100644 +index 0000000..cb0a4ea +--- /dev/null ++++ b/configuration/scripts/options/set_nml.fluff +@@ -0,0 +1 @@ ++tr_fluff = .true. +diff --git a/configuration/scripts/tests/timeseries.csh b/configuration/scripts/tests/timeseries.csh +index 459c905..7b2d5fe 100755 +--- a/configuration/scripts/tests/timeseries.csh ++++ b/configuration/scripts/tests/timeseries.csh +@@ -29,6 +29,7 @@ set fieldlist=("area fraction " \ + "new ice (m)" \ + "congelation (m)" \ + # "snow-ice (m)" \ ++ "fluffballs (kg)" \ + "intnl enrgy chng(W/m^2)") + + # Get the filename for the latest log diff --git a/doc/source/appendices/icepack_index.rst b/doc/source/appendices/icepack_index.rst new file mode 120000 index 000000000..de23229be --- /dev/null +++ b/doc/source/appendices/icepack_index.rst @@ -0,0 +1 @@ +../icepack_index.rst \ No newline at end of file diff --git a/doc/source/appendices/index.rst b/doc/source/appendices/index.rst new file mode 100755 index 000000000..ffd6e293c --- /dev/null +++ b/doc/source/appendices/index.rst @@ -0,0 +1,11 @@ +.. _appendices: + +Appendices +----------------------- + +.. toctree:: + :maxdepth: 3 + + icepack_index.rst + tutorial.rst + diff --git a/doc/source/appendices/tutorial.rst b/doc/source/appendices/tutorial.rst new file mode 100644 index 000000000..a938eba53 --- /dev/null +++ b/doc/source/appendices/tutorial.rst @@ -0,0 +1,155 @@ +:tocdepth: 3 + +.. _tutorial: + +Icepack Tutorial +================= + + + +Learning Goals +---------------- + +In this activity you will clone the Icepack model code from the Consortium GitHub repository, create a branch, add a new tracer to Icepack, and run standalone Icepack simulations. You will also make namelist changes and code modifications for experiments and make some basic plots. + +Notes: + +* Command line text is shown in highlighted boxes. +* When there is the syntax, you need to fill in your personal information (e.g. a URL or username) for that command but without the angle brackets. Your GitHub and local computer usernames may not be the same, so check which you need to use. +* There is a lot of documentation. + + * Icepack User Guide, https://cice-consortium-icepack.readthedocs.io/en/latest/index.html + * CICE-Consortium GitHub Usage Guide, https://github.com/CICE-Consortium/About-Us/wiki/Git-Workflow-Guide + * CICE and Icepack Resources, https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index + + +Create An Icepack Branch, Port, and Run Initial Case +------------------------------------------------------ + +You should fork the Icepack repository and create a new branch in your fork for development. This is documented in https://github.com/CICE-Consortium/About-Us/wiki/Git-Workflow-Guide. But basically, + +* Create a github account for yourself +* Fork the Consortium Icepack repository using the "Fork" feature at https://github.com/CICE-Consortium/Icepack +* Clone your repository onto your machine +* Create a branch +* Checkout the branch +* Port the model and verify you can build and run the model + +Many of these steps are done once per user or machine. You may be able to leverage the conda port to build and run the model, you may be working on a supported machine, or you may have to port the model to your machine. Porting, setting up cases, building, running, and running test suites are all documented in the Icepack User Guide, https://cice-consortium-icepack.readthedocs.io/en/latest/index.html. There are many ways to setup and run the model. + +**Note:** The workflow guide is oriented toward setting up CICE rather than Icepack, but the same workflow applies to Icepack standalone. + +To summarize the steps in greater detail **assuming use of conda in a Mac or Linux environment**. + +* Create a github account for yourself if you don't have one already (done once per user) + +* Fork the Consortium Icepack repository, go to https://github.com/CICE-Consortium/Icepack and click on the fork button (done once per user) + +* Clone Icepack, sync the main branch, and create a new branch from the main branch. This will create a branch based on the lastest version of main:: + + mkdir ~/icepack-dirs + cd ~/icepack-dirs + git clone https://github.com//Icepack + cd Icepack + git status (Branch should be main) + git remote --v (Check the origin and NO upstream) + git remote add upstream https://github.com/CICE-Consortium/Icepack + git remote --v (Check upstream has been added) + git pull upstream main + git push origin main + git branch + git checkout + git status (Branch should be ) + +* Setup local env and download input datasets (done once per machine):: + + mkdir -p ~/icepack-dirs/runs ~/icepack-dirs/input ~/icepack-dirs/baseline + cd ~/icepack-dirs/input + curl -O https://zenodo.org/records/3728287/files/Icepack_data-20200326.tar.gz + tar -xzf Icepack_data-20200326.tar.gz + +* Setup the conda environment (done once per machine), see :ref:`laptops`:: + + curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/Downloads/miniconda.sh + bash ~/Downloads/miniconda.sh + source $HOME/miniconda3/bin/activate + conda init bash + conda config --set auto_activate_base false + source $HOME/miniconda3/bin/activate + cd ~/icepack-dirs/Icepack + conda env create -f configuration/scripts/machines/environment.yml + conda activate icepack + +**NOTE:** If you have a Windows machine, we recommend using the Ubuntu Linux application, https://ubuntu.com/desktop/wsl. + +Again, there are many options for setting up the model on hardware, see the Icepack User Guide for more details. + +* Set Up an Icepack Simulation. See :ref:`quickstart` and :ref:`running_icepack`:: + + cd ~/Icepack + ./icepack.setup --case icepack_test0 --mach conda --env macos + cd ~/icepack-dirs/cases/icepack_test0 + ./icepack.build + ./icepack.submit + +Several env variables are defined in **icepack.settings** and the Icepack namelist file is **icepack_in**. Output files are copied from the run directory to a logs directory under the case. If the run is successful, you will see the message “ICEPACK COMPLETED SUCCESSFULLY” in the icepack run log file. Note that this job runs quickly - you are running a column model with four grid cells! + +Look at the output. Go to the ICE_RUNDIR (defined in **icepack.settings**). A successful model integration will create ice_diag.* files and a file in the “restart” directory called “iced.yyyy-mm-dd-sssss” where yyyy-mm-dd-sssss is a model date/time stamp. The Icepack documentation has more information about :ref:`history`. + +* Plot some output using the timeseries script provided, see :ref:`testplotting`. The conda icepack environment must be activated:: + + cd $ICE_RUNDIR + conda activate icepack + ${ICE_SANDBOX}/configurations/scripts/tests/timeseries.csh ice_diag.full_ITD + +**Note:** that you can run the plotting script on any of the four ice_diag.* files. The .png files are created in the ICE_RUNDIR directory. View the png files. + +* Questions to think about while looking at the output. + + * What time period does an out-of-the-box run cover? + * What are the differences between the full_ITD plots and the icefree plots (or any other combination of the ice_diag.* output files)? Which fields are the same? Which are different? Why would this be? + * What happens to ice area and ice thickness around October 1, 2015? Why do you see this signal? + * How does your output compare to the sample output provided for this release? + + +Modify the Configuration or Code +------------------------------------ + +* Set up a longer Run. Modify ``npt`` in icepack_in. ``npt`` defines the number of timesteps to run. Details about namelist options are in the documentation (:ref:`case_settings`). + +* Modify a physics option. Change the thermodynamics option from ktherm=2 to ktherm=1 in **icepack_in**, and set sw_redist=.true. The intent here is to change the namelist option for the current experiment in the case directory. What is different compared to your first run? What happens if sw_redist = .false. with ktherm = 1? Why? + +* Undo your latest **icepack_in** changes + +* Change a Parameter in the Fortran Code. Edit **icepack_mechred.F90** and set + + ``fsnowrdg = c1 , & ! snow fraction that survives in ridging``. + + Rebuild the code before running. What is different about this run? What do you think the fsnowrdg parameter is doing here? + +* Revert your latest code changes:: + + cd ~/Icepack + git status + git checkout columnphysics/icepack_mechred.F90 + git status + +.. _tutorialfluff: + +Add a New Tracer +-------------------------------------- + +In this exercise, add a new tracer associated with fluffballs. +Call the tracer fluff and make it depend on ice area. Follow the step-by-step instructions in the :ref:`addtrcr` documentation. +Once you have implemented the model changes, be sure to add fluffballs output to the standard output diagnostics and turn on the +fluff tracer. Then update the timeseries plotting script to plot the fluffballs values over time. + +* First, set the initial value, physics, sources, and sinks of fluff to zero and make sure fluff values remain zero throughout the run + +* Add some constant atmospheric forcing and review results + +* Change the dependency to ice volume, how do the results change? + +* Modify the physics to create some physics processes, see isotopes or aerosols for some ideas + +**NOTE:** The file, **doc/source/tutorial/fluff.diff** in the Icepack repository, demonstrates code differences for this fluffball activity as implemented in a version of Icepack from July, 2024. These code differences may not be directly applicable to other code versions, but they provide an example of the typical code modifications required to add the tracer, fluff. diff --git a/doc/source/conf.py b/doc/source/conf.py index 6a6aa7cc0..ba2e04715 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -38,6 +38,7 @@ 'sphinxcontrib.bibtex', ] +bibtex_bibfiles=['master_list.bib'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -54,7 +55,7 @@ # General information about the project. project = u'Icepack' -copyright = u'2023, Triad National Security, LLC (code) and National Center for Atmospheric Research (documentation)' +copyright = u'2024, Triad National Security, LLC (code) and National Center for Atmospheric Research (documentation)' author = u'CICE-Consortium' # The version info for the project you're documenting, acts as replacement for @@ -62,16 +63,16 @@ # built documents. # # The short X.Y version. -version = u'1.3.4' +version = u'1.5.0' # The full version, including alpha/beta/rc tags. -version = u'1.3.4' +version = u'1.5.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/doc/source/developer_guide/dg_adding_tracers.rst b/doc/source/developer_guide/dg_adding_tracers.rst index 4f16ec0f3..3a1646af1 100755 --- a/doc/source/developer_guide/dg_adding_tracers.rst +++ b/doc/source/developer_guide/dg_adding_tracers.rst @@ -8,7 +8,7 @@ Adding tracers We require that any changes made to the code be implemented in such a way that they can be "turned off" through namelist flags. In most cases, code run with such changes should be bit-for-bit identical with the unmodified code. Occasionally, non-bit-for-bit changes -are necessary, e.g. associated with an unavoidable change in the order of operations. In +are necessary or unavoidable due to a change in the order of operations. In these cases, changes should be made in stages to isolate the non-bit-for-bit changes, so that those that should be bit-for-bit can be tested separately. @@ -16,10 +16,9 @@ Tracers added to Icepack will also require extensive modifications to the host sea ice model, including initialization on the horizontal grid, namelist flags and restart capabilities. Modifications to the Icepack driver should reflect the modifications needed in the host model but are not expected to match completely. -We recommend that the logical namelist variable -``tr_[tracer]`` be used for all calls involving the new tracer outside of -**ice\_[tracer].F90**, in case other users do not want to use that -tracer. +We recommend that a logical namelist variable +``tr_[tracer]`` be added and used for all calls involving the new tracer to provide +clean backwards compatibility. A number of optional tracers are available in the code, including ice age, first-year ice area, melt pond area and volume, brine height, @@ -45,54 +44,134 @@ the tracer dependencies (weights), which are tracked using the arrays ``trcr_depend`` (indicates dependency on area, ice volume or snow volume), ``trcr_base`` (a dependency mask), ``n_trcr_strata`` (the number of underlying tracer layers), and ``nt_strata`` (indices of underlying layers). -See subroutine *icepack_compute_tracers* in **icepack\_tracers.F90**. +See subroutine *icepack_compute_tracers* in **icepack_tracers.F90**. -To add a tracer, follow these steps using one of the existing tracers as -a pattern (e.g. age). +To add a tracer, follow these steps using one of the existing tracers, for example +age or isotopes, as an example. Lets call the new tracer xyz. Note that many +of the changes are defined in the Icepack driver or scripts. For CICE or other models +using Icepack, adding a new tracer may be done differently. However, changes to the +Icepack columnphyics should be similar. As you make changes, we recommend that you +build and run with the tracer off to ensure the code modifications are working properly. +Changes to setup, namelist, and build files either need to be tested by generating +a new case or by modifying the same files in an existing case before running. +Code changes can be tested by rebuilding and rerunning an existing case. -#. **icedrv\_domain\_size.F90**: increase ``max_ntrcr`` (can also add option - to **icepack.settings** and **icepack.build**) +The appendix has a tutorial activity, :ref:`tutorialfluff`, where a tracer is added to +Icepack. A set of code differences are provided there as an example of how this could +be done in practice. -#. **icepack\_tracers.F90**: +#. Define a new tracer. First, setup the tracer cpp in **configuration/scripts/icepack.settings** + and **configuration/scripts/icepack.build** - - declare ``nt_[tracer]`` and ``tr_[tracer]`` + - In **icepack.settings**, add:: - - add flags and indices to the init, query and write subroutines, and - call these routines as needed throughout the code + setenv NXYZ 1 # number of xyz tracers -#. **icepack\_[tracer].F90**: create physics routines + - In **icepack.build**, add:: -#. **icedrv\_init.F90**: (some of this may be done in **icepack\_[tracer].F90** - instead) + -DNXYZ=${NXYZ} - - declare ``tr_[tracer]`` and ``nt_[tracer]`` as needed + to the setenv ICE_CPPDEFS line - - add logical namelist variable ``tr_[tracer]`` +#. Define the new tracer dimension in **icedrv_domain_size.F90**. - - initialize namelist variable + - Add a new dimension:: - - print namelist variable to diagnostic output file + n_xyz = NXYZ, & ! number of xyz tracers - - increment number of tracers in use based on namelist input (``ntrcr``) + - Update the size of ``max_ntrcr`` by adding:: - - define tracer dependencies + + n_xyz & ! number of xyz tracers -#. **icedrv\_step\_mod.F90** (and elsewhere as needed): +#. Add the new tracer to **icepack_tracers.F90**: - - call physics routines in **icepack\_[tracer].F90** + - Define new variables:: -#. **icedrv\_restart.F90**: + tr_xyz=.false. + n_xyz=0 + nt_xyz=0 - - define restart variables + By default, these are turned off. + + - Add the new variables to the tracer init, query, and write subroutine arguments + (tracer_flags, tracer_sizes, and tracer_indices). The driver of Icepack will turn + this tracer on as needed. + +#. Update the driver code to initialize the tracer flag and size and allocate space + for the tracer. You will also + define dependency, whether the variable is dependent on ice area (aice), ice + volume (vice), snow volume (vsno), or something else. Edit **icedrv_init.F90**. + + - Add ``n_xyz`` to use icedrv_domain_size in subroutine input_data + + - Define ``tr_xyz`` and ``nt_xyz`` variables in subroutine input_data + + - Add a logical namelist variable ``tr_xyz` to tracer_nml + + - Add a line to initialize ``tr_xyz=.false.`` + + - Add a check that ``tr_xyz`` and ``n_xyz`` are consistent + + - Add code to increment the number of tracers in use, ``ntrcr``, based on namelist input + + - Add some code to print xyz tracer info to the output file + + - Add calls to subroutines icepack_init_tracer_sizes, icepack_init_tracer_flags, and + icepack_init_tracer_indices to initialize the xyz tracer information in Icepack. + + - Define the tracer dependency in subroutine init_state. Area tracers can be thought of in terms of averages across + the ice area (the tracer value itself) or averages over the grid cell area (tracer * aice). + Volume tracers can be considered in a similar way, but it can also be helpful to think of + the tracer as the “density” of the variable, which when multiplied by the ice or snow volume + gives the total content of the variable in that volume of the ice or snow. The “total content” + is often a conserved quantity that can be checked during the calculation. + +#. Add the tracer to the default namelist **configuration/scripts/icepack_in** + + - Add the namelist flag ``tr_xyz`` to *tracer_nml*. + Best practice is to set the default namelist values so that the + new capability is turned off. You can create an option file with your preferred + configuration in **configuration/scripts/options**. - - call routines to read, write tracer restart data +#. If your tracer depends on ocean or atmosphere forcing -#. **icepack\_in**: add namelist variables to *tracer\_nml* and - *icefields\_nml*. Best practice is to set the namelist values so that the - new capability is turned off, and create an option file with your preferred - configuration in **configuration/scripts/options**. + - Initialize the sources and sinks in **icedrv_flux.F90** -#. If strict conservation is necessary, add diagnostics as noted for - topo ponds in Section :ref:`ponds` + - Add a subroutine to generate these sources or sinks in **icedrv_forcing.F90** + or **icedrv_forcing_bgc.F90**. + + - Add the new tracer forcing calls in **icedrv_InitMod.F90** and **icedrv_RunMod.F90** + + - Always use the flag ``tr_xyz`` to determine whether to call these routines. + +#. Create a new physics file/module for your tracer, **icepack_xyz.F90**. + This subroutine handles a number of the processes within the + sea ice and snow which affect the distribution of the tracer. These processes could include + congelation growth, snow melt, sea ice melt, evaporation / sublimation, or snow-ice formation. + Note there is a more sophisticated vertical distribution of tracer under the zbgc package. + If your tracer is impacted by frazil ice growth or lateral melt, this is discussed later. + It’s often helpful to copy and modify existing modules such as icepack_age.F90 or icepack_isotope.F90. + +#. Add the physics calls to Icepack or the driver. + + - Depending on the physics implementation, the + new tracer physics calls might be done in **icepack_therm_vertical**, **icedrv_step.F90**, and/or + elsewhere. See use of subroutines ``update_aerosol``, ``update_isotope``, or ``increment_age``. + + - Pass tracer array into Icepack via public interfaces as needed + + - Always use the flag ``tr_xyz`` to determine whether to call these routines. + +#. Add the new tracer to the restart files. Edit **icedrv_restart.F90**, + + - define restart variables + + - call routines to read and write tracer restart data + +#. If strict conservation is necessary, add conservation diagnostics using the + topographical ponds as an example, :ref:`ponds` #. Update documentation, including **icepack_index.rst** and **ug_case_settings.rst** + +#. Test and validate. Verify backwards compatibility. + diff --git a/doc/source/icepack_index.rst b/doc/source/icepack_index.rst index fed6ceb18..712d1d891 100755 --- a/doc/source/icepack_index.rst +++ b/doc/source/icepack_index.rst @@ -5,13 +5,15 @@ Index of primary variables and parameters ========================================== -This index defines many of the symbols used frequently in the ice model +This index defines many (but not all) of the symbols used frequently in the ice model code. Values appearing in this list are fixed or recommended; most namelist parameters are indicated ( :math:`\bullet`) with their default -values. For other namelist options, see Section :ref:`tabnamelist`. All -quantities in the code are expressed in MKS units (temperatures may take +values. All quantities in the code are expressed in MKS units (temperatures may take either Celsius or Kelvin units). Deprecated parameters are listed at the end. +Namelist variables are partly included here, but they are fully documented in +section :ref:`tabnamelist`. + .. csv-table:: *Alphabetical Index of Icepack Variables and Parameters* :header: " ", " ", " " :widths: 15, 30, 15, 1 @@ -247,7 +249,7 @@ either Celsius or Kelvin units). Deprecated parameters are listed at the end. "kappav", "visible extinction coefficient in ice, wavelength\ :math:`<`\ 700nm", "1.4 m\ :math:`^{-1}`" "kcatbound", ":math:`\bullet` category boundary formula", "" "kg_to_g", "kg to g conversion factor", "1000." - "kice", "thermal conductivity of fresh ice (:cite:`Bitz99`)", "2.03 W/m/deg" + "kice", "thermal conductivity of fresh ice with BL99+MU71 (:cite:`Bitz99`)", "2.03 W/m/deg" "kitd", ":math:`\bullet` type of itd conversions (0 = delta function, 1 = linear remap)", "1" "krdg_partic", ":math:`\bullet` ridging participation function", "1" "krdg_redist", ":math:`\bullet` ridging redistribution function", "1" diff --git a/doc/source/index.rst b/doc/source/index.rst index ee714eb79..5788fbe18 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -16,7 +16,7 @@ Icepack Documentation user_guide/index_standalone.rst user_guide/index_withmodels.rst developer_guide/index.rst - icepack_index.rst + appendices/index.rst zreferences.rst * :ref:`search` diff --git a/doc/source/intro/copyright.rst b/doc/source/intro/copyright.rst index e477d9d57..8ddeef022 100755 --- a/doc/source/intro/copyright.rst +++ b/doc/source/intro/copyright.rst @@ -5,7 +5,7 @@ Copyright ============================= -© Copyright 2023, Triad National Security LLC. All rights reserved. +© Copyright 2024, Triad National Security LLC. All rights reserved. This software was produced under U.S. Government contract 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S. Department diff --git a/doc/source/master_list.bib b/doc/source/master_list.bib index 7ffb0a841..2296cbd98 100644 --- a/doc/source/master_list.bib +++ b/doc/source/master_list.bib @@ -32,7 +32,7 @@ @string{JGR @string{JGRO = {J. Geophys. Res. Oceans}} @string{JGRB = {J. Geophys. Res. Biogeo.}} @string{JGRA = {J. Geophys. Res. Atmos.}} -@string{JCT = {J. Comput. Phys.}} +@string{TC = {The Cryosphere}} @string{QJRMS = {Quart. J. Royal Met. Soc.}} @string{GRL = {Geophys. Res. Lett.}} @string{JAS = {J. Atmos. Sci.}} @@ -56,6 +56,8 @@ @string{BGC @string{EFM = {Eng. Fract. Mech.}} @string{ANG = {Ann. Glaciol.}} @string{NOAA = {Natl. Ocn. and Atm. Admin}} +@string{WRR = {Water Resour. Res.}} +@string{LO = {L&O}} % ********************************************** % List of individual sources and their meta data @@ -244,7 +246,7 @@ @Article{Maykut95 @Article{Murray96 author = "R.J. Murray", title = "{Explicit generation of orthogonal grids for ocean models}", - journal = JCT, + journal = JCP, year = {1996}, volume = {126}, pages = {251-273}, @@ -805,13 +807,42 @@ @article{Roberts19 @article{Dang19, author = {Dang, C. and Zender, C. S. and Flanner, M. G.}, title = {Intercomparison and improvement of two-stream shortwave radiative transfer schemes in Earth system models for a unified treatment of cryospheric surfaces}, -journal = {The Cryosphere}, +journal = {TC}, volume = 13, pages = {2325--2343}, doi = {10.5194/tc-13-2325-2019}, year = {2019} } +@article{Plante24, +author = {Plante, M. and J.-F. Lemieux and L. B. Tremblay and A. Tivy and J. Angnatok and F. Roy and G. Smith and F. Dupont and A. K. Turner}, +title = {Using Icepack to reproduce ice mass balance buoy observations in landfast ice: improvements from the mushy-layer thermodynamcis}, +journal = {TC}, +volume = 18, +pages = {1685--1708}, +doi = {10.5194/tc-18-1685-2024}, +year = {2024} +} + +@article{Johnson95, +author = {Johnson, {William P.} and Blue, {Karen A.} and Logan, {Bruce E.} and Arnold, {Robert G.}}, +title = {Modeling Bacterial Detachment During Transport Through Porous Media as a Residence‐Time‐Dependent Process}, +year = {1995}, +doi = {10.1029/95WR02311}, +volume = 31, +pages = {2649--2658}, +journal = {WWR} +} +@article{Edwards2012, +author = {Edwards, Kyle F. and Thomas, Mridul K. and Klausmeier, Christopher A. and Litchman, Elena}, +title = {Allometric scaling and taxonomic variation in nutrient utilization traits and maximum growth rate of phytoplankton}, +journal = {LO}, +volume = {57}, +number = {2}, +pages = {554-566}, +doi = {https://doi.org/10.4319/lo.2012.57.2.0554}, +year = {2012} +} % ********************************************** % For new entries, see example entry in BIB_TEMPLATE.txt % ********************************************** diff --git a/doc/source/science_guide/sg_bgc.rst b/doc/source/science_guide/sg_bgc.rst index 90f93f620..b38b27135 100755 --- a/doc/source/science_guide/sg_bgc.rst +++ b/doc/source/science_guide/sg_bgc.rst @@ -13,7 +13,7 @@ Basic Aerosols Aerosols may be deposited on the ice and gradually work their way through it until the ice melts and they are passed into the ocean. They -are defined as ice and snow volume tracers (Eq. 15 and 16 in CICE.v5 +are defined as ice and snow volume tracers (see CICE "Tracers" documentation), with the snow and ice each having two tracers for each aerosol species, one in the surface scattering layer (delta-Eddington SSL) and one in the snow or ice interior below the SSL. @@ -50,7 +50,7 @@ An alternate scheme for aerosols in sea ice is available using the brine motion based transport scheme of the biogeochemical tracers. All vertically resolved biogeochemical tracers (z-tracers), including aerosols, have the potential to be atmospherically deposited onto the -snow or ice, scavenged during snow melt, and passed into the brine. The +snow or ice, scavenged during snow melt, and passed into the brine. They can also be picked up from the ocean if there is an ocean source. The mobile fraction (discussed in :ref:`mobile-and-stationary`) is then transported via brine drainage processes (Eq. :eq:`mobile-transport`) while a @@ -63,7 +63,7 @@ the scavenging parameter ``kscavz`` for z-tracers defined in **icepack\_zbgc\_shared.F90**. Within the snow, z-tracers are defined as concentrations in the snow -surface layer (:math:`h_{ssl}`) and the snow interior +surface layer (:math:`h_{ssl}`), equal to half the snow layer thickness, and the snow interior (:math:`h_s-h_{ssl}`). The total snow content of z-tracers per ice area per grid cell area, :math:`C_{snow}` is @@ -73,13 +73,13 @@ per grid cell area, :math:`C_{snow}` is One major difference in how the two schemes model snow aerosol transport is that the fraction scavenged from snow melt in the z-tracer scheme is not immediately fluxed into the ocean, but rather, enters the ice as a -source of low salinity but potentially tracer-rich brine. The snow melt +source of potentially tracer-rich brine. The snow melt source is included as a surface flux condition in **icepack\_algae.F90**. All the z-aerosols are nonreactive with the exception of the dust -aerosols. We assume that a small fraction of the dust flux into the ice -has soluble iron (``dustFe_sol`` in **icepack\_in**) and so is -passed to the dissolved iron tracer. The remaining dust passes through +aerosols. If biogeochemistry is active, we assume that a small fraction of the dust flux into the ice +is iron ((``R_dFe2dust`` in **icepack\_in**) and a fraction of that has soluble iron (``dustFe_sol`` in **icepack\_in**). This is +passed to the dissolved iron tracer if active. The remaining dust passes through the ice without reactions. To use z-aerosols, ``tr_zaero`` must be set to true in **icepack\_in**, and the @@ -87,7 +87,7 @@ number of z-aerosol species is set in **icepack.settings**, ``TRZAERO``. Note, t basic tracers ``tr_aero`` must be false and ``NTRAERO`` in **icepack.settings** should be 0. In addition, z-tracers and the brine height tracer must also be active. These are set in **icepack\_in** with ``tr_brine`` and -``z_tracer`` set to true. In addition, to turn on the radiative coupling +``z_tracer`` set to true. To turn on the radiative coupling between the aerosols and the Delta-Eddington radiative scheme, ``shortwave`` must equal ’dEdd’ and ``dEdd_algae`` must be true in **icepack\_in**. @@ -98,7 +98,7 @@ Water Isotope Water isotopes may be deposited on the ice from above or below, and gradually work their way through it until the ice melts and they are passed into the ocean. They -are defined as ice and snow volume tracers (Eq. 15 and 16 in CICE.v5 +are defined as ice and snow volume tracers (see CICE "Tracers" documentation), with the snow and ice each having one tracer for each water isotope species. @@ -264,6 +264,10 @@ where the sums are taken over thickness categories. Sea ice ecosystem ----------------- +**The skeletal layer implementation has been deprecated but not removed as of +September, 2024. If users are interested in this feature, please contact +the CICE Consortium. The documentation below has not yet been removed.** + There are two options for modeling biogeochemistry in sea ice: 1) a skeletal layer or bottom layer model that assumes biology and biological molecules are restricted to a single layer at the base of @@ -299,8 +303,7 @@ There are also environmental variables in **icepack.settings** that, in part, specify the complexity of the ecosystem and are used for both zbgc and the skeletal-layer model. These are 1) ``TRALG``, the number of algal species; 2) ``TRDOC``, the number of dissolved organic carbon groups, 3) ``TRDIC``, the -number of dissolved inorganic carbon groups (this is currently not yet -implemented and should be set to 0); 4) ``TRDON``, the number of dissolved +number of dissolved inorganic carbon groups (this is set to 1 if conservation of carbon is desired); 4) ``TRDON``, the number of dissolved organic nitrogen groups, 5) ``TRFEP``, the number of particulate iron groups; and 6) ``TRFED``, the number of dissolved iron groups. The current version of **algal\_dyn** biochemistry has parameters for up to 3 algal @@ -329,6 +332,10 @@ namelist, ``bgc_data_file``. Skeletal Layer BGC ~~~~~~~~~~~~~~~~~~ +**The skeletal layer implementation has been deprecated but not removed as of +September, 2024. If users are interested in this feature, please contact +the CICE Consortium. The documentation below has not yet been removed.** + In the skeletal layer model, biogeochemical processing is modelled as a single layer of reactive tracers attached to the sea ice bottom. Optional settings are available via the *zbgc\_nml* namelist in @@ -426,7 +433,7 @@ section :ref:`reactions`. .. _zbgc: -Vertical BGC (''zbgc'') +Vertical BGC ("zbgc") ~~~~~~~~~~~~~~~~~~~~~~~ In order to solve for the vertically resolved biogeochemistry, several @@ -439,7 +446,7 @@ flags in **icepack\_in** must be true: a) ``tr_brine``, b) ``z_tracers``, and c) volume\ :math:`\times`\ brine height fraction. - ``z_tracers`` = true indicates use of vertically resolved - biogeochemical and z-aerosol tracers. This flag alone turns on the + biogeochemical tracers, z-aerosol tracers, or both. This flag alone turns on the vertical transport scheme but not the biochemistry. - ``solve_zbgc`` = true turns on the biochemistry for the vertically @@ -455,17 +462,17 @@ flags in **icepack\_in** must be true: a) ``tr_brine``, b) ``z_tracers``, and c) .. the Bitz and Lipscomb thermodynamics ``ktherm`` set to 1 and ``solve_zsal`` .. true (referred to as "zsalinity"). -With the above flags, the default biochemistry is a simple -algal-nitrate system: ``tr_bgc_N`` and ``tr_bgc_Nit`` are true. Options +With the above flags and ``tr_bgc_Nit`` set to true, the default biochemistry is a simple +algal-nitrate system: ``tr_bgc_N`` (turned on by default) and ``tr_bgc_Nit`` (required). Options exist in **icepack\_in** to use a more complicated ecosystem which includes up -to three algal classes, two DOC groups, one DON pool, limitation by -nitrate, silicate and dissolved iron, sulfur chemistry plus refractory +to three algal classes, two DOC groups, one DON pool, one DIC, limitation by +silicate and dissolved iron, sulfur chemistry plus refractory humic material. The **icepack\_in** namelist options are described in the :ref:`tabnamelist`. -Vertically resolved z-tracers are brine- volume conserved and thus depend +Vertically resolved z-tracers are brine volume conserved and thus depend on both the ice volume and the brine height fraction tracer (:math:`v_{in}f_b`). These tracers follow the conservation equations for multiply dependent tracers (see, for example Equation :eq:`transport-apnd-lvl` where :math:`a_{pnd}` is a tracer on :math:`a_{lvl}a_{i}`) @@ -482,12 +489,12 @@ The vertical bio-grid is described in the :ref:`grids` section. Purely mobile tracers are tracers which move with the brine and thus, in the absence of biochemical reactions, evolve like salinity. For vertical tracer transport of purely mobile tracers, the flux conserved quantity -is the bulk tracer concentration multiplied by the ice thickness, i.e. -:math:`C = h\phi -[c]`, where :math:`h` is the ice thickness, :math:`\phi` is the +is the bulk tracer concentration multiplied by the brine thickness, i.e. +:math:`C = h_{b}\phi +[c]`, where :math:`h_{b}` is the brine thickness, :math:`\phi` is the porosity, and :math:`[c]` is the tracer concentration in the brine. :math:`\phi`, :math:`[c]` and :math:`C` are defined on the interface bio -grid (igrid): +grid (igrid) with ``NBGCLYR`` equal to :math:`n_{b}` in what follows: .. math:: \mbox{igrid}(k) = \Delta (k-1) \ \ \ \mbox{for }k = 1:n_b+1 \ \ \mbox{and }\Delta = 1/n_b. @@ -497,13 +504,13 @@ The biogeochemical module solves the following equation: .. math:: \begin{aligned} \frac{\partial C}{\partial t} & =& \frac{\partial }{\partial x}\left\{ - \left( \frac{v}{h} + \frac{w_f}{h\phi} - - \frac{\tilde{D}}{h^2\phi^2}\frac{\partial \phi}{\partial x} \right) C - + \frac{\tilde{D}}{h^2\phi}\frac{\partial C}{\partial x} - \right\} + h\phi R([c])\end{aligned} + \left( \frac{v}{h_{b}} + \frac{w_f}{h_{b}\phi} - + \frac{\tilde{D}}{h_{b}^2\phi^2}\frac{\partial \phi}{\partial x} \right) C + + \frac{\tilde{D}}{h_{b}^2\phi}\frac{\partial C}{\partial x} + \right\} + h_{b}\phi R([c])\end{aligned} :label: mobile-transport -where :math:`D_{in} = \tilde{D}/h^2 = (D + \phi D_m)/h^2` and +where :math:`D_{in} = \tilde{D}/h_{b}^2 = (D + \phi D_m)/h_{b}^2` and :math:`R([c])` is the nonlinear biogeochemical interaction term (see :cite:`Jeffery11`). @@ -516,12 +523,7 @@ otherwise adhere to the ice crystals. These tracers exist in both the mobile and stationary phases. In this case, their total brine concentration is a sum :math:`c_m + c_s` where :math:`c_m` is the mobile fraction transported by equation :eq:`mobile-transport` and :math:`c_s` -is fixed vertically in the ice matrix. The algae are an exception, -however. We assume that algae in the stationary phase resist brine -motion, but rather than being fixed vertically, these tracers maintain -their relative position in the ice. Algae that adhere to the ice -interior (bottom, surface), remain in the ice interior (bottom, surface) -until release to the mobile phase. +is fixed vertically in the ice matrix. Nitrate and Diatoms are special cases discussed below. In order to model the transfer between these fractions, we assume that tracers adhere (are retained) to the crystals with a time-constant of @@ -545,8 +547,8 @@ We use the exponential form of these equations: c_s^{t+dt} & = & c_s^t\exp\left(-\frac{dt}{\tau_{rel}}\right) + c_m^t\left(1-\exp\left[-\frac{dt}{\tau_{ret}}\right]\right) \end{aligned} -The time constants are functions of the ice growth and melt rates -(:math:`dh/dt`). All tracers except algal nitrogen diatoms follow the +The time constants are step-functions of the ice growth and melt rates +(:math:`dh/dt`). All tracers except algal nitrogen diatoms and nitrate follow the simple case: when :math:`dh/dt \geq 0`, then :math:`\tau_{rel} \rightarrow \infty` and :math:`\tau_{ret}` is finite. For :math:`dh/dt < 0`, then :math:`\tau_{ret} \rightarrow \infty` and @@ -554,7 +556,9 @@ For :math:`dh/dt < 0`, then :math:`\tau_{ret} \rightarrow \infty` and transitions to the stationary phase and ice melt enables transitions to the mobile phase. -The exception is the diatom pool. We assume that diatoms, the first +Nitrate is a special case. This tracer is generally treated as purely mobile. However this is not the case if nitrate arises from in situ nitrification (i.e. ammonium to nitrate). In this case, we model the nitrate as associated with a implicit biofilm which adheres to the ice matrix. This ice in situ production is assigned to the stationary phase. + +As with nitrate, diatoms are a special case. We assume that diatoms, the first algal nitrogen group, can actively maintain their relative position within the ice, i.e. bottom (interior, upper) algae remain in the bottom (interior, upper) ice, unless melt rates exceed a threshold. The @@ -562,18 +566,19 @@ namelist parameter ``algal_vel`` sets this threshold. The variable ``bgc_tracer_type`` determines the mobile to stationary transition timescales for each z-tracer. It is multi-dimensional with a -value for each z-tracer. For ``bgc_tracer_type``(k) equal to -1, the kth +value for each z-tracer. For ``bgc_tracer_type`` equal to -1, the tracer remains solely in the mobile phase. For ``bgc_tracer_type`` equal to 1, the tracer has maximal rates in the retention phase and minimal in the release. For ``bgc_tracer_type`` equal to 0, the tracer has maximal rates in the release phase and minimal in the retention. -Finally for ``bgc_tracer_type`` equal to 0.5, minimum timescales are +Finally, for ``bgc_tracer_type`` equal to 0.5, minimum timescales are used for both transitions. Table :ref:`tab-phases` summarizes the -transition types. The tracer types are: ``algaltype_diatoms``, +transition types. The distinct tracer types are specified by the parameters: ``algaltype_diatoms``, ``algaltype_sp`` (small plankton), ``algaltype_phaeo`` (*phaeocystis*), ``nitratetype``, ``ammoniumtype``, ``silicatetype``, ``dmspptype``, ``dmspdtype``, ``humtype``, ``doctype_s`` (saccharids), ``doctype_l`` (lipids), ``dontype_protein``, +``dictype`` ``fedtype_1``, ``feptype_1``, ``zaerotype_bc1`` (black carbon class 1), ``zaerotype_bc2`` (black carbon class 2), and four dust classes, ``zaerotype_dustj``, where j takes values 1 to 4. These may be modified to @@ -606,13 +611,20 @@ dependent on two tracers: brine height fraction (:math:`f_b`) and ice volume (:math:`v_{in}`). The conservation equations are given by .. math:: - {\partial\over\partial t} (f_{b}v_{in}) + \nabla \cdot (f_{b}v_{in} {\bf u}) = 0. + {\partial\over\partial t} (f_{b}v_{in}) + \nabla \cdot (f_{b}v_{in} {\bf u}) = 0 . The tracer, ``zbgc_frac``, is initialized to 1 during new ice formation, because all z-tracers are initially in the purely mobile phase. -Similarly, as the ice melts, z-tracers return to the mobile phase. Very -large release timescales will prevent this transition and could result -in an unphysically large accumulation during the melt season. +Similarly, as the ice melts, z-tracers gradually return to the mobile phase. + +Maximum accumulation of tracers (based on diatoms) on ice crystals (i.e. collectors) is ultimately limited by their saturation concentration based on :cite:`Johnson95`'s model of bacterial detachment in porous media. This is modeled simply using a single saturation concentration for all tracers. This could be modified to be tracer dependent in future versions if warranted. Several local parameters defined in **z\_biogeochemistry** are used in the calculation: 1) mean ice crystal radius :math:`r_c` ; 2) large diatom radius :math:`r_{bac}` ; 3) small diatom radius :math:`r_{alg}` ; 4) two parameters in a conversion from algal nitrogen quota to cell volume :math:`Nquota_{A}` and :math:`Nquota_I` :cite:`Edwards2012` ; 5) fraction of sites available for saturation :math:`f_s` ; 6) fraction of the collector (ice crystal) available for attachment :math:`f_a` ; 6) fraction of algal coverage by area available for attachment :math:`f_v`. These are used to compute the volume and surface area of a diatom cell (assumed to be a prolate spheriod) :math:`V_alg = \frac{\pi}{6} r_{bac}r_{alg}^{2}` and :math:`P_b = \pi r_{bac}^{2}`, respectively; and the volume and surface area of the collector (assumed to be spherical) :math:`V_c = \frac{4 \pi}{3} r_{c}^{3}` and :math:`S_{col} = 4 \pi r_{c}^{2}`, respectively. + +The saturation concentration ``Sat_conc`` is approximated as: + +.. math:: + Sat_{conc} = \frac{f_{s}f_{a}f_{v} S_{col}Nquota_{I}}{V_{c} P_{b}}(c1-phi_{max})V_{alg}^{Nquota_{A}} + +where :math:`phi_{max}` is the maximum porosity in the ice column. .. _tracer-numerics: @@ -997,9 +1009,10 @@ are true). "N (3)", "Nin(3)", "`tr_bgc_N`", "*Phaeocystis sp*", ":math:`mmol` :math:`N/m^3`" "DOC (1)", "DOCin(1)", "`tr_bgc_DOC`", "polysaccharids", ":math:`mmol` :math:`C/m^3`" "DOC (2)", "DOCin(2)", "`tr_bgc_DOC`", "lipids", ":math:`mmol` :math:`C/m^3`" - "DON", "DONin(1)", "`tr_bgc_DON`", "proteins", ":math:`mmol` :math:`C/m^3`" - "fed", "Fedin(1)", "`tr_bgc_Fe`", "dissolved iron", ":math:`\mu` :math:`Fe/m^3`" - "fep", "Fepin(1)", "`tr_bgc_Fe`", "particulate iron", ":math:`\mu` :math:`Fe/m^3`" + "DIC", "DICin(1)", "`tr_bgc_DIC`", "dissolved inorganic carbon", ":math:`mmol` :math:`C/m^3`" + "DON", "DONin(1)", "`tr_bgc_DON`", "proteins", ":math:`mmol` :math:`N/m^3`" + "fed", "Fedin(1)", "`tr_bgc_Fe`", "dissolved iron", ":math:`\mu mol` :math:`Fe/m^3`" + "fep", "Fepin(1)", "`tr_bgc_Fe`", "particulate iron", ":math:`\mu mol` :math:`Fe/m^3`" ":math:`{\mbox{NO$_3$}}`", "Nitin", "`tr_bgc_Nit`", ":math:`{\mbox{NO$_3$}}`", ":math:`mmol` :math:`N/m^3`" ":math:`{\mbox{NH$_4$}}`", "Amin", "`tr_bgc_Am`", ":math:`{\mbox{NH$_4$}}`", ":math:`mmol` :math:`N/m^3`" ":math:`{\mbox{SiO$_3$}}`", "Silin", "`tr_bgc_Sil`", ":math:`{\mbox{SiO$_2$}}`", ":math:`mmol` :math:`Si/m^3`" @@ -1007,7 +1020,7 @@ are true). "DMSPd", "DMSPdin", "`tr_bgc_DMS`", "dissolved DMSP", ":math:`mmol` :math:`S/m^3`" "DMS", "DMSin", "`tr_bgc_DMS`", "DMS", ":math:`mmol` :math:`S/m^3`" "PON", "PON :math:`^a`", "`tr_bgc_PON`", "passive mobile tracer", ":math:`mmol` :math:`N/m^3`" - "hum", "hum :math:`^{ab}`", "`tr_bgc_hum`", "passive sticky tracer", ":math:`mmol` :math:`/m^3`" + "hum", "hum :math:`^{a}`", "`tr_bgc_hum`", "refractory dissolved organic carbon", ":math:`mmol C` :math:`/m^3`" "BC (1)", "zaero(1) :math:`^a`", "`tr_zaero`", "black carbon species 1", ":math:`kg` :math:`/m^3`" "BC (2)", "zaero(2) :math:`^a`", "`tr_zaero`", "black carbon species 2", ":math:`kg` :math:`/m^3`" "dust (1)", "zaero(3) :math:`^a`", "`tr_zaero`", "dust species 1", ":math:`kg` :math:`/m^3`" @@ -1017,33 +1030,31 @@ are true). :math:`^a` not modified in *algal_dyn* -:math:`^b` may be in C or N units depending on the ocean concentration - The biochemical reaction term for each algal species has the form: .. math:: - \Delta {\mbox{N}}/dt = R_{{\mbox{N}}} = \mu (1- f_{graze} - f_{res}) - M_{ort} + \Delta {\mbox{N}}/dt = R_{{\mbox{N}}} = \mu (1 - f_{res}) - M_{ort} - G_{raze} where :math:`\mu` is the algal growth rate, :math:`M_{ort}` is a -mortality loss, :math:`f_{graze}` is the fraction of algal growth that -is lost to predatory grazing, and :math:`f_{res}` is the fraction of -algal growth lost to respiration. Algal mortality is temperature -dependent and limited by a maximum loss rate fraction (:math:`l_{max}`): +mortality loss, :math:`G_{raze}` is a loss term from implicit predatory grazing, and :math:`f_{res}` is the fraction of algal growth lost to respiration. Algal mortality is temperature +dependent. Both are limited by a maximum loss rate fraction (:math:`l_{max}`). For each algal type, we have: .. math:: - M_{ort} = \min( l_{max}[{\mbox{N}}], m_{pre} \exp\{m_{T}(T-T_{max})\}[{\mbox{N}}]) + G_{raze} = \min( l_{max} * {\mbox{N}}/dt, \mu * fr_{graze}(k) * ({\mbox{N}}/graze_{conc})^{graze_{exponent}}) Note, :math:`[\cdot]` denotes brine concentration. +.. math:: + M_{ort} = \min( l_{max}[{\mbox{N}}], m_{pre} \exp\{m_{T}(T-T_{max})\}[{\mbox{N}}]) + Nitrate and ammonium reaction terms are given by .. math:: \begin{aligned} - \Delta{\mbox{NO$_3$}}/dt & = & R_{{\mbox{NO$_3$}}} = [{\mbox{NH$_4$}}] k_{nitr}- U^{tot}_{{\mbox{NO$_3$}}} \nonumber \\ - \Delta{\mbox{NH$_4$}}/dt & = & R_{{\mbox{NH$_4$}}} = -[{\mbox{NH$_4$}}] k_{nitr} -U^{tot}_{{\mbox{NH$_4$}}} + - (f_{ng}f_{graze}(1-f_{gs})+f_{res})\mu^{tot} \nonumber \\ - & + & f_{nm} M_{ort} + \frac{\Delta{\mbox{NO$_3$}}}{dt} = R_{{\mbox{NO$_3$}}} & = & [{\mbox{NH$_4$}}] k_{nitr}- U^{tot}_{{\mbox{NO$_3$}}} \nonumber \\ + \frac{\Delta{\mbox{NH$_4$}}}{dt} = R_{{\mbox{NH$_4$}}} & = & -[{\mbox{NH$_4$}}] k_{nitr} -U^{tot}_{{\mbox{NH$_4$}}} + + (f_{ng}f_{graze}(1-f_{gs})+f_{res})\mu^{tot} + f_{nm} M_{ort} \nonumber \\ & = & -[{\mbox{NH$_4$}}]k_{nitr} -U^{tot}_{{\mbox{NH$_4$}}} + N_{remin}\end{aligned} @@ -1055,15 +1066,19 @@ ammonium and :math:`f_{gs}` is the fraction of grazing spilled or lost. Algal growth and nutrient uptake terms are described in more detail in :ref:`growth-uptake`. -Dissolved organic nitrogen satisfies the equation + +Dissolved organic nitrogen depends on the sum of all grazing :math:`graze^{tot}` and mortality :math:`M_{ort}^{tot}` and satisfies the equation .. math:: \begin{aligned} - \Delta {\mbox{DON}}/dt & = & R_{{\mbox{DON}}} = f_{dg}f_{gs}f_{graze}\mu^{tot} - [{\mbox{DON}}]k_{nb}\end{aligned} + \frac{\Delta {\mbox{DON}}}{dt} & = & R_{{\mbox{DON}}} \nonumber \\ + & = & graze^{tot} - graze^{tot}(1-fr_{graze_s})*fr_{graze_e} + M_{ort}^{tot}(1 - fr_{mort2min}) - [{\mbox{DON}}]k_{nb} \\ + & = & DON_{source} - [{\mbox{DON}}]k_{nb} + \end{aligned} With a loss from bacterial degration (rate :math:`k_{nb}`) and a gain -from spilled grazing that does not enter the :math:`{\mbox{NH$_4$}}` +from spilled grazing and mortality that does not enter the :math:`{\mbox{NH$_4$}}` pool. A term Z\ :math:`_{oo}` closes the nitrogen cycle by summing all the @@ -1077,8 +1092,8 @@ cycle at each timestep. .. math:: \begin{aligned} - \mbox{Z}_{oo} & = & [(1-f_{ng}(1-f_{gs}) - f_{dg}f_{gs}]f_{graze}\mu^{tot}dt + (1-f_{nm})M_{ort}dt + - [{\mbox{DON}}]k_{nb}dt \nonumber\end{aligned} + \mbox{Z}_{oo} & = & (1-fr_{graze_e})(1-fr_{graze_s})graze^{tot} + fr_{graze_s} graze^{tot} + M_{ort}^{tot}(1 - fr_{mort2min}) + \nonumber\end{aligned} Dissolved organic carbon may be divided into polysaccharids and lipids. Parameters are two dimensional (indicated by superscript :math:`i`) with @@ -1088,15 +1103,16 @@ lipids. The :math:`{\mbox{DOC}}^i` equation is: .. math:: \begin{aligned} - \Delta {\mbox{DOC}}^i/dt & = & R_{{\mbox{DOC}}} = f^i_{cg}f_{ng}\mu^{tot} + R^i_{c:n}M_{ort}-[{\mbox{DOC}}]k^i_{cb}\end{aligned} - + \frac{\Delta {\mbox{DOC}}^i}{dt} & = & R_{{\mbox{DOC}}} = f^i_{cg}(graze^{tot} + M_{ort}^{tot} - f_{ng}\mu^{tot} - \frac{DON_{source}}{dt}) R^i_{c:n}-[{\mbox{DOC}}]k^i_{cb} \\ + & = & R_{{\mbox{DOC}}} = f^i_{cg}(graze^{tot} + M_{ort}^{tot} - f_{ng}\mu^{tot} - \frac{DON_{source}}{dt}) R^i_{c:n} - \frac{DOC_{loss}}{dt}\end{aligned} + Silicate has no biochemical source terms within the ice and is lost only through algal uptake: .. math:: \begin{aligned} - \Delta {\mbox{SiO$_3$}}/dt & = & R_{{\mbox{SiO$_3$}}} = -U_{{\mbox{SiO$_3$}}}^{tot}\end{aligned} + \frac{\Delta {\mbox{SiO$_3$}}}{dt} & = & R_{{\mbox{SiO$_3$}}} = -U_{{\mbox{SiO$_3$}}}^{tot}\end{aligned} Dissolved iron has algal uptake and remineralization pathways. In addition, :math:`{\mbox{fed}}` may be converted to or released from the @@ -1109,16 +1125,16 @@ and particulate iron is .. math:: \begin{aligned} - \Delta_{fe}{\mbox{fed}}/dt & = & -[{\mbox{fed}}]/\tau_{fe} \nonumber \\ - \Delta_{fe}{\mbox{fep}}/dt & = & [{\mbox{fed}}]/\tau_{fe}\end{aligned} + \frac{\tilde{\Delta} {\mbox{fed}}}{dt} & = & -\frac{[{\mbox{fed}}]}{\tau_{fe}} \nonumber \\ + \frac{\tilde{\Delta} {\mbox{fep}}}{dt} & = & \frac{[{\mbox{fed}}]}{\tau_{fe}}\end{aligned} -For values less than :math:`r^{max}_{fed:doc}` +for values less than :math:`r^{max}_{fed:doc}`. .. math:: \begin{aligned} - \Delta_{fe}{\mbox{fed}}/dt & = & [{\mbox{fep}}]/\tau_{fe} \nonumber \\ - \Delta_{fe}{\mbox{fep}}/dt & = & -[{\mbox{fep}}]/\tau_{fe}\end{aligned} + \frac{\tilde{\Delta} {\mbox{fed}}}{dt} & = & \frac{[{\mbox{fep}}]}{\tau_{fe}} \nonumber \\ + \frac{\tilde{\Delta} {\mbox{fep}}}{dt} & = & -\frac{[{\mbox{fep}}]}{\tau_{fe}}\end{aligned} Very long timescales :math:`\tau_{fe}` will remove this source/sink term. The default value is currently set at 3065 days to turn off this @@ -1131,8 +1147,8 @@ remineralization is .. math:: \begin{aligned} - \Delta {\mbox{fed}}/dt & = & R_{{\mbox{fed}}} = -U^{tot}_{{\mbox{fed}}} + f_{fa}R_{fe:n}N_{remin} - + \Delta_{fe}{\mbox{fed}}/dt\end{aligned} + \frac{\Delta {\mbox{fed}}}{dt} & = & R_{{\mbox{fed}}} = -U^{tot}_{{\mbox{fed}}} + f_{fa}R_{fe:n}N_{remin} + + \frac{\tilde{\Delta}{\mbox{fed}}}{dt}\end{aligned} Particulate iron also includes a source term from algal mortality and grazing that is not immediately bioavailable. The full equation for @@ -1141,8 +1157,8 @@ grazing that is not immediately bioavailable. The full equation for .. math:: \begin{aligned} - \Delta {\mbox{fep}}/dt & = & R_{{\mbox{fep}}} = R_{fe:n}[\mbox{Z}_{oo}/dt + (1-f_{fa})]N_{remin} - + \Delta_{fe}{\mbox{fep}}/dt\end{aligned} + \frac{\Delta {\mbox{fep}}}{dt} & = & R_{{\mbox{fep}}} = R_{fe:n}[\frac{\mbox{Z}_{oo}}{dt} + (1-f_{fa})]N_{remin} + + \frac{\tilde{\Delta}{\mbox{fep}}}{dt}\end{aligned} The sulfur cycle includes :math:`{\mbox{DMS}}` and dissolved DMSP (:math:`{\mbox{DMSPd}}`). Particulate DMSP is assumed to be proportional @@ -1153,9 +1169,21 @@ to the algal concentration, i.e. .. math:: \begin{aligned} - \Delta {\mbox{DMSPd}}/dt & = & R_{{\mbox{DMSPd}}} = R_{s:n}[ f_{sr}f_{res}\mu^{tot} - +f_{nm}M_{ort} ] - [{\mbox{DMSPd}}]/\tau_{dmsp} \nonumber \\ - \Delta {\mbox{DMS}}/dt & = & R_{{\mbox{DMS}}} = y_{dms}[{\mbox{DMSPd}}]/\tau_{dmsp} - [{\mbox{DMS}}]/\tau_{dms}\end{aligned} + \frac{\Delta {\mbox{DMSPd}}}{dt} & = & R_{{\mbox{DMSPd}}} = R_{s:n}[ f_{sr}f_{res}\mu^{tot} + +f_{nm}M_{ort} ] - \frac{[{\mbox{DMSPd}}]}{\tau_{dmsp}} \nonumber \\ + \frac{\Delta {\mbox{DMS}}}{dt} & = & R_{{\mbox{DMS}}} = y_{dms}\frac{[{\mbox{DMSPd}}]}{\tau_{dmsp}} - \frac{[{\mbox{DMS}}]}{\tau_{dms}}\end{aligned} + +The dissolved inorganic carbon tracer, :math:`{\mbox{DIC}}`, currently serves to conserve carbon in sea ice. There is no alkalinity tracer nor precipitated forms of carbonate that would be needed for solving the carbonate chemistry. In addition, :math:`{\mbox{DIC}}` never limits photosynthesis in this formulation and carbon to nitrogen ratios for each algal species are fixed at run-time. In the event that :math:`{\mbox{DIC}}` algal requirements exceed the available in situ concentration at a given timestep, the demand is met by an assumed ocean flux into the sea ice. :math:`{\mbox{DIC}}` reactive sources are equivalent to the remineralized losses of :math:`{\mbox{DON}}_{loss} = [{\mbox{DON}}] k_{nb}` and :math:`{\mbox{DOC}}^{tot}_{loss} = \sum^{i} [{\mbox{DOC}}]_i (k_{bac})_i` + +The :math:`{\mbox{DIC}}` reaction equation is + +.. math:: + + \begin{aligned} + \frac{\Delta {\mbox{DIC}}}{dt} & = & R_{{\mbox{DIC}}} = {\mbox{DON}}_{loss} * R_{C2N:DON} + {\mbox{DOC}}^{tot}_{loss}-\sum^{algae} [(1-fr_{resp})*grow_{N} * R_{C:N}]\end{aligned} + +where the summation is over all algal groups, :math:`R_{C:N}` is the carbon to nitrogen ratio of each algal group :math:`{\mbox{N}}`, and :math:`R_{C2N:DON}` is the carbon to nitrogen ratio of :math:`{\mbox{DON}}`. + See :ref:`tuning` for a more complete list and description of biogeochemical parameters. @@ -1180,13 +1208,12 @@ limitation terms may also be found for :math:`{\mbox{NH$_4$}}`, Light limitation :math:`L_{lim}` is defined in the following way: :math:`I _{sw}(z)` (in :math:`W/m^2`) is the shortwave radiation at the ice level -and the optical depth is proportional to the chlorophyll concentration, -:math:`op_{dep} =` ``chlabs`` [Chl*a*]. If ( :math:`op_{dep} > op_{min}`) then +and the optical depth :math:`op_{dep}` is proportional to the chlorophyll concentration. If ( :math:`op_{dep} > op_{min}`) then .. math:: - I_{avg} = I_{sw}(1- \exp(-op_{dep}))/op_{dep} + I_{avg} = I_{sw}\frac{(1- \exp(-op_{dep}))}{op_{dep}} -otherwise :math:`I_{avg} = I_{sw}`. +otherwise :math:`I_{avg} = I_{sw}`. Then, .. math:: L_{lim} = (1 - \exp(-\alpha I_{avg}))\exp(-\beta I_{avg}) @@ -1196,7 +1223,7 @@ The maximal algal growth rate before limitation is .. math:: \begin{aligned} \mu_o & = & \mu_{max}\exp(\mu_T\Delta T)f_{sal}[{\mbox{N}}] \\ - \mu' & = & min(L_{lim},N_{lim},{\mbox{SiO$_3$}}_{lim},{\mbox{fed}}_{lim}) \mu_o\end{aligned} + \mu' & = & min(L_{lim},\ N_{lim},\ {\mbox{SiO$_3$}}_{lim},\ {\mbox{fed}}_{lim}) \mu_o\end{aligned} where :math:`\mu'` is the initial estimate of algal growth rate for a given algal species and :math:`\Delta T` is the difference between the @@ -1241,8 +1268,13 @@ uptake is .. math:: \begin{aligned} - fU^i_{{\mbox{NO$_3$}}} & = & \frac{\tilde{U}^i_{{\mbox{NO$_3$}}}}{\tilde{U}^{tot}_{{\mbox{NO$_3$}}}} \nonumber \\ - U^{tot}_{{\mbox{NO$_3$}}} & = & \min(\tilde{U}^{tot}_{{\mbox{NO$_3$}}}, l_{max}[{\mbox{NO$_3$}}]/dt)\end{aligned} + fU^i_{{\mbox{NO$_3$}}} & = & \frac{\tilde{U}^i_{{\mbox{NO$_3$}}}}{\tilde{U}^{tot}_{{\mbox{NO$_3$}}}},\end{aligned} + +and the true total update is + +.. math:: + \begin{aligned} + U^{tot}_{{\mbox{NO$_3$}}} & = & \min(\tilde{U}^{tot}_{{\mbox{NO$_3$}}}, l_{max}[{\mbox{NO$_3$}}]/dt) .\end{aligned} Now, for each algal species the nitrate uptake is @@ -1254,7 +1286,7 @@ Then the true growth rate for each algal species :math:`i` is .. math:: \begin{aligned} - \mu^i & = & \min(U^i_{{\mbox{SiO$_3$}}}/R_{si:n}, U^i_{{\mbox{NO$_3$}}} + U^i_{{\mbox{NH$_4$}}}, U^i_{{\mbox{fed}}}/R_{fe:n})\end{aligned} + \mu^i & = & \min(R_{si:n}^{-1}U^i_{{\mbox{SiO$_3$}}}, U^i_{{\mbox{NO$_3$}}} + U^i_{{\mbox{NH$_4$}}}, R_{fe:n}^{-1}U^i_{{\mbox{fed}}})\end{aligned} Preferential ammonium uptake is assumed once again and the remaining nitrogen is taken from the nitrate pool. diff --git a/doc/source/science_guide/sg_boundary_forcing.rst b/doc/source/science_guide/sg_boundary_forcing.rst index c7715228d..ce4f10e07 100755 --- a/doc/source/science_guide/sg_boundary_forcing.rst +++ b/doc/source/science_guide/sg_boundary_forcing.rst @@ -318,7 +318,7 @@ the ocean. If the resulting sea surface temperature falls below the salinity-dependent freezing point, then new ice (frazil) forms. Otherwise, heat is made available for melting the ice. -The ice-ocean drag coefficient, :math:`c_w`, can optionally be computed from the thickness of the first ocean level, :math:`h_1`, and an under-ice roughness length, :math:`z_{io}`. +When the namelist option ``calc_dragio`` is set to true, the ice-ocean drag coefficient, :math:`c_w` (``dragio``), is computed from the thickness of the first ocean level, :math:`h_1` (``thickness_ocn_layer1``), and an under-ice roughness length, :math:`z_{io}` (``iceruf_ocn``). The computation follows :cite:`Roy15` : .. math:: diff --git a/doc/source/science_guide/sg_thermo.rst b/doc/source/science_guide/sg_thermo.rst index d12b90cfe..1577a7e5e 100755 --- a/doc/source/science_guide/sg_thermo.rst +++ b/doc/source/science_guide/sg_thermo.rst @@ -1737,9 +1737,21 @@ conductive heat flux at the bottom surface: If ice is melting at the bottom surface, :math:`q` in Equation :eq:`bottom-melting` is the enthalpy of the bottom ice layer. If -ice is growing, :math:`q` is the enthalpy of new ice with temperature -:math:`T_f` and salinity :math:`S_{max}` (``ktherm`` = 1) or ocean surface -salinity (``ktherm`` = 2). This ice is added to the bottom layer. +ice is growing, :math:`q` is the enthalpy of new ice added to the bottom layer with +temperature :math:`T_f` and salinity :math:`S_{max}` (``ktherm`` = 1) for the Bitz99 +:cite:`Bitz99` formulation. The original mushy thermodynamics +(``ktherm`` = 2, ``congel_freeze`` = 'two-step') formed new ice in two steps, first +moving the lower ice boundary into the ocean to form a mushy layer with an initial +liquid fraction :math:`phi_{init}`, then freezing the new ice in the next step. In +this case, the freezing temperature is calculated using the ocean surface salinity +:math:`SSS`. A second mushy thermo method +(``ktherm`` = 2, ``congel_freeze`` = 'one-step') freezes the ice immediately using +the brine salinity :math:`phi_{init} * SSS` :cite:`Plante24`. +In the two-step method, enthalpy not +yet used to freeze the ice is returned to the ocean, causing frazil ice to form +instead. Together, the congelation and frazil ice add up to a similar total amount +of new ice, but the differing freezing mechanism complicates comparisons with observational +data and there is an unnecessary lag in ice-ocean coupling. In general, frazil ice formed in the ocean is added to the thinnest ice category. The new ice is grown in the open water area of the grid cell diff --git a/doc/source/user_guide/interfaces.include b/doc/source/user_guide/interfaces.include index e4bbb7d37..b28eff1a7 100644 --- a/doc/source/user_guide/interfaces.include +++ b/doc/source/user_guide/interfaces.include @@ -81,26 +81,22 @@ icepack_init_hbrine ! Initialize brine height tracer - subroutine icepack_init_hbrine(bgrid, igrid, cgrid, & - icgrid, swgrid, nblyr, nilyr, phi_snow) + subroutine icepack_init_hbrine(bgrid_out, igrid_out, cgrid_out, & + icgrid_out, swgrid_out, phi_snow) - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nblyr ! number of bio layers - - real (kind=dbl_kind), intent(inout) :: & + real (kind=dbl_kind), optional, intent(inout) :: & phi_snow ! porosity at the ice-snow interface - real (kind=dbl_kind), dimension (nblyr+2), intent(out) :: & - bgrid ! biology nondimensional vertical grid points + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + bgrid_out ! biology nondimensional vertical grid points - real (kind=dbl_kind), dimension (nblyr+1), intent(out) :: & - igrid ! biology vertical interface points + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + igrid_out ! biology vertical interface points - real (kind=dbl_kind), dimension (nilyr+1), intent(out) :: & - cgrid , & ! CICE vertical coordinate - icgrid , & ! interface grid for CICE (shortwave variable) - swgrid ! grid for ice tracers used in dEdd scheme + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + cgrid_out , & ! CICE vertical coordinate + icgrid_out , & ! interface grid for CICE (shortwave variable) + swgrid_out ! grid for ice tracers used in dEdd scheme @@ -113,14 +109,8 @@ icepack_init_zsalinity ! **DEPRECATED**, all code removed ! Interface provided for backwards compatibility - subroutine icepack_init_zsalinity(nblyr,ntrcr_o, Rayleigh_criteria, & - Rayleigh_real, trcrn_bgc, nt_bgc_S, ncat, sss) - - integer (kind=int_kind), intent(in) :: & - nblyr , & ! number of biolayers - ntrcr_o, & ! number of non bio tracers - ncat , & ! number of categories - nt_bgc_S ! zsalinity index + subroutine icepack_init_zsalinity(Rayleigh_criteria, & + Rayleigh_real, trcrn_bgc, sss) logical (kind=log_kind), intent(inout) :: & Rayleigh_criteria @@ -151,26 +141,23 @@ icepack_init_fsd_bounds ! ! authors: Lettie Roach, NIWA/VUW and C. M. Bitz, UW - subroutine icepack_init_fsd_bounds(nfsd, & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth, & ! fsd size bin width in m (radius) - c_fsd_range, & ! string for history output - write_diags ) ! flag for writing diagnostics - - integer (kind=int_kind), intent(in) :: & - nfsd ! number of floe size categories + subroutine icepack_init_fsd_bounds( & + floe_rad_l_out, & ! fsd size lower bound in m (radius) + floe_rad_c_out, & ! fsd size bin centre in m (radius) + floe_binwidth_out, & ! fsd size bin width in m (radius) + c_fsd_range_out, & ! string for history output + write_diags) ! flag for writing diagnostics - real(kind=dbl_kind), dimension(:), intent(inout) :: & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) + real(kind=dbl_kind), dimension(:), intent(out), optional :: & + floe_rad_l_out, & ! fsd size lower bound in m (radius) + floe_rad_c_out, & ! fsd size bin centre in m (radius) + floe_binwidth_out ! fsd size bin width in m (radius) - character (len=35), intent(out) :: & - c_fsd_range(nfsd) ! string for history output + character (len=35), dimension(:), intent(out), optional :: & + c_fsd_range_out ! string for history output logical (kind=log_kind), intent(in), optional :: & - write_diags ! write diags flag + write_diags ! write diags flag @@ -185,21 +172,11 @@ icepack_init_fsd ! ! authors: Lettie Roach, NIWA/VUW - subroutine icepack_init_fsd(nfsd, ice_ic, & - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth, & ! fsd size bin width in m (radius) - afsd) ! floe size distribution tracer - - integer(kind=int_kind), intent(in) :: & - nfsd + subroutine icepack_init_fsd(ice_ic, afsd) ! floe size distribution tracer character(len=char_len_long), intent(in) :: & ice_ic ! method of ice cover initialization - real(kind=dbl_kind), dimension(:), intent(inout) :: & - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) - real (kind=dbl_kind), dimension (:), intent(inout) :: & afsd ! floe size tracer: fraction distribution of floes @@ -216,11 +193,7 @@ icepack_cleanup_fsd ! ! authors: Elizabeth Hunke, LANL ! - subroutine icepack_cleanup_fsd (ncat, nfsd, afsdn) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nfsd ! number of floe size categories + subroutine icepack_cleanup_fsd (afsdn) real (kind=dbl_kind), dimension(:,:), intent(inout) :: & afsdn ! floe size distribution tracer @@ -326,9 +299,12 @@ icepack_intfc.F90 use icepack_therm_shared , only: icepack_snow_temperature use icepack_therm_shared , only: icepack_liquidus_temperature use icepack_therm_shared , only: icepack_sea_freezing_temperature - use icepack_therm_shared , only: icepack_init_thermo + use icepack_therm_shared , only: icepack_init_salinity use icepack_therm_shared , only: icepack_salinity_profile - use icepack_therm_shared , only: icepack_init_trcr + use icepack_therm_shared , only: icepack_init_enthalpy + ! for backwards compatibilty, remove in the future + use icepack_therm_shared , only: icepack_init_thermo => icepack_init_salinity + use icepack_therm_shared , only: icepack_init_trcr => icepack_init_enthalpy use icepack_mushy_physics , only: icepack_enthalpy_snow use icepack_mushy_physics , only: icepack_enthalpy_mush @@ -358,10 +334,7 @@ icepack_init_itd ! authors: William H. Lipscomb and Elizabeth C. Hunke, LANL ! C. M. Bitz, UW - subroutine icepack_init_itd(ncat, hin_max) - - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories + subroutine icepack_init_itd(hin_max) real (kind=dbl_kind), intent(out) :: & hin_max(0:ncat) ! category limits (m) @@ -379,10 +352,7 @@ icepack_init_itd_hist ! authors: William H. Lipscomb and Elizabeth C. Hunke, LANL ! C. M. Bitz, UW - subroutine icepack_init_itd_hist (ncat, hin_max, c_hi_range) - - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories + subroutine icepack_init_itd_hist (hin_max, c_hi_range) real (kind=dbl_kind), intent(in) :: & hin_max(0:ncat) ! category limits (m) @@ -403,22 +373,16 @@ icepack_aggregate ! authors: C. M. Bitz, UW ! W. H. Lipscomb, LANL - subroutine icepack_aggregate (ncat, & - aicen, trcrn, & + subroutine icepack_aggregate(aicen, trcrn, & vicen, vsnon, & aice, trcr, & vice, vsno, & aice0, & - ntrcr, & trcr_depend, & trcr_base, & n_trcr_strata, & nt_strata, Tf) - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - ntrcr ! number of tracers in use - real (kind=dbl_kind), dimension (:), intent(in) :: & aicen , & ! concentration of ice vicen , & ! volume per unit area of ice (m) @@ -475,15 +439,11 @@ icepack_ice_strength ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_ice_strength (ncat, & - aice, vice, & + subroutine icepack_ice_strength(aice, vice, & aice0, aicen, & vicen, & strength) - integer (kind=int_kind), intent(in) :: & - ncat ! number of thickness categories - real (kind=dbl_kind), intent(in) :: & aice , & ! concentration of ice vice , & ! volume per unit area of ice (m) @@ -509,10 +469,8 @@ icepack_step_ridge ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_step_ridge (dt, ndtd, & - nilyr, nslyr, & - nblyr, & - ncat, hin_max, & + subroutine icepack_step_ridge(dt, ndtd, & + hin_max, & rdg_conv, rdg_shear, & aicen, & trcrn, & @@ -524,7 +482,6 @@ icepack_step_ridge dvirdgdt, opening, & fpond, & fresh, fhocn, & - n_aero, & faero_ocn, fiso_ocn, & aparticn, krdgn, & aredistn, vredistn, & @@ -533,7 +490,9 @@ icepack_step_ridge araftn, vraftn, & aice, fsalt, & first_ice, fzsal, & - flux_bio, closing, Tf ) + flux_bio, closing, & + Tf, & + docleanup, dorebin) real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -542,12 +501,7 @@ icepack_step_ridge Tf ! freezing temperature integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - ndtd , & ! number of dynamics supercycles - nblyr , & ! number of bio layers - nilyr , & ! number of ice layers - nslyr , & ! number of snow layers - n_aero ! number of aerosol tracers + ndtd ! number of dynamics supercycles real (kind=dbl_kind), dimension(0:ncat), intent(inout) :: & hin_max ! category limits (m) @@ -613,6 +567,10 @@ icepack_step_ridge logical (kind=log_kind), dimension(:), intent(inout) :: & first_ice ! true until ice forms + logical (kind=log_kind), intent(in), optional :: & + docleanup, & ! if false, do not call cleanup_itd (default true) + dorebin ! if false, do not call rebin in cleanup_itd (default true) + icepack_mushy_physics.F90 @@ -844,7 +802,7 @@ icepack_init_parameters rhos_in, rhoi_in, rhow_in, cp_air_in, emissivity_in, & cp_ice_in, cp_ocn_in, hfrazilmin_in, floediam_in, & depressT_in, dragio_in, thickness_ocn_layer1_in, iceruf_ocn_in, & - albocn_in, gravit_in, viscosity_dyn_in, & + albocn_in, gravit_in, viscosity_dyn_in, tscale_pnd_drain_in, & Tocnfrz_in, rhofresh_in, zvir_in, vonkar_in, cp_wv_in, & stefan_boltzmann_in, ice_ref_salinity_in, & Tffresh_in, Lsub_in, Lvap_in, Timelt_in, Tsmelt_in, & @@ -853,7 +811,7 @@ icepack_init_parameters zref_in, hs_min_in, snowpatch_in, rhosi_in, sk_l_in, & saltmax_in, phi_init_in, min_salin_in, salt_loss_in, & Tliquidus_max_in, & - min_bgc_in, dSin0_frazil_in, hi_ssl_in, hs_ssl_in, & + min_bgc_in, dSin0_frazil_in, hi_ssl_in, hs_ssl_in, hs_ssl_min_in, & awtvdr_in, awtidr_in, awtvdf_in, awtidf_in, & qqqice_in, TTTice_in, qqqocn_in, TTTocn_in, & ktherm_in, conduct_in, fbot_xfer_type_in, calc_Tsfc_in, dts_b_in, & @@ -864,17 +822,18 @@ icepack_init_parameters phi_i_mushy_in, shortwave_in, albedo_type_in, albsnowi_in, & albicev_in, albicei_in, albsnowv_in, & ahmax_in, R_ice_in, R_pnd_in, R_snw_in, dT_mlt_in, rsnw_mlt_in, & - kalg_in, kstrength_in, krdg_partic_in, krdg_redist_in, mu_rdg_in, & + kalg_in, R_gC2molC_in, kstrength_in, krdg_partic_in, krdg_redist_in, mu_rdg_in, & atmbndy_in, calc_strair_in, formdrag_in, highfreq_in, natmiter_in, & atmiter_conv_in, calc_dragio_in, & tfrz_option_in, kitd_in, kcatbound_in, hs0_in, frzpnd_in, & - saltflux_option_in, & + saltflux_option_in, congel_freeze_in, & floeshape_in, wave_spec_in, wave_spec_type_in, nfreq_in, & dpscale_in, rfracmin_in, rfracmax_in, pndaspect_in, hs1_in, hp1_in, & bgc_flux_type_in, z_tracers_in, scale_bgc_in, solve_zbgc_in, & - modal_aero_in, skl_bgc_in, solve_zsal_in, grid_o_in, l_sk_in, & + modal_aero_in, use_macromolecules_in, restartbgc_in, skl_bgc_in, & + solve_zsal_in, grid_o_in, l_sk_in, & initbio_frac_in, grid_oS_in, l_skS_in, dEdd_algae_in, & - phi_snow_in, T_max_in, fsal_in, & + phi_snow_in, T_max_in, fsal_in, use_atm_dust_iron_in, & fr_resp_in, algal_vel_in, R_dFe2dust_in, dustFe_sol_in, & op_dep_min_in, fr_graze_s_in, fr_graze_e_in, fr_mort2min_in, & fr_dFe_in, k_nitrif_in, t_iron_conv_in, max_loss_in, & @@ -886,7 +845,38 @@ icepack_init_parameters snwlvlfac_in, isnw_T_in, isnw_Tgrd_in, isnw_rhos_in, & snowage_rhos_in, snowage_Tgrd_in, snowage_T_in, & snowage_tau_in, snowage_kappa_in, snowage_drdt0_in, & - snw_aging_table_in, snw_ssp_table_in ) + snw_aging_table_in, snw_ssp_table_in, grid_o_t_in, tau_min_in, tau_max_in, & + f_don_protein_in, kn_bac_protein_in, f_don_Am_protein_in, & + ratio_Si2N_diatoms_in, & + ratio_Si2N_sp_in, ratio_Si2N_phaeo_in, ratio_S2N_diatoms_in, & + ratio_S2N_sp_in, ratio_S2N_phaeo_in, ratio_Fe2C_diatoms_in, & + ratio_Fe2C_sp_in, ratio_Fe2C_phaeo_in, ratio_Fe2N_diatoms_in, & + ratio_Fe2N_sp_in, ratio_Fe2N_phaeo_in, ratio_Fe2DON_in, & + ratio_Fe2DOC_s_in, ratio_Fe2DOC_l_in, & + chlabs_diatoms_in, chlabs_sp_in, chlabs_phaeo_in, alpha2max_low_diatoms_in, & + alpha2max_low_sp_in, alpha2max_low_phaeo_in, beta2max_diatoms_in, & + beta2max_sp_in, beta2max_phaeo_in, mu_max_diatoms_in, mu_max_sp_in, & + mu_max_phaeo_in, grow_Tdep_diatoms_in, grow_Tdep_sp_in, & + grow_Tdep_phaeo_in, fr_graze_diatoms_in, fr_graze_sp_in, & + fr_graze_phaeo_in, mort_pre_diatoms_in, mort_pre_sp_in, & + mort_pre_phaeo_in, mort_Tdep_diatoms_in, mort_Tdep_sp_in, & + mort_Tdep_phaeo_in, k_exude_diatoms_in, k_exude_sp_in, k_exude_phaeo_in, & + K_Nit_diatoms_in, K_Nit_sp_in, K_Nit_phaeo_in, & + K_Am_diatoms_in, K_Am_sp_in, K_Am_phaeo_in, & + K_Sil_diatoms_in, K_Sil_sp_in, K_Sil_phaeo_in, & + K_Fe_diatoms_in, K_Fe_sp_in, K_Fe_phaeo_in, & + f_doc_s_in, f_doc_l_in, f_exude_s_in, f_exude_l_in, & + k_bac_s_in, k_bac_l_in, algaltype_diatoms_in, & + algaltype_sp_in, algaltype_phaeo_in, nitratetype_in, & + ammoniumtype_in, silicatetype_in, dmspptype_in, & + dmspdtype_in, humtype_in, doctype_s_in, doctype_l_in, & + dictype_1_in, dontype_protein_in, fedtype_1_in, feptype_1_in, & + zaerotype_bc1_in, zaerotype_bc2_in, zaerotype_dust1_in, & + zaerotype_dust2_in, zaerotype_dust3_in, zaerotype_dust4_in, & + ratio_C2N_diatoms_in, ratio_C2N_sp_in, ratio_C2N_phaeo_in, & + ratio_chl2N_diatoms_in, ratio_chl2N_sp_in, ratio_chl2N_phaeo_in, & + F_abs_chl_diatoms_in, F_abs_chl_sp_in, F_abs_chl_phaeo_in, & + ratio_C2N_proteins_in ) !----------------------------------------------------------------- ! control settings @@ -927,6 +917,7 @@ icepack_init_parameters cp_ocn_in, & ! specific heat of ocn (J/kg/K) depressT_in, & ! Tf:brine salinity ratio (C/ppt) viscosity_dyn_in, & ! dynamic viscosity of brine (kg/m/s) + tscale_pnd_drain_in,&! mushy macroscopic drainage timescale (days) Tocnfrz_in, & ! freezing temp of seawater (C) Tffresh_in, & ! freezing temp of fresh ice (K) Lsub_in, & ! latent heat, sublimation freshwater (J/kg) @@ -977,15 +968,20 @@ icepack_init_parameters phi_i_mushy_in ! liquid fraction of congelation ice character(len=*), intent(in), optional :: & - tfrz_option_in ! form of ocean freezing temperature - ! 'minus1p8' = -1.8 C - ! 'linear_salt' = -depressT * sss - ! 'mushy' conforms with ktherm=2 + congel_freeze_in ! congelation computation + ! 'two-step' = original formulation + ! 'one-step' = Plante et al, The Cryosphere, 2024 + + character(len=*), intent(in), optional :: & + tfrz_option_in ! form of ocean freezing temperature + ! 'minus1p8' = -1.8 C + ! 'linear_salt' = -depressT * sss + ! 'mushy' conforms with ktherm=2 character(len=*), intent(in), optional :: & - saltflux_option_in ! Salt flux computation - ! 'constant' reference value of ice_ref_salinity - ! 'prognostic' prognostic salt flux + saltflux_option_in ! Salt flux computation + ! 'constant' reference value of ice_ref_salinity + ! 'prognostic' prognostic salt flux !----------------------------------------------------------------------- ! Parameters for radiation @@ -998,7 +994,8 @@ icepack_init_parameters stefan_boltzmann_in, & ! W/m^2/K^4 kappav_in, & ! vis extnctn coef in ice, wvlngth<700nm (1/m) hi_ssl_in, & ! ice surface scattering layer thickness (m) - hs_ssl_in, & ! visible, direct + hs_ssl_in, & ! snow surface scattering layer thickness (m) + hs_ssl_min_in, & ! minimum snow surface scattering layer thickness for aerosols (m) awtvdr_in, & ! visible, direct ! for history and awtidr_in, & ! near IR, direct ! diagnostics awtvdf_in, & ! visible, diffuse @@ -1025,7 +1022,8 @@ icepack_init_parameters dT_mlt_in , & ! change in temp for non-melt to melt snow grain ! radius change (C) rsnw_mlt_in , & ! maximum melting snow grain radius (10^-6 m) - kalg_in ! algae absorption coefficient for 0.5 m thick layer + kalg_in , & ! algae absorption coefficient for 0.5 m thick layer + R_gC2molC_in ! g carbon per mol logical (kind=log_kind), intent(in), optional :: & sw_redist_in ! redistribute shortwave @@ -1112,7 +1110,7 @@ icepack_init_parameters nfreq_in ! number of frequencies real (kind=dbl_kind), intent(in), optional :: & - floeshape_in ! constant from Steele (unitless) + floeshape_in ! constant from Rothrock 1984 (unitless) logical (kind=log_kind), intent(in), optional :: & wave_spec_in ! if true, use wave forcing @@ -1134,6 +1132,10 @@ icepack_init_parameters solve_zbgc_in, & ! if .true., solve vertical biochemistry portion of code dEdd_algae_in, & ! if .true., algal absorptionof Shortwave is computed in the modal_aero_in, & ! if .true., use modal aerosol formulation in shortwave + use_macromolecules_in, & ! if .true., ocean DOC is already split into + ! polysaccharid, lipid and protein fractions + use_atm_dust_iron_in, & ! if .true., compute iron contribution from dust + restartbgc_in, & conserv_check_in ! if .true., run conservation checks and abort if checks fail logical (kind=log_kind), intent(in), optional :: & @@ -1143,12 +1145,112 @@ icepack_init_parameters real (kind=dbl_kind), intent(in), optional :: & grid_o_in , & ! for bottom flux l_sk_in , & ! characteristic diffusive scale (zsalinity) (m) + grid_o_t_in , & ! top grid point length scale initbio_frac_in, & ! fraction of ocean tracer concentration used to initialize tracer phi_snow_in ! snow porosity at the ice/snow interface real (kind=dbl_kind), intent(in), optional :: & grid_oS_in , & ! for bottom flux (zsalinity) l_skS_in ! 0.02 characteristic skeletal layer thickness (m) (zsalinity) + + real (kind=dbl_kind), intent(in), optional :: & + ratio_Si2N_diatoms_in, & ! algal Si to N (mol/mol) + ratio_Si2N_sp_in , & + ratio_Si2N_phaeo_in , & + ratio_S2N_diatoms_in , & ! algal S to N (mol/mol) + ratio_S2N_sp_in , & + ratio_S2N_phaeo_in , & + ratio_Fe2C_diatoms_in, & ! algal Fe to C (umol/mol) + ratio_Fe2C_sp_in , & + ratio_Fe2C_phaeo_in , & + ratio_Fe2N_diatoms_in, & ! algal Fe to N (umol/mol) + ratio_Fe2N_sp_in , & + ratio_Fe2N_phaeo_in , & + ratio_Fe2DON_in , & ! Fe to N of DON (nmol/umol) + ratio_Fe2DOC_s_in , & ! Fe to C of DOC (nmol/umol) saccharids + ratio_Fe2DOC_l_in , & ! Fe to C of DOC (nmol/umol) lipids + tau_min_in , & ! rapid mobile to stationary exchanges (s) = 1.5 hours + tau_max_in , & ! long time mobile to stationary exchanges (s) = 2 days + chlabs_diatoms_in , & ! chl absorption (1/m/(mg/m^3)) + chlabs_sp_in , & ! + chlabs_phaeo_in , & ! + alpha2max_low_diatoms_in , & ! light limitation (1/(W/m^2)) + alpha2max_low_sp_in , & + alpha2max_low_phaeo_in , & + beta2max_diatoms_in , & ! light inhibition (1/(W/m^2)) + beta2max_sp_in , & + beta2max_phaeo_in , & + mu_max_diatoms_in , & ! maximum growth rate (1/day) + mu_max_sp_in , & + mu_max_phaeo_in , & + grow_Tdep_diatoms_in, & ! Temperature dependence of growth (1/C) + grow_Tdep_sp_in , & + grow_Tdep_phaeo_in , & + fr_graze_diatoms_in , & ! Fraction grazed + fr_graze_sp_in , & + fr_graze_phaeo_in , & + mort_pre_diatoms_in , & ! Mortality (1/day) + mort_pre_sp_in , & + mort_pre_phaeo_in , & + mort_Tdep_diatoms_in, & ! T dependence of mortality (1/C) + mort_Tdep_sp_in , & + mort_Tdep_phaeo_in , & + k_exude_diatoms_in , & ! algal exudation (1/d) + k_exude_sp_in , & + k_exude_phaeo_in , & + K_Nit_diatoms_in , & ! nitrate half saturation (mmol/m^3) + K_Nit_sp_in , & + K_Nit_phaeo_in , & + K_Am_diatoms_in , & ! ammonium half saturation (mmol/m^3) + K_Am_sp_in , & + K_Am_phaeo_in , & + K_Sil_diatoms_in , & ! silicate half saturation (mmol/m^3) + K_Sil_sp_in , & + K_Sil_phaeo_in , & + K_Fe_diatoms_in , & ! iron half saturation (nM) + K_Fe_sp_in , & + K_Fe_phaeo_in , & + f_don_protein_in , & ! fraction of spilled grazing to proteins + kn_bac_protein_in , & ! Bacterial degredation of DON (1/d) + f_don_Am_protein_in , & ! fraction of remineralized DON to ammonium + f_doc_s_in , & ! fraction of mortality to DOC + f_doc_l_in , & + f_exude_s_in , & ! fraction of exudation to DOC + f_exude_l_in , & + k_bac_s_in , & ! Bacterial degredation of DOC (1/d) + k_bac_l_in , & + algaltype_diatoms_in , & ! mobility type + algaltype_sp_in , & ! + algaltype_phaeo_in , & ! + nitratetype_in , & ! + ammoniumtype_in , & ! + silicatetype_in , & ! + dmspptype_in , & ! + dmspdtype_in , & ! + humtype_in , & ! + doctype_s_in , & ! + doctype_l_in , & ! + dictype_1_in , & ! + dontype_protein_in , & ! + fedtype_1_in , & ! + feptype_1_in , & ! + zaerotype_bc1_in , & ! + zaerotype_bc2_in , & ! + zaerotype_dust1_in , & ! + zaerotype_dust2_in , & ! + zaerotype_dust3_in , & ! + zaerotype_dust4_in , & ! + ratio_C2N_diatoms_in , & ! algal C to N ratio (mol/mol) + ratio_C2N_sp_in , & ! + ratio_C2N_phaeo_in , & ! + ratio_chl2N_diatoms_in, & ! algal chlorophyll to N ratio (mg/mmol) + ratio_chl2N_sp_in , & ! + ratio_chl2N_phaeo_in , & ! + F_abs_chl_diatoms_in , & ! scales absorbed radiation for dEdd + F_abs_chl_sp_in , & ! + F_abs_chl_phaeo_in , & ! + ratio_C2N_proteins_in ! ratio of C to N in proteins (mol/mol) + real (kind=dbl_kind), intent(in), optional :: & fr_resp_in , & ! fraction of algal growth lost due to respiration algal_vel_in , & ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day @@ -1258,7 +1360,8 @@ icepack_query_parameters p333_out, p666_out, spval_const_out, pih_out, piq_out, pi2_out, & rhos_out, rhoi_out, rhow_out, cp_air_out, emissivity_out, & cp_ice_out, cp_ocn_out, hfrazilmin_out, floediam_out, & - depressT_out, dragio_out, thickness_ocn_layer1_out, iceruf_ocn_out, albocn_out, gravit_out, viscosity_dyn_out, & + depressT_out, dragio_out, thickness_ocn_layer1_out, iceruf_ocn_out, & + albocn_out, gravit_out, viscosity_dyn_out, tscale_pnd_drain_out, & Tocnfrz_out, rhofresh_out, zvir_out, vonkar_out, cp_wv_out, & stefan_boltzmann_out, ice_ref_salinity_out, & Tffresh_out, Lsub_out, Lvap_out, Timelt_out, Tsmelt_out, & @@ -1267,7 +1370,7 @@ icepack_query_parameters zref_out, hs_min_out, snowpatch_out, rhosi_out, sk_l_out, & saltmax_out, phi_init_out, min_salin_out, salt_loss_out, & Tliquidus_max_out, & - min_bgc_out, dSin0_frazil_out, hi_ssl_out, hs_ssl_out, & + min_bgc_out, dSin0_frazil_out, hi_ssl_out, hs_ssl_out, hs_ssl_min_out, & awtvdr_out, awtidr_out, awtvdf_out, awtidf_out, cpl_frazil_out, & qqqice_out, TTTice_out, qqqocn_out, TTTocn_out, update_ocn_f_out, & Lfresh_out, cprho_out, Cp_out, ustar_min_out, hi_min_out, a_rapid_mode_out, & @@ -1277,15 +1380,16 @@ icepack_query_parameters albedo_type_out, albicev_out, albicei_out, albsnowv_out, & albsnowi_out, ahmax_out, R_ice_out, R_pnd_out, R_snw_out, dT_mlt_out, & rsnw_mlt_out, dEdd_algae_out, & - kalg_out, kstrength_out, krdg_partic_out, krdg_redist_out, mu_rdg_out, & + kalg_out, R_gC2molC_out, kstrength_out, krdg_partic_out, krdg_redist_out, mu_rdg_out, & atmbndy_out, calc_strair_out, formdrag_out, highfreq_out, natmiter_out, & atmiter_conv_out, calc_dragio_out, & tfrz_option_out, kitd_out, kcatbound_out, hs0_out, frzpnd_out, & - saltflux_option_out, & + saltflux_option_out, congel_freeze_out, & floeshape_out, wave_spec_out, wave_spec_type_out, nfreq_out, & dpscale_out, rfracmin_out, rfracmax_out, pndaspect_out, hs1_out, hp1_out, & bgc_flux_type_out, z_tracers_out, scale_bgc_out, solve_zbgc_out, & - modal_aero_out, skl_bgc_out, solve_zsal_out, grid_o_out, l_sk_out, & + modal_aero_out, use_macromolecules_out, restartbgc_out, use_atm_dust_iron_out, & + skl_bgc_out, solve_zsal_out, grid_o_out, l_sk_out, & initbio_frac_out, grid_oS_out, l_skS_out, & phi_snow_out, conserv_check_out, & fr_resp_out, algal_vel_out, R_dFe2dust_out, dustFe_sol_out, & @@ -1299,7 +1403,37 @@ icepack_query_parameters snwlvlfac_out, isnw_T_out, isnw_Tgrd_out, isnw_rhos_out, & snowage_rhos_out, snowage_Tgrd_out, snowage_T_out, & snowage_tau_out, snowage_kappa_out, snowage_drdt0_out, & - snw_aging_table_out, snw_ssp_table_out ) + snw_aging_table_out, snw_ssp_table_out, ratio_Si2N_diatoms_out, & + ratio_Si2N_sp_out, ratio_Si2N_phaeo_out, ratio_S2N_diatoms_out, & + ratio_S2N_sp_out, ratio_S2N_phaeo_out, ratio_Fe2C_diatoms_out, & + ratio_Fe2C_sp_out, ratio_Fe2C_phaeo_out, ratio_Fe2N_diatoms_out, & + ratio_Fe2N_sp_out, ratio_Fe2N_phaeo_out, ratio_Fe2DON_out, & + ratio_Fe2DOC_s_out, ratio_Fe2DOC_l_out, grid_o_t_out, tau_min_out, tau_max_out, & + chlabs_diatoms_out, chlabs_sp_out, chlabs_phaeo_out, alpha2max_low_diatoms_out, & + alpha2max_low_sp_out, alpha2max_low_phaeo_out, beta2max_diatoms_out, & + beta2max_sp_out, beta2max_phaeo_out, mu_max_diatoms_out, mu_max_sp_out, & + mu_max_phaeo_out, grow_Tdep_diatoms_out, grow_Tdep_sp_out, & + grow_Tdep_phaeo_out, fr_graze_diatoms_out, fr_graze_sp_out, & + fr_graze_phaeo_out, mort_pre_diatoms_out, mort_pre_sp_out, & + mort_pre_phaeo_out, mort_Tdep_diatoms_out, mort_Tdep_sp_out, & + mort_Tdep_phaeo_out, k_exude_diatoms_out, k_exude_sp_out, k_exude_phaeo_out, & + K_Nit_diatoms_out, K_Nit_sp_out, K_Nit_phaeo_out, & + K_Am_diatoms_out, K_Am_sp_out, K_Am_phaeo_out, & + K_Sil_diatoms_out, K_Sil_sp_out, K_Sil_phaeo_out, & + K_Fe_diatoms_out, K_Fe_sp_out, K_Fe_phaeo_out, & + f_don_protein_out, kn_bac_protein_out, f_don_Am_protein_out, & + f_doc_s_out, f_doc_l_out, f_exude_s_out, f_exude_l_out, & + k_bac_s_out, k_bac_l_out, algaltype_diatoms_out, & + algaltype_sp_out, algaltype_phaeo_out, nitratetype_out, & + ammoniumtype_out, silicatetype_out, dmspptype_out, & + dmspdtype_out, humtype_out, doctype_s_out, doctype_l_out, & + dictype_1_out, dontype_protein_out, fedtype_1_out, feptype_1_out, & + zaerotype_bc1_out, zaerotype_bc2_out, zaerotype_dust1_out, & + zaerotype_dust2_out, zaerotype_dust3_out, zaerotype_dust4_out, & + ratio_C2N_diatoms_out, ratio_C2N_sp_out, ratio_C2N_phaeo_out, & + ratio_chl2N_diatoms_out, ratio_chl2N_sp_out, ratio_chl2N_phaeo_out, & + F_abs_chl_diatoms_out, F_abs_chl_sp_out, F_abs_chl_phaeo_out, & + ratio_C2N_proteins_out ) !----------------------------------------------------------------- ! control settings @@ -1349,6 +1483,7 @@ icepack_query_parameters cp_ocn_out, & ! specific heat of ocn (J/kg/K) depressT_out, & ! Tf:brine salinity ratio (C/ppt) viscosity_dyn_out, & ! dynamic viscosity of brine (kg/m/s) + tscale_pnd_drain_out, & ! mushy macroscopic drainage timescale (days) Tocnfrz_out, & ! freezing temp of seawater (C) Tffresh_out, & ! freezing temp of fresh ice (K) Lsub_out, & ! latent heat, sublimation freshwater (J/kg) @@ -1399,16 +1534,21 @@ icepack_query_parameters phi_i_mushy_out ! liquid fraction of congelation ice character(len=*), intent(out), optional :: & - tfrz_option_out ! form of ocean freezing temperature - ! 'minus1p8' = -1.8 C - ! 'constant' = Tocnfrz - ! 'linear_salt' = -depressT * sss - ! 'mushy' conforms with ktherm=2 + congel_freeze_out ! congelation computation + ! 'two-step' = original formulation + ! 'one-step' = Plante et al, The Cryosphere, 2024 character(len=*), intent(out), optional :: & - saltflux_option_out ! Salt flux computation - ! 'constant' reference value of ice_ref_salinity - ! 'prognostic' prognostic salt flux + tfrz_option_out ! form of ocean freezing temperature + ! 'minus1p8' = -1.8 C + ! 'constant' = Tocnfrz + ! 'linear_salt' = -depressT * sss + ! 'mushy' conforms with ktherm=2 + + character(len=*), intent(out), optional :: & + saltflux_option_out ! Salt flux computation + ! 'constant' reference value of ice_ref_salinity + ! 'prognostic' prognostic salt flux !----------------------------------------------------------------------- @@ -1422,7 +1562,8 @@ icepack_query_parameters stefan_boltzmann_out, & ! W/m^2/K^4 kappav_out, & ! vis extnctn coef in ice, wvlngth<700nm (1/m) hi_ssl_out, & ! ice surface scattering layer thickness (m) - hs_ssl_out, & ! visible, direct + hs_ssl_out, & ! snow surface scattering layer thickness (m) + hs_ssl_min_out, & ! minimum snow surface scattering layer thickness for aerosols (m) awtvdr_out, & ! visible, direct ! for history and awtidr_out, & ! near IR, direct ! diagnostics awtvdf_out, & ! visible, diffuse @@ -1449,7 +1590,8 @@ icepack_query_parameters dT_mlt_out , & ! change in temp for non-melt to melt snow grain ! radius change (C) rsnw_mlt_out , & ! maximum melting snow grain radius (10^-6 m) - kalg_out ! algae absorption coefficient for 0.5 m thick layer + kalg_out , & ! algae absorption coefficient for 0.5 m thick layer + R_gC2molC_out ! grams carbon per mol logical (kind=log_kind), intent(out), optional :: & sw_redist_out ! redistribute shortwave @@ -1536,7 +1678,7 @@ icepack_query_parameters nfreq_out ! number of frequencies real (kind=dbl_kind), intent(out), optional :: & - floeshape_out ! constant from Steele (unitless) + floeshape_out ! constant from Rothrock 1984 (unitless) logical (kind=log_kind), intent(out), optional :: & wave_spec_out ! if true, use wave forcing @@ -1558,6 +1700,10 @@ icepack_query_parameters solve_zbgc_out, & ! if .true., solve vertical biochemistry portion of code dEdd_algae_out, & ! if .true., algal absorptionof Shortwave is computed in the modal_aero_out, & ! if .true., use modal aerosol formulation in shortwave + use_macromolecules_out, & ! if .true., ocean DOC is already split + ! into polysaccharid, lipid and protein fractions + use_atm_dust_iron_out, & ! if .true., compute iron contribution from dust + restartbgc_out, & conserv_check_out ! if .true., run conservation checks and abort if checks fail logical (kind=log_kind), intent(out), optional :: & @@ -1567,12 +1713,112 @@ icepack_query_parameters real (kind=dbl_kind), intent(out), optional :: & grid_o_out , & ! for bottom flux l_sk_out , & ! characteristic diffusive scale (zsalinity) (m) + grid_o_t_out , & ! top grid point length scale initbio_frac_out, & ! fraction of ocean tracer concentration used to initialize tracer phi_snow_out ! snow porosity at the ice/snow interface real (kind=dbl_kind), intent(out), optional :: & grid_oS_out , & ! for bottom flux (zsalinity) l_skS_out ! 0.02 characteristic skeletal layer thickness (m) (zsalinity) + + real (kind=dbl_kind), intent(out), optional :: & + ratio_Si2N_diatoms_out, & ! algal Si to N (mol/mol) + ratio_Si2N_sp_out , & + ratio_Si2N_phaeo_out , & + ratio_S2N_diatoms_out , & ! algal S to N (mol/mol) + ratio_S2N_sp_out , & + ratio_S2N_phaeo_out , & + ratio_Fe2C_diatoms_out, & ! algal Fe to C (umol/mol) + ratio_Fe2C_sp_out , & + ratio_Fe2C_phaeo_out , & + ratio_Fe2N_diatoms_out, & ! algal Fe to N (umol/mol) + ratio_Fe2N_sp_out , & + ratio_Fe2N_phaeo_out , & + ratio_Fe2DON_out , & ! Fe to N of DON (nmol/umol) + ratio_Fe2DOC_s_out , & ! Fe to C of DOC (nmol/umol) saccharids + ratio_Fe2DOC_l_out , & ! Fe to C of DOC (nmol/umol) lipids + tau_min_out , & ! rapid mobile to stationary exchanges (s) = 1.5 hours + tau_max_out , & ! long time mobile to stationary exchanges (s) = 2 days + chlabs_diatoms_out , & ! chl absorption (1/m/(mg/m^3)) + chlabs_sp_out , & ! + chlabs_phaeo_out , & ! + alpha2max_low_diatoms_out , & ! light limitation (1/(W/m^2)) + alpha2max_low_sp_out , & + alpha2max_low_phaeo_out , & + beta2max_diatoms_out , & ! light inhibition (1/(W/m^2)) + beta2max_sp_out , & + beta2max_phaeo_out , & + mu_max_diatoms_out , & ! maximum growth rate (1/day) + mu_max_sp_out , & + mu_max_phaeo_out , & + grow_Tdep_diatoms_out, & ! Temperature dependence of growth (1/C) + grow_Tdep_sp_out , & + grow_Tdep_phaeo_out , & + fr_graze_diatoms_out , & ! Fraction grazed + fr_graze_sp_out , & + fr_graze_phaeo_out , & + mort_pre_diatoms_out , & ! Mortality (1/day) + mort_pre_sp_out , & + mort_pre_phaeo_out , & + mort_Tdep_diatoms_out, & ! T dependence of mortality (1/C) + mort_Tdep_sp_out , & + mort_Tdep_phaeo_out , & + k_exude_diatoms_out , & ! algal exudation (1/d) + k_exude_sp_out , & + k_exude_phaeo_out , & + K_Nit_diatoms_out , & ! nitrate half saturation (mmol/m^3) + K_Nit_sp_out , & + K_Nit_phaeo_out , & + K_Am_diatoms_out , & ! ammonium half saturation (mmol/m^3) + K_Am_sp_out , & + K_Am_phaeo_out , & + K_Sil_diatoms_out , & ! silicate half saturation (mmol/m^3) + K_Sil_sp_out , & + K_Sil_phaeo_out , & + K_Fe_diatoms_out , & ! iron half saturation (nM) + K_Fe_sp_out , & + K_Fe_phaeo_out , & + f_don_protein_out , & ! fraction of spilled grazing to proteins + kn_bac_protein_out , & ! Bacterial degredation of DON (1/d) + f_don_Am_protein_out , & ! fraction of remineralized DON to ammonium + f_doc_s_out , & ! fraction of mortality to DOC + f_doc_l_out , & + f_exude_s_out , & ! fraction of exudation to DOC + f_exude_l_out , & + k_bac_s_out , & ! Bacterial degredation of DOC (1/d) + k_bac_l_out , & + algaltype_diatoms_out , & ! mobility type + algaltype_sp_out , & ! + algaltype_phaeo_out , & ! + nitratetype_out , & ! + ammoniumtype_out , & ! + silicatetype_out , & ! + dmspptype_out , & ! + dmspdtype_out , & ! + humtype_out , & ! + doctype_s_out , & ! + doctype_l_out , & ! + dictype_1_out , & ! + dontype_protein_out , & ! + fedtype_1_out , & ! + feptype_1_out , & ! + zaerotype_bc1_out , & ! + zaerotype_bc2_out , & ! + zaerotype_dust1_out , & ! + zaerotype_dust2_out , & ! + zaerotype_dust3_out , & ! + zaerotype_dust4_out , & ! + ratio_C2N_diatoms_out , & ! algal C to N ratio (mol/mol) + ratio_C2N_sp_out , & ! + ratio_C2N_phaeo_out , & ! + ratio_chl2N_diatoms_out, & ! algal chlorophyll to N ratio (mg/mmol) + ratio_chl2N_sp_out , & ! + ratio_chl2N_phaeo_out , & ! + F_abs_chl_diatoms_out , & ! scales absorbed radiation for dEdd + F_abs_chl_sp_out , & ! + F_abs_chl_phaeo_out , & ! + ratio_C2N_proteins_out ! ratio of C to N in proteins (mol/mol) + real (kind=dbl_kind), intent(out), optional :: & fr_resp_out , & ! fraction of algal growth lost due to respiration algal_vel_out , & ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day @@ -1782,7 +2028,6 @@ icepack_step_radiation ! Elizabeth C. Hunke, LANL subroutine icepack_step_radiation (dt, & - swgrid, igrid, & fbri, & aicen, vicen, & vsnon, Tsfcn, & @@ -1844,12 +2089,6 @@ icepack_step_radiation real (kind=dbl_kind), intent(inout) :: & coszen ! cosine solar zenith angle, < 0 for sun below horizon - real (kind=dbl_kind), dimension (:), intent(in) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (:), intent(in) :: & - swgrid ! grid for ice tracers used in dEdd scheme - real (kind=dbl_kind), dimension(:), intent(in) :: & aicen , & ! ice area fraction in each category vicen , & ! ice volume in each category (m) @@ -1937,8 +2176,7 @@ icepack_step_snow ! authors: Elizabeth C. Hunke, LANL ! Nicole Jeffery, LANL - subroutine icepack_step_snow(dt, nilyr, & - nslyr, ncat, & + subroutine icepack_step_snow(dt, & wind, aice, & aicen, vicen, & vsnon, Tsfc, & @@ -1950,11 +2188,6 @@ icepack_step_snow fresh, fhocn, & fsloss, fsnow) - integer (kind=int_kind), intent(in) :: & - nslyr, & ! number of snow layers - nilyr, & ! number of ice layers - ncat ! number of thickness categories - real (kind=dbl_kind), intent(in) :: & dt , & ! time step wind , & ! wind speed (m/s) @@ -2002,9 +2235,7 @@ icepack_step_therm2 ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_step_therm2 (dt, ncat, nltrcr, & - nilyr, nslyr, & - hin_max, nblyr, & + subroutine icepack_step_therm2(dt, hin_max, & aicen, & vicen, vsnon, & aicen_init, vicen_init, & @@ -2015,40 +2246,28 @@ icepack_step_therm2 nt_strata, & Tf, sss, & salinz, & - rside, meltl, & - fside, wlat, & + rsiden, meltl, & + wlat, & frzmlt, frazil, & frain, fpond, & fresh, fsalt, & fhocn, update_ocn_f, & - bgrid, cgrid, & - igrid, faero_ocn, & + faero_ocn, & first_ice, fzsal, & flux_bio, ocean_bio, & frazil_diag, & frz_onset, yday, & fiso_ocn, HDO_ocn, & H2_16O_ocn, H2_18O_ocn, & - nfsd, wave_sig_ht, & + wave_sig_ht, & wave_spectrum, & wavefreq, & dwavefreq, & d_afsd_latg, d_afsd_newi, & - d_afsd_latm, d_afsd_weld, & - floe_rad_c, floe_binwidth) + d_afsd_latm, d_afsd_weld) use icepack_parameters, only: icepack_init_parameters - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nltrcr , & ! number of zbgc tracers - nblyr , & ! number of bio layers - nilyr , & ! number of ice layers - nslyr ! number of snow layers - - integer (kind=int_kind), intent(in), optional :: & - nfsd ! number of floe size categories - logical (kind=log_kind), intent(in), optional :: & update_ocn_f ! if true, update fresh water and salt fluxes @@ -2059,7 +2278,6 @@ icepack_step_therm2 dt , & ! time step Tf , & ! freezing temperature (C) sss , & ! sea surface salinity (ppt) - rside , & ! fraction of ice that melts laterally frzmlt ! freezing/melting potential (W/m^2) integer (kind=int_kind), dimension (:), intent(in) :: & @@ -2073,23 +2291,14 @@ icepack_step_therm2 integer (kind=int_kind), dimension (:,:), intent(in) :: & nt_strata ! indices of underlying tracer layers - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bgrid ! biology nondimensional vertical grid points - - real (kind=dbl_kind), dimension (nblyr+1), intent(in) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), intent(in) :: & - cgrid ! CICE vertical coordinate - real (kind=dbl_kind), dimension(:), intent(in) :: & + rsiden , & ! fraction of ice that melts laterally salinz , & ! initial salinity profile ocean_bio ! ocean concentration of biological tracer real (kind=dbl_kind), intent(inout) :: & aice , & ! sea ice concentration aice0 , & ! concentration of open water - fside , & ! lateral heat flux (W/m^2) frain , & ! rainfall rate (kg/m^2 s) fpond , & ! fresh water flux to ponds (kg/m^2/s) fresh , & ! fresh water flux to ocean (kg/m^2/s) @@ -2152,30 +2361,24 @@ icepack_step_therm2 d_afsd_latm, & ! lateral melt d_afsd_weld ! welding - real (kind=dbl_kind), dimension (:), intent(in), optional :: & - floe_rad_c, & ! fsd size bin centre in m (radius) - floe_binwidth ! fsd size bin width in m (radius) - icepack_therm_shared.F90 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. _icepack_init_thermo: +.. _icepack_init_salinity: -icepack_init_thermo +icepack_init_salinity ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: fortran - ! Initialize the vertical profile of ice salinity and melting temperature. + ! Initialize the vertical profile of ice salinity. + ! This subroutine was renamed from icepack_init_thermo in Oct 2024 ! ! authors: C. M. Bitz, UW ! William H. Lipscomb, LANL - subroutine icepack_init_thermo(nilyr, sprofile) - - integer (kind=int_kind), intent(in) :: & - nilyr ! number of ice layers + subroutine icepack_init_salinity(sprofile) real (kind=dbl_kind), dimension(:), intent(out) :: & sprofile ! vertical salinity profile @@ -2203,23 +2406,19 @@ icepack_salinity_profile -.. _icepack_init_trcr: +.. _icepack_init_enthalpy: -icepack_init_trcr +icepack_init_enthalpy ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: fortran + ! This subroutine was renamed from icepack_init_trcr in Oct 2024 ! - subroutine icepack_init_trcr(Tair, Tf, & + subroutine icepack_init_enthalpy(Tair, Tf, & Sprofile, Tprofile, & Tsfc, & - nilyr, nslyr, & qin, qsn) - integer (kind=int_kind), intent(in) :: & - nilyr, & ! number of ice layers - nslyr ! number of snow layers - real (kind=dbl_kind), intent(in) :: & Tair, & ! air temperature (K) Tf ! freezing temperature (C) @@ -2312,7 +2511,7 @@ icepack_step_therm1 ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_step_therm1(dt, ncat, nilyr, nslyr, & + subroutine icepack_step_therm1(dt, & aicen_init , & vicen_init , vsnon_init , & aice , aicen , & @@ -2351,8 +2550,8 @@ icepack_step_therm1 strocnxT , strocnyT , & fbot , & Tbot , Tsnice , & - frzmlt , rside , & - fside , wlat , & + frzmlt , rsiden , & + wlat , & fsnow , frain , & fpond , fsloss , & fsurf , fsurfn , & @@ -2399,12 +2598,7 @@ icepack_step_therm1 lmask_n , lmask_s , & mlt_onset , frz_onset , & yday , prescribed_ice, & - zlvs) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nslyr ! number of snow layers + zlvs , afsdn) real (kind=dbl_kind), intent(in) :: & dt , & ! time step @@ -2480,8 +2674,6 @@ icepack_step_therm1 strocnyT , & ! ice-ocean stress, y-direction fbot , & ! ice-ocean heat flux at bottom surface (W/m^2) frzmlt , & ! freezing/melting potential (W/m^2) - rside , & ! fraction of ice that melts laterally - fside , & ! lateral heat flux (W/m^2) sst , & ! sea surface temperature (C) Tf , & ! freezing temperature (C) Tbot , & ! ice bottom surface temperature (deg C) @@ -2494,7 +2686,7 @@ icepack_step_therm1 frz_onset ! day of year that freezing begins (congel or frazil) real (kind=dbl_kind), intent(out), optional :: & - wlat ! lateral melt rate (m/s) + wlat ! lateral melt rate (m/s) real (kind=dbl_kind), intent(inout), optional :: & fswthru_vdr , & ! vis dir shortwave penetrating to ocean (W/m^2) @@ -2528,6 +2720,9 @@ icepack_step_therm1 H2_18O_ocn , & ! ocean concentration of H2_18O (kg/kg) zlvs ! atm level height for scalars (if different than zlvl) (m) + real (kind=dbl_kind), dimension(:,:), intent(in), optional :: & + afsdn ! afsd tracer + real (kind=dbl_kind), dimension(:), intent(inout) :: & aicen_init , & ! fractional area of ice vicen_init , & ! volume per unit area of ice (m) @@ -2543,6 +2738,7 @@ icepack_step_therm1 ipnd , & ! melt pond refrozen lid thickness (m) iage , & ! volume-weighted ice age FY , & ! area-weighted first-year ice area + rsiden , & ! fraction of ice that melts laterally fsurfn , & ! net flux to top surface, excluding fcondtop fcondtopn , & ! downward cond flux at top surface (W m-2) fcondbotn , & ! downward cond flux at bottom surface (W m-2) @@ -2562,12 +2758,14 @@ icepack_step_therm1 melttn , & ! top ice melt (m) meltbn , & ! bottom ice melt (m) congeln , & ! congelation ice growth (m) - snoicen , & ! snow-ice growth (m) - dsnown ! change in snow thickness (m/step-->cm/day) + snoicen ! snow-ice growth (m) real (kind=dbl_kind), dimension(:), intent(in) :: & fswthrun ! SW through ice to ocean (W/m^2) + real (kind=dbl_kind), dimension(:), intent(inout), optional :: & + dsnown ! change in snow thickness (m/step-->cm/day) + real (kind=dbl_kind), dimension(:), intent(in), optional :: & fswthrun_vdr , & ! vis dir SW through ice to ocean (W/m^2) fswthrun_vdf , & ! vis dif SW through ice to ocean (W/m^2) @@ -3024,15 +3222,12 @@ icepack_compute_tracers ! Compute tracer fields. ! Given atrcrn = aicen*trcrn (or vicen*trcrn, vsnon*trcrn), compute trcrn. - subroutine icepack_compute_tracers (ntrcr, trcr_depend, & + subroutine icepack_compute_tracers (trcr_depend, & atrcrn, aicen, & vicen, vsnon, & trcr_base, n_trcr_strata, & nt_strata, trcrn, Tf) - integer (kind=int_kind), intent(in) :: & - ntrcr ! number of tracers in use - integer (kind=int_kind), dimension (ntrcr), intent(in) :: & trcr_depend, & ! = 0 for aicen tracers, 1 for vicen, 2 for vsnon n_trcr_strata ! number of underlying tracer layers @@ -3174,21 +3369,17 @@ icepack_step_wavefracture ! authors: 2018 Lettie Roach, NIWA/VUW ! subroutine icepack_step_wavefracture(wave_spec_type, & - dt, ncat, nfsd, & - nfreq, & + dt, nfreq, & aice, vice, aicen, & - floe_rad_l, floe_rad_c, & wave_spectrum, wavefreq, dwavefreq, & trcrn, d_afsd_wave) character (len=char_len), intent(in) :: & - wave_spec_type ! type of wave spectrum forcing + wave_spec_type ! type of wave spectrum forcing integer (kind=int_kind), intent(in) :: & - nfreq, & ! number of wave frequency categories - ncat, & ! number of thickness categories - nfsd ! number of floe size categories + nfreq ! number of wave frequency categories real (kind=dbl_kind), intent(in) :: & dt, & ! time step @@ -3198,10 +3389,6 @@ icepack_step_wavefracture real (kind=dbl_kind), dimension(ncat), intent(in) :: & aicen ! ice area fraction (categories) - real(kind=dbl_kind), dimension(:), intent(in) :: & - floe_rad_l, & ! fsd size lower bound in m (radius) - floe_rad_c ! fsd size bin centre in m (radius) - real (kind=dbl_kind), dimension (:), intent(in) :: & wavefreq, & ! wave frequencies (s^-1) dwavefreq ! wave frequency bin widths (s^-1) @@ -3231,23 +3418,8 @@ icepack_init_bgc .. code-block:: fortran ! - subroutine icepack_init_bgc(ncat, nblyr, nilyr, ntrcr_o, & - cgrid, igrid, ntrcr, nbtrcr, & - sicen, trcrn, sss, ocean_bio_all) - - integer (kind=int_kind), intent(in) :: & - ncat , & ! number of thickness categories - nilyr , & ! number of ice layers - nblyr , & ! number of bio layers - ntrcr_o,& ! number of tracers not including bgc - ntrcr , & ! number of tracers in use - nbtrcr ! number of bio tracers in use - - real (kind=dbl_kind), dimension (nblyr+1), intent(inout) :: & - igrid ! biology vertical interface points - - real (kind=dbl_kind), dimension (nilyr+1), intent(inout) :: & - cgrid ! CICE vertical coordinate + subroutine icepack_init_bgc( & + sicen, trcrn, sss, ocean_bio_all, DOCPoolFractions) real (kind=dbl_kind), dimension(nilyr, ncat), intent(in) :: & sicen ! salinity on the cice grid @@ -3258,9 +3430,12 @@ icepack_init_bgc real (kind=dbl_kind), intent(in) :: & sss ! sea surface salinity (ppt) - real (kind=dbl_kind), dimension (:), intent(inout) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & ocean_bio_all ! fixed order, all values even for tracers false + real (kind=dbl_kind), dimension (:), optional, intent(out) :: & + DOCPoolFractions ! Fraction of DOC in polysacharids, lipids, and proteins + .. _icepack_init_zbgc: @@ -3271,76 +3446,14 @@ icepack_init_zbgc ! - subroutine icepack_init_zbgc ( & - R_Si2N_in, R_S2N_in, R_Fe2C_in, R_Fe2N_in, R_C2N_in, R_C2N_DON_in, & - R_chl2N_in, F_abs_chl_in, R_Fe2DON_in, R_Fe2DOC_in, chlabs_in, & - alpha2max_low_in, beta2max_in, mu_max_in, fr_graze_in, mort_pre_in, & - mort_Tdep_in, k_exude_in, K_Nit_in, K_Am_in, K_sil_in, K_Fe_in, & - f_don_in, kn_bac_in, f_don_Am_in, f_doc_in, f_exude_in, k_bac_in, & - grow_Tdep_in, zbgc_frac_init_in, & - zbgc_init_frac_in, tau_ret_in, tau_rel_in, bgc_tracer_type_in, & - fr_resp_in, algal_vel_in, R_dFe2dust_in, dustFe_sol_in, T_max_in, & - op_dep_min_in, fr_graze_s_in, fr_graze_e_in, fr_mort2min_in, fr_dFe_in, & - k_nitrif_in, t_iron_conv_in, max_loss_in, max_dfe_doc1_in, & - fr_resp_s_in, y_sk_DMS_in, t_sk_conv_in, t_sk_ox_in, fsal_in) - - real (kind=dbl_kind), optional :: R_C2N_in(:) ! algal C to N (mole/mole) - real (kind=dbl_kind), optional :: R_chl2N_in(:) ! 3 algal chlorophyll to N (mg/mmol) - real (kind=dbl_kind), optional :: F_abs_chl_in(:) ! to scale absorption in Dedd - real (kind=dbl_kind), optional :: R_C2N_DON_in(:) ! increase compare to algal R_Fe2C - real (kind=dbl_kind), optional :: R_Si2N_in(:) ! algal Sil to N (mole/mole) - real (kind=dbl_kind), optional :: R_S2N_in(:) ! algal S to N (mole/mole) - real (kind=dbl_kind), optional :: R_Fe2C_in(:) ! algal Fe to carbon (umol/mmol) - real (kind=dbl_kind), optional :: R_Fe2N_in(:) ! algal Fe to N (umol/mmol) - real (kind=dbl_kind), optional :: R_Fe2DON_in(:) ! Fe to N of DON (nmol/umol) - real (kind=dbl_kind), optional :: R_Fe2DOC_in(:) ! Fe to C of DOC (nmol/umol) - - real (kind=dbl_kind), optional :: fr_resp_in ! frac of algal growth lost due to respiration - real (kind=dbl_kind), optional :: algal_vel_in ! 0.5 cm/d(m/s) Lavoie 2005 1.5 cm/day - real (kind=dbl_kind), optional :: R_dFe2dust_in ! g/g (3.5% content) Tagliabue 2009 - real (kind=dbl_kind), optional :: dustFe_sol_in ! solubility fraction - real (kind=dbl_kind), optional :: T_max_in ! maximum temperature (C) - real (kind=dbl_kind), optional :: op_dep_min_in ! Light attenuates for optical depths exceeding min - real (kind=dbl_kind), optional :: fr_graze_s_in ! fraction of grazing spilled or slopped - real (kind=dbl_kind), optional :: fr_graze_e_in ! fraction of assimilation excreted - real (kind=dbl_kind), optional :: fr_mort2min_in ! fractionation of mortality to Am - real (kind=dbl_kind), optional :: fr_dFe_in ! fraction of remineralized nitrogen - ! (in units of algal iron) - real (kind=dbl_kind), optional :: k_nitrif_in ! nitrification rate (1/day) - real (kind=dbl_kind), optional :: t_iron_conv_in ! desorption loss pFe to dFe (day) - real (kind=dbl_kind), optional :: max_loss_in ! restrict uptake to % of remaining value - real (kind=dbl_kind), optional :: max_dfe_doc1_in ! max ratio of dFe to saccharides in the ice (nM Fe/muM C) - real (kind=dbl_kind), optional :: fr_resp_s_in ! DMSPd fraction of respiration loss as DMSPd - real (kind=dbl_kind), optional :: y_sk_DMS_in ! fraction conversion given high yield - real (kind=dbl_kind), optional :: t_sk_conv_in ! Stefels conversion time (d) - real (kind=dbl_kind), optional :: t_sk_ox_in ! DMS oxidation time (d) - real (kind=dbl_kind), optional :: fsal_in ! salinity limitation factor (1) - - real (kind=dbl_kind), optional :: chlabs_in(:) ! chla absorption 1/m/(mg/m^3) - real (kind=dbl_kind), optional :: alpha2max_low_in(:) ! light limitation (1/(W/m^2)) - real (kind=dbl_kind), optional :: beta2max_in(:) ! light inhibition (1/(W/m^2)) - real (kind=dbl_kind), optional :: mu_max_in(:) ! maximum growth rate (1/d) - real (kind=dbl_kind), optional :: grow_Tdep_in(:) ! T dependence of growth (1/C) - real (kind=dbl_kind), optional :: fr_graze_in(:) ! fraction of algae grazed - real (kind=dbl_kind), optional :: mort_pre_in(:) ! mortality (1/day) - real (kind=dbl_kind), optional :: mort_Tdep_in(:) ! T dependence of mortality (1/C) - real (kind=dbl_kind), optional :: k_exude_in(:) ! algal carbon exudation rate (1/d) - real (kind=dbl_kind), optional :: K_Nit_in(:) ! nitrate half saturation (mmol/m^3) - real (kind=dbl_kind), optional :: K_Am_in(:) ! ammonium half saturation (mmol/m^3) - real (kind=dbl_kind), optional :: K_Sil_in(:) ! silicon half saturation (mmol/m^3) - real (kind=dbl_kind), optional :: K_Fe_in(:) ! iron half saturation or micromol/m^3 - real (kind=dbl_kind), optional :: f_don_in(:) ! fraction of spilled grazing to DON - real (kind=dbl_kind), optional :: kn_bac_in(:) ! Bacterial degredation of DON (1/d) - real (kind=dbl_kind), optional :: f_don_Am_in(:) ! fraction of remineralized DON to Am - real (kind=dbl_kind), optional :: f_doc_in(:) ! fraction of mort_N that goes to each doc pool - real (kind=dbl_kind), optional :: f_exude_in(:) ! fraction of exuded carbon to each DOC pool - real (kind=dbl_kind), optional :: k_bac_in(:) ! Bacterial degredation of DOC (1/d) - - real (kind=dbl_kind), optional :: zbgc_frac_init_in(:) ! initializes mobile fraction - real (kind=dbl_kind), optional :: bgc_tracer_type_in(:) ! described tracer in mobile or stationary phases - real (kind=dbl_kind), optional :: zbgc_init_frac_in(:) ! fraction of ocean tracer concentration in new ice - real (kind=dbl_kind), optional :: tau_ret_in(:) ! retention timescale (s), mobile to stationary phase - real (kind=dbl_kind), optional :: tau_rel_in(:) ! release timescale (s), stationary to mobile phase + subroutine icepack_init_zbgc (& + zbgc_frac_init_in, zbgc_init_frac_in, tau_ret_in, tau_rel_in, bgc_tracer_type_in) + + real (kind=dbl_kind), dimension (:), intent(in), optional :: zbgc_frac_init_in(:) ! initializes mobile fraction + real (kind=dbl_kind), dimension (:), intent(in), optional :: bgc_tracer_type_in(:) ! described tracer in mobile or stationary phases + real (kind=dbl_kind), dimension (:), intent(in), optional :: zbgc_init_frac_in(:) ! fraction of ocean tracer concentration in new ice + real (kind=dbl_kind), dimension (:), intent(in), optional :: tau_ret_in(:) ! retention timescale (s), mobile to stationary phase + real (kind=dbl_kind), dimension (:), intent(in), optional :: tau_rel_in(:) ! release timescale (s), stationary to mobile phase @@ -3351,54 +3464,40 @@ icepack_biogeochemistry .. code-block:: fortran ! - subroutine icepack_biogeochemistry(dt, & - ntrcr, nbtrcr, & upNO, upNH, iDi, iki, zfswin, & - zsal_tot, darcy_V, grow_net, & + darcy_V, grow_net, & PP_net, hbri,dhbr_bot, dhbr_top, Zoo,& - fbio_snoice, fbio_atmice, ocean_bio, & + fbio_snoice, fbio_atmice, ocean_bio_dh, ocean_bio, & first_ice, fswpenln, bphi, bTiz, ice_bio_net, & - snow_bio_net, fswthrun, Rayleigh_criteria, & - sice_rho, fzsal, fzsal_g, & - bgrid, igrid, icgrid, cgrid, & - nblyr, nilyr, nslyr, n_algae, n_zaero, ncat, & - n_doc, n_dic, n_don, n_fed, n_fep, & + snow_bio_net, totalChla, fswthrun, & meltbn, melttn, congeln, snoicen, & - sst, sss, fsnow, meltsn, & + sst, sss, Tf, fsnow, meltsn, & !hmix, & hin_old, flux_bio, flux_bio_atm, & aicen_init, vicen_init, aicen, vicen, vsnon, & - aice0, trcrn, vsnon_init, skl_bgc) + aice0, trcrn, vsnon_init, & + flux_bion, bioPorosityIceCell, & + bioSalinityIceCell, bioTemperatureIceCell) real (kind=dbl_kind), intent(in) :: & dt ! time step - integer (kind=int_kind), intent(in) :: & - ncat, & - nilyr, & - nslyr, & - nblyr, & - ntrcr, & - nbtrcr, & - n_algae, n_zaero, & - n_doc, n_dic, n_don, n_fed, n_fep - real (kind=dbl_kind), dimension (:), intent(inout) :: & - bgrid , & ! biology nondimensional vertical grid points - igrid , & ! biology vertical interface points - cgrid , & ! CICE vertical coordinate - icgrid , & ! interface grid for CICE (shortwave variable) - ocean_bio , & ! contains all the ocean bgc tracer concentrations fbio_snoice , & ! fluxes from snow to ice fbio_atmice , & ! fluxes from atm to ice dhbr_top , & ! brine top change dhbr_bot , & ! brine bottom change darcy_V , & ! darcy velocity positive up (m/s) hin_old , & ! old ice thickness - sice_rho , & ! avg sea ice density (kg/m^3) ice_bio_net , & ! depth integrated tracer (mmol/m^2) snow_bio_net , & ! depth integrated snow tracer (mmol/m^2) - flux_bio ! all bio fluxes to ocean + flux_bio ! all bio fluxes to ocean + + real (kind=dbl_kind), dimension (:), intent(in) :: & + ocean_bio ! contains the ocean bgc tracer concentrations in use (mmol/m^3) + + real (kind=dbl_kind), optional, dimension (:), intent(out) :: & + ocean_bio_dh ! The ocean bgc tracer concentrations in use * brine thickness * phi (mmol/m^2) logical (kind=log_kind), dimension (:), intent(inout) :: & first_ice ! distinguishes ice that disappears (e.g. melts) @@ -3406,6 +3505,14 @@ icepack_biogeochemistry ! during a single time step from ice that was ! there the entire time step (true until ice forms) + real (kind=dbl_kind), optional, dimension (:,:), intent(out) :: & + flux_bion ! per categeory ice to ocean biogeochemistry flux (mmol/m2/s) + + real (kind=dbl_kind), optional, dimension (:), intent(inout) :: & + bioPorosityIceCell, & ! category average porosity on the interface bio grid + bioSalinityIceCell, & ! (ppt) category average porosity on the interface bio grid + bioTemperatureIceCell ! (oC) category average porosity on the interface bio grid + real (kind=dbl_kind), dimension (:,:), intent(inout) :: & Zoo , & ! N losses accumulated in timestep (ie. zooplankton/bacteria) ! mmol/m^3 @@ -3423,15 +3530,8 @@ icepack_biogeochemistry upNO , & ! nitrate uptake rate (mmol/m^2/d) times aice upNH ! ammonium uptake rate (mmol/m^2/d) times aice - real (kind=dbl_kind), intent(inout), optional :: & - zsal_tot ! Total ice salinity in per grid cell (g/m^2) (deprecated) - - real (kind=dbl_kind), intent(inout), optional :: & - fzsal , & ! Total flux of salt to ocean at time step for conservation (deprecated) - fzsal_g ! Total gravity drainage flux (deprecated) - - logical (kind=log_kind), intent(inout), optional :: & - Rayleigh_criteria ! .true. means Ra_c was reached (deprecated) + real (kind=dbl_kind), optional, intent(inout) :: & + totalChla ! ice integrated chla and summed over all algal groups (mg/m^2) real (kind=dbl_kind), dimension (:,:), intent(in) :: & fswpenln ! visible SW entering ice layers (W m-2) @@ -3455,11 +3555,10 @@ icepack_biogeochemistry aice0 , & ! open water area fraction sss , & ! sea surface salinity (ppt) sst , & ! sea surface temperature (C) + !hmix , & ! mixed layer depth (m) + Tf , & ! basal freezing temperature (C) fsnow ! snowfall rate (kg/m^2 s) - logical (kind=log_kind), intent(in) :: & - skl_bgc ! if true, solve skeletal biochemistry - .. _icepack_load_ocean_bio_array: @@ -3470,20 +3569,10 @@ icepack_load_ocean_bio_array ! basic initialization for ocean_bio_all - subroutine icepack_load_ocean_bio_array(max_nbtrcr, & - max_algae, max_don, max_doc, max_dic, max_aero, max_fe, & + subroutine icepack_load_ocean_bio_array(& nit, amm, sil, dmsp, dms, algalN, & doc, don, dic, fed, fep, zaeros, ocean_bio_all, hum) - integer (kind=int_kind), intent(in) :: & - max_algae , & ! maximum number of algal types - max_dic , & ! maximum number of dissolved inorganic carbon types - max_doc , & ! maximum number of dissolved organic carbon types - max_don , & ! maximum number of dissolved organic nitrogen types - max_fe , & ! maximum number of iron types - max_aero , & ! maximum number of aerosols - max_nbtrcr ! maximum number of bio tracers - real (kind=dbl_kind), intent(in) :: & nit , & ! ocean nitrate (mmol/m^3) amm , & ! ammonia/um (mmol/m^3) @@ -3492,25 +3581,25 @@ icepack_load_ocean_bio_array dms , & ! dms (mmol/m^3) hum ! humic material (mmol/m^3) - real (kind=dbl_kind), dimension (max_algae), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & algalN ! ocean algal nitrogen (mmol/m^3) (diatoms, phaeo, pico) - real (kind=dbl_kind), dimension (max_doc), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & doc ! ocean doc (mmol/m^3) (proteins, EPS, lipid) - real (kind=dbl_kind), dimension (max_don), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & don ! ocean don (mmol/m^3) - real (kind=dbl_kind), dimension (max_dic), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & dic ! ocean dic (mmol/m^3) - real (kind=dbl_kind), dimension (max_fe), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & fed, fep ! ocean disolved and particulate fe (nM) - real (kind=dbl_kind), dimension (max_aero), intent(in) :: & + real (kind=dbl_kind), dimension (:), intent(in) :: & zaeros ! ocean aerosols (mmol/m^3) - real (kind=dbl_kind), dimension (max_nbtrcr), intent(inout) :: & + real (kind=dbl_kind), dimension (:), intent(out) :: & ocean_bio_all ! fixed order, all values even for tracers false @@ -3524,16 +3613,9 @@ icepack_init_ocean_bio ! Initialize ocean concentration subroutine icepack_init_ocean_bio (amm, dmsp, dms, algalN, doc, dic, don, & - fed, fep, hum, nit, sil, zaeros, max_dic, max_don, max_fe, max_aero,& - CToN, CToN_DON) - - integer (kind=int_kind), intent(in) :: & - max_dic, & - max_don, & - max_fe, & - max_aero + fed, fep, hum, nit, sil, zaeros,CToN, CToN_DON) - real (kind=dbl_kind), intent(out):: & + real (kind=dbl_kind), intent(out), optional:: & amm , & ! ammonium dmsp , & ! DMSPp dms , & ! DMS @@ -3541,7 +3623,7 @@ icepack_init_ocean_bio nit , & ! nitrate sil ! silicate - real (kind=dbl_kind), dimension(:), intent(out):: & + real (kind=dbl_kind), dimension(:), intent(out), optional:: & algalN , & ! algae doc , & ! DOC dic , & ! DIC @@ -3550,7 +3632,7 @@ icepack_init_ocean_bio fep , & ! Particulate Iron zaeros ! BC and dust - real (kind=dbl_kind), dimension(:), intent(inout), optional :: & + real (kind=dbl_kind), dimension(:), intent(out), optional :: & CToN , & ! carbon to nitrogen ratio for algae CToN_DON ! nitrogen to carbon ratio for proteins diff --git a/doc/source/user_guide/ug_case_settings.rst b/doc/source/user_guide/ug_case_settings.rst index 754b51c2f..3dea32fb6 100644 --- a/doc/source/user_guide/ug_case_settings.rst +++ b/doc/source/user_guide/ug_case_settings.rst @@ -2,8 +2,8 @@ .. _case_settings: -Case Settings -===================== +Case Settings, Model Namelist, and CPPs +==================================================== There are two important files that define the case, **icepack.settings** and **icepack_in**. **icepack.settings** is a list of env variables that define many @@ -31,8 +31,8 @@ can be found in :ref:`cicecpps`. The following CPPs are available. "**General Macros**", "" "NO_I8", "Converts ``integer*8`` to ``integer*4``." "NO_R16", "Converts ``real*16`` to ``real*8``." + "NO_SNICARHC", "Does not compile hardcoded (HC) 5 band snicar tables tables needed by ``shortwave=dEdd_snicar_ad``. May reduce compile time." "USE_NETCDF", "Turns on netcdf capabilities in Icepack. By default and generally, Icepack does not need netcdf." - "USE_SNICARHC", "Compiles hardcoded (HC) tables needed for ``dEdd_snicar_ad``, which can lengthen the compile time considerably." "","" "**Application Macros**", "" "CESMCOUPLED", "Turns on code changes for the CESM coupled application " @@ -103,11 +103,11 @@ can be modified as needed. "NBGCLYR", "integer", "number of zbgc layers", "1" "TRZAERO", "0-6", "number of z aerosol tracers", "0" "TRALG", "0,1,2,3", "number of algal tracers", "0" - "TRDOC", "0,1,2,3", "number of dissolved organic carbon", "0" + "TRDOC", "0,1,2", "number of dissolved organic carbon", "0" "TRDIC", "0,1", "number of dissolved inorganic carbon", "0" "TRDON", "0,1", "number of dissolved organic nitrogen", "0" - "TRFEP", "0,1,2", "number of particulate iron tracers", "0" - "TRFED", "0,1,2", "number of dissolved iron tracers", "0" + "TRFEP", "0,1", "number of particulate iron tracers", "0" + "TRFED", "0,1", "number of dissolved iron tracers", "0" "ICE_SNICARHC", "true,false", "include hardcoded (HC) snicar tables", "false" "ICE_BLDDEBUG", "true,false", "turn on compile debug flags", "false" "ICE_COVERAGE", "true,false", "turn on code coverage flags", "false" @@ -115,8 +115,8 @@ can be modified as needed. .. _tabnamelist: -Table of Namelist Inputs --------------------------- +Tables of Namelist Options +---------------------------- The Icepack driver reads a namelist input file, **icepack_in**, consisting of several namelist groups. The tables below summarize the different groups and the variables in each group. The variables are organized alphabetically @@ -265,7 +265,7 @@ shortwave_nml "``shortwave``", "``ccsm3``", "NCAR CCSM3 shortwave distribution method", "``dEdd``" "", "``dEdd``", "Delta-Eddington method (3-band)", "" "", "``dEdd_snicar_ad``", "Delta-Eddington method with 5-band snow", "" - "``snw_ssp_table``", "``snicar``", "lookup table for `dEdd_snicar_ad`", "" + "``snw_ssp_table``", "``snicar``", "lookup table for `dEdd_snicar_ad`", "test" "", "``test``", "reduced lookup table for `dEdd_snicar_ad` testing", "" "``sw_dtemp``", "real", "temperature from melt for sw_redist", "0.02" "``sw_frac``", "real", "fraction of shortwave redistribution", "0.9" @@ -284,7 +284,7 @@ ponds_nml "``frzpnd``", "``cesm``", "CESM pond refreezing forumulation", "``cesm``" "", "``hlid``", "Stefan refreezing with pond ice thickness", "" "``hp1``", "real", "critical ice lid thickness for topo ponds in m", "0.01" - "``hs0``", "real", "snow depth of transition to bare sea ice in m", "" + "``hs0``", "real", "snow depth of transition to bare sea ice in m", "0.03" "``hs1``", "real", "snow depth of transition to pond ice in m", "0.03" "``pndaspect``", "real", "aspect ratio of pond changes (depth:area)", "0.8" "``rfracmax``", ":math:`0 \le r_{max} \le 1`", "maximum melt water added to ponds", "0.85" @@ -307,12 +307,12 @@ snow_nml "``rsnw_tmax``", "real", "maximum snow radius (um)", "1500.0" "``snw_aging_table``", "test", "snow aging lookup table", "test" "", "snicar", "(not available in Icepack)", "" - "``snwgrain``", "logical", "snow grain metamorphosis", ".true." + "``snwgrain``", "logical", "snow grain metamorphosis", ".false." "``snwlvlfac``", "real", "fraction increase in bulk snow redistribution", "0.3" - "``snwredist``", "``snwITDrdg``", "snow redistribution using ITD/ridges", "snwITDrdg" + "``snwredist``", "``snwITDrdg``", "snow redistribution using ITD/ridges", "none" "", "``bulk``", "bulk snow redistribution", "" "", "``none``", "no snow redistribution", "" - "``use_smliq_pnd``", "logical", "use liquid in snow for ponds", ".true." + "``use_smliq_pnd``", "logical", "use liquid in snow for ponds", ".false." "``windmin``", "real", "minimum wind speed to compact snow", "10.0" "", "", "", "" @@ -344,6 +344,11 @@ forcing_nml "``calc_strair``", "``.false.``", "read wind stress and speed from files", "``.true.``" "", "``.true.``", "calculate wind stress and speed", "" "``calc_Tsfc``", "logical", "calculate surface temperature", "``.true.``" + "``congel_freeze``", "``one-step``", "immediately freeze congelation ice", "``two-step``" + "", "``two-step``", "delayed freezing of congelation ice", "" + "``cpl_frazil``", "``external``", "frazil water/salt fluxes are handled outside of Icepack", "``fresh_ice_correction``" + "", "``fresh_ice_correction``", "correct fresh-ice frazil water/salt fluxes for mushy physics", "" + "", "``internal``", "send full frazil water/salt fluxes for mushy physics", "" "``data_dir``", "string", "path to forcing data directory", "' '" "``default_season``", "``summer``", "forcing initial summer values", "``winter``" "", "``winter``", "forcing initial winter values", "" @@ -378,9 +383,6 @@ forcing_nml "", "``minus1p8``", "constant ocean freezing temperature (:math:`-1.8^{\circ} C`)", "" "", "``mushy``", "matches mushy-layer thermo (ktherm=2)", "" "``trestore``", "integer", "sst restoring time scale (days)", "90" - "``cpl_frazil``", "``external``", "frazil water/salt fluxes are handled outside of Icepack", "``fresh_ice_correction``" - "", "``fresh_ice_correction``", "correct fresh-ice frazil water/salt fluxes for mushy physics", "" - "", "``internal``", "send full frazil water/salt fluxes for mushy physics", "" "``update_ocn_f``", "``.false.``", "do not include frazil water/salt fluxes in ocn fluxes", "``.false.``" "", "``true``", "include frazil water/salt fluxes in ocn fluxes", "" "``ustar_min``", "real", "minimum value of ocean friction velocity in m/s", "0.005" @@ -390,69 +392,70 @@ forcing_nml "", "``random``", "wave data file is provided, sea surface height generated using random number (multiple iterations of wave fracture)", "" "``ycycle``", "integer", "number of years in forcing data cycle", "1" "", "", "", "" + +* = If Icepack is run stand-alone and wave_spec_type is not set to none, then a fixed wave spectrum is defined in the code to use for testing. As with other input data, this spectrum should not be used for production runs or publications. zbgc_nml ~~~~~~~~~~~~~~~~~~~~~~~~~ +.. _tab-bio-tracers-namelist2: + .. csv-table:: **zbgc_nml namelist options** :header: "variable", "options/format", "description", "default value" - :widths: 15, 15, 30, 15 + :widths: 15, 15, 30, 15 "", "", "", "" "``algaltype_diatoms``", "real", "mobility type between stationary and mobile algal diatoms", "0.0" - "``algaltype_phaeo``", "real", "mobility type between stationary and mobile algal phaeocystis", "0.5" - "``algaltype_sp``", "real", "mobility type between stationary and mobile small plankton", "0.5" - "``algal_vel``", "real", ":cite:`Lavoie05`", "1.11e-8" - "``alpha2max_low_diatoms``", "real", "light limitation diatoms 1/(W/m^2)", "0.8" - "``alpha2max_low_phaeo``", "real", "light limitation phaeocystis 1/(W/m^2)", "0.67" - "``alpha2max_low_sp``", "real", "light limitation small plankton 1/(W/m^2)", "0.67" - "``ammoniumtype``", "real", "mobility type between stationary and mobile ammonium", "1.0" - "``beta2max_diatoms``", "real", "light inhibition diatoms 1/(W/m^2)", "0.18" - "``beta2max_phaeo``", "real", "light inhibition phaeocystis 1/(W/m^2)", "0.01" - "``beta2max_sp``", "real", "light inhibition small plankton 1/(W/m^2)", "0.0025" - "``bgc_data_type``", "``clim``", "bgc climatological data", "``default``" - "", "``default``", "constant values defined in the code", "" - "", "``ncar``", "POP ocean forcing data", "" + "``algaltype_phaeo``", "real", "mobility type between stationary and mobile algal phaeocystis", "0.0" + "``algaltype_sp``", "real", "mobility type between stationary and mobile small plankton", "0.0" + "``algal_vel``", "real", "maximum speed of algae (m/s) :cite:`Lavoie05`", "1.0e-7" + "``alpha2max_low_diatoms``", "real", "light limitation diatoms 1/(W/m^2)", "0.3" + "``alpha2max_low_phaeo``", "real", "light limitation phaeocystis 1/(W/m^2)", "0.17" + "``alpha2max_low_sp``", "real", "light limitation small plankton 1/(W/m^2)", "0.2" + "``ammoniumtype``", "real", "mobility type between stationary and mobile ammonium", "0.0" + "``beta2max_diatoms``", "real", "light inhibition diatoms 1/(W/m^2)", "0.001" + "``beta2max_phaeo``", "real", "light inhibition phaeocystis 1/(W/m^2)", "0.04" + "``beta2max_sp``", "real", "light inhibition small plankton 1/(W/m^2)", "0.001" "``bgc_flux_type``", "``constant``", "constant ice–ocean flux velocity", "``Jin2006``" "", "``Jin2006``", "ice–ocean flux velocity of :cite:`Jin06`", "" "``chlabs_diatoms``", "real", "chl absorbtion diatoms 1/m/(mg/m^3)", "0.03" "``chlabs_phaeo``", "real", "chl absorbtion phaeocystis 1/m/(mg/m^3)", "0.05" "``chlabs_sp``", "real", "chl absorbtion small plankton 1/m/(mg/m^3)", "0.01" - "``dEdd_algae``", "logical", "", "``.false.``" - "``dmspdtype``", "real", "mobility type between stationary and mobile dmspd", "-1.0" + "``dEdd_algae``", "logical", "include ice bgc and/or aerosols in radiative transfer", "``.false.``" + "``dmspdtype``", "real", "mobility type between stationary and mobile dmspd", "0.0" "``dmspptype``", "real", "mobility type between stationary and mobile dmspp", "0.5" - "``doctype_l``", "real", "mobility type between stationary and mobile doc lipids", "0.5" - "``doctype_s``", "real", "mobility type between stationary and mobile doc saccharids", "0.5" - "``dontype_protein``", "real", "mobility type between stationary and mobile don proteins", "0.5" + "``doctype_l``", "real", "mobility type between stationary and mobile doc lipids", "0.0" + "``doctype_s``", "real", "mobility type between stationary and mobile doc saccharids", "0.0" + "``dontype_protein``", "real", "mobility type between stationary and mobile don proteins", "0.0" "``dustFe_sol``", "real", "solubility fraction", "0.005" - "``fedtype_1``", "real", "mobility type between stationary and mobile fed lipids", "0.5" + "``fedtype_1``", "real", "mobility type between stationary and mobile fed lipids", "0.0" "``feptype_1``", "real", "mobility type between stationary and mobile fep lipids", "0.5" - "``frazil_scav``", "real", "increase in initial bio bracer from ocean scavenging", "1.0" - "``fr_dFe``", "real", "fraction of remineralized nitrogen in units of algal iron", "0.3" - "``fr_graze_diatoms``", "real", "fraction grazed diatoms", "0.01" + "``frazil_scav``", "real", "increase in initial bio bracer from ocean scavenging", "0.8" + "``fr_dFe``", "real", "fraction of remineralized iron from algae", "1.0" + "``fr_graze_diatoms``", "real", "fraction grazed diatoms", "0.19" "``fr_graze_e``", "real", "fraction of assimilation excreted", "0.5" - "``fr_graze_phaeo``", "real", "fraction grazed phaeocystis", "0.1" + "``fr_graze_phaeo``", "real", "fraction grazed phaeocystis", "0.19" "``fr_graze_s``", "real", "fraction of grazing spilled or slopped", "0.5" - "``fr_graze_sp``", "real", "fraction grazed small plankton", "0.1" - "``fr_mort2min``", "real", "fractionation of mortality to Am", "0.5" - "``fr_resp``", "real", "frac of algal growth lost due to respiration", "0.05" - "``fr_resp_s``", "real", "DMSPd fraction of respiration loss as DMSPd", "0.75" + "``fr_graze_sp``", "real", "fraction grazed small plankton", "0.19" + "``fr_mort2min``", "real", "fractionation of mortality to Am", "0.9" + "``fr_resp``", "real", "fraction of algal growth lost due to respiration", "0.05" + "``fr_resp_s``", "real", "DMSPd fraction of respiration loss as DMSPd", "0.9" "``fsal``", "real", "salinity limitation ppt", "1.0" "``F_abs_chl_diatoms``", "real", "scales absorbed radiation for dEdd chl diatoms", "2.0" "``F_abs_chl_phaeo``", "real", "scales absorbed radiation for dEdd chl phaeocystis", "5.0" "``F_abs_chl_sp``", "real", "scales absorbed radiation for dEdd small plankton", "4.0" - "``f_doc_l``", "real", "fraction of mortality to DOC lipids", "0.4" - "``f_doc_s``", "real", "fraction of mortality to DOC saccharides", "0.4" - "``f_don_Am_protein``", "real", "fraction of remineralized DON to ammonium", "0.25" + "``f_doc_l``", "real", "fraction of mortality to DOC lipids", "0.5" + "``f_doc_s``", "real", "fraction of mortality to DOC saccharides", "0.5" + "``f_don_Am_protein``", "real", "fraction of remineralized DON to ammonium", "1.0" "``f_don_protein``", "real", "fraction of spilled grazing to proteins", "0.6" "``f_exude_l``", "real", "fraction of exudation to DOC lipids", "1.0" "``f_exude_s``", "real", "fraction of exudation to DOC saccharids", "1.0" - "``grid_o``", "real", "z biology for bottom flux", "5.0" + "``grid_o``", "real", "z biology length scale for bottom flux (m)", "0.006" "``grid_oS``", "real", "DEPRECATED", "" - "``grow_Tdep_diatoms``", "real", "temperature dependence growth diatoms per degC", "0.06" - "``grow_Tdep_phaeo``", "real", "temperature dependence growth phaeocystis per degC", "0.06" - "``grow_Tdep_sp``", "real", "temperature dependence growth small plankton per degC", "0.06" - "``humtype``", "real", "mobility type between stationary and mobile hum", "1.0" + "``grow_Tdep_diatoms``", "real", "temperature dependence growth diatoms per degC", "0.063" + "``grow_Tdep_phaeo``", "real", "temperature dependence growth phaeocystis per degC", "0.063" + "``grow_Tdep_sp``", "real", "temperature dependence growth small plankton per degC", "0.063" + "``humtype``", "real", "mobility type between stationary and mobile hum", "0.0" "``initbio_frac``", "real", "fraction of ocean trcr concentration in bio tracers", "1.0" "``K_Am_diatoms``", "real", "ammonium half saturation diatoms mmol/m^3", "0.3" "``K_Am_phaeo``", "real", "ammonium half saturation phaeocystis mmol/m^3", "0.3" @@ -465,45 +468,45 @@ zbgc_nml "``K_Fe_diatoms``", "real", "iron half saturation diatoms nM", "1.0" "``K_Fe_phaeo``", "real", "iron half saturation phaeocystis nM", "0.1" "``K_Fe_sp``", "real", "iron half saturation small plankton nM", "0.2" - "``k_nitrif``", "real", "nitrification rate per day", "0.0" + "``k_nitrif``", "real", "nitrification rate per day", "0.046" "``K_Nit_diatoms``", "real", "nitrate half saturation diatoms mmol/m^3", "1.0" "``K_Nit_phaeo``", "real", "nitrate half saturation phaeocystis mmol/m^3", "1.0" "``K_Nit_sp``", "real", "nitrate half saturation small plankton mmol/m^3", "1.0" "``K_Sil_diatoms``", "real", "silicate half saturation diatoms mmol/m^3", "4.0" "``K_Sil_phaeo``", "real", "silicate half saturation phaeocystis mmol/m^3", "0.0" "``K_Sil_sp``", "real", "silicate half saturation small plankton mmol/m^3", "0.0" - "``kn_bac_protein``", "real", "bacterial degradation of DON per day", "0.03" - "``l_sk``", "real", "characteristic diffusive scale in m", "7.0" + "``kn_bac_protein``", "real", "bacterial degradation of DON per day", "0.2" + "``l_sk``", "real", "characteristic diffusive scale in m", "2.0" "``l_skS``", "real", "DEPRECATED", "" "``max_dfe_doc1``", "real", "max ratio of dFe to saccharides in the ice in nm Fe / muM C", "0.2" "``max_loss``", "real", "restrict uptake to percent of remaining value", "0.9" - "``modal_aero``", "logical", "modal aersols", "``.false.``" - "``mort_pre_diatoms``", "real", "mortality diatoms", "0.007" - "``mort_pre_phaeo``", "real", "mortality phaeocystis", "0.007" - "``mort_pre_sp``", "real", "mortality small plankton", "0.007" + "``modal_aero``", "logical", "modal aerosols", "``.false.``" + "``mort_pre_diatoms``", "real", "mortality diatoms per day", "0.007" + "``mort_pre_phaeo``", "real", "mortality phaeocystis per day", "0.007" + "``mort_pre_sp``", "real", "mortality small plankton per day", "0.007" "``mort_Tdep_diatoms``", "real", "temperature dependence of mortality diatoms per degC", "0.03" "``mort_Tdep_phaeo``", "real", "temperature dependence of mortality phaeocystis per degC", "0.03" "``mort_Tdep_sp``", "real", "temperature dependence of mortality small plankton per degC", "0.03" - "``mu_max_diatoms``", "real", "maximum growth rate diatoms per day", "1.2" - "``mu_max_phaeo``", "real", "maximum growth rate phaeocystis per day", "0.851" - "``mu_max_sp``", "real", "maximum growth rate small plankton per day", "0.851" + "``mu_max_diatoms``", "real", "maximum growth rate diatoms per day", "1.44" + "``mu_max_phaeo``", "real", "maximum growth rate phaeocystis per day", "0.63" + "``mu_max_sp``", "real", "maximum growth rate small plankton per day", "0.41" "``nitratetype``", "real", "mobility type between stationary and mobile nitrate", "-1.0" "``op_dep_min``", "real", "light attenuates for optical depths exceeding min", "0.1" - "``phi_snow``", "real", "snow porosity for brine height tracer", "0.5" + "``phi_snow``", "real", "snow porosity for brine height tracer (compute from snow density if negative)", "-1.0" "``ratio_chl2N_diatoms``", "real", "algal chl to N in mg/mmol diatoms", "2.1" "``ratio_chl2N_phaeo``", "real", "algal chl to N in mg/mmol phaeocystis", "0.84" "``ratio_chl2N_sp``", "real", "algal chl to N in mg/mmol small plankton", "1.1" "``ratio_C2N_diatoms``", "real", "algal C to N in mol/mol diatoms", "7.0" "``ratio_C2N_phaeo``", "real", "algal C to N in mol/mol phaeocystis", "7.0" - "``ratio_C2N_proteins``", "real", "algal C to N in mol/mol proteins", "7.0" + "``ratio_C2N_proteins``", "real", "algal C to N in mol/mol proteins", "5.0" "``ratio_C2N_sp``", "real", "algal C to N in mol/mol small plankton", "7.0" - "``ratio_Fe2C_diatoms``", "real", "algal Fe to C in umol/mol diatoms", "0.0033" - "``ratio_Fe2C_phaeo``", "real", "algal Fe to C in umol/mol phaeocystis", "1.0" - "``ratio_Fe2C_sp``", "real", "algal Fe to C in umol/mol small plankton", "0.0033" - "``ratio_Fe2N_diatoms``", "real", "algal Fe to N in umol/mol diatoms", "0.23" - "``ratio_Fe2N_phaeo``", "real", "algal Fe to N in umol/mol phaeocystis", "0.7" - "``ratio_Fe2N_sp``", "real", "algal Fe to N in umol/mol small plankton", "0.23" - "``ratio_Fe2DOC_s``", "real", "Fe to C of DON saccharids nmol/umol", "1.0" + "``ratio_Fe2C_diatoms``", "real", "algal Fe to C in mmol/mol diatoms", "0.0033" + "``ratio_Fe2C_phaeo``", "real", "algal Fe to C in mmol/mol phaeocystis", "0.1" + "``ratio_Fe2C_sp``", "real", "algal Fe to C in mmol/mol small plankton", "0.0033" + "``ratio_Fe2N_diatoms``", "real", "algal Fe to N in mmol/mol diatoms", "0.023" + "``ratio_Fe2N_phaeo``", "real", "algal Fe to N in mmol/mol phaeocystis", "0.7" + "``ratio_Fe2N_sp``", "real", "algal Fe to N in mmol/mol small plankton", "0.023" + "``ratio_Fe2DOC_s``", "real", "Fe to C of DON saccharids nmol/umol", "0.1" "``ratio_Fe2DOC_l``", "real", "Fe to C of DOC lipids nmol/umol", "0.033" "``ratio_Fe2DON``", "real", "Fe to C of DON nmol/umol", "0.023" "``ratio_Si2N_diatoms``", "real", "algal Si to N in mol/mol diatoms", "1.8" @@ -512,39 +515,39 @@ zbgc_nml "``ratio_S2N_diatoms``", "real", "algal S to N in mol/mol diatoms", "0.03" "``ratio_S2N_phaeo``", "real", "algal S to N in mol/mol phaeocystis", "0.03" "``ratio_S2N_sp``", "real", "algal S to N in mol/mol small plankton", "0.03" - "``restore_bgc``", "logical", "restore bgc to data", "``.false.``" + "``restore_bgc``", "logical", "DEPRECATED", "``.false.``" "``R_dFe2dust``", "real", "g/g :cite:`Tagliabue09`", "0.035" - "``scale_bgc``", "logical", "", "``.false.``" + "``scale_bgc``", "logical", "initialize bgc by scaling with salinity", "``.false.``" "``silicatetype``", "real", "mobility type between stationary and mobile silicate", "-1.0" - "``skl_bgc``", "logical", "biogeochemistry", "``.false.``" - "``solve_zbgc``", "logical", "", "``.false.``" + "``skl_bgc``", "logical", "DEPRECATED: skeletal layer biogeochemistry", "``.false.``" + "``solve_zbgc``", "logical", "solve z-biogeochemistry reactions", "``.false.``" "``solve_zsal``", "logical", "DEPRECATED", "``.false.``" - "``tau_max``", "real", "long time mobile to stationary exchanges", "1.73e-5" - "``tau_min``", "real", "rapid module to stationary exchanges", "5200." + "``tau_max``", "real", "long time mobile to stationary exchanges (s)", "604800.0" + "``tau_min``", "real", "rapid module to stationary exchanges (s)", "3600.0" "``tr_bgc_Am``", "logical", "ammonium tracer", "``.false.``" "``tr_bgc_C``", "logical", "algal carbon tracer", "``.false.``" "``tr_bgc_chl``", "logical", "algal chlorophyll tracer", "``.false.``" "``tr_bgc_DMS``", "logical", "DMS tracer", "``.false.``" "``tr_bgc_DON``", "logical", "DON tracer", "``.false.``" "``tr_bgc_Fe``", "logical", "iron tracer", "``.false.``" - "``tr_bgc_hum``", "logical", "", "``.false.``" - "``tr_bgc_Nit``", "logical", "", "``.false.``" - "``tr_bgc_PON``", "logical", "PON tracer", "``.false.``" + "``tr_bgc_hum``", "logical", "refractory DOC", "``.false.``" + "``tr_bgc_Nit``", "logical", "nitrate tracer", "``.false.``" + "``tr_bgc_PON``", "logical", "Non-reactive nitrate tracer", "``.false.``" "``tr_bgc_Sil``", "logical", "silicate tracer", "``.false.``" "``tr_brine``", "logical", "brine height tracer", "``.false.``" "``tr_zaero``", "logical", "vertical aerosol tracers", "``.false.``" "``t_iron_conv``", "real", "desorption loss pFe to dFe in days", "3065." - "``t_sk_conv``", "real", "Stefels conversion time in days", "3.0" - "``t_sk_ox``", "real", "DMS oxidation time in days", "10.0" - "``T_max``", "real", "maximum temperature degC", "0.0" - "``y_sk_DMS``", "real", "fraction conversion given high yield", "0.5" - "``zaerotype_bc1``", "real", "mobility type between stationary and mobile zaero bc1", "1.0" - "``zaerotype_bc2``", "real", "mobility type between stationary and mobile zaero bc2", "1.0" - "``zaerotype_dust1``", "real", "mobility type between stationary and mobile zaero dust1", "1.0" - "``zaerotype_dust2``", "real", "mobility type between stationary and mobile zaero dust2", "1.0" - "``zaerotype_dust3``", "real", "mobility type between stationary and mobile zaero dust3", "1.0" - "``zaerotype_dust4``", "real", "mobility type between stationary and mobile zaero dust4", "1.0" - "``z_tracers``", "logical", "", "``.false.``" + "``t_sk_conv``", "real", "Stefels conversion time in days", "5.0" + "``t_sk_ox``", "real", "DMS oxidation time in days", "12.0" + "``T_max``", "real", "maximum brine temperature degC", "0.0" + "``y_sk_DMS``", "real", "fraction conversion given high yield", "0.7" + "``zaerotype_bc1``", "real", "mobility type between stationary and mobile zaero bc1", "-1.0" + "``zaerotype_bc2``", "real", "mobility type between stationary and mobile zaero bc2", "-1.0" + "``zaerotype_dust1``", "real", "mobility type between stationary and mobile zaero dust1", "-1.0" + "``zaerotype_dust2``", "real", "mobility type between stationary and mobile zaero dust2", "-1.0" + "``zaerotype_dust3``", "real", "mobility type between stationary and mobile zaero dust3", "-1.0" + "``zaerotype_dust4``", "real", "mobility type between stationary and mobile zaero dust4", "-1.0" + "``z_tracers``", "logical", "allows vertically resolved bgc and/or z-aerosol tracers", "``.false.``" "", "", "", "" @@ -560,19 +563,18 @@ zbgc_nml .. "``restart_hbrine``", "logical", "", "``.false.``" .. "``solve_zsal``", "logical", "update salinity tracer profile", "``.false.``" .. "TRZS", "0,1", "zsalinity tracer, needs TRBRI=1", "0" - -* = If Icepack is run stand-alone and wave_spec_type is not set to none, then a fixed wave spectrum is defined in the code to use for testing. As with other input data, this spectrum should not be used for production runs or publications. .. _tuning: -BGC Tuning Parameters +BGC Parameter Arrays ------------------------ -Biogeochemical tuning parameters are specified as namelist options in -**icepack\_in**. Table :ref:`tab-bio-tracers2` provides a list of parameters + +Biogeochemical parameter arrays are specified in the code from namelist options in +**icepack\_in**. Table :ref:`tab-bio-tracers2` provides a list of parameter arrays used in the reaction equations, their representation in the code, a -short description of each and the default values. Please keep in mind -that there has only been minimal tuning of the model. +short description of each and the namelist parameters (Table :ref:`tab-bio-tracers-namelist2`) +used in their definition. .. _tab-bio-tracers2: @@ -580,41 +582,22 @@ that there has only been minimal tuning of the model. :header: "Text Variable", "Variable in code", "Description", "Value", "units" :widths: 7, 20, 15, 15, 15 - ":math:`f_{graze}`", "fr\_graze(1:3)", "fraction of growth grazed", "0, 0.1, 0.1", "1" - ":math:`f_{res}`", "fr\_resp", "fraction of growth respired", "0.05", "1" - ":math:`l_{max}`", "max\_loss", "maximum tracer loss fraction", "0.9", "1" - ":math:`m_{pre}`", "mort\_pre(1:3)", "maximum mortality rate", "0.007, 0.007, 0.007", "day\ :math:`^{-1}`" - ":math:`m_{T}`", "mort\_Tdep(1:3)", "mortality temperature decay", "0.03, 0.03, 0.03", ":math:`^o`\ C\ :math:`^{-1}`" - ":math:`T_{max}`", "T\_max", "maximum brine temperature", "0", ":math:`^o`\ C" - ":math:`k_{nitr}`", "k\_nitrif", "nitrification rate", "0", "day\ :math:`^{-1}`" - ":math:`f_{ng}`", "fr\_graze\_e", "fraction of grazing excreted", "0.5", "1" - ":math:`f_{gs}`", "fr\_graze\_s", "fraction of grazing spilled", "0.5", "1" - ":math:`f_{nm}`", "fr\_mort2min", "fraction of mortality to :math:`{\mbox{NH$_4$}}`", "0.5", "1" - ":math:`f_{dg}`", "f\_don", "frac. spilled grazing to :math:`{\mbox{DON}}`", "0.6", "1" - ":math:`k_{nb}`", "kn\_bac :math:`^a`", "bacterial degradation of :math:`{\mbox{DON}}`", "0.03", "day\ :math:`^{-1}`" - ":math:`f_{cg}`", "f\_doc(1:3)", "fraction of mortality to :math:`{\mbox{DOC}}`", "0.4, 0.4, 0.2 ", "1" - ":math:`R_{c:n}^c`", "R\_C2N(1:3)", "algal carbon to nitrogen ratio", "7.0, 7.0, 7.0", "mol/mol" - ":math:`k_{cb}`", "k\_bac1:3\ :math:`^a`", "bacterial degradation of DOC", "0.03, 0.03, 0.03", "day\ :math:`^{-1}`" - ":math:`\tau_{fe}`", "t\_iron\_conv", "conversion time pFe :math:`\leftrightarrow` dFe", "3065.0 ", "day" - ":math:`r^{max}_{fed:doc}`", "max\_dfe\_doc1", "max ratio of dFe to saccharids", "0.1852", "nM Fe\ :math:`/\mu`\ M C" - ":math:`f_{fa}`", "fr\_dFe ", "fraction of remin. N to dFe", "0.3", "1" - ":math:`R_{fe:n}`", "R\_Fe2N(1:3)", "algal Fe to N ratio", "0.023, 0.023, 0.7", "mmol/mol" - ":math:`R_{s:n}`", "R\_S2N(1:3)", "algal S to N ratio", "0.03, 0.03, 0.03", "mol/mol" - ":math:`f_{sr}`", "fr\_resp\_s", "resp. loss as DMSPd", "0.75", "1" - ":math:`\tau_{dmsp}`", "t\_sk\_conv", "Stefels rate", "3.0", "day" - ":math:`\tau_{dms}`", "t\_sk\_ox", "DMS oxidation rate", "10.0", "day" - ":math:`y_{dms}`", "y\_sk\_DMS", "yield for DMS conversion", "0.5", "1" - ":math:`K_{{\mbox{NO$_3$}}}`", "K\_Nit(1:3)", ":math:`{\mbox{NO$_3$}}` half saturation constant", "1,1,1", "mmol/m\ :math:`^{3}`" - ":math:`K_{{\mbox{NH$_4$}}}`", "K\_Am(1:3)", ":math:`{\mbox{NH$_4$}}` half saturation constant", "0.3, 0.3, 0.3", "mmol/m\ :math:`^{-3}`" - ":math:`K_{{\mbox{SiO$_3$}}}`", "K\_Sil(1:3)", "silicate half saturation constant", "4.0, 0, 0", "mmol/m\ :math:`^{-3}`" - ":math:`K_{{\mbox{fed}}}`", "K\_Fe(1:3)", "iron half saturation constant", "1.0, 0.2, 0.1", ":math:`\mu`\ mol/m\ :math:`^{-3}`" - ":math:`op_{min}`", "op\_dep\_min", "boundary for light attenuation", "0.1", "1" - ":math:`chlabs`", "chlabs(1:3)", "light absorption length per chla conc.", "0.03, 0.01, 0.05", "1\ :math:`/`\ m\ :math:`/`\ (mg\ :math:`/`\ m\ :math:`^{3}`)" - ":math:`\alpha`", "alpha2max\_low(1:3)", "light limitation factor", "0.25, 0.25, 0.25", "m\ :math:`^2`/W" - ":math:`\beta`", "beta2max(1:3)", "light inhibition factor", "0.018, 0.0025, 0.01", "m\ :math:`^2`/W" - ":math:`\mu_{max}`", "mu\_max(1:3)", "maximum algal growth rate", "1.44, 0.851, 0.851", "day\ :math:`^{-1}`" - ":math:`\mu_T`", "grow\_Tdep(1:3)", "temperature growth factor", "0.06, 0.06, 0.06", "day\ :math:`^{-1}`" - ":math:`f_{sal}`", "fsal", "salinity growth factor", "1", "1" - ":math:`R_{si:n}`", "R\_Si2N(1:3)", "algal silicate to nitrogen", "1.8, 0, 0", "mol/mol" - -:math:`^a` only (1:2) of DOC and DOC parameters have physical meaning + ":math:`f_{graze}`", "fr\_graze(1:3)", "fraction of growth grazed", "(``fr_graze_diatoms``, ``fr_graze_sp``, ``fr_graze_phaeo``)", "1" + ":math:`m_{pre}`", "mort\_pre(1:3)", "maximum mortality rate", "(``mort_pre_diatoms``, ``mort_pre_sp``, ``mort_pre_phaeo``)", "day\ :math:`^{-1}`" + ":math:`m_{T}`", "mort\_Tdep(1:3)", "mortality temperature decay", "(``mort_Tdep_diatoms``, ``mort_Tdep_sp``, ``mort_Tdep_phaeo``)", ":math:`^o`\ C\ :math:`^{-1}`" + ":math:`f_{cg}`", "f\_doc(1:2)", "fraction of mortality to :math:`{\mbox{DOC}}`", "(``f_doc_s``, ``f_doc_l``)", "1" + ":math:`R_{c:n}`", "R\_C2N(1:3)", "algal carbon to nitrogen ratio", "(``ratio_C2N_diatoms``, ``ratio_C2N_sp``, ``ratio_C2N_phaeo``)", "mol/mol" + ":math:`k_{cb}`", "k\_bac(1:2)", "bacterial degradation of DOC", "(``k_bac_s``, ``k_bac_l``)", "day\ :math:`^{-1}`" + ":math:`R_{fe:n}`", "R\_Fe2N(1:3)", "algal Fe to N ratio", "(``ratio_Fe2N_diatoms``, ``ratio_Fe2N_sp``, ``ratio_Fe2N_phaeo``)", "mmol/mol" + ":math:`R_{s:n}`", "R\_S2N(1:3)", "algal S to N ratio", "(``ratio_S2N_diatoms``, ``ratio_S2N_sp``, ``ratio_S2N_phaeo``)", "mol/mol" + ":math:`K_{{\mbox{NO$_3$}}}`", "K\_Nit(1:3)", ":math:`{\mbox{NO$_3$}}` half saturation constant", "(``K_Nit_diatoms``, ``K_Nit_sp``, ``K_Nit_phaeo``)", "mmol/m\ :math:`^{3}`" + ":math:`K_{{\mbox{NH$_4$}}}`", "K\_Am(1:3)", ":math:`{\mbox{NH$_4$}}` half saturation constant", "(``K_Am_diatoms``, ``K_Am_sp``, ``K_Am_phaeo``)", "mmol/m\ :math:`^{-3}`" + ":math:`K_{{\mbox{SiO$_3$}}}`", "K\_Sil(1:3)", "silicate half saturation constant", "(``K_Sil_diatoms``, ``K_Sil_sp``, ``K_Sil_phaeo``)", "mmol/m\ :math:`^{-3}`" + ":math:`K_{{\mbox{fed}}}`", "K\_Fe(1:3)", "iron half saturation constant", "(``K_Fe_diatoms``, ``K_Fe_sp``, ``K_Fe_phaeo``)", ":math:`\mu`\ mol/m\ :math:`^{-3}`" + ":math:`chlabs`", "chlabs(1:3)", "light absorption length per chla conc.", "(``chlabs_diatoms``, ``chlabs_sp``, ``chlabs_phaeo``)", "1\ :math:`/`\ m\ :math:`/`\ (mg\ :math:`/`\ m\ :math:`^{3}`)" + + ":math:`\alpha`", "alpha2max\_low(1:3)", "light limitation factor", "(``alpha2max_low_diatoms``, ``alpha2max_low_sp``, ``alpha2max_low_phaeo``)", "m\ :math:`^2`/W" + ":math:`\beta`", "beta2max(1:3)", "light inhibition factor", "(``beta2max_diatoms``, ``beta2max_sp``, ``beta2max_phaeo``)", "m\ :math:`^2`/W" + ":math:`\mu_{max}`", "mu\_max(1:3)", "maximum algal growth rate", "(``mu_max_diatoms``, ``mu_max_sp``, ``mu_max_phaeo``)", "day\ :math:`^{-1}`" + ":math:`\mu_T`", "grow\_Tdep(1:3)", "temperature growth factor", "(``grow_Tdep_diatoms``, ``grow_Tdep_sp``, ``grow_Tdep_phaeo``)", "day\ :math:`^{-1}`" + ":math:`R_{si:n}`", "R\_Si2N(1:3)", "algal silicate to nitrogen", "(``ratio_Si2N_diatoms``, ``ratio_Si2N_sp``, ``ratio_Si2N_phaeo``)", "mol/mol"