# real ? rho ? cr ?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 August 30, 2011, 05:05 real ? rho ? cr ? #1 New Member   rezvan Join Date: Aug 2011 Location: Mashhad,iran Posts: 10 Rep Power: 7 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 07:23.

 September 5, 2011, 02:28 #2 New Member   Kristian Etienne Einarsrud Join Date: Oct 2010 Location: Trondheim Posts: 29 Rep Power: 8 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, 12:19 thanks #3 New Member   rezvan Join Date: Aug 2011 Location: Mashhad,iran Posts: 10 Rep Power: 7 thank u very much

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post MASOUD Fluent UDF and Scheme Programming 5 October 17, 2016 04:24 shanu FLUENT 1 August 26, 2011 10:48 MASOUD Fluent UDF and Scheme Programming 1 September 24, 2010 05:08 MASOUD Fluent UDF and Scheme Programming 0 June 5, 2010 00:49 Rashmi FLUENT 0 December 27, 2005 06:35

All times are GMT -4. The time now is 04:57.