I am trying to find the temperature gradient in the entire domain. While running the calculation in the ANSYS fluent 2021, R1, I want to be able to calculate the temperature gradient in the domain. For that, I am creating a new "report definition" by interpreting UDF code and creating a "report file", but while testing the code on the simple conduction problem, I am only getting 0 as output in the report file.
This is my code:
# include "udf.h"
# define domain_ID 2
DEFINE_ADJUST(adjust_gradient, domain)
{
Thread *t;
cell_t c;
face_t f;
domain = Get_Domain(domain_ID);
/* Fill UDS with the variable. */
thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
C_UDSI(c,t,0) = C_T_G(c,t)[0];
}
end_c_loop (c,t)
}
}
DEFINE_ON_DEMAND(store_gradient)
{
Domain *domain;
cell_t c;
Thread *t;
domain=Get_Domain(domain_ID);
/* Fill the UDM with magnitude of gradient. */
thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
C_UDMI(c,t,0) = NV_MAG(C_UDSI_G(c,t,0));
}
end_c_loop (c,t)
}
}
Kindly give necessary suggestions and comments.
Thankyou.