CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   how can i get the size of mesh with udf? (http://www.cfd-online.com/Forums/fluent-udf/123138-how-can-i-get-size-mesh-udf.html)

judgin September 5, 2013 05:48

how can i get the size of mesh with udf?
 
i'm writting a udf program to calculate the erosion rate of a workpiece. i want to get the mesh size with udf. with which macro can i get it?
thank you!

syavash September 5, 2013 15:11

Quote:

Originally Posted by judgin (Post 450028)
i'm writting a udf program to calculate the erosion rate of a workpiece. i want to get the mesh size with udf. with which macro can i get it?
thank you!

you may loop over the cells in your domain and using a counter to obtain cells number. This procedure can be done via a Define_on_demand macro.

DEFINE_ON_DEMAND(on_demand_calc)
{
Domain *d = Get_Domain(1); /* declare domain pointer since it is not passed as an argument to the DEFINE macro */
Thread *t;
cell_t c;
face_t f;
int n = 0;
thread_loop_c(t,d)
{
if (FLUID_THREAD_P(t))
{
begin_c_loop(c,t) /* loops over cells in a cell thread */
{
n += 1;
}
end_c_loop(c,t)
}
}
Message("grid size: %d\n", n);
}
Regards


All times are GMT -4. The time now is 05:22.