  Catastrophically evaporating rocky planets provide a unique opportunity to
study the composition of small planets. The surface composition of these
planets can be constrained via modelling their comet-like tails of dust. In
this work, we present a new self-consistent model of the dusty tails: we
physically model the trajectory of the dust grains after they have left the
gaseous outflow, including an on-the-fly calculation of the dust cloud's
optical depth. We model two catastrophically evaporating planets: KIC 1255b and
K2-22b. For both planets, we find the dust is likely composed of magnesium-iron
silicates (olivine and pyroxene), consistent with an Earth-like composition. We
constrain the initial dust grain sizes to be $\sim$ 1.25-1.75 $\mu$m and the
average (dusty) planetary mass-loss rate to be $\sim$ 3$M_\oplus
\mathrm{Gyr^{-1}}$. Our model shows the origin of the leading tail of dust of
K2-22b is likely a combination of the geometry of the outflow and a low
radiation pressure force to stellar gravitational force ratio. We find the
optical depth of the dust cloud to be a factor of a few in the vicinity of the
planet. Our composition constraint supports the recently suggested idea that
the dusty outflows of these planets go through a greenhouse effect-nuclear
winter cycle, which gives origin to the observed transit depth time
variability. Magnesium-iron silicates have the necessary visible-to-infrared
opacity ratio to give origin to this cycle in the high mass-loss state.
