|
[Sponsors] |
September 26, 2006, 03:46 |
How to retrieve thread id by name
|
#1 |
Guest
Posts: n/a
|
hi guys, does anybody of you know a good method to retrieve the id of a thread (you know, those shown in the boundary conditions panel) if I only know the name of the thread (e.g. ground)? I have to implement a function like
int thread_id = getThreadIDByName("ground"); but I have absolutely no idea how to get the id of "ground" without taking a look into the boundary conditions panel and adjust the sources. thanks for any help thomas |
|
September 26, 2006, 04:46 |
Re: How to retrieve thread id by name
|
#2 |
Guest
Posts: n/a
|
by typing :
surface list into the tui you get all id´s to all names. hope that helps |
|
September 26, 2006, 06:04 |
Re: How to retrieve thread id by name
|
#3 |
Guest
Posts: n/a
|
definitely helps. but do you know a way to call this from within the source code (I was thinking about doing this via CX_Interpret_String(char *) ) so that you can access the output? I was thinking about writing a *.fluent file that starts a transscript and cutting out the needed information from the generated file, but I want everything to happen automatically when I load the case into fluent and still don't know how to realise this best...
|
|
September 26, 2006, 06:07 |
Re: How to retrieve thread id by name
|
#4 |
Guest
Posts: n/a
|
sorry i can´t help you with that.
|
|
July 31, 2011, 04:13 |
|
#5 |
New Member
Olle Högblom
Join Date: Jan 2011
Posts: 5
Rep Power: 15 |
Hi Thomas!
Did you solve the problem of getting the thread ID from the name? I have exactly the same problem now... Thanks in advance! |
|
July 31, 2011, 21:56 |
|
#6 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Quote:
real ground_id; CX_Interpret_String("(if(not(rp-var-object 'ground-id))(rp-var-define 'ground-id -1 'integer #f) ())"); CX_Interpret_String("(if (zone-name->id 'ground)(rpsetvar 'ground-id (zone-name->id 'ground))(rpsetvar 'ground-id -1))"); ground_id=RP_Get_Integer("ground-id"); Note: The above code doesn't work in parallel solver. You need to use auto-load scheme file. For Fluent 12.1, you can loop over all the thread in you domain and use THREAD_NAME to judge whether the thread name is same as you specified. Then use THREAD_ID to get its id. |
||
August 1, 2011, 10:21 |
|
#7 | |
New Member
Olle Högblom
Join Date: Jan 2011
Posts: 5
Rep Power: 15 |
Quote:
I use Fluent 13 in parallel, do you mean that I can use THREAD_NAME(t) instead of THREAD_ID(t) in my loop? For example to access my cells in zone n: thread_loop_c (t,domain) { if ( NULL != THREAD_STORAGE(t,SV_T_G) ) { begin_c_loop (c,t) { if(THREAD_NAME(t) == "n") { } } end_c_loop (c,t) } } It doesn't seems to work, maybe I misunderstood you... Thanks for your help! |
||
August 2, 2011, 01:21 |
|
#8 | |
Senior Member
Join Date: Feb 2010
Posts: 164
Rep Power: 17 |
Quote:
|
||
March 29, 2021, 04:40 |
|
#9 |
Senior Member
AH
Join Date: Apr 2014
Posts: 282
Rep Power: 13 |
Interesting, a long way since this posting started. Now ANSYS 2021academic, just looking if any developments have occurred. Whether above code will work with parallel processing or not.
|
|
December 20, 2021, 03:36 |
|
#10 | |
New Member
Join Date: Sep 2010
Location: Wuhan, China
Posts: 23
Rep Power: 15 |
Quote:
/surface> list-surfaces surface group name id points 0D facets 1D facets 2D facets ------------------------- ---- --------- ---------- ----------- ----------- cylinder 0 0 0 0 0 inlet 2 0 0 0 0 int_fluid 3 0 0 0 0 outlet 1 0 0 0 0 x0 4 0 0 0 0 Total: 0 points, 0 facets. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf problem | jane | Fluent UDF and Scheme Programming | 37 | February 20, 2018 04:17 |
Guide: Getting Started with the CFD Online Discussion Forums | pete | Site Help, Feedback & Discussions | 8 | July 29, 2016 05:00 |
Please check out my parallelized udf code | aleisia | Fluent UDF and Scheme Programming | 0 | June 10, 2011 16:16 |
Parallelizing UDF | Hattori Hanzo | Fluent UDF and Scheme Programming | 4 | July 17, 2010 14:26 |
Phase locked average in run time | panara | OpenFOAM | 2 | February 20, 2008 14:37 |