Multiscale modeling of microbial communities