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

udf eror + Define property + density

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Amir
  • 1 Post By Amir

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 29, 2011, 08:54
Smile udf eror + Define property + density
  #1
New Member
 
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 14
rezvan is on a distinguished road
hi,I want to assign a high density (infinity) to a region of my 2D model.
I have writen the following code;

#include "udf.h"
DEFINE_PROPERTY(cell_density, cell, thread)
{
real density;
real grid_y = NODE_Y(cell, threads);
real grid_x = NODE_X(cell, threads);
if ( grid_x >= 30. && grid_x <= 40. )
{
if ( grid_y >= 10. && grid_y <= 20. )
{
density =1000000000;
}
}
}


but I have received the following error:

line 5: macro `NODE_Y' used with too many (2) args

can anyone help me with it?
rezvan is offline   Reply With Quote

Old   August 29, 2011, 09:24
Default
  #2
Member
 
fox000002's Avatar
 
Join Date: Apr 2009
Posts: 46
Rep Power: 17
fox000002 is on a distinguished road
See the definition:

Code:
#define NODE_Y(v) (NODE_COORD(v)[1])
fox000002 is offline   Reply With Quote

Old   August 29, 2011, 09:36
Default
  #3
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Hi,
you wouldn't need any UDF for this case; separate desired space and set different density.
__________________
Amir
Amir is offline   Reply With Quote

Old   August 29, 2011, 10:29
Default re
  #4
New Member
 
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 14
rezvan is on a distinguished road
hi,thanks for ur replying,you say true,but my teacher tell me that i should solve this problem with udf,please say me what i should to do?please write all of the udf(i am in the start of the writing udf)thanks
rezvan is offline   Reply With Quote

Old   August 29, 2011, 10:45
Default
  #5
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by rezvan View Post
hi,thanks for ur replying,you say true,but my teacher tell me that i should solve this problem with udf,please say me what i should to do?please write all of the udf(i am in the start of the writing udf)thanks
Dear Rezvan,
for such cases, we use cell values instead of node ones. I didn't check this UDF; check 2 rho vales:
Code:
#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;
}
Bests,
soheil_r7 likes this.
__________________
Amir
Amir is offline   Reply With Quote

Old   August 29, 2011, 20:56
Smile rep
  #6
New Member
 
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 14
rezvan is on a distinguished road
hi,i am really thank you,i take a lot of ur time,exuse me,when i interpreted this udf,acure this eror:
line 1: parse error.
plz help me
rezvan is offline   Reply With Quote

Old   August 29, 2011, 20:58
Default
  #7
New Member
 
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 14
rezvan is on a distinguished road
dear fox000002 ,hi,thank u a lot,i am in the start of writting udf,plz SITUATION your sentence in my udf
rezvan is offline   Reply With Quote

Old   August 30, 2011, 04:45
Default
  #8
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by rezvan View Post
hi,i am really thank you,i take a lot of ur time,exuse me,when i interpreted this udf,acure this eror:
line 1: parse error.
plz help me
Hi,
I checked that both as interpreted and compiled one and there is not any error!
maybe there is a problem in your text editor. use this attached file.

Bests,
Attached Files
File Type: c density.c (232 Bytes, 143 views)
__________________
Amir
Amir is offline   Reply With Quote

Old   August 30, 2011, 06:43
Default s
  #9
New Member
 
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 14
rezvan is on a distinguished road
hi,thank u a lot...with ur help,my problem solved,bud if u have time ,i am glading that u answer to my other guestions :
1=this program must be .h or .c ?
2=in this udf whats the meaning and aplication of these words:
("real" and "rho" and "cr[ND_ND] and "C_CENTROID(cr,c,t)"
3=and my importand guestion is that :
why u answer to my guestions and other guestion of every peaple ?and spend alot of ur time for me & others?

Last edited by rezvan; August 30, 2011 at 07:21.
rezvan is offline   Reply With Quote

Old   August 30, 2011, 08:12
Default
  #10
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by rezvan View Post
hi,thank u a lot...with ur help,my problem solved,bud if u have time ,i am glading that u answer to my other guestions :
1=this program must be .h or .c ?
this is a main program part which includes execution macro and should be stored in .C extension; .H extension are header files which are generally consist of class definitions such as udf.h. for more info, it's better to refer to C or C++ documentations.
Quote:
Originally Posted by rezvan View Post
2=in this udf whats the meaning and aplication of these words:
("real" and "rho" and "cr[ND_ND] and "C_CENTROID(cr,c,t)"
real-> type definition(float); it's a class
rho-> just a name; it's an object in real class
cr[ND_ND]-> self adjusting dimension array in 2D or 3D solvers; i.e., in 2D it's cr[2] and in 3D it's cr[3]
C_CENTROID(cr,c,t)-> it stores center cell coordinate of cell index c which belongs to thread t in array cr
Quote:
Originally Posted by rezvan View Post
3=and my importand guestion is that :
why u answer to my guestions and other guestion of every peaple ?and spend alot of ur time for me & others?
I'll be glad if I can help others; in this forum, you can improve your CFD knowledge regardless that you ask a question or answer that. Many questions don't take much time; like yours.

Bests,
rezvan likes this.
__________________
Amir
Amir is offline   Reply With Quote

Old   July 10, 2015, 04:30
Default property define
  #11
New Member
 
hassan
Join Date: Jul 2015
Posts: 3
Rep Power: 10
bazaee is on a distinguished road
hi my friends
i want define kinetic viscosity for fluent by UDFs.
but i am very weak in c programming.
this is my equation:

please help me/
thank you
bazaee is offline   Reply With Quote

Reply

Tags
define property, density, udf eror


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
URGENT custom property for UDF Sandilya Garimella FLUENT 0 May 19, 2008 12:35
Interpret three UDF for property Atsu FLUENT 4 April 22, 2006 15:04
UDF to change density in species transport Karthik FLUENT 6 December 8, 2004 18:19
Warning 097- AB Siemens 6 November 15, 2004 04:41
density update by UDF in non-premixed combustion IKSOO FLUENT 2 December 8, 2002 20:37


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