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

host_to_node global variable

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 29, 2019, 08:02
Question host_to_node global variable
  #1
New Member
 
Paweł
Join Date: Nov 2015
Posts: 9
Rep Power: 10
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:

Code:
int number_of_injections;
int number_of_injections_DROP;
int number_of_injections_DUST;

DEFINE_EXECUTE_ON_LOADING(Check_Injections,libudf)
{
#if RP_HOST
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)
{
	number_of_injections++;
if(strncmp(dust_injection_key, I->name, strlen(dust_injection_key)) == 0)
	{
		number_of_injections_DUST++;
	}
if(strncmp(drop_injection_key, I->name, strlen(drop_injection_key)) == 0)
	{
		number_of_injections_DROP++;
	}
}
#endif

host_to_node_int_3(number_of_injections,number_of_injections_DUST,number_of_injections_DROP);

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
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ 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 was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
dpm, global variable, parallel code


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 686 December 22, 2022 09:10
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 02:40.