Skip to content

Commit

Permalink
fix tkn balance
Browse files Browse the repository at this point in the history
  • Loading branch information
joyxyz1994 committed May 21, 2024
1 parent 22224ec commit e8c35a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions qsdsan/sanunits/_junction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1924,15 +1924,15 @@ def _compile_reactions(self):
S_F_i_N = cmps_asm.S_F.i_N
# S_A_i_N = cmps_asm.S_A.i_N

# asm_X_I_i_N = cmps_asm.X_I.i_N
asm_X_I_i_N = cmps_asm.X_I.i_N
# asm_S_I_i_N = cmps_asm.S_I.i_N
asm_ions_idx = cmps_asm.indices(('S_NH4', 'S_A', 'S_NO3', 'S_PO4', 'S_ALK'))

# P balance
X_S_i_P = cmps_asm.X_S.i_P
S_F_i_P = cmps_asm.S_F.i_P
# S_A_i_P = cmps_asm.S_A.i_P
# asm_X_I_i_P = cmps_asm.X_I.i_P
asm_X_I_i_P = cmps_asm.X_I.i_P
# asm_S_I_i_P = cmps_asm.S_I.i_P

#!!! All checks are now done in `check_component_property`
Expand Down Expand Up @@ -2058,8 +2058,8 @@ def madm12asm2d(adm_vals):
#!!! equality is enforced in `check_component_properties`
# if asm_X_I_i_N == adm_X_I_i_N and asm_X_I_i_P == adm_X_I_i_P:
# X_I = xi_cod
# excess_N = (bio_cod * (1 - self.bio_to_xs))*asm_X_I_i_N
# excess_P = (bio_cod * (1 - self.bio_to_xs))*asm_X_I_i_P
excess_N = (bio_cod * (1 - self.bio_to_xs))*asm_X_I_i_N
excess_P = (bio_cod * (1 - self.bio_to_xs))*asm_X_I_i_P
# else:
# raise RuntimeError('N and P content in X_I should be same')

Expand Down Expand Up @@ -2285,8 +2285,8 @@ def madm12asm2d(adm_vals):
# S_PO4 = S_IP + si_p + ssub_p + xsub_p + xi_p + bio_p
#------------------------------Rai version---------------------------------------------

S_NH4 = S_IN + ssub_n + xsub_n + bio_n #- excess_N
S_PO4 = S_IP + ssub_p + xsub_p + bio_p #- excess_P
S_NH4 = S_IN + ssub_n + xsub_n + bio_n - excess_N
S_PO4 = S_IP + ssub_p + xsub_p + bio_p - excess_P

#------------------------------Rai version---------------------------------------------
# S_A += si_cod + ssub_cod + xsub_cod + xi_cod + xs_cod
Expand Down

0 comments on commit e8c35a4

Please sign in to comment.