|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 15 ![]() |
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? |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Member
Join Date: Apr 2009
Posts: 46
Rep Power: 17 ![]() |
See the definition:
Code:
#define NODE_Y(v) (NODE_COORD(v)[1]) |
|
![]() |
![]() |
![]() |
![]() |
#4 |
New Member
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 15 ![]() |
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
|
|
![]() |
![]() |
![]() |
![]() |
#5 | |
Senior Member
|
Quote:
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; }
__________________
Amir |
||
![]() |
![]() |
![]() |
![]() |
#6 |
New Member
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 15 ![]() |
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 |
|
![]() |
![]() |
![]() |
![]() |
#8 | |
Senior Member
|
Quote:
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,
__________________
Amir |
||
![]() |
![]() |
![]() |
![]() |
#9 |
New Member
rezvan
Join Date: Aug 2011
Location: Mashhad,iran
Posts: 10
Rep Power: 15 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#10 | |||
Senior Member
|
Quote:
Quote:
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:
![]() ![]() Bests,
__________________
Amir |
||||
![]() |
![]() |
![]() |
![]() |
#11 |
New Member
hassan
Join Date: Jul 2015
Posts: 3
Rep Power: 11 ![]() |
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 |
|
![]() |
![]() |
![]() |
Tags |
define property, density, udf eror |
|
|
![]() |
||||
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 |