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

Problem in Parallel UDF

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2008, 12:28
Default Problem in Parallel UDF
  #1
Giacomo de Renzi
Guest
 
Posts: n/a
Hello, I've a problem using UDF with Parallel Computing: the main part of the UDF is a DEFINE EXECUTE AT END macro that calculates the average temperature on a face. In Serial Computing it works, but in Parallel Computing (and I need it!!!) it doesn't work fine because the macro is read by all partitions, while the face belongs to only one partition, how can I select the partition that is involved in the macro??

the UDF is attached below:

DEFINE_EXECUTE_AT_END(DEAE_T_rack_NO1_in) { real A_tot = 0.0; real ma_sum = 0.0; real T_sum = 0.0;

step = CURRENT_TIMESTEP; current_time = CURRENT_TIME; if (current_time > step) { Domain *d = Get_Domain(1);

real A[ND_ND]; Thread *t; face_t f; int id=62 ; /* ZONE ID RACK-NO1-IN */ t= Lookup_Thread(d,id);

begin_f_loop(f,t) { F_AREA(A,f,t); T_sum = T_sum + (F_T(f,t) * NV_MAG(A)); ma_sum = ma_sum + NV_MAG(A); } end_f_loop(f,t)

T_rack_NO1_in=T_sum/ma_sum; RP_Set_Real("controllo_no1",T_rack_NO1_in); } else {

T_rack_NO1_in = t_init; RP_Set_Real("controllo_no1",T_rack_NO1_in);

}

printf("T_rack_NO1_in: %g\n", T_rack_NO1_in); }

thank You, I hope someone could help me.. Giacomo de Renzi
  Reply With Quote

Old   June 18, 2008, 05:05
Default Re: Problem in Parallel UDF
  #2
lzw
Guest
 
Posts: n/a
As Fluent USER GUIDE says, in the parallel mode, the grids are divided to several partitions. In any partition, the faces are three types: interior face, boundary face, and the external face. Thus, it is different to loop the faces from the serial mode. In your loop, you should use the macro PRINCIPAL_FACE_P(f,t) to limit the faces.
  Reply With Quote

Old   June 18, 2008, 06:17
Default Re: Problem in Parallel UDF
  #3
Giacomo de Renzi
Guest
 
Posts: n/a
Thank you for answering me.. I tried using PRINCIPAL_FACE_P macro, but the UDF doesn't work, when I compile it the seguent messagge occurs (referred to the line where I used PRINCIPAL_FACE_P):"THREAD_STORE: undecleared variable"

It's very strange because the whole UDF which I wrote is the same of the example I found in UDF manual (9.6 Parallel UDF example); the only difference between mine and manual one is that my general macro is a DEFINE_EXECUTE_AT_END whereas in the manual there is a DEFINE_ADJUST, so I must add " Domain *d = Get_Domain(1); ", and I added it inside the first #if cicle...

could you tell me something to solve my problem?? thank you, Giacomo
  Reply With Quote

Old   June 18, 2008, 07:46
Default Re: Problem in Parallel UDF
  #4
lzw
Guest
 
Posts: n/a
I tested the example(9.6 Parallel UDF example), and I changed the DEFINE_ADJUST to the DEFINE_EXECUTE_AT_END. There is no compiling error. "Domain *d = Get_Domain(1);" should be placed in the #if !RP_HOST. Generally, the parallel UDF should work fine in the serial mode.
  Reply With Quote

Old   June 18, 2008, 08:07
Default Re: Problem in Parallel UDF
  #5
Giacomo de Renzi
Guest
 
Posts: n/a
Thank you for answering, I didn't try to compiling directly the udf of the manual but I tried to compile the mine, that's different in some parts, even if it's very similar.

I'm a newuser of fluent and I've not got much experience, my udf is the seguent, considering that certainly you have more experience than me, can you find what's wrong in it??

the error occurs in the line where there's "if (PRINCIPAL_FACE_P(f,t))",

thank you very much, I hope you could solve my problem (I'm going to degree on july, and this is the last obstacle I have to pass!!) Giacomo

DEFINE_EXECUTE_AT_END(DEAE_T_rack_NO1_in) { int id = 0; real ma_sum = 0.0; real T_sum = 0.0;

#if !RP_HOST Domain *d = Get_Domain(1); real A[ND_ND]; Thread* t; face_t f; #endif /* !RP_HOST */

#if !RP_NODE id=62 ; /* ZONE ID RACK-NO1-IN */ #endif /* !RP_NODE */

host_to_node_int_1(id);

#if !RP_HOST t= Lookup_Thread(d,id);

begin_f_loop(f,t) if (PRINCIPAL_FACE_P(f,t)) { F_AREA(A,f,t); T_sum += F_T(f,t) * NV_MAG(A); ma_sum += NV_MAG(A); } end_f_loop(f,t)

#if RP_NODE ma_sum = PRF_GRSUM1(ma_sum); T_sum = PRF_GRSUM1(T_sum); #endif /* RP_NODE */

#endif /* !RP_HOST */

node_to_host_real_2(ma_sum,T_sum);

#if !RP_NODE T_rack_NO1_in = T_sum/ma_sum; RP_Set_Real("controllo_no1",T_rack_NO1_in); printf("T_rack_NO1_in: %g\n", T_rack_NO1_in); #endif /* !RP_NODE */

}

  Reply With Quote

Old   June 18, 2008, 08:43
Default Re: Problem in Parallel UDF
  #6
lzw
Guest
 
Posts: n/a
Hello, I tested your udf in my fluent 6.2.16. There is no error except the variable "T_rack_NO1_in". Is is defined yourself?
  Reply With Quote

Old   June 18, 2008, 08:55
Default Re: Problem in Parallel UDF
  #7
Giacomo de Renzi
Guest
 
Posts: n/a
really??? then I really don't understand why it doesn't work in my fluent (6.3.26, but I don't think it's a problem about version used)

(the variable T_rack_NO1_in is defined before, that's not a problem for me)

did you use interpreted or compiled udf??

I've been always using 'interpreted', could be this the problem?

thank you very much!!!

  Reply With Quote

Old   June 18, 2008, 09:07
Default Re: Problem in Parallel UDF
  #8
lzw
Guest
 
Posts: n/a
Oh, I just use the compile mode, as I like this mode. And if your program is a little complicated, you should compile it. In my computer, I have installed the Visual Studio 2005. I started the fluent in the Visual Studio Command Window. Then load the source file and compile it directly. But I just had a problem too. I have four computers, each one has four CPU cores. I have just loaded the parallel UDF in one computer successfully(four cores). I failed to load the UDF if I used two computers to parallel(eight cores).
  Reply With Quote

Old   June 18, 2008, 09:27
Default Re: Problem in Parallel UDF
  #9
Giacomo de Renzi
Guest
 
Posts: n/a
I didn't understand well.. are you saying to me that my udf in your computer works in serial and not in parallel computing??

now I'm trying to use compiled way, could you tell me other possibility I could try??

thank you very much, Giacomo
  Reply With Quote

Old   June 18, 2008, 09:37
Default Re: Problem in Parallel UDF
  #10
lzw
Guest
 
Posts: n/a
No, I tested your udf in parallel way. You can try to compile it. This is a good way to debug your program. My OS is windows server 2003, and the compiler is the cl.exe of the Visual Studio 2005.
  Reply With Quote

Old   June 18, 2008, 09:39
Default Re: Problem in Parallel UDF
  #11
lzw
Guest
 
Posts: n/a
I mean I just could parallel the multi-CPUs in one computer, failed in two computers. Thus, present I just use four CPU cores to parallel in my calculation.
  Reply With Quote

Old   June 18, 2008, 09:59
Default Re: Problem in Parallel UDF
  #12
Giacomo de Renzi
Guest
 
Posts: n/a
thank you, I'm going to try in compiled way and I let you know.. thank you very much, Giacomo
  Reply With Quote

Old   June 18, 2008, 13:19
Default Re: Problem in Parallel UDF
  #13
Giacomo de Renzi
Guest
 
Posts: n/a
I've just solved my problem!!! the problem was really that I used interpret udf instead of compiled one!!

thank you very much, Giacomo
  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
Parallel UDF problem Lindsay FLUENT 4 June 20, 2016 10:37
Parallel UDF Problem Dimitris Fluent UDF and Scheme Programming 7 September 20, 2013 02:51
parallel problem siyu Siemens 6 March 7, 2009 00:38
parallel problem rui Siemens 2 July 31, 2007 14:23
parallel UDF problem kerem FLUENT 2 June 20, 2006 07:56


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