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

UDFs run three times instead of just once

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 25, 2019, 10:34
Unhappy [SOLVED] UDFs are run three times instead of just once
  #1
nvx
New Member
 
Join Date: Jan 2019
Posts: 2
Rep Power: 0
nvx is on a distinguished road
Perhaps someone here will be able to help me with the following problem: even with a rather minimal UDF (see further), the included functions are always run three times instead of just once. For example, when I compile this source file:

Code:
#include "udf.h"

DEFINE_EXECUTE_ON_LOADING(on_loading, libname)
{
    Message("\n%s has been loaded.\n", libname);
}

DEFINE_EXECUTE_AT_END(fcn)
{
    Message("\n(Computing additional stuff)\n");
}
(obviously without any errors) and try to load it, it seems to be loaded three times -- see the three occurrences of "libudf has been loaded." in the log below:

Code:
[...]
make[3]: Leaving directory `/home/xxx/test/libudf/lnamd64/3ddp_node'
make[2]: Leaving directory `/home/xxx/test/libudf/lnamd64/3ddp_node'
make[1]: Leaving directory `/home/xxx/test/libudf/lnamd64/3ddp_node'

Opening library "/home/xxx/test/libudf"...
Library "/home/xxx/test/libudf/lnamd64/3ddp_host/libudf.so" opened
libudf has been loaded.

Opening library "/home/xxx/test/libudf"...
Library "/home/xxx/test/libudf/lnamd64/3ddp_node/libudf.so" opened
	on_loading
	fcn

UDF Autorun:
on_loading

libudf has been loaded.

Done.

Opening library "/home/xxx/test/libudf"...
Library "/home/xxx/test/libudf/lnamd64/3ddp_node/libudf.so" opened
libudf has been loaded.
Similarly, when I set the function "fcn" to be run at the end of iteration/time step via function hooks and run the simulation, the log looks like this:

Code:
  iter  continuity  x-velocity  y-velocity  z-velocity      energy           k     epsilon     time/iter
!  104 solution is converged
   104  9.1032e-04  4.3001e-04  1.7156e-04  1.2367e-04  1.4684e-16  7.1970e-04  9.9163e-04  0:00:00 200

(Computing additional stuff)

(Computing additional stuff)

(Computing additional stuff)
!  105 solution is converged
   105  9.1246e-04  4.1374e-04  1.6847e-04  1.2057e-04  1.4959e-16  6.9600e-04  9.7084e-04  0:01:03 199

Calculation complete.
Again, the message from the respective function ("(Computing additional stuff)") is shown three times. I have no clue why this could be happening...

Just for completeness' sake: I am using Fluent 19.1 on a linux machine.

Any help would be much appreciated.

nvx


EDIT (27 Jan):

Today I also tried to replicate the issue in a freshly-installed virtual machine (CentOS 7 x64). The result was identical to what I have been experiencing with the other linux machine. In other words, with the same minimal source code mentioned above, UDFs from the compiled library were always run three times.

Last edited by nvx; January 27, 2019 at 11:59. Reason: New information added
nvx is offline   Reply With Quote

Old   January 27, 2019, 06:33
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Could it be that you are running parallel with three nodes?
pakk is offline   Reply With Quote

Old   January 27, 2019, 06:40
Default
  #3
nvx
New Member
 
Join Date: Jan 2019
Posts: 2
Rep Power: 0
nvx is on a distinguished road
pakk,

Thank you for your response, it led me to the solution! After a lot of additional digging and testing it seems that Fluent runs both types of UDFs mentioned in the example on all compute nodes, i.e., including the master node. This was what confused me all along, because the number of UDF executions did not even match the number of specified parallel nodes...

nvx

Last edited by nvx; January 27, 2019 at 11:58.
nvx 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
Problem with foam-extend 4.0 ggi parallel run Metikurke OpenFOAM Running, Solving & CFD 1 December 6, 2018 15:51
Long loading times and unable to run with 4 cores in ANSYS AIM Vestdam ANSYS 0 October 4, 2018 03:10
Inconsistencies in reading .dat file during run time in new injection model Scram_1 OpenFOAM 0 March 23, 2018 22:29
parallel run is slower than serial run (pimpleFoam) !!! mechy OpenFOAM 18 August 17, 2016 17:19
Can not run OpenFOAM in parallel in clusters, help! ripperjack OpenFOAM Running, Solving & CFD 5 May 6, 2014 15:25


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