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

THREAD-ID in UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 6, 2013, 05:04
Default
  #21
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 15
Kanarya is on a distinguished road
thanks. no it is not working in parallel. what do you mean with thread ID?
I am using this one like ID "if( THREAD_ID(mixture_thread) == 4 )"
and it works in serial perfect but not in parallel.

thanks
Quote:
Originally Posted by zwbmimi View Post
Hi, i include the thread id in source terms of my uds. Does your code work well in parallel without the tread id? I'm happy to help.
Kanarya is offline   Reply With Quote

Old   March 6, 2013, 05:08
Default
  #22
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 15
Kanarya is on a distinguished road
are you using auto-partitioning or manual one?
thanks...
Quote:
Originally Posted by Kanarya View Post
thanks. no it is not working in parallel. what do you mean with thread ID?
I am using this one like ID "if( THREAD_ID(mixture_thread) == 4 )"
and it works in serial perfect but not in parallel.

thanks
Kanarya is offline   Reply With Quote

Old   March 6, 2013, 05:15
Default
  #23
New Member
 
W Z
Join Date: Nov 2010
Posts: 11
Rep Power: 15
zwbmimi is on a distinguished road
Hi Kanarya,

My code is like this,
DEFINE_SOURCE(source_1,c,t,dS,eqn)
{
int aaa = 4;

...

if (THREAD_ID(t) == aaa)
{
...
}
}
where t is the thread passed by FLUENT UDF Marco.

Quote:
Originally Posted by Kanarya View Post
are you using auto-partitioning or manual one?
thanks...
zwbmimi is offline   Reply With Quote

Old   March 6, 2013, 05:29
Default
  #24
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 15
Kanarya is on a distinguished road
are you using auto-partitioning or manual one?
thanks...

Quote:
Originally Posted by zwbmimi View Post
Hi Kanarya,

My code is like this,
DEFINE_SOURCE(source_1,c,t,dS,eqn)
{
int aaa = 4;

...

if (THREAD_ID(t) == aaa)
{
...
}
}
where t is the thread passed by FLUENT UDF Marco.
Kanarya is offline   Reply With Quote

Old   March 6, 2013, 05:34
Default
  #25
New Member
 
W Z
Join Date: Nov 2010
Posts: 11
Rep Power: 15
zwbmimi is on a distinguished road
Hi Kanarya,

Do you mean define the zones in geometry? Actually, my geometry has many zones. I define them when I drawn it.

Quote:
Originally Posted by Kanarya View Post
are you using auto-partitioning or manual one?
thanks...
zwbmimi is offline   Reply With Quote

Old   March 6, 2013, 05:43
Default
  #26
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 15
Kanarya is on a distinguished road
No. You parallelise it when you start the Fluent or after starting it.
Quote:
Originally Posted by zwbmimi View Post
Hi Kanarya,

Do you mean define the zones in geometry? Actually, my geometry has many zones. I define them when I drawn it.
Kanarya is offline   Reply With Quote

Old   March 6, 2013, 05:52
Default
  #27
New Member
 
W Z
Join Date: Nov 2010
Posts: 11
Rep Power: 15
zwbmimi is on a distinguished road
It should be auto partitioning.

Quote:
Originally Posted by Kanarya View Post
No. You parallelise it when you start the Fluent or after starting it.
zwbmimi is offline   Reply With Quote

Old   March 6, 2013, 07:11
Default
  #28
Senior Member
 
Join Date: May 2011
Posts: 231
Rep Power: 15
Kanarya is on a distinguished road
thanks a lot..I will try to deal with this!!

BEst regards...
Quote:
Originally Posted by zwbmimi View Post
It should be auto partitioning.
Kanarya is offline   Reply With Quote

Old   February 19, 2015, 00:54
Default Regarding ZONE ID in ICEM CFD!!!!!
  #29
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Quote:
Originally Posted by truffaldino View Post
Hello Nathan,

Yes I have solved the problem but it was a long time ago: I remember that it turns out that zone ID numbers must be taken as assigned by gambit (as in mesh file) and not as shown by fluent! That is why my procedure was not working. So, in file I have presented above, it was necessary to change values of idtop and idbottom to those given by gambit in mesh file.

Truffaldino
Hi everyone,

I am getting ACCESS VIOLATION ERROR, when I Initialize my case (WITH AN UDF FOR MASS FLUX).

This error, as I have came across is because of using a parameter which is not present or given in FLUENT (my case F_T(f, t) i.e, face temperature).

In my case I have used t = Lookup_Thread(d, ID). I have taken the ID from FLUENT BOUNDARY CONDITION PANEL. And my mesh was generated using ICEM CFD.

QUESTION:

How do you find out the ZONE ID in ICEM CFD????

I really have very less idea regarding GAMBIT.
Any help is of great use. Thanks in advance.

Bharadwaj
Bharadwaj B S is offline   Reply With Quote

Old   February 19, 2015, 04:09
Default
  #30
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Your problem is that the Fluent UDF tries to read face temperatures that don't exist.

Why do you want to find the zone id in ICEM CFD???

(That is like saying: "I have a problem with my car, it will not start. How do I get the serial number of my telephone?")
pakk is offline   Reply With Quote

Old   February 19, 2015, 05:04
Default Solved
  #31
Member
 
Baradwaj B S
Join Date: Jan 2015
Posts: 75
Rep Power: 11
Bharadwaj B S is on a distinguished road
Quote:
Originally Posted by pakk View Post
Your problem is that the Fluent UDF tries to read face temperatures that don't exist.

Why do you want to find the zone id in ICEM CFD???

(That is like saying: "I have a problem with my car, it will not start. How do I get the serial number of my telephone?")
Hi pakk,

First of all sorry for confusing. I was confused.

Thanks for your genuine and speedy reply, I was writing a UDF for mass flux from a sphere surface, which is present inside a flow domain.

I was able to write the same. (Thankfully). Just before few minutes ago.

Actually I have used F_T(f, t) as a variable in my flux logic. i.e,
flx = a * F_T(f, t);
where a is just a arbitrary constant.

Its a practice problem which I am doing in order to get grip in writing UDF.

And yes if I use the ZONE ID from FLUENT Boundary conditions tab. I was not able to hook the UDF to the specific sphere.

I opened the mesh in ICEM, while saving the output file in output tab, I gave the required ZONE ID(my case 13). And then I exported the mesh to fluent using Write/output.

Again thanks for your suggestion. I had not switched on the "energy equation", which was giving me an error during initialization. I switched on the energy equation and initialized with BC's (without hooking UDF). Once the case was initialized I hooked the UDF and got the result. Hurray.
Bharadwaj B S is offline   Reply With Quote

Old   December 15, 2015, 08:19
Default
  #32
New Member
 
Syed Aaquib Hazari
Join Date: Apr 2015
Location: Delft
Posts: 16
Rep Power: 10
hazari.aaquib is on a distinguished road
Dear All,,

I am facing the exact same problem (as previously mentioned, by Truffaldino) with my UDF where the statement if(Thread_ID==...) is ignored in the program.

I have to modify the specific dissipation rate at the interface of a stratified two phase channel flow.
The zone according to fluent is 2 for the interface.

Here is my UDF

# include "udf.h"
DEFINE_ADJUST(adjust_omega, mixture_domain)
{
real xc[ND_ND];
real abcd = 5;
cell_t c;
int ID = 2;
Thread *thread = Lookup_Thread(mixture_domain, ID);
thread_loop_c(thread, mixture_domain)
{
begin_c_loop(c, thread)
{
C_CENTROID(xc, c, thread);
if (THREAD_ID(thread) == ID)
{
C_O(c, thread) = 2927;
}
}
end_c_loop(c, thread)
}

}

According to the previous posts on this thread Truffaldino, solved the same problem (if(Thread_ID)==...) by finding out that gambit had a different values for zone ID than fluent.
I have used ANSYS meshing.

Any suggestions will be appreciated.
hazari.aaquib is offline   Reply With Quote

Old   December 15, 2015, 21:24
Default
  #33
New Member
 
W Z
Join Date: Nov 2010
Posts: 11
Rep Power: 15
zwbmimi is on a distinguished road
Quote:
Originally Posted by hazari.aaquib View Post
Dear All,,

I am facing the exact same problem (as previously mentioned, by Truffaldino) with my UDF where the statement if(Thread_ID==...) is ignored in the program.

I have to modify the specific dissipation rate at the interface of a stratified two phase channel flow.
The zone according to fluent is 2 for the interface.

Here is my UDF

# include "udf.h"
DEFINE_ADJUST(adjust_omega, mixture_domain)
{
real xc[ND_ND];
real abcd = 5;
cell_t c;
int ID = 2;
Thread *thread = Lookup_Thread(mixture_domain, ID);
thread_loop_c(thread, mixture_domain)
{
begin_c_loop(c, thread)
{
C_CENTROID(xc, c, thread);
if (THREAD_ID(thread) == ID)
{
C_O(c, thread) = 2927;
}
}
end_c_loop(c, thread)
}

}

According to the previous posts on this thread Truffaldino, solved the same problem (if(Thread_ID)==...) by finding out that gambit had a different values for zone ID than fluent.
I have used ANSYS meshing.

Any suggestions will be appreciated.

I think you may use the ID shown in Fluent. It can be found in the Boundary Condition Panel.
zwbmimi is offline   Reply With Quote

Old   December 16, 2015, 06:17
Default
  #34
New Member
 
Syed Aaquib Hazari
Join Date: Apr 2015
Location: Delft
Posts: 16
Rep Power: 10
hazari.aaquib is on a distinguished road
Hi zwbmimi,

I have used the fluent ID from the boundary conditions panel and even then the commands under if(THREAD_ID==...) is ignored.

Is there any other way?
hazari.aaquib is offline   Reply With Quote

Reply


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
How to access only one phase in multiphase model by UDF wersoe Fluent UDF and Scheme Programming 1 January 4, 2017 07:11
Parallelizing UDF Hattori Hanzo Fluent UDF and Scheme Programming 4 July 17, 2010 14:26
thread pointer comparison crash in Fluent UDF Miriam Main CFD Forum 0 August 31, 2008 16:40
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 14:37
UDF: Checking Thread Storage Greg Perkins FLUENT 0 March 10, 2000 20:35


All times are GMT -4. The time now is 08:51.