BioSTEAMDevelopmentGroup / biosteam

The Biorefinery Simulation and Techno-Economic Analysis Modules; Life Cycle Assessment; Chemical Process Simulation Under Uncertainty
Other
175 stars 35 forks source link

Negative water flows in permeate of AnMBR in high-rate WWT system #152

Closed yoelcortes closed 1 year ago

yoelcortes commented 1 year ago

@yalinli2.

I'm running into an issue with negative flow rates in the new high-rate wastewater treatment system. The issue is at the AnMBR. It seems like it requires high moisture contents to work well. The new systems with microbial production of TAG produces a ton of biomass and leads to much larger solid contents. I'm not sure if any changes should be made to accommodate higher solids contents or if the system should not operate in these regions. Do you have any recommendations?

Code to reproduce:

# Initialize WWT system just as in documentation
from biosteam import Stream, create_high_rate_wastewater_treatment_system, settings
from biorefineries import cornstover as cs
settings.set_thermo(cs.create_chemicals())
feed = Stream(
    ID='wastewater', 
    Water=2.634e+04, 
    Ethanol=0.07225, 
    AceticAcid=24.67, 
    Furfural=6.206, 
    Glycerol=1.784, 
    LacticAcid=17.7, 
    SuccinicAcid=3.472, 
    DAP=1.001, 
    AmmoniumSulfate=17.63, 
    HMF=2.366, 
    Glucose=2.816, 
    Xylose=6.953, 
    Arabinose=12.78, 
    Extract=65.98, 
    Ash=83.52, 
    Lignin=1.659, 
    SolubleLignin=4.202, 
    GlucoseOligomer=6.796, 
    GalactoseOligomer=0.01718, 
    MannoseOligomer=0.009008, 
    XyloseOligomer=2.878, 
    ArabinoseOligomer=0.3508, 
    Z_mobilis=0.6668, 
    Protein=2.569, 
    Glucan=0.1555, 
    Xylan=0.06121, 
    Xylitol=4.88, 
    Cellobiose=0.9419, 
    Arabinan=0.02242, 
    Mannan=0.06448, 
    Galactan=0.01504, 
    Cellulase=25.4, 
    units='kmol/hr'
)
wwt_sys = create_high_rate_wastewater_treatment_system(ins=feed)
wwt_sys.simulate()

# Attempt to simulate AnMBR at different moisture contents until error
import numpy as np
import biosteam as bst
AnMBR = wwt_sys.flowsheet(bst.wastewater.high_rate.AnMBR)
feed = AnMBR.ins[0] 
permeate = AnMBR.outs[1]
moisture_contents = np.linspace(0.99, 0.8)
other = feed.F_mass - feed.imass['Water'] # Anything other than water 
def set_moisture_content(moisture_content):
    other_check = feed.F_mass - feed.imass['Water']
    assert abs(other - other_check) < 1e-6, 'feed flow changes after simulation'
    water_over_other = moisture_content / (1 - moisture_content)
    feed.imass['Water'] = water_over_other * other 
    assert abs(get_moisture_content() - moisture_content) < 1e-6

def get_moisture_content():
    return feed.imass['Water'] / feed.F_mass

set_moisture_content(get_moisture_content()) # 

for i in moisture_contents:
    set_moisture_content(i)
    AnMBR.simulate()
    assert permeate.imass['Water'] > 0, f'negative water flow in permeate at {i:%} feed moisture content'

Output:

AssertionError: negative water flow in permeate at 95.510204% feed moisture content

Version

Thanks!

yoelcortes commented 1 year ago

@yalinli2, I believe the issue has to do on my side with what I am sending to the wastewater treatment system. The amount of biomass I am producing is at a higher concentration than normal. I'll try to fix it, but let me know if you have any recommendations.

Thanks!

yalinli2 commented 1 year ago

@yoelcortes the problem has to do with the default sludge concentration in the waste sludge.

There's an attribute called sludge_conc (default to 10.5 g/L, so a little over 1%), that defines the concentration of the sludge in the wasted sludge stream, you need to have enough water in the feedstock so that your waste sludge stream can meet the sludge_conc you set.

You can increase sludge_conc to make it work, but at the same time I don't think AnMBR can give you a sludge concentration of 20%, the moisture content of the influent matters, but you can't stretch it too far.

For one Gates' paper there was an AnMBR (much much smaller than the one here, that one was a modular one used for toilets) and the Gates folks talked to the design team, they ultimately settled on a 93% moisture content, which I think is already on the higher end.

I updated biosteam@wwt to issue a clearer error so that the users know which attribute to adjust.

Output

ValueError: Not enough moisture in the influent for waste sludge with 10.5 g/L sludge concentration.

Also I have multiple travels these weeks so my response is a bit slow, sorry about this!

yalinli2 commented 1 year ago

PS, if you look at the membrane bioreactor in Humbird, I think the moisture content of the sludge is like 98-99%

yoelcortes commented 1 year ago

@yalinli2, thanks so much for the detailed reply! This helps a ton. I managed to reduce the wastewater solids content (now the wastewater is 98.6% water) and got all microbial oil biorefineries working.

Thank you!