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

What are C_VAR, F_VAR and THREAD_VAR ?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 24, 2017, 06:43
Default What are C_VAR, F_VAR and THREAD_VAR ?
  #1
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 11
SJSW is on a distinguished road
Hi~

I found some example udf on the internet were using C_VAR, F_VAR and THREAD_VAR.

The example is like
1.
Cell flow variables: C_var(c,t) = flow variable “var”
Where: var={R,P,U,V,W,T,H}
For: density,pressure,velocity(XYZ),temperature,enthalp y

2.
Boundary face flow variables: F_var(f,t) = flow variable “var”
and I found this in "species.h" :
F_VAR(f,THREAD,THREAD_VAR(THREAD).TYPE.yi[_ns]);
and this in "profile.h" :
F_VAR(f,t,prof)
It seems a property from the Boundary Condition setting for GUI?

3.
THREAD_VAR(tc).fluid.omega
THREAD VAR(t).fluid.porous

What are they and how to use@@?
For example, how to find the name behind THREAD_VAR(tc) or F_VAR, C_VAR, like fluid.omega?

Thank you!
SJSW is offline   Reply With Quote

Old   March 24, 2017, 08:41
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
The Fluent manual explains this all.
pakk is offline   Reply With Quote

Old   March 24, 2017, 08:50
Default
  #3
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 11
SJSW is on a distinguished road
I didn't find anything about C_VAR, F_VAR and THREAD_VAR in ANSYS Help of ANSYS 16.
The search result is 0.
I'll search other place.
Thank you~
SJSW is offline   Reply With Quote

Old   March 24, 2017, 09:42
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
It is hard to decode what you really want to know.

Code:
Cell flow variables: C_var(c,t) = flow variable “var”
Where: var={R,P,U,V,W,T,H}
I parse this as
Code:
C_R(c,t);
C_P(c,t);
C_U(c,t);
C_V(c,t); //and so on
Those are all things you can find in the Fluent manual, with a list of all those properties that can be extracted.


A literal answer to your last question: you can find it in c_fluid.h. But this is not at all useful, unless you want to work at Ansys and improve Fluent.
pakk is offline   Reply With Quote

Old   July 9, 2019, 10:37
Default error C2039 compiling define_adjust macro
  #5
Member
 
Hanye Azimi
Join Date: Oct 2016
Posts: 42
Rep Power: 9
ronak is on a distinguished road
Hi everybody
I've been trying to compile a define_adjust macro to define angular velocity. I get this error,then.


motion_spec' : is not a member of 'tv_cell_struct
see declaration of tv_cell_struct




part of this UDF is:

thread_loop_c(t,domain)
{
if (THREAD_VAR(t).cell.motion_spec == MOTION_TYPE_MOVING_GRID)
{
THREAD_VAR(t).cell.omega = omega;
}
}
Would you help me and advise me what to do.
Thanks a lot.
ronak is offline   Reply With Quote

Old   July 9, 2019, 10:50
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
You use
Code:
THREAD_VAR(t).cell.motion_spec
, but Fluent says that it this is not an existing variable.
This code segment is not found anywhere in the help, so I have no idea why you believe that this code is valid.


The solution is to replace it by valid code. Preferably valid code that does what you want. I have no idea what you want and how you arrived at this code, so I can not really help more...
pakk is offline   Reply With Quote

Old   July 10, 2019, 00:11
Default
  #7
Member
 
Hanye Azimi
Join Date: Oct 2016
Posts: 42
Rep Power: 9
ronak is on a distinguished road
Quote:
Originally Posted by pakk View Post
You use
Code:
THREAD_VAR(t).cell.motion_spec
, but Fluent says that it this is not an existing variable.
This code segment is not found anywhere in the help, so I have no idea why you believe that this code is valid.


The solution is to replace it with a valid code. Preferably valid code that does what you want. I have no idea what you want and how you arrived at this code, so I can not really help more...
Anyway, thank you!
ronak is offline   Reply With Quote

Old   July 16, 2019, 01:03
Default
  #8
Senior Member
 
Join Date: Jun 2014
Location: Taiwan
Posts: 100
Rep Power: 11
SJSW is on a distinguished road
It seems that C_VAR, F_VAR and THREAD_VAR are used for code developer since they are found in files with the extension "h" such as "species.h" and "profile.h".
SJSW is offline   Reply With Quote

Old   July 16, 2019, 09:03
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Yes, but if it is not mentioned in the manual then Ansys can choose to completely change the definitions in the next version of Fluent (without warning!) and your udf might not run anymore.

So if you want to have pressure, the following three might work now (I didn't bother looking up the exact grammar):
  • C_P(c,t)
  • C_VAR(c,t,PRESSURE)
  • THREAD_VAR(t).cell.pressure
But only the first one is documented in the Fluent manual, so use the first one!
pakk 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



All times are GMT -4. The time now is 10:45.