KR123: Access Distance of a cell from the nearest wall


The Macro described here returns the distance of the cell from the nearest wall in SI units.

This macro can be used in many applications such as specifying Wall function treatments, calculating Gradients and identifying cells near the wall.

Macro Argument Types

C_WALL_DIST (c, t) cell_t c, Thread *t

Returns

Distance of a cell from the nearest wall


Following UDF is to find the cells which are lying at a distance of 0.01m from the boundary.

/*Remember to initialize UDM from Fluent before running this UDF*/
#include "udf.h"
#include "mem.h"

DEFINE_ON_DEMAND(find_cell)
{
Domain *d; /* declare domain pointer since it is not passed as an argument to the DEFINE macro */
Thread *t;
cell_t c;
d = Get_Domain(1);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
if(C_WALL_DIST(c,t)<=0.001)
C_UDMI(c,t,0)=1;
}
end_c_loop(c,t)
}
}





Show Form
No comments yet. Be the first to add a comment!