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/)
-   -   Thread_name (https://www.cfd-online.com/Forums/fluent-udf/199718-thread_name.html)

denis.sanga@hotmail.it March 13, 2018 10:35

Thread_name
 
Goodmorning,
I'm writing a UDF with the function DEFINE_ADJUST(my_adjust,d) but I want that it works just only in some cell zones for computational cost matter. In the thread_loop_c(t,d) I don't understand how to compare the cell zone name in order to compare it with the name read from a file. Just to results clearer I used THREAD_ID(t) and it gave me the ID number of the current CELL ZONE analyzed but I need to read the name of that (for example fluid-1 as shown in the CELL ZONE CONDITION menu).
Or maybe someone have a more efficient solution with which by a journal file I can set the name of cell zone on which the my_adjust function have to operate.
Thank you very much
Best regards
Denis

obscureed March 13, 2018 11:38

Hi Denis,

For a thread pointer t, you can access THREAD_NAME(t). This returns a string, so then you can use strcmp and so on. However, THREAD_NAME(t) will return a blank unless you have issued the following Scheme command:
(update-solver-thread-names)

A frequent, but somewhat clunky, way to define a single thread (instead of a thread_loop_c) is to define a thread ID number (for example, from the Cell Zone Conditions window) and look up the thread from that in the UDF:
#DEFINE CELL_ZONE_ID 3
Domain *d;
Thread *t;

d = Get_Domain(1);
t = Lookup_Thread(d, CELL_ZONE_ID);

If you need to pass the ID to the UDF without recompiling, you need to look at RP-variables.

Good luck!
Ed

denis.sanga@hotmail.it March 13, 2018 11:48

Thank you very very much. I will try your suggestions immediately. Thank you!
Denis

denis.sanga@hotmail.it March 13, 2018 12:06

Just one more question. I'm using fluent 18.2. I tried to find in the console command the update-solver-thread-names path but I couldn't reach it. I'm sorry for my inexperience in fluent software.
Thank you very much for your help
Best regards
Denis

AlexanderZ March 13, 2018 23:38

  • copy with brackets
    Code:

    (update-solver-thread-names)
  • go to fluent
  • click console
  • in root use paste [ctrl+v]
  • enter
that's it

best regards


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