Microbes interact by secreting diffusive chemicals into their environment. Cooperators are seen as bright green dots, and cheaters are seen as dark green dots. The waste compound is shown as blue and the public good as red, the two combined is seen as magenta. Top row: In the homogeneous phase the microbes spread to fill the domain. Cheaters quickly begin to take over, and eventually take over the whole domain. With no cooperators left, the public good decays away and the system goes extinct. Middle row: In the group phase, when the diffusion length of the waste compound is larger than the diffusion length of public good, microbes form stable groups. As the microbes increase in number, the groups split apart and form new groups. As mutations occur within groups, the cheaters take over and the group goes extinct. Cooperation can only be stable here if groups reproduce quicker than mutants take over. Bottom row: By adding a shearing flow to the group system, we can cause the groups to split apart quicker. Mutations still take over groups, but the groups are able to reproduce quicker than mutants take over, thus allowing cooperative groups to prevail at steady state. The simulation videos corresponding to this figure are provided in the Videos 1–3.