|
[Sponsors] |
August 31, 2016, 06:54 |
UDF Fluent running in Parallel mode
|
#1 |
New Member
Abhiroop Bhadra
Join Date: Jul 2016
Posts: 10
Rep Power: 10 |
Hi, I have a udf in Ansys Fluent and it is suppose to run only once in a timestep.
/************************************************** **********/ static int last_ts = -1; DEFINE_DPM_LAW(trial1,p,ci) { int curr_ts; curr_ts = N_TIME; if (last_ts != curr_ts) { last_ts = curr_ts; Message("Called"); } } /************************************************** **********/ On running fluent in serial mode it is being called once.But on running in parallel mode, it is called thrice in a timestep. I am new to udfs. Can anyone tell me why is this happening ? |
|
August 31, 2016, 07:04 |
|
#2 |
Member
Davoud Malekian
Join Date: Jan 2016
Posts: 53
Rep Power: 10 |
Hello,
How many processors you have allocated to your calculation? probably 3? actually parallel mode divide your domain into several subdomains (for parallel calculation as far as i know!! check it urself for making sure), in your case your domain has been divided into 3 subdomains by parallel mode and thats why you are getting 3 results in each time step. |
|
September 1, 2016, 18:19 |
|
#3 |
Member
Join Date: Jun 2016
Posts: 66
Rep Power: 11 |
When you start a parallel computation, your mesh is divided among the computer cores you allocated. Any UDF that you use is sent to every core by default. If you want to change it, you need to use directives, such as "if RP_NODE", "if RP_HOST" etc. First, read a bit about UDF parallelization in the UDF/Customization Manual. Once you understand how the commands are passed around the cores, you will find out that to write a paralllelized UDF is not hard.
The code you posted is just simple printing of a message in the console. It gets printed once for each core. If you want to have it printed only once in total, use Message0 instead of Message. This commands performs the print only from node 0. Some applications can become a bit more complicated. For example, if you want to integrate a quantity over the whole domain, you need to do it at each core, then send the partial results from all nodes to node 0 and then to sum it up. If you want to write the result in a file, you need to pass it to the host process. Anyway, that's just a very brief overview, I would recommend the manual, it is well understandable. |
|
Tags |
fluent, fluent - udf - parallel, fluent udf |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem running fluent with udf on batch | tobi b. | Fluent UDF and Scheme Programming | 3 | April 14, 2016 14:54 |
Reading a file from 32-bit Fluent 15.0 through a UDF for DPM in parallel | anthony05 | Fluent UDF and Scheme Programming | 0 | July 11, 2014 02:52 |
PROBLEM in UDF on parallel fluent mode | rakadit | Fluent UDF and Scheme Programming | 0 | July 13, 2012 07:51 |
Parallel running of Fluent | Bhanu Gupta | FLUENT | 3 | April 7, 2011 10:32 |
running multiple Fluent parallel jobs | Michael Bo Hansen | FLUENT | 8 | June 7, 2006 09:52 |