CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

host_to_node global variable

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Search this Thread Display Modes
Old   October 29, 2019, 08:02
Question host_to_node global variable
New Member
Join Date: Nov 2015
Posts: 8
Rep Power: 6
Pablo86 is on a distinguished road
Dear all,

This is the part of UDF manual for Fluent:

Note that these host_to_node communication macros do not need to be "protected'' by compiler directives for parallel UDFs, because all of these macros automatically do the following:
  • send the variable value if compiled as the host version
  • receive and then set the local variable if compiled as a compute node version
  • do nothing in the serial version

I wonder if there is a possibility to set global variables for each compute node with this (or another) macro.

I am using this macro for DPM calculations. In my UDF the host recognizes different injection types and I would like it to pass the number of each injection type to every node. This is done on UDF loading, yet the values are required in subsequent macro (I don't want to check number and types of injections on every single time step calculation).

Here is the part of the code:

int number_of_injections;
int number_of_injections_DROP;
int number_of_injections_DUST;

int i;
Injection *I;						/* Pointer to the injection structure */
Injection *Ilist;					/* Pointer to the injection name type */
Ilist = Get_dpm_injections();

number_of_injections = 0;
number_of_injections_DROP = 0;
number_of_injections_DUST = 0;

loop(I, Ilist)
if(strncmp(dust_injection_key, I->name, strlen(dust_injection_key)) == 0)
if(strncmp(drop_injection_key, I->name, strlen(drop_injection_key)) == 0)


Message("There are %d injection(s) detected: %d dust injection(s) and %d drop injection(s)\n", number_of_injections, number_of_injections_DUST, number_of_injections_DROP);
While the host correctly recognise that there are 2 droplets and 3 dust injections, the nodes print incorrect values.

Any suggestion would be highly appriciated.
Pablo86 is offline   Reply With Quote

Old   October 30, 2019, 00:13
Senior Member
Join Date: Apr 2013
Posts: 1,203
Rep Power: 20
AlexanderZ will become famous soon enough
show output.
make a message on nodes only
problem could be in the way, how you define your variables (now you've defined them as global variables everywhere)
best regards

press LIKE if this message helped you

How to ask questions:
AlexanderZ is offline   Reply With Quote


dpm, global variable, parallel code

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[solidMechanics] Support thread for "Solid Mechanics Solvers added to OpenFOAM Extend" bigphil OpenFOAM CC Toolkits for Fluid-Structure Interaction 537 March 11, 2020 06:53
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
emag beta feature: charge density charlotte CFX 4 March 22, 2011 09:14
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 04:27

All times are GMT -4. The time now is 13:02.