100100 Ksat = Qfe_ps / max (1.0f-30 , Qfe_ps + p. KfePS)
101101 PS = p. PCmax * (1.0f0 - exp (- αI)) * Bm * Ksat
102102 # RePS = PS * 4.0f0 / 2.6f0 # e:ATP = 4.0:2.6
103- # OPS = PS /2.6f0 # O2:ATP = 1.0:2.6
103+ # OPS = PS / 2.6f0 # O2:ATP = 1.0:2.6
104104 return PS
105105end
106106@kernel function calc_PS_kernel! (plank, trs, p)
@@ -116,17 +116,19 @@ end
116116
117117# #### calculate potential maximum respiration (mmolC/individual/second)
118118# #### and energy production (mmolATP/individual/second)
119- @inline function calc_respir (CH, T, p, ac, ΔT)
120- RS = CH * p . k_rs * tempFunc (T, p) * ac
121- RS = min (RS, CH / ΔT) # double check CH is not over consumed
122- # ERS = RS * p.e_rs * ac
123- # ORS = RS
124- # ReRS = 2.0f0/3.0f0*RS
125- return RS
119+ @inline function calc_respir (CH, Bm, qO2, T, p, ac, ΔT)
120+ Qo = qO2 / max ( 1.0f-30 , Bm + CH)
121+ regQO = shape_func_inc_alt (Qo, p . qOmax, 1.0f-1 , pow = 2.0f0 )
122+ RSo = CH * p. k_rs * regQO * tempFunc (T, p) * ac
123+ RSo = min (RSo, 0.5f0 * CH / ΔT, qO2 / ΔT) # double check CH and qO2 is not over consumed
124+ RSe = RSo
125+ return RSo, RSe
126126end
127127@kernel function calc_respiration_kernel! (plank, trs, p, ΔT)
128128 i = @index (Global)
129- @inbounds plank. RS[i] = calc_respir (plank. CH[i], trs. T[i], p, plank. ac[i], ΔT)
129+ @inbounds plank. RSo[i], plank. RSe[i] =
130+ calc_respir (plank. CH[i], plank. Bm[i], plank. qO2[i],
131+ trs. T[i], p, plank. ac[i], ΔT)
130132end
131133function calc_repiration! (plank, trs, p, ΔT, arch:: Architecture )
132134 kernel! = calc_respiration_kernel! (device (arch), 256 , (size (plank. ac,1 )))
159161# #### and energy consumption (mmolATP/individual/second)
160162@inline function calc_NR (qNO3, qNH4, qFeNR, Bm, CH, T, p, ac, ΔT)
161163 Qn = qNH4/ max (1.0f-30 , Bm + CH)
162- reg = shape_func_dec (Qn, p. qNH4max, 1.0f-4 , pow = 2.0f0 )
164+ reg = shape_func_dec (Qn , p. qNH4max, 1.0f-4 , pow = 2.0f0 )
163165 Qfe_NR = qFeNR / max (1.0f-30 , Bm + CH)
164166 Ksat = Qfe_NR / max (1.0f-30 , Qfe_NR + p. KfeNR)
165167 NR = p. k_nr * reg * qNO3 * Ksat * tempFunc (T, p) * ac
218220 plank. ERS[i], plank. ECF[i], plank. ENF[i], plank. ENR[i], plank. exEn[i] =
219221 energy_alloc (plank. PS[i], plank. ERS[i], plank. ECF[i],
220222 plank. ENF[i], plank. ENR[i], p)
221- @inbounds plank. RS[i] = plank. ERS[i] / p. e_rs
222223 @inbounds plank. CF[i] = plank. ECF[i] / p. e_cf
223224 @inbounds plank. NF[i] = plank. ENF[i] / p. e_nf
224225 @inbounds plank. NR[i] = plank. ENR[i] / p. e_nr
232233# #### update energy reserve and CH, and N quotas - second time
233234@kernel function update_state_2_kernel! (plank, ΔT)
234235 i = @index (Global)
235- @inbounds plank. CH[i] += (plank. CF[i] - plank. RS [i]) * ΔT
236+ @inbounds plank. CH[i] += (plank. CF[i] - plank. RSo[i] - plank . RSe [i]) * ΔT
236237 @inbounds plank. qNO3[i] += - plank. NR[i] * ΔT
237238 @inbounds plank. qNH4[i] += plank. NR[i] * ΔT
238239 @inbounds plank. qNH4[i] += plank. NF[i] * ΔT
0 commit comments