One of the most important steps in any mesh-adaptation is determining which aspect of the solution best indicates where the mesh size must change. The choice is often problem dependent: the Mach number may work well for external aerodynamics but can be irrelevant for other flows. You can, as a post-processing step, derive a function from the flow field as shown in this video. The function you evaluate, as we shall see subsequently, can then be used to drive the mesh size.