An inversion approach to assimilation and fractional crystallisation processes