diff --git a/columnphysics/icepack_aerosol.F90 b/columnphysics/icepack_aerosol.F90 index 8e6a4933c..da0715e79 100644 --- a/columnphysics/icepack_aerosol.F90 +++ b/columnphysics/icepack_aerosol.F90 @@ -8,8 +8,8 @@ module icepack_aerosol use icepack_kinds - use icepack_parameters, only: c0, c1, c2, puny, rhoi, rhos, hs_min - use icepack_parameters, only: hi_ssl, hs_ssl + use icepack_parameters, only: c0, c1, c2, p5, puny, rhoi, rhos, hs_min + use icepack_parameters, only: hi_ssl, hs_ssl, hs_ssl_min use icepack_tracers, only: max_aero use icepack_warnings, only: warnstr, icepack_warnings_add use icepack_warnings, only: icepack_warnings_setabort, icepack_warnings_aborted @@ -27,8 +27,8 @@ module icepack_aerosol !======================================================================= -! Increase aerosol in ice or snow surface due to deposition -! and vertical cycling +! Deposition and vertical cycling of aerosol in ice or snow +! Called from icepack_step_therm1 when tr_aero=T (not used for zbgc tracers) subroutine update_aerosol(dt, & nilyr, nslyr, & @@ -128,6 +128,7 @@ subroutine update_aerosol(dt, & hs = vsnon*ar hi = vicen*ar + ! fluxes were divided by aice for thermo, not yet multiplied by aice dhs_melts = -melts dhi_snoice = snoice dhs_snoice = dhi_snoice*rhoi/rhos @@ -424,8 +425,8 @@ end subroutine update_aerosol !======================================================================= -! Increase aerosol in snow surface due to deposition -! and vertical cycling : after update_aerosol +! Aerosol in snow for vertical biogeochemistry with mushy thermodynamics +! Called from icepack_algae.F90 when z_tracers=T (replaces update_aerosol) subroutine update_snow_bgc (dt, nblyr, & nslyr, & @@ -438,7 +439,8 @@ subroutine update_snow_bgc (dt, nblyr, & vice_old, vsno_old, & vicen, vsnon, & aicen, flux_bio_atm,& - zbgc_atm, flux_bio) + zbgc_atm, flux_bio, & + bio_index_o) integer (kind=int_kind), intent(in) :: & nbtrcr, & ! number of distinct snow tracers @@ -447,7 +449,8 @@ subroutine update_snow_bgc (dt, nblyr, & ntrcr ! number of tracers integer (kind=int_kind), dimension (nbtrcr), intent(in) :: & - bio_index + bio_index, & + bio_index_o ! provides index of scavenging (kscavz) data array real (kind=dbl_kind), intent(in) :: & dt ! time step @@ -466,9 +469,11 @@ subroutine update_snow_bgc (dt, nblyr, & vice_old, & vsno_old - real (kind=dbl_kind),dimension(nbtrcr), intent(inout) :: & + real (kind=dbl_kind), dimension(nbtrcr), intent(out) :: & zbgc_snow, & ! aerosol contribution from snow to ice - zbgc_atm, & ! and atm to ice concentration * volume (kg or mmol/m^3*m) + zbgc_atm ! and atm to ice concentration * volume (kg or mmol/m^3*m) + + real (kind=dbl_kind),dimension(nbtrcr), intent(inout) :: & flux_bio ! total ocean tracer flux (mmol/m^2/s) real (kind=dbl_kind), dimension(nbtrcr), intent(in) :: & @@ -484,6 +489,9 @@ subroutine update_snow_bgc (dt, nblyr, & real (kind=dbl_kind) :: & dzssl, dzssl_new, & ! snow ssl thickness dzint, dzint_new, & ! snow interior thickness + dz, & ! + hi, & ! ice thickness (m) + hilyr, & ! ice layer thickness (m) hs, & ! snow thickness (m) dhs_evap, & ! snow thickness change due to evap dhs_melts, & ! ... due to surface melt @@ -516,38 +524,53 @@ subroutine update_snow_bgc (dt, nblyr, & zbgc_atm(:) = c0 hs_old = vsno_old/aice_old + if (aice_old .gt. puny) then + hs_old = vsno_old/aice_old + else + hs_old = c0 + end if hslyr_old = hs_old/real(nslyr,kind=dbl_kind) - dzssl = min(hslyr_old/c2, hs_ssl) + dzssl = hslyr_old/c2 dzint = hs_old - dzssl if (aicen > 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 +588,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 +638,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 +677,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 +731,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 +768,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 +801,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..6163c52f1 100644 --- a/columnphysics/icepack_algae.F90 +++ b/columnphysics/icepack_algae.F90 @@ -10,7 +10,7 @@ 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 @@ -27,11 +27,12 @@ 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: ntrcr, 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,7 +40,7 @@ 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 @@ -48,12 +49,13 @@ module icepack_algae 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,8 +68,8 @@ 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 @@ -81,7 +83,7 @@ subroutine zbio (dt, nblyr, & snoice, nbtrcr, & fsnow, ntrcr, & trcrn, bio_index, & - aice_old, & + bio_index_o, aice_old, & vice_old, vsno_old, & vicen, vsnon, & aicen, flux_bio_atm,& @@ -91,24 +93,29 @@ subroutine zbio (dt, nblyr, & n_fed, n_fep, & n_zaero, 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, & + darcy_V, & + bgrid, & igrid, icgrid, & 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 @@ -122,7 +129,8 @@ subroutine zbio (dt, nblyr, & ntrcr ! number of tracers 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,9 +160,10 @@ 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) :: & @@ -164,7 +173,8 @@ subroutine zbio (dt, nblyr, & 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 @@ -187,6 +197,10 @@ subroutine zbio (dt, nblyr, & !change to inout when updating ocean fields ocean_bio ! ocean concentrations (mmol/m^3) + real (kind=dbl_kind), dimension (nbtrcr), 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 @@ -194,7 +208,13 @@ subroutine zbio (dt, nblyr, & PP_net , & ! net PP (mg C/m^2/d) times aice grow_net , & ! net specific growth (m/d) times vice upNO , & ! tot nitrate uptake rate (mmol/m^2/d) times aice - upNH ! tot ammonium uptake rate (mmol/m^2/d) times aice + upNH , & ! tot ammonium uptake rate (mmol/m^2/d) times aice + totalChla ! total chla (mg chla/m^2) + + real (kind=dbl_kind), dimension (nblyr+1), intent(inout):: & ! diagnostics + 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 +229,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,14 +240,17 @@ subroutine zbio (dt, nblyr, & real (kind=dbl_kind) :: & hsnow_i, & ! initial snow thickness (m) - hsnow_f ! final snow thickness (m) + hsnow_f, & ! final snow thickness (m) + carbonError ! carbon conservation error (mmol/m2) + + real (kind=dbl_kind) :: & + 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 - real (kind=dbl_kind) :: & - a_ice - character(len=*),parameter :: subname='(zbio)' zbgc_snown(:) = c0 @@ -239,21 +259,22 @@ 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. - 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(nblyr, hbri_old, trcrn(:), carbonInitial,n_doc,n_dic,n_algae,n_don) + + if (aice_old > puny) then + hsnow_i = vsno_old/aice_old + do mm = 1,nbtrcr + call bgc_column_sum (nblyr, nslyr, 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 - endif + if (icepack_warnings_aborted(subname)) return + enddo + endif call update_snow_bgc (dt, nblyr, & nslyr, & @@ -266,11 +287,13 @@ subroutine zbio (dt, nblyr, & 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, & + nilyr, & nblyr, nbtrcr, & n_algae, n_doc, & n_dic, n_don, & @@ -278,19 +301,19 @@ subroutine zbio (dt, nblyr, & n_zaero, 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, & + bgrid, & igrid, icgrid, & bphi_min, zbgc_snown,& - zbgc_atmn, & + zbgc_atmn, & iTin, dh_direct, & Zoo, meltb, & congel ) @@ -300,6 +323,65 @@ subroutine zbio (dt, nblyr, & flux_bion(mm) = flux_bion(mm) + flux_bio_sno(mm) enddo + call bgc_carbon_sum(nblyr, hbri, trcrn(:), carbonFinal,n_doc,n_dic,n_algae,n_don) + call bgc_carbon_flux(flux_bio_atm,flux_bion,n_doc,n_dic,n_algae,n_don,carbonFlux) + + carbonError = carbonInitial-carbonFlux*dt-carbonFinal + + if (abs(carbonError) > max(puny,accuracy * maxval ((/carbonInitial, carbonFinal/)))) 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 (nblyr, nslyr, 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 @@ -330,12 +412,11 @@ subroutine zbio (dt, nblyr, & if (icepack_warnings_aborted(subname)) return call merge_bgc_fluxes (dt, nblyr, & - nslyr, & bio_index, n_algae, & nbtrcr, aicen, & vicen, vsnon, & - iphin, & - trcrn, & + iphin, &! ntrcr + trcrn, aice_old, &!aice_old flux_bion, flux_bio, & upNOn, upNHn, & upNO, upNH, & @@ -343,13 +424,16 @@ subroutine zbio (dt, nblyr, & fbio_snoice, fbio_atmice,& PP_net, ice_bio_net,& snow_bio_net, grow_alg, & - grow_net) + grow_net, totalChla, & + nslyr, 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,7 +445,7 @@ 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 @@ -371,7 +455,8 @@ end subroutine zbio !======================================================================= - subroutine sklbio (dt, ntrcr, & + subroutine sklbio (dt, Tf, & + ntrcr, & nbtrcr, n_algae, & n_doc, & n_dic, n_don, & @@ -397,6 +482,7 @@ subroutine sklbio (dt, ntrcr, & 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) @@ -446,7 +532,8 @@ subroutine sklbio (dt, ntrcr, & 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, & @@ -474,7 +561,8 @@ subroutine skl_biogeochemistry (dt, & meltb, congel, & fswthru, first_ice, & trcrn, upNOn, & - upNHn, grow_alg_skl) + upNHn, grow_alg_skl, & + Tf) integer (kind=int_kind), intent(in) :: & n_doc, n_dic, n_don, n_fed, n_fep, & @@ -486,6 +574,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 +619,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 +640,11 @@ 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 do nn = 1, nbtrcr cinit (nn) = c0 @@ -578,9 +667,6 @@ subroutine skl_biogeochemistry (dt, & 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 +674,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 +743,17 @@ 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, n_doc, n_dic, & + n_don, n_fed, n_fep, & + dEdd_algae, & fswthru, react, & - cinit_v, & - grow_alg_skl(:), n_algae, & + cinit_v, & + grow_alg_skl(:), n_algae, & iTin, & - upNOn(:), upNHn(:), & + upNOn(:), upNHn(:), & Zoo_skl, & - Nerror, conserve_N) + Cerror, conserve_C,& + nitrification) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -697,8 +784,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 +798,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 +811,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,7 +838,7 @@ end subroutine skl_biogeochemistry ! subroutine z_biogeochemistry (n_cat, dt, & - nilyr, & + nilyr, & nblyr, nbtrcr, & n_algae, n_doc, & n_dic, n_don, & @@ -759,19 +846,19 @@ subroutine z_biogeochemistry (n_cat, dt, & n_zaero, 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, & + bgrid, & i_grid, ic_grid, & bphi_min, zbgc_snow, & - zbgc_atm, & + zbgc_atm, & iTin, dh_direct, & Zoo, meltb, & congel ) @@ -797,7 +884,6 @@ 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) @@ -822,7 +908,10 @@ subroutine z_biogeochemistry (n_cat, dt, & ocean_bio , & ! ocean concentrations (mmol/m^3) bphin ! Porosity on the bgrid - real (kind=dbl_kind), intent(inout) :: & + real (kind=dbl_kind), 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 +935,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 +959,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 +987,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 +995,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 +1016,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 :: & @@ -950,14 +1043,21 @@ subroutine z_biogeochemistry (n_cat, dt, & !----------------------------------- 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 + 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 +1067,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 +1089,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,11 +1110,10 @@ 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 !----------------------------------------------------------------- @@ -1080,6 +1177,7 @@ subroutine z_biogeochemistry (n_cat, dt, & endif C_bot(m) = ocean_bio(m)*hbri_old*iphin_N(nblyr+1) + ocean_bio_dh(m) = C_bot(m) enddo ! m @@ -1134,14 +1232,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) @@ -1152,7 +1252,7 @@ subroutine z_biogeochemistry (n_cat, dt, & call compute_FCT_matrix & (initcons,sbdiagz, dt, nblyr, & diagz, spdiagz, rhsz, bgrid, & - darcyV, dhtop, & + darcyV, dhtop, & dhbot, iphin_N, & Diff, hbri_old, & atm_add_cons(mm), bphin_N, & @@ -1219,40 +1319,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 +1360,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 @@ -1294,7 +1392,8 @@ subroutine z_biogeochemistry (n_cat, dt, & 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 +1403,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)) 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 +1452,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 +1469,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 +1488,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,16 +1520,17 @@ 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, n_doc, n_dic, & + n_don, n_fed, n_fep, & + dEdd_algae, & fswthru, reactb, & - ltrcrn, & + ltrcrn, & grow_alg, n_algae, & T_bot, & upNOn, upNHn, & Zoo, & - Nerror, conserve_N) + Cerror, conserve_C, & + nitrification) integer (kind=int_kind), intent(in) :: & n_doc, n_dic, n_don, n_fed, n_fep, & @@ -1420,7 +1543,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 +1558,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 +1575,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 +1604,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 +1619,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 +1643,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 +1659,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 +1680,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 +1728,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 +1752,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 +1775,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 +1795,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 +1806,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)) @@ -1834,11 +1953,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 +1968,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 +2005,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 +2050,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 +2068,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 +2088,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 +2107,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 +2158,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 +2170,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 +2191,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 +2207,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 @@ -2141,7 +2327,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 +2335,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 @@ -2578,7 +2764,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 +2785,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 @@ -2665,7 +2901,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 +2914,146 @@ 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 (nblyr, hbrine, xin, xout, n_doc, n_dic, n_algae, n_don) + + integer (kind=int_kind), intent(in) :: & + nblyr, & ! number of ice layers + n_doc, n_dic, n_algae, n_don + + 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, n_doc, & + n_dic, n_algae, n_don, Tot_Carbon_flux) + + integer (kind=int_kind), intent(in) :: & + n_doc, n_dic, n_algae, n_don + + 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_brine.F90 b/columnphysics/icepack_brine.F90 index 98aea58da..46c7c1757 100644 --- a/columnphysics/icepack_brine.F90 +++ b/columnphysics/icepack_brine.F90 @@ -7,7 +7,7 @@ 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 @@ -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 @@ -143,7 +132,7 @@ subroutine compute_microS_mushy (nilyr, nblyr, & kperm, bphi_min, & bSin, brine_sal, brine_rho, & iphin, ibrine_rho, ibrine_sal, & - sice_rho, iDin ) + iDin, iSin) integer (kind=int_kind), intent(in) :: & nilyr , & ! number of ice layers @@ -170,7 +159,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 +169,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 +181,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 +200,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 +223,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, & @@ -273,10 +273,9 @@ subroutine compute_microS_mushy (nilyr, nblyr, & bSin, bTin, iTin, & brine_sal, brine_rho, & ibrine_sal, ibrine_rho, & - sice_rho, & bphin, iphin, & - kperm, bphi_min, & - igrid, sss) + kperm, bphi_min, & + igrid, sss, iSin) if (icepack_warnings_aborted(subname)) return call calculate_drho(nblyr, igrid, bgrid, & @@ -299,9 +298,9 @@ subroutine prepare_hbrine (nblyr, & bSin, bTin, iTin, & brine_sal, brine_rho, & ibrine_sal, ibrine_rho, & - sice_rho, bphin, iphin,& + bphin, iphin, & kperm, bphi_min, & - i_grid, sss) + i_grid, sss, iSin) integer (kind=int_kind), intent(in) :: & nblyr ! number of bio layers @@ -318,7 +317,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 +327,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,8 +345,6 @@ subroutine prepare_hbrine (nblyr, & ! calculate equilibrium brine density and gradients !----------------------------------------------------------------- - sice_rho = c0 - do k = 1, nblyr+1 if (k == 1) then @@ -366,8 +361,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 +372,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)) @@ -401,6 +396,7 @@ subroutine prepare_hbrine (nblyr, & 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)) @@ -755,7 +751,7 @@ 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) diff --git a/columnphysics/icepack_itd.F90 b/columnphysics/icepack_itd.F90 index b86d1cf78..d12f74f12 100644 --- a/columnphysics/icepack_itd.F90 +++ b/columnphysics/icepack_itd.F90 @@ -1096,6 +1096,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 +1147,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), & @@ -1273,6 +1273,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) & @@ -1414,8 +1444,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 + & diff --git a/columnphysics/icepack_mechred.F90 b/columnphysics/icepack_mechred.F90 index 818faa01d..3f015037b 100644 --- a/columnphysics/icepack_mechred.F90 +++ b/columnphysics/icepack_mechred.F90 @@ -45,7 +45,7 @@ module icepack_mechred 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, nblyr, bio_index use icepack_tracers, only: icepack_compute_tracers use icepack_warnings, only: warnstr, icepack_warnings_add @@ -102,7 +102,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, & @@ -188,6 +188,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 +224,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 +279,7 @@ subroutine ridge_ice (dt, ndtd, & msnow_mlt = c0 esnow_mlt = c0 maero (:) = c0 + mbio (:) = c0 miso (:) = c0 mpond = c0 ardg1 = c0 @@ -401,7 +408,8 @@ subroutine ridge_ice (dt, ndtd, & msnow_mlt, esnow_mlt, & maero, miso, & mpond, Tf, & - aredistn, vredistn) + aredistn, vredistn, & + mbio) if (icepack_warnings_aborted(subname)) return !----------------------------------------------------------------- @@ -591,6 +599,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 ??? @@ -1086,7 +1099,8 @@ subroutine ridge_shift (ntrcr, dt, & msnow_mlt, esnow_mlt, & maero, miso, & mpond, Tf, & - aredistn, vredistn) + aredistn, vredistn, & + mbio) integer (kind=int_kind), intent(in) :: & ncat , & ! number of thickness categories @@ -1163,6 +1177,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 +1232,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 +1405,16 @@ subroutine ridge_shift (ntrcr, dt, & enddo endif + if (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) @@ -1875,7 +1904,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, & diff --git a/columnphysics/icepack_parameters.F90 b/columnphysics/icepack_parameters.F90 index 02deaae9a..b5e9a622f 100644 --- a/columnphysics/icepack_parameters.F90 +++ b/columnphysics/icepack_parameters.F90 @@ -187,6 +187,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 +201,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: @@ -393,7 +395,10 @@ 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 + restartbgc = .false. real (kind=dbl_kind), public :: & phi_snow = p5 , & ! snow porosity @@ -402,7 +407,7 @@ module icepack_parameters 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 + 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 @@ -425,8 +430,104 @@ module icepack_parameters 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) - + t_sk_ox = 10.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 +551,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,7 +562,7 @@ 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, & @@ -469,8 +570,9 @@ subroutine icepack_init_parameters( & 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, & - initbio_frac_in, grid_oS_in, l_skS_in, dEdd_algae_in, & + modal_aero_in, use_macromolecules_in, restartbgc_in, skl_bgc_in, & + solve_zsal_in, grid_o_in, l_sk_in, & + grid_oS_in, l_skS_in, dEdd_algae_in, & phi_snow_in, T_max_in, fsal_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, & @@ -483,7 +585,40 @@ 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, & + ! these are defined in icepack_init_zbgc + 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 @@ -596,7 +731,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 +759,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 @@ -732,6 +869,9 @@ 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 + restartbgc_in, & conserv_check_in ! if .true., run conservation checks and abort if checks fail logical (kind=log_kind), intent(in), optional :: & @@ -741,12 +881,111 @@ 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) - initbio_frac_in, & ! fraction of ocean tracer concentration used to initialize tracer + grid_o_t_in , & ! top grid point length scale 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 +1141,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 +1179,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 @@ -1104,6 +1345,8 @@ 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(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 +1357,108 @@ 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(initbio_frac_in) ) initbio_frac = initbio_frac_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(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 (present(ratio_Fe2N_sp_in) ) ratio_Fe2N_sp = ratio_Fe2N_sp_in + if (present(ratio_Fe2N_phaeo_in) ) ratio_Fe2N_phaeo = ratio_Fe2N_phaeo_in + 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 (present(K_Nit_sp_in) ) K_Nit_sp = K_Nit_sp_in + if (present(K_Nit_phaeo_in) ) K_Nit_phaeo = K_Nit_phaeo_in + if (present(K_Am_diatoms_in) ) K_Am_diatoms = K_Am_diatoms_in + if (present(K_Am_sp_in) ) K_Am_sp = K_Am_sp_in + if (present(K_Am_phaeo_in) ) K_Am_phaeo = K_Am_phaeo_in + 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 +1478,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 +1518,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,7 +1528,7 @@ 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, & @@ -1196,7 +1536,8 @@ subroutine icepack_query_parameters( & 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, & + 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 +1551,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 @@ -1334,7 +1705,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 +1733,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 @@ -1470,6 +1843,9 @@ 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 + restartbgc_out, & conserv_check_out ! if .true., run conservation checks and abort if checks fail logical (kind=log_kind), intent(out), optional :: & @@ -1479,12 +1855,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 +2148,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 +2186,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 @@ -1763,15 +2241,115 @@ 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(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 +2369,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 @@ -1871,6 +2448,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 +2497,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 @@ -1973,15 +2552,116 @@ 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,*) " 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 +2681,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..b8150fe3c 100644 --- a/columnphysics/icepack_shortwave.F90 +++ b/columnphysics/icepack_shortwave.F90 @@ -3497,9 +3497,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 diff --git a/columnphysics/icepack_therm_itd.F90 b/columnphysics/icepack_therm_itd.F90 index b6048dbce..0d4dd6c66 100644 --- a/columnphysics/icepack_therm_itd.F90 +++ b/columnphysics/icepack_therm_itd.F90 @@ -23,7 +23,7 @@ module icepack_therm_itd 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 +31,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: ntrcr 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 @@ -92,10 +92,10 @@ subroutine linear_itd (ncat, hin_max, & ntrcr, 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) :: & @@ -318,7 +318,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 @@ -969,6 +969,7 @@ subroutine lateral_melt (dt, ncat, & real (kind=dbl_kind), dimension (ncat) :: & aicen_init, & ! initial area fraction vicen_init, & ! volume per unit area of ice (m) + vsnon_init, & ! initial volume of snow (m) G_radialn , & ! rate of lateral melt (m/s) delta_an , & ! change in the ITD rsiden ! delta_an/aicen @@ -1000,7 +1001,7 @@ subroutine lateral_melt (dt, ncat, & dvint = c0 bin1_arealoss = c0 tmp = c0 - vicen_init = c0 + vicen_init = vicen(:) G_radialn = c0 delta_an = c0 rsiden = c0 @@ -1119,6 +1120,7 @@ subroutine lateral_melt (dt, ncat, & ! state variables vicen_init(n) = vicen(n) + vsnon_init(n) = vsnon(n) aicen(n) = aicen(n) * (c1 - rsiden(n)) vicen(n) = vicen(n) * (c1 - rsiden(n)) vsnon(n) = vsnon(n) * (c1 - rsiden(n)) @@ -1228,8 +1230,8 @@ subroutine lateral_melt (dt, ncat, & !----------------------------------------------------------------- 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 & @@ -1243,9 +1245,9 @@ 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, & + nbtrcr) if (icepack_warnings_aborted(subname)) return endif ! flag @@ -1301,10 +1303,10 @@ end subroutine lateral_melt subroutine add_new_ice (ncat, nilyr, & nfsd, nblyr, & n_aero, dt, & - ntrcr, nltrcr, & + ntrcr, & hin_max, ktherm, & aicen, trcrn, & - vicen, vsnon1, & + vicen, & aice0, aice, & frzmlt, frazil, & frz_onset, yday, & @@ -1312,7 +1314,8 @@ subroutine add_new_ice (ncat, nilyr, & Tf, sss, & salinz, phi_init, & dSin0_frazil, & - bgrid, cgrid, igrid, & + bgrid, cgrid, & + igrid, & nbtrcr, flux_bio, & ocean_bio, & frazil_diag, & @@ -1334,7 +1337,7 @@ subroutine add_new_ice (ncat, nilyr, & nilyr , & ! number of ice layers nblyr , & ! number of bio layers ntrcr , & ! number of tracers - nltrcr, & ! number of zbgc tracers + nbtrcr, & ! number of zbgc tracers n_aero, & ! number of aerosol tracers ktherm ! type of thermodynamics (-1 none, 1 BL99, 2 mushy) @@ -1349,8 +1352,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 @@ -1390,9 +1392,6 @@ subroutine add_new_ice (ncat, nilyr, & 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) @@ -1810,7 +1809,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 @@ -1879,7 +1877,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 +1896,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 +1908,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 +1943,14 @@ subroutine add_new_ice (ncat, nilyr, & ! Biogeochemistry !----------------------------------------------------------------- if (tr_brine .or. nbtrcr > 0) then - call add_new_ice_bgc(dt, nblyr, & - ncat, nilyr, nltrcr, & + call add_new_ice_bgc(dt, nblyr, ncats, & + ncat, nilyr, & bgrid, cgrid, igrid, & aicen_init, vicen_init, vi0_init, & - aicen, vicen, vsnon1, & - vi0new, ntrcr, trcrn, & - nbtrcr, sss, ocean_bio,& - flux_bio, hsurp) + aicen, vicen, vin0new, & + ntrcr, trcrn, nbtrcr, & + ocean_bio, flux_bio, hsurp, & + d_an_tot) if (icepack_warnings_aborted(subname)) return endif @@ -1972,10 +1968,10 @@ end subroutine add_new_ice ! authors: William H. Lipscomb, LANL ! Elizabeth C. Hunke, LANL - subroutine icepack_step_therm2 (dt, ncat, nltrcr, & + subroutine icepack_step_therm2 (dt, ncat, & nilyr, nslyr, & hin_max, nblyr, & - aicen, & + aicen, nbtrcr, & vicen, vsnon, & aicen_init, vicen_init, & trcrn, & @@ -2011,8 +2007,8 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & integer (kind=int_kind), intent(in) :: & ncat , & ! number of thickness categories - nltrcr , & ! number of zbgc tracers nblyr , & ! number of bio layers + nbtrcr , & ! number of bio tracers nilyr , & ! number of ice layers nslyr ! number of snow layers @@ -2190,6 +2186,8 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & ! Compute fractional ice area in each grid cell. !----------------------------------------------------------------- + flux_bio(:) = c0 + call aggregate_area (ncat, aicen, aice, aice0) if (icepack_warnings_aborted(subname)) return @@ -2233,10 +2231,10 @@ subroutine icepack_step_therm2 (dt, ncat, nltrcr, & call add_new_ice (ncat, nilyr, & nfsd, nblyr, & n_aero, dt, & - ntrcr, nltrcr, & + ntrcr, & hin_max, ktherm, & aicen, trcrn, & - vicen, vsnon(1), & + vicen, & aice0, aice, & frzmlt, frazil, & frz_onset, yday, & diff --git a/columnphysics/icepack_tracers.F90 b/columnphysics/icepack_tracers.F90 index 3057ad57b..abdc03b6c 100644 --- a/columnphysics/icepack_tracers.F90 +++ b/columnphysics/icepack_tracers.F90 @@ -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 diff --git a/columnphysics/icepack_warnings.F90 b/columnphysics/icepack_warnings.F90 index 459f2dc80..231f71285 100644 --- a/columnphysics/icepack_warnings.F90 +++ b/columnphysics/icepack_warnings.F90 @@ -68,9 +68,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 diff --git a/columnphysics/icepack_zbgc.F90 b/columnphysics/icepack_zbgc.F90 index 928b4ca65..a327778bd 100644 --- a/columnphysics/icepack_zbgc.F90 +++ b/columnphysics/icepack_zbgc.F90 @@ -9,19 +9,37 @@ 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: nt_sice, bio_index, bio_index_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: ntrcr, ntrcr_o, 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_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: ntrcr, ntrcr_o, nbtrcr, nbtrcr_sw + 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 @@ -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,23 +86,22 @@ module icepack_zbgc ! Adjust biogeochemical tracers when new frazil ice forms - subroutine add_new_ice_bgc (dt, nblyr, & - ncat, nilyr, nltrcr, & + subroutine add_new_ice_bgc (dt, nblyr, ncats, & + ncat, nilyr, & bgrid, cgrid, igrid, & aicen_init, vicen_init, vi0_init, & - aicen, vicen, vsnon1, & - vi0new, & + aicen, vicen, vin0new, & ntrcr, trcrn, nbtrcr, & - sss, ocean_bio, flux_bio, & - hsurp) + 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 + ntrcr , & ! number of tracers in use + ncats ! 1 without floe size distribution or ncat real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & bgrid ! biology nondimensional vertical grid points @@ -97,22 +117,19 @@ subroutine add_new_ice_bgc (dt, nblyr, & 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 +144,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 +162,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 +173,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 +216,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,11 +286,11 @@ 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) + subroutine lateral_melt_bgc (dt, & + ncat, nblyr, & + rsiden, vicen_init,& + trcrn, flux_bio, & + nbltrcr) integer (kind=int_kind), intent(in) :: & ncat , & ! number of thickness categories @@ -285,37 +301,43 @@ subroutine lateral_melt_bgc (dt, & 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 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 @@ -328,132 +350,119 @@ end subroutine lateral_melt_bgc ! ! 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) +! subroutine adjust_tracer_profile (nbtrcr, dt, ntrcr, & +! aicen, vbrin, & +! vicen, trcrn, & +! vtmp, & +! vsurp, & +! 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 +! 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) :: & +! 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), intent(in) :: & +! aicen , & ! concentration of ice +! vicen , & ! volume of ice +! 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), 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), 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+1), intent(in) :: & +! igrid ! zbio grid - real (kind=dbl_kind), dimension (nblyr+2), intent(in) :: & - bgrid ! zsal 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 (nilyr+1), intent(in) :: & +! cgrid ! CICE grid - real (kind=dbl_kind), dimension (ntrcr), intent(inout) :: & - trcrn ! ice tracers +! 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), 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 - 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+1) :: & - C_stationary ! stationary bulk concentration*h (mmol/m^2) +! 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 - real (kind=dbl_kind), dimension (nblyr) :: & - S_stationary ! stationary bulk concentration*h (ppt*m) +! character(len=*),parameter :: subname='(adjust_tracer_profile)' - 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 +! trtmp0(:) = c0 +! trtmp(:) = c0 +! fluxb = c0 - character(len=*),parameter :: subname='(adjust_tracer_profile)' + ! if (location == 1 .and. vbrin > c0) then ! add frazil to bottom - trtmp0(:) = c0 - trtmp(:) = c0 - fluxb = c0 +! hbri = vbrin +! hbri_old = vtmp - if (location == 1 .and. vbrin > c0) then ! add frazil to bottom +! 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 - hbri = vbrin - hbri_old = vtmp +! elseif (vbrin > c0) then ! add frazil throughout location == 0 .and. - 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 +! 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 - elseif (vbrin > c0) then ! add frazil throughout location == 0 .and. +! endif ! location - 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 +! 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) + subroutine icepack_init_bgc(ncat, nblyr, nilyr, & + cgrid, igrid, sicen, trcrn, sss, ocean_bio_all, & + DOCPoolFractions) 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 + nblyr ! number of bio layers real (kind=dbl_kind), dimension (nblyr+1), intent(inout) :: & igrid ! biology vertical interface points @@ -470,9 +479,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 (:), intent(out) :: & + DOCPoolFractions ! Fraction of DOC in polysacharids, lipids, and proteins + !autodocument_end ! local variables @@ -493,6 +505,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 +561,14 @@ subroutine icepack_init_bgc(ncat, nblyr, nilyr, ntrcr_o, & endif ! scale_bgc endif ! skl_bgc + endif ! restart + + DOCPoolFractions(:) = c1 + if (.not. use_macromolecules) then + do mm = 1,max_doc + DOCPoolFractions(mm) = doc_pool_fractions(mm) + end do + end if end subroutine icepack_init_bgc @@ -554,164 +576,1117 @@ 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 ( nblyr, nilyr, nslyr, & + n_algae_in, n_zaero_in, n_doc_in, n_dic_in, n_don_in, n_fed_in, n_fep_in, & + trcr_base, trcr_depend, n_trcr_strata, nt_strata, nbtrcr_sw_out, tr_brine_in,& + nt_fbri_out, ntrcr_out,ntrcr_o_out, nbtrcr_out, nt_bgc_Nit_out, nt_bgc_Am_out, & + nt_bgc_Sil_out, nt_bgc_DMS_out, nt_bgc_PON_out, nt_bgc_N_out, & + nt_bgc_C_out, nt_bgc_chl_out, nt_bgc_DOC_out, nt_bgc_DON_out, nt_bgc_DIC_out, & + nt_zaero_out, nt_bgc_DMSPp_out, nt_bgc_DMSPd_out, nt_bgc_Fed_out, nt_bgc_Fep_out, & + nt_zbgc_frac_out, tr_bgc_Nit_in, tr_bgc_Am_in, tr_bgc_Sil_in, tr_bgc_DMS_in, & + tr_bgc_PON_in, tr_bgc_N_in, tr_bgc_C_in, tr_bgc_chl_in, & + tr_bgc_DON_in, tr_bgc_Fe_in, tr_zaero_in, nlt_zaero_sw_out, nlt_chl_sw_out, & + nlt_bgc_N_out, nlt_bgc_Nit_out, nlt_bgc_Am_out, nlt_bgc_Sil_out, & + nlt_bgc_DMS_out, nlt_bgc_DMSPp_out, nlt_bgc_DMSPd_out, & + nlt_bgc_C_out, nlt_bgc_chl_out, nlt_bgc_DIC_out, nlt_bgc_DOC_out, & + nlt_bgc_PON_out, nlt_bgc_DON_out, nlt_bgc_Fed_out, nlt_bgc_Fep_out, & + nlt_zaero_out, & + nt_bgc_hum_out, nlt_bgc_hum_out, tr_bgc_hum_in, & + skl_bgc_in, z_tracers_in, dEdd_algae_in, solve_zbgc_in, & + bio_index_o_out, bio_index_out, & + frazil_scav_in, initbio_frac_in, & + max_algae_in, max_doc_in, max_dic_in, max_don_in, max_fe_in, max_aero_in, & !optional + 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_don_protein_in, kn_bac_protein_in, & + f_don_Am_protein_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, & + 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, & + nitratetype_in, ammoniumtype_in, dmspptype_in, dmspdtype_in, & + silicatetype_in, humtype_in, tau_min_in, tau_max_in) + + integer (kind=int_kind), intent(in) :: & + nblyr , & ! number of bio/brine layers per category + nilyr , & ! number of ice layers per category + nslyr ! number of snow layers per category + + integer (kind=int_kind), optional, intent(in) ::& + n_zaero_in , & ! number of z aerosols in use + n_algae_in , & ! number of algae in use + n_doc_in , & ! number of DOC pools in use + n_dic_in , & ! number of DIC pools in use + n_don_in , & ! number of DON pools in use + n_fed_in , & ! number of Fe pools in use dissolved Fe + n_fep_in ! number of Fe pools in use particulate Fe + + integer (kind=int_kind), optional, intent(inout) :: & + ntrcr_out, & ! number of tracers + ntrcr_o_out, & ! number of non-bio tracers in use + nbtrcr_out, & ! number of bgc tracers in use + nbtrcr_sw_out ! size of shorwave tracer vector + + integer (kind=int_kind), dimension (:), intent(inout) :: & + trcr_depend ! = 0 for ice area tracers + ! = 1 for ice volume tracers + ! = 2 for snow volume tracers + + integer (kind=int_kind), dimension (:), intent(inout) :: & + n_trcr_strata ! number of underlying tracer layers + + integer (kind=int_kind), dimension (:,:), intent(inout) :: & + nt_strata ! indices of underlying tracer layers + + real (kind=dbl_kind), dimension (:,:), intent(inout) :: & + trcr_base ! = 0 or 1 depending on tracer dependency + ! argument 2: (1) aice, (2) vice, (3) vsno + + logical (kind=log_kind), optional, intent(in) :: & + tr_brine_in, & ! if .true., brine height differs from ice thickness + tr_zaero_in, & ! if .true., black carbon is tracers (n_zaero) + tr_bgc_Nit_in, & ! if .true. Nitrate tracer in ice + tr_bgc_N_in, & ! if .true., algal nitrogen tracers (n_algae) + tr_bgc_DON_in, & ! if .true., DON pools are tracers (n_don) + tr_bgc_C_in, & ! if .true., algal carbon tracers + DOC and DIC + tr_bgc_chl_in, & ! if .true., algal chlorophyll tracers + tr_bgc_Am_in, & ! if .true., ammonia/um as nutrient tracer + tr_bgc_Sil_in, & ! if .true., silicon as nutrient tracer + tr_bgc_DMS_in, & ! if .true., DMS as tracer + tr_bgc_Fe_in, & ! if .true., Fe as tracer + tr_bgc_PON_in, & ! if .true., PON as tracer + tr_bgc_hum_in, & ! if .true., humic material as tracer + z_tracers_in, & ! if .true., bgc or aerosol tracers are vertically resolved + solve_zbgc_in, & ! if .true., solve vertical biochemistry portion of code + dEdd_algae_in, & ! if .true., algal absorption of Shortwave is computed in the + skl_bgc_in ! if true, solve skeletal biochemistry + + integer (kind=int_kind), optional, intent(in) ::& + max_algae_in , & + max_doc_in , & + max_dic_in , & + max_don_in , & + max_fe_in , & + max_aero_in + + real (kind=dbl_kind), optional, intent(in) :: & + initbio_frac_in, & ! fraction of ocean tracer concentration used to initialize tracer + frazil_scav_in ! multiple of ocean tracer concentration due to frazil scavenging + + real (kind=dbl_kind), optional, intent(in) :: & + 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) + + integer (kind=int_kind), optional, intent(out) :: & + nt_fbri_out, & ! volume fraction of ice with dynamic salt (hinS/vicen*aicen) + nt_bgc_Nit_out, & ! nutrients + nt_bgc_Am_out, & ! + nt_bgc_Sil_out, & ! + nt_bgc_DMSPp_out, & ! trace gases (skeletal layer) + nt_bgc_DMSPd_out, & ! + nt_bgc_DMS_out, & ! + nt_bgc_PON_out, & ! zooplankton and detritus + nt_bgc_hum_out, & ! humic material + ! bio layer indicess + nlt_bgc_Nit_out, & ! nutrients + nlt_bgc_Am_out, & ! + nlt_bgc_Sil_out, & ! + nlt_bgc_DMSPp_out,& ! trace gases (skeletal layer) + nlt_bgc_DMSPd_out,& ! + nlt_bgc_DMS_out, & ! + nlt_bgc_PON_out, & ! zooplankton and detritus + nlt_bgc_hum_out, & ! humic material + nlt_chl_sw_out, & ! points to total chla in trcrn_sw + nt_zbgc_frac_out ! fraction of tracer in the mobile phase + + integer (kind=int_kind), dimension(:), optional, intent(out) :: & + nt_bgc_N_out , & ! diatoms, phaeocystis, pico/small + nt_bgc_C_out , & ! diatoms, phaeocystis, pico/small + nt_bgc_chl_out,& ! diatoms, phaeocystis, pico/small + nlt_bgc_N_out ,& ! diatoms, phaeocystis, pico/small + nlt_bgc_C_out ,& ! diatoms, phaeocystis, pico/small + nlt_bgc_chl_out ! diatoms, phaeocystis, pico/small + + integer (kind=int_kind), dimension(:), optional, intent(out) :: & + nt_bgc_DOC_out, & ! dissolved organic carbon + nlt_bgc_DOC_out ! dissolved organic carbon + + integer (kind=int_kind), dimension(:), optional, intent(out) :: & + nt_bgc_DON_out, & ! dissolved organic nitrogen + nlt_bgc_DON_out ! dissolved organic nitrogen + + integer (kind=int_kind), dimension(:), optional, intent(out) :: & + nt_bgc_DIC_out, & ! dissolved inorganic carbon + nlt_bgc_DIC_out ! dissolved inorganic carbon + + integer (kind=int_kind), dimension(:), optional, intent(out) :: & + nt_bgc_Fed_out, & ! dissolved iron + nt_bgc_Fep_out, & ! particulate iron + nlt_bgc_Fed_out, & ! dissolved iron + nlt_bgc_Fep_out ! particulate iron + + integer (kind=int_kind), dimension(:), optional, intent(out) :: & + nt_zaero_out, & ! black carbon and other aerosols + nlt_zaero_out, & ! black carbon and other aerosols + nlt_zaero_sw_out + + integer (kind=int_kind), dimension(:), optional, intent(out) :: & + bio_index_o_out , & ! nlt to appropriate value in ocean data array + bio_index_out ! nlt to nt !autodocument_end + ! local variables + + integer (kind=int_kind) :: & + k, mm , & ! loop index + ntd , & ! for tracer dependency calculation + nk , & ! + nt_depend + character(len=*),parameter :: subname='(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(:) + !------------ + ! BGC Maximum Dimensions + if (present(max_algae_in) ) then + if (max_algae .ne. max_algae_in) then + call icepack_warnings_add(subname//' incorrect dimension max_algae_in') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + endif + if (present(max_doc_in) ) then + if (max_doc .ne. max_doc_in) then + call icepack_warnings_add(subname//' incorrect dimension max_doc_in') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + endif + if (present(max_dic_in) ) then + if (max_dic .ne. max_dic_in) then + call icepack_warnings_add(subname//' incorrect dimension max_dic_in') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + endif + if (present(max_don_in) ) then + if (max_don .ne. max_don_in) then + call icepack_warnings_add(subname//' incorrect dimension max_don_in') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + endif + if (present(max_fe_in) ) then + if (max_fe .ne. max_fe_in) then + call icepack_warnings_add(subname//' incorrect dimension max_fe_in') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + endif + if (present(max_aero_in) ) then + if (max_aero .ne. max_aero_in) then + call icepack_warnings_add(subname//' incorrect dimension max_aero_in') + call icepack_warnings_setabort(.true.,__FILE__,__LINE__) + endif + endif + + ! BGC Tracer Dimensions + if (present(n_algae_in) ) n_algae = n_algae_in + if (present(n_zaero_in) ) n_zaero = n_zaero_in + if (present(n_doc_in) ) n_doc = n_doc_in + if (present(n_dic_in) ) n_dic = n_dic_in + if (present(n_don_in) ) n_don = n_don_in + if (present(n_fed_in) ) n_fed = n_fed_in + if (present(n_fep_in) ) n_fep = n_fep_in + + ! BGC Tracer Flags + if (present(tr_brine_in) ) tr_brine = tr_brine_in + if (present(tr_zaero_in) ) tr_zaero = tr_zaero_in + if (present(tr_bgc_Nit_in)) tr_bgc_Nit = tr_bgc_Nit_in + if (present(tr_bgc_N_in) ) tr_bgc_N = tr_bgc_N_in + if (present(tr_bgc_DON_in)) tr_bgc_DON = tr_bgc_DON_in + if (present(tr_bgc_C_in) ) tr_bgc_C = tr_bgc_C_in + if (present(tr_bgc_chl_in)) tr_bgc_chl = tr_bgc_chl_in + if (present(tr_bgc_Am_in) ) tr_bgc_Am = tr_bgc_Am_in + if (present(tr_bgc_Sil_in)) tr_bgc_Sil = tr_bgc_Sil_in + if (present(tr_bgc_DMS_in)) tr_bgc_DMS = tr_bgc_DMS_in + if (present(tr_bgc_Fe_in )) tr_bgc_Fe = tr_bgc_Fe_in + if (present(tr_bgc_hum_in)) tr_bgc_hum = tr_bgc_hum_in + if (present(tr_bgc_PON_in)) tr_bgc_PON = tr_bgc_PON_in + + !BGC Config Flags + if (present(z_tracers_in) ) z_tracers = z_tracers_in + if (present(solve_zbgc_in) ) solve_zbgc = solve_zbgc_in + if (present(dEdd_algae_in) ) dEdd_algae = dEdd_algae_in + if (present(skl_bgc_in) ) skl_bgc = skl_bgc_in + + !BGC Config Parameters + if (present(f_doc_l_in) ) f_doc_l = f_doc_l_in + if (present(f_doc_s_in) ) f_doc_s = f_doc_s_in + if (present(f_exude_l_in) ) f_exude_l = f_exude_l_in + if (present(f_exude_s_in) ) f_exude_s = f_exude_s_in + if (present(k_bac_l_in) ) k_bac_l = k_bac_l_in + if (present(k_bac_s_in) ) k_bac_s = k_bac_s_in + if (present(frazil_scav_in) ) frazil_scav = frazil_scav_in + if (present(initbio_frac_in) ) initbio_frac = initbio_frac_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 (present(ratio_Fe2N_sp_in) ) ratio_Fe2N_sp = ratio_Fe2N_sp_in + if (present(ratio_Fe2N_phaeo_in) ) ratio_Fe2N_phaeo = ratio_Fe2N_phaeo_in + 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 (present(K_Nit_sp_in) ) K_Nit_sp = K_Nit_sp_in + if (present(K_Nit_phaeo_in) ) K_Nit_phaeo = K_Nit_phaeo_in + if (present(K_Am_diatoms_in) ) K_Am_diatoms = K_Am_diatoms_in + if (present(K_Am_sp_in) ) K_Am_sp = K_Am_sp_in + if (present(K_Am_phaeo_in) ) K_Am_phaeo = K_Am_phaeo_in + 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(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(silicatetype_in) ) silicatetype = silicatetype_in + if (present(humtype_in) ) humtype = humtype_in + if (present(dontype_protein_in) ) dontype_protein = dontype_protein_in + if (present(dmspptype_in) ) dmspptype = dmspptype_in + if (present(dmspdtype_in) ) dmspdtype = dmspdtype_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(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 + + ! Total tracer counts. Initialize first + if (present(ntrcr_out) ) ntrcr = ntrcr_out + if (present(ntrcr_o_out) ) ntrcr_o = ntrcr_o_out + if (present(nbtrcr_out) ) nbtrcr = nbtrcr_out + if (present(nbtrcr_sw_out) ) nbtrcr_sw = nbtrcr_sw_out + + ntrcr_o = ntrcr + nt_fbri = 0 + if (tr_brine) then + nt_fbri = ntrcr + 1 ! ice volume fraction with salt + ntrcr = ntrcr + 1 + trcr_depend(nt_fbri) = 1 ! volume-weighted + trcr_base (nt_fbri,1) = c0 ! volume-weighted + trcr_base (nt_fbri,2) = c1 ! volume-weighted + trcr_base (nt_fbri,3) = c0 ! volume-weighted + n_trcr_strata(nt_fbri) = 0 + nt_strata (nt_fbri,1) = 0 + nt_strata (nt_fbri,2) = 0 + endif + + ntd = 0 ! if nt_fbri /= 0 then use fbri dependency + if (nt_fbri == 0) ntd = -1 ! otherwise make tracers depend on ice volume + + !----------------------------------------------------------------- + ! biogeochemistry + !----------------------------------------------------------------- + + nbtrcr = 0 + nbtrcr_sw = 0 + + ! vectors of size max_algae + nlt_bgc_N(:) = 0 + nlt_bgc_C(:) = 0 + nlt_bgc_chl(:) = 0 + nt_bgc_N(:) = 0 + nt_bgc_C(:) = 0 + nt_bgc_chl(:) = 0 + + ! vectors of size max_dic + nlt_bgc_DIC(:) = 0 + nt_bgc_DIC(:) = 0 + + ! vectors of size max_doc + nlt_bgc_DOC(:) = 0 + nt_bgc_DOC(:) = 0 + + ! vectors of size max_don + nlt_bgc_DON(:) = 0 + nt_bgc_DON(:) = 0 + + ! vectors of size max_fe + nlt_bgc_Fed(:) = 0 + nlt_bgc_Fep(:) = 0 + nt_bgc_Fed(:) = 0 + nt_bgc_Fep(:) = 0 + + ! vectors of size max_aero + nlt_zaero(:) = 0 + nlt_zaero_sw(:) = 0 + nt_zaero(:) = 0 + + nlt_bgc_Nit = 0 + nlt_bgc_Am = 0 + nlt_bgc_Sil = 0 + nlt_bgc_DMSPp = 0 + nlt_bgc_DMSPd = 0 + nlt_bgc_DMS = 0 + nlt_bgc_PON = 0 + nlt_bgc_hum = 0 + nlt_chl_sw = 0 + bio_index(:) = 0 + bio_index_o(:) = 0 + + nt_bgc_Nit = 0 + nt_bgc_Am = 0 + nt_bgc_Sil = 0 + nt_bgc_DMSPp = 0 + nt_bgc_DMSPd = 0 + nt_bgc_DMS = 0 + nt_bgc_PON = 0 + nt_bgc_hum = 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_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(1) = f_exude_s + f_exude(2) = f_exude_l + 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(1) = doctype_s + doctype(2) = doctype_l + dictype(1) = dictype_1 + + dontype(1) = dontype_protein + + fedtype(1) = fedtype_1 + feptype(1) = 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 + + if (skl_bgc) then + + nk = 1 + nt_depend = 0 + + if (dEdd_algae) then + nlt_chl_sw = 1 + nbtrcr_sw = nilyr+nslyr+2 ! only the bottom layer + ! will be nonzero + endif + elseif (z_tracers) then ! defined on nblyr+1 in ice + ! and 2 snow layers (snow surface + interior) + nk = nblyr + 1 + nt_depend = 2 + nt_fbri + ntd + + if (tr_bgc_N) then + if (dEdd_algae) then + nlt_chl_sw = 1 + nbtrcr_sw = nilyr+nslyr+2 + endif + endif ! tr_bgc_N + + endif ! skl_bgc or z_tracers + + + if (skl_bgc .or. z_tracers) then + + !----------------------------------------------------------------- + ! assign tracer indices and dependencies + ! bgc_tracer_type: < 0 purely mobile , >= 0 stationary + !------------------------------------------------------------------ + + if (tr_bgc_N) then + do mm = 1, n_algae + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_N(mm), nlt_bgc_N(mm), & + algaltype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_N(mm)) = mm + enddo ! mm + endif ! tr_bgc_N + + if (tr_bgc_Nit) then + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_Nit, nlt_bgc_Nit, & + nitratetype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_Nit) = max_algae + 1 + endif ! tr_bgc_Nit + + if (tr_bgc_C) then + ! + ! Algal C is not yet distinct from algal N + ! * Reqires exudation and/or changing C:N ratios + ! for implementation + ! + ! do mm = 1,n_algae + ! call icepack_init_bgc_trcr(nk, nt_fbri, & + ! nt_bgc_C(mm), nlt_bgc_C(mm), & + ! algaltype(mm), nt_depend, & + ! ntrcr, nbtrcr, & + ! bgc_tracer_type, trcr_depend, & + ! trcr_base, n_trcr_strata, & + ! nt_strata, bio_index) + ! bio_index_o(nlt_bgc_C(mm)) = max_algae + 1 + mm + ! enddo ! mm + + do mm = 1, n_doc + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_DOC(mm), nlt_bgc_DOC(mm), & + doctype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_DOC(mm)) = max_algae + 1 + mm + enddo ! mm + do mm = 1, n_dic + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_DIC(mm), nlt_bgc_DIC(mm), & + dictype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_DIC(mm)) = max_algae + max_doc + 1 + mm + enddo ! mm + endif ! tr_bgc_C + + if (tr_bgc_chl) then + do mm = 1, n_algae + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_chl(mm), nlt_bgc_chl(mm), & + algaltype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_chl(mm)) = max_algae + 1 + max_doc + max_dic + mm + enddo ! mm + endif ! tr_bgc_chl + + if (tr_bgc_Am) then + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_Am, nlt_bgc_Am, & + ammoniumtype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_Am) = 2*max_algae + max_doc + max_dic + 2 + endif + if (tr_bgc_Sil) then + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_Sil, nlt_bgc_Sil, & + silicatetype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_Sil) = 2*max_algae + max_doc + max_dic + 3 + endif + if (tr_bgc_DMS) then ! all together + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_DMSPp, nlt_bgc_DMSPp, & + dmspptype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_DMSPp) = 2*max_algae + max_doc + max_dic + 4 + + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_DMSPd, nlt_bgc_DMSPd, & + dmspdtype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_DMSPd) = 2*max_algae + max_doc + max_dic + 5 + + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_DMS, nlt_bgc_DMS, & + dmspdtype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_DMS) = 2*max_algae + max_doc + max_dic + 6 + endif + if (tr_bgc_PON) then + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_PON, nlt_bgc_PON, & + nitratetype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_PON) = 2*max_algae + max_doc + max_dic + 7 + endif + if (tr_bgc_DON) then + do mm = 1, n_don + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_DON(mm), nlt_bgc_DON(mm), & + dontype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_DON(mm)) = 2*max_algae + max_doc + max_dic + 7 + mm + enddo ! mm + endif ! tr_bgc_DON + if (tr_bgc_Fe) then + do mm = 1, n_fed + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_Fed(mm), nlt_bgc_Fed(mm), & + fedtype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_Fed(mm)) = 2*max_algae + max_doc + max_dic & + + max_don + 7 + mm + enddo ! mm + do mm = 1, n_fep + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_Fep(mm), nlt_bgc_Fep(mm), & + feptype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_Fep(mm)) = 2*max_algae + max_doc + max_dic & + + max_don + max_fe + 7 + mm + enddo ! mm + endif ! tr_bgc_Fe + + if (tr_bgc_hum) then + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc_hum, nlt_bgc_hum, & + humtype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_bgc_hum) = 2*max_algae + max_doc + 8 + max_dic & + + max_don + 2*max_fe + max_aero + endif + endif ! skl_bgc or z_tracers + + if (z_tracers) then ! defined on nblyr+1 in ice + ! and 2 snow layers (snow surface + interior) + + nk = nblyr + 1 + nt_depend = 2 + nt_fbri + ntd + + ! z layer aerosols + if (tr_zaero) then + do mm = 1, n_zaero + if (dEdd_algae) then + nlt_zaero_sw(mm) = nbtrcr_sw + 1 + nbtrcr_sw = nbtrcr_sw + nilyr + nslyr+2 + endif + call icepack_init_bgc_trcr(nk, nt_fbri, & + nt_zaero(mm), nlt_zaero(mm), & + zaerotype(mm), nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + bio_index_o(nlt_zaero(mm)) = 2*max_algae + max_doc + max_dic & + + max_don + 2*max_fe + 7 + mm + enddo ! mm + endif ! tr_zaero + + nt_zbgc_frac = 0 + if (nbtrcr > 0) then + nt_zbgc_frac = ntrcr + 1 + ntrcr = ntrcr + nbtrcr + do k = 1,nbtrcr + zbgc_frac_init(k) = c1 + trcr_depend(nt_zbgc_frac+k-1) = 2+nt_fbri + trcr_base(nt_zbgc_frac+ k - 1,1) = c0 + trcr_base(nt_zbgc_frac+ k - 1,2) = c1 + trcr_base(nt_zbgc_frac+ k - 1,3) = c0 + n_trcr_strata(nt_zbgc_frac+ k - 1)= 1 + nt_strata(nt_zbgc_frac+ k - 1,1) = nt_fbri + nt_strata(nt_zbgc_frac+ k - 1,2) = 0 + tau_ret(k) = c1 + tau_rel(k) = c1 + if (bgc_tracer_type(k) >= c0 .and. bgc_tracer_type(k) < p5) then + tau_ret(k) = tau_min + tau_rel(k) = tau_max + zbgc_frac_init(k) = c1 + elseif (bgc_tracer_type(k) >= p5 .and. bgc_tracer_type(k) < c1) then + tau_ret(k) = tau_min + tau_rel(k) = tau_min + zbgc_frac_init(k) = c1 + elseif (bgc_tracer_type(k) >= c1 .and. bgc_tracer_type(k) < c2) then + tau_ret(k) = tau_max + tau_rel(k) = tau_min + zbgc_frac_init(k) = c1 + elseif (bgc_tracer_type(k) >= c2 ) then + tau_ret(k) = tau_max + tau_rel(k) = tau_max + zbgc_frac_init(k) = c1 + endif + enddo + endif + + endif ! z_tracers + + do k = 1, nbtrcr + zbgc_init_frac(k) = frazil_scav + if (bgc_tracer_type(k) < c0) zbgc_init_frac(k) = initbio_frac + enddo + + ! BGC Indices + if (present(bio_index_out) ) bio_index_out = bio_index + if (present(bio_index_o_out) ) bio_index_o_out = bio_index_o + if (present(nt_fbri_out) ) nt_fbri_out = nt_fbri + if (present(nt_bgc_Nit_out) ) nt_bgc_Nit_out = nt_bgc_Nit + if (present(nlt_bgc_Nit_out) ) nlt_bgc_Nit_out = nlt_bgc_Nit + if (present(nt_bgc_Am_out) ) nt_bgc_Am_out = nt_bgc_Am + if (present(nlt_bgc_Am_out) ) nlt_bgc_Am_out = nlt_bgc_Am + if (present(nt_bgc_Sil_out) ) nt_bgc_Sil_out = nt_bgc_Sil + if (present(nlt_bgc_Sil_out) ) nlt_bgc_Sil_out = nlt_bgc_Sil + if (present(nt_bgc_DMSPp_out) ) nt_bgc_DMSPp_out = nt_bgc_DMSPp + if (present(nlt_bgc_DMSPp_out)) nlt_bgc_DMSPp_out= nlt_bgc_DMSPp + if (present(nt_bgc_DMSPd_out) ) nt_bgc_DMSPd_out = nt_bgc_DMSPd + if (present(nlt_bgc_DMSPd_out)) nlt_bgc_DMSPd_out= nlt_bgc_DMSPd + if (present(nt_bgc_DMS_out) ) nt_bgc_DMS_out = nt_bgc_DMS + if (present(nlt_bgc_DMS_out) ) nlt_bgc_DMS_out = nlt_bgc_DMS + if (present(nt_bgc_hum_out) ) nt_bgc_hum_out = nt_bgc_hum + if (present(nlt_bgc_hum_out) ) nlt_bgc_hum_out = nlt_bgc_hum + if (present(nt_bgc_PON_out) ) nt_bgc_PON_out = nt_bgc_PON + if (present(nlt_bgc_PON_out) ) nlt_bgc_PON_out = nlt_bgc_PON + if (present(nt_bgc_N_out) ) nt_bgc_N_out = nt_bgc_N + if (present(nlt_bgc_N_out) ) nlt_bgc_N_out = nlt_bgc_N + if (present(nt_bgc_C_out) ) nt_bgc_C_out = nt_bgc_C + if (present(nlt_bgc_C_out) ) nlt_bgc_C_out = nlt_bgc_C + if (present(nt_bgc_chl_out) ) nt_bgc_chl_out = nt_bgc_chl + if (present(nlt_bgc_chl_out) ) nlt_bgc_chl_out = nlt_bgc_chl + if (present(nt_bgc_DOC_out) ) nt_bgc_DOC_out = nt_bgc_DOC + if (present(nlt_bgc_DOC_out) ) nlt_bgc_DOC_out = nlt_bgc_DOC + if (present(nt_bgc_DON_out) ) nt_bgc_DON_out = nt_bgc_DON + if (present(nlt_bgc_DON_out) ) nlt_bgc_DON_out = nlt_bgc_DON + if (present(nt_bgc_DIC_out) ) nt_bgc_DIC_out = nt_bgc_DIC + if (present(nlt_bgc_DIC_out) ) nlt_bgc_DIC_out = nlt_bgc_DIC + if (present(nt_bgc_Fed_out) ) nt_bgc_Fed_out = nt_bgc_Fed + if (present(nlt_bgc_Fed_out) ) nlt_bgc_Fed_out = nlt_bgc_Fed + if (present(nt_bgc_Fep_out) ) nt_bgc_Fep_out = nt_bgc_Fep + if (present(nlt_bgc_Fep_out) ) nlt_bgc_Fep_out = nlt_bgc_Fep + if (present(nt_zaero_out) ) nt_zaero_out = nt_zaero + if (present(nlt_zaero_out) ) nlt_zaero_out = nlt_zaero + if (present(nlt_zaero_sw_out) ) nlt_zaero_sw_out = nlt_zaero_sw + if (present(nlt_chl_sw_out) ) nlt_chl_sw_out = nlt_chl_sw + if (present(nt_zbgc_frac_out) ) nt_zbgc_frac_out = nt_zbgc_frac + + if (present(ntrcr_out) ) ntrcr_out = ntrcr + if (present(ntrcr_o_out) ) ntrcr_o_out = ntrcr_o + if (present(nbtrcr_out) ) nbtrcr_out = nbtrcr + if (present(nbtrcr_sw_out)) nbtrcr_sw_out = nbtrcr_sw end subroutine icepack_init_zbgc +!======================================================================= + + subroutine icepack_init_bgc_trcr(nk, nt_fbri, & + nt_bgc, nlt_bgc, & + bgctype, nt_depend, & + ntrcr, nbtrcr, & + bgc_tracer_type, trcr_depend, & + trcr_base, n_trcr_strata, & + nt_strata, bio_index) + + + integer (kind=int_kind), intent(in) :: & + nk , & ! counter + nt_depend , & ! tracer dependency index + nt_fbri + + integer (kind=int_kind), intent(inout) :: & + ntrcr , & ! number of tracers + nbtrcr , & ! number of bio tracers + nt_bgc , & ! tracer index + nlt_bgc ! bio tracer index + + integer (kind=int_kind), dimension(:), intent(inout) :: & + trcr_depend , & ! tracer dependencies + n_trcr_strata, & ! number of underlying tracer layers + bio_index ! + + integer (kind=int_kind), dimension(:,:), intent(inout) :: & + nt_strata ! indices of underlying tracer layers + + real (kind=dbl_kind), dimension(:,:), intent(inout) :: & + trcr_base ! = 0 or 1 depending on tracer dependency + ! argument 2: (1) aice, (2) vice, (3) vsno + + real (kind=dbl_kind), intent(in) :: & + bgctype ! bio tracer transport type (mobile vs stationary) + + real (kind=dbl_kind), dimension(:), intent(inout) :: & + bgc_tracer_type ! bio tracer transport type array + + ! local variables + + integer (kind=int_kind) :: & + k , & ! loop index + n_strata , & ! temporary values + nt_strata1, & ! + nt_strata2 + + real (kind=dbl_kind) :: & + trcr_base1, & ! temporary values + trcr_base2, & + trcr_base3 + + character(len=*),parameter :: subname='(icepack_init_bgc_trcr)' + + nt_bgc = ntrcr + 1 + nbtrcr = nbtrcr + 1 + nlt_bgc = nbtrcr + bgc_tracer_type(nbtrcr) = bgctype + + if (nk > 1) then + ! include vertical bgc in snow + do k = nk, nk+1 + ntrcr = ntrcr + 1 + trcr_depend (nt_bgc + k ) = 2 ! snow volume + trcr_base (nt_bgc + k,1) = c0 + trcr_base (nt_bgc + k,2) = c0 + trcr_base (nt_bgc + k,3) = c1 + n_trcr_strata(nt_bgc + k ) = 0 + nt_strata (nt_bgc + k,1) = 0 + nt_strata (nt_bgc + k,2) = 0 + enddo + + trcr_base1 = c0 + trcr_base2 = c1 + trcr_base3 = c0 + n_strata = 1 + nt_strata1 = nt_fbri + nt_strata2 = 0 + else ! nk = 1 + trcr_base1 = c1 + trcr_base2 = c0 + trcr_base3 = c0 + n_strata = 0 + nt_strata1 = 0 + nt_strata2 = 0 + endif ! nk + + do k = 1, nk !in ice + ntrcr = ntrcr + 1 + trcr_depend (nt_bgc + k - 1 ) = nt_depend + trcr_base (nt_bgc + k - 1,1) = trcr_base1 + trcr_base (nt_bgc + k - 1,2) = trcr_base2 + trcr_base (nt_bgc + k - 1,3) = trcr_base3 + n_trcr_strata(nt_bgc + k - 1 ) = n_strata + nt_strata (nt_bgc + k - 1,1) = nt_strata1 + nt_strata (nt_bgc + k - 1,2) = nt_strata2 + enddo + + bio_index (nlt_bgc) = nt_bgc + + end subroutine icepack_init_bgc_trcr + !======================================================================= !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, & + snow_bio_net, totalChla, fswthrun, & bgrid, igrid, icgrid, cgrid, & - nblyr, nilyr, nslyr, n_algae, n_zaero, ncat, & - n_doc, n_dic, n_don, n_fed, n_fep, & + nblyr, nilyr, nslyr, ncat, & 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 @@ -720,28 +1695,28 @@ subroutine icepack_biogeochemistry(dt, & ncat, & nilyr, & nslyr, & - nblyr, & - ntrcr, & - nbtrcr, & - n_algae, n_zaero, & - n_doc, n_dic, n_don, n_fed, n_fep + nblyr 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), 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 +1724,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), dimension (:,:), intent(out) :: & + flux_bion ! per categeory ice to ocean biogeochemistry flux (mmol/m2/s) + + real (kind=dbl_kind), 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 @@ -764,17 +1747,8 @@ subroutine icepack_biogeochemistry(dt, & PP_net , & ! Total production (mg C/m^2/s) per grid cell hbri , & ! brine height, area-averaged for comparison with hi (m) 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) + upNH , & ! ammonium uptake rate (mmol/m^2/d) times aice + 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 +1772,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,6 +1805,7 @@ 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) :: & @@ -842,14 +1817,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) + + bioPorosityIceCell(:) = c0 + bioSalinityIceCell(:) = c0 + 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) & @@ -857,11 +1843,10 @@ subroutine icepack_biogeochemistry(dt, & else first_ice(n) = .true. if (tr_brine) trcrn(nt_fbri,n) = c1 - if (z_tracers) then + !if (z_tracers) then do mm = 1,nbtrcr trcrn(nt_zbgc_frac-1+mm,n) = zbgc_frac_init(mm) enddo - endif endif if (aicen(n) > puny) then @@ -896,7 +1881,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(:) @@ -912,15 +1897,14 @@ subroutine icepack_biogeochemistry(dt, & 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), & @@ -948,7 +1932,8 @@ subroutine icepack_biogeochemistry(dt, & congeln(n), snoicen(n), & nbtrcr, fsnow, & ntrcr, trcrn(1:ntrcr,n), & - bio_index(1:nbtrcr), aicen_init(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), & @@ -958,29 +1943,35 @@ subroutine icepack_biogeochemistry(dt, & n_fed, n_fep, & n_zaero, first_ice(n), & hin_old(n), ocean_bio(1:nbtrcr), & + ocean_bio_dh(1:nbtrcr), & 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, & + darcy_V(n), & + bgrid, & igrid, icgrid, & 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), iSin, & + bioPorosityIceCell(:), bioSalinityIceCell(:), & + bioTemperatureIceCell(:) ) + if (icepack_warnings_aborted(subname)) return elseif (skl_bgc) then - call sklbio (dt, ntrcr, & + call sklbio (dt, Tf, & + ntrcr, & nbtrcr, n_algae, & n_doc, & n_dic, n_don, & @@ -998,6 +1989,16 @@ subroutine icepack_biogeochemistry(dt, & first_ice(n) = .false. + else + do mm = 1, nbtrcr + do k = 1, nblyr+1 + 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) + 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 ! aicen > puny enddo ! ncat @@ -1007,20 +2008,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 +2020,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(inout) :: & ocean_bio_all ! fixed order, all values even for tracers false !autodocument_end @@ -1120,14 +2111,7 @@ 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):: & amm , & ! ammonium @@ -1180,7 +2164,7 @@ subroutine icepack_init_ocean_bio (amm, dmsp, dms, algalN, doc, dic, don, & doc(2) = 9.0_dbl_kind ! lipids doc(3) = c1 ! do k = 1, max_dic - dic(k) = c1 + dic(k) = 1950.0_dbl_kind ! 1950-2260 mmol C/m3 (Tynan et al. 2015) enddo do k = 1, max_don don(k) = 12.9_dbl_kind @@ -1204,6 +2188,96 @@ subroutine icepack_init_ocean_bio (amm, dmsp, dms, algalN, doc, dic, don, & 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..e6099694e 100644 --- a/columnphysics/icepack_zbgc_shared.F90 +++ b/columnphysics/icepack_zbgc_shared.F90 @@ -14,9 +14,9 @@ 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: 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 +57,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 +100,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 +150,28 @@ 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 !----------------------------------------------------------------- @@ -549,12 +580,11 @@ end subroutine regrid_stationary ! for z layer biogeochemistry ! subroutine merge_bgc_fluxes (dt, nblyr, & - nslyr, & bio_index, n_algae, & nbtrcr, aicen, & vicen, vsnon, & - iphin, & - trcrn, & + iphin, & + trcrn, aice_init, & flux_bion, flux_bio, & upNOn, upNHn, & upNO, upNH, & @@ -562,15 +592,20 @@ 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, & + nslyr, 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 + nblyr, & + nslyr, & ! number of snow layers + n_algae, & ! nbtrcr ! number of biology tracer tracers integer (kind=int_kind), dimension(:), intent(in) :: & @@ -578,12 +613,15 @@ subroutine merge_bgc_fluxes (dt, nblyr, & 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):: & @@ -603,14 +641,18 @@ subroutine merge_bgc_fluxes (dt, nblyr, & zbgc_snow , & ! bio flux from snow to ice per cat (mmol/m^2/s) zbgc_atm , & ! bio flux from atm to ice per cat (mmol/m^2/s) ice_bio_net, & ! integrated ice tracers mmol or mg/m^2) - snow_bio_net ! integrated snow tracers mmol or mg/m^2) + snow_bio_net, &! integrated snow tracers mmol or mg/m^2) + 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 grow_net , & ! net specific growth (m/d) times vice upNO , & ! tot nitrate uptake rate (mmol/m^2/d) times aice - upNH ! tot ammonium uptake rate (mmol/m^2/d) times aice + upNH , & ! tot ammonium uptake rate (mmol/m^2/d) times aice + totalChla ! total Chla (mg chla/m^2) ! local variables @@ -645,18 +687,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 + bioPorosityIceCell(k) = bioPorosityIceCell(k) + iphin(k)*vicen + bioSalinityIceCell(k) = bioSalinityIceCell(k) + iSin(k)*vicen + bioTemperatureIceCell(k) = bioTemperatureIceCell(k) + iTin(k)*vicen + end do if (solve_zbgc) then do mm = 1, n_algae + 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 &