Rob
Ansys Employee

There are some examples in the UDF manual, and you may find some relevant solutions on the Customer Portal (https://support.ansys.com/AnsysCustomerPortal/en_us/Knowledge%20Resources/Solutions/FLUENT/328  looks like it might be useful).