Skip to content

Commit

Permalink
mpb
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydro Modeller committed Mar 30, 2022
1 parent 25e965b commit d78846d
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/aed_phytoplankton.F90
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,9 @@ SUBROUTINE aed_define_phytoplankton(data, namlst)
! Register benthic phyto diagnostic variables
IF(do_mpb>0) THEN
data%id_d_MPB = aed_define_sheet_diag_variable('mpb_ben','mmol C/m2' ,'microphytobenthos density')
data%id_d_BPP = aed_define_sheet_diag_variable('gpp_ben','mmol C/m2/d','benthic gross productivity')
data%id_d_BCP = aed_define_sheet_diag_variable('ncp_ben','mmol C/m2/d','benthic net productivity')
data%id_d_mpbv= aed_define_sheet_diag_variable('swi_mpb','mmol C/m2/d','mpb vertical exchange')
data%id_d_BPP = aed_define_sheet_diag_variable('mpb_gpp','mmol C/m2/d','benthic gross productivity')
data%id_d_BCP = aed_define_sheet_diag_variable('mpb_rsp','mmol C/m2/d','benthic phyto respiration')
data%id_d_mpbv= aed_define_sheet_diag_variable('mpb_swi','mmol C/m2/d','mpb vertical exchange')
ENDIF

! Register environmental dependencies
Expand Down Expand Up @@ -1236,12 +1236,13 @@ SUBROUTINE aed_calculate_benthic_phytoplankton(data,column,layer_idx)
IF ( data%do_mpb>0 ) THEN
! Get local conditions
matz = _STATE_VAR_S_(data%id_sedzone) ! local benthic type
mpb = _STATE_VAR_S_(data%id_mpb) ! local mpb density
Io = _STATE_VAR_S_(data%id_I_0) ! surface short wave radiation
temp = _STATE_VAR_(data%id_tem) ! local temperature
extc = _STATE_VAR_(data%id_extc) ! cell extinction
par = _STATE_VAR_(data%id_par) ! local photosynt. active radiation
dz = _STATE_VAR_(data%id_dz) ! cell depth
mpb = _STATE_VAR_S_(data%id_mpb) ! local mpb density
IF(data%do_mpb==2) mpb = _DIAG_VAR_S_(data%id_d_mpb)

! Get sedimentation flux (mmmol/m2/d) loss into the benthos (diagnostic was set in mobility)
Psed_phy = _DIAG_VAR_(data%id_Psed_phy)
Expand All @@ -1253,35 +1254,35 @@ SUBROUTINE aed_calculate_benthic_phytoplankton(data,column,layer_idx)
mpb_flux = (mpb_prod-mpb_resp)*mpb

! Update the MPB biomass, include net production and add sedimented phytos (mmolC/m2/s)
_FLUX_VAR_B_(data%id_mpb) = _FLUX_VAR_B_(data%id_mpb) + mpb_flux + (-Psed_phy/secs_per_day)
IF(data%do_mpb/=2) _FLUX_VAR_B_(data%id_mpb) = _FLUX_VAR_B_(data%id_mpb) + mpb_flux + (-Psed_phy/secs_per_day)

! log this uptake into the bulk community GPP/NCP diagnostics (mmolC/m3/d)
_DIAG_VAR_(data%id_GPP) = _DIAG_VAR_(data%id_GPP) + (mpb_prod/dz) * mpb * secs_per_day
_DIAG_VAR_(data%id_NCP) = _DIAG_VAR_(data%id_NCP) + (mpb_flux/dz) * secs_per_day

! Update flux terms for other O2, CO2 and nutrient fluxes (mmolO2/m2/s)
IF (data%do_DOuptake) THEN
_FLUX_VAR_(data%id_DOupttarget) = _FLUX_VAR_(data%id_DOupttarget) + mpb_flux
IF(data%do_mpb/=2)_FLUX_VAR_(data%id_DOupttarget) = _FLUX_VAR_(data%id_DOupttarget) + mpb_flux
ENDIF
IF (data%do_Cuptake) THEN
_FLUX_VAR_(data%id_Cupttarget) = _FLUX_VAR_(data%id_Cupttarget) - mpb_flux
IF(data%do_mpb/=2)_FLUX_VAR_(data%id_Cupttarget) = _FLUX_VAR_(data%id_Cupttarget) - mpb_flux
! log this uptake into the bulk community C uptake diagnostic
_DIAG_VAR_(data%id_CUP) = _DIAG_VAR_(data%id_CUP) - (mpb_flux/dz) * secs_per_day
ENDIF
! A quick and dirty nutrient uptake by MPB; needs cleaning to account for limitation and excretion of DOM
IF (data%do_Nuptake) THEN
! increment flux from bottom cell nutrient amount (mmol N/m2/s)
_FLUX_VAR_(data%id_Nupttarget(1)) = &
IF(data%do_mpb/=2)_FLUX_VAR_(data%id_Nupttarget(1)) = &
_FLUX_VAR_(data%id_Nupttarget(1)) - mpb_flux * (16./106.) *0.5
_FLUX_VAR_(data%id_Nupttarget(2)) = &
IF(data%do_mpb/=2)_FLUX_VAR_(data%id_Nupttarget(2)) = &
_FLUX_VAR_(data%id_Nupttarget(2)) - mpb_flux * (16./106.) *0.5
! log this uptake into the bulk community N uptake diagnostic (mmol N/m3/d)
_DIAG_VAR_(data%id_NUP1)= _DIAG_VAR_(data%id_NUP1)- (mpb_flux/dz) * (16./106.) *0.5 * secs_per_day
_DIAG_VAR_(data%id_NUP2)= _DIAG_VAR_(data%id_NUP2)- (mpb_flux/dz) * (16./106.) *0.5 * secs_per_day
ENDIF
IF (data%do_Puptake) THEN
! increment flux from bottom cell nutrient (po4) amount (mmol P/m2/s)
_FLUX_VAR_(data%id_Pupttarget(1)) = _FLUX_VAR_(data%id_Pupttarget(1)) - mpb_flux * (1./106.)
IF(data%do_mpb/=2)_FLUX_VAR_(data%id_Pupttarget(1)) = _FLUX_VAR_(data%id_Pupttarget(1)) - mpb_flux * (1./106.)
! log this uptake into the bulk community P uptake diagnostic (mmol P/m3/d)
_DIAG_VAR_(data%id_PUP) = _DIAG_VAR_(data%id_PUP) - mpb_flux * (1./106.) * secs_per_day
ENDIF
Expand All @@ -1294,7 +1295,7 @@ SUBROUTINE aed_calculate_benthic_phytoplankton(data,column,layer_idx)
phy_sed_frac = SUM(data%resuspension(1:data%num_phytos))
Fsed_phy = _DIAG_VAR_S_(data%id_l_resus) * phy_sed_frac

_FLUX_VAR_B_(data%id_mpb) = _FLUX_VAR_B_(data%id_mpb) - Fsed_phy
IF(data%do_mpb/=2)_FLUX_VAR_B_(data%id_mpb) = _FLUX_VAR_B_(data%id_mpb) - Fsed_phy

IF( phy_sed_frac > zero_ ) THEN
DO phy_i=1,data%num_phytos
Expand Down Expand Up @@ -1324,9 +1325,9 @@ SUBROUTINE aed_calculate_benthic_phytoplankton(data,column,layer_idx)
ENDIF

! Update the diagnostic variables (mmol C/m2/d)
_DIAG_VAR_S_(data%id_d_mpb) = mpb
IF(data%do_mpb/=2) _DIAG_VAR_S_(data%id_d_mpb) = mpb
_DIAG_VAR_S_(data%id_d_bpp) = (mpb_prod) * mpb * secs_per_day
_DIAG_VAR_S_(data%id_d_bcp) = mpb_flux * secs_per_day
_DIAG_VAR_S_(data%id_d_bcp) = (mpb_resp) * mpb * secs_per_day
_DIAG_VAR_S_(data%id_d_mpbv)= -Psed_phy - (Fsed_phy * secs_per_day)
_DIAG_VAR_S_(data%id_d_res) = Fsed_phy * secs_per_day
ENDIF
Expand Down

0 comments on commit d78846d

Please sign in to comment.