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

how to parallel a udf?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 17, 2016, 14:29
Default how to parallel a udf?
  #1
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
i wrote a udf code in order to correct some field quantity during every time step by using EXECUTE_AT_END macro. when i want to run code in parallel it seems the code does not have access to domain. in other words computing core can not work together. here is the code :

#include "udf.h"

DEFINE_EXECUTE_AT_END(Stabilazation)
{
Domain *d = Get_Domain(0);
cell_t c;
Thread *t;
real x[ND_ND];

thread_loop_c(t, d)
{

C_CENTROID(x, c, t);
Thread *t_water = THREAD_SUB_THREAD(t, 0);
Thread *t_air = THREAD_SUB_THREAD(t, 1);
begin_c_loop(c, t)

{

if (x[2] > 0.6)
C_VOF(c, t_air) = 1.0;
else
C_VOF(c, t_air) = 0.0;
}
end_c_loop(c, t)

}
}

any advice will be appreciated.
HyperNova is offline   Reply With Quote

Old   January 17, 2016, 15:06
Default
  #2
New Member
 
sepideh
Join Date: Mar 2014
Posts: 3
Rep Power: 12
ansys13 is on a distinguished road
i have encountered the similar problem, please try this modification:
#include "udf.h"

DEFINE_EXECUTE_AT_END(Stabilazation)
{
#if !RP_HOST
{
Domain *d = Get_Domain(0);
cell_t c;
Thread *t;
real x[ND_ND];

thread_loop_c(t, d)
{

C_CENTROID(x, c, t);
Thread *t_water = THREAD_SUB_THREAD(t, 0);
Thread *t_air = THREAD_SUB_THREAD(t, 1);
begin_c_loop(c, t)

{

if (x[2] > 0.6)
C_VOF(c, t_air) = 1.0;
else
C_VOF(c, t_air) = 0.0;
}
end_c_loop(c, t)

}
#endif
}
ansys13 is offline   Reply With Quote

Old   January 17, 2016, 16:43
Default
  #3
Senior Member
 
B_Kia
Join Date: May 2014
Location: Ir
Posts: 123
Rep Power: 11
HyperNova is on a distinguished road
Hi Sepide, thanks for your reply,
i must have examined 1000 ways to fix it. the one you mentioned was tested and same problem exists. another problem arises because i tried to share threads! so the modification you suggested does not work i am working on it and any new suggestion will be appreciated.
by the way i am a master student at khaje nasir university of technology.
HyperNova is offline   Reply With Quote

Old   January 19, 2016, 13:15
Default
  #4
New Member
 
Join Date: Sep 2013
Posts: 13
Rep Power: 12
RTN3000 is on a distinguished road
I'm in the same boat with trying to parallelize my code, but here's some things that I've found (which I haven't necessarily been able to implement successfully, segmentation faults everywhere) but might lead you in the right direction.

UDFs will be run on every single node, both compute and host nodes, so you'll have to state which nodes run which code by using compiler directives such as RP_NODE.

7.5.1 Compiler Directives

7.8 Parallel UDF Example

Hope this helps.

EDIT: Just noticed that ansys13 said the same thing I did. You might have to look into 7.5.9 Macros for Exchanging Data Between Compute Nodes to share the thread info. In my code, I'm trying to share the same data across nodes with use of reduction macros, but have been looking for better ways to do it.
RTN3000 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
"Define_Profile" UDF for parallel solver Antoine Fluent UDF and Scheme Programming 9 February 29, 2016 06:09
Problem in using UDF in parallel computing Yogini Fluent UDF and Scheme Programming 0 January 22, 2013 08:23
UDF Error with Parallel affter several step trantoan2008 Fluent UDF and Scheme Programming 0 January 7, 2013 07:33
Parallel UDF Error Andrew FLUENT 2 March 30, 2007 11:11
UDF in parallel version. yobee FLUENT 0 August 17, 2004 04:12


All times are GMT -4. The time now is 20:41.