! BioCGT processes file
! *********************
! properties of processes:
! name=           fortran variable name for the rate
! description=    e.g. "grazing of zooplankton"
! turnover=       fortran formula for calculating the process turnover [mol/kg or mol/m2]
! equation=       equation which, like a chemical equation, lists reaction agents and products of this process.
!                   example: t_no3 + 1/16*t_po4 -> t_lpp
!                   tracers to the left of the "->" are consumed, tracers to the right of the "->" are produced by this process.
! isActive=       1=active (default); 0=process is switched off
! isOutput=       1=occurs as output in model results; 0=internal use only (default)
! limitation=     TYPE tracer > value else otherProcess
! limitation=     TYPE tracer < value else otherProcess
!                   TYPE = HARD (theta function), MM (Michaelis-Menten), MMQ (quadratic Michaelis-Menten), IV (Ivlev), IVQ (quadratic Ivlev), LIN (linear), TANH (tangens hyperbolicus)
!                   tracer = name of tracer that needs to be present
!                   value = value that needs to be exceeded, may also be a constant or auxiliary
!                   otherProcess = process that takes place instead if this process gets hampered by the availability of "tracer"
!                 several of these lines may exist, the order of them may be relevant for the rate of "otherProcess".
! processType=    type of process, e.g. "propagation", default="standard"
! repaint=        number n of repainting actions to be done by the process, default=0
!                 This line is followed by n lines of this kind:
!   <oldColor> <element> = <newColor>    e.g.: "all  N   = blue "
!                                              "blue P   = none "
!                                              "red  all = green"
! vertLoc=        WAT=z-dependent (default), SED=in the sediment only, SUR=in the surface only, FIS=fish-type behaviour
! feedingEfficiency= name of an auxiliary variable (values 0..1) which tells how much of the food in a certain depth is accessible for the predator with vertLoc=FIS. Relevant for vertLoc=FIS only. Default="1.0"
! comment=        comment, default=""
!
! Process rates are calculated in the given order.
! *************************************************************************************
name        = p_n2_stf_down
description = downward nitrogen flux through the surface
turnover    = w_n2_stf*(n2_sat-t_n2)*theta(n2_sat-t_n2)*cgt_density
comment     = relaxation of nitrogen concentration against saturation at surface using \\piston-velocity, downward oxygen flow
equation    =  -> t_n2
vertLoc     = SUR
processType = gas_exchange
***********************
name        = p_n2_stf_up
description = upward nitrogen flux through the surface
turnover    = w_n2_stf*(t_n2-n2_sat)*theta(t_n2-n2_sat)*cgt_density
comment     = relaxation of nitrogen concentration against saturation at surface using piston-velocity, upward oxygen flow
equation    = t_n2 -> 
vertLoc     = SUR
processType = gas_exchange
***********************
name        = p_o2_stf_down
description = downward oxygen flux through the surface
turnover    = w_o2_stf*(o2_sat-t_o2)*theta(o2_sat-t_o2)*cgt_density
comment     = relaxation of oxygen concentration against saturation at surface using piston-velocity, downward oxygen flow
equation    =  -> t_o2
vertLoc     = SUR
processType = gas_exchange
***********************
name        = p_o2_stf_up
description = upward oxygen flux through the surface
turnover    = w_o2_stf*(t_o2-o2_sat)*theta(t_o2-o2_sat)*cgt_density
comment     = relaxation of oxygen concentration against saturation at surface using piston-velocity, upward oxygen flow
equation    = t_o2 -> 
vertLoc     = SUR
processType = gas_exchange
***********************
name        = p_co2_stf_down
description = downward co2 flux through the surface
turnover    = w_co2_stf*(patm_co2-pco2)*k0_co2*theta(patm_co2-pco2)*cgt_density
comment     = relaxation of co2 concentration against saturation at surface using piston-velocity, downward co2 flow
equation    =  -> t_dic
vertLoc     = SUR
isOutput    = 1
processType = gas_exchange
***********************
name        = p_co2_stf_up
description = upward co2 flux through the surface
turnover    = w_co2_stf*(pco2-patm_co2)*k0_co2*theta(pco2-patm_co2)*cgt_density
comment     = relaxation of co2 concentration against saturation at surface using piston-velocity, upward co2 flow
equation    = t_dic -> 
vertLoc     = SUR
isOutput    = 1
processType = gas_exchange
***********************
name        = p_no3_assim_lpp
description = assimilation of nitrate by large-cell phytoplankton
turnover    = lpp_plus_lpp0*lr_assim_lpp*t_no3/(din+epsilon)
equation    = 1.1875*h3oplus + 6.4375*h2o + rfr_c*t_dic + rfr_p*t_po4 + t_no3 -> 8.625*t_o2 + t_lpp
***********************
name        = p_nh4_assim_lpp
description = assimilation of ammonium by large-cell phytoplankton
turnover    = lpp_plus_lpp0*lr_assim_lpp*t_nh4/(din+epsilon)
equation    = t_nh4 + rfr_p*t_po4 + rfr_c*t_dic + 7.4375*h2o -> t_lpp + 6.625*t_o2 + 0.8125*h3oplus
***********************
name        = p_no3_assim_spp
description = assimilation of nitrate by small-cell phytoplankton
turnover    = spp_plus_spp0*lr_assim_spp*t_no3/(din+epsilon)
equation    = 1.1875*h3oplus + 6.4375*h2o + rfr_c*t_dic + rfr_p*t_po4 + t_no3 -> 8.625*t_o2 + t_spp
***********************
name        = p_nh4_assim_spp
description = assimilation of ammonium by small-cell phytoplankton
turnover    = spp_plus_spp0*lr_assim_spp*t_nh4/(din+epsilon)
equation    = 7.4375*h2o + 0*h2o + rfr_c*t_dic + rfr_p*t_po4 + t_nh4 -> 0.8125*h3oplus + 6.625*t_o2 + t_spp
***********************
name        = p_n2_assim_cya
description = fixation of dinitrogen by diazotroph cyanobacteria
turnover    = cya_plus_cya0*lr_assim_cya
equation    = 7.9375*h2o + rfr_c*t_dic + rfr_p*t_po4 + 0.5*t_n2 + 0.1875*h3oplus -> 7.375*t_o2 + t_cya
repaint     = 1
  all N = blue
***********************
name        = p_lpp_graz_zoo
description = grazing of large-cell phytoplankton by zooplankton
turnover    = (t_zoo+zoo0)*lr_graz_zoo*t_lpp/max(food_zoo,epsilon)
equation    = t_lpp -> t_zoo
***********************
name        = p_spp_graz_zoo
description = grazing of small-cell phytoplankton by zooplankton
turnover    = (t_zoo+zoo0)*lr_graz_zoo*t_spp/max(food_zoo,epsilon)
equation    = t_spp -> t_zoo
***********************
name        = p_cya_graz_zoo
description = grazing of diazotroph cyanobacteria by zooplankton
turnover    = (t_zoo+zoo0)*lr_graz_zoo*(0.5*t_cya)/max(food_zoo,epsilon)
equation    = t_cya -> t_zoo
***********************
name        = p_lpp_resp_nh4
description = respiration of large-cell phytoplankton
turnover    = t_lpp*r_pp_resp
equation    = 0.8125*h3oplus + 6.625*t_o2 + t_lpp -> 7.4375*h2o + rfr_c*t_dic + rfr_p*t_po4 + t_nh4
***********************
name        = p_spp_resp_nh4
description = respiration of small-cell phytoplankton
turnover    = t_spp*r_pp_resp
equation    = t_spp + 6.625*t_o2 + 0.8125*h3oplus -> t_nh4 + rfr_p*t_po4 + rfr_c*t_dic + 7.4375*h2o
***********************
name        = p_cya_resp_nh4
description = respiration of diazotroph cyanobacteria
turnover    = t_cya*r_pp_resp
equation    = t_cya + 6.625*t_o2 + 0.8125*h3oplus -> t_nh4 + rfr_p*t_po4 + rfr_c*t_dic + 7.4375*h2o
***********************
name        = p_zoo_resp_nh4
description = respiration of zooplankton
turnover    = zoo_eff*r_zoo_resp
equation    = 0.8125*h3oplus + 6.625*t_o2 + t_zoo -> 7.4375*h2o + rfr_c*t_dic + rfr_p*t_po4 + t_nh4
***********************
name        = p_lpp_mort_det
description = mortality of large-cell phytoplankton
turnover    = t_lpp*r_pp_mort*(1+9*theta(5.0e-6-t_o2))
equation    = t_lpp -> t_det
***********************
name        = p_spp_mort_det
description = mortality of small-cell phytoplankton
turnover    = t_spp*r_pp_mort*(1+9*theta(5.0e-6-t_o2))
equation    = t_spp -> t_det
***********************
name        = p_cya_mort_det
description = mortality of diazotroph cyanobacteria
turnover    = t_cya*r_pp_mort*(1+9*theta(5.0e-6-t_o2))
equation    = t_cya -> t_det
***********************
name        = p_zoo_mort_det
description = mortality of zooplankton
turnover    = zoo_eff*r_zoo_mort*(1+9*theta(5.0e-6-t_o2))
equation    = t_zoo -> t_det
***********************
name        = p_nh4_nit_no3
description = nitrification
turnover    = t_nh4*r_nh4_nitrif*exp(q10_nit*cgt_temp)
equation    = t_nh4 + 2*t_o2 + h2o -> t_no3 + 2*h3oplus
limitation  = MM t_o2 > o2_min_nit
***********************
name        = p_det_resp_nh4
description = recycling of detritus using oxygen (respiration)
turnover    = t_det*r_det_rec*exp(q10_det_rec*cgt_temp)
equation    = 0.8125*h3oplus + 6.625*t_o2 + t_det -> 7.4375*h2o + rfr_c*t_dic + rfr_p*t_po4 + t_nh4
limitation  = IV t_o2 > o2_min_det_resp
***********************
name        = p_det_denit_nh4
description = recycling of detritus using nitrate (denitrification)
turnover    = t_det*r_det_rec*exp(q10_det_rec*cgt_temp)
comment     = as long as there is enough nitrate, no H2S("negative \\oxygen") is generated (2 NO3- + \\2 H3O+ -> N2 + 3 H2O + 5/2 O2)
equation    = 6.1125*h3oplus + 5.3*t_no3 + t_det -> rfr_c*t_dic + rfr_p*t_po4 + t_nh4 + 15.3875*h2o + 2.65*t_n2
limitation  = IV t_o2 < o2_min_det_resp
limitation  = IV t_no3 > no3_min_det_denit
***********************
name        = p_det_sulf_nh4
description = recycling of detritus using sulfate (sulfate reduction)
turnover    = t_det*r_det_rec*exp(q10_det_rec*cgt_temp)
equation    = t_det + 3.3125*so4 + 7.4375*h3oplus -> t_nh4 + rfr_p*t_po4 + rfr_c*t_dic + 3.3125*t_h2s + 14.0625*h2o
limitation  = IV t_o2 < o2_min_det_resp
limitation  = IV t_no3 < no3_min_det_denit
***********************
name        = p_sed_resp_nh4
description = recycling of sedimentary detritus to ammonium using oxygen (respiration)
turnover    = lr_sed_rec*sed_active
equation    = 0.8125*h3oplus + 6.625*t_o2 + t_sed -> 7.4375*h2o + rfr_c*t_dic + rfr_p*t_po4 + t_nh4
vertLoc     = SED
***********************
name        = p_nh4_nitdenit_n2
description = coupled nitrification and denitrification after mineralization of detritus in oxic sediments
turnover    = frac_denit_sed*p_sed_resp_nh4*theta(t_o2-5.0e-6)
comment     = NH4+ + 0.75 O2 -> 1/2 N2 + 1/2 H2O + H3O+
equation    = t_nh4 + 0.75*t_o2 -> 0.5*h2o + h3oplus + 0.5*t_n2
vertLoc     = SED
***********************
name        = p_sed_denit_nh4
description = recycling of sedimentary detritus to ammonium using nitrate (denitrification)
turnover    = lr_sed_rec*sed_active
comment     = as long as there is enough nitrate, no "negative oxygen" is \\generated (2 NO3- + 2 \\H3O+ -> N2 + 3 H2O + 5/2 O2)
equation    = 5.3*t_no3 + 6.1125*h3oplus + t_sed -> 15.3875*h2o + 2.65*t_n2 + t_nh4 + rfr_p*t_po4 + rfr_c*t_dic
vertLoc     = SED
limitation  = HARD t_o2 < 0.0
limitation  = MMQ t_no3 > no3_min_sed_denit
***********************
name        = p_sed_sulf_nh4
description = recycling of sedimentary detritus to ammonium using sulfate (sulfate reduction)
turnover    = lr_sed_rec*sed_active
equation    = 7.4375*h3oplus + 3.3125*so4 + t_sed -> 14.0625*h2o + 3.3125*t_h2s + rfr_c*t_dic + rfr_p*t_po4 + t_nh4
vertLoc     = SED
limitation  = HARD t_o2 < 0.0
limitation  = MMQ t_no3 < no3_min_sed_denit
***********************
name        = p_po4_retent_ips
description = retention of phosphate in the sediment under oxic conditions
turnover    = p_sed_resp_nh4*frac_po4retent*rfr_p
equation    = fe3plus + t_po4 -> t_ips
vertLoc     = SED
limitation  = MMQ t_o2 > o2_min_po4_retent
***********************
name        = p_ips_liber_po4
description = liberation of phosphate from the sediment under anoxic conditions
turnover    = t_ips*r_ips_liber
comment     = FePO4 -> PO43- + Fe3+
equation    = t_ips -> fe3plus + t_po4
vertLoc     = SED
limitation  = HARD t_h2s > h2s_min_po4_liber
***********************
name        = p_h2s_oxo2_sul
description = oxidation of hydrogen sulfide with oxygen
turnover    = t_h2s*t_o2*k_h2s_o2*exp(q10_h2s*cgt_temp)
equation    = t_h2s + 0.5*t_o2 -> t_sul + h2o
***********************
name        = p_h2s_oxno3_sul
description = oxidation of hydrogen sulfide with nitrate
turnover    = t_h2s*t_no3*k_h2s_no3*exp(q10_h2s*cgt_temp)
equation    = 0.4*h3oplus + 0.4*t_no3 + t_h2s -> 0.2*t_n2 + 1.6*h2o + t_sul
***********************
name        = p_sul_oxo2_so4
description = oxidation of elemental sulfur with oxygen
turnover    = t_sul*t_o2*k_sul_o2*exp(q10_h2s*cgt_temp)
equation    = 3*h2o + 1.5*t_o2 + t_sul -> 2*h3oplus + so4
***********************
name        = p_sul_oxno3_so4
description = oxidation of elemental sulfur with nitrate
turnover    = t_sul*t_no3*k_sul_no3*exp(q10_h2s*cgt_temp)
equation    = 1.2*h2o + 1.2*t_no3 + t_sul -> 0.6*t_n2 + 0.8*h3oplus + so4
***********************
name        = p_det_sedi_sed
description = detritus sedimentation
turnover    = (1.0-erosion_is_active)*w_det_sedi*t_det*cgt_density
equation    = t_det -> t_sed
vertLoc     = SED
***********************
name        = p_ipw_sedi_ips
description = sedimentation of iron PO4
turnover    = (1.0-erosion_is_active)*w_ipw_sedi*t_ipw*cgt_density
equation    = t_ipw -> t_ips
vertLoc     = SED
***********************
name        = p_sed_ero_det
description = sedimentary detritus erosion
turnover    = erosion_is_active*r_sed_ero*sed_active
equation    = t_sed -> t_det
vertLoc     = SED
***********************
name        = p_ips_ero_ipw
description = erosion of iron PO4
turnover    = erosion_is_active*r_ips_ero*t_ips
equation    = t_ips -> t_ipw
vertLoc     = SED
***********************
name        = p_sed_biores_det
description = bio resuspension of sedimentary detritus
turnover    = r_biores*sed_active
equation    = t_sed -> t_det
vertLoc     = SED
limitation  = MMQ t_o2 > o2_min_sed_resp
***********************
name        = p_ips_biores_ipw
description = bio resuspension of iron PO4
turnover    = r_biores*t_ips
equation    = t_ips -> t_ipw
vertLoc     = SED
limitation  = MMQ t_o2 > o2_min_sed_resp
***********************
name        = p_sed_burial
description = burial of benthos deeper than max_sed
turnover    = (t_sed-sed_active)/cgt_timestep
equation    = t_sed -> 
vertLoc     = SED
***********************
name        = p_ips_burial
description = burial of iron PO4
turnover    = ips_eff*r_ips_burial*sed_active/sed_max
equation    = t_ips -> 
vertLoc     = SED
***********************
