A mathematical model for the prediction of mucilage dynamics