Ansys > Fluent

Global maximum value of a variable in Fluent using UDF

(1/1)

infocfd:
Is there any way of accessing the value of a global maximum value in the domain using a UDF in fluent?

Thank you in advance.

william:
Hi,

The Global Maximum Value of a certain variable can be obtained through the User Defined Functions in Fluent using Global Maximum Macro PRF_GRHIGH1(x). This can be used to obtain the Global Minimum as well.

Here is the implementation that outputs the global maximum temperature in the domain:


--- Code: ---#include "udf.h"
DEFINE_ON_DEMAND(MaxTemp)
{
Domain *d;
d = Get_Domain(1); /* Get the domain using Fluent utility */
Thread *t;
cell_t c;
real T_maxx = 0;
real T_max = 0;
#if RP_NODE
{
thread_loop_c(t,d)
{
if (FLUID_THREAD_P(t))
{
begin_c_loop(c,t)
{
T_maxx = MAX(C_T(c,t), T_maxx);
}
end_c_loop(c,t)
}
}
}
#endif
 T_max = PRF_GRHIGH1(T_maxx);
Message("\n T_maxx %0.14f", T_maxx);
Message("\n T_max %0.14f", T_max);
}

--- End code ---

infocfd:
Thanks!

Navigation

[0] Message Index

Reply

Go to full version