Analysis and modeling of structure formation in granular and fluid-solid flows