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/)
-   -   What are C_VAR, F_VAR and THREAD_VAR ? (https://www.cfd-online.com/Forums/fluent-udf/185382-what-c_var-f_var-thread_var.html)

SJSW March 24, 2017 06:43

What are C_VAR, F_VAR and THREAD_VAR ?
 
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!

pakk March 24, 2017 08:41

The Fluent manual explains this all.

SJSW March 24, 2017 08:50

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~

pakk March 24, 2017 09:42

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.

ronak July 9, 2019 10:37

error C2039 compiling define_adjust macro
 
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.

pakk July 9, 2019 10:50

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...

ronak July 10, 2019 00:11

Quote:

Originally Posted by pakk (Post 738442)
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!

SJSW July 16, 2019 01:03

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".

pakk July 16, 2019 09:03

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!


All times are GMT -4. The time now is 07:26.