I wonder if the cell isn't passed to the macro, https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_DPMDEFINE.html Example 2.5.6.3 suggests you may need to tell the UDF about the cell, and thread: look for cell = PP_CELL(p) That may not fix the problem, but may get you a bit further.
Once you get it working please post the structure for others.