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

PARALLELIZING UDF - node to host error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 29, 2011, 09:56
Default PARALLELIZING UDF - node to host error
  #1
Senior Member
 
Bionico's Avatar
 
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 15
Bionico is on a distinguished road
Hi everybody,
I'm trying to parallelize my udf: there are a DEFINE_ADJUST and a DEFINE_PROFILE (that depends on the first)
I put the basic compiler directives like #if !RP_HOST but I had some problem!

this is my UDF:

Code:
 
#include "udf.h"
real tm=0.00;
DEFINE_ADJUST(tsensor,d)
{
 
 real trif=0.0;
 real nt;
 
#if !RP_HOST
 real trif_coordinate[ND_ND];
 real x,y,z;
 
 Thread *t=Lookup_Thread(d,120573);
 cell_t c;
 printf("Node è %d", myid);
 nt=0.0;
 
 begin_c_loop(c,t)
  {
  C_CENTROID(trif_coordinate,c,t);
 
  x=trif_coordinate[0];
  y=trif_coordinate[1];
  z=trif_coordinate[2];
 
  if (sqrt(ND_SUM(pow(x+1.900,2.),pow(y+1.000,2.),pow(z-1.400,2.))) < 0.04)
    {
     trif=trif + C_T(c,t); 
     nt=nt+1.0;   
     printf("trif somma = %f\n", trif);  
     printf("nr celle = %f\n", nt);  
    }
  }
 end_c_loop(c,t)
 
 #if RP_NODE
 trif=PRF_GRSUM1(trif);
 nt=PRF_GRSUM1(nt);
 printf("trif = %f\n", trif);
 printf("nt = %f\n", nt);
 #endif
 
#endif
 
node_to_host_real_2(trif,nt);
 
#if !RP_NODE
 if (nt!=0)
   {
    tm=trif/nt;
   }
 printf("tm vale %f\n", tm);
#endif
 
} 
 
 
DEFINE_PROFILE(twall, thread, position)
{
 real tlim;
 face_t f;
 tlim=291.65;
  if (tm>tlim)
 
   begin_f_loop(f,thread)
 {
     F_PROFILE(f, thread, position) = 291.15-(tm-291.15);  
 }
   end_f_loop(f, thread)
 
 else
 
 begin_f_loop(f,thread)
 {
     F_PROFILE(f, thread, position) = 291.15;    
 }
   end_f_loop(f, thread)
}
It gives me this error

ERROR: /Fluent/..../.... line 175: function "mpnode_to_host_double_2" not found (pc=19)
ERROR: /Fluent/..../.... line 175: function "mpnode_to_host_double_2" not found (pc=399)
ERROR: /Fluent/..../.... line 175: function "mpnode_to_host_double_2" not found (pc=399)
...
etc...

why the macro node_to_host does not work?

Last edited by Bionico; December 29, 2011 at 11:24.
Bionico is offline   Reply With Quote

Old   December 29, 2011, 12:54
Default
  #2
Member
 
Join Date: Nov 2011
Location: Czech Republic
Posts: 97
Rep Power: 14
Sixkillers is on a distinguished road
Working for me (Fluent header files version 12.1 & GCC 4.6.2). Are you compiling or interpreting it?
Sixkillers is offline   Reply With Quote

Old   December 29, 2011, 13:23
Default
  #3
Senior Member
 
Bionico's Avatar
 
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 15
Bionico is on a distinguished road
Interpreting! Should I compile my udf?
Bionico is offline   Reply With Quote

Old   December 29, 2011, 16:36
Default
  #4
Member
 
Join Date: Nov 2011
Location: Czech Republic
Posts: 97
Rep Power: 14
Sixkillers is on a distinguished road
Definitely! Interpreted UDF are useful only for very simple problems. The only their advantage is you don't need to bother with configuration of a compiler. On the other hand compiled UDF can use whole potential of C programming language and also their performance is better. Here is lovely tutorial how to setup a compiler on a Windows platform.
Sixkillers is offline   Reply With Quote

Old   December 29, 2011, 17:25
Default
  #5
Senior Member
 
Bionico's Avatar
 
Flavio
Join Date: Sep 2011
Location: Brescia, Italy
Posts: 181
Rep Power: 15
Bionico is on a distinguished road
Thank you! I'll try to compile my UDF!
Can you give me some advice for Linux platform?
Bionico is offline   Reply With Quote

Old   December 30, 2011, 16:57
Default
  #6
Member
 
Join Date: Nov 2011
Location: Czech Republic
Posts: 97
Rep Power: 14
Sixkillers is on a distinguished road
For compiling on Linux systems just follow Fluent's UDF manual. It is really straightforward. Basically it consists of 2 files, which you need to customize. Personally I prefer compiling on Linux machines, because it is working out of the box and with little extra effort you can link an UDF against external libraries (e.g. GSL) and use it in your code.
Sixkillers is offline   Reply With Quote

Reply


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
polynomial thermophysical properties II sebastian OpenFOAM Running, Solving & CFD 54 November 21, 2019 07:12
error while running paraFoam! padmanathan OpenFOAM 9 October 13, 2009 05:17
How to get the max value of the whole field waynezw0618 OpenFOAM Running, Solving & CFD 4 June 17, 2008 05:07
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51
Problems of Duns Codes! Martin J Main CFD Forum 8 August 14, 2003 23:19


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