CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDFs run three times instead of just once (https://www.cfd-online.com/Forums/fluent-udf/214274-udfs-run-three-times-instead-just-once.html)

nvx January 25, 2019 10:34

[SOLVED] UDFs are run three times instead of just once
 
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.

pakk January 27, 2019 06:33

Could it be that you are running parallel with three nodes?

nvx January 27, 2019 06:40

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


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