|
[Sponsors] |
August 30, 2011, 06:05 |
real ? rho ? cr ?
|
#1 |
New Member
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 15 |
hi,in this udf whats the meaning and aplication of these words:
("real" and "rho" and "cr[ND_ND] and "C_CENTROID(cr,c,t)" thank u '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''' #include "udf.h" DEFINE_PROPERTY(my_density, c, t) { real rho; real cr[ND_ND]; C_CENTROID(cr,c,t); if ( cr[0] >= 30. && cr[0] <= 40. && cr[1] >= 10. && cr[1] <= 20.) { rho =1000000000; } else { rho=1.0; //check that } return rho; } Last edited by rezvan; August 30, 2011 at 08:23. |
|
September 5, 2011, 03:28 |
|
#2 |
New Member
Kristian Etienne Einarsrud
Join Date: Oct 2010
Location: Trondheim
Posts: 29
Rep Power: 16 |
Hi,
"real" is a generic data type returning a "float" when using the single precision solver and "double" when using the double precision solver. The use of "real" thus automatically ensures that you are using the right format. "rho" is in this case the variable returned from your function. That is, the property you are defining by the DEFINE_PROPERTY() macro will take the value "rho. "cr[ND_ND]" is an array with ND ("Number of dimensions") values. For instance, if you are running a 2D simulation, "cr" will have two values, "cr[0]" and "cr[1]". "C_CENTROID(cr,c,t)" is a special macro which stores the position of a cell with pointer "c" and thread "t" in the variable "cr". Hence, in your "if(....)" statement, "cr[0] >= 30. && cr[0] <= 40." checks wheter the x-coordinate of a given cell in your domain ("cr[0]") is on the closed interval 30. to 40., correspondingly, "cr[1]" gives the y-coordinate. Cheers! |
|
September 5, 2011, 13:19 |
thanks
|
#3 |
New Member
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 15 |
thank u very much
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
error: uninitialized local variable 't' used | MASOUD | Fluent UDF and Scheme Programming | 5 | October 17, 2016 05:24 |
how to hook this udf | shanu | FLUENT | 1 | August 26, 2011 11:48 |
defining a term for a domain using DEFINE_ADJUST | MASOUD | Fluent UDF and Scheme Programming | 1 | September 24, 2010 06:08 |
enum | MASOUD | Fluent UDF and Scheme Programming | 0 | June 5, 2010 01:49 |
udf error | Rashmi | FLUENT | 0 | December 27, 2005 06:35 |