Modeling and optimization of an upflow anaerobic sludge blanket (UASB) system treating blackwaters