Why is the cell data not available in the DEFINE_SPECIFIC_HEAT UDF?
The UDF for specific heat is called as part of the material definition in the solver where the cell is not available. This is a limitation for this macro and its Real Gas equivalent.
Cp is by definition ∂H/∂T, so for it to have other dependencies is not expected by the solver. Since Cp and enthalpy definitions are critical to the stability of the energy equation, a strict format has to be defined so that the UDF doesn't cause instabilities.
The only way to vary the Cp at the cell level is via the variation of the mass fractions of a mixture. This is what most users are trying to emulate when they are using a UDS, UDM or similar value to vary Cp. They should instead add a new species (which is not much more expensive than a UDS) to follow the material flow. The species could be a copy of the original species, but with a different Cp. Then, the Cp can be varied by varying the proportions of the species, potentially via source terms driven by UDM values.