CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   F_YI(f,t,i) is creating a problem (

techy May 23, 2009 06:46

F_YI(f,t,i) is creating a problem
Hello everybody,

Here is the UDF

#include "udf.h"

FILE *fp;
float mfrac;
int i = 0;
int zone_ID = 2;
Thread *thread = Lookup_Thread(domain,zone_ID);
face_t f ;
fp = fopen("check.txt","w+");
begin_f_loop(f, thread)
mfrac = F_YI(f,thread,i); /* Here lies the problem */
end_f_loop(f, thread)

The zone_ID is for a wall.
I have compiled this successfully but it gives ACCESS VIOLATION.
But when i replace F_YI with F_T there is just no problem at all.
F_YI(f,thread,i) is causing this error.
But i am unable to figure out the mistake.
Any help is highly appreciated


techy May 23, 2009 07:30

there is a small mistake


as mfrac is defined as float
so i am using


but F_YI(f,t,i) is still causing that error

Please help somebody


Daniel Tanner May 23, 2009 09:54

Not sure what the problem is!
Are you sure F_T is working?
Some quick things to try:
1) Do you need to include "fstream.h"?
2) Should the face_t f; come before the Thread *thread... statement?
3) Remove the file commands (FILE, fp, fprintf, fclose) and see if that helps.
Sorry not sure why it has a problem. Good luck

techy May 24, 2009 03:10

yes Daniel F_T is working for sure.

I have tried everything you listed without
any effect.

Please help somebody its a bit urgent.


Daniel Tanner May 24, 2009 06:00

I saw the following on a different forum:

It gives some useful bits of info:
"The macros C_YI, F_YI cannot be used while using pdf combustion model.

The species mass fractions can be accessed using the macro Pdf_Yi(c,t,i). When using this macro, please include the library sg_pdf.h in your UDF."

Sorry, I have no other ideas!

techy May 24, 2009 11:23

thanks daniel

but i am only using species transport and nothing
means no benefit from Pdf_Yi

But i am sure this forum is
gonna certainly solve my problem.


byronsmith September 3, 2009 08:03

The problem is that mfrac is not defined as a array whereas F_YI(c,t,i) generates an arrray of mass fractions of species.

Byron SMith

SJSW April 2, 2015 05:36

I am using Non-premixed model in Ansys 14.0.
The description in*Species Fractions Calculations with the Non- and Partially- Premixed Models
says that "... Pdf_Yi(c, t, n) or Pdf_XY(c,t,x,y). The functions are defined in the header file pdf_props.h, which you will need to include in your UDF."

However, I would like to acquire the species fraction on a certain face.
In other cases without Non-premixed model, it should be F_YI(f,t,i).
Could anyone kindly tell me how to get the mass fraction on a face when using Non-premixed model?
Thank you!

All times are GMT -4. The time now is 23:34.