CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

real ? rho ? cr ?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2011, 06:05
Default real ? rho ? cr ?
  #1
New Member
 
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 14
rezvan is on a distinguished road
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.
rezvan is offline   Reply With Quote

Old   September 5, 2011, 03:28
Default
  #2
New Member
 
Kristian Etienne Einarsrud
Join Date: Oct 2010
Location: Trondheim
Posts: 29
Rep Power: 15
KristianEtienne is on a distinguished road
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!
KristianEtienne is offline   Reply With Quote

Old   September 5, 2011, 13:19
Smile thanks
  #3
New Member
 
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 14
rezvan is on a distinguished road
thank u very much
rezvan is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 17:01.