Atharva Nagarkar
Ansys Employee

Hello,

As Ansys employees, we cannot debug UDFs on this platform. However, can you share more details about the error you receive when you run the solution? 

One possible issue could be with the C_UDMI macro. You can use the C_UDMI macro to access or store the value of the user-defined memory in a cell. It can be used to allocate up to 500 memory locations in order to store and retrieve the values of cell field variables computed by UDFs. If the number of field variable values to be stored exceed 500, you may receive a memory storage error. Please find the link from the Ansys UDF Manual for this macro below.

Additionally, I have attached links from the Ansys UDF Manual for the DEFINE_SOURCE, DEFINE_EXECUTE_ON_LOADING and Gradient macros. Please ensure that you have appropriately used these macros.

DEFINE_SOURCE - 2.3. Model-Specific DEFINE Macros (ansys.com) -> Check section 2.3.43

DEFINE_EXECUTE_ON_LOADING - 2.2. General Purpose DEFINE Macros (ansys.com) -> Check section 2.2.6

Gradient - 3.2. Data Access Macros (ansys.com) -> Check section 3.2.3.7

C_UDMI - 3.2. Data Access Macros (ansys.com) -> Check section 3.2.12.4

If you are not able to access the link, please refer to this forum discussion: Using Help with links (ansys.com)

Thanks!