python scripting is possible, but you can also create a text file x y z coordinates, and use a formula based on them to create the internal heat generation data.
This text or csv file can be imported in Mechanical using external data.
https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/wb2_help/wb2h_MechLoadapp.html
-Aniket
How to access Ansys help links
Guidelines for Posting on Ansys Learning Forum