CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   UDF for parallel use in combination with scheme possible? (https://www.cfd-online.com/Forums/main/230171-udf-parallel-use-combination-scheme-possible.html)

schwaral September 11, 2020 06:46

UDF for parallel use in combination with scheme possible?
 
Hi I have the follwoing code that comuptes the variable fnew. Depending on the value ><0 I set the variable veldirect to 0 or 1. Everything works fine in serial, but not in parallel.

In parallel the printed value for veldirect is always 0. I use this variable in a scheme code that is executed every timestep. I am not sure if this will affect the parallel usage. I tried several types of this code now but I am not really sure around which line I should use host or node execution. In other codes it was more intuitive to me.

[CODE]
**** calculated fnew here ****

DEFINE_ADJUST(adjust_UDS_bc, d)
{
#if !RP_NODE /*execute on host or in serial */
if (fnew >= 0)
{
RP_Set_Integer("veldirect", 0);
}
else
{
RP_Set_Integer("veldirect", 1);
}
#endif
}
[CODE]

node_to_host_int_1(count); this is something that migth be needed as well? But again I couldnt really understand where in my case to use.


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