Skip to content

Commit

Permalink
added doctest for ADM1_p_extension
Browse files Browse the repository at this point in the history
  • Loading branch information
joyxyz1994 committed Oct 22, 2024
1 parent b8b55aa commit 7f566bb
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion qsdsan/processes/_adm1_p_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def _rhos_adm1_p_extension(state_arr, params, h=None):
rhos[9] *= Inh3
rhos[-3:] = kLa * (biogas_S - KH * biogas_p)

# print(rhos)
return rhos

def dydt_Sh2_AD(S_h2, state_arr, h, params, f_stoichio, V_liq, S_h2_in):
Expand Down Expand Up @@ -355,6 +354,42 @@ class ADM1_p_extension(ADM1):
>>> adm1_p.show()
ADM1_p_extension([hydrolysis_carbs, hydrolysis_proteins, hydrolysis_lipids, uptake_sugars, uptake_amino_acids, uptake_LCFA, uptake_valerate, uptake_butyrate, uptake_propionate, uptake_acetate, uptake_h2, decay_Xsu, decay_Xaa, decay_Xfa, decay_Xc4, decay_Xpro, decay_Xac, decay_Xh2, storage_Sva_in_XPHA, storage_Sbu_in_XPHA, storage_Spro_in_XPHA, storage_Sac_in_XPHA, lysis_XPAO, lysis_XPP, lysis_XPHA, h2_transfer, ch4_transfer, IC_transfer])
>>> import numpy as np
>>> state_arr = np.ones(cmps.size + len(adm1_p._biogas_IDs) + 2) # liquid-phase concentrations, gas-phase concentrations, liquid flowrate, and temperature
>>> state_arr[-1] = 273.15+35 # Temperature
>>> rhos = adm1_p.rate_function(state_arr) # reaction rate for each process
>>> for i,j in zip(adm1_p.IDs, rhos):
... print(f'{i}{(40-len(i))*" "}{j:.3g}')
hydrolysis_carbs 10
hydrolysis_proteins 10
hydrolysis_lipids 10
uptake_sugars 20
uptake_amino_acids 38.4
uptake_LCFA 2.14e-05
uptake_valerate 8.32e-05
uptake_butyrate 8.32e-05
uptake_propionate 4.13e-05
uptake_acetate 1.93
uptake_h2 34.9
decay_Xsu 0.02
decay_Xaa 0.02
decay_Xfa 0.02
decay_Xc4 0.02
decay_Xpro 0.02
decay_Xac 0.02
decay_Xh2 0.02
storage_Sva_in_XPHA 0.747
storage_Sbu_in_XPHA 0.747
storage_Spro_in_XPHA 0.747
storage_Sac_in_XPHA 0.747
lysis_XPAO 0.2
lysis_XPP 0.2
lysis_XPHA 0.2
h2_transfer 139
ch4_transfer -181
IC_transfer -1.66e+03
References
----------
[1] Batstone, D. J.; Keller, J.; Angelidaki, I.; Kalyuzhnyi, S. V;
Expand Down

0 comments on commit 7f566bb

Please sign in to comment.